hexsha
stringlengths
40
40
size
int64
22
2.4M
ext
stringclasses
5 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
260
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
260
max_issues_repo_name
stringlengths
5
109
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
260
max_forks_repo_name
stringlengths
5
109
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
22
2.4M
avg_line_length
float64
5
169k
max_line_length
int64
5
786k
alphanum_fraction
float64
0.06
0.95
matches
listlengths
1
11
8082141c119db8002983cb619b53ebf4547c1c0f
2,007
c
C
drivers/wdm/vbi/nabtsfec/testing/nabtsdump/nabtsdump.c
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
drivers/wdm/vbi/nabtsfec/testing/nabtsdump/nabtsdump.c
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
drivers/wdm/vbi/nabtsfec/testing/nabtsdump/nabtsdump.c
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
#include <stdio.h> #define BIT(n) (((unsigned long)1)<<(n)) #define BITSIZE(v) (sizeof(v)*8) #define SETBIT(array,n) (array[(n)/BITSIZE(*array)] |= BIT((n)%BITSIZE(*array))) #define CLEARBIT(array,n) (array[(n)/BITSIZE(*array)] &= ~BIT((n)%BITSIZE(*array))) #define TESTBIT(array,n) (BIT((n)%BITSIZE(*array)) == (array[(n)/BITSIZE(*array)] & BIT(n%BITSIZE(*array)))) __cdecl main(int argc, char *argv[]) { unsigned long bitArr[32]; unsigned long pictureNumber[2]; int c, b, i; int lines; size_t bytes; FILE *fp; char *me; me = *argv++; --argc; while (argc-- > 0) { fp = fopen(*argv, "rb"); if (fp == NULL) { fprintf(stderr, "%s: Can't open \"%s\"; ", me, *argv); perror(""); continue; } b = 0; for ( ; ; ) { bytes = fread((void *)bitArr, 1, 128, fp); if (128 != bytes) { if (0 != bytes) { fprintf(stderr, "%s: Error reading bitmap; ", me); perror(""); } break; } bytes = fread((void *)pictureNumber, 1, 8, fp); if (8 != bytes) { if (0 != bytes) { fprintf(stderr, "%s: Error reading pictureNumber; ", me); perror(""); } break; } printf("pic# 0x%08x%08x.\n", pictureNumber[1], pictureNumber[0]); lines = 0; #if 0 if (TESTBIT(bitArr, 0)) printf("Odd "); else printf("Even "); #endif /*0*/ printf("Lines: "); for (i = 1; i < 1024; ++i) { if (TESTBIT(bitArr, i-1)) { printf("%d, ", i); ++lines; } } printf("Total = %d.\n", lines); while (lines > 0 && (c = getc(fp)) != EOF) { ++b; if (b % 37 == 1) printf("%3d%% ", (unsigned char)(c & 0xff)); else printf("%02x", (unsigned char)(c & 0xff)); if (b % 37 == 4) putchar(' '); if (b % 37 == 7) putchar(' '); if (b % 37 == 0) { putchar('\n'); --lines; } } if (c == EOF) break; } putchar('\n'); fclose(fp); } return 0; }
22.3
111
0.47434
[ "3d" ]
809be8db374a6e50b4654112612e946059de92a8
1,675
h
C
src/comet/event/event_manager.h
m4jr0/gameengine
8b63893ac65c5853852c1418550d2772c22cd10f
[ "MIT" ]
2
2018-09-15T21:18:26.000Z
2018-10-03T14:28:26.000Z
src/comet/event/event_manager.h
m4jr0/gameengine
8b63893ac65c5853852c1418550d2772c22cd10f
[ "MIT" ]
null
null
null
src/comet/event/event_manager.h
m4jr0/gameengine
8b63893ac65c5853852c1418550d2772c22cd10f
[ "MIT" ]
null
null
null
// Copyright 2021 m4jr0. All Rights Reserved. // Use of this source code is governed by the MIT // license that can be found in the LICENSE file. #ifndef COMET_COMET_EVENT_EVENT_MANAGER_H_ #define COMET_COMET_EVENT_EVENT_MANAGER_H_ #include "comet/event/event.h" #include "comet/utils/structure/ring_queue.h" #include "comet_precompile.h" namespace comet { namespace core { class Engine; } // namespace core namespace event { using EventListener = std::function<void(Event&)>; class EventManager { public: EventManager(std::size_t = 200); EventManager(const EventManager&) = delete; EventManager(EventManager&&) = delete; EventManager& operator=(const EventManager&) = delete; EventManager& operator=(EventManager&&) = delete; virtual ~EventManager() = default; void Register(const EventListener& function, const core::StringId& event_type); template <typename T, typename... Targs> void FireEventNow(Targs... args) { Dispatch(Event::Create<T>(args...)); } void FireEventNow(std::unique_ptr<Event> event); template <typename T, typename... Targs> void FireEvent(Targs... args) { std::scoped_lock<std::mutex> lock(mutex_); event_queue_.push(Event::Create<T>(args...)); } void FireEvent(std::unique_ptr<Event> event); private: friend core::Engine; mutable std::mutex mutex_; std::unordered_map<core::StringId, std::vector<EventListener>> listeners_; comet::utils::structure::ring_queue<std::unique_ptr<event::Event>> event_queue_; void Dispatch(std::unique_ptr<Event>); void FireAllEvents(); }; } // namespace event } // namespace comet #endif // COMET_COMET_EVENT_EVENT_MANAGER_H_
27.459016
76
0.723582
[ "vector" ]
80a0992ed11b7b65e7884976a2cf405fae6eed5f
246
h
C
src/main.h
maxest/MaxestFramework
aa396c2e15543ba4d62bb5cf908c3919e4e84fb7
[ "MIT" ]
9
2018-09-16T14:12:35.000Z
2021-06-20T19:03:11.000Z
src/main.h
maxest/MaxestFramework
aa396c2e15543ba4d62bb5cf908c3919e4e84fb7
[ "MIT" ]
null
null
null
src/main.h
maxest/MaxestFramework
aa396c2e15543ba4d62bb5cf908c3919e4e84fb7
[ "MIT" ]
3
2018-06-08T13:57:03.000Z
2018-11-21T12:54:18.000Z
#pragma once #include "essentials/main.h" #include "system/main.h" #include "math/main.h" #include "image/main.h" #include "mesh/main.h" #include "gpu/main.h" #include "net/main.h" #include "physics/main.h" #include "common/main.h"
18.923077
29
0.674797
[ "mesh" ]
80a78646857e4eca46f70ef3bf4df6fb322f5045
4,354
h
C
JNIChaos/JNIChaos.h
fast01/chaosframework
28194bcca5f976fd5cf61448ca84ce545e94d822
[ "Apache-2.0" ]
2
2020-04-16T13:20:57.000Z
2021-06-24T02:05:25.000Z
JNIChaos/JNIChaos.h
fast01/chaosframework
28194bcca5f976fd5cf61448ca84ce545e94d822
[ "Apache-2.0" ]
null
null
null
JNIChaos/JNIChaos.h
fast01/chaosframework
28194bcca5f976fd5cf61448ca84ce545e94d822
[ "Apache-2.0" ]
null
null
null
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class it_infn_chaos_JNIChaos */ #ifndef _Included_it_infn_chaos_JNIChaos #define _Included_it_infn_chaos_JNIChaos #ifdef __cplusplus extern "C" { #endif /* * Class: it_infn_chaos_JNIChaos * Method: initToolkit * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_initToolkit (JNIEnv *, jobject, jstring); /* * Class: it_infn_chaos_JNIChaos * Method: getNewControllerForDeviceID * Signature: (Ljava/lang/String;Lit/infn/chaos/type/IntReference;)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_getNewControllerForDeviceID (JNIEnv *, jobject, jstring, jobject); /* * Class: it_infn_chaos_JNIChaos * Method: setControllerTimeout * Signature: (II)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_setControllerTimeout (JNIEnv *, jobject, jint, jint); /* * Class: it_infn_chaos_JNIChaos * Method: getDeviceDatasetAttributeNameForDirection * Signature: (IILjava/util/Vector;)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_getDeviceDatasetAttributeNameForDirection (JNIEnv *, jobject, jint, jint, jobject); /* * Class: it_infn_chaos_JNIChaos * Method: initDevice * Signature: (I)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_initDevice (JNIEnv *, jobject, jint); /* * Class: it_infn_chaos_JNIChaos * Method: startDevice * Signature: (I)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_startDevice (JNIEnv *, jobject, jint); /* * Class: it_infn_chaos_JNIChaos * Method: setDeviceRunScheduleDelay * Signature: (II)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_setDeviceRunScheduleDelay (JNIEnv *, jobject, jint, jint); /* * Class: it_infn_chaos_JNIChaos * Method: stopDevice * Signature: (I)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_stopDevice (JNIEnv *, jobject, jint); /* * Class: it_infn_chaos_JNIChaos * Method: deinitDevice * Signature: (I)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_deinitDevice (JNIEnv *, jobject, jint); /* * Class: it_infn_chaos_JNIChaos * Method: fetchLiveData * Signature: (I)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_fetchLiveData (JNIEnv *, jobject, jint); /* * Class: it_infn_chaos_JNIChaos * Method: fetchLiveDatasetByDomain * Signature: (II)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_fetchLiveDatasetByDomain (JNIEnv *env, jobject obj, jint devID, jint domainType); /* * Class: it_infn_chaos_JNIChaos * Method: getJSONDescriptionForDataset * Signature: (IILjava/lang/StringBuffer;)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_getJSONDescriptionForDataset (JNIEnv *env, jobject obj, jint devID, jint domainType, jobject jsonDescription); /* * Class: it_infn_chaos_JNIChaos * Method: getStrValueForAttribute * Signature: (ILjava/lang/String;Ljava/lang/StringBuffer;)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_getStrValueForAttribute (JNIEnv *, jobject, jint, jstring, jobject); /* * Class: it_infn_chaos_JNIChaos * Method: setStrValueForAttribute * Signature: (ILjava/lang/String;Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_setStrValueForAttribute (JNIEnv *, jobject, jint, jstring, jstring); /* * Class: it_infn_chaos_JNIChaos * Method: getTimeStamp * Signature: (ILit/infn/chaos/type/IntReference;)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_getTimeStamp (JNIEnv *, jobject, jint, jobject); /* * Class: it_infn_chaos_JNIChaos * Method: submitSlowControlCommand * Signature: (ILjava/lang/String;IILit/infn/chaos/type/IntReference;IILjava/lang/String;)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_submitSlowControlCommand (JNIEnv *, jobject, jint, jstring, jint, jint, jobject, jint, jint, jstring); /* * Class: it_infn_chaos_JNIChaos * Method: deinitController * Signature: (I)I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_deinitController (JNIEnv *, jobject, jint); /* * Class: it_infn_chaos_JNIChaos * Method: deinitToolkit * Signature: ()I */ JNIEXPORT jint JNICALL Java_it_infn_chaos_JNIChaos_deinitToolkit (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif
27.556962
92
0.754708
[ "vector" ]
80be93fa5e30945eb0650b4ea1faa5f97611f041
1,244
h
C
MovEd1/CVProcessing.h
wrdeman/physics-in-motion
1e3044104783d6a0967585d0e8cc31c31499f695
[ "BSD-2-Clause" ]
null
null
null
MovEd1/CVProcessing.h
wrdeman/physics-in-motion
1e3044104783d6a0967585d0e8cc31c31499f695
[ "BSD-2-Clause" ]
null
null
null
MovEd1/CVProcessing.h
wrdeman/physics-in-motion
1e3044104783d6a0967585d0e8cc31c31499f695
[ "BSD-2-Clause" ]
null
null
null
// // CVProcessing.h // MovEd1 // // Created by Simon on 26/08/2013. // Copyright (c) 2013 Simon Osborne. All rights reserved. // #ifndef __MovEd1__CVProcessing__ #define __MovEd1__CVProcessing__ #include <vector> #include <algorithm> #include <iostream> #include <opencv2/highgui/cap_ios.h> #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/video/tracking.hpp" //#import "CVPlotting.h" //using namespace std; class CVProcessing{ private: cv::Point2f newpoint2f; cv::Size subPixWinSize, winSize; cv::TermCriteria termcrit; void cvAddPoint(int xtrans, int ytrans); std::vector<uchar> status; std::vector<float> err; protected: std::vector<cv::Point2f> plotPoints; cv::Mat previous, gray; public: //empty constructor CVProcessing(); void cvNewPoint(int x, int y); void cvDeletePoint(); void cvDeleteOrigin(); void cvTracking(cv::Mat image ,bool newPoints, int xtrans, int ytrans); int cvTrackedPoints(); void cvOrigin(int x, int y, int xtrans, int ytrans); std::vector<cv::Point2f> points[2]; std::vector<int> newpoint; std::vector<cv::Point2f> origin2f; }; #endif /* defined(__MovEd1__CVProcessing__) */
24.392157
75
0.697749
[ "vector" ]
80c8306d079ee15c5aa6b7876f4c7f81298e230c
2,514
c
C
examples/g2553/echo_port80.c
spirilis/w5200sock
a37d159dfcf31f5d617e5aa3ebf18efb26928e5d
[ "MIT" ]
2
2019-09-06T02:50:11.000Z
2019-09-25T04:45:09.000Z
examples/g2553/echo_port80.c
buddy-xl/w5200sock
a37d159dfcf31f5d617e5aa3ebf18efb26928e5d
[ "MIT" ]
null
null
null
examples/g2553/echo_port80.c
buddy-xl/w5200sock
a37d159dfcf31f5d617e5aa3ebf18efb26928e5d
[ "MIT" ]
1
2019-09-25T04:45:11.000Z
2019-09-25T04:45:11.000Z
#include <msp430.h> #include "uartcli.h" #include "uartdbg.h" #include <stdint.h> #include "w5200_config.h" #include "w5200_buf.h" #include "w5200_sock.h" // Using our new ip2binary routines for this... //const uint16_t myip[] = { 0x0A68, 0x73B4 }; // 10.104.115.180 //const uint16_t myip[] = { 0xC0A8, 0x00E6 }; // 192.168.0.230 volatile int res1, res2; char uartbuf[8]; #define RED_SET P1OUT|=BIT0 #define RED_CLEAR P1OUT&=~BIT0 #define GREEN_SET P4OUT|=BIT7 #define GREEN_CLEAR P4OUT&=~BIT7 int main() { int sockfd; uint8_t sockopen = 0; uint8_t netbuf[32]; P1DIR |= BIT0; P4DIR |= BIT7; RED_SET; GREEN_CLEAR; WDTCTL = WDTPW | WDTHOLD; DCOCTL = CALDCO_16MHZ; BCSCTL1 = CALBC1_16MHZ; BCSCTL2 = 0x00; BCSCTL3 = LFXT1S_2; __delay_cycles(160000); uartcli_begin(uartbuf, 8); wiznet_init(); while (!wiznet_phystate()) __delay_cycles(160000); wiznet_ip_str_w_reg(W52_SOURCEIP, "10.104.115.180"); wiznet_ip_bin_w_reg(W52_SUBNETMASK, w52_const_subnet_classC); sockfd = wiznet_socket(IPPROTO_TCP); if (sockfd < 0) LPM4; uartcli_print_str("wiznet_socket(): "); uartcli_println_int(sockfd); res1 = wiznet_bind(sockfd, 80); // Bind port 80 if (res1 < 0) LPM4; RED_CLEAR; while(1) { if (!sockopen) { res1 = wiznet_accept(sockfd); uartcli_print_str("accept; "); uartcli_println_int(res1); if (!res1 || res1 == -EISCONN) sockopen = 1; } else { res1 = wiznet_recv(sockfd, netbuf, 32, 1); uartcli_print_str("RECV: "); uartcli_println_int(res1); //wiznet_debug_uart(sockfd); switch (res1) { case -ENOTCONN: case -ECONNABORTED: case -ENETDOWN: sockopen = 0; break; case -EAGAIN: break; default: uartcli_println_str("sending;"); switch (res2 = wiznet_send(sockfd, netbuf, res1, 1)) { case -ENOTCONN: case -ECONNABORTED: case -ETIMEDOUT: case -ENETDOWN: uartcli_print_str("send failed: "); uartcli_println_int(res2); sockopen = 0; break; default: uartcli_print_str("send returned: "); uartcli_println_int(res2); } } } if (wiznet_irq_getsocket() == -EAGAIN && !wiznet_recvsize(sockfd)) { uartcli_println_str("LPM0;"); LPM0; uartcli_println_str("wake;"); } } return 0; } #pragma vector = PORT2_VECTOR __interrupt void P2_IRQ (void) { if(P2IFG & W52_IRQ_PORTBIT){ w5200_irq |= 1; __bic_SR_register_on_exit(LPM4_bits); // Wake up P2IFG &= ~W52_IRQ_PORTBIT; // Clear interrupt flag } }
23.495327
71
0.661098
[ "vector" ]
80de254387ed9b8f326ab5574b52cd9cd091df7b
3,412
h
C
src/base/roi.h
radionavlab/colmap
551efd8d33470fdafd79092d1da7c2c0bb700b2e
[ "BSD-3-Clause" ]
null
null
null
src/base/roi.h
radionavlab/colmap
551efd8d33470fdafd79092d1da7c2c0bb700b2e
[ "BSD-3-Clause" ]
null
null
null
src/base/roi.h
radionavlab/colmap
551efd8d33470fdafd79092d1da7c2c0bb700b2e
[ "BSD-3-Clause" ]
2
2018-08-29T17:31:29.000Z
2022-01-29T22:06:21.000Z
// Copyright (c) 2018, ETH Zurich and UNC Chapel Hill. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of ETH Zurich and UNC Chapel Hill 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 HOLDERS 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. // // Author: Tucker Haydon #ifndef COLMAP_SRC_BASE_ROI_H_ #define COLMAP_SRC_BASE_ROI_H_ #include <Eigen/Core> #include <vector> #include "util/logging.h" #include "util/misc.h" namespace colmap { struct PolyhedronFace { // POD std::vector<Eigen::Vector3d> points_; // Normal vector Eigen::Vector3d Normal() const { CHECK_GE(points_.size(), 3); Eigen::Vector3d v1 = points_[1] - points_[0]; Eigen::Vector3d v2 = points_[2] - points_[0]; Eigen::Vector3d n = v1.cross(v2); n = n / n.norm(); return n; }; }; struct Polyhedron { // POD std::vector<PolyhedronFace> faces_; static constexpr double BOUND = -1e-15; void LoadFromFile(const std::string& path) { std::vector<std::string> roi_lines = ReadTextFileLines(path); PolyhedronFace face; for(const std::string& line: roi_lines) { if(line[0] == '!') { faces_.push_back(face); face = PolyhedronFace(); continue; } if(line[0] == '#') { continue; } std::istringstream iss(line); std::vector<std::string> tokens( std::istream_iterator<std::string>{iss}, std::istream_iterator<std::string>()); Eigen::Vector3d point; for(size_t idx = 0; idx < 3; ++idx) { point(idx) = std::stod(tokens[idx]); } face.points_.push_back(point); } } // Is point contained within polyhedron bool Contains(const Eigen::Vector3d& point) const { for(const auto& face: faces_) { Eigen::Vector3d p2f = face.points_[0] - point; double d = p2f.dot(face.Normal()) / p2f.norm(); if(d < BOUND) { return false; } } return true; }; }; } // namespace colmap #endif // COLMAP_SRC_BASE_ROI_H_
35.175258
89
0.670281
[ "vector" ]
80e4d4b8c1cd9604bde4fcaa7e2201016521ea9d
10,438
h
C
ZTOBarCodeKit/Classes/Source/BCKCode.h
GoodWorkGoodStudy/ZTOBarCodeKit
4491fb7a2051bf8018361dc54333cb5490798394
[ "MIT" ]
null
null
null
ZTOBarCodeKit/Classes/Source/BCKCode.h
GoodWorkGoodStudy/ZTOBarCodeKit
4491fb7a2051bf8018361dc54333cb5490798394
[ "MIT" ]
null
null
null
ZTOBarCodeKit/Classes/Source/BCKCode.h
GoodWorkGoodStudy/ZTOBarCodeKit
4491fb7a2051bf8018361dc54333cb5490798394
[ "MIT" ]
null
null
null
// // BCKCode.h // BarCodeKit // // Created by Oliver Drobnik on 8/9/13. // Copyright (c) 2013 Oliver Drobnik. All rights reserved. // // Drawing options string constants extern NSString * const BCKCodeDrawingBarScaleOption; extern NSString * const BCKCodeDrawingPrintCaptionOption; extern NSString * const BCKCodeDrawingCaptionFontNameOption; extern NSString * const BCKCodeDrawingCaptionFontPointSizeOption; extern NSString * const BCKCodeDrawingMarkerBarsOverlapCaptionPercentOption; extern NSString * const BCKCodeDrawingFillEmptyQuietZonesOption; extern NSString * const BCKCodeDrawingDebugOption; extern NSString * const BCKCodeDrawingShowCheckDigitsOption; extern NSString * const BCKCodeDrawingBackgroundColorOption; extern NSString * const BCKCodeDrawingReduceBleedOption; extern NSString * const BCKCodeDrawingSizeWidthOption; extern NSString * const BCKCodeDrawingSizeHeightOption; extern NSString * const BCKCodeDrawingSuppressQuietZones; /** Caption Zones */ typedef NS_ENUM(NSUInteger, BCKCodeDrawingCaption) { /** The quiet zone to the left of the left start marker */ BCKCodeDrawingCaptionLeftQuietZone, /** The digit zone between the left start marker and the middle marker */ BCKCodeDrawingCaptionLeftNumberZone, /** The digit zone between the middle marker and the right end marker */ BCKCodeDrawingCaptionRightNumberZone, /** The quiet zone to the right of the right end marker */ BCKCodeDrawingCaptionRightQuietZone, /** The text zone between the left and right start and end markers */ BCKCodeDrawingCaptionTextZone }; /** This is the protocol all BCKCode subclasses must conform to. */ @protocol BCKCoding <NSObject> @required /** The array of individual code characters the barcode comprises. When subclassing BCKCode this array of BCKCodeCharacter instances make up the bit string representation of the barcode content string. Defaults to `nil`. */ @property (nonatomic, readonly) NSArray *codeCharacters; /** The barcode class' standard. For example "International standard ISO/IEC 15420". Defaults to `nil`. */ + (NSString *)barcodeStandard; /** Human readable description of the barcode class. For example "EAN-8". Defaults to `nil`. */ + (NSString *)barcodeDescription; /** Checks if the content string is encodable by the BCKCode subclass. Defaults to `NO`. @param content The content string to be encoded by the BCKCode subclass. Any check digits will be generated by the subclass and should not be included in the content string. @param error Optional output parameter providing an `NSError` in case the content string cannot be encoded by the BCKCode subclass. @return `YES` if the content string is encodable, in which case the error object is set to nil. `NO` if the contents can not be encoded, in which case the error object contains error information. */ + (BOOL)canEncodeContent:(NSString *)content error:(NSError **)error; @optional /** The caption text to display in the given caption zone. If you return `nil` then the digits are taken from @note Not implementing this method disables caption drawing altogether @param captionZone The BCKCodeDrawingCaption zone specifying the required text zone. @param options The rendering options. @return The caption text to display in this zone, or `nil` for no caption text. */ - (NSString *)captionTextForZone:(BCKCodeDrawingCaption)captionZone withRenderOptions:(NSDictionary *)options; /** @name Creating Barcodes */ /** Root initializer for subclasses of the BCKCode class cluster. You should not call this on BCKCode directly. Always use a concrete subclass depending on the kind of barcode you want to generate. The initializer copies the content string to the _content ivar. Subclasses only need to override this initializer if they add additional properties. This initialiser calls the subclass' canEncodeContent method to determine whether the content string can be encoded. @param content The content string to be encoded by the subclass. @param error Optional output parameter to take an `NSError` in case the content cannot be encoded by this barcode class. Pass `nil` if not error information is not required. @return The requested BCKCode subclass. Returns `nil` if the provided content cannot be encoded by the requested BCKCode subclass, the error object will then contain error details. */ - (instancetype)initWithContent:(NSString *)content error:(NSError**)error; /** @name Configuring barcodes */ /** The width of the horizontal quiet zone (in bar units) on the left and right sides of the barcode. Defaults to 0 to indicate there are no horizontal quiet zones. */ - (NSUInteger)horizontalQuietZoneWidth; /** The aspect ratio between the length and width of the rendered barcode. Defaults to 1. */ - (CGFloat)aspectRatio; /** The fixed height of the rendered barcode. Defaults to 0 to indicate there is no fixed height. */ - (CGFloat)fixedHeight; /** Whether the subclass allows for marker bars to extend into the bottom caption region. If `YES`, then the percentage of overlap can be specified with the BCKCodeDrawingMarkerBarsOverlapCaptionPercentOption. Defaults to `NO`. */ - (BOOL)markerBarsCanOverlapBottomCaption; /** Whether the barcode allows for quite zones to be filled with angle brackets. If `YES`, then quiet zones are filled if the BCKCodeDrawingFillEmptyQuietZonesOption is specified. Defaults to `NO`. */ - (BOOL)allowsFillingOfEmptyQuietZones; /** The font used for text captions if no other font is specified via BCKCodeDrawingCaptionFontNameOption. Defaults to Helvetica. */ - (NSString *)defaultCaptionFontName; /** Whether the barcode includes check digits in the caption printed below the barcode. By default any check digits that are NOT markers ARE included in the caption text. Subclasses can indicate support for excluding check digits from the caption by overriding this method and returning `YES`. Defaults to `NO`. */ - (BOOL)showCheckDigitsInCaption; /** @name Deprecated Methods */ /** Root initializer for sub-classes of the BCKCode class cluster. You should not call this on BCKCode directly, but always on concrete subclasses based on the kind of code you want to generate. @warning This method is deprecated, use - [BCKCode initWithContent:error:] instead. @param content The content string for the barcode. @return The requested BCKCode subclass. Returns `nil` if the content string cannot be encoded using the requested BCKCode subclass. */ - (instancetype)initWithContent:(NSString *)content __attribute__((deprecated("use - [BCKCode initWithContent:error:] instead"))) NS_SWIFT_UNAVAILABLE("use `init(content:) throws` instead"); @end /** This is the base class for all barcode variants: - BCKEAN8Code - EAN-8 - International Standard ISO/IEC 15420 - BCKEAN13Code - EAN-13 (13-digit EAN or 12-digit UPC-A) - International Standard ISO/IEC 15420 - BCKUPCECode - UPC-E (shortened UPC) - International Standard ISO/IEC 15420 - BCKCode39Code - Code 39 - international standard ISO/IEC 16388 - BCKCode93Code - Code 93 - no international standard - BCKInterleaved2of5Code - Interleaved 2 of 5 - International standard ISO/IEC 16390 - BCKCode128Code - Code 128 - International Standard ISO/IEC 15417 - BCKCode11Code - Code 11 - no international standard - BCKMSICode - MSI or Modified Plessey barcode - no international standard - BCKPharmacodeOneTrack - Pharmacode One Track - no international standard - BCKCodabarCode - Codabar - no international standard - BCKStandard2of5Code - Codabar - no international standard - BCKFacingIdentificationMarkCode - FIM - no international standard - BCKEAN2SupplementCode - no international standard - BCKEAN5SupplementCode - no international standard - BCKISBNCode - ISBN (10 and 13 characters) - International standard ISO 2108 - BCKISSNCode - ISSN - International standard ISO 3297 - BCKPOSTNETCode - POSTNET - no international standard - BCKISMNCode - ISMN = International standard ISO 10957) For rendering codes several options can be combined in an options dictionary: - **BCKCodeDrawingBarScaleOption** - Multiplier for the bar width (default: 1) - **BCKCodeDrawingPrintCaptionOption** - Whether the code caption should be printed (default: `YES`) - **BCKCodeDrawingCaptionFontNameOption** - Which font face name to use for the caption (default: 'OCRB' for EAN/UPC and 'Helvetica' otherwise) - **BCKCodeDrawingCaptionFontPointSizeOption** - Specifies a fixed value for the caption point size. Is usually calculated - **BCKCodeDrawingMarkerBarsOverlapCaptionPercentOption** - Percentage of the caption height covered by elongated marker bars (default: 1.0) - **BCKCodeDrawingFillEmptyQuietZonesOption** - Whether quiet zones should be filled with angle brackets (default: `NO`) - **BCKCodeDrawingDebugOption** - Whether caption areas should be tinted for debugging (default: `NO`) - **BCKCodeDrawingShowCheckDigitsOption** - Whether check digits are to be included in the printed caption (default: `NO`) - **BCKCodeDrawingBackgroundColorOption** - The background color to fill the drawing canvas with (default: none) - **BCKCodeDrawingReduceBleedOption** - Bars are drawn less wide to counteract bleeding on thermo printers (default: `NO`) - **BCKCodeDrawingSizeWidthOption** - Specify width of the barcode image - **BCKCodeDrawingSizeHeightOption** - Specify height of the barcode image - **BCKCodeDrawingSuppressQuietZones** - Enable/disable quite zones of the barcode */ @interface BCKCode : NSObject <BCKCoding> { NSString *_content; NSArray *_codeCharacters; // This ivar is declared as a public ivar to enable subclass access } /** @name Drawing Barcodes */ /** Renders the barcode symbol into a graphics context. @param context The graphics context to render into. @param options The rendering options. */ - (void)renderInContext:(CGContextRef)context options:(NSDictionary *)options; /** Calculates the graphics context's size using the provided rendering options. @param options An NSDictionary containig the requested rendering options. @returns The size required to fit the barcode's rendered barcode symbol. */ - (CGSize)sizeWithRenderOptions:(NSDictionary *)options; /** @name Getting Information about Barcodes */ /** The content string for the receiver that will be converted into the barcode. */ @property (nonatomic, readonly) NSString *content; @end
44.228814
460
0.780226
[ "render", "object" ]
80ece57225c1db8af052c3087092155c0b481ce7
66,374
c
C
src/best.c
streammy2013/mrbayes_3.2.6_parallel
b3b69ea32c365f430a0e8a5782640b17a70fe0c1
[ "Intel" ]
1
2017-07-13T14:50:06.000Z
2017-07-13T14:50:06.000Z
src/best.c
streammy2013/mrbayes_3.2.6_parallel
b3b69ea32c365f430a0e8a5782640b17a70fe0c1
[ "Intel" ]
null
null
null
src/best.c
streammy2013/mrbayes_3.2.6_parallel
b3b69ea32c365f430a0e8a5782640b17a70fe0c1
[ "Intel" ]
null
null
null
/* * Best 2.2 * * This file contains the functions * for calculating the probability of * gene trees given the species tree * and the prior probability of the * species tree * * Liang Liu * Department of Statistics * The Ohio State University * Columbus, Ohio * * liuliang@stat.ohio-state.edu */ #include "bayes.h" #include "best.h" #include "command.h" #include "mcmc.h" #include "model.h" #include "proposal.h" #include "utils.h" const char* const svnRevisionBestC = "$Rev: 1040 $"; /* Revision keyword which is expended/updated by svn on each commit/update */ /****************************** Local functions converted by Fredrik from BEST code *****************************/ int CompareDepths (const void *x, const void *y); int CompareDoubles (const void *x, const void *y); int CompareNodes (const void *x, const void *y); int CompareNodesByX (const void *x, const void *y); int GetSpeciesTreeFromMinDepths (Tree* speciesTree, double *depthMatrix); int GetDepthMatrix(Tree * speciesTree, double *depthMatrix); int GetMeanDist (Tree *speciesTree, double *depthMatrix, double *mean); int GetMinDepthMatrix (Tree **geneTrees, int numGeneTrees, double *depthMatrix); void LineagesIn (TreeNode* geneTreeNode, TreeNode* speciesTreeNode); double LnPriorProbGeneTree (Tree *geneTree, double mu, Tree *speciesTree, double *popSizePtr); double LnProposalProbSpeciesTree (Tree *speciesTree, double *depthMatrix, double expRate); void MapGeneTreeToSpeciesTree (Tree *geneTree, Tree *speciesTree); int ModifyDepthMatrix (double expRate, double *depthMatrix, RandLong *seed); /* Global BEST variables */ BitsLong **speciesPairSets; double *depthMatrix; /* Allocate variables used by best code during mcmc */ void AllocateBestChainVariables (void) { int i, j, index, numUpperTriang, nLongsNeeded; // Free if by mistake variables are already allocated if (memAllocs[ALLOC_BEST] == YES) FreeBestChainVariables (); // Allocate space for upper triangular pair sets numUpperTriang = (numSpecies * (numSpecies-1)) / 2; nLongsNeeded = ((numSpecies - 1) / nBitsInALong) + 1; speciesPairSets = (BitsLong **) SafeCalloc (numUpperTriang, sizeof(BitsLong *)); speciesPairSets[0] = (BitsLong *) SafeCalloc (numUpperTriang*nLongsNeeded, sizeof(BitsLong)); for (i=1; i<numUpperTriang; i++) speciesPairSets[i] = speciesPairSets[0] + i*nLongsNeeded; // Set upper triangular pair partitions once and for all index = 0; for (i=0; i<numSpecies; i++) { for (j=i+1; j<numSpecies; j++) { SetBit(i, speciesPairSets[index]); SetBit(j, speciesPairSets[index]); index++; } } /* allocate species for depthMatrix */ depthMatrix = SafeCalloc (numUpperTriang, sizeof(double)); memAllocs[ALLOC_BEST] = YES; } /** Compare function (Depth struct) for qsort */ int CompareDepths (const void *x, const void *y) { if ((*((Depth *)(x))).depth < (*((Depth *)(y))).depth) return -1; else if ((*((Depth *)(x))).depth > (*((Depth *)(y))).depth) return 1; else return 0; } /** Compare function (doubles) for qsort */ int CompareDoubles (const void *x, const void *y) { if (*((double *)(x)) < *((double *)(y))) return -1; else if (*((double *)(x)) > *((double *)(y))) return 1; else return 0; } /** Compare function (TreeNode struct) for qsort */ int CompareNodes (const void *x, const void *y) { if ((*((TreeNode **)(x)))->nodeDepth < (*((TreeNode**)(y)))->nodeDepth) return -1; else if ((*((TreeNode **)(x)))->nodeDepth > (*((TreeNode**)(y)))->nodeDepth) return 1; else return 0; } /** Compare function (TreeNode struct; sort by x, then by nodeDepth) for qsort */ int CompareNodesByX (const void *x, const void *y) { if ((*((TreeNode **)(x)))->x < (*((TreeNode**)(y)))->x) return -1; else if ((*((TreeNode **)(x)))->x > (*((TreeNode**)(y)))->x) return 1; else { if ((*((TreeNode **)(x)))->nodeDepth < (*((TreeNode**)(y)))->nodeDepth) return -1; else if ((*((TreeNode **)(x)))->nodeDepth > (*((TreeNode**)(y)))->nodeDepth) return 1; else return 0; } } /**----------------------------------------------------------------- | | FillSpeciesTreeParams: Fill in species trees (start value) | ------------------------------------------------------------------*/ int FillSpeciesTreeParams (RandLong *seed, int fromChain, int toChain) { int i, k, chn, numGeneTrees, freeBestChainVars; Param *p; Tree *speciesTree, **geneTrees; // Allocate space for global best model variables used in this function, in case they are not allocated if (memAllocs[ALLOC_BEST] == NO) { freeBestChainVars = YES; AllocateBestChainVariables(); } else freeBestChainVars = NO; // Use global variable numTopologies to calculate number of gene trees // There is one topology for the species tree, the other ones are gene trees // The number of current divisions is not safe because one gene tree can have // several partitions, for instance if we assign the different genes on the // mitochondrion different substitution models, or if we assign different rates // to the codon site positions in a sequence numGeneTrees = numTopologies - 1; geneTrees = (Tree **) SafeCalloc (numGeneTrees, sizeof(Tree*)); // Build species trees for state 0 for (chn=fromChain; chn<toChain; chn++) { for (k=0; k<numParams; k++) { p = &params[k]; if (p->paramType == P_SPECIESTREE) { // Find species tree and gene trees speciesTree = GetTree(p, chn, 0); for (i=0; i<p->nSubParams; i++) geneTrees[i] = GetTree(p->subParams[i], chn, 0); // Get minimum depth matrix for species tree GetMinDepthMatrix (geneTrees, numGeneTrees, depthMatrix); // Get a species tree from min depth matrix GetSpeciesTreeFromMinDepths(speciesTree, depthMatrix); assert (IsSpeciesTreeConsistent(speciesTree, chn) == YES); // Label the tips if (LabelTree (speciesTree, speciesNameSets[speciespartitionNum].names) == ERROR) { FreeBestChainVariables(); return (ERROR); } } } } // Free gene trees free (geneTrees); // Free best model variables if appropriate if (freeBestChainVars == YES) FreeBestChainVariables(); return (NO_ERROR); MrBayesPrint ("%lf", *seed); /* just because I am tired of seeing the unused parameter error msg */ } /**----------------------------------------------------------------- | | FreeBestChainVariables: Free best variables used during an mcmc | run. | ------------------------------------------------------------------*/ void FreeBestChainVariables(void) { if (memAllocs[ALLOC_BEST] == YES) { free (speciesPairSets[0]); free (speciesPairSets); speciesPairSets = NULL; } free (depthMatrix); depthMatrix = NULL; memAllocs[ALLOC_BEST] = NO; } /**--------------------------------------------------------------------- | | GetDepthMatrix: | | This algorithm calculates the upper triangular depth matrix for the | species tree. Time complexity O(n^2). | | @param speciesTree The species tree (in) | @param depthMatrix The minimum depth matrix, upper triangular array (out) | @returns Returns ERROR or NO_ERROR ----------------------------------------------------------------------*/ int GetDepthMatrix (Tree *speciesTree, double *depthMatrix) { int i, left, right, numUpperTriang, index, nLongsNeeded, freeBitsets; double maxDepth; TreeNode *p; // Make sure we have bitfields allocated and set freeBitsets = NO; if (speciesTree->bitsets == NULL) { AllocateTreePartitions(speciesTree); freeBitsets = YES; } else { ResetTreePartitions(speciesTree); // just in case freeBitsets = NO; } // Calculate number of values in the upper triangular matrix numUpperTriang = numSpecies * (numSpecies - 1) / 2; // Number of longs needed in a bitfield representing a species set nLongsNeeded = ((numSpecies -1) / nBitsInALong) + 1; // Set all cells to max maxDepth = speciesTree->root->left->nodeDepth; // root depth for (i=0; i<numUpperTriang; i++) depthMatrix[i] = maxDepth; // Loop over interior nodes for (i=0; i<speciesTree->nIntNodes; i++) { p = speciesTree->intDownPass[i]; for (left = FirstTaxonInPartition(p->left->partition, nLongsNeeded); left < numSpecies; left = NextTaxonInPartition(left, p->left->partition, nLongsNeeded)) { for (right = FirstTaxonInPartition(p->right->partition, nLongsNeeded); right < numSpecies; right = NextTaxonInPartition(right, p->right->partition, nLongsNeeded)) { index = UpperTriangIndex(left, right, numSpecies); depthMatrix[index] = p->nodeDepth; } } } // Free partitions if appropriate if (freeBitsets == YES) FreeTreePartitions(speciesTree); return (NO_ERROR); } /**--------------------------------------------------------------------- | | GetMeanDist | | This algorithm calculates the mean distance between a distance matrix | and the minimum depths that define a species tree. | | @param speciesTree The species tree (in) | @param minDepthMatrix The minimum depth matrix, upper triangular array (in) | @param mean The mean distance (out) | @returns Returns ERROR or NO_ERROR ----------------------------------------------------------------------*/ int GetMeanDist (Tree *speciesTree, double *minDepthMatrix, double *mean) { int i, left, right, index, nLongsNeeded, freeBitsets; double dist, minDist=0.0, distSum; TreeNode *p; // Make sure we have bitfields allocated and set freeBitsets = NO; if (speciesTree->bitsets == NULL) { AllocateTreePartitions(speciesTree); freeBitsets = YES; } else { ResetTreePartitions(speciesTree); // just in case freeBitsets = NO; } // Number of longs needed in a bitfield representing a species set nLongsNeeded = ((numSpecies -1) / nBitsInALong) + 1; // Loop over interior nodes distSum = 0.0; for (i=0; i<speciesTree->nIntNodes; i++) { p = speciesTree->intDownPass[i]; p->x = 0; while ((left=FirstTaxonInPartition(p->left->partition, nLongsNeeded)) < numSpecies) { while ((right=FirstTaxonInPartition(p->right->partition, nLongsNeeded)) < numSpecies) { p->x++; index = UpperTriangIndex(left, right, numSpecies); dist = depthMatrix[index] - p->nodeDepth; if (p->x == 1) minDist = dist; else if (dist < minDist) minDist = dist; ClearBit(right, p->right->partition); } ClearBit(left, p->left->partition); } distSum += minDist; } (*mean) = distSum / speciesTree->nIntNodes; // Reset partitions that were destroyed above or free partitions, as appropriate if (freeBitsets == YES) FreeTreePartitions(speciesTree); else ResetTreePartitions(speciesTree); return (NO_ERROR); MrBayesPrint ("%lf", *minDepthMatrix); /* just because I am tired of seeing the unused parameter error msg */ } /**--------------------------------------------------------------------- | | GetMinDepthMatrix: converted from GetMinDists. | | This algorithm scans the gene trees and calculates the minimum depth | (height) separating species across gene trees. The complexity of the | original algorithm was O(mn^3), where m is the number of gene trees and | n is the number of taxa in each gene tree. I think this algorithm has | complexity that is better on average, but the difference is small. | | I have rewritten the algorithm also to show alternative techniques that | could be used in this and other BEST algorithms. | | @param geneTrees The gene trees (in) | @param depthMatrix The minimum depth matrix, upper triangular array (out) | @returns Returns ERROR or NO_ERROR ----------------------------------------------------------------------*/ int GetMinDepthMatrix (Tree **geneTrees, int numGeneTrees, double *depthMatrix) { int i, j, w, nLongsNeeded, numUpperTriang, index, trace=0; double maxDepth; TreeNode *p; BitsLong **speciesSets; // Allocate space for species partitions nLongsNeeded = ((numSpecies -1) / nBitsInALong) + 1; // number of longs needed in a bitfield representing a species set speciesSets = (BitsLong **) SafeCalloc ((2*(size_t)numLocalTaxa-1), sizeof(BitsLong *)); speciesSets[0] = (BitsLong *) SafeCalloc ((2*(size_t)numLocalTaxa-1)*nLongsNeeded, sizeof(BitsLong)); for (i=1; i<2*numLocalTaxa-1; i++) speciesSets[i] = speciesSets[0] + i*nLongsNeeded; // Set tip species partitions once and for all for (i=0; i<numLocalTaxa; i++) SetBit(speciespartitionId[i][speciespartitionNum]-1, speciesSets[i]); // Set initial max depth for upper triangular matrix numUpperTriang = (numSpecies * (numSpecies - 1)) / 2; maxDepth = geneTrees[0]->root->left->nodeDepth; for (i=0; i<numUpperTriang; i++) depthMatrix[i] = maxDepth; // Now we are ready to cycle over gene trees for (w=0; w<numGeneTrees; w++) { if (trace) { printf ("\nGene %d\n",w); ShowTree(geneTrees[w]); } // Set species sets for interior nodes. O(n) for (i=0; i<geneTrees[w]->nIntNodes; i++) { p = geneTrees[w]->intDownPass[i]; for (j=0; j<nLongsNeeded; j++) speciesSets[p->index][j] = speciesSets[p->left->index][j] | speciesSets[p->right->index][j]; } // Now order the interior nodes in terms of node depth. We rely on the fact that the // ordered sequence is a valid downpass sequence. O(log n). qsort((void *)(geneTrees[w]->intDownPass), (size_t)(geneTrees[w]->nIntNodes), sizeof(TreeNode *), CompareNodes); // Finally find the minimum for each cell in the upper triangular matrix // This is the time critical step with complexity O(n^3) in the simplest // algorithm version. This algorithm should do a little better in most cases. for (i=0; i<numUpperTriang; i++) { // Find shallowest node that has the pair for (j=0; j<geneTrees[w]->nIntNodes; j++) { p = geneTrees[w]->intDownPass[j]; // Because nodes are ordered in time, if this test is true then we cannot beat the minimum if (p->nodeDepth > depthMatrix[i]) break; // Check whether the node is a candidate minimum for the species pair // If the test is true, we know from the test above that p->nodeDepth is // either a tie or the new minimum if (IsPartNested(speciesPairSets[i], speciesSets[p->index], nLongsNeeded) == YES) { depthMatrix[i] = p->nodeDepth; break; } } } } // Next gene tree if (trace) { index = 0; printf ("Mindepth matrix\n"); for (i=0;i<numSpecies;i++) { for (j=0; j<i; j++) printf (" "); for (j=i+1;j<numSpecies;j++) { printf ("%.6f ",depthMatrix[index]); index++; } printf ("\n"); } printf ("\n"); } free (speciesSets[0]); free (speciesSets); return (NO_ERROR); } /**--------------------------------------------------------------------- | | GetSpeciesTreeFromMinDepths: converted from GetConstraints, Startsptree, | and MaximumTree. | | This is a clustering algorithm based on minimum depths for species pairs. | It reduces an n choose 2 upper triangular min depth matrix to an array | of n-1 node depths, which fit onto a tree. | | @param speciesTree The species tree to be filled (out) | @param depthMatrix The min depth matrix, upper triangular array (in) | @returns Returns NO_ERROR if success, ERROR if negative brlens occur ----------------------------------------------------------------------*/ int GetSpeciesTreeFromMinDepths (Tree* speciesTree, double *depthMatrix) { int i, j, numUpperTriang, nLongsNeeded, index, nextNodeIndex; Depth *minDepth; PolyTree *polyTree; PolyNode *p, *q, *r, *u, *qPrev, *rPrev; nLongsNeeded = ((numSpecies - 1) / nBitsInALong) + 1; numUpperTriang = numSpecies*(numSpecies - 1) / 2; minDepth = (Depth *) SafeCalloc (numUpperTriang, sizeof(Depth)); // Convert depthMatrix to an array of Depth structs index = 0; for (i=0; i<numSpecies; i++) { for (j=i+1; j<numSpecies; j++) { minDepth[index].depth = depthMatrix[index]; minDepth[index].pairSet = speciesPairSets[index]; index++; } } // Sort the array of distance structs (O(log n^2)) qsort((void *)(minDepth), (size_t)(numUpperTriang), sizeof(Depth), CompareDepths); // The algorithm below reduces the upper triangular matrix (n choose 2) to an n-1 // array in O(n^2log(n)) time. We build the tree at the same time, since we can // find included pairs in the tree in log(n) time. We use a polytomous tree for this. // Allocate space for polytomous tree and set up partitions polyTree = AllocatePolyTree(numSpecies); AllocatePolyTreePartitions(polyTree); // Build initial tree (a bush) polyTree->isRooted = YES; polyTree->isClock = YES; polyTree->root = &polyTree->nodes[2*numSpecies-2]; for (i=0; i<numSpecies; i++) { p = &polyTree->nodes[i]; p->index = i; p->depth = 0.0; p->left = NULL; if (i<numSpecies-1) p->sib = &polyTree->nodes[i+1]; else p->sib = NULL; p->anc = polyTree->root; } p = polyTree->root; p->index = 2*numSpecies - 2; p->left = &polyTree->nodes[0]; p->sib = NULL; p->anc = NULL; p->depth = -1.0; polyTree->nNodes = numSpecies + 1; polyTree->nIntNodes = 1; GetPolyDownPass(polyTree); ResetPolyTreePartitions(polyTree); /* set bitsets (partitions) for initial tree */ // Resolve bush using sorted depth structs nextNodeIndex = numSpecies; for (i=0; i<numUpperTriang; i++) { // Find tip corresponding to first taxon in pair p = &polyTree->nodes[FirstTaxonInPartition(minDepth[i].pairSet, nLongsNeeded)]; // Descend tree until we find a node within which the pair set is nested do { p = p->anc; } while (!IsPartNested(minDepth[i].pairSet, p->partition, nLongsNeeded)); if (p->left->sib->sib != NULL) { // This node is still a polytomy // Find left and right descendants of new node qPrev = NULL; for (q=p->left; IsSectionEmpty(q->partition, minDepth[i].pairSet, nLongsNeeded); q=q->sib) qPrev = q; rPrev = q; for (r=q->sib; IsSectionEmpty(r->partition, minDepth[i].pairSet, nLongsNeeded); r=r->sib) rPrev = r; // Introduce the new node u = &polyTree->nodes[nextNodeIndex]; u->index = nextNodeIndex; nextNodeIndex++; polyTree->nIntNodes++; polyTree->nNodes++; u->left = q; u->anc = p; if (p->left == q) p->left = u; else qPrev->sib = u; // former upstream sibling to r should point to r->sib if (rPrev == q) u->sib = r->sib; else rPrev->sib = r->sib; if (q->sib == r) u->sib = r->sib; else u->sib = q->sib; u->depth = minDepth[i].depth; // because minDepth structs are sorted, we know this is the min depth assert (u->depth > 0.0); // Create new taxon set with bitfield operations for (j=0; j<nLongsNeeded; j++) u->partition[j] = q->partition[j] | r->partition[j]; // Patch the tree together with the new node added q->sib = r; r->sib = NULL; q->anc = u; r->anc = u; } else if (p == polyTree->root && p->depth < 0.0) { // This is the first time we hit the root of the tree && it is resolved p->depth = minDepth[i].depth; assert (p->depth > 0.0); } // other cases should not be added to tree } // Make sure we have a complete species tree assert (polyTree->nIntNodes == numSpecies - 1); // Set traversal sequences GetPolyDownPass(polyTree); // Set branch lengths from node depths (not done automatically for us) // Make sure all branch lengths are nonnegative (we can have 0.0 brlens, they // should not be problematic in a species tree; they occur when there are // ties in the min depth matrix that have not been modified by the move) for (i=0; i<polyTree->nNodes; i++) { p = polyTree->allDownPass[i]; if (p->anc == NULL) p->length = 0.0; else p->length = p->anc->depth - p->depth; if (p->length < 0.0) { FreePolyTree(polyTree); free (minDepth); return (ERROR); } } // Copy to species tree from polytomous tree CopyToSpeciesTreeFromPolyTree (speciesTree, polyTree); // Free locally allocated variables FreePolyTree(polyTree); free (minDepth); return(NO_ERROR); } /**--------------------------------------------------------------------------------------- | | IsSpeciesTreeConsistent: Called when user tries to set a species tree or when | attempting to use a species tree from a check point as starting value. | -----------------------------------------------------------------------------------------*/ int IsSpeciesTreeConsistent (Tree *speciesTree, int chain) { int i, answer, numGeneTrees, numUpperTriang, freeBestVars; double *speciesTreeDepthMatrix; Tree **geneTrees; answer = NO; freeBestVars = NO; if (memAllocs[ALLOC_BEST] == NO) { AllocateBestChainVariables(); freeBestVars = YES; } numGeneTrees = numTrees - 1; geneTrees = (Tree **) SafeCalloc (numGeneTrees, sizeof(Tree *)); for (i=0; i<numTrees-1; i++) geneTrees[i] = GetTreeFromIndex(i, chain, state[chain]); numUpperTriang = numSpecies * (numSpecies - 1) / 2; speciesTreeDepthMatrix = (double *) SafeCalloc (numUpperTriang, sizeof(double)); GetMinDepthMatrix(geneTrees, numGeneTrees, depthMatrix); GetDepthMatrix(speciesTree, speciesTreeDepthMatrix); for (i=0; i<numUpperTriang; i++) { if (depthMatrix[i] < speciesTreeDepthMatrix[i]) break; } if (i == numUpperTriang) answer = YES; else answer = NO; if (answer == NO) ShowNodes(speciesTree->root, 0, YES); if (freeBestVars == YES) FreeBestChainVariables(); free (speciesTreeDepthMatrix); free (geneTrees); return answer; } /**--------------------------------------------------------------------------------------- | | LineagesIn: Recursive function to get number of gene tree lineages coming into each | branch of the species tree (in ->x of speciestree nodes). We also assign each gene | tree lineage to the corresponding species tree lineage (in ->x of genetree nodes). | Finally, number of coalescent events is recorded (in ->y of speciestree nodes). | Time complexity is O(n). | -----------------------------------------------------------------------------------------*/ void LineagesIn (TreeNode *geneTreeNode, TreeNode *speciesTreeNode) { int nLongsNeeded; if (geneTreeNode->nodeDepth < speciesTreeNode->nodeDepth) { // climb up species tree if (speciesTreeNode->left == NULL) { assert (geneTreeNode->left == NULL); speciesTreeNode->x++; } else { nLongsNeeded = (numSpecies - 1) / nBitsInALong + 1; speciesTreeNode->x++; if (IsPartNested(geneTreeNode->partition, speciesTreeNode->left->partition, nLongsNeeded) == YES) LineagesIn (geneTreeNode, speciesTreeNode->left); else if (IsPartNested(geneTreeNode->partition, speciesTreeNode->right->partition, nLongsNeeded) == YES) LineagesIn (geneTreeNode, speciesTreeNode->right); } } else { // climb up gene tree if (geneTreeNode->left != NULL) LineagesIn(geneTreeNode->left, speciesTreeNode); if (geneTreeNode->right != NULL) LineagesIn(geneTreeNode->right, speciesTreeNode); if (geneTreeNode->left == NULL) { speciesTreeNode->x++; assert (speciesTreeNode->left == NULL); } else { speciesTreeNode->y++; } geneTreeNode->x = speciesTreeNode->index; } } /**----------------------------------------------------------------- | | LnSpeciesTreeProb: Wrapper for LnJointGeneTreeSpeciesTreePr to | free calling functions from retrieving gene and species trees. | ------------------------------------------------------------------*/ double LnSpeciesTreeProb(int chain) { int i, numGeneTrees; double lnProb; Tree **geneTrees, *speciesTree; ModelInfo *m; m = &modelSettings[0]; speciesTree = GetTree(m->speciesTree, chain, state[chain]); numGeneTrees = m->speciesTree->nSubParams; geneTrees = (Tree **) SafeCalloc (numGeneTrees, sizeof(Tree *)); for (i=0; i<m->speciesTree->nSubParams; i++) geneTrees[i] = GetTree(m->speciesTree->subParams[i], chain, state[chain]); lnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, speciesTree, chain); free (geneTrees); return lnProb; } /**----------------------------------------------------------------- | | LnJointGeneTreeSpeciesTreePr: Converted from LnJointGenetreePr, | SPLogLike, SPLogPrior. | | In this function we calculate the entire probability of the species | tree, including its probability given its priors, and the probability | of the gene trees given the species tree. | ------------------------------------------------------------------*/ double LnJointGeneTreeSpeciesTreePr(Tree **geneTrees, int numGeneTrees, Tree *speciesTree, int chain) { double lnPrior, lnLike, clockRate, mu, *popSizePtr, sR, eR, sF; int i; ModelInfo *m; ModelParams *mp; // Get model info for species tree m = &modelSettings[speciesTree->relParts[0]]; // Get model params for species tree mp = &modelParams[speciesTree->relParts[0]]; // Get popSize ptr popSizePtr = GetParamVals(m->popSize, chain, state[chain]); // Get clock rate if (speciesTree->isCalibrated == YES) clockRate = *GetParamVals(m->clockRate, chain, state[chain]); else clockRate = 1.0; // Calculate probability of gene trees given species tree // ShowNodes(speciesTree->root, 0, YES); lnLike = 0.0; mu = clockRate; for (i=0; i<numGeneTrees; i++) { lnLike += LnPriorProbGeneTree(geneTrees[i], mu, speciesTree, popSizePtr); } // Calculate probability of species tree given its priors if (strcmp(mp->speciesTreeBrlensPr, "Birthdeath") == 0) { sR = *GetParamVals(m->speciationRates, chain, state[chain]); eR = *GetParamVals(m->extinctionRates, chain, state[chain]); sF = mp->sampleProb; lnPrior = 0.0; LnBirthDeathPriorPr(speciesTree, clockRate, &lnPrior, sR, eR, mp->sampleStrat, sF); } else lnPrior = 0.0; // The population size is taken care of elsewhere return lnLike + lnPrior; } /**----------------------------------------------------------------- | | LnPriorProbGeneTree: Calculate the prior probability of a gene | tree. | ------------------------------------------------------------------*/ double LnPriorProbGeneTree (Tree *geneTree, double mu, Tree *speciesTree, double *popSizePtr) { int i, k, index, nEvents, trace=0; double N, lnProb, ploidyFactor, theta, timeInterval; TreeNode *p, *q=NULL, *r; ModelParams *mp; // Get model params mp = &modelParams[speciesTree->relParts[0]]; // Find ploidy setting if (strcmp(mp->ploidy, "Diploid") == 0) ploidyFactor = 4.0; else if (strcmp(mp->ploidy, "Haploid") == 0) ploidyFactor = 2.0; else /* if (strcmp(mp->ploidy, "Zlinked") == 0) */ ploidyFactor = 3.0; // Initialize species tree with theta in d for (i=0; i<speciesTree->nNodes-1; i++) { p = speciesTree->allDownPass[i]; if (strcmp(mp->popVarPr, "Equal") != 0) N = popSizePtr[p->index]; else N = popSizePtr[0]; p->d = ploidyFactor * N * mu; } // Map gene tree to species tree MapGeneTreeToSpeciesTree(geneTree, speciesTree); // Sort gene tree interior nodes first by speciestree branch on which they coalesce, then in time order qsort((void *)(geneTree->intDownPass), (size_t)(geneTree->nIntNodes), sizeof(TreeNode *), CompareNodesByX); // Debug output of qsort result if (trace) { printf ("index -- x -- nodeDepth for gene tree\n"); for (i=0; i<geneTree->nIntNodes; i++) printf ("%d -- %d -- %e\n", geneTree->intDownPass[i]->index, geneTree->intDownPass[i]->x, geneTree->intDownPass[i]->nodeDepth); } // Now calculate probability after making sure species tree nodes appear in index order // (the order does not have to be a correct downpass sequence) for (i=0; i<speciesTree->memNodes; i++) { p = &(speciesTree->nodes[i]); speciesTree->allDownPass[p->index] = p; } index = 0; lnProb = 0.0; for (i=0; i<speciesTree->nNodes-1; i++) { p = speciesTree->allDownPass[i]; // Get theta theta = p->d; // Get number of events nEvents = p->y; // Calculate probability lnProb += nEvents * log (2.0 / theta); for (k=p->x; k > p->x - p->y; k--) { q = geneTree->intDownPass[index]; assert (q->x == p->index); if (k == p->x) timeInterval = q->nodeDepth - p->nodeDepth; else { r = geneTree->intDownPass[index-1]; timeInterval = q->nodeDepth - r->nodeDepth; } lnProb -= (k * (k - 1) * timeInterval) / theta; index++; } if (p->x - p->y > 1) { if (nEvents == 0) timeInterval = p->anc->nodeDepth - p->nodeDepth; else timeInterval = p->anc->nodeDepth - q->nodeDepth; assert (p->anc->anc != NULL); assert (timeInterval >= 0.0); k = p->x - p->y; lnProb -= (k * (k - 1) * timeInterval) / theta; } } // Restore downpass sequences (probably not necessary for gene tree, but may be if some // code relies on intDownPass and allDownPass to be in same order) GetDownPass(speciesTree); GetDownPass(geneTree); // Free space FreeTreePartitions(speciesTree); FreeTreePartitions(geneTree); return lnProb; } /**--------------------------------------------------------------------- | | LnProposalProbSpeciesTree: | | This algorithm calculates the probability of proposing a particular | species tree given a distance matrix modified using a scheme based on | truncated exponential distributions with rate expRate. | | @param speciesTree The species tree (in) | @param depthMatrix The minimum depth matrix, upper triangular array (in) | @param expRate Rate of truncated exponential distribution | @returns Returns probability of proposing the species tree ----------------------------------------------------------------------*/ double LnProposalProbSpeciesTree (Tree *speciesTree, double *depthMatrix, double expRate) { int i, left, right, index, nLongsNeeded, freeBitsets; double dist, normConst=1.0, negLambdaX=0.0, eNegLambdaX, density, prob, sumDensRatio, prodProb, lnProb; TreeNode *p; // Make sure we have bitfields allocated and set freeBitsets = NO; if (speciesTree->bitsets == NULL) freeBitsets = YES; else freeBitsets = NO; AllocateTreePartitions(speciesTree); // Number of longs needed in a bitfield representing a species set nLongsNeeded = ((numSpecies -1) / nBitsInALong) + 1; // Loop over interior nodes lnProb = 0.0; for (i=0; i<speciesTree->nIntNodes; i++) { p = speciesTree->intDownPass[i]; p->x = 0; sumDensRatio = 0.0; prodProb = 1.0; for (left = FirstTaxonInPartition(p->left->partition, nLongsNeeded); left < numSpecies; left = NextTaxonInPartition(left, p->left->partition, nLongsNeeded)) { for (right = FirstTaxonInPartition(p->right->partition, nLongsNeeded); right < numSpecies; right = NextTaxonInPartition(right, p->right->partition, nLongsNeeded)) { p->x++; index = UpperTriangIndex(left, right, numSpecies); assert (index < numSpecies*(numSpecies - 1) / 2); dist = depthMatrix[index] - p->nodeDepth; // distance between depth matrix entry and actual species-tree node normConst = 1.0 - exp(-expRate * depthMatrix[index]); // normalization constant because of truncation of exp distribution negLambdaX = - expRate * dist; eNegLambdaX = exp(negLambdaX); density = expRate * eNegLambdaX / normConst; // density for x == dist, f(dist) prob = (1.0 - eNegLambdaX) / normConst; // cumulative prob for x <= dist, F(dist) sumDensRatio += density / prob; // warning: if dist==0, prob is ZERO! prodProb *= prob; } } if (p->x == 1) lnProb += log(expRate) + negLambdaX - log(normConst); else lnProb += log(sumDensRatio * prodProb); } // to avoid lnProposalProb is NaN at initial steps if (lnProb != lnProb) lnProb = 0.0; // Free partitions if appropriate if (freeBitsets == YES) FreeTreePartitions(speciesTree); return (lnProb); } /**----------------------------------------------------------------- | | MapGeneTreeToSpeciesTree: Fold gene tree into species tree. We | are going to use ->x of gene tree to give index of the | corresponding node in the species tree. ->x in the species | tree will give the number of lineages into the corresponding | branch, and ->y will give the number of coalescent events on | that branch. | ------------------------------------------------------------------*/ void MapGeneTreeToSpeciesTree (Tree *geneTree, Tree *speciesTree) { int i, j, nLongsNeeded, trace=0; TreeNode *p; // Initialize species partitions for both gene tree and species tree // This will set the partitions to reflect the partitions in the tree itself, // which is OK for the species tree, but we want the gene tree partitions to // reflect the species partitions and not the gene partitions, so we need to // set them here AllocateTreePartitions(geneTree); AllocateTreePartitions(speciesTree); nLongsNeeded = (numSpecies - 1) / nBitsInALong + 1; for (i=0; i<geneTree->nNodes-1; i++) { p = geneTree->allDownPass[i]; ClearBits(p->partition, nLongsNeeded); if (p->left == NULL) SetBit(speciespartitionId[p->index][speciespartitionNum]-1, p->partition); else { for (j=0; j<nLongsNeeded; j++) p->partition[j] = p->left->partition[j] | p->right->partition[j]; } } // Species tree partitions already set by call to AllocateTreePartitions // Reset ->x and ->y of species tree (->x of gene tree does not need to be initialized) for (i=0; i<speciesTree->nNodes; i++) { p = speciesTree->allDownPass[i]; p->x = 0; p->y = 0; } // Call recursive function to match gene tree and species tree LineagesIn(geneTree->root->left, speciesTree->root->left); if (trace) { printf ("index -- x -- y for species tree\n"); for (i=0; i<speciesTree->nNodes-1; i++) printf ("%-2d -- %d -- %d\n", speciesTree->allDownPass[i]->index, speciesTree->allDownPass[i]->x, speciesTree->allDownPass[i]->y); } if (trace) { printf ("index -- x -- nodeDepth for gene tree\n"); for (i=0; i<geneTree->nIntNodes; i++) printf ("%-2d -- %d -- %e\n", geneTree->intDownPass[i]->index, geneTree->intDownPass[i]->x, geneTree->intDownPass[i]->nodeDepth); } // Free space FreeTreePartitions(speciesTree); FreeTreePartitions(geneTree); } /**--------------------------------------------------------------------- | | ModifyDepthMatrix: | | This algorithm uses a truncated exponential distribution to modify | a depth matrix. | | @param expRate The rate of the exponential distribution (in) | @param depthMatrix The minimum depth matrix to be modified, upper triangular array (in/out) | @param seed Pointer to seed for random number generator (in/ut) | @returns Returns ERROR or NO_ERROR ----------------------------------------------------------------------*/ int ModifyDepthMatrix (double expRate, double *depthMatrix, RandLong *seed) { int i, numUpperTriang; double u, interval, delta; numUpperTriang = numSpecies * (numSpecies - 1) / 2; for (i=0; i<numUpperTriang; i++) { interval = depthMatrix[i]; u = RandomNumber(seed); delta = log (1.0 - u*(1.0 - exp(-expRate*interval))) / (-expRate); assert (delta <= interval); depthMatrix[i] -= delta; } return (NO_ERROR); } /**----------------------------------------------------------------- | | Move_GeneTree1: Propose a new gene tree using ExtSPRClock | | @param param The parameter (gene tree) to change | @param chain The chain number | @param seed Pointer to the seed of the random number gen. | @param lnPriorRatio Pointer to the log prior ratio (out) | @param lnProposalRatio Pointer to the log proposal (Hastings) ratio (out) | @param mvp Pointer to tuning parameter(s) ------------------------------------------------------------------*/ int Move_GeneTree1 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp) { int i, numGeneTrees, numUpperTriang; double newLnProb, oldLnProb, backwardLnProposalProb, forwardLnProposalProb, *oldMinDepths, *modMinDepths, forwardLambda, backwardLambda, mean; Tree *newSpeciesTree, *oldSpeciesTree, **geneTrees; ModelInfo *m; // Calculate number of gene trees numGeneTrees = numTopologies - 1; // Get model settings m = &modelSettings[param->relParts[0]]; // Get species tree (this trick is possible because we always copy tree params) newSpeciesTree = GetTree (m->speciesTree, chain, state[chain]); oldSpeciesTree = GetTree (m->speciesTree, chain, state[chain] ^ 1); // Get gene trees geneTrees = (Tree **) SafeCalloc (2*numGeneTrees, sizeof(Tree *)); for (i=0; i<m->speciesTree->nSubParams; i++) { geneTrees[i] = GetTree(m->speciesTree->subParams[i], chain, state[chain]); } // Allocate space for depth matrix copy numUpperTriang = numSpecies * (numSpecies - 1) / 2; oldMinDepths = (double *) SafeCalloc (2*numUpperTriang, sizeof(double)); modMinDepths = oldMinDepths + numUpperTriang; // Get min depth matrix for old gene trees GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix); // Save a copy for (i=0; i<numUpperTriang; i++) oldMinDepths[i] = depthMatrix[i]; // Get forward lambda GetMeanDist(oldSpeciesTree, depthMatrix, &mean); // if (mean < 1E-6) mean = 1E-6; forwardLambda = 1.0 / mean; // Calculate joint probability of old gene trees and old species tree oldLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, oldSpeciesTree, chain); // Modify the picked gene tree using code from a regular MrBayes move Move_ExtSPRClock(param, chain, seed, lnPriorRatio, lnProposalRatio, mvp); // Update the min depth matrix GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix); // Copy the min depth matrix for (i=0; i<numUpperTriang; i++) modMinDepths[i] = depthMatrix[i]; // Modify the min depth matrix ModifyDepthMatrix (forwardLambda, modMinDepths, seed); // Get a new species tree if (GetSpeciesTreeFromMinDepths (newSpeciesTree, modMinDepths) == ERROR) { abortMove = YES; free (geneTrees); free (oldMinDepths); return (NO_ERROR); } // Calculate joint probability of new gene trees and new species tree newLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, newSpeciesTree, chain); // Get backward lambda GetMeanDist(newSpeciesTree, depthMatrix, &mean); // if (mean < 1E-6) mean = 1E-6; backwardLambda = 1.0 / mean; // Get proposal probability of old species tree backwardLnProposalProb = LnProposalProbSpeciesTree (oldSpeciesTree, oldMinDepths, backwardLambda); // Get proposal probability of new species tree forwardLnProposalProb = LnProposalProbSpeciesTree (newSpeciesTree, depthMatrix, forwardLambda); // Update prior ratio taking species tree into account (*lnPriorRatio) += (newLnProb - oldLnProb); // Update proposal ratio based on this move (*lnProposalRatio) += (backwardLnProposalProb - forwardLnProposalProb); // Free allocated memory free (geneTrees); free (oldMinDepths); return (NO_ERROR); } /**----------------------------------------------------------------- | | Move_GeneTree2: Propose a new gene tree using NNIClock | | @param param The parameter to change | @param chain The chain number | @param seed Pointer to the seed of the random number gen. | @param lnPriorRatio Pointer to the log prior ratio (out) | @param lnProposalRatio Pointer to the log proposal (Hastings) ratio (out) | @param mvp Pointer to tuning parameter(s) ------------------------------------------------------------------*/ int Move_GeneTree2 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp) { int i, numGeneTrees, numUpperTriang; double newLnProb, oldLnProb, backwardLnProposalProb, forwardLnProposalProb, *oldMinDepths, *modMinDepths, forwardLambda, backwardLambda, mean; Tree *newSpeciesTree, *oldSpeciesTree, **geneTrees; ModelInfo *m; // Calculate number of gene trees numGeneTrees = numTopologies - 1; // Get model settings m = &modelSettings[param->relParts[0]]; // Get species tree (this trick is possible because we always copy tree params) newSpeciesTree = GetTree (m->speciesTree, chain, state[chain]); oldSpeciesTree = GetTree (m->speciesTree, chain, state[chain] ^ 1); // Get gene trees geneTrees = (Tree **) SafeCalloc (2*numGeneTrees, sizeof(Tree *)); for (i=0; i<m->speciesTree->nSubParams; i++) { geneTrees[i] = GetTree(m->speciesTree->subParams[i], chain, state[chain]); } // Allocate space for depth matrix copy numUpperTriang = numSpecies * (numSpecies - 1) / 2; oldMinDepths = (double *) SafeCalloc (2*numUpperTriang, sizeof(double)); modMinDepths = oldMinDepths + numUpperTriang; // Get min depth matrix for old gene trees GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix); // Save a copy for (i=0; i<numUpperTriang; i++) oldMinDepths[i] = depthMatrix[i]; // Get forward lambda GetMeanDist(oldSpeciesTree, depthMatrix, &mean); // if (mean < 1E-6) mean = 1E-6; forwardLambda = 1.0 / mean; // Calculate joint probability of old gene trees and old species tree oldLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, oldSpeciesTree, chain); // Modify the picked gene tree using code from a regular MrBayes move (no tuning parameter, so passing on mvp is OK) Move_NNIClock(param, chain, seed, lnPriorRatio, lnProposalRatio, mvp); // Update the min depth matrix GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix); // Copy the min depth matrix for (i=0; i<numUpperTriang; i++) modMinDepths[i] = depthMatrix[i]; // Modify the min depth matrix ModifyDepthMatrix (forwardLambda, modMinDepths, seed); // Get a new species tree if (GetSpeciesTreeFromMinDepths (newSpeciesTree, modMinDepths) == ERROR) { abortMove = YES; free (geneTrees); free (oldMinDepths); return (NO_ERROR); } // Calculate joint probability of new gene trees and new species tree newLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, newSpeciesTree, chain); // Get backward lambda GetMeanDist(newSpeciesTree, depthMatrix, &mean); // if (mean < 1E-6) mean = 1E-6; backwardLambda = 1.0 / mean; // Get proposal probability of old species tree backwardLnProposalProb = LnProposalProbSpeciesTree (oldSpeciesTree, oldMinDepths, backwardLambda); // Get proposal probability of new species tree forwardLnProposalProb = LnProposalProbSpeciesTree (newSpeciesTree, depthMatrix, forwardLambda); // Update prior ratio taking species tree into account (*lnPriorRatio) += (newLnProb - oldLnProb); // Update proposal ratio based on this move (*lnProposalRatio) += (backwardLnProposalProb - forwardLnProposalProb); // Free allocated memory free (geneTrees); free (oldMinDepths); return (NO_ERROR); } /**----------------------------------------------------------------- | | Move_GeneTree3: Propose a new gene tree using ParsSPRClock | | @param param The parameter to change | @param chain The chain number | @param seed Pointer to the seed of the random number gen. | @param lnPriorRatio Pointer to the log prior ratio (out) | @param lnProposalRatio Pointer to the log proposal (Hastings) ratio (out) | @param mvp Pointer to tuning parameter(s) ------------------------------------------------------------------*/ int Move_GeneTree3 (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp) { int i, numGeneTrees, numUpperTriang; double newLnProb, oldLnProb, backwardLnProposalProb, forwardLnProposalProb, *oldMinDepths, *modMinDepths, forwardLambda, backwardLambda, mean; Tree *newSpeciesTree, *oldSpeciesTree, **geneTrees; ModelInfo *m; // Calculate number of gene trees numGeneTrees = numTopologies - 1; // Get model settings m = &modelSettings[param->relParts[0]]; // Get species tree (this trick is possible because we always copy tree params) newSpeciesTree = GetTree (m->speciesTree, chain, state[chain]); oldSpeciesTree = GetTree (m->speciesTree, chain, state[chain] ^ 1); // Get gene trees geneTrees = (Tree **) SafeCalloc (2*numGeneTrees, sizeof(Tree *)); for (i=0; i<m->speciesTree->nSubParams; i++) { geneTrees[i] = GetTree(m->speciesTree->subParams[i], chain, state[chain]); } // Allocate space for depth matrix copy numUpperTriang = numSpecies * (numSpecies - 1) / 2; oldMinDepths = (double *) SafeCalloc (2*numUpperTriang, sizeof(double)); modMinDepths = oldMinDepths + numUpperTriang; // Get min depth matrix for old gene trees GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix); // Save a copy for (i=0; i<numUpperTriang; i++) oldMinDepths[i] = depthMatrix[i]; // Get forward lambda GetMeanDist(oldSpeciesTree, depthMatrix, &mean); // if (mean < 1E-6) mean = 1E-6; forwardLambda = 1.0 / mean; // Calculate joint probability of old gene trees and old species tree oldLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, oldSpeciesTree, chain); // Modify the picked gene tree using code from a regular MrBayes move Move_ParsSPRClock(param, chain, seed, lnPriorRatio, lnProposalRatio, mvp); // Update the min depth matrix GetMinDepthMatrix(geneTrees, numTopologies-1, depthMatrix); // Copy the min depth matrix for (i=0; i<numUpperTriang; i++) modMinDepths[i] = depthMatrix[i]; // Modify the min depth matrix ModifyDepthMatrix (forwardLambda, modMinDepths, seed); // Get a new species tree if (GetSpeciesTreeFromMinDepths (newSpeciesTree, modMinDepths) == ERROR) { abortMove = YES; free (geneTrees); free (oldMinDepths); return (NO_ERROR); } // Calculate joint probability of new gene trees and new species tree newLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, newSpeciesTree, chain); // Get backward lambda GetMeanDist(newSpeciesTree, depthMatrix, &mean); // if (mean < 1E-6) mean = 1E-6; backwardLambda = 1.0 / mean; // Get proposal probability of old species tree backwardLnProposalProb = LnProposalProbSpeciesTree (oldSpeciesTree, oldMinDepths, backwardLambda); // Get proposal probability of new species tree forwardLnProposalProb = LnProposalProbSpeciesTree (newSpeciesTree, depthMatrix, forwardLambda); // Update prior ratio taking species tree into account (*lnPriorRatio) += (newLnProb - oldLnProb); // Update proposal ratio based on this move (*lnProposalRatio) += (backwardLnProposalProb - forwardLnProposalProb); // Free allocated memory free (geneTrees); free (oldMinDepths); return (NO_ERROR); } /*----------------------------------------------------------------------------------- | | Move_NodeSliderGeneTree: Move the position of one (root or nonroot) node in a | gene tree inside a species tree. | -------------------------------------------------------------------------------------*/ int Move_NodeSliderGeneTree (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp) { int i, *nEvents; MrBFlt window, minDepth, maxDepth, oldDepth, newDepth, oldLeftLength=0.0, oldRightLength=0.0, clockRate, oldPLength=0.0, lambda=0.0, nu=0.0, igrvar=0.0, *brlens=NULL, *tk02Rate=NULL, *igrRate=NULL, *popSizePtr; TreeNode *p, *q; ModelInfo *m; Tree *geneTree, *speciesTree; Param *subParm; window = mvp[0]; /* window size */ m = &modelSettings[param->relParts[0]]; /* get gene tree and species tree */ geneTree = GetTree (param, chain, state[chain]); speciesTree = GetTree (m->speciesTree, chain, state[chain]); /* get population size(s) */ popSizePtr = GetParamVals(m->popSize, chain, state[chain]); /* get clock rate */ if (m->clockRate == NULL) clockRate = 1.0; else clockRate = *GetParamVals(m->clockRate, chain, state[chain]); /* pick a node to be changed */ p = geneTree->intDownPass[(int)(RandomNumber(seed)*geneTree->nIntNodes)]; # if defined (DEBUG_CSLIDER) printf ("Before node slider (gene tree):\n"); printf ("Picked branch with index %d and depth %f\n", p->index, p->nodeDepth); if (p->anc->anc == NULL) printf ("Old clock rate: %f\n", clockRate); ShowNodes (t->root, 0, t->isRooted); getchar(); # endif /* get gene tree prior prob before move */ (*lnPriorRatio) -= LnPriorProbGeneTree(geneTree, clockRate, speciesTree, popSizePtr); /* store values needed later for prior calculation (relaxed clocks) */ oldPLength = p->length; if (p->left != NULL) { oldLeftLength = p->left->length; oldRightLength = p->right->length; } else oldLeftLength = oldRightLength = 0.0; /* find species tree branch to which the gene tree node belongs */ MapGeneTreeToSpeciesTree(geneTree, speciesTree); q = NULL; for (i=0; i<speciesTree->nNodes-1; i++) { q = speciesTree->allDownPass[i]; if (p->x == q->index) break; } assert (q != NULL && p->x == q->index); /* determine lower and upper bound */ minDepth = p->left->nodeDepth + POS_MIN; if (p->right->nodeDepth + POS_MIN > minDepth) minDepth = p->right->nodeDepth + POS_MIN; if (q->nodeDepth + POS_MIN > minDepth) minDepth = q->nodeDepth + POS_MIN; if (p->anc->anc == NULL) maxDepth = TREEHEIGHT_MAX; else maxDepth = p->anc->nodeDepth - POS_MIN; /* abort if impossible */ if (minDepth >= maxDepth) { abortMove = YES; return (NO_ERROR); } if (maxDepth-minDepth < window) { window = maxDepth-minDepth; } /* pick the new node depth */ oldDepth = p->nodeDepth; newDepth = oldDepth + (RandomNumber(seed) - 0.5) * window; /* reflect the new node depth */ while (newDepth < minDepth || newDepth > maxDepth) { if (newDepth < minDepth) newDepth = 2.0 * minDepth - newDepth; if (newDepth > maxDepth) newDepth = 2.0 * maxDepth - newDepth; } p->nodeDepth = newDepth; /* determine new branch lengths around p and set update of transition probabilities */ if (p->left != NULL) { p->left->length = p->nodeDepth - p->left->nodeDepth; assert (p->left->length >= POS_MIN); p->left->upDateTi = YES; p->right->length = p->nodeDepth - p->right->nodeDepth; assert (p->right->length >= POS_MIN); p->right->upDateTi = YES; } if (p->anc->anc != NULL) { p->length = p->anc->nodeDepth - p->nodeDepth; assert (p->length >= POS_MIN); p->upDateTi = YES; } /* set flags for update of cond likes from p and down to root */ q = p; while (q->anc != NULL) { q->upDateCl = YES; q = q->anc; } /* calculate proposal ratio */ (*lnProposalRatio) = 0.0; /* calculate prior ratio */ (*lnPriorRatio) += LnPriorProbGeneTree (geneTree, clockRate, speciesTree, popSizePtr); /* adjust proposal and prior ratio for relaxed clock models */ for (i=0; i<param->nSubParams; i++) { subParm = param->subParams[i]; if (subParm->paramType == P_CPPEVENTS) { nEvents = subParm->nEvents[2*chain+state[chain]]; lambda = *GetParamVals (modelSettings[subParm->relParts[0]].cppRate, chain, state[chain]); /* proposal ratio */ if (p->left != NULL) { (*lnProposalRatio) += nEvents[p->left->index ] * log (p->left->length / oldLeftLength); (*lnProposalRatio) += nEvents[p->right->index] * log (p->right->length / oldRightLength); } if (p->anc->anc != NULL) (*lnProposalRatio) += nEvents[p->index] * log (p->length / oldPLength); /* prior ratio */ if (p->anc->anc == NULL) // two branches changed in same direction (*lnPriorRatio) += lambda * (2.0 * (oldDepth - newDepth)); else if (p->left != NULL) // two branches changed in one direction, one branch in the other direction (*lnPriorRatio) += lambda * (oldDepth - newDepth); else /* if (p->left == NULL) */ // one branch changed (*lnPriorRatio) += lambda * (newDepth - oldDepth); /* update effective evolutionary lengths */ if (UpdateCppEvolLengths (subParm, p, chain) == ERROR) { abortMove = YES; return (NO_ERROR); } } else if ( subParm->paramType == P_TK02BRANCHRATES || (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_TK02)) { if (subParm->paramType == P_TK02BRANCHRATES) nu = *GetParamVals (modelSettings[subParm->relParts[0]].tk02var, chain, state[chain]); else nu = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]); tk02Rate = GetParamVals (subParm, chain, state[chain]); brlens = GetParamSubVals (subParm, chain, state[chain]); /* no proposal ratio effect */ /* prior ratio */ if (p->left != NULL) { (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->index], nu*oldLeftLength, tk02Rate[p->left->index]); (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->index], nu*oldRightLength, tk02Rate[p->right->index]); (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->index], nu*p->left->length, tk02Rate[p->left->index]); (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->index], nu*p->right->length, tk02Rate[p->right->index]); } if (p->anc->anc != NULL) { (*lnPriorRatio) -= LnProbTK02LogNormal (tk02Rate[p->anc->index], nu*oldPLength, tk02Rate[p->index]); (*lnPriorRatio) += LnProbTK02LogNormal (tk02Rate[p->anc->index], nu*p->length, tk02Rate[p->index]); } /* update effective evolutionary lengths */ if (p->left != NULL) { brlens[p->left->index] = p->left->length * (tk02Rate[p->left->index]+tk02Rate[p->index])/2.0; brlens[p->right->index] = p->right->length * (tk02Rate[p->right->index]+tk02Rate[p->index])/2.0; } if (p->anc->anc != NULL) { brlens[p->index] = p->length * (tk02Rate[p->index]+tk02Rate[p->anc->index])/2.0; } } else if ( subParm->paramType == P_IGRBRANCHRATES || (subParm->paramType == P_MIXEDBRCHRATES && *GetParamIntVals(subParm, chain, state[chain]) == RCL_IGR)) { if (subParm->paramType == P_IGRBRANCHRATES) igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].igrvar, chain, state[chain]); else igrvar = *GetParamVals (modelSettings[subParm->relParts[0]].mixedvar, chain, state[chain]); igrRate = GetParamVals (subParm, chain, state[chain]); brlens = GetParamSubVals (subParm, chain, state[chain]); if (p->left != NULL) { (*lnPriorRatio) -= LnProbGamma (oldLeftLength/igrvar, oldLeftLength/igrvar, igrRate[p->left->index ]); (*lnPriorRatio) -= LnProbGamma (oldRightLength/igrvar, oldRightLength/igrvar, igrRate[p->right->index]); (*lnPriorRatio) += LnProbGamma (p->left->length/igrvar, p->left->length/igrvar, igrRate[p->left->index ]); (*lnPriorRatio) += LnProbGamma (p->right->length/igrvar, p->right->length/igrvar, igrRate[p->right->index]); } if (p->anc->anc != NULL) { (*lnPriorRatio) -= LnProbGamma (oldPLength/igrvar, oldPLength/igrvar, igrRate[p->index]); (*lnPriorRatio) += LnProbGamma (p->length /igrvar, p->length /igrvar, igrRate[p->index]); } if (p->left != NULL) { brlens[p->left->index ] = igrRate[p->left->index ] * p->left->length; brlens[p->right->index] = igrRate[p->right->index] * p->right->length; } if (p->anc->anc != NULL) { brlens[p->index] = igrRate[p->index] * p->length; } } } # if defined (DEBUG_CSLIDER) printf ("After node slider (gene tree):\n"); printf ("Old depth: %f -- New depth: %f -- LnPriorRatio %f -- LnProposalRatio %f\n", oldDepth, newDepth, (*lnPriorRatio), (*lnProposalRatio)); ShowNodes (t->root, 0, t->isRooted); getchar(); # endif return (NO_ERROR); } /*------------------------------------------------------------------ | | Move_SpeciesTree: Propose a new species tree | ------------------------------------------------------------------*/ int Move_SpeciesTree (Param *param, int chain, RandLong *seed, MrBFlt *lnPriorRatio, MrBFlt *lnProposalRatio, MrBFlt *mvp) { int i, numGeneTrees, numUpperTriang; double newLnProb, oldLnProb, backwardLnProposalProb, forwardLnProposalProb, *modMinDepths, forwardLambda, backwardLambda, lambdaDiv, mean; Tree *newSpeciesTree, *oldSpeciesTree, **geneTrees; ModelInfo *m; /* get tuning parameter (lambda divider) */ lambdaDiv = mvp[0]; /* calculate number of gene trees */ numGeneTrees = param->nSubParams; /* get model settings */ m = &modelSettings[param->relParts[0]]; /* get new and old species trees */ newSpeciesTree = GetTree (m->speciesTree, chain, state[chain]); oldSpeciesTree = GetTree (m->speciesTree, chain, state[chain] ^ 1); /* get gene trees */ geneTrees = (Tree **) SafeCalloc (numGeneTrees, sizeof(Tree*)); for (i=0; i<param->nSubParams; i++) geneTrees[i] = GetTree(param->subParams[i], chain, state[chain]); /* get minimum depth matrix */ GetMinDepthMatrix(geneTrees, numGeneTrees, depthMatrix); /* get forward lambda */ GetMeanDist(oldSpeciesTree, depthMatrix, &mean); forwardLambda = 1.0 / (mean * lambdaDiv); /* make a copy for modification */ numUpperTriang = numSpecies * (numSpecies - 1) / 2; modMinDepths = (double *) SafeCalloc (numUpperTriang, sizeof(double)); for (i=0; i<numUpperTriang; i++) modMinDepths[i] = depthMatrix[i]; /* modify minimum depth matrix */ ModifyDepthMatrix (forwardLambda, modMinDepths, seed); /* construct a new species tree from the modified constraints */ if (GetSpeciesTreeFromMinDepths(newSpeciesTree, modMinDepths) == ERROR) { abortMove = YES; free (modMinDepths); free (geneTrees); return (NO_ERROR); } /* get lambda for back move */ GetMeanDist(newSpeciesTree, depthMatrix, &mean); backwardLambda = 1.0 / (mean * lambdaDiv); /* calculate proposal ratio */ backwardLnProposalProb = LnProposalProbSpeciesTree (oldSpeciesTree, depthMatrix, backwardLambda); forwardLnProposalProb = LnProposalProbSpeciesTree (newSpeciesTree, depthMatrix, forwardLambda); (*lnProposalRatio) = backwardLnProposalProb - forwardLnProposalProb; # if defined (BEST_MPI_ENABLED) // Broadcast the proposed species tree to all processors if MPI version # endif # if defined (BEST_MPI_ENABLED) // Let each processor calculate the ln probability ratio of its current gene tree(s) // given the new and old species tree in the MPI version // Assemble the ln probability ratios across the processors and to lnPriorRatio # else /* calculate the ln probability ratio of the current gene trees given the new and old species trees */ newLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, newSpeciesTree, chain); oldLnProb = LnJointGeneTreeSpeciesTreePr(geneTrees, numGeneTrees, oldSpeciesTree, chain); # endif /* set (*lnPriorRatio) to ln probability ratio */ (*lnPriorRatio) = (newLnProb - oldLnProb); /* free allocated space */ free (modMinDepths); free (geneTrees); return (NO_ERROR); } /** Show upper triangular matrix */ void ShowUpperTriangMatrix (double *values, int squareSize) { int i, j, index; index = 0; printf ("Upper triang matrix:\n"); for (i=0; i<squareSize; i++) { for (j=0; j<i; j++) printf (" "); for (j=i+1; j<squareSize; j++) { printf ("%.6f ", values[index]); index++; } printf ("\n"); } printf ("\n"); }
37.101174
174
0.580423
[ "model" ]
80f0fe78025f644c4ddc630d245c864406fd7985
7,945
h
C
Code/Engine/Render/Renderers/DebugRenderStates.h
JuanluMorales/KRG
f3a11de469586a4ef0db835af4bc4589e6b70779
[ "MIT" ]
419
2022-01-27T19:37:43.000Z
2022-03-31T06:14:22.000Z
Code/Engine/Render/Renderers/DebugRenderStates.h
jagt/KRG
ba20cd8798997b0450491b0cc04dc817c4a4bc76
[ "MIT" ]
2
2022-01-28T20:35:33.000Z
2022-03-13T17:42:52.000Z
Code/Engine/Render/Renderers/DebugRenderStates.h
jagt/KRG
ba20cd8798997b0450491b0cc04dc817c4a4bc76
[ "MIT" ]
20
2022-01-27T20:41:02.000Z
2022-03-26T16:16:57.000Z
#pragma once #include "Engine/Render/_Module/API.h" #include "System/Render/RenderDevice.h" #include "System/Render/RenderViewport.h" //------------------------------------------------------------------------- #if KRG_DEVELOPMENT_TOOLS namespace KRG::Render { //------------------------------------------------------------------------- // Primitives //------------------------------------------------------------------------- struct KRG_ENGINE_RENDER_API DebugLineRenderState { constexpr static uint32 const MaxLinesPerDrawCall = 100000; public: bool Initialize( RenderDevice* pRenderDevice ); void Shutdown( RenderDevice* pRenderDevice ); void SetState( RenderContext const& renderContext, Viewport const& viewport ); public: VertexShader m_vertexShader; GeometryShader m_geometryShader; PixelShader m_pixelShader; ShaderInputBindingHandle m_inputBinding; VertexBuffer m_vertexBuffer; BlendState m_blendState; RasterizerState m_rasterizerState; TVector<uint8> m_stagingVertexData; PipelineState m_PSO; }; //------------------------------------------------------------------------- struct KRG_ENGINE_RENDER_API DebugPointRenderState { constexpr static uint32 const MaxPointsPerDrawCall = 100000; public: bool Initialize( RenderDevice* pRenderDevice ); void Shutdown( RenderDevice* pRenderDevice ); void SetState( RenderContext const& renderContext, Viewport const& viewport ); public: VertexShader m_vertexShader; GeometryShader m_geometryShader; PixelShader m_pixelShader; ShaderInputBindingHandle m_inputBinding; VertexBuffer m_vertexBuffer; BlendState m_blendState; RasterizerState m_rasterizerState; TVector<uint8> m_stagingVertexData; PipelineState m_PSO; }; //------------------------------------------------------------------------- struct KRG_ENGINE_RENDER_API DebugPrimitiveRenderState { constexpr static uint32 const MaxTrianglesPerDrawCall = 100000; public: bool Initialize( RenderDevice* pRenderDevice ); void Shutdown( RenderDevice* pRenderDevice ); void SetState( RenderContext const& renderContext, Viewport const& viewport ); public: VertexShader m_vertexShader; PixelShader m_pixelShader; ShaderInputBindingHandle m_inputBinding; VertexBuffer m_vertexBuffer; BlendState m_blendState; RasterizerState m_rasterizerState; TVector<uint8> m_stagingVertexData; PipelineState m_PSO; }; //------------------------------------------------------------------------- // Text //------------------------------------------------------------------------- struct DebugFontGlyph { Float2 m_positionTL; Float2 m_positionBR; Float2 m_texCoordsTL; Float2 m_texCoordsBR; float m_advanceX; }; struct DebugFontGlyphVertex { Float2 m_pos; Float2 m_texcoord; uint32 m_color; }; //------------------------------------------------------------------------- class KRG_ENGINE_RENDER_API DebugTextFontAtlas { public: struct FontDesc { Byte const* m_compressedFontData; float m_fontSize; }; private: struct FontInfo { public: inline float GetAscent() const { return m_ascent; } inline float GetDescent() const { return m_descent; } inline float GetLineGap() const { return m_lineGap; } inline IntRange GetValidGlyphRange() const { return IntRange( 0x20, 0xFF ); } inline int32 GetGlyphIndex( char c ) const { KRG_ASSERT( GetValidGlyphRange().ContainsInclusive( c ) ); return c - GetValidGlyphRange().m_start; } inline DebugFontGlyph const& GetGlyph( int32 glyphIdx ) const { return m_glyphs[glyphIdx]; } public: TVector<DebugFontGlyph> m_glyphs; float m_ascent = 0.0f; float m_descent = 0.0f; float m_lineGap = 0.0f; }; public: // Generate a font atlas with the specified fonts bool Generate( FontDesc* pFonts, int32 numFonts ); // Returns the 2D dimensions of the atlas data inline Int2 GetDimensions() const { return Int2( 512 ); } // Returns the raw font atlas bitmap data inline Byte const* GetAtlasData() const { return m_atlasData.data(); } // Get a list of glyphs indices that correspond to the supplied string void GetGlyphsForString( uint32 fontIdx, TInlineString<24> const& str, TInlineVector<int32, 100>& outGlyphIndices ) const; // Get a list of glyphs indices that correspond to the supplied string void GetGlyphsForString( uint32 fontIdx, char const* pStr, TInlineVector<int32, 100>& outGlyphIndices ) const; // Get the 2D pixel size of the string if it were rendered Int2 GetTextExtents( uint32 fontIdx, char const* pText ) const; // Fill the supplied vertex and index buffer with the necessary data to render the supplied glyphs uint32 WriteGlyphsToBuffer( DebugFontGlyphVertex* pVertexBuffer, uint16 indexStartOffset, uint16* pIndexBuffer, uint32 fontIdx, TInlineVector<int32, 100> const& glyphIndices, Float2 const& textPosTopLeft, Float4 const& color ) const; // Writes a glyph with custom texture coords to the render buffers void WriteCustomGlyphToBuffer( DebugFontGlyphVertex* pVertexBuffer, uint16 indexStartOffset, uint16* pIndexBuffer, uint32 fontIdx, int32 firstGlyphIdx, Float2 const& texCoords, Float2 const& baselinePos, Int2 const& textExtents, int32 pixelPadding, Float4 const& color ) const; private: TVector<Byte> m_atlasData; TInlineVector<FontInfo, 3> m_fonts; }; //------------------------------------------------------------------------- struct KRG_ENGINE_RENDER_API DebugTextRenderState { constexpr static uint32 const MaxGlyphsPerDrawCall = 10000; static Float4 const ClipSpaceTopLeft; public: bool Initialize( RenderDevice* pRenderDevice ); void Shutdown( RenderDevice* pRenderDevice ); void SetState( RenderContext const& renderContext, Viewport const& viewport ); public: VertexShader m_vertexShader; PixelShader m_pixelShader; ShaderInputBindingHandle m_inputBinding; VertexBuffer m_vertexBuffer; VertexBuffer m_indexBuffer; SamplerState m_samplerState; BlendState m_blendState; RasterizerState m_rasterizerState; PipelineState m_PSO; DebugTextFontAtlas m_fontAtlas; Texture m_fontAtlasTexture; Float2 m_nonZeroAlphaTexCoords; }; } #endif
38.014354
285
0.53606
[ "render" ]
80f8f9b8716b5db1cbf2efbb8f0f073138d4481d
4,763
h
C
aws-cpp-sdk-lexv2-models/include/aws/lexv2-models/model/OutputContext.h
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-10T08:06:54.000Z
2022-02-10T08:06:54.000Z
aws-cpp-sdk-lexv2-models/include/aws/lexv2-models/model/OutputContext.h
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-lexv2-models/include/aws/lexv2-models/model/OutputContext.h
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-12-30T04:25:33.000Z
2021-12-30T04:25:33.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/lexv2-models/LexModelsV2_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace LexModelsV2 { namespace Model { /** * <p>Describes a session context that is activated when an intent is * fulfilled.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/models.lex.v2-2020-08-07/OutputContext">AWS * API Reference</a></p> */ class AWS_LEXMODELSV2_API OutputContext { public: OutputContext(); OutputContext(Aws::Utils::Json::JsonView jsonValue); OutputContext& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The name of the output context.</p> */ inline const Aws::String& GetName() const{ return m_name; } /** * <p>The name of the output context.</p> */ inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } /** * <p>The name of the output context.</p> */ inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } /** * <p>The name of the output context.</p> */ inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } /** * <p>The name of the output context.</p> */ inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } /** * <p>The name of the output context.</p> */ inline OutputContext& WithName(const Aws::String& value) { SetName(value); return *this;} /** * <p>The name of the output context.</p> */ inline OutputContext& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} /** * <p>The name of the output context.</p> */ inline OutputContext& WithName(const char* value) { SetName(value); return *this;} /** * <p>The amount of time, in seconds, that the output context should remain active. * The time is figured from the first time the context is sent to the user.</p> */ inline int GetTimeToLiveInSeconds() const{ return m_timeToLiveInSeconds; } /** * <p>The amount of time, in seconds, that the output context should remain active. * The time is figured from the first time the context is sent to the user.</p> */ inline bool TimeToLiveInSecondsHasBeenSet() const { return m_timeToLiveInSecondsHasBeenSet; } /** * <p>The amount of time, in seconds, that the output context should remain active. * The time is figured from the first time the context is sent to the user.</p> */ inline void SetTimeToLiveInSeconds(int value) { m_timeToLiveInSecondsHasBeenSet = true; m_timeToLiveInSeconds = value; } /** * <p>The amount of time, in seconds, that the output context should remain active. * The time is figured from the first time the context is sent to the user.</p> */ inline OutputContext& WithTimeToLiveInSeconds(int value) { SetTimeToLiveInSeconds(value); return *this;} /** * <p>The number of conversation turns that the output context should remain * active. The number of turns is counted from the first time that the context is * sent to the user.</p> */ inline int GetTurnsToLive() const{ return m_turnsToLive; } /** * <p>The number of conversation turns that the output context should remain * active. The number of turns is counted from the first time that the context is * sent to the user.</p> */ inline bool TurnsToLiveHasBeenSet() const { return m_turnsToLiveHasBeenSet; } /** * <p>The number of conversation turns that the output context should remain * active. The number of turns is counted from the first time that the context is * sent to the user.</p> */ inline void SetTurnsToLive(int value) { m_turnsToLiveHasBeenSet = true; m_turnsToLive = value; } /** * <p>The number of conversation turns that the output context should remain * active. The number of turns is counted from the first time that the context is * sent to the user.</p> */ inline OutputContext& WithTurnsToLive(int value) { SetTurnsToLive(value); return *this;} private: Aws::String m_name; bool m_nameHasBeenSet; int m_timeToLiveInSeconds; bool m_timeToLiveInSecondsHasBeenSet; int m_turnsToLive; bool m_turnsToLiveHasBeenSet; }; } // namespace Model } // namespace LexModelsV2 } // namespace Aws
31.753333
124
0.669116
[ "model" ]
a7eb401f9fc28fb679f13d7894aefd6702ac3a24
1,959
c
C
src/arch/aarch64/hftest/interrupts.c
alastairreid/hafnium-verification
51f6c103929c0004775034855020fedd54cad912
[ "Apache-2.0" ]
null
null
null
src/arch/aarch64/hftest/interrupts.c
alastairreid/hafnium-verification
51f6c103929c0004775034855020fedd54cad912
[ "Apache-2.0" ]
null
null
null
src/arch/aarch64/hftest/interrupts.c
alastairreid/hafnium-verification
51f6c103929c0004775034855020fedd54cad912
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2018 The Hafnium 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 * * 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. */ #include "hf/arch/vm/interrupts.h" #include <stdint.h> #include "hf/dlog.h" #include "msr.h" #include "test/hftest.h" extern uint8_t vector_table_el1; static void (*irq_callback)(void); static bool (*exception_callback)(void); void irq_current(void) { if (irq_callback != NULL) { irq_callback(); } else { FAIL("Got unexpected interrupt.\n"); } } noreturn static bool default_sync_current_exception(void) { uintreg_t esr = read_msr(esr_el1); uintreg_t elr = read_msr(elr_el1); switch (esr >> 26) { case 0x25: /* EC = 100101, Data abort. */ dlog("Data abort: pc=%#x, esr=%#x, ec=%#x", elr, esr, esr >> 26); if (!(esr & (1U << 10))) { /* Check FnV bit. */ dlog(", far=%#x", read_msr(far_el1)); } else { dlog(", far=invalid"); } dlog("\n"); break; default: dlog("Unknown current sync exception pc=%#x, esr=%#x, " "ec=%#x\n", elr, esr, esr >> 26); } for (;;) { /* do nothing */ } } bool sync_exception_current(void) { if (exception_callback != NULL) { return exception_callback(); } return default_sync_current_exception(); } void exception_setup(void (*irq)(void), bool (*exception)(void)) { irq_callback = irq; exception_callback = exception; /* Set exception vector table. */ write_msr(VBAR_EL1, &vector_table_el1); } void interrupt_wait(void) { __asm__ volatile("wfi"); }
22.011236
75
0.671261
[ "vector" ]
a7f27cae2850ab147f8739ba7c6979ba612a2b49
441
h
C
src/GateOr.h
k911/cpp-patterns
4613b3a2ded437be03348bf0a98436ccd82c7cbb
[ "MIT" ]
null
null
null
src/GateOr.h
k911/cpp-patterns
4613b3a2ded437be03348bf0a98436ccd82c7cbb
[ "MIT" ]
null
null
null
src/GateOr.h
k911/cpp-patterns
4613b3a2ded437be03348bf0a98436ccd82c7cbb
[ "MIT" ]
null
null
null
#ifndef BAZ_LAB_1_GATEOR_H #define BAZ_LAB_1_GATEOR_H #include <memory> #include <vector> #include "AbstractLogic.h" class GateOr : public AbstractLogic { std::vector<std::shared_ptr<AbstractLogic>> children{}; public: void add(const std::shared_ptr<AbstractLogic> &element); void accept(Visitor *visitor) override; std::shared_ptr<AbstractLogic> first(); bool operation() override; }; #endif //BAZ_LAB_1_GATEOR_H
20.045455
60
0.739229
[ "vector" ]
c502358166c9c8efa7c7e9369d59df9d7ed50c8a
3,104
h
C
Code/Review/itkAnchorOpenCloseLine.h
kiranhs/ITKv4FEM-Kiran
0e4ab3b61b5fc4c736f04a73dd19e41390f20152
[ "BSD-3-Clause" ]
1
2018-04-15T13:32:43.000Z
2018-04-15T13:32:43.000Z
Code/Review/itkAnchorOpenCloseLine.h
kiranhs/ITKv4FEM-Kiran
0e4ab3b61b5fc4c736f04a73dd19e41390f20152
[ "BSD-3-Clause" ]
null
null
null
Code/Review/itkAnchorOpenCloseLine.h
kiranhs/ITKv4FEM-Kiran
0e4ab3b61b5fc4c736f04a73dd19e41390f20152
[ "BSD-3-Clause" ]
null
null
null
/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: itkAnchorOpenCloseLine.h Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __itkAnchorOpenCloseLine_h #define __itkAnchorOpenCloseLine_h #include "itkAnchorHistogram.h" //#define RAWHIST namespace itk { /** * \class AnchorOpenCloseLine * \brief class to implement openings and closings using anchor * methods. This is the base class that must be instantiated with * appropriate definitions of greater, less and so on */ template<class TInputPix, class THistogramCompare, class TFunction1, class TFunction2> class ITK_EXPORT AnchorOpenCloseLine { public: /** Some convenient typedefs. */ typedef TInputPix InputImagePixelType; AnchorOpenCloseLine(); ~AnchorOpenCloseLine() { delete m_Histo; } void PrintSelf(std::ostream& os, Indent indent) const; /** Single-threaded version of GenerateData. This filter delegates * to GrayscaleGeodesicErodeImageFilter. */ void DoLine(InputImagePixelType * buffer, unsigned bufflength); void SetSize(unsigned int size) { m_Size = size; } private: unsigned int m_Size; TFunction1 m_TF1; TFunction2 m_TF2; typedef MorphologyHistogram<InputImagePixelType> Histogram; typedef MorphologyHistogramVec<InputImagePixelType,THistogramCompare> VHistogram; typedef MorphologyHistogramMap<InputImagePixelType,THistogramCompare> MHistogram; bool StartLine(InputImagePixelType * buffer, InputImagePixelType &Extreme, Histogram &histo, unsigned &outLeftP, unsigned &outRightP, unsigned bufflength); void FinishLine(InputImagePixelType * buffer, InputImagePixelType &Extreme, unsigned &outLeftP, unsigned &outRightP, unsigned bufflength); bool UseVectorBasedHistogram() { // bool, short and char are acceptable for vector based algorithm: they do not require // too much memory. Other types are not usable with that algorithm return typeid(InputImagePixelType) == typeid(unsigned char) || typeid(InputImagePixelType) == typeid(signed char) || typeid(InputImagePixelType) == typeid(unsigned short) || typeid(InputImagePixelType) == typeid(signed short) || typeid(InputImagePixelType) == typeid(bool); } Histogram * m_Histo; }; // end of class } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkAnchorOpenCloseLine.txx" #endif #endif
30.135922
90
0.670103
[ "vector" ]
c5031bf41ee42daa3f5f0a0ee7d78530351f99ac
350,701
h
C
obj/MatrixModel/matrixModelView/otherShape.h
DoctorWho-O/OBJ
8f66ea2be4cba32bc8ea516c88668922624faff9
[ "MIT" ]
null
null
null
obj/MatrixModel/matrixModelView/otherShape.h
DoctorWho-O/OBJ
8f66ea2be4cba32bc8ea516c88668922624faff9
[ "MIT" ]
null
null
null
obj/MatrixModel/matrixModelView/otherShape.h
DoctorWho-O/OBJ
8f66ea2be4cba32bc8ea516c88668922624faff9
[ "MIT" ]
null
null
null
/////////////////////////////////////////////////////////////////////////////// // cameraSimple.h // ============== // A simple camera model (192 triangles) // Use "drawCube()" to draw this model. // // 3D model is converted by the PolyTrans from Okino Computer Graphics, Inc. // Bounding box of geometry = (-0.5,-0.35,-0.3) to (0.5,0.37,0.3). // // AUTHOR: Song Ho Ahn (song.ahn@gmail.com) // CREATED: 2008-09-18 // UPDATED: 2018-03-02 /////////////////////////////////////////////////////////////////////////////// #ifndef OTHER_SHAPE_H #define OTHER_SHAPE_H static GLfloat otherShapeVertices1[] = { 0.377918,-0.101428, 0.363766,-0.101428, 0.418492,-0.080823, 0.446446,-0.080823, 0.344123,-0.101428, 0.379688,-0.080823, 0.320910,-0.101428, 0.333834,-0.080823, 0.296400,-0.101428, 0.285419,-0.080823, 0.272992,-0.101428, 0.239179,-0.080823, 0.252978,-0.101428, 0.199644,-0.080823, 0.238316,-0.101428, 0.170681,-0.080823, 0.230442,-0.101428, 0.155127,-0.080823, 0.230127,-0.101428, 0.154504,-0.080823, 0.237401,-0.101428, 0.168873,-0.080823, 0.251552,-0.101428, 0.196826,-0.080823, 0.271196,-0.101428, 0.235630,-0.080823, 0.294408,-0.101428, 0.281484,-0.080823, 0.318918,-0.101428, 0.329900,-0.080823, 0.342326,-0.101428, 0.376139,-0.080823, 0.362340,-0.101428, 0.415675,-0.080823, 0.377002,-0.101428, 0.444638,-0.080823, 0.384876,-0.101428, 0.460192,-0.080823, 0.385192,-0.101428, 0.460815,-0.080823, 0.470488,-0.047046, 0.511557,-0.047046, 0.413481,-0.047046, 0.346114,-0.047046, 0.274984,-0.047046, 0.207053,-0.047046, 0.148969,-0.047046, 0.106418,-0.047046, 0.083567,-0.047046, 0.082652,-0.047046, 0.103762,-0.047046, 0.144830,-0.047046, 0.201838,-0.047046, 0.269203,-0.047046, 0.340334,-0.047046, 0.408266,-0.047046, 0.466350,-0.047046, 0.508899,-0.047046, 0.531751,-0.047046, 0.532667,-0.047046, 0.518476,-0.000929, 0.571647,-0.000929, 0.444667,-0.000929, 0.357448,-0.000929, 0.265355,-0.000929, 0.177402,-0.000929, 0.102201,-0.000929, 0.047111,-0.000929, 0.017526,-0.000929, 0.016340,-0.000929, 0.043671,-0.000929, 0.096843,-0.000929, 0.170651,-0.000929, 0.257870,-0.000929, 0.349964,-0.000929, 0.437916,-0.000929, 0.513117,-0.000929, 0.568207,-0.000929, 0.597793,-0.000929, 0.598979,-0.000929, 0.561272,0.056395, 0.625238,0.056395, 0.472480,0.056395, 0.367555,0.056395, 0.256767,0.056395, 0.150961,0.056395, 0.060493,0.056395, -0.005781,0.056395, -0.041372,0.056395, -0.042798,0.056395, -0.009918,0.056395, 0.054047,0.056395, 0.142838,0.056395, 0.247763,0.056395, 0.358551,0.056395, 0.464358,0.056395, 0.554825,0.056395, 0.621099,0.056395, 0.656691,0.056395, 0.658117,0.056395, 0.597823,0.123512, 0.671008,0.123512, 0.496235,0.123512, 0.376188,0.123512, 0.249432,0.123512, 0.128377,0.123512, 0.024870,0.123512, -0.050954,0.123512, -0.091675,0.123512, -0.093307,0.123512, -0.055689,0.123512, 0.017495,0.123512, 0.119084,0.123512, 0.239132,0.123512, 0.365886,0.123512, 0.486942,0.123512, 0.590447,0.123512, 0.666272,0.123512, 0.706994,0.123512, 0.708626,0.123512, 0.627230,0.198770, 0.707832,0.198770, 0.515346,0.198770, 0.383133,0.198770, 0.243531,0.198770, 0.110207,0.198770, -0.003789,0.198770, -0.087297,0.198770, -0.132146,0.198770, -0.133943,0.198770, -0.092512,0.198770, -0.011911,0.198770, 0.099973,0.198770, 0.232186,0.198770, 0.371787,0.198770, 0.505111,0.198770, 0.619107,0.198770, 0.702616,0.198770, 0.747464,0.198770, 0.749262,0.198770, 0.648767,0.280315, 0.734801,0.280315, 0.529344,0.280315, 0.388219,0.280315, 0.239210,0.280315, 0.096900,0.280315, -0.024779,0.280315, -0.113916,0.280315, -0.161787,0.280315, -0.163705,0.280315, -0.119482,0.280315, -0.033449,0.280315, 0.085975,0.280315, 0.227100,0.280315, 0.376109,0.280315, 0.518419,0.280315, 0.640098,0.280315, 0.729235,0.280315, 0.777105,0.280315, 0.779024,0.280315, 0.661906,0.366141, 0.751254,0.366141, 0.537882,0.366141, 0.391322,0.366141, 0.236573,0.366141, 0.088782,0.366141, -0.037583,0.366141, -0.130154,0.366141, -0.179869,0.366141, -0.181861,0.366141, -0.135935,0.366141, -0.046587,0.366141, 0.077437,0.366141, 0.223996,0.366141, 0.378745,0.366141, 0.526536,0.366141, 0.652902,0.366141, 0.745472,0.366141, 0.795187,0.366141, 0.797179,0.366141, 0.666321,0.454133, 0.756783,0.454133, 0.540751,0.454133, 0.392365,0.454133, 0.235686,0.454133, 0.086054,0.454133, -0.041886,0.454133, -0.135612,0.454133, -0.185946,0.454133, -0.187962,0.454133, -0.141464,0.454133, -0.051003,0.454133, 0.074567,0.454133, 0.222954,0.454133, 0.379631,0.454133, 0.529265,0.454133, 0.657205,0.454133, 0.750929,0.454133, 0.801265,0.454133, 0.803281,0.454133, 0.661906,0.542126, 0.751254,0.542126, 0.537882,0.542126, 0.391322,0.542126, 0.236573,0.542126, 0.088782,0.542126, -0.037583,0.542126, -0.130154,0.542126, -0.179869,0.542126, -0.181861,0.542126, -0.135935,0.542126, -0.046587,0.542126, 0.077437,0.542126, 0.223996,0.542126, 0.378745,0.542126, 0.526536,0.542126, 0.652902,0.542126, 0.745472,0.542126, 0.795187,0.542126, 0.797179,0.542126, 0.648767,0.627951, 0.734801,0.627951, 0.529344,0.627951, 0.388219,0.627951, 0.239210,0.627951, 0.096900,0.627951, -0.024779,0.627951, -0.113916,0.627951, -0.161787,0.627951, -0.163705,0.627951, -0.119482,0.627951, -0.033449,0.627951, 0.085975,0.627951, 0.227100,0.627951, 0.376109,0.627951, 0.518419,0.627951, 0.640098,0.627951, 0.729235,0.627951, 0.777105,0.627951, 0.779024,0.627951, 0.627230,0.709497, 0.707832,0.709497, 0.515346,0.709497, 0.383133,0.709497, 0.243531,0.709497, 0.110207,0.709497, -0.003789,0.709497, -0.087297,0.709497, -0.132146,0.709497, -0.133943,0.709497, -0.092512,0.709497, -0.011911,0.709497, 0.099973,0.709497, 0.232186,0.709497, 0.371787,0.709497, 0.505111,0.709497, 0.619107,0.709497, 0.702616,0.709497, 0.747464,0.709497, 0.749262,0.709497, 0.597823,0.784756, 0.671008,0.784756, 0.496235,0.784756, 0.376188,0.784756, 0.249432,0.784756, 0.128377,0.784756, 0.024870,0.784756, -0.050954,0.784756, -0.091675,0.784756, -0.093307,0.784756, -0.055689,0.784756, 0.017495,0.784756, 0.119084,0.784756, 0.239132,0.784756, 0.365886,0.784756, 0.486942,0.784756, 0.590447,0.784756, 0.666272,0.784756, 0.706994,0.784756, 0.708626,0.784756, 0.561272,0.851872, 0.625238,0.851872, 0.472480,0.851872, 0.367555,0.851872, 0.256767,0.851872, 0.150961,0.851872, 0.060493,0.851872, -0.005781,0.851872, -0.041372,0.851872, -0.042798,0.851872, -0.009918,0.851872, 0.054047,0.851872, 0.142838,0.851872, 0.247763,0.851872, 0.358551,0.851872, 0.464358,0.851872, 0.554825,0.851872, 0.621099,0.851872, 0.656691,0.851872, 0.658117,0.851872, 0.518476,0.909195, 0.571647,0.909195, 0.444667,0.909195, 0.357448,0.909195, 0.265355,0.909195, 0.177402,0.909195, 0.102201,0.909195, 0.047111,0.909195, 0.017526,0.909195, 0.016340,0.909195, 0.043671,0.909195, 0.096843,0.909195, 0.170651,0.909195, 0.257870,0.909195, 0.349964,0.909195, 0.437916,0.909195, 0.513117,0.909195, 0.568207,0.909195, 0.597793,0.909195, 0.598979,0.909195, 0.470488,0.955313, 0.511557,0.955313, 0.413481,0.955313, 0.346114,0.955313, 0.274984,0.955313, 0.207053,0.955313, 0.148969,0.955313, 0.106418,0.955313, 0.083567,0.955313, 0.082652,0.955313, 0.103762,0.955313, 0.144830,0.955313, 0.201838,0.955313, 0.269203,0.955313, 0.340334,0.955313, 0.408266,0.955313, 0.466350,0.955313, 0.508899,0.955313, 0.531751,0.955313, 0.532667,0.955313, 0.418492,0.989090, 0.446446,0.989090, 0.379688,0.989090, 0.333834,0.989090, 0.285419,0.989090, 0.239179,0.989090, 0.199644,0.989090, 0.170681,0.989090, 0.155127,0.989090, 0.154504,0.989090, 0.168873,0.989090, 0.196826,0.989090, 0.235630,0.989090, 0.281484,0.989090, 0.329900,0.989090, 0.376139,0.989090, 0.415675,0.989090, 0.444638,0.989090, 0.460192,0.989090, 0.460815,0.989090, 0.363766,1.009696, 0.377918,1.009696, 0.344123,1.009696, 0.320910,1.009696, 0.296400,1.009696, 0.272992,1.009696, 0.252978,1.009696, 0.238316,1.009696, 0.230442,1.009696, 0.230127,1.009696, 0.237401,1.009696, 0.251552,1.009696, 0.271196,1.009696, 0.294408,1.009696, 0.318918,1.009696, 0.342326,1.009696, 0.362340,1.009696, 0.377002,1.009696, 0.384876,1.009696, 0.385192,1.009696, 0.307659,-0.108354, 0.307659,1.016621, 0.377994,-0.098013, 0.363862,-0.098013, 0.418515,-0.077436, 0.446431,-0.077436, 0.344245,-0.098013, 0.379763,-0.077436, 0.321063,-0.098013, 0.333970,-0.077436, 0.296586,-0.098013, 0.285619,-0.077436, 0.273209,-0.098013, 0.239441,-0.077436, 0.253222,-0.098013, 0.199958,-0.077436, 0.238580,-0.098013, 0.171035,-0.077436, 0.230716,-0.098013, 0.155501,-0.077436, 0.230401,-0.098013, 0.154879,-0.077436, 0.237665,-0.098013, 0.169228,-0.077436, 0.251797,-0.098013, 0.197145,-0.077436, 0.271415,-0.098013, 0.235897,-0.077436, 0.294597,-0.098013, 0.281689,-0.077436, 0.319074,-0.098013, 0.330041,-0.077436, 0.342450,-0.098013, 0.376218,-0.077436, 0.362438,-0.098013, 0.415701,-0.077436, 0.377080,-0.098013, 0.444625,-0.077436, 0.384943,-0.098013, 0.460158,-0.077436, 0.385259,-0.098013, 0.460781,-0.077436, 0.470442,-0.043704, 0.511455,-0.043704, 0.413510,-0.043704, 0.346234,-0.043704, 0.275198,-0.043704, 0.207357,-0.043704, 0.149351,-0.043704, 0.106858,-0.043704, 0.084037,-0.043704, 0.083122,-0.043704, 0.104204,-0.043704, 0.145218,-0.043704, 0.202149,-0.043704, 0.269426,-0.043704, 0.340461,-0.043704, 0.408302,-0.043704, 0.466309,-0.043704, 0.508802,-0.043704, 0.531623,-0.043704, 0.532537,-0.043704, 0.518365,0.002353, 0.571466,0.002353, 0.444655,0.002353, 0.357552,0.002353, 0.265582,0.002353, 0.177747,0.002353, 0.102646,0.002353, 0.047630,0.002353, 0.018083,0.002353, 0.016899,0.002353, 0.044194,0.002353, 0.097295,0.002353, 0.171005,0.002353, 0.258107,0.002353, 0.350078,0.002353, 0.437912,0.002353, 0.513014,0.002353, 0.568030,0.002353, 0.597576,0.002353, 0.598760,0.002353, 0.561104,0.059600, 0.624984,0.059600, 0.472431,0.059600, 0.367646,0.059600, 0.257005,0.059600, 0.151340,0.059600, 0.060993,0.059600, -0.005191,0.059600, -0.040736,0.059600, -0.042160,0.059600, -0.009325,0.059600, 0.054556,0.059600, 0.143229,0.059600, 0.248014,0.059600, 0.358654,0.059600, 0.464319,0.059600, 0.554666,0.059600, 0.620851,0.059600, 0.656395,0.059600, 0.657819,0.059600, 0.597606,0.126626, 0.670693,0.126626, 0.496154,0.126626, 0.376267,0.126626, 0.249681,0.126626, 0.128787,0.126626, 0.025419,0.126626, -0.050305,0.126626, -0.090972,0.126626, -0.092602,0.126626, -0.055034,0.126626, 0.018054,0.126626, 0.119506,0.126626, 0.239393,0.126626, 0.365979,0.126626, 0.486873,0.126626, 0.590241,0.126626, 0.665964,0.126626, 0.706631,0.126626, 0.708261,0.126626, 0.626973,0.201784, 0.707468,0.201784, 0.515239,0.201784, 0.383202,0.201784, 0.243787,0.201784, 0.110642,0.201784, -0.003202,0.201784, -0.086600,0.201784, -0.131388,0.201784, -0.133183,0.201784, -0.091808,0.201784, -0.011314,0.201784, 0.100420,0.201784, 0.232457,0.201784, 0.371872,0.201784, 0.505018,0.201784, 0.618862,0.201784, 0.702259,0.201784, 0.747048,0.201784, 0.748842,0.201784, 0.648483,0.283221, 0.734401,0.283221, 0.529218,0.283221, 0.388282,0.283221, 0.239471,0.283221, 0.097352,0.283221, -0.024164,0.283221, -0.113183,0.283221, -0.160990,0.283221, -0.162905,0.283221, -0.118742,0.283221, -0.032823,0.283221, 0.086442,0.283221, 0.227377,0.283221, 0.376188,0.283221, 0.518308,0.283221, 0.639824,0.283221, 0.728842,0.283221, 0.776649,0.283221, 0.778565,0.283221, 0.661603,0.368933, 0.750832,0.368933, 0.537745,0.368933, 0.391381,0.368933, 0.236838,0.368933, 0.089245,0.368933, -0.036952,0.368933, -0.129399,0.368933, -0.179048,0.368933, -0.181037,0.368933, -0.135172,0.368933, -0.045944,0.368933, 0.077915,0.368933, 0.224279,0.368933, 0.378821,0.368933, 0.526414,0.368933, 0.652611,0.368933, 0.745058,0.368933, 0.794707,0.368933, 0.796696,0.368933, 0.666013,0.456807, 0.756354,0.456807, 0.540611,0.456807, 0.392422,0.456807, 0.235954,0.456807, 0.086520,0.456807, -0.041250,0.456807, -0.134849,0.456807, -0.185117,0.456807, -0.187131,0.456807, -0.140694,0.456807, -0.050353,0.456807, 0.075049,0.456807, 0.223237,0.456807, 0.379706,0.456807, 0.529139,0.456807, 0.656909,0.456807, 0.750509,0.456807, 0.800776,0.456807, 0.802790,0.456807, 0.661603,0.544682, 0.750832,0.544682, 0.537745,0.544682, 0.391381,0.544682, 0.236838,0.544682, 0.089245,0.544682, -0.036952,0.544682, -0.129399,0.544682, -0.179048,0.544682, -0.181037,0.544682, -0.135172,0.544682, -0.045944,0.544682, 0.077915,0.544682, 0.224279,0.544682, 0.378821,0.544682, 0.526414,0.544682, 0.652611,0.544682, 0.745058,0.544682, 0.794707,0.544682, 0.796696,0.544682, 0.648483,0.630393, 0.734401,0.630393, 0.529218,0.630393, 0.388282,0.630393, 0.239471,0.630393, 0.097352,0.630393, -0.024164,0.630393, -0.113183,0.630393, -0.160990,0.630393, -0.162905,0.630393, -0.118742,0.630393, -0.032823,0.630393, 0.086442,0.630393, 0.227377,0.630393, 0.376188,0.630393, 0.518308,0.630393, 0.639824,0.630393, 0.728842,0.630393, 0.776649,0.630393, 0.778565,0.630393, 0.626973,0.711830, 0.707468,0.711830, 0.515239,0.711830, 0.383202,0.711830, 0.243787,0.711830, 0.110642,0.711830, -0.003202,0.711830, -0.086600,0.711830, -0.131388,0.711830, -0.133183,0.711830, -0.091808,0.711830, -0.011314,0.711830, 0.100420,0.711830, 0.232457,0.711830, 0.371872,0.711830, 0.505018,0.711830, 0.618862,0.711830, 0.702259,0.711830, 0.747048,0.711830, 0.748842,0.711830, 0.597606,0.786988, 0.670693,0.786988, 0.496154,0.786988, 0.376267,0.786988, 0.249681,0.786988, 0.128787,0.786988, 0.025419,0.786988, -0.050305,0.786988, -0.090972,0.786988, -0.092602,0.786988, -0.055034,0.786988, 0.018054,0.786988, 0.119506,0.786988, 0.239393,0.786988, 0.365979,0.786988, 0.486873,0.786988, 0.590241,0.786988, 0.665964,0.786988, 0.706631,0.786988, 0.708261,0.786988, 0.561104,0.854015, 0.624984,0.854015, 0.472431,0.854015, 0.367646,0.854015, 0.257005,0.854015, 0.151340,0.854015, 0.060993,0.854015, -0.005191,0.854015, -0.040736,0.854015, -0.042160,0.854015, -0.009325,0.854015, 0.054556,0.854015, 0.143229,0.854015, 0.248014,0.854015, 0.358654,0.854015, 0.464319,0.854015, 0.554666,0.854015, 0.620851,0.854015, 0.656395,0.854015, 0.657819,0.854015, 0.518365,0.911261, 0.571466,0.911261, 0.444655,0.911261, 0.357552,0.911261, 0.265582,0.911261, 0.177747,0.911261, 0.102646,0.911261, 0.047630,0.911261, 0.018083,0.911261, 0.016899,0.911261, 0.044194,0.911261, 0.097295,0.911261, 0.171005,0.911261, 0.258107,0.911261, 0.350078,0.911261, 0.437912,0.911261, 0.513014,0.911261, 0.568030,0.911261, 0.597576,0.911261, 0.598760,0.911261, 0.470442,0.957318, 0.511455,0.957318, 0.413510,0.957318, 0.346234,0.957318, 0.275198,0.957318, 0.207357,0.957318, 0.149351,0.957318, 0.106858,0.957318, 0.084037,0.957318, 0.083122,0.957318, 0.104204,0.957318, 0.145218,0.957318, 0.202149,0.957318, 0.269426,0.957318, 0.340461,0.957318, 0.408302,0.957318, 0.466309,0.957318, 0.508802,0.957318, 0.531623,0.957318, 0.532537,0.957318, 0.418515,0.991050, 0.446431,0.991050, 0.379763,0.991050, 0.333970,0.991050, 0.285619,0.991050, 0.239441,0.991050, 0.199958,0.991050, 0.171035,0.991050, 0.155501,0.991050, 0.154879,0.991050, 0.169228,0.991050, 0.197145,0.991050, 0.235897,0.991050, 0.281689,0.991050, 0.330041,0.991050, 0.376218,0.991050, 0.415701,0.991050, 0.444625,0.991050, 0.460158,0.991050, 0.460781,0.991050, 0.363862,1.011628, 0.377994,1.011628, 0.344245,1.011628, 0.321063,1.011628, 0.296586,1.011628, 0.273209,1.011628, 0.253222,1.011628, 0.238580,1.011628, 0.230716,1.011628, 0.230401,1.011628, 0.237665,1.011628, 0.251797,1.011628, 0.271415,1.011628, 0.294597,1.011628, 0.319074,1.011628, 0.342450,1.011628, 0.362438,1.011628, 0.377080,1.011628, 0.384943,1.011628, 0.385259,1.011628, 0.307830,-0.104929, 0.307830,1.018544, 0.195591,0.236832, 0.186946,0.195649, 0.474069,0.841635, 0.474069,0.845516, 0.474069,0.911336, 0.480930,0.129797, 0.474069,0.832897, 0.500000,0.121873, 0.474069,0.850148, 0.511319,0.745148, 0.474069,0.745148, 0.474069,0.857468, 0.511319,0.737827, 0.474069,0.737827, 0.474069,0.864226, 0.511319,0.731070, 0.474069,0.731070, 0.474069,0.847578, 0.480892,0.122100, 0.474069,0.747718, 0.474069,0.895796, 0.517163,0.731070, 0.517163,0.737827, 0.517163,0.745148, 0.186510,0.124766, 0.264508,0.533398, 0.308020,0.573160, 0.474069,0.802806, 0.305087,0.554874, 0.014736,0.988385, 0.025263,0.973575, 0.480247,0.747718, 0.480247,0.745148, 0.480247,0.737827, 0.480247,0.731070, 0.480247,0.911336, 0.480247,0.895796, 0.480247,0.864226, 0.480247,0.857468, 0.480247,0.850148, 0.480247,0.847578, 0.480247,0.845516, 0.480247,0.841635, 0.480247,0.832897, 0.019545,0.965395, 0.008795,0.979880, 0.474069,0.836264, 0.480247,0.836264, 0.234216,0.189985, 0.234088,0.121593, 0.193720,0.121720, 0.194156,0.191479, 0.203074,0.233763, 0.474069,0.828154, 0.480247,0.828154, 0.239618,0.233064, 0.254159,0.537098, 0.213516,0.451115, 0.496775,0.731070, 0.496775,0.737827, 0.496775,0.745148, 0.496775,0.747718, 0.291900,0.475368, 0.278270,0.460207, 0.222057,0.450384, 0.214764,0.056761, 0.257177,0.025896, 0.474069,0.886758, 0.480247,0.886758, 0.526200,0.731070, 0.526200,0.737827, 0.526200,0.745148, 0.526200,0.747718, 0.526200,0.749779, 0.526200,0.753661, 0.526200,0.759032, 0.526200,0.762398, 0.526200,0.767141, 0.480247,0.811843, 0.474069,0.811843, 0.474069,0.839102, 0.480247,0.839102, 0.526200,0.756194, 0.245832,0.056378, 0.264387,0.003350, 0.221974,0.054733, 0.222439,0.059761, 0.474069,0.834460, 0.480247,0.834460, 0.526200,0.760836, 0.264853,0.024642, 0.276748,0.007148, 0.234334,0.058566, 0.194637,0.194059, 0.194202,0.123606, 0.206097,0.116730, 0.206532,0.180916, 0.203387,0.235663, 0.215443,0.226265, 0.260175,0.537180, 0.221705,0.451062, 0.526200,0.751625, 0.480247,0.843671, 0.474069,0.843671, 0.474069,0.860228, 0.480247,0.860228, 0.526200,0.735068, 0.517163,0.735068, 0.511319,0.735068, 0.496775,0.735068, 0.480247,0.735068, 0.474069,0.735068, 0.474069,0.862271, 0.480247,0.862271, 0.526200,0.733025, 0.517163,0.733025, 0.511319,0.733025, 0.496775,0.733025, 0.480247,0.733025, 0.474069,0.733025, 0.234431,0.451014, 0.270422,0.536732, 0.315272,0.578827, 0.311959,0.590809, 0.526200,0.764285, 0.480247,0.831011, 0.474069,0.831011, 0.366681,0.598487, 0.365610,0.558695, 0.334452,0.479274, 0.370993,0.241386, 0.373088,0.187518, 0.287784,0.187989, 0.288959,0.232121, 0.371829,0.123382, 0.294767,0.121402, 0.376350,0.065263, 0.369883,0.008967, 0.318738,0.007720, 0.313813,0.061063, 0.364959,0.601117, 0.353188,0.613592, 0.025984,0.988513, 0.036149,0.973686, 0.214425,0.336217, 0.217553,0.297134, 0.229789,0.291934, 0.226776,0.333685, 0.206439,0.336619, 0.209640,0.297834, 0.214422,0.335565, 0.258322,0.336564, 0.250044,0.297149, 0.213005,0.295997, 0.329676,0.342952, 0.474069,0.898543, 0.480247,0.898543, 0.514416,0.731070, 0.514416,0.733025, 0.514416,0.735068, 0.514416,0.737827, 0.514416,0.745148, 0.290274,0.298401, 0.291110,0.337310, 0.307967,0.598627, 0.354019,0.620973, 0.368647,0.325316, 0.369691,0.287977, 0.214654,0.383309, 0.227119,0.383096, 0.206609,0.383455, 0.214804,0.383103, 0.265886,0.381269, 0.292034,0.341499, 0.330613,0.342777, 0.365766,0.483147, 0.357857,0.465372, 0.267390,0.429912, 0.207328,0.579988, 0.262597,0.657203, 0.205061,0.581136, 0.265927,0.650597, 0.212412,0.580164, 0.325626,0.678580, 0.325611,0.681223, 0.324807,0.672338, 0.040351,0.952646, 0.018934,0.931355, 0.063769,0.962903, 0.054499,0.977255, 0.040560,0.952289, 0.063763,0.962614, 0.036185,0.973782, 0.025272,0.973622, 0.019157,0.931245, 0.019454,0.965270, 0.008265,0.944730, 0.073095,0.907782, 0.514416,0.747718, 0.511319,0.747718, 0.511319,0.737827, 0.514416,0.737827, 0.517163,0.737827, 0.526200,0.737827, 0.526200,0.745148, 0.526200,0.747718, 0.517163,0.747718, 0.496775,0.745148, 0.496775,0.737827, 0.496775,0.747718, 0.496775,0.747718, 0.511319,0.747718, 0.034814,0.865201, 0.517163,0.747718, 0.526200,0.747718, 0.526200,0.745148, 0.526200,0.737827, 0.517163,0.737827, 0.514416,0.737827, 0.511319,0.737827, 0.496775,0.737827, 0.496775,0.745148, 0.496775,0.747718, 0.511319,0.747718, 0.517163,0.747718, 0.526200,0.747718, 0.526200,0.745148, 0.526200,0.737827, 0.517163,0.737827, 0.514416,0.737827, 0.511319,0.737827, 0.496775,0.737827, 0.496775,0.745148, 0.496775,0.745148, 0.496775,0.747718, 0.511319,0.747718, 0.115390,0.931736, 0.107735,0.944810, 0.526200,0.747718, 0.526200,0.745148, 0.526200,0.737827, 0.517163,0.737827, 0.514416,0.737827, 0.511319,0.737827, 0.496775,0.737827, 0.474069,0.853584, 0.480247,0.853584, 0.526200,0.741711, 0.526200,0.741712, 0.526200,0.741712, 0.526200,0.741712, 0.526200,0.741711, 0.517163,0.741711, 0.514416,0.741711, 0.511319,0.741711, 0.496775,0.741711, 0.496775,0.741712, 0.496775,0.741712, 0.496775,0.741712, 0.496775,0.741711, 0.480247,0.741711, 0.474069,0.741711, 0.496775,0.747718, 0.511319,0.747718, 0.517163,0.747718, 0.526200,0.747718, 0.526200,0.745148, 0.526200,0.741712, 0.526200,0.737827, 0.517163,0.737827, 0.514416,0.737827, 0.511319,0.737827, 0.496775,0.737827, 0.496775,0.741712, 0.496775,0.745148, 0.480247,0.898543, 0.480247,0.905513, 0.474069,0.904695, 0.474069,0.898543, 0.480247,0.886758, 0.480247,0.895796, 0.474069,0.895796, 0.474069,0.886758, 0.480247,0.916184, 0.474069,0.916184, 0.480247,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.480247,0.916184, 0.474069,0.916184, 0.474069,0.731981, 0.480247,0.731981, 0.496775,0.731981, 0.511319,0.731981, 0.514416,0.731981, 0.517163,0.731981, 0.526200,0.731981, 0.480247,0.863315, 0.474069,0.863315, 0.480247,0.916184, 0.480247,0.912743, 0.474069,0.911916, 0.474069,0.916184, 0.480247,0.886758, 0.474069,0.886758, 0.474069,0.895796, 0.474069,0.898543, 0.474069,0.907656, 0.474069,0.913819, 0.474069,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.914277, 0.480247,0.908109, 0.480247,0.898543, 0.480247,0.895796, 0.462720,0.860228, 0.462720,0.862271, 0.462720,0.863315, 0.462720,0.864226, 0.462720,0.886758, 0.462720,0.895796, 0.462720,0.898543, 0.462720,0.903097, 0.462720,0.731070, 0.462720,0.731981, 0.462720,0.733025, 0.462720,0.735068, 0.462720,0.737827, 0.462720,0.741711, 0.462720,0.745148, 0.462720,0.747718, 0.074695,0.898266, 0.115208,0.930618, 0.035770,0.865108, 0.024886,0.876461, 0.130646,0.827607, 0.071278,0.754714, 0.179137,0.881451, 0.174570,0.891060, 0.132413,0.824179, 0.178661,0.878325, 0.073797,0.754928, 0.063700,0.761737, 0.462720,0.802806, 0.462720,0.811843, 0.462720,0.828154, 0.462720,0.831011, 0.462720,0.832897, 0.462720,0.834460, 0.462720,0.836264, 0.462720,0.839102, 0.462720,0.841635, 0.462720,0.843671, 0.462720,0.845516, 0.462720,0.847578, 0.462720,0.850148, 0.462720,0.853584, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.475216,0.916184, 0.475531,0.916184, 0.475360,0.916184, 0.476290,0.916184, 0.475740,0.916184, 0.479889,0.916184, 0.478793,0.916184, 0.479215,0.916184, 0.479079,0.916184, 0.479693,0.916184, 0.478883,0.916184, 0.479524,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.474616,0.916184, 0.475740,0.916184, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.477246,0.886758, 0.477123,0.886758, 0.476872,0.886758, 0.476997,0.895796, 0.477122,0.898543, 0.477202,0.905110, 0.477302,0.912349, 0.477382,0.916184, 0.477461,0.916184, 0.477400,0.916184, 0.477498,0.916184, 0.476730,0.911336, 0.511319,0.747718, 0.511319,0.745148, 0.514416,0.745148, 0.514416,0.747718, 0.511319,0.741711, 0.511319,0.737827, 0.514416,0.737827, 0.514416,0.741711, 0.511319,0.745637, 0.514416,0.745591, 0.514416,0.744362, 0.511319,0.744296, 0.511319,0.742257, 0.514416,0.742138, 0.514416,0.741162, 0.511319,0.741217, 0.513064,0.737827, 0.513064,0.737827, 0.513064,0.741186, 0.513064,0.741711, 0.513064,0.742190, 0.513064,0.744334, 0.513064,0.745148, 0.513064,0.745611, 0.513064,0.747718, 0.513064,0.747718, 0.229656,0.699733, 0.164143,0.621014, 0.115268,0.688034, 0.178965,0.765202, 0.292424,0.735174, 0.238037,0.809034, 0.291363,0.739766, 0.235312,0.816289, 0.232505,0.694007, 0.291613,0.729760, 0.237398,0.804791, 0.181260,0.760652, 0.168552,0.621257, 0.118709,0.688262, 0.160215,0.623589, 0.109428,0.692840, 0.203306,0.582026, 0.104904,0.696562, 0.157172,0.625584, 0.496775,0.747718, 0.511319,0.747718, 0.513064,0.747718, 0.514416,0.747718, 0.517163,0.747718, 0.526200,0.747718, 0.526200,0.745148, 0.526200,0.741711, 0.526200,0.737827, 0.517163,0.737827, 0.514416,0.737827, 0.513064,0.737827, 0.511319,0.737827, 0.496775,0.737827, 0.496775,0.741711, 0.496775,0.745148, 0.513064,0.747718, 0.511319,0.747718, 0.511319,0.747718, 0.513064,0.747718, 0.514416,0.747718, 0.514416,0.747718, 0.513064,0.737827, 0.514416,0.737827, 0.514416,0.737827, 0.513064,0.737827, 0.511319,0.737827, 0.511319,0.737827, 0.511319,0.739179, 0.511319,0.739331, 0.513064,0.739430, 0.514416,0.739342, 0.514416,0.738984, 0.511319,0.747718, 0.511319,0.747718, 0.513064,0.747718, 0.514416,0.747718, 0.514416,0.747718, 0.511319,0.737827, 0.511319,0.737827, 0.513064,0.737827, 0.514416,0.737827, 0.514416,0.737827, 0.511319,0.746506, 0.511319,0.746799, 0.513064,0.746715, 0.514416,0.746725, 0.514416,0.746566, 0.517163,0.746516, 0.517163,0.743228, 0.514416,0.743358, 0.514416,0.743244, 0.513064,0.743234, 0.511319,0.743342, 0.511319,0.742366, 0.476805,0.916184, 0.476813,0.916184, 0.476885,0.916184, 0.474947,0.916184, 0.474936,0.916184, 0.479638,0.916184, 0.479672,0.916184, 0.017195,0.885184, 0.057830,0.767177, 0.000000,0.955091, 0.000466,0.991102, 0.006580,0.999858, 0.018109,1.000000, 0.047318,0.988373, 0.101805,0.954939, 0.171032,0.898505, 0.290541,0.743324, 0.233201,0.821909, 0.325600,0.683271, 0.248358,0.022445, 0.255726,0.021009, 0.267077,0.003588, 0.255214,0.000000, 0.215561,0.025338, 0.190126,0.029395, 0.222372,0.023485, 0.196775,0.027355, 0.232592,0.006308, 0.481447,0.062819, 0.480470,0.008967, 0.434711,0.187518, 0.449094,0.159046, 0.416331,0.241953, 0.480452,0.342143, 0.480570,0.313190, 0.367156,0.348435, 0.480194,0.352328, 0.366169,0.370882, 0.372525,0.389757, 0.479922,0.490499, 0.479942,0.438190, 0.372697,0.431373, 0.479846,0.570006, 0.479921,0.615786, 0.478017,0.637101, 0.477892,0.630009, 0.493423,0.342063, 0.500000,0.343502, 0.500000,0.338282, 0.500000,0.345121, 0.484260,0.341509, 0.500000,0.331155, 0.500000,0.332624, 0.451339,0.229011, 0.449491,0.247696, 0.470257,0.248831, 0.462234,0.196745, 0.489586,0.229490, 0.489800,0.196745, 0.489630,0.162532, 0.470759,0.179869, 0.413212,0.273476, 0.448247,0.275390, 0.370386,0.263111, 0.413500,0.270568, 0.480665,0.287343, 0.489473,0.255915, 0.500000,0.298478, 0.480665,0.287343, 0.448247,0.275390, 0.480665,0.287343, 0.519335,0.287343, 0.519335,0.287343, 0.413212,0.273476, 0.479285,0.916184, 0.475339,0.916184, 0.477048,0.916184, 0.477858,0.916184, 0.413522,0.270344, 0.448247,0.275390, 0.462720,0.731070, 0.462720,0.903097, 0.416331,0.241953, 0.434711,0.187518, 0.449094,0.159046, 0.480930,0.129797, 0.462720,0.839102, 0.462720,0.841635, 0.510527,0.255915, 0.325050,0.415035, 0.324865,0.437577, 0.343912,0.440030, 0.342203,0.417086, 0.319329,0.429898, 0.314093,0.415831, 0.462720,0.843671, 0.324347,0.394047, 0.318272,0.379172, 0.313574,0.391772, 0.340837,0.371364, 0.323519,0.372568, 0.341806,0.394048, 0.361296,0.395587, 0.358209,0.385475, 0.361257,0.417321, 0.526200,0.753661, 0.480247,0.841635, 0.480247,0.839102, 0.526200,0.756194, 0.526200,0.751625, 0.480247,0.843671, 0.511319,0.731070, 0.480247,0.911336, 0.480247,0.731070, 0.496775,0.731070, 0.479971,0.394019, 0.354279,0.434000, 0.338493,0.478256, 0.296933,0.474085, 0.283904,0.458827, 0.273095,0.428986, 0.462720,0.831011, 0.462720,0.828154, 0.526200,0.764285, 0.480247,0.831011, 0.480247,0.828154, 0.526200,0.767141, 0.275338,0.357337, 0.271703,0.380310, 0.281161,0.355986, 0.295301,0.343166, 0.334067,0.341123, 0.369515,0.369339, 0.375846,0.388618, 0.375957,0.430838, 0.462720,0.847578, 0.462720,0.850148, 0.526200,0.745148, 0.480247,0.850148, 0.480247,0.847578, 0.526200,0.747718, 0.511319,0.747718, 0.511319,0.746799, 0.513064,0.746715, 0.513064,0.747718, 0.480247,0.747718, 0.480247,0.745148, 0.496775,0.745148, 0.496775,0.747718, 0.462720,0.747718, 0.462720,0.745148, 0.462720,0.853584, 0.462720,0.857468, 0.526200,0.737827, 0.480247,0.857468, 0.480247,0.853584, 0.526200,0.741711, 0.513064,0.741186, 0.511319,0.741217, 0.511319,0.739331, 0.513064,0.739430, 0.480247,0.741711, 0.480247,0.737827, 0.496775,0.737827, 0.496775,0.741711, 0.462720,0.741711, 0.462720,0.737827, 0.462720,0.863315, 0.462720,0.862271, 0.526200,0.731981, 0.480247,0.863315, 0.480247,0.862271, 0.526200,0.733025, 0.511319,0.733025, 0.511319,0.731981, 0.480247,0.733025, 0.480247,0.731981, 0.496775,0.731981, 0.496775,0.733025, 0.462720,0.733025, 0.462720,0.731981, 0.462720,0.845516, 0.480247,0.845516, 0.526200,0.749779, 0.361295,0.464780, 0.520079,0.615786, 0.520154,0.570006, 0.521983,0.637101, 0.510414,0.229490, 0.510200,0.196745, 0.462720,0.886758, 0.462720,0.895796, 0.517163,0.731070, 0.480247,0.895796, 0.480247,0.886758, 0.526200,0.731070, 0.517163,0.733025, 0.517163,0.731981, 0.517163,0.741711, 0.517163,0.737827, 0.526200,0.737827, 0.526200,0.741711, 0.517163,0.747718, 0.517163,0.746516, 0.526200,0.745148, 0.526200,0.747718, 0.804408,0.236832, 0.813054,0.195649, 0.519070,0.129797, 0.519108,0.122100, 0.480247,0.811843, 0.813489,0.124766, 0.462720,0.811843, 0.462720,0.802806, 0.735492,0.533398, 0.694913,0.554874, 0.691980,0.573160, 0.985264,0.988385, 0.991205,0.979880, 0.980455,0.965395, 0.974737,0.973575, 0.474069,0.747718, 0.474069,0.745148, 0.474069,0.741711, 0.474069,0.737827, 0.474069,0.733025, 0.474069,0.731981, 0.474069,0.911336, 0.476730,0.911336, 0.474069,0.731070, 0.477202,0.905110, 0.474069,0.904695, 0.476872,0.886758, 0.476997,0.895796, 0.474069,0.895796, 0.474069,0.886758, 0.474069,0.863315, 0.474069,0.862271, 0.474069,0.857468, 0.474069,0.853584, 0.474069,0.850148, 0.474069,0.847578, 0.474069,0.845516, 0.474069,0.843671, 0.474069,0.841635, 0.474069,0.839102, 0.474069,0.831011, 0.474069,0.828154, 0.474069,0.811843, 0.474069,0.802806, 0.712215,0.187989, 0.768943,0.190103, 0.462720,0.834460, 0.462720,0.836264, 0.480247,0.834460, 0.480247,0.836264, 0.474069,0.836264, 0.474069,0.834460, 0.526200,0.760836, 0.526200,0.759032, 0.769314,0.121604, 0.705233,0.121402, 0.762827,0.233111, 0.711041,0.232121, 0.745841,0.537098, 0.786484,0.451115, 0.777943,0.450384, 0.721730,0.460207, 0.708100,0.475368, 0.520078,0.490499, 0.785236,0.056761, 0.477302,0.912349, 0.474069,0.911916, 0.511319,0.741711, 0.496775,0.741711, 0.496775,0.737827, 0.511319,0.739179, 0.511319,0.747718, 0.496775,0.747718, 0.496775,0.745148, 0.511319,0.746506, 0.742823,0.025896, 0.462720,0.864226, 0.474069,0.864226, 0.480247,0.864226, 0.477246,0.886758, 0.474069,0.886758, 0.686187,0.061063, 0.756305,0.056230, 0.735613,0.003350, 0.681262,0.007720, 0.462720,0.832897, 0.480247,0.832897, 0.474069,0.832897, 0.526200,0.762398, 0.518553,0.062819, 0.519530,0.008967, 0.777560,0.059761, 0.765666,0.058566, 0.723252,0.007148, 0.735147,0.024642, 0.805363,0.194059, 0.793468,0.180916, 0.793903,0.116730, 0.462720,0.857468, 0.462720,0.860228, 0.480247,0.860228, 0.474069,0.860228, 0.526200,0.735068, 0.517163,0.737827, 0.517163,0.735068, 0.511319,0.737827, 0.511319,0.735068, 0.496775,0.735068, 0.480247,0.735068, 0.474069,0.735068, 0.462720,0.735068, 0.462720,0.860228, 0.805798,0.123606, 0.796613,0.235663, 0.784557,0.226265, 0.739825,0.537180, 0.729578,0.536732, 0.765569,0.451014, 0.778295,0.451062, 0.688040,0.590809, 0.684728,0.578827, 0.634390,0.558695, 0.633319,0.598487, 0.665548,0.479274, 0.629007,0.241386, 0.626912,0.187518, 0.628171,0.123382, 0.623650,0.065263, 0.630117,0.008967, 0.635041,0.601117, 0.646812,0.613592, 0.974016,0.988513, 0.963851,0.973686, 0.785575,0.336217, 0.773224,0.333685, 0.770211,0.291934, 0.782447,0.297134, 0.793561,0.336619, 0.790360,0.297834, 0.742365,0.336548, 0.751312,0.297107, 0.709726,0.298401, 0.708890,0.337310, 0.670324,0.342952, 0.519806,0.352328, 0.519548,0.342143, 0.778026,0.054733, 0.806280,0.121720, 0.805844,0.191479, 0.796925,0.233763, 0.786995,0.295997, 0.785577,0.335565, 0.692033,0.598627, 0.645981,0.620973, 0.631353,0.325316, 0.630309,0.287977, 0.519430,0.313190, 0.785345,0.383309, 0.772881,0.383096, 0.793391,0.383455, 0.785196,0.383103, 0.707966,0.341499, 0.669387,0.342777, 0.520029,0.394019, 0.520058,0.438190, 0.462720,0.898543, 0.477122,0.898543, 0.474069,0.898543, 0.514416,0.731070, 0.480247,0.898543, 0.514416,0.733025, 0.514416,0.731981, 0.514416,0.735068, 0.514416,0.737827, 0.514416,0.741711, 0.514416,0.738984, 0.514416,0.747718, 0.514416,0.746566, 0.642143,0.465372, 0.634234,0.483147, 0.732610,0.429912, 0.737403,0.657203, 0.792672,0.579988, 0.794939,0.581136, 0.787588,0.580164, 0.734073,0.650597, 0.674388,0.681223, 0.674374,0.678580, 0.675193,0.672338, 0.959649,0.952646, 0.981066,0.931355, 0.936231,0.962903, 0.945501,0.977255, 0.959440,0.952289, 0.974728,0.973622, 0.963815,0.973782, 0.936237,0.962614, 0.980843,0.931245, 0.980546,0.965270, 0.991735,0.944730, 0.926905,0.907782, 0.965186,0.865201, 0.884610,0.931736, 0.892265,0.944810, 0.511319,0.747718, 0.511319,0.737827, 0.526200,0.737827, 0.517163,0.737827, 0.526200,0.741712, 0.526200,0.747718, 0.526200,0.745148, 0.925305,0.898266, 0.496775,0.737827, 0.496775,0.741712, 0.496775,0.747718, 0.496775,0.745148, 0.514416,0.737827, 0.884792,0.930618, 0.511319,0.747718, 0.496775,0.747718, 0.496775,0.747718, 0.511319,0.747718, 0.517163,0.747718, 0.517163,0.747718, 0.526200,0.747718, 0.526200,0.747718, 0.526200,0.745148, 0.526200,0.745148, 0.526200,0.737827, 0.526200,0.741712, 0.526200,0.741712, 0.526200,0.737827, 0.517163,0.737827, 0.517163,0.737827, 0.514416,0.737827, 0.514416,0.737827, 0.511319,0.737827, 0.511319,0.737827, 0.496775,0.737827, 0.496775,0.737827, 0.496775,0.741712, 0.496775,0.741712, 0.496775,0.745148, 0.496775,0.745148, 0.496775,0.747718, 0.511319,0.747718, 0.517163,0.747718, 0.526200,0.747718, 0.526200,0.745148, 0.526200,0.741712, 0.526200,0.737827, 0.517163,0.737827, 0.514416,0.737827, 0.511319,0.737827, 0.496775,0.737827, 0.496775,0.741712, 0.496775,0.745148, 0.517163,0.743228, 0.514416,0.743358, 0.513064,0.743234, 0.511319,0.743342, 0.511319,0.742257, 0.513064,0.742190, 0.511319,0.742366, 0.496775,0.747718, 0.511319,0.747718, 0.513064,0.747718, 0.514416,0.747718, 0.517163,0.747718, 0.526200,0.747718, 0.526200,0.745148, 0.526200,0.741711, 0.526200,0.737827, 0.517163,0.737827, 0.514416,0.737827, 0.513064,0.737827, 0.511319,0.737827, 0.496775,0.737827, 0.496775,0.741711, 0.496775,0.745148, 0.480247,0.908109, 0.474069,0.907656, 0.480247,0.895796, 0.480247,0.886758, 0.474069,0.895796, 0.474069,0.886758, 0.474069,0.895796, 0.477123,0.886758, 0.476805,0.916184, 0.476813,0.916184, 0.478793,0.916184, 0.479524,0.916184, 0.480247,0.898543, 0.474069,0.898543, 0.474069,0.898543, 0.474069,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.475740,0.916184, 0.476290,0.916184, 0.475740,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.480247,0.916184, 0.480247,0.914277, 0.477498,0.916184, 0.474069,0.916184, 0.474069,0.913819, 0.477382,0.916184, 0.474616,0.916184, 0.474069,0.916184, 0.477400,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.474069,0.916184, 0.476885,0.916184, 0.479079,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.480247,0.912743, 0.480247,0.905513, 0.480247,0.898543, 0.480247,0.895796, 0.480247,0.886758, 0.964230,0.865108, 0.975114,0.876461, 0.869354,0.827607, 0.928722,0.754714, 0.820863,0.881451, 0.825430,0.891060, 0.867587,0.824179, 0.462720,0.857468, 0.462720,0.860228, 0.475531,0.916184, 0.475216,0.916184, 0.475360,0.916184, 0.474936,0.916184, 0.479672,0.916184, 0.480247,0.916184, 0.479215,0.916184, 0.479693,0.916184, 0.480247,0.916184, 0.480247,0.916184, 0.479889,0.916184, 0.479285,0.916184, 0.479638,0.916184, 0.477858,0.916184, 0.477048,0.916184, 0.477461,0.916184, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.478883,0.916184, 0.514416,0.746725, 0.514416,0.747718, 0.513064,0.747718, 0.511319,0.741711, 0.511319,0.737827, 0.513064,0.737827, 0.513064,0.737827, 0.511319,0.737827, 0.514416,0.739342, 0.514416,0.741162, 0.514416,0.743244, 0.514416,0.742138, 0.511319,0.745637, 0.511319,0.745148, 0.511319,0.745148, 0.513064,0.745611, 0.513064,0.745148, 0.514416,0.745148, 0.514416,0.745591, 0.514416,0.745148, 0.514416,0.744362, 0.511319,0.744296, 0.513064,0.744334, 0.513064,0.741711, 0.514416,0.741711, 0.514416,0.737827, 0.514416,0.737827, 0.511319,0.747718, 0.513064,0.747718, 0.511319,0.747718, 0.511319,0.747718, 0.513064,0.747718, 0.514416,0.747718, 0.514416,0.747718, 0.514416,0.747718, 0.514416,0.737827, 0.513064,0.737827, 0.513064,0.737827, 0.514416,0.737827, 0.514416,0.737827, 0.511319,0.737827, 0.511319,0.737827, 0.511319,0.737827, 0.513064,0.747718, 0.511319,0.747718, 0.514416,0.747718, 0.514416,0.737827, 0.513064,0.737827, 0.511319,0.737827, 0.517163,0.745148, 0.474947,0.916184, 0.821339,0.878325, 0.926203,0.754928, 0.936300,0.761737, 0.770344,0.699733, 0.821035,0.765202, 0.884732,0.688034, 0.835857,0.621014, 0.707576,0.735174, 0.761963,0.809034, 0.708637,0.739766, 0.764688,0.816289, 0.767495,0.694007, 0.818740,0.760652, 0.762602,0.804791, 0.708387,0.729760, 0.831448,0.621257, 0.881291,0.688262, 0.890572,0.692840, 0.839785,0.623589, 0.796694,0.582026, 0.895096,0.696562, 0.842828,0.625584, 0.982805,0.885184, 0.942170,0.767177, 1.000000,0.955091, 0.999534,0.991102, 0.993420,0.999858, 0.981890,1.000000, 0.952682,0.988373, 0.898195,0.954939, 0.828968,0.898505, 0.766799,0.821909, 0.709459,0.743324, 0.674400,0.683271, 0.522108,0.630009, 0.751642,0.022445, 0.732923,0.003588, 0.744274,0.021009, 0.744786,0.000000, 0.777628,0.023485, 0.767408,0.006308, 0.475339,0.916184, 0.550906,0.159046, 0.565289,0.187518, 0.583669,0.241953, 0.632844,0.348435, 0.633831,0.370882, 0.627475,0.389757, 0.627303,0.431373, 0.506577,0.342063, 0.515740,0.341509, 0.519335,0.287343, 0.548661,0.229011, 0.529743,0.248831, 0.550509,0.247696, 0.537766,0.196745, 0.510370,0.162532, 0.529241,0.179869, 0.586788,0.273476, 0.551753,0.275390, 0.629614,0.263111, 0.586500,0.270568, 0.551753,0.275390, 0.586478,0.270344, 0.586788,0.273476, 0.551753,0.275390, 0.565289,0.187518, 0.583669,0.241953, 0.519070,0.129797, 0.550906,0.159046, 0.674950,0.415035, 0.657797,0.417086, 0.656087,0.440030, 0.675135,0.437577, 0.680670,0.429898, 0.685907,0.415831, 0.675653,0.394047, 0.686426,0.391772, 0.681728,0.379172, 0.659163,0.371364, 0.658194,0.394048, 0.676481,0.372568, 0.638704,0.395587, 0.641790,0.385475, 0.638743,0.417321, 0.734114,0.381269, 0.645720,0.434000, 0.703067,0.474085, 0.661507,0.478256, 0.716096,0.458827, 0.726905,0.428986, 0.724662,0.357337, 0.718839,0.355986, 0.728297,0.380310, 0.665933,0.341123, 0.704699,0.343166, 0.624154,0.388618, 0.630485,0.369339, 0.624043,0.430838, 0.638705,0.464780, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.857468, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, 0.462720,0.860228, }; // vertices for camera static GLfloat otherShapeVertices[] = {0.174820,-0.975090,-0.136521, 0.124456,-0.969407,-0.211569, 0.206539,-0.916673,-0.342129, 0.289621,-0.930992,-0.222203, 0.064311,-0.962920,-0.262010, 0.107784,-0.900382,-0.421539, 0.001281,-0.958081,-0.286496, 0.004569,-0.888194,-0.459447, -0.059858,-0.956330,-0.286095, -0.095831,-0.883754,-0.458035, -0.116030,-0.958081,-0.261951, -0.188377,-0.888194,-0.419078, -0.163958,-0.962919,-0.214252, -0.267739,-0.900382,-0.342970, -0.198838,-0.969406,-0.143931, -0.326377,-0.916672,-0.230631, -0.214890,-0.975089,-0.054987, -0.354411,-0.930991,-0.087458, -0.207028,-0.977376,0.043317, -0.342524,-0.936772,0.071664, -0.174819,-0.975089,0.136527, -0.289621,-0.930992,0.222203, -0.124456,-0.969405,0.211575, -0.206539,-0.916672,0.342132, -0.064311,-0.962921,0.262006, -0.107784,-0.900381,0.421541, -0.001282,-0.958081,0.286496, -0.004569,-0.888193,0.459447, 0.059858,-0.956330,0.286096, 0.095832,-0.883753,0.458035, 0.116030,-0.958081,0.261951, 0.188377,-0.888193,0.419078, 0.163958,-0.962919,0.214255, 0.267738,-0.900381,0.342974, 0.198838,-0.969405,0.143936, 0.326376,-0.916671,0.230634, 0.214890,-0.975089,0.054987, 0.354411,-0.930991,0.087458, 0.207028,-0.977376,-0.043317, 0.342524,-0.936772,-0.071664, 0.286126,-0.836289,-0.467710, 0.404358,-0.861410,-0.307356, 0.148555,-0.808558,-0.569355, 0.007797,-0.788339,-0.615191, -0.127879,-0.781070,-0.611209, -0.253771,-0.788339,-0.560466, -0.364347,-0.808559,-0.462042, -0.449632,-0.836289,-0.313771, -0.493659,-0.861410,-0.119472, -0.479546,-0.871762,0.100332, -0.404358,-0.861410,0.307356, -0.286127,-0.836289,0.467710, -0.148554,-0.808559,0.569354, -0.007796,-0.788338,0.615193, 0.127879,-0.781067,0.611213, 0.253771,-0.788338,0.560467, 0.364347,-0.808558,0.462045, 0.449631,-0.836288,0.313774, 0.493660,-0.861410,0.119470, 0.479547,-0.871762,-0.100332, 0.355198,-0.736217,-0.576038, 0.508304,-0.770739,-0.384171, 0.182345,-0.699650,-0.690826, 0.010491,-0.673913,-0.738736, -0.152975,-0.664835,-0.731159, -0.305768,-0.673912,-0.672568, -0.444001,-0.699651,-0.559778, -0.556336,-0.736217,-0.385324, -0.619683,-0.770739,-0.148173, -0.605894,-0.785381,0.126766, -0.508304,-0.770739,0.384171, -0.355198,-0.736217,0.576038, -0.182345,-0.699651,0.690825, -0.010490,-0.673913,0.738736, 0.152974,-0.664835,0.731159, 0.305768,-0.673913,0.672567, 0.444001,-0.699650,0.559780, 0.556336,-0.736217,0.385325, 0.619683,-0.770739,0.148172, 0.605894,-0.785381,-0.126766, 0.411937,-0.623373,-0.664616, 0.597813,-0.663355,-0.450088, 0.208783,-0.582803,-0.785334, 0.012573,-0.555249,-0.831589, -0.171607,-0.545714,-0.820212, -0.344901,-0.555250,-0.756797, -0.506110,-0.582804,-0.635760, -0.643828,-0.623372,-0.443726, -0.728110,-0.663355,-0.172676, -0.716901,-0.680849,0.149993, -0.597812,-0.663355,0.450090, -0.411937,-0.623372,0.664617, -0.208784,-0.582802,0.785335, -0.012573,-0.555248,0.831590, 0.171607,-0.545714,0.820212, 0.344901,-0.555250,0.756797, 0.506111,-0.582804,0.635761, 0.643828,-0.623372,0.443726, 0.728110,-0.663355,0.172675, 0.716901,-0.680849,-0.149993, 0.456448,-0.503073,-0.733875, 0.671314,-0.543372,-0.504069, 0.228611,-0.463756,-0.855960, 0.014102,-0.437872,-0.898927, -0.184981,-0.429061,-0.884131, -0.373297,-0.437873,-0.817873, -0.552588,-0.463755,-0.692515, -0.712371,-0.503073,-0.489331, -0.817085,-0.543371,-0.192664, -0.809919,-0.561531,0.169454, -0.671312,-0.543372,0.504070, -0.456448,-0.503073,0.733876, -0.228612,-0.463754,0.855961, -0.014103,-0.437872,0.898927, 0.184981,-0.429061,0.884132, 0.373297,-0.437872,0.817874, 0.552589,-0.463755,0.692515, 0.712371,-0.503073,0.489331, 0.817085,-0.543371,0.192663, 0.809919,-0.561530,-0.169453, 0.489585,-0.378919,-0.785320, 0.728274,-0.414367,-0.545817, 0.242822,-0.345433,-0.906484, 0.015177,-0.323932,-0.945959, -0.194248,-0.316704,-0.928421, -0.393137,-0.323932,-0.860530, -0.585862,-0.345434,-0.733104, -0.763352,-0.378919,-0.523177, -0.886005,-0.414367,-0.208075, -0.883346,-0.430746,0.184816, -0.728274,-0.414367,0.545818, -0.489585,-0.378919,0.785320, -0.242823,-0.345433,0.906484, -0.015177,-0.323932,0.945959, 0.194248,-0.316704,0.928422, 0.393137,-0.323931,0.860530, 0.585863,-0.345433,0.733103, 0.763352,-0.378919,0.523178, 0.886005,-0.414367,0.208075, 0.883347,-0.430746,-0.184815, 0.512366,-0.253062,-0.820634, 0.768704,-0.279291,-0.575405, 0.252314,-0.228868,-0.940190, 0.015882,-0.213606,-0.976791, -0.200287,-0.208521,-0.957290, -0.406143,-0.213607,-0.888493, -0.608070,-0.228869,-0.760177, -0.798380,-0.253062,-0.546396, -0.934905,-0.279290,-0.218974, -0.936256,-0.291641,0.195885, -0.768703,-0.279290,0.575407, -0.512366,-0.253062,0.820634, -0.252315,-0.228868,0.940190, -0.015882,-0.213606,0.976791, 0.200287,-0.208520,0.957290, 0.406143,-0.213606,0.888493, 0.608070,-0.228868,0.760178, 0.798380,-0.253062,0.546397, 0.934905,-0.279290,0.218974, 0.936256,-0.291642,-0.195885, 0.525659,-0.126605,-0.841222, 0.792818,-0.140516,-0.593039, 0.257746,-0.113957,-0.959469, 0.016280,-0.106063,-0.994226, -0.203690,-0.103446,-0.973555, -0.413497,-0.106063,-0.904307, -0.620776,-0.113957,-0.775662, -0.818812,-0.126604,-0.559928, -0.964066,-0.140515,-0.225460, -0.968152,-0.147143,0.202560, -0.792817,-0.140515,0.593040, -0.525659,-0.126605,0.841222, -0.257747,-0.113958,0.959469, -0.016281,-0.106063,0.994226, 0.203690,-0.103446,0.973555, 0.413498,-0.106063,0.904307, 0.620776,-0.113958,0.775662, 0.818811,-0.126604,0.559928, 0.964066,-0.140515,0.225460, 0.968152,-0.147143,-0.202559, 0.530025,0.000000,-0.847982, 0.800828,0.000000,-0.598894, 0.259514,0.000000,-0.965739, 0.016409,-0.000000,-0.999865, -0.204789,-0.000000,-0.978806, -0.415876,0.000000,-0.909421, -0.624908,-0.000000,-0.780698, -0.825522,-0.000000,-0.564369, -0.973752,-0.000000,-0.227612, -0.978806,0.000000,0.204790, -0.800827,-0.000000,0.598896, -0.530025,-0.000000,0.847982, -0.259514,0.000000,0.965739, -0.016410,-0.000000,0.999865, 0.204789,-0.000000,0.978806, 0.415877,-0.000000,0.909421, 0.624908,-0.000000,0.780698, 0.825522,-0.000000,0.564370, 0.973752,-0.000000,0.227612, 0.978806,0.000000,-0.204788, 0.525659,0.126605,-0.841222, 0.792818,0.140515,-0.593039, 0.257746,0.113957,-0.959469, 0.016280,0.106063,-0.994226, -0.203690,0.103446,-0.973555, -0.413498,0.106063,-0.904307, -0.620776,0.113957,-0.775662, -0.818812,0.126604,-0.559927, -0.964066,0.140515,-0.225460, -0.968152,0.147143,0.202560, -0.792817,0.140515,0.593041, -0.525658,0.126605,0.841222, -0.257746,0.113957,0.959469, -0.016281,0.106062,0.994226, 0.203690,0.103446,0.973555, 0.413498,0.106063,0.904306, 0.620776,0.113958,0.775662, 0.818812,0.126604,0.559927, 0.964066,0.140515,0.225459, 0.968152,0.147143,-0.202558, 0.512366,0.253062,-0.820634, 0.768703,0.279290,-0.575406, 0.252314,0.228868,-0.940190, 0.015881,0.213606,-0.976791, -0.200287,0.208521,-0.957290, -0.406142,0.213606,-0.888494, -0.608070,0.228868,-0.760178, -0.798380,0.253062,-0.546396, -0.934905,0.279290,-0.218974, -0.936256,0.291641,0.195886, -0.768703,0.279290,0.575407, -0.512366,0.253061,0.820635, -0.252314,0.228868,0.940190, -0.015882,0.213605,0.976791, 0.200287,0.208520,0.957290, 0.406143,0.213605,0.888494, 0.608070,0.228868,0.760178, 0.798380,0.253062,0.546396, 0.934905,0.279290,0.218974, 0.936256,0.291642,-0.195885, 0.489584,0.378919,-0.785321, 0.728274,0.414367,-0.545818, 0.242822,0.345434,-0.906484, 0.015176,0.323932,-0.945959, -0.194247,0.316703,-0.928422, -0.393136,0.323931,-0.860530, -0.585863,0.345434,-0.733103, -0.763352,0.378919,-0.523176, -0.886005,0.414367,-0.208075, -0.883346,0.430746,0.184817, -0.728273,0.414367,0.545819, -0.489585,0.378919,0.785320, -0.242824,0.345434,0.906483, -0.015178,0.323931,0.945959, 0.194247,0.316702,0.928422, 0.393136,0.323931,0.860531, 0.585863,0.345433,0.733103, 0.763352,0.378919,0.523177, 0.886005,0.414367,0.208074, 0.883347,0.430746,-0.184815, 0.456447,0.503073,-0.733876, 0.671314,0.543372,-0.504069, 0.228611,0.463756,-0.855960, 0.014102,0.437873,-0.898926, -0.184981,0.429061,-0.884132, -0.373298,0.437873,-0.817873, -0.552589,0.463756,-0.692514, -0.712371,0.503073,-0.489331, -0.817085,0.543372,-0.192663, -0.809919,0.561531,0.169454, -0.671313,0.543372,0.504070, -0.456448,0.503073,0.733875, -0.228612,0.463755,0.855960, -0.014103,0.437871,0.898927, 0.184980,0.429060,0.884133, 0.373297,0.437873,0.817873, 0.552589,0.463756,0.692514, 0.712371,0.503073,0.489331, 0.817085,0.543372,0.192662, 0.809919,0.561530,-0.169452, 0.411937,0.623373,-0.664616, 0.597814,0.663356,-0.450086, 0.208784,0.582805,-0.785333, 0.012573,0.555250,-0.831589, -0.171607,0.545714,-0.820212, -0.344900,0.555249,-0.756798, -0.506110,0.582804,-0.635761, -0.643828,0.623373,-0.443725, -0.728110,0.663355,-0.172675, -0.716901,0.680849,0.149992, -0.597813,0.663355,0.450089, -0.411937,0.623372,0.664617, -0.208785,0.582803,0.785334, -0.012573,0.555248,0.831590, 0.171607,0.545714,0.820212, 0.344900,0.555249,0.756798, 0.506110,0.582803,0.635761, 0.643828,0.623373,0.443726, 0.728109,0.663355,0.172675, 0.716901,0.680849,-0.149989, 0.355198,0.736218,-0.576036, 0.508305,0.770740,-0.384170, 0.182346,0.699651,-0.690824, 0.010492,0.673912,-0.738737, -0.152975,0.664835,-0.731159, -0.305769,0.673913,-0.672567, -0.444001,0.699650,-0.559780, -0.556336,0.736217,-0.385324, -0.619683,0.770739,-0.148172, -0.605894,0.785381,0.126767, -0.508304,0.770739,0.384173, -0.355198,0.736217,0.576037, -0.182345,0.699651,0.690825, -0.010491,0.673914,0.738735, 0.152975,0.664836,0.731158, 0.305768,0.673913,0.672567, 0.444001,0.699649,0.559781, 0.556337,0.736217,0.385324, 0.619683,0.770739,0.148169, 0.605894,0.785381,-0.126766, 0.286126,0.836288,-0.467711, 0.404358,0.861410,-0.307356, 0.148555,0.808558,-0.569355, 0.007797,0.788339,-0.615192, -0.127879,0.781069,-0.611210, -0.253771,0.788339,-0.560465, -0.364348,0.808560,-0.462041, -0.449632,0.836288,-0.313772, -0.493659,0.861410,-0.119471, -0.479546,0.871762,0.100336, -0.404357,0.861409,0.307359, -0.286127,0.836289,0.467709, -0.148554,0.808560,0.569353, -0.007796,0.788339,0.615192, 0.127879,0.781069,0.611211, 0.253771,0.788340,0.560465, 0.364347,0.808559,0.462043, 0.449632,0.836288,0.313772, 0.493660,0.861410,0.119467, 0.479547,0.871762,-0.100332, 0.206538,0.916671,-0.342134, 0.289621,0.930990,-0.222209, 0.107784,0.900381,-0.421541, 0.004569,0.888195,-0.459445, -0.095831,0.883755,-0.458032, -0.188377,0.888194,-0.419077, -0.267739,0.900381,-0.342972, -0.326377,0.916671,-0.230635, -0.354411,0.930990,-0.087463, -0.342524,0.936772,0.071670, -0.289621,0.930989,0.222214, -0.206539,0.916671,0.342135, -0.107784,0.900380,0.421542, -0.004569,0.888193,0.459449, 0.095832,0.883753,0.458036, 0.188377,0.888193,0.419080, 0.267738,0.900380,0.342976, 0.326376,0.916672,0.230633, 0.354411,0.930991,0.087456, 0.342524,0.936772,-0.071665, 0.124457,0.969407,-0.211566, 0.174820,0.975090,-0.136518, 0.064311,0.962919,-0.262015, 0.001281,0.958079,-0.286501, -0.059857,0.956329,-0.286099, -0.116030,0.958082,-0.261947, -0.163958,0.962921,-0.214243, -0.198838,0.969405,-0.143935, -0.214890,0.975088,-0.055003, -0.207028,0.977376,0.043314, -0.174819,0.975087,0.136541, -0.124456,0.969404,0.211584, -0.064311,0.962920,0.262011, -0.001282,0.958080,0.286497, 0.059858,0.956330,0.286095, 0.116030,0.958080,0.261954, 0.163957,0.962919,0.214257, 0.198838,0.969405,0.143936, 0.214890,0.975089,0.054987, 0.207028,0.977375,-0.043322, 0.000000,-1.000000,0.000001, 0.000000,1.000000,0.000003, -0.174820,-0.975089,-0.136527, -0.124456,-0.969405,-0.211575, -0.206539,-0.916672,-0.342132, -0.289622,-0.930992,-0.222203, -0.064311,-0.962920,-0.262008, -0.107784,-0.900381,-0.421541, -0.001281,-0.958080,-0.286498, -0.004569,-0.888193,-0.459447, 0.059857,-0.956329,-0.286098, 0.095831,-0.883754,-0.458034, 0.116030,-0.958080,-0.261953, 0.188377,-0.888193,-0.419078, 0.163958,-0.962919,-0.214255, 0.267739,-0.900381,-0.342973, 0.198838,-0.969405,-0.143936, 0.326377,-0.916672,-0.230632, 0.214890,-0.975089,-0.054987, 0.354411,-0.930991,-0.087458, 0.207028,-0.977376,0.043317, 0.342524,-0.936772,0.071664, 0.174819,-0.975089,0.136524, 0.289621,-0.930992,0.222203, 0.124456,-0.969406,0.211573, 0.206539,-0.916672,0.342132, 0.064311,-0.962920,0.262010, 0.107784,-0.900381,0.421540, 0.001282,-0.958081,0.286495, 0.004569,-0.888194,0.459447, -0.059858,-0.956330,0.286096, -0.095832,-0.883753,0.458035, -0.116030,-0.958081,0.261952, -0.188377,-0.888193,0.419078, -0.163958,-0.962919,0.214252, -0.267739,-0.900382,0.342970, -0.198838,-0.969406,0.143931, -0.326376,-0.916672,0.230631, -0.214890,-0.975089,0.054987, -0.354411,-0.930991,0.087458, -0.207028,-0.977376,-0.043317, -0.342525,-0.936772,-0.071664, -0.286126,-0.836289,-0.467710, -0.404357,-0.861410,-0.307356, -0.148555,-0.808558,-0.569356, -0.007797,-0.788339,-0.615192, 0.127879,-0.781070,-0.611210, 0.253772,-0.788340,-0.560465, 0.364347,-0.808559,-0.462042, 0.449632,-0.836288,-0.313773, 0.493659,-0.861410,-0.119470, 0.479546,-0.871762,0.100332, 0.404358,-0.861410,0.307356, 0.286127,-0.836289,0.467710, 0.148554,-0.808560,0.569353, 0.007796,-0.788340,0.615190, -0.127879,-0.781069,0.611210, -0.253771,-0.788340,0.560465, -0.364347,-0.808559,0.462042, -0.449631,-0.836288,0.313773, -0.493660,-0.861410,0.119470, -0.479547,-0.871762,-0.100332, -0.355198,-0.736217,-0.576038, -0.508304,-0.770739,-0.384171, -0.182345,-0.699650,-0.690826, -0.010492,-0.673913,-0.738736, 0.152975,-0.664836,-0.731158, 0.305769,-0.673914,-0.672566, 0.444001,-0.699650,-0.559779, 0.556336,-0.736217,-0.385324, 0.619683,-0.770739,-0.148171, 0.605894,-0.785381,0.126766, 0.508304,-0.770740,0.384170, 0.355198,-0.736217,0.576037, 0.182345,-0.699650,0.690826, 0.010491,-0.673914,0.738736, -0.152975,-0.664836,0.731158, -0.305769,-0.673914,0.672566, -0.444001,-0.699650,0.559779, -0.556336,-0.736216,0.385325, -0.619683,-0.770739,0.148172, -0.605894,-0.785381,-0.126766, -0.411937,-0.623373,-0.664616, -0.597813,-0.663355,-0.450089, -0.208784,-0.582804,-0.785334, -0.012573,-0.555250,-0.831589, 0.171607,-0.545714,-0.820212, 0.344900,-0.555250,-0.756797, 0.506110,-0.582804,-0.635761, 0.643828,-0.623373,-0.443725, 0.728109,-0.663355,-0.172675, 0.716901,-0.680849,0.149993, 0.597812,-0.663355,0.450090, 0.411937,-0.623372,0.664617, 0.208785,-0.582803,0.785334, 0.012573,-0.555249,0.831589, -0.171607,-0.545714,0.820212, -0.344901,-0.555250,0.756797, -0.506111,-0.582804,0.635760, -0.643827,-0.623373,0.443726, -0.728109,-0.663355,0.172676, -0.716901,-0.680849,-0.149992, -0.456448,-0.503073,-0.733875, -0.671313,-0.543372,-0.504069, -0.228611,-0.463756,-0.855960, -0.014103,-0.437873,-0.898926, 0.184981,-0.429061,-0.884132, 0.373296,-0.437872,-0.817874, 0.552588,-0.463756,-0.692515, 0.712372,-0.503073,-0.489330, 0.817085,-0.543371,-0.192664, 0.809919,-0.561531,0.169453, 0.671312,-0.543372,0.504071, 0.456448,-0.503073,0.733875, 0.228612,-0.463756,0.855960, 0.014103,-0.437873,0.898926, -0.184981,-0.429061,0.884132, -0.373297,-0.437872,0.817874, -0.552589,-0.463755,0.692515, -0.712372,-0.503073,0.489331, -0.817086,-0.543371,0.192663, -0.809919,-0.561531,-0.169452, -0.489585,-0.378919,-0.785320, -0.728274,-0.414367,-0.545817, -0.242822,-0.345434,-0.906484, -0.015177,-0.323932,-0.945959, 0.194248,-0.316704,-0.928421, 0.393136,-0.323932,-0.860530, 0.585863,-0.345434,-0.733103, 0.763353,-0.378919,-0.523176, 0.886005,-0.414367,-0.208075, 0.883346,-0.430746,0.184816, 0.728274,-0.414366,0.545818, 0.489585,-0.378919,0.785320, 0.242824,-0.345434,0.906483, 0.015177,-0.323931,0.945959, -0.194247,-0.316703,0.928422, -0.393136,-0.323931,0.860530, -0.585864,-0.345433,0.733103, -0.763353,-0.378919,0.523176, -0.886005,-0.414367,0.208075, -0.883347,-0.430746,-0.184814, -0.512367,-0.253062,-0.820634, -0.768704,-0.279290,-0.575406, -0.252314,-0.228868,-0.940190, -0.015882,-0.213606,-0.976791, 0.200287,-0.208521,-0.957290, 0.406142,-0.213607,-0.888493, 0.608070,-0.228869,-0.760177, 0.798380,-0.253062,-0.546396, 0.934905,-0.279290,-0.218973, 0.936255,-0.291641,0.195886, 0.768703,-0.279290,0.575406, 0.512366,-0.253062,0.820634, 0.252315,-0.228868,0.940190, 0.015882,-0.213605,0.976791, -0.200287,-0.208520,0.957290, -0.406143,-0.213605,0.888493, -0.608071,-0.228868,0.760177, -0.798380,-0.253062,0.546396, -0.934905,-0.279290,0.218974, -0.936256,-0.291641,-0.195884, -0.525658,-0.126604,-0.841222, -0.792818,-0.140515,-0.593040, -0.257746,-0.113957,-0.959469, -0.016280,-0.106063,-0.994226, 0.203690,-0.103446,-0.973555, 0.413497,-0.106063,-0.904307, 0.620776,-0.113957,-0.775662, 0.818812,-0.126604,-0.559928, 0.964066,-0.140515,-0.225460, 0.968152,-0.147143,0.202560, 0.792817,-0.140515,0.593040, 0.525659,-0.126605,0.841222, 0.257747,-0.113958,0.959469, 0.016281,-0.106062,0.994226, -0.203690,-0.103446,0.973555, -0.413498,-0.106063,0.904307, -0.620776,-0.113958,0.775662, -0.818811,-0.126605,0.559928, -0.964066,-0.140515,0.225460, -0.968152,-0.147143,-0.202559, -0.530025,0.000000,-0.847982, -0.800828,0.000000,-0.598895, -0.259514,0.000000,-0.965739, -0.016409,-0.000000,-0.999865, 0.204789,-0.000000,-0.978806, 0.415876,0.000000,-0.909421, 0.624909,-0.000000,-0.780698, 0.825522,-0.000000,-0.564370, 0.973752,0.000000,-0.227612, 0.978806,-0.000000,0.204790, 0.800827,0.000000,0.598896, 0.530025,0.000000,0.847982, 0.259514,0.000000,0.965739, 0.016410,0.000000,0.999865, -0.204789,-0.000000,0.978806, -0.415877,-0.000000,0.909421, -0.624908,-0.000000,0.780698, -0.825522,0.000000,0.564370, -0.973752,0.000000,0.227612, -0.978806,0.000000,-0.204788, -0.525659,0.126604,-0.841222, -0.792817,0.140515,-0.593040, -0.257746,0.113957,-0.959469, -0.016281,0.106063,-0.994226, 0.203691,0.103446,-0.973555, 0.413498,0.106063,-0.904307, 0.620776,0.113957,-0.775662, 0.818812,0.126604,-0.559927, 0.964066,0.140515,-0.225459, 0.968152,0.147143,0.202560, 0.792817,0.140515,0.593041, 0.525659,0.126605,0.841222, 0.257747,0.113958,0.959469, 0.016281,0.106063,0.994226, -0.203690,0.103446,0.973555, -0.413498,0.106063,0.904306, -0.620775,0.113957,0.775662, -0.818811,0.126605,0.559928, -0.964066,0.140515,0.225460, -0.968152,0.147143,-0.202559, -0.512366,0.253062,-0.820634, -0.768703,0.279290,-0.575406, -0.252314,0.228869,-0.940190, -0.015882,0.213607,-0.976791, 0.200287,0.208521,-0.957290, 0.406142,0.213607,-0.888493, 0.608070,0.228869,-0.760178, 0.798380,0.253062,-0.546396, 0.934905,0.279290,-0.218974, 0.936255,0.291641,0.195887, 0.768702,0.279290,0.575408, 0.512365,0.253061,0.820635, 0.252314,0.228867,0.940190, 0.015882,0.213605,0.976791, -0.200287,0.208520,0.957290, -0.406143,0.213605,0.888494, -0.608070,0.228868,0.760178, -0.798380,0.253062,0.546396, -0.934905,0.279290,0.218974, -0.936256,0.291641,-0.195885, -0.489585,0.378919,-0.785319, -0.728275,0.414368,-0.545816, -0.242823,0.345435,-0.906483, -0.015177,0.323932,-0.945958, 0.194247,0.316703,-0.928422, 0.393135,0.323931,-0.860531, 0.585862,0.345434,-0.733104, 0.763352,0.378919,-0.523177, 0.886005,0.414367,-0.208074, 0.883346,0.430746,0.184816, 0.728274,0.414366,0.545819, 0.489584,0.378918,0.785321, 0.242823,0.345433,0.906484, 0.015177,0.323932,0.945959, -0.194247,0.316703,0.928422, -0.393136,0.323930,0.860531, -0.585863,0.345433,0.733103, -0.763352,0.378919,0.523176, -0.886005,0.414367,0.208074, -0.883347,0.430746,-0.184815, -0.456449,0.503074,-0.733874, -0.671314,0.543373,-0.504067, -0.228611,0.463756,-0.855960, -0.014102,0.437873,-0.898926, 0.184981,0.429061,-0.884132, 0.373297,0.437873,-0.817873, 0.552589,0.463756,-0.692514, 0.712371,0.503073,-0.489331, 0.817085,0.543371,-0.192663, 0.809919,0.561531,0.169452, 0.671313,0.543372,0.504070, 0.456447,0.503072,0.733876, 0.228611,0.463754,0.855961, 0.014103,0.437872,0.898927, -0.184980,0.429061,0.884132, -0.373297,0.437873,0.817873, -0.552589,0.463756,0.692514, -0.712371,0.503073,0.489331, -0.817086,0.543371,0.192662, -0.809919,0.561531,-0.169451, -0.411937,0.623373,-0.664616, -0.597814,0.663356,-0.450086, -0.208784,0.582804,-0.785334, -0.012573,0.555248,-0.831589, 0.171607,0.545714,-0.820212, 0.344900,0.555249,-0.756798, 0.506110,0.582804,-0.635761, 0.643828,0.623373,-0.443725, 0.728109,0.663355,-0.172675, 0.716901,0.680849,0.149992, 0.597812,0.663356,0.450088, 0.411937,0.623371,0.664618, 0.208785,0.582803,0.785334, 0.012573,0.555249,0.831590, -0.171607,0.545713,0.820212, -0.344900,0.555249,0.756798, -0.506110,0.582804,0.635761, -0.643827,0.623373,0.443726, -0.728109,0.663355,0.172674, -0.716901,0.680849,-0.149990, -0.355198,0.736217,-0.576037, -0.508304,0.770739,-0.384171, -0.182346,0.699651,-0.690825, -0.010492,0.673914,-0.738735, 0.152975,0.664836,-0.731158, 0.305769,0.673914,-0.672566, 0.444001,0.699650,-0.559780, 0.556337,0.736218,-0.385323, 0.619683,0.770739,-0.148170, 0.605893,0.785381,0.126767, 0.508304,0.770739,0.384172, 0.355198,0.736218,0.576036, 0.182345,0.699651,0.690824, 0.010491,0.673914,0.738735, -0.152975,0.664836,0.731158, -0.305768,0.673913,0.672567, -0.444001,0.699650,0.559780, -0.556336,0.736217,0.385324, -0.619683,0.770739,0.148169, -0.605894,0.785381,-0.126768, -0.286126,0.836289,-0.467709, -0.404358,0.861411,-0.307354, -0.148555,0.808561,-0.569351, -0.007797,0.788340,-0.615191, 0.127879,0.781070,-0.611210, 0.253772,0.788340,-0.560464, 0.364347,0.808559,-0.462042, 0.449632,0.836289,-0.313772, 0.493659,0.861410,-0.119470, 0.479546,0.871762,0.100332, 0.404358,0.861410,0.307356, 0.286127,0.836289,0.467710, 0.148554,0.808560,0.569353, 0.007796,0.788340,0.615191, -0.127879,0.781070,0.611210, -0.253771,0.788340,0.560465, -0.364347,0.808560,0.462042, -0.449631,0.836288,0.313773, -0.493660,0.861410,0.119471, -0.479547,0.871762,-0.100332, -0.206539,0.916672,-0.342131, -0.289621,0.930991,-0.222208, -0.107784,0.900381,-0.421540, -0.004569,0.888193,-0.459448, 0.095831,0.883753,-0.458036, 0.188377,0.888193,-0.419080, 0.267739,0.900380,-0.342975, 0.326376,0.916670,-0.230639, 0.354411,0.930990,-0.087463, 0.342524,0.936772,0.071665, 0.289621,0.930990,0.222212, 0.206539,0.916671,0.342133, 0.107784,0.900382,0.421538, 0.004569,0.888192,0.459449, -0.095832,0.883753,0.458036, -0.188377,0.888194,0.419076, -0.267738,0.900381,0.342972, -0.326376,0.916671,0.230637, -0.354411,0.930990,0.087463, -0.342525,0.936772,-0.071665, -0.124456,0.969405,-0.211578, -0.174820,0.975088,-0.136532, -0.064311,0.962921,-0.262006, -0.001281,0.958081,-0.286495, 0.059857,0.956329,-0.286097, 0.116030,0.958082,-0.261948, 0.163958,0.962921,-0.214243, 0.198837,0.969404,-0.143943, 0.214889,0.975088,-0.055002, 0.207028,0.977375,0.043322, 0.174819,0.975088,0.136532, 0.124456,0.969407,0.211568, 0.064311,0.962921,0.262005, 0.001282,0.958080,0.286499, -0.059858,0.956329,0.286099, -0.116031,0.958082,0.261948, -0.163958,0.962920,0.214247, -0.198838,0.969404,0.143940, -0.214890,0.975089,0.054996, -0.207028,0.977375,-0.043322, -0.000000,-1.000000,-0.000002, -0.000000,1.000000,0.000000, 0.964946,0.199381,-0.170667, 0.970982,0.239003,-0.008483, 0.996510,0.082715,-0.011236, 0.981652,0.092122,-0.166954, 0.205387,-0.346050,0.915459, -0.000000,-0.988816,0.149144, 0.132105,-0.634950,0.761175, 0.974329,-0.224817,-0.011801, 0.970621,-0.174852,-0.165291, 0.828053,0.502851,0.247932, 0.540874,0.803835,0.247597, 0.620242,0.604947,0.499339, 0.295274,0.309314,0.903957, 0.287872,0.316709,0.903784, 0.451663,0.162771,0.877215, 0.448832,0.165530,0.878151, 0.899919,-0.010697,-0.435926, 0.756496,-0.114483,-0.643901, 0.782011,-0.000024,-0.623264, 0.905120,0.085348,-0.416502, 0.866401,-0.223161,-0.446709, 0.729085,-0.269428,-0.629161, 0.799188,-0.578476,-0.163289, 0.809446,-0.586555,0.027397, 0.708426,-0.516630,0.480860, 0.662517,-0.738876,-0.123018, 0.495665,-0.779860,0.382275, 0.675677,-0.677134,0.291463, 0.845586,-0.071084,0.529085, 0.753126,-0.434550,0.493930, 0.955529,-0.256858,0.144873, 0.988002,0.048523,0.146622, 0.943258,0.294013,0.154341, 0.839749,0.291076,0.458362, 0.872163,0.298723,-0.387422, 0.734836,0.364602,-0.571911, 0.663087,0.599543,-0.448179, 0.788938,0.519515,-0.328149, 0.840159,0.512407,-0.177686, 0.855669,0.508695,0.095190, 0.946675,0.316068,0.062508, 0.940795,0.298571,-0.160501, 0.707458,0.451920,0.543389, 0.832380,0.358518,0.422622, 0.918139,0.292085,0.267781, 0.872666,0.274783,-0.403668, 0.813696,0.266243,-0.516733, 0.844811,0.093095,-0.526903, 0.900810,-0.202398,-0.384156, 0.319226,0.646000,0.693382, 0.491144,0.488341,0.721319, 0.725534,0.682168,0.090814, 0.267261,0.960538,0.077062, 0.823116,-0.096446,0.559624, 0.802053,0.271647,0.531902, 0.848111,0.296810,0.438875, 0.881508,-0.362251,0.302849, 0.874574,0.194867,-0.444013, 0.770541,0.158823,-0.617287, 0.795049,0.229321,-0.561524, 0.857386,0.244758,-0.452751, 0.811210,0.544196,-0.213986, 0.817403,0.512875,0.262318, 0.911374,-0.234437,0.338284, 0.968950,-0.095125,-0.228224, 0.795925,0.220563,0.563787, 0.782606,0.185230,0.594321, 0.900396,0.223593,0.373221, 0.866140,0.208085,0.454425, 0.751033,-0.521641,-0.404772, 0.604475,-0.571498,-0.554977, 0.725858,-0.218341,-0.652271, 0.873428,-0.189861,-0.448415, 0.969358,-0.176908,-0.170434, 0.980546,-0.192943,0.036086, 0.846699,-0.529328,0.053971, 0.849442,-0.498666,-0.172574, 0.752383,-0.217019,0.621950, 0.618420,-0.611987,0.492979, 0.721692,-0.590078,0.361896, 0.899825,-0.186588,0.394334, 0.748334,-0.322330,-0.579741, 0.796428,-0.456120,-0.397060, 0.806555,-0.576225,-0.132039, 0.807179,-0.588938,-0.040163, 0.633305,-0.770676,-0.070592, 0.631680,-0.772217,-0.068269, 0.665536,-0.620335,0.415026, 0.814535,-0.572489,0.093747, 0.810650,-0.563993,-0.157348, 0.716946,-0.688359,-0.110231, 0.794921,-0.359493,-0.488739, 0.738581,-0.579461,-0.344561, 0.967602,-0.186023,-0.170709, 0.849463,-0.498624,-0.172587, 0.498376,-0.085762,-0.862709, 0.449764,-0.149409,-0.880562, 0.520373,-0.162148,-0.838403, 0.451930,-0.021489,-0.891795, 0.266073,0.470952,-0.841076, 0.313556,0.493772,-0.811093, 0.351511,0.233723,-0.906539, 0.257035,0.513095,-0.818942, 0.532294,0.812066,-0.239192, 0.546327,0.811599,-0.206960, 0.215540,0.929495,0.299301, 0.293907,0.699045,0.651885, 0.520133,0.534254,0.666359, 0.390672,-0.031404,0.919994, 0.382566,-0.208728,0.900042, 0.605816,-0.162525,0.778828, 0.656588,0.165054,0.735968, 0.307540,-0.528447,0.791305, 0.551670,-0.477822,0.683627, 0.321413,-0.469509,0.822347, 0.423451,0.088388,0.901597, 0.572468,-0.592719,0.566537, 0.438716,0.234946,0.867369, 0.405395,0.243540,0.881104, 0.410515,0.163998,0.896985, 0.439223,-0.283484,0.852479, 0.279053,-0.782388,0.556774, -0.029372,-0.988891,0.145709, 0.428071,-0.811531,0.397711, 0.182608,-0.929385,0.320776, -0.008420,-0.998997,-0.043971, -0.007733,-0.999911,-0.010905, -0.030423,-0.999470,-0.011558, -0.031546,-0.998738,-0.039089, -0.016095,-0.999079,-0.039789, -0.005385,-0.999212,-0.039334, -0.037573,-0.998609,-0.036993, -0.041008,-0.998348,-0.040248, 0.200141,-0.750719,-0.629575, 0.325610,-0.325161,-0.887834, 0.383923,0.126755,-0.914624, 0.371000,0.190105,-0.908966, 0.376292,0.269129,-0.886552, 0.362886,0.282601,-0.887947, 0.372524,-0.118960,-0.920366, 0.332188,-0.368636,-0.868193, 0.340483,-0.239116,-0.909338, 0.363211,-0.092340,-0.927120, 0.316929,0.503525,-0.803753, 0.284590,0.776582,-0.562076, 0.204667,0.946339,-0.250107, 0.173336,0.969019,-0.175948, 0.128456,0.440256,0.888636, 0.139461,0.433105,0.890489, 0.794352,-0.040885,-0.606080, 0.793677,-0.017130,-0.608098, 0.362785,-0.050571,-0.930500, 0.355725,0.001651,-0.934589, 0.916990,-0.056072,-0.394949, 0.915041,0.026615,-0.402482, 0.984526,-0.060729,-0.164378, 0.981102,0.088395,-0.172120, 0.999189,-0.000948,0.040265, 0.988042,0.154162,0.002777, 0.950116,0.144771,0.276264, 0.835694,0.333714,0.436177, 0.810988,0.425338,0.401729, 0.935409,0.309533,0.170877, 0.499269,0.712563,0.492935, 0.677602,0.419666,0.603934, 0.697655,0.558430,0.448812, 0.000485,-0.999895,0.014462, -0.024695,-0.999643,0.010220, 0.592005,0.037227,0.805074, 0.593994,0.130128,0.793875, 0.585531,0.023321,0.810315, 0.577827,0.028512,0.815661, 0.461158,0.410624,0.786589, 0.461158,0.410624,0.786589, 0.561029,0.275024,0.780774, 0.488769,0.399124,0.775761, 0.547735,0.810008,0.209461, 0.172402,0.980534,0.093968, 0.181303,-0.832329,-0.523792, 0.577034,-0.637883,-0.510036, 0.312877,-0.722275,-0.616787, -0.110493,-0.962702,-0.246973, 0.342173,0.652809,0.675839, 0.447204,0.233584,0.863393, 0.752326,0.154236,-0.640482, 0.331817,0.254835,-0.908271, 0.905252,0.093800,-0.414393, 0.981700,0.067566,-0.178044, 0.996240,0.070764,0.049986, 0.944560,0.096164,0.313941, 0.869946,0.120449,0.478211, 0.707852,0.539887,0.455486, 0.446208,0.740800,0.502110, 0.755338,0.020586,-0.655013, 0.357345,-0.074883,-0.930965, 0.890925,0.075690,-0.447799, 0.957370,0.256767,-0.132336, 0.979832,0.134183,-0.148072, 0.955654,0.261343,-0.135742, 0.964709,0.263013,0.012668, 0.990871,0.133396,0.019473, 0.978486,0.142867,-0.148845, 0.920318,0.119928,0.372333, 0.783387,0.057768,0.618844, 0.433504,-0.016302,0.901004, 0.238071,0.525933,0.816527, 0.307017,0.261341,0.915119, 0.868929,0.150523,0.471493, 0.129730,0.100865,0.986406, 0.407129,-0.138883,0.902750, 0.379871,-0.123573,0.916748, 0.134667,0.086628,0.987097, 0.642025,-0.762318,-0.081705, 0.638387,-0.769573,-0.014833, 0.633824,-0.745274,-0.206962, -0.113423,-0.121711,-0.986064, -0.108841,-0.121276,-0.986634, -0.105787,-0.107778,-0.988531, -0.098793,-0.120818,-0.987746, -0.885169,0.465136,0.011137, -0.906751,0.419557,-0.042116, -0.851317,0.516260,0.093459, -0.277606,0.403602,0.871803, -0.240775,0.372484,0.896261, -0.102835,-0.120703,-0.987348, -0.114316,-0.098726,-0.988527, 0.212462,0.145406,0.966290, 0.333990,0.030361,0.942088, 0.410178,0.096949,0.906838, 0.297210,0.178968,0.937890, 0.016228,0.282027,0.959269, 0.053060,0.331784,0.941862, -0.203176,0.640179,0.740872, -0.227906,0.656557,0.719022, -0.108002,0.586486,0.802727, -0.112931,0.588609,0.800491, -0.030687,0.007780,-0.999499, -0.230260,0.126692,-0.964847, -0.202997,0.332444,-0.921017, 0.101280,0.125289,-0.986937, 0.127240,-0.139134,-0.982065, 0.280477,-0.009985,-0.959809, 0.679877,-0.063026,0.730613, 0.647626,-0.023542,0.761594, 0.575238,0.055782,0.816082, 0.560970,0.073146,0.824598, 0.245636,0.167943,0.954703, 0.369576,0.063450,0.927032, 0.081854,0.319987,0.943879, -0.336872,0.721158,0.605350, -0.358008,0.748207,0.558584, -0.078139,-0.062925,-0.994955, -0.233436,0.044274,-0.971364, 0.034917,-0.151359,-0.987862, 0.788949,-0.165351,0.591793, 0.766020,-0.153241,0.624284, 0.217026,0.143757,0.965522, 0.348250,0.018882,0.937212, 0.029735,0.290022,0.956558, -0.586404,0.726248,0.358739, -0.669975,0.692212,0.268283, -0.102201,-0.072639,-0.992108, -0.216627,0.020152,-0.976047, -0.015026,-0.146809,-0.989051, 0.831393,-0.439614,0.339889, 0.830410,-0.332578,0.447003, 0.147052,0.105883,0.983445, 0.348443,-0.067290,0.934912, 0.339781,-0.028991,0.940058, 0.166037,0.113610,0.979553, -0.138818,0.319333,0.937420, -0.065243,0.284229,0.956534, -0.794320,0.593222,0.130937, -0.804909,0.580491,0.123097, -0.749107,0.640372,0.169592, -0.740803,0.646848,0.181103, -0.102908,-0.089574,-0.990650, -0.148517,-0.046371,-0.987822, -0.181611,-0.007512,-0.983342, -0.107312,-0.078033,-0.991158, -0.066095,-0.125480,-0.989892, -0.045902,-0.135622,-0.989697, 0.720177,-0.686328,0.101488, 0.742362,-0.659525,0.118003, 0.802243,-0.565450,0.191502, 0.797732,-0.577051,0.175029, 0.426829,-0.103101,-0.898436, 0.323965,-0.123426,-0.937983, 0.285430,0.363919,-0.886618, 0.394571,0.458847,-0.796099, 0.776879,-0.606381,-0.169593, 0.724670,-0.673039,-0.147891, 0.673750,-0.698740,-0.240465, 0.730630,-0.615275,-0.296000, 0.878969,-0.306974,-0.364940, 0.870383,-0.420332,-0.256426, 0.751671,-0.509926,-0.418290, 0.729869,-0.344404,-0.590488, 0.835711,-0.097238,-0.540492, 0.604877,-0.220665,-0.765135, 0.824881,-0.000140,-0.565306, 0.406002,-0.025774,-0.913509, 0.054008,0.329855,-0.942486, 0.331590,0.615054,-0.715372, 0.567782,0.342425,-0.748578, 0.226440,0.180734,-0.957110, -0.092591,0.441539,-0.892452, -0.059117,0.797671,-0.600188, -0.420060,0.600182,-0.680685, -0.407055,0.810410,-0.421358, -0.355190,0.800181,-0.483270, -0.298825,0.541834,-0.785569, -0.585639,0.646744,-0.488619, -0.540742,0.777362,-0.321414, -0.705858,0.616151,-0.349461, -0.668338,0.717361,-0.196765, -0.810374,0.529590,-0.250654, -0.808523,0.570072,-0.145977, -0.767305,0.621206,-0.159205, -0.765379,0.577689,-0.283673, 0.661129,-0.747860,0.060118, 0.647331,-0.761733,0.026938, -0.855692,0.468163,-0.220487, -0.877584,0.467674,-0.105487, 0.354387,0.896940,-0.264402, 0.377875,0.911220,0.163980, 0.032231,0.982482,0.183547, 0.030426,0.976032,-0.215491, 0.659535,-0.737170,-0.146950, 0.684671,-0.721373,0.104143, 0.822040,-0.561835,0.092695, 0.796330,-0.583326,-0.159966, 0.868877,-0.450106,-0.206054, 0.885211,-0.408616,-0.222339, 0.739778,-0.623736,-0.252353, 0.686259,-0.691742,-0.224816, 0.796771,0.196998,-0.571268, 0.688155,0.185031,-0.701574, 0.360511,0.033363,-0.932158, 0.494957,0.010186,-0.868858, 0.396088,0.337471,-0.853948, 0.373617,0.498501,-0.782245, 0.167754,0.475969,-0.863315, 0.202384,0.281924,-0.937849, 0.358185,0.862023,-0.358636, 0.079716,0.938748,-0.335256, 0.559659,0.018699,0.828512, 0.604945,-0.100902,0.789849, 0.464644,-0.182020,0.866588, 0.399351,-0.051971,0.915324, 0.817567,-0.545152,0.185456, 0.693246,-0.691707,0.202364, 0.387914,0.870147,0.303920, 0.092772,0.947464,0.306113, 0.455210,0.528058,0.716895, 0.480228,0.358009,0.800756, 0.286192,0.310844,0.906350, 0.233482,0.513758,0.825554, -0.093461,0.979228,0.179938, -0.071832,0.952299,0.296593, -0.075006,0.949988,0.303144, -0.082485,0.980367,0.179100, -0.105611,0.972249,-0.208752, -0.106153,0.977430,-0.182651, -0.092148,0.945015,-0.313776, -0.110289,0.929305,-0.352461, 0.066855,0.230733,-0.970718, 0.014186,0.445425,-0.895207, -0.001971,0.452023,-0.892004, 0.072357,0.229363,-0.970648, 0.205592,-0.128073,-0.970221, 0.154670,-0.051611,-0.986617, 0.189259,-0.063435,-0.979876, 0.221612,-0.142565,-0.964657, 0.568675,-0.790794,-0.226393, 0.571023,-0.778955,-0.259158, 0.580707,-0.768103,-0.269810, 0.584671,-0.772137,-0.248928, 0.571766,-0.808230,-0.140883, 0.583361,-0.795317,-0.164808, 0.606155,-0.787567,0.110966, 0.587059,-0.801903,0.110963, 0.590268,-0.779391,0.210078, 0.598947,-0.771126,0.215933, 0.291746,-0.099790,0.951276, 0.353149,-0.240290,0.904183, 0.377532,-0.232902,0.896229, 0.331526,-0.094795,0.938672, 0.091715,0.484002,0.870247, 0.164449,0.265199,0.950066, 0.193466,0.262945,0.945215, 0.111139,0.475732,0.872541, -0.034034,0.950028,0.310303, -0.037731,0.982908,0.180189, -0.062110,0.974511,-0.215570, -0.069714,0.919086,-0.387841, 0.063206,0.477388,-0.876417, 0.147930,0.256264,-0.955220, 0.268407,-0.034228,-0.962697, 0.302169,-0.120266,-0.945637, 0.629183,-0.714963,-0.304889, 0.635006,-0.713963,-0.294998, 0.636662,-0.745945,-0.195518, 0.663395,-0.739669,0.113122, 0.653227,-0.724309,0.220615, 0.442049,-0.191205,0.876375, 0.395728,-0.050026,0.917004, 0.262041,0.286363,0.921591, 0.179555,0.484002,0.856448, 0.471012,0.140334,-0.870893, 0.875880,0.320563,-0.360657, 0.982948,0.125271,-0.134614, 0.912218,0.021211,0.409156, 0.730909,-0.661269,0.168809, 0.746697,-0.647039,-0.154219, 0.592084,0.215209,0.776609, 0.031597,0.945982,0.322675, 0.034325,0.953760,0.298601, -0.010583,0.999126,-0.040439, 0.006857,0.924608,-0.380859, 0.010927,0.888903,-0.457966, 0.149842,0.508422,-0.847971, 0.246074,0.287494,-0.925632, 0.366270,0.003268,-0.930503, 0.406896,-0.084155,-0.909590, 0.695452,-0.600854,-0.394109, 0.685058,-0.607349,-0.402272, 0.686094,-0.669064,-0.285708, 0.702773,-0.683378,-0.197749, 0.719930,-0.658347,0.219728, 0.718378,-0.650098,0.247599, 0.542404,-0.109542,0.832946, 0.496975,0.020308,0.867527, 0.375851,0.309421,0.873496, 0.297588,0.491318,0.818565, 0.822715,0.566459,-0.047583, 0.983950,0.172369,-0.046157, 0.980551,0.190702,-0.046394, 0.811394,0.584128,-0.020825, -0.917550,-0.396094,-0.034812, -0.952512,-0.304269,-0.011888, -0.881662,0.470695,-0.033443, -0.845551,0.533855,-0.006601, 0.911238,0.387911,-0.138458, 0.891431,0.441945,-0.100176, 0.981518,0.098644,-0.163986, 0.973966,0.083059,-0.210931, -0.950837,0.308728,-0.024398, -0.975481,0.218424,-0.026983, -0.926732,-0.367675,-0.077351, -0.890381,-0.449475,-0.072067, 0.004273,0.065936,-0.997815, 0.290891,0.055639,-0.955137, 0.241537,-0.238778,-0.940556, -0.001061,-0.139205,-0.990263, -0.496497,0.207152,0.842958, -0.490385,0.010257,0.871445, 0.549038,0.066680,0.833134, 0.572485,0.345499,0.743567, -0.945067,0.326419,0.017319, -0.988693,-0.147390,0.027622, -0.969940,-0.113156,0.215433, -0.957540,0.195365,0.212011, 0.983416,0.179363,-0.026869, 0.848050,0.528811,-0.034198, 0.854774,0.510819,0.091784, 0.974939,0.194786,0.107484, 0.804684,0.454879,0.381535, 0.880501,0.226953,0.416186, -0.007925,-0.999968,0.000801, 0.037303,-0.999284,0.006298, 0.048642,-0.998797,-0.006197, -0.885097,0.102227,0.454041, -0.878150,-0.084421,0.470878, -0.012737,0.015821,0.999794, -0.023007,0.039480,0.998955, 0.836436,0.545189,-0.056066, 0.988043,0.149813,-0.036424, -0.099409,0.986791,-0.127910, -0.142871,0.980446,-0.135325, -0.977760,-0.209720,0.001663, -0.913550,0.405678,-0.029176, 0.000000,-0.999935,0.011370, -0.014295,-0.999809,0.013310, 0.007195,-0.999748,0.021253, -0.060830,0.996627,-0.055090, -0.139838,0.989311,-0.041348, 0.239502,-0.578623,-0.779637, -0.013677,-0.606729,-0.794791, -0.509879,-0.854276,-0.101179, -0.507284,-0.857371,-0.087056, -0.510607,-0.859037,-0.036542, -0.595223,-0.803474,0.011772, -0.687698,-0.725335,0.030994, -0.787423,-0.615844,0.026475, -0.891143,-0.403223,0.208028, -0.850878,-0.254770,0.459455, -0.004829,-0.002388,0.999986, -0.487945,-0.188066,0.852374, 0.517352,-0.150453,0.842443, 0.969140,-0.216243,0.118346, 0.910959,-0.053649,0.408993, 0.936391,-0.350717,-0.013038, 0.913195,-0.407524,-0.000205, 0.915597,-0.400940,-0.030482, 0.927350,-0.368626,-0.064322, 0.877351,-0.420225,-0.231661, 0.853675,-0.437954,-0.281841, 0.105413,-0.342348,-0.933641, 0.148225,-0.080297,-0.985688, 0.068246,-0.773865,-0.629663, 0.027431,-0.885463,-0.463899, -0.101310,-0.977491,-0.185063, -0.133286,-0.985148,-0.108254, -0.179942,-0.978626,-0.099560, -0.118538,-0.992422,-0.032351, -0.161214,-0.986617,-0.024443, -0.047138,-0.992627,0.111668, 0.027395,-0.952944,0.301906, 0.087343,-0.816716,0.570391, 0.143655,-0.297432,0.943874, 0.155871,-0.004073,0.987769, 0.155031,0.175534,0.972190, 0.147349,0.245811,0.958053, 0.148641,0.219357,0.964255, 0.154828,0.122017,0.980378, 0.144811,-0.423120,0.894427, 0.218806,-0.261597,0.940048, 0.208898,-0.339728,0.917031, 0.229447,-0.047564,0.972158, 0.226891,0.696470,0.680771, 0.237778,0.209771,0.948398, 0.325029,0.698019,0.638064, 0.163491,0.712160,0.682714, 0.650925,0.383236,0.655307, 0.227854,0.241386,0.943300, 0.163768,0.516572,0.840436, 0.179313,0.169705,0.969045, 0.243606,0.173395,0.954249, 0.139828,0.720305,0.679418, 0.109164,0.948209,0.298299, 0.097288,0.992608,0.072552, 0.084157,0.981641,-0.171166, 0.089973,0.961366,-0.260153, 0.118579,0.804666,-0.581766, 0.140635,0.523093,-0.840592, 0.155812,0.274805,-0.948791, 0.161316,0.017332,-0.986751, 0.159494,-0.046398,-0.986108, 0.158811,-0.099214,-0.982311, 0.151464,-0.252170,-0.955756, 0.139840,-0.386860,-0.911473, 0.143156,-0.096803,-0.984955, 0.135203,0.302498,-0.943512, 0.141608,0.275843,-0.950714, 0.150656,0.187906,-0.970564, 0.179020,0.147792,-0.972682, 1.000000,0.000692,0.000113, 1.000000,0.000692,0.000113, 1.000000,0.000622,0.000101, 1.000000,0.000622,0.000101, 0.000000,-0.992855,-0.119325, 0.000000,-0.992855,-0.119325, 0.000000,-0.992856,-0.119321, 0.000000,-0.992856,-0.119321, -0.062560,-0.034818,0.997434, -0.205717,0.619415,0.757631, 0.837370,0.482508,0.256902, 0.966377,0.010419,0.256917, 0.239820,-0.651828,0.719449, 0.927065,-0.300644,0.223973, 0.028463,-0.999590,-0.003263, 0.069126,-0.997560,0.009810, 0.025040,-0.999683,-0.002590, 0.033744,-0.999362,-0.011669, 0.020528,-0.999357,0.029387, 0.032643,-0.999109,0.026762, 0.040153,-0.998865,0.025603, -0.939539,-0.143589,0.310883, 0.591001,-0.062885,0.804216, 0.406648,-0.584639,0.702022, -0.864663,-0.372083,0.337508, -0.958142,0.119866,0.259992, 0.386397,0.653980,0.650391, 0.042342,0.997143,0.062552, 0.064884,0.965887,0.250703, -0.111173,0.970380,0.214485, -0.071985,0.992214,0.101632, 0.051185,0.128702,0.990362, 0.067804,0.083553,0.994194, 0.084463,0.037657,0.995715, 0.039904,-0.999089,-0.015139, 0.057710,0.994383,0.088729, -0.155765,0.981036,0.115346, -0.157829,0.952849,0.259168, -0.028568,0.965986,0.257011, 0.039802,-0.998789,-0.028907, 0.012868,0.997240,-0.073119, 0.049982,-0.998592,0.017773, 0.064799,-0.997491,0.028504, 0.034096,-0.999310,0.014732, 0.097185,-0.994700,0.033557, 0.025133,-0.999618,0.011494, -0.010486,-0.999942,0.002396, 0.000000,-0.047673,-0.998863, 0.000000,-0.047673,-0.998863, 0.000000,-0.803721,-0.595006, 0.000000,-0.809748,-0.586777, 1.000000,0.000329,0.000332, 1.000000,0.000359,0.000300, 1.000000,0.000016,0.000629, 1.000000,0.000016,0.000627, -0.000015,-0.999297,-0.037500, -0.000012,-0.850745,-0.525578, -0.000000,-0.850746,-0.525576, -0.000000,-0.999297,-0.037500, 1.000000,0.000378,0.000223, 1.000000,0.000353,0.000249, 1.000000,0.000511,0.000039, 1.000000,0.000513,0.000039, 0.000000,-0.293852,-0.955851, 0.000000,-0.293853,-0.955851, -0.000003,-0.621120,-0.783715, -0.000000,-0.621121,-0.783715, 1.000000,0.000218,0.000311, 1.000000,0.000202,0.000328, 1.000000,0.000102,0.000398, 1.000000,0.000102,0.000396, 0.000000,-0.987932,-0.154888, 0.000000,-0.889391,-0.457147, 0.000000,-0.889392,-0.457146, 0.000000,-0.987932,-0.154887, 1.000000,0.000291,0.000158, 1.000000,0.000286,0.000163, 1.000000,0.000346,0.000068, 1.000000,0.000347,0.000069, -0.000000,-0.411896,-0.911231, -0.000021,-0.411897,-0.911231, -0.000025,-0.496746,-0.867896, -0.000000,-0.496746,-0.867896, 1.000000,0.000141,0.000266, 1.000000,0.000138,0.000269, 1.000000,0.000116,0.000277, 1.000000,0.000116,0.000277, -0.000016,-0.931202,-0.364504, -0.000026,-0.794490,-0.607277, -0.000000,-0.794492,-0.607275, -0.000000,-0.931203,-0.364502, 1.000000,0.000206,0.000162, 1.000000,0.000201,0.000167, 1.000000,0.000250,0.000102, 1.000000,0.000251,0.000102, -0.000000,-0.507221,-0.861816, -0.000001,-0.507222,-0.861816, 0.000000,-0.612828,-0.790216, 0.000000,-0.612832,-0.790214, 1.000000,0.000124,0.000193, 1.000000,0.000116,0.000199, 1.000000,0.000076,0.000176, 1.000000,0.000076,0.000176, 0.461622,0.046602,-0.885852, 0.462714,-0.214707,-0.860114, 0.415622,-0.534036,-0.736250, 0.028422,-0.998838,-0.038909, 0.024328,-0.998753,-0.043587, 0.016721,-0.998689,-0.048378, 0.019296,-0.999768,-0.009549, 0.025609,-0.999530,0.016866, 0.030966,-0.999209,0.024951, 0.056340,-0.998127,0.023858, 0.112914,-0.992814,0.039637, -0.053350,0.991903,-0.115246, 0.187988,0.101922,0.976869, 0.193359,0.106072,0.975378, 0.192899,0.105717,0.975507, 0.187988,0.101922,0.976869, -0.201214,-0.046500,-0.978443, -0.202048,-0.045692,-0.978309, -0.139894,-0.104985,-0.984585, -0.139894,-0.104985,-0.984585, -0.644291,0.748046,0.159110, -0.591147,0.738174,0.325031, -0.591147,0.738174,0.325031, -0.643475,0.748071,0.162264, 0.360686,0.011146,0.932621, 0.365379,0.092587,0.926243, 0.500019,-0.044690,0.864860, 0.411513,-0.907050,0.088982, 0.289816,-0.942646,-0.165609, 0.241757,-0.937182,-0.251482, 0.411513,-0.907050,0.088982, -0.377125,-0.139787,-0.915552, -0.387632,-0.108344,-0.915425, -0.333083,-0.063561,-0.940753, -0.373097,-0.181728,-0.909821, 0.240108,0.034630,0.970128, 0.252644,0.014633,0.967449, 0.336136,-0.146288,0.930383, -0.225295,-0.060259,-0.972425, -0.225359,-0.060124,-0.972419, -0.280167,0.066802,-0.957624, 0.218166,0.091143,0.971646, 0.215576,0.094924,0.971862, 0.302041,0.170741,0.937880, 0.997708,-0.013415,-0.066325, 0.889252,-0.014225,0.457197, 0.769030,0.616117,0.170271, 0.789518,0.561174,-0.248486, -0.227414,-0.071690,-0.971156, -0.261320,0.009050,-0.965210, -0.300826,-0.172667,-0.937918, -0.189828,-0.148159,-0.970574, 0.511854,0.804736,0.300675, 0.461885,0.885023,-0.058291, 0.217645,0.089369,0.971928, 0.989108,-0.077082,0.125392, 0.943454,-0.089475,-0.319200, -0.500043,0.044402,-0.864862, 0.384908,0.013883,0.922851, 0.375330,0.036995,0.926153, 0.117814,-0.887239,-0.446012, 0.117814,-0.887239,-0.446012, 0.650527,0.409723,-0.639486, 0.620961,-0.184463,-0.761827, 0.787743,-0.090329,-0.609345, 0.602625,-0.665128,-0.440962, 0.737621,0.079513,-0.670517, 0.357955,0.839419,-0.408955, 0.696221,0.431714,-0.573498, 0.766312,-0.119297,-0.631296, 0.440671,0.557952,-0.703206, 0.099072,0.833288,-0.543889, -0.683115,0.728190,-0.055615, -0.683115,0.728190,-0.055615, 0.086448,0.868161,0.488695, -0.002960,0.834740,0.550636, -0.691086,0.706929,0.150507, -0.621443,0.671150,0.404187, -0.324885,0.879012,0.348981, -0.350595,0.933523,0.074955, -0.709302,0.681358,-0.180674, -0.450471,0.853225,-0.262838, -0.018687,0.998130,-0.058196, -0.199990,0.820860,-0.534970, -0.087284,0.847569,-0.523458, 0.092612,0.795157,-0.599290, 0.276356,0.526396,-0.804074, 0.379458,0.313733,-0.870393, 0.487496,0.052031,-0.871574, 0.523876,-0.025487,-0.851413, 0.670546,-0.472205,-0.572180, 0.530893,-0.462152,-0.710329, 0.162703,-0.366336,-0.916147, 0.045239,-0.295177,-0.954371, 0.946341,-0.185730,-0.264468, 0.744668,-0.627149,-0.228370, 0.452368,-0.431036,-0.780751, 0.674625,-0.082473,-0.733539, 0.689892,-0.668651,0.277408, 0.936909,-0.231835,0.261636, 0.567910,-0.568634,0.595091, 0.475588,-0.556173,0.681533, 0.122542,-0.452331,0.883391, 0.756711,0.069555,0.650038, 0.730105,0.157695,0.664890, 0.652942,0.354979,0.669072, 0.592205,0.476228,0.650001, -0.967168,-0.125404,0.221043, -0.935340,-0.120027,0.332766, -0.935340,-0.120027,0.332766, -0.967630,-0.125487,0.218963, 0.099682,0.026944,0.994654, 0.080625,0.029168,0.996318, 0.073572,0.029988,0.996839, 0.099682,0.026944,0.994654, 0.954042,0.288891,-0.079661, 0.932338,0.282528,-0.225663, 0.929756,0.281763,-0.236990, 0.954042,0.288891,-0.079661, -0.989928,-0.130148,0.055710, -0.989928,-0.130148,0.055710, 0.875270,0.265508,-0.404238, 0.875270,0.265508,-0.404238, 0.003804,-0.008654,-0.999955, 0.003253,-0.008838,-0.999956, -0.006697,-0.012161,-0.999904, -0.006697,-0.012161,-0.999904, -0.724531,-0.683565,0.088280, -0.714356,-0.689183,0.121332, -0.714356,-0.689183,0.121332, -0.725824,-0.682751,0.083854, -0.151973,0.241918,-0.958321, -0.145618,0.231538,-0.961866, -0.207399,0.332488,-0.920020, -0.207399,0.332488,-0.920020, 0.691525,0.714181,-0.108346, 0.718809,0.690175,-0.083501, 0.709845,0.698347,-0.091823, 0.691525,0.714181,-0.108346, -0.731324,-0.678987,0.064351, -0.731324,-0.678987,0.064351, 0.735036,0.674609,-0.068006, 0.735036,0.674609,-0.068006, 0.277281,-0.284222,0.917787, 0.191171,-0.196717,0.961642, 0.189516,-0.195035,0.962312, 0.277281,-0.284222,0.917787, 0.515550,0.068830,0.854091, 0.436281,-0.122302,0.891460, 0.436281,-0.122302,0.891460, 0.728674,-0.636056,0.253904, 0.700834,-0.659803,-0.271092, 0.501266,-0.518438,-0.692788, -0.430708,0.038837,-0.901655, -0.430708,0.038837,-0.901655, 0.169973,-0.066557,-0.983199, -0.240651,0.692400,0.680198, 0.060498,0.031502,0.997671, 0.060498,0.031502,0.997671, 0.047584,0.970710,0.235493, 0.043388,0.998563,0.031467, 0.031323,0.941928,-0.334351, 0.015477,-0.004755,-0.999869, 0.015477,-0.004755,-0.999869, -0.263591,0.613746,-0.744201, 0.164385,-0.169489,0.971726, 0.164385,-0.169489,0.971726, 0.281060,-0.932839,0.225426, 0.227587,-0.933467,-0.277207, 0.126257,-0.721869,-0.680415, -0.127611,0.202133,-0.971009, -0.127611,0.202133,-0.971009, 0.581764,0.249801,0.774048, 0.751748,0.451282,-0.480853, 0.437018,0.232053,-0.869003, -0.091916,0.982301,0.163205, -0.139020,0.981230,0.133645, -0.017555,0.976368,0.215402, -0.000242,0.996431,0.084412, -0.033470,0.974531,0.221742, 0.017236,-0.999420,0.029378, 0.165223,0.171828,0.971173, 0.165223,0.171828,0.971173, 0.165223,0.171828,0.971173, -0.000000,0.975634,0.219403, 0.214917,0.891694,0.398362, 0.214917,0.891694,0.398362, 0.507754,-0.742544,0.436823, 0.507754,-0.742544,0.436823, 0.507754,-0.742544,0.436823, 0.507754,-0.742544,0.436823, 0.236611,0.820895,0.519757, 0.236611,0.820895,0.519757, 0.236611,0.820895,0.519757, 0.331491,-0.158316,0.930081, 0.331491,-0.158316,0.930080, 0.331491,-0.158316,0.930081, 0.331491,-0.158316,0.930080, 0.235096,-0.025671,0.971633, 0.222621,0.188236,0.956560, 0.234065,0.193434,0.952784, 0.230532,-0.195007,0.953324, 0.139008,-0.000552,0.990291, 0.125394,-0.241603,0.962239, 0.070961,-0.382230,0.921339, 0.218996,-0.371750,0.902133, 0.243469,0.096680,0.965078, 0.243429,0.073244,0.967149, 0.479895,0.233995,0.845545, 0.227769,0.181977,0.956559, 0.167098,-0.017623,0.985783, 0.116788,0.195459,0.973733, 0.000000,0.000000,0.000000, 0.000000,0.000000,0.000000, 0.000000,0.000000,0.000000, 0.000000,0.000000,0.000000, 0.164399,0.986394,0.000000, 0.164399,0.986394,0.000000, 0.000000,0.296207,0.955124, 0.000000,0.000000,0.000000, 0.000000,0.000000,0.000000, 0.000000,0.296207,0.955124, 0.000000,-1.000000,0.000029, 0.000000,-0.916820,0.399301, 0.000000,-1.000000,-0.000007, 0.000000,-0.916601,0.399803, 0.000000,-0.279213,0.960229, -0.995525,0.087560,-0.035556, -0.995525,0.087560,-0.035556, -0.995228,0.087654,-0.042863, -0.995214,0.087658,-0.043188, -0.050287,-0.998734,-0.001371, -0.050287,-0.998734,-0.001371, -0.050287,-0.998734,-0.001371, -0.050287,-0.998734,-0.001371, -0.939589,0.339112,-0.046650, -0.939589,0.339112,-0.046650, -0.939589,0.339112,-0.046650, -0.939589,0.339112,-0.046650, -0.639317,0.768782,-0.015741, -0.639317,0.768782,-0.015741, -0.639317,0.768782,-0.015741, -0.639317,0.768782,-0.015741, -0.874011,0.484510,-0.036802, -0.874011,0.484510,-0.036802, -0.874011,0.484510,-0.036802, -0.874011,0.484510,-0.036802, -0.322247,-0.946647,-0.004143, -0.322247,-0.946647,-0.004143, -0.322247,-0.946647,-0.004143, -0.322247,-0.946647,-0.004143, 0.000000,-0.427296,0.904112, 0.000000,-0.427296,0.904112, 0.000000,-0.427296,0.904112, 0.000000,-0.427296,0.904112, -0.357655,0.222865,0.906870, -0.357414,0.227833,0.905730, -0.357443,0.227243,0.905867, 0.159029,-0.529451,0.833302, 0.159029,-0.529451,0.833302, 0.159029,-0.529450,0.833302, 0.159029,-0.529450,0.833302, -0.323434,0.079215,0.942929, -0.323434,0.079215,0.942929, -0.323434,0.079215,0.942929, -0.323434,0.079215,0.942929, -0.217497,0.152580,0.964062, -0.217497,0.152580,0.964062, -0.217497,0.152580,0.964061, -0.217497,0.152580,0.964061, -0.369406,-0.045071,0.928175, -0.369406,-0.045071,0.928175, -0.369406,-0.045071,0.928175, -0.369406,-0.045071,0.928175, 0.018913,-0.433722,0.900848, 0.018913,-0.433722,0.900848, 0.018913,-0.433722,0.900848, 0.018913,-0.433722,0.900848, 0.723241,0.158811,0.672088, 0.720839,0.183953,0.668246, 0.639180,0.168466,0.750379, 0.581219,0.143656,0.800967, 0.844091,0.197425,0.498533, 0.837871,0.155390,0.523284, 0.680877,0.178483,0.710317, 0.862742,0.160157,0.479610, 0.834277,0.130168,0.535759, 0.508219,0.253375,0.823113, 0.566218,0.260933,0.781864, 0.527933,0.187825,0.828256, 0.498751,0.160583,0.851740, 0.503615,0.228143,0.833260, 0.492498,0.111912,0.863088, 0.168053,0.232816,0.957891, 0.511728,0.098743,0.853454, -0.043602,-0.948542,0.313636, 0.168047,-0.983164,0.071754, 0.542156,-0.643275,0.540615, 0.425287,-0.636212,0.643712, -0.204646,-0.808981,0.551062, 0.382577,-0.567188,0.729337, -0.475399,-0.142621,0.868133, -0.435869,-0.341061,0.832884, 0.187098,-0.058447,0.980601, 0.174210,-0.003142,0.984704, -0.298288,0.854574,0.425121, -0.397252,0.781739,0.480703, 0.240344,0.691960,0.680754, 0.300361,0.747379,0.592628, -0.005036,0.999969,0.006120, -0.077666,0.982172,0.171189, 0.289101,0.826338,0.483308, 0.276944,0.815870,0.507600, 0.858648,0.034957,-0.511372, 0.803448,0.258379,-0.536388, 0.920702,0.332936,0.203622, 0.965468,0.148318,0.214182, 0.400258,0.791858,-0.461253, 0.400258,0.791858,-0.461253, 0.639870,0.722842,0.260894, 0.639892,0.722727,0.261159, 0.843111,-0.278949,-0.459730, 0.957341,-0.138385,0.253667, -0.488183,-0.035636,0.872013, 0.201343,0.040467,0.978685, 0.393365,-0.907983,-0.144330, 0.661525,-0.598910,0.451322, 0.771571,-0.491733,-0.403581, 0.904898,-0.330776,0.267858, 0.597796,-0.488947,0.635273, 0.539911,-0.491123,0.683589, 0.505459,-0.467581,0.725175, 0.293570,-0.002505,0.955934, 0.326213,0.035515,0.944629, 0.397362,0.613164,0.682740, 0.412888,0.686833,0.598150, 0.369120,0.750742,0.547848, 0.322689,0.741482,0.588282, 0.870014,0.322727,0.372724, 0.921903,0.134080,0.363480, 0.642850,0.639059,0.422312, 0.642850,0.639059,0.422312, 0.912794,-0.090591,0.398246, 0.342507,0.054841,0.937913, 0.676303,-0.460847,0.574659, 0.863587,-0.256455,0.434107, -0.357414,0.227842,0.905728, -0.357414,0.227842,0.905728, -0.995185,0.087666,-0.043835, -0.995185,0.087666,-0.043835, -0.135373,0.986023,0.097121, 0.005721,0.977380,0.211414, -0.168202,0.949915,0.263380, -0.139828,0.720305,0.679418, -0.109164,0.948209,0.298300, -0.027395,-0.952944,0.301906, 0.047138,-0.992627,0.111668, -0.139008,-0.000552,0.990291, -0.125393,-0.241603,0.962239, -0.151464,-0.252170,-0.955756, -0.158811,-0.099214,-0.982311, -0.205387,-0.346049,0.915460, -0.132106,-0.634949,0.761175, -0.139840,-0.386860,-0.911473, -0.828052,0.502851,0.247932, -0.620242,0.604946,0.499340, -0.540874,0.803835,0.247597, -0.295275,0.309312,0.903957, -0.448833,0.165531,0.878151, -0.451665,0.162773,0.877213, -0.287874,0.316709,0.903783, -0.910064,-0.010737,-0.414328, -0.912788,0.089630,-0.398478, -0.782012,-0.000024,-0.623264, -0.756495,-0.114483,-0.643901, -0.876442,-0.228036,-0.424086, -0.729085,-0.269427,-0.629162, -0.495664,-0.779861,0.382275, -0.675677,-0.677134,0.291463, -0.708426,-0.516629,0.480861, -0.619356,-0.159062,0.768829, -0.846934,-0.071194,0.526910, -0.753671,-0.432824,0.494614, -0.564138,-0.471661,0.677705, -0.841982,0.285021,0.458072, -0.666836,0.163790,0.726982, -0.140635,0.523093,-0.840592, -0.118579,0.804666,-0.581766, -0.881842,0.299048,-0.364588, -0.801528,0.515227,-0.303470, -0.663086,0.599543,-0.448180, -0.734836,0.364602,-0.571911, -0.707458,0.451920,0.543390, -0.163768,0.516573,0.840436, -0.141608,0.275843,-0.950714, -0.135203,0.302498,-0.943512, -0.872666,0.274783,-0.403668, -0.903937,-0.194686,-0.380783, -0.844811,0.093095,-0.526903, -0.813696,0.266243,-0.516733, -0.319228,0.646004,0.693377, -0.267261,0.960538,0.077056, -0.725534,0.682168,0.090814, -0.491145,0.488341,0.721318, -0.823050,-0.099080,0.559260, -0.879917,-0.364770,0.304449, -0.848111,0.296810,0.438875, -0.802053,0.271648,0.531901, -0.148641,0.219357,0.964255, -0.154828,0.122017,0.980378, -0.179020,0.147792,-0.972682, -0.150656,0.187906,-0.970564, -0.874574,0.194867,-0.444013, -0.857386,0.244758,-0.452751, -0.795049,0.229321,-0.561523, -0.770541,0.158823,-0.617287, -0.811210,0.544195,-0.213989, -0.968950,-0.095126,-0.228225, -0.911374,-0.234435,0.338288, -0.817405,0.512875,0.262316, -0.795925,0.220563,0.563787, -0.866140,0.208084,0.454425, -0.900396,0.223593,0.373221, -0.782606,0.185230,0.594321, -0.155031,0.175534,0.972190, -0.147349,0.245811,0.958053, -0.068246,-0.773865,-0.629663, -0.105413,-0.342348,-0.933641, -0.751033,-0.521641,-0.404772, -0.873428,-0.189861,-0.448415, -0.725858,-0.218341,-0.652270, -0.604475,-0.571498,-0.554977, -0.752383,-0.217019,0.621950, -0.899825,-0.186588,0.394334, -0.721692,-0.590078,0.361896, -0.618420,-0.611987,0.492979, -0.143655,-0.297432,0.943874, -0.087343,-0.816716,0.570391, -0.143156,-0.096803,-0.984955, -0.805020,-0.452318,-0.383865, -0.748334,-0.322330,-0.579741, -0.577275,-0.590581,0.563886, -0.665901,-0.618243,0.417554, -0.144811,-0.423119,0.894427, 0.133286,-0.985148,-0.108254, 0.101310,-0.977491,-0.185063, -0.810650,-0.563993,-0.157348, -0.738581,-0.579461,-0.344561, -0.794920,-0.359494,-0.488739, -0.716946,-0.688359,-0.110231, -0.967602,-0.186022,-0.170709, -0.849463,-0.498624,-0.172587, -0.498376,-0.085762,-0.862709, -0.451930,-0.021488,-0.891795, -0.520373,-0.162147,-0.838404, -0.449764,-0.149408,-0.880562, -0.266072,0.470954,-0.841076, -0.257032,0.513096,-0.818943, -0.351511,0.233724,-0.906539, -0.313556,0.493772,-0.811093, -0.812377,-0.569185,-0.126775, -0.657020,-0.751119,-0.064374, -0.979513,0.097006,-0.176474, -0.970061,-0.171237,-0.172218, -0.964651,0.199099,-0.172651, -0.845119,0.508872,-0.163777, -0.939936,0.297291,-0.167745, -0.557601,0.807909,-0.190696, -0.538911,0.810206,-0.230521, -0.084157,0.981641,-0.171166, -0.089973,0.961366,-0.260154, -0.293907,0.699045,0.651885, -0.215540,0.929495,0.299301, -0.520133,0.534254,0.666359, -0.390672,-0.031403,0.919994, -0.382566,-0.208728,0.900042, -0.307540,-0.528448,0.791304, -0.321413,-0.469509,0.822347, -0.423451,0.088388,0.901597, -0.438716,0.234946,0.867369, -0.410515,0.163998,0.896985, -0.405395,0.243540,0.881104, -0.439223,-0.283484,0.852479, -0.279053,-0.782388,0.556775, 0.029372,-0.988891,0.145709, -0.182608,-0.929385,0.320776, -0.428071,-0.811531,0.397710, 0.016095,-0.999079,-0.039789, 0.041008,-0.998348,-0.040248, 0.037573,-0.998609,-0.036993, 0.005385,-0.999212,-0.039334, -0.325610,-0.325161,-0.887834, -0.200141,-0.750719,-0.629575, -0.371000,0.190105,-0.908966, -0.383923,0.126755,-0.914624, -0.362886,0.282601,-0.887947, -0.376292,0.269129,-0.886552, -0.372524,-0.118960,-0.920367, -0.340483,-0.239116,-0.909338, -0.332188,-0.368637,-0.868193, -0.363211,-0.092340,-0.927120, -0.284590,0.776582,-0.562076, -0.316929,0.503525,-0.803753, -0.204667,0.946339,-0.250107, -0.173336,0.969019,-0.175948, -0.128456,0.440254,0.888637, -0.139461,0.433104,0.890490, -0.159494,-0.046398,-0.986108, -0.161316,0.017332,-0.986751, -0.794352,-0.040885,-0.606080, -0.355725,0.001651,-0.934589, -0.362785,-0.050571,-0.930500, -0.793677,-0.017130,-0.608098, -0.922688,0.030805,-0.384316, -0.925384,-0.053048,-0.375301, -0.984801,-0.061336,-0.162499, -0.982017,0.087536,-0.167272, -0.836128,0.331012,0.437402, -0.812982,0.418987,0.404364, -0.685373,0.415035,0.598339, -0.702485,0.553377,0.447537, -0.499269,0.712562,0.492935, -0.163491,0.712160,0.682714, -0.226891,0.696470,0.680772, 0.007733,-0.999911,-0.010905, 0.030423,-0.999470,-0.011558, 0.024695,-0.999643,0.010220, -0.000485,-0.999895,0.014462, -0.809446,-0.586555,0.027397, -0.980546,-0.192943,0.036086, -0.846699,-0.529328,0.053970, -0.592005,0.037229,0.805074, -0.577827,0.028515,0.815661, -0.585531,0.023323,0.810314, -0.593995,0.130128,0.793874, -0.461158,0.410625,0.786588, -0.488769,0.399124,0.775761, -0.561030,0.275024,0.780773, -0.461158,0.410625,0.786588, -0.814790,-0.575352,-0.071319, -0.640318,-0.763585,-0.083254, -0.816998,-0.569950,0.087585, -0.995385,0.084264,-0.045908, -0.974873,-0.217447,-0.048372, -0.957720,-0.251798,0.139180, -0.988487,0.051201,0.142379, -0.971335,0.233789,-0.043021, -0.944220,0.292202,0.151878, -0.999955,-0.008564,-0.004040, -0.988577,0.145025,-0.041031, -0.936983,0.305711,0.169128, -0.950740,0.142209,0.275447, -0.859081,0.508256,0.060458, -0.948884,0.315138,0.017519, -0.918139,0.292085,0.267781, -0.547735,0.810007,0.209462, -0.172402,0.980534,0.093968, -0.097288,0.992608,0.072552, -0.027431,-0.885463,-0.463899, -0.181303,-0.832329,-0.523792, 0.110493,-0.962702,-0.246973, -0.312877,-0.722275,-0.616788, -0.577035,-0.637883,-0.510036, -0.342173,0.652809,0.675839, -0.447204,0.233585,0.863393, 0.000000,0.290131,0.956987, -0.237778,0.209771,0.948398, -0.155812,0.274805,-0.948791, -0.752326,0.154237,-0.640482, -0.331817,0.254835,-0.908271, -0.913185,0.094272,-0.396492, -0.983076,0.066049,-0.170879, -0.997605,0.069142,0.001686, -0.944655,0.096044,0.313692, -0.709571,0.537745,0.455346, -0.446206,0.740793,0.502121, -0.168053,0.232816,0.957891, 0.000016,0.866805,-0.498648, 0.000000,0.866805,-0.498647, -0.000000,0.866805,-0.498647, 0.000016,0.866805,-0.498648, -0.357345,-0.074883,-0.930966, -0.755338,0.020586,-0.655013, -0.890925,0.075690,-0.447799, -0.957370,0.256767,-0.132336, -0.979832,0.134183,-0.148071, -0.964709,0.263013,0.012668, -0.990871,0.133396,0.019473, -0.920318,0.119929,0.372333, -0.783387,0.057768,0.618844, -0.433504,-0.016302,0.901004, -0.155871,-0.004073,0.987769, -0.148225,-0.080297,-0.985688, -0.179313,0.169705,0.969045, -0.307015,0.261339,0.915120, -0.238071,0.525934,0.816527, -0.868929,0.150524,0.471493, -0.832379,0.358518,0.422622, -0.129731,0.100865,0.986406, -0.134668,0.086628,0.987097, -0.379872,-0.123573,0.916748, -0.407130,-0.138883,0.902750, -0.610598,-0.789842,-0.057608, -0.661129,-0.747859,0.060119, -0.631429,-0.775302,-0.014307, 0.112896,-0.115584,-0.986861, 0.098248,-0.117583,-0.988191, 0.105655,-0.106167,-0.988719, 0.108632,-0.117756,-0.987083, 0.277606,0.403602,0.871803, 0.240775,0.372483,0.896261, 0.114317,-0.098726,-0.988527, 0.102835,-0.120703,-0.987348, -0.212462,0.145407,0.966290, -0.297210,0.178969,0.937889, -0.410178,0.096950,0.906838, -0.333989,0.030361,0.942088, -0.016228,0.282028,0.959269, -0.053061,0.331786,0.941861, 0.203176,0.640179,0.740872, 0.112931,0.588609,0.800492, 0.108003,0.586490,0.802724, 0.227906,0.656556,0.719022, 0.030687,0.007780,-0.999499, -0.101280,0.125289,-0.986937, 0.202997,0.332445,-0.921017, 0.230260,0.126692,-0.964847, -0.127241,-0.139134,-0.982065, -0.280477,-0.009985,-0.959809, -0.679874,-0.063024,0.730616, -0.560968,0.073145,0.824600, -0.575237,0.055782,0.816082, -0.647626,-0.023542,0.761595, -0.245636,0.167943,0.954703, -0.369576,0.063450,0.927032, -0.081854,0.319987,0.943879, 0.336873,0.721159,0.605348, 0.358008,0.748209,0.558582, 0.078139,-0.062925,-0.994955, 0.233436,0.044274,-0.971364, -0.034917,-0.151359,-0.987862, -0.788950,-0.165349,0.591792, -0.766020,-0.153242,0.624284, -0.217026,0.143757,0.965522, -0.348250,0.018882,0.937211, -0.029735,0.290022,0.956558, 0.586405,0.726249,0.358737, 0.669975,0.692212,0.268284, 0.102200,-0.072639,-0.992108, 0.216627,0.020152,-0.976047, 0.015025,-0.146809,-0.989051, -0.831394,-0.439614,0.339887, -0.830411,-0.332578,0.447002, -0.147052,0.105883,0.983445, -0.166037,0.113610,0.979553, -0.339781,-0.028991,0.940058, -0.348443,-0.067290,0.934912, 0.138818,0.319333,0.937420, 0.065244,0.284230,0.956534, 0.794320,0.593221,0.130937, 0.740803,0.646848,0.181101, 0.749107,0.640372,0.169595, 0.804908,0.580490,0.123101, 0.102908,-0.089574,-0.990650, 0.107312,-0.078033,-0.991158, 0.181611,-0.007512,-0.983342, 0.148516,-0.046371,-0.987822, 0.066095,-0.125480,-0.989892, 0.045901,-0.135622,-0.989697, -0.720177,-0.686328,0.101485, -0.797733,-0.577052,0.175021, -0.802243,-0.565450,0.191499, -0.742362,-0.659525,0.118002, 0.118538,-0.992422,-0.032351, 0.031546,-0.998738,-0.039089, 0.008420,-0.998997,-0.043971, -0.799188,-0.578476,-0.163288, -0.662517,-0.738876,-0.123018, -0.969359,-0.176908,-0.170434, -0.849442,-0.498666,-0.172573, -0.978486,0.142867,-0.148844, -0.955654,0.261344,-0.135741, -0.426829,-0.103099,-0.898436, -0.323965,-0.123425,-0.937983, -0.285430,0.363923,-0.886617, -0.394573,0.458851,-0.796095, -0.625686,-0.772912,-0.105467, -0.609499,-0.789460,-0.072553, -0.776879,-0.606381,-0.169591, -0.730631,-0.615276,-0.295997, -0.673750,-0.698740,-0.240464, -0.724670,-0.673039,-0.147888, -0.878968,-0.306974,-0.364942, -0.729868,-0.344403,-0.590490, -0.751671,-0.509925,-0.418290, -0.870383,-0.420332,-0.256427, -0.835711,-0.097239,-0.540492, -0.604876,-0.220665,-0.765135, -0.824882,-0.000141,-0.565305, -0.406003,-0.025774,-0.913508, -0.054009,0.329856,-0.942485, -0.226441,0.180735,-0.957110, -0.567781,0.342426,-0.748578, -0.331590,0.615052,-0.715373, 0.092591,0.441541,-0.892451, 0.059118,0.797668,-0.600193, 0.420060,0.600182,-0.680684, 0.298825,0.541831,-0.785572, 0.355190,0.800180,-0.483273, 0.407055,0.810409,-0.421359, 0.585639,0.646745,-0.488618, 0.540743,0.777362,-0.321412, 0.705858,0.616152,-0.349460, 0.668338,0.717362,-0.196765, 0.810374,0.529590,-0.250656, 0.765380,0.577688,-0.283673, 0.767305,0.621205,-0.159206, 0.808523,0.570071,-0.145980, 0.905856,0.418928,-0.062639, 0.855692,0.468162,-0.220489, 0.877584,0.467674,-0.105488, 0.885169,0.465136,0.011138, 0.851317,0.516260,0.093461, -0.617316,-0.761198,-0.198743, -0.868878,-0.450103,-0.206054, -0.686259,-0.691741,-0.224816, -0.739779,-0.623735,-0.252353, -0.885212,-0.408613,-0.222339, -0.796770,0.196998,-0.571270, -0.494957,0.010186,-0.868858, -0.360511,0.033363,-0.932158, -0.688154,0.185031,-0.701575, -0.396087,0.337471,-0.853948, -0.202384,0.281923,-0.937849, -0.167754,0.475968,-0.863315, -0.373615,0.498501,-0.782246, -0.358183,0.862024,-0.358637, -0.079716,0.938748,-0.335258, -0.030426,0.976032,-0.215492, -0.354385,0.896940,-0.264404, -0.559661,0.018700,0.828511, -0.399351,-0.051971,0.915324, -0.464644,-0.182020,0.866588, -0.604947,-0.100900,0.789847, -0.817565,-0.545154,0.185455, -0.693245,-0.691708,0.202363, -0.684671,-0.721374,0.104143, -0.822039,-0.561836,0.092695, -0.377873,0.911220,0.163980, -0.032231,0.982482,0.183547, -0.092772,0.947464,0.306113, -0.387911,0.870148,0.303921, -0.455208,0.528058,0.716896, -0.233481,0.513758,0.825554, -0.286192,0.310844,0.906350, -0.480228,0.358010,0.800756, -0.796332,-0.583324,-0.159966, -0.659535,-0.737170,-0.146951, 0.093461,0.979228,0.179939, 0.082485,0.980367,0.179100, 0.075007,0.949988,0.303144, 0.071832,0.952299,0.296593, 0.092148,0.945015,-0.313777, 0.110289,0.929305,-0.352460, 0.105611,0.972250,-0.208752, 0.106154,0.977430,-0.182651, -0.066854,0.230733,-0.970718, -0.072357,0.229363,-0.970648, 0.001971,0.452023,-0.892004, -0.014186,0.445424,-0.895207, -0.205592,-0.128073,-0.970221, -0.221611,-0.142565,-0.964657, -0.189259,-0.063435,-0.979876, -0.154670,-0.051611,-0.986617, -0.568675,-0.790794,-0.226392, -0.584671,-0.772137,-0.248928, -0.580707,-0.768103,-0.269810, -0.571022,-0.778955,-0.259158, -0.571766,-0.808230,-0.140883, -0.583361,-0.795317,-0.164808, -0.590268,-0.779391,0.210078, -0.598947,-0.771126,0.215933, -0.606155,-0.787568,0.110966, -0.587059,-0.801903,0.110963, -0.291746,-0.099790,0.951276, -0.331526,-0.094795,0.938672, -0.377532,-0.232902,0.896229, -0.353149,-0.240290,0.904183, -0.091715,0.484002,0.870247, -0.111139,0.475732,0.872541, -0.193466,0.262945,0.945215, -0.164450,0.265198,0.950066, 0.037731,0.982908,0.180189, 0.034034,0.950028,0.310303, 0.069714,0.919086,-0.387842, 0.062110,0.974511,-0.215570, -0.147930,0.256264,-0.955220, -0.063206,0.477388,-0.876416, -0.302169,-0.120266,-0.945637, -0.268407,-0.034228,-0.962697, -0.635007,-0.713963,-0.294998, -0.629183,-0.714962,-0.304889, -0.636662,-0.745945,-0.195517, -0.653227,-0.724310,0.220615, -0.663395,-0.739669,0.113122, -0.395728,-0.050026,0.917004, -0.442049,-0.191205,0.876375, -0.179554,0.484001,0.856448, -0.262041,0.286363,0.921591, -0.471013,0.140333,-0.870893, -0.875880,0.320566,-0.360655, -0.982948,0.125271,-0.134616, -0.746697,-0.647039,-0.154220, -0.730911,-0.661267,0.168806, -0.912218,0.021215,0.409155, -0.592085,0.215209,0.776608, -0.034326,0.953761,0.298601, -0.031597,0.945982,0.322675, -0.010927,0.888903,-0.457966, -0.006856,0.924607,-0.380862, -0.246073,0.287494,-0.925632, -0.149842,0.508423,-0.847970, -0.366270,0.003268,-0.930503, -0.406896,-0.084155,-0.909590, -0.685058,-0.607349,-0.402272, -0.695452,-0.600854,-0.394108, -0.686094,-0.669064,-0.285707, -0.718378,-0.650098,0.247599, -0.719930,-0.658347,0.219727, -0.496975,0.020309,0.867527, -0.542404,-0.109541,0.832946, -0.375851,0.309420,0.873496, -0.297588,0.491317,0.818565, -0.911239,0.387909,-0.138459, -0.973966,0.083058,-0.210932, -0.981518,0.098644,-0.163986, -0.891432,0.441944,-0.100176, 0.950838,0.308727,-0.024398, 0.890380,-0.449476,-0.072067, 0.926731,-0.367677,-0.077351, 0.975481,0.218422,-0.026983, -0.004273,0.065936,-0.997815, 0.001061,-0.139204,-0.990263, -0.241537,-0.238778,-0.940556, -0.290890,0.055639,-0.955137, 0.496497,0.207152,0.842959, -0.572485,0.345500,0.743566, -0.549037,0.066678,0.833134, 0.490386,0.010255,0.871445, -0.980551,0.190700,-0.046394, -0.811394,0.584128,-0.020826, 0.845550,0.533855,-0.006600, 0.917550,-0.396094,-0.034812, 0.945066,0.326420,0.017319, 0.957540,0.195366,0.212012, 0.969941,-0.113155,0.215433, 0.988693,-0.147388,0.027622, -0.983416,0.179362,-0.026869, -0.974939,0.194786,0.107484, -0.854774,0.510820,0.091784, -0.848050,0.528811,-0.034198, -0.880500,0.226955,0.416186, -0.804683,0.454881,0.381534, 0.011538,-0.999929,0.003051, -0.047039,-0.998840,-0.010315, -0.037303,-0.999284,0.006298, 0.885097,0.102226,0.454041, 0.023009,0.039480,0.998955, 0.012737,0.015821,0.999794, 0.878150,-0.084420,0.470877, -0.822714,0.566460,-0.047583, -0.983950,0.172369,-0.046157, -0.988043,0.149813,-0.036424, -0.836436,0.545189,-0.056066, 0.099409,0.986791,-0.127910, 0.142871,0.980446,-0.135325, 0.977760,-0.209718,0.001663, 0.952512,-0.304268,-0.011888, 0.881662,0.470695,-0.033443, 0.913550,0.405678,-0.029176, 0.000000,-0.972964,-0.230956, -0.007195,-0.999748,0.021253, 0.014295,-0.999809,0.013309, 0.060830,0.996627,-0.055090, 0.139838,0.989311,-0.041348, 0.013677,-0.606729,-0.794791, -0.239502,-0.578624,-0.779637, 0.507283,-0.857371,-0.087056, 0.509878,-0.854276,-0.101179, 0.510607,-0.859037,-0.036542, 0.687699,-0.725334,0.030994, 0.595224,-0.803473,0.011772, 0.787423,-0.615844,0.026475, 0.891143,-0.403222,0.208028, 0.004828,-0.002388,0.999986, 0.850879,-0.254767,0.459455, -0.517351,-0.150458,0.842443, 0.487945,-0.188069,0.852373, -0.969140,-0.216243,0.118347, -0.910959,-0.053646,0.408993, -0.936390,-0.350719,-0.013038, -0.913194,-0.407525,-0.000205, -0.915597,-0.400941,-0.030482, -0.877351,-0.420224,-0.231661, -0.927349,-0.368628,-0.064322, -0.853676,-0.437953,-0.281842, 0.179942,-0.978626,-0.099560, 0.161214,-0.986617,-0.024444, -0.208898,-0.339729,0.917031, -0.218807,-0.261598,0.940048, -0.229447,-0.047564,0.972158, -0.325029,0.698019,0.638064, -0.650925,0.383237,0.655306, -0.227854,0.241385,0.943300, -0.243605,0.173394,0.954249, 0.000000,0.975110,0.221724, 0.000000,0.975108,0.221731, 0.000000,0.975108,0.221731, 0.000000,0.975110,0.221724, -1.000000,0.000691,0.000114, -1.000000,0.000621,0.000101, -1.000000,0.000622,0.000101, -1.000000,0.000691,0.000114, 0.062561,-0.034820,0.997434, -0.966377,0.010422,0.256916, -0.837366,0.482513,0.256902, 0.205716,0.619418,0.757630, -0.239821,-0.651832,0.719445, -0.927065,-0.300644,0.223972, -0.028463,-0.999590,-0.003263, -0.069126,-0.997560,0.009810, -0.033744,-0.999362,-0.011669, -0.025040,-0.999683,-0.002589, -0.020528,-0.999357,0.029387, -0.040153,-0.998865,0.025604, -0.032643,-0.999109,0.026762, 0.939540,-0.143585,0.310882, 0.864666,-0.372079,0.337505, -0.406646,-0.584643,0.702020, -0.590998,-0.062889,0.804218, 0.958142,0.119865,0.259993, -0.386397,0.653979,0.650391, -0.042341,0.997143,0.062552, 0.071985,0.992214,0.101632, 0.111174,0.970380,0.214485, -0.064884,0.965887,0.250703, -0.067804,0.083553,0.994194, -0.051186,0.128701,0.990362, -0.084463,0.037657,0.995715, -0.039904,-0.999089,-0.015139, -0.057711,0.994383,0.088729, 0.028568,0.965986,0.257010, 0.157829,0.952849,0.259168, 0.155765,0.981036,0.115346, -0.039803,-0.998789,-0.028907, -0.012868,0.997240,-0.073119, -0.049982,-0.998592,0.017772, -0.064798,-0.997491,0.028504, -0.097184,-0.994701,0.033557, -0.034096,-0.999310,0.014732, -0.025133,-0.999618,0.011494, 0.010487,-0.999942,0.002397, 0.000000,0.003694,0.999993, 0.000000,0.003694,0.999993, 0.000000,0.636907,0.770941, 0.000000,0.627700,0.778456, -1.000000,0.000330,0.000331, -1.000000,0.000016,0.000628, -1.000000,0.000016,0.000629, -1.000000,0.000361,0.000300, 0.000000,0.993337,0.115243, 0.000000,0.993337,0.115243, 0.000000,0.787035,0.616908, 0.000000,0.787033,0.616911, -1.000000,0.000378,0.000224, -1.000000,0.000513,0.000039, -1.000000,0.000511,0.000039, -1.000000,0.000353,0.000250, 0.000000,0.205127,0.978735, 0.000000,0.205127,0.978735, 0.000001,0.520285,0.853993, 0.000000,0.520287,0.853992, -1.000000,0.000217,0.000312, -1.000000,0.000101,0.000396, -1.000000,0.000102,0.000398, -1.000000,0.000200,0.000329, -0.000003,0.972139,0.234404, 0.000000,0.972139,0.234405, 0.000000,0.832722,0.553692, 0.000000,0.832723,0.553690, -1.000000,0.000289,0.000159, -1.000000,0.000347,0.000069, -1.000000,0.000345,0.000068, -1.000000,0.000285,0.000164, 0.000000,0.362346,0.932044, 0.000000,0.362345,0.932044, -0.000000,0.442095,0.896968, -0.000000,0.442104,0.896964, -1.000000,0.000143,0.000266, -1.000000,0.000116,0.000277, -1.000000,0.000116,0.000277, -1.000000,0.000140,0.000269, 0.000000,0.919122,0.393972, 0.000001,0.919122,0.393972, 0.000000,0.747036,0.664783, 0.000000,0.747041,0.664778, -1.000000,0.000205,0.000162, -1.000000,0.000251,0.000102, -1.000000,0.000250,0.000102, -1.000000,0.000201,0.000167, -0.000028,0.271590,0.962413, -0.000000,0.271589,0.962413, -0.000000,0.414038,0.910259, 0.000000,0.414042,0.910258, -1.000000,0.000122,0.000194, -1.000000,0.000076,0.000176, -1.000000,0.000076,0.000176, -1.000000,0.000114,0.000200, -0.462715,-0.214707,-0.860114, -0.461622,0.046602,-0.885852, -0.415622,-0.534037,-0.736250, -0.028422,-0.998838,-0.038909, -0.024328,-0.998753,-0.043587, -0.016721,-0.998689,-0.048378, -0.025609,-0.999530,0.016866, -0.019296,-0.999768,-0.009549, -0.030966,-0.999209,0.024951, -0.056340,-0.998127,0.023858, -0.112915,-0.992814,0.039637, 0.053350,0.991903,-0.115246, -0.187987,0.101923,0.976869, -0.187987,0.101923,0.976869, -0.192898,0.105717,0.975507, -0.193357,0.106072,0.975378, 0.201214,-0.046501,-0.978443, 0.139893,-0.104986,-0.984585, 0.139893,-0.104986,-0.984585, 0.202048,-0.045693,-0.978309, 0.644289,0.748047,0.159113, 0.643474,0.748072,0.162267, 0.591144,0.738173,0.325036, 0.591144,0.738173,0.325036, -0.360686,0.011150,0.932621, -0.500019,-0.044692,0.864860, -0.365379,0.092589,0.926242, -0.411510,-0.907051,0.088985, -0.411510,-0.907051,0.088985, -0.241754,-0.937184,-0.251478, -0.289812,-0.942647,-0.165607, 0.377126,-0.139787,-0.915552, 0.373097,-0.181729,-0.909820, 0.333083,-0.063561,-0.940753, 0.387632,-0.108343,-0.915425, -0.240108,0.034630,0.970128, -0.336135,-0.146282,0.930384, -0.252643,0.014635,0.967449, 0.280166,0.066802,-0.957624, 0.225358,-0.060122,-0.972419, 0.225293,-0.060257,-0.972426, -0.218165,0.091143,0.971646, -0.302043,0.170742,0.937879, -0.215575,0.094923,0.971863, -0.997708,-0.013415,-0.066321, -0.789518,0.561175,-0.248483, -0.769031,0.616115,0.170274, -0.889250,-0.014226,0.457201, 0.227413,-0.071689,-0.971156, 0.300826,-0.172669,-0.937917, 0.261320,0.009049,-0.965210, 0.189827,-0.148157,-0.970575, -0.461886,0.885022,-0.058290, -0.511855,0.804735,0.300675, -0.217645,0.089367,0.971928, -0.943455,-0.089476,-0.319198, -0.989109,-0.077082,0.125384, 0.500044,0.044397,-0.864861, -0.375331,0.036996,0.926152, -0.384909,0.013883,0.922850, -0.702773,-0.683378,-0.197749, -0.117813,-0.887242,-0.446006, -0.117813,-0.887242,-0.446006, -0.650527,0.409722,-0.639486, -0.620960,-0.184464,-0.761828, -0.787748,-0.090331,-0.609339, -0.602627,-0.665130,-0.440956, -0.737619,0.079509,-0.670519, -0.696221,0.431716,-0.573496, -0.357955,0.839419,-0.408955, -0.766313,-0.119294,-0.631295, -0.099073,0.833289,-0.543887, -0.440672,0.557953,-0.703205, 0.683115,0.728190,-0.055616, 0.683115,0.728190,-0.055616, 0.018687,0.998130,-0.058199, 0.002960,0.834743,0.550632, -0.086448,0.868164,0.488689, 0.691081,0.706933,0.150506, 0.350593,0.933524,0.074955, 0.324885,0.879012,0.348980, 0.621437,0.671158,0.404183, 0.709301,0.681358,-0.180674, 0.450471,0.853225,-0.262836, 0.087284,0.847570,-0.523456, 0.199990,0.820861,-0.534968, -0.092612,0.795156,-0.599291, -0.379457,0.313732,-0.870393, -0.276356,0.526396,-0.804074, -0.487495,0.052031,-0.871574, -0.523876,-0.025486,-0.851413, -0.530893,-0.462154,-0.710329, -0.670546,-0.472206,-0.572180, -0.162704,-0.366338,-0.916147, -0.045239,-0.295176,-0.954371, -0.946340,-0.185727,-0.264472, -0.674624,-0.082470,-0.733540, -0.452366,-0.431034,-0.780753, -0.744668,-0.627148,-0.228375, -0.689895,-0.668648,0.277407, -0.936911,-0.231834,0.261631, -0.567908,-0.568636,0.595091, -0.122541,-0.452325,0.883395, -0.475588,-0.556174,0.681533, -0.730105,0.157695,0.664890, -0.756711,0.069556,0.650039, -0.652941,0.354979,0.669072, -0.592204,0.476228,0.650001, 0.967167,-0.125409,0.221045, 0.967629,-0.125492,0.218965, 0.935337,-0.120031,0.332771, 0.935337,-0.120031,0.332771, -0.099683,0.026944,0.994654, -0.099683,0.026944,0.994654, -0.073572,0.029988,0.996839, -0.080626,0.029168,0.996318, -0.954043,0.288889,-0.079661, -0.954043,0.288889,-0.079661, -0.929755,0.281764,-0.236990, -0.932337,0.282529,-0.225664, 0.989928,-0.130153,0.055707, 0.989928,-0.130153,0.055707, -0.875268,0.265512,-0.404239, -0.875268,0.265512,-0.404239, -0.003805,-0.008654,-0.999955, 0.006697,-0.012161,-0.999904, 0.006697,-0.012161,-0.999904, -0.003254,-0.008838,-0.999956, 0.724530,-0.683566,0.088276, 0.725823,-0.682752,0.083851, 0.714357,-0.689184,0.121326, 0.714357,-0.689184,0.121326, 0.151973,0.241920,-0.958321, 0.207399,0.332487,-0.920021, 0.207399,0.332487,-0.920021, 0.145618,0.231541,-0.961865, -0.691514,0.714191,-0.108349, -0.691514,0.714191,-0.108349, -0.709839,0.698353,-0.091825, -0.718805,0.690179,-0.083502, 0.731323,-0.678989,0.064349, 0.731323,-0.678989,0.064349, -0.735035,0.674610,-0.068006, -0.735035,0.674610,-0.068006, -0.277282,-0.284224,0.917786, -0.277282,-0.284224,0.917786, -0.189516,-0.195034,0.962313, -0.191171,-0.196716,0.961643, -0.515549,0.068836,0.854091, -0.436282,-0.122308,0.891459, -0.436282,-0.122308,0.891459, -0.700836,-0.659802,-0.271091, -0.728675,-0.636052,0.253913, -0.501263,-0.518436,-0.692791, 0.430709,0.038839,-0.901655, 0.430708,0.038839,-0.901655, -0.169973,-0.066558,-0.983198, 0.240652,0.692398,0.680200, -0.060499,0.031501,0.997671, -0.060499,0.031501,0.997671, -0.043388,0.998563,0.031468, -0.047584,0.970710,0.235495, -0.031323,0.941930,-0.334347, -0.015478,-0.004755,-0.999869, -0.015478,-0.004755,-0.999869, 0.263595,0.613740,-0.744205, -0.164385,-0.169488,0.971726, -0.164385,-0.169488,0.971726, -0.281060,-0.932838,0.225428, -0.227588,-0.933465,-0.277212, -0.126257,-0.721865,-0.680419, 0.127611,0.202137,-0.971008, 0.127611,0.202137,-0.971008, -0.581764,0.249800,0.774048, -0.437019,0.232054,-0.869003, -0.751752,0.451281,-0.480848, 0.091916,0.982301,0.163205, 0.139020,0.981230,0.133646, 0.017556,0.976368,0.215402, 0.000242,0.996431,0.084411, 0.033470,0.974531,0.221742, -0.017236,-0.999420,0.029378, -0.165223,0.171830,0.971173, -0.165223,0.171830,0.971172, -0.165223,0.171830,0.971172, -0.214915,0.891684,0.398385, -0.214915,0.891684,0.398385, -0.507752,-0.742545,0.436824, -0.507752,-0.742545,0.436824, -0.507752,-0.742545,0.436824, -0.507752,-0.742545,0.436824, -0.236630,0.820937,0.519681, -0.236631,0.820937,0.519681, -0.236630,0.820937,0.519681, -0.331488,-0.158315,0.930082, -0.331488,-0.158315,0.930082, -0.331488,-0.158315,0.930082, -0.331488,-0.158315,0.930082, 0.000000,0.084961,0.996384, -0.167098,-0.017623,0.985783, -0.116788,0.195459,0.973733, -0.235096,-0.025670,0.971633, -0.234065,0.193434,0.952784, -0.222626,0.188236,0.956559, -0.230531,-0.195007,0.953325, -0.070961,-0.382230,0.921339, -0.218996,-0.371750,0.902133, -0.243469,0.096680,0.965078, -0.243429,0.073244,0.967149, -0.479894,0.233995,0.845546, -0.227770,0.181977,0.956559, 0.000000,0.000000,0.000000, 0.000000,0.000000,0.000000, 0.000000,0.000000,0.000000, -0.000000,0.000000,0.000000, -0.164399,0.986394,0.000000, -0.164399,0.986394,0.000000, 0.000000,1.000000,0.000000, 0.000000,1.000000,0.000000, 0.000000,0.000000,0.000000, 0.000000,0.000000,0.000000, 0.995523,0.087573,-0.035559, 0.995214,0.087656,-0.043188, 0.995229,0.087653,-0.042863, 0.995523,0.087573,-0.035559, 0.050287,-0.998734,-0.001374, 0.050287,-0.998734,-0.001374, 0.050287,-0.998734,-0.001374, 0.050287,-0.998734,-0.001374, 0.939588,0.339113,-0.046648, 0.939588,0.339113,-0.046648, 0.939589,0.339113,-0.046648, 0.939588,0.339113,-0.046648, 0.639317,0.768782,-0.015735, 0.639317,0.768782,-0.015735, 0.639317,0.768782,-0.015735, 0.639317,0.768782,-0.015735, 0.874010,0.484511,-0.036808, 0.874010,0.484511,-0.036808, 0.874010,0.484511,-0.036808, 0.874010,0.484511,-0.036808, 0.000000,1.000000,0.000013, 0.120625,0.922768,0.365989, -0.046224,0.965341,0.256868, -0.120218,0.621985,0.773746, 0.352218,0.935907,-0.004640, 0.322247,-0.946647,-0.004140, 0.322247,-0.946647,-0.004140, 0.322247,-0.946647,-0.004140, 0.322247,-0.946647,-0.004140, 0.357645,0.222862,0.906875, 0.357442,0.227242,0.905868, 0.357414,0.227833,0.905730, -0.159030,-0.529449,0.833303, -0.159030,-0.529449,0.833303, -0.159030,-0.529448,0.833303, -0.159030,-0.529449,0.833303, 0.323433,0.079215,0.942930, 0.323433,0.079215,0.942930, 0.323433,0.079215,0.942930, 0.323433,0.079215,0.942930, 0.217497,0.152580,0.964061, 0.217497,0.152580,0.964061, 0.217497,0.152580,0.964061, 0.217497,0.152580,0.964061, 0.369404,-0.045071,0.928175, 0.369404,-0.045071,0.928175, 0.369405,-0.045071,0.928175, 0.369404,-0.045071,0.928175, 0.000000,0.222627,0.974904, 0.000000,0.222627,0.974904, 0.000000,0.222627,0.974904, 0.000000,0.222627,0.974904, -0.018912,-0.433722,0.900848, -0.018912,-0.433722,0.900848, -0.018912,-0.433722,0.900848, -0.018912,-0.433722,0.900848, -0.723242,0.158810,0.672087, -0.581219,0.143655,0.800966, -0.639181,0.168465,0.750378, -0.720840,0.183953,0.668245, -0.844090,0.197427,0.498532, -0.837872,0.155391,0.523283, -0.680878,0.178482,0.710316, -0.834278,0.130168,0.535759, -0.862740,0.160156,0.479615, -0.508220,0.253375,0.823113, -0.527933,0.187825,0.828257, -0.566220,0.260932,0.781863, -0.498750,0.160582,0.851741, -0.503613,0.228142,0.833262, -0.492498,0.111911,0.863089, -0.870033,0.120380,0.478071, -0.511727,0.098742,0.853455, 0.043602,-0.948543,0.313632, -0.425287,-0.636212,0.643712, -0.542156,-0.643274,0.540615, -0.168046,-0.983165,0.071752, 0.204645,-0.808982,0.551061, -0.382576,-0.567188,0.729337, 0.475396,-0.142621,0.868135, -0.174209,-0.003142,0.984704, -0.187096,-0.058447,0.980601, 0.435869,-0.341060,0.832884, 0.298288,0.854574,0.425121, -0.300362,0.747379,0.592628, -0.240345,0.691960,0.680753, 0.397252,0.781738,0.480704, 0.005036,0.999969,0.006124, -0.276944,0.815871,0.507600, -0.289101,0.826338,0.483308, 0.077666,0.982172,0.171192, -0.858648,0.034956,-0.511373, -0.965468,0.148319,0.214181, -0.920700,0.332939,0.203623, -0.803448,0.258381,-0.536388, -0.400256,0.791860,-0.461252, -0.639892,0.722727,0.261158, -0.639870,0.722842,0.260893, -0.400256,0.791859,-0.461252, -0.843111,-0.278950,-0.459730, -0.957342,-0.138385,0.253666, 0.488178,-0.035637,0.872016, -0.201343,0.040467,0.978684, -0.661527,-0.598908,0.451323, -0.393366,-0.907983,-0.144326, -0.771571,-0.491733,-0.403580, -0.904898,-0.330776,0.267856, -0.539911,-0.491122,0.683590, -0.597796,-0.488945,0.635274, -0.505459,-0.467580,0.725176, -0.326213,0.035516,0.944629, -0.293568,-0.002504,0.955935, -0.412889,0.686833,0.598150, -0.397363,0.613164,0.682739, -0.322690,0.741483,0.588280, -0.369120,0.750742,0.547848, -0.921903,0.134081,0.363480, -0.870013,0.322730,0.372723, -0.642851,0.639059,0.422311, -0.642851,0.639059,0.422311, -0.912795,-0.090592,0.398245, -0.342507,0.054842,0.937913, -0.676305,-0.460846,0.574659, -0.863588,-0.256455,0.434105, 0.357414,0.227842,0.905728, 0.357414,0.227842,0.905728, 0.995185,0.087663,-0.043834, 0.995185,0.087663,-0.043834, 0.135373,0.986023,0.097121, -0.005721,0.977380,0.211414, 0.168202,0.949916,0.263379, -0.868262,0.110012,0.483755, 0.868270,0.111175,0.483474, 0.000000,0.205127,0.978736, 0.000000,0.205127,0.978735, -1.000000,0.000101,0.000395, -1.000000,0.000101,0.000394, 0.000000,-0.293853,-0.955851, 0.000000,-0.293852,-0.955851, 1.000000,0.000101,0.000394, 1.000000,0.000101,0.000395, 0.000000,0.972139,0.234406, -0.000003,0.972139,0.234404, -1.000000,0.000345,0.000068, -1.000000,0.000345,0.000068, -0.000000,-0.987932,-0.154888, -0.000000,-0.987932,-0.154888, 1.000000,0.000346,0.000068, 1.000000,0.000345,0.000068, -1.000000,0.000116,0.000277, -1.000000,0.000116,0.000277, -0.000021,-0.411897,-0.911231, 0.000000,-0.411896,-0.911231, 1.000000,0.000116,0.000277, 1.000000,0.000116,0.000277, -0.000000,0.362345,0.932044, 0.000000,0.362346,0.932044, 0.000001,0.919122,0.393973, 0.000000,0.919122,0.393973, -1.000000,0.000250,0.000102, -1.000000,0.000250,0.000102, -0.000016,-0.931202,-0.364504, 0.000000,-0.931203,-0.364502, 1.000000,0.000250,0.000102, 1.000000,0.000250,0.000102, 0.000000,0.975108,0.221731, 0.000000,0.975108,0.221731, -1.000000,0.000618,0.000101, -1.000000,0.000614,0.000100, 0.000000,-0.992855,-0.119324, 0.000000,-0.992855,-0.119325, 1.000000,0.000615,0.000100, 1.000000,0.000619,0.000101, 0.000000,-0.809655,-0.586906, 0.000000,-0.803724,-0.595002, 0.000000,0.003694,0.999993, 0.000000,0.003694,0.999993, -1.000000,0.000016,0.000627, -1.000000,0.000016,0.000626, -0.000000,-0.047673,-0.998863, -0.000000,-0.047673,-0.998863, 1.000000,0.000016,0.000625, 1.000000,0.000016,0.000627, 0.000000,0.993337,0.115244, 0.000000,0.993337,0.115243, -1.000000,0.000509,0.000038, -1.000000,0.000510,0.000038, -0.000015,-0.999297,-0.037499, 0.000000,-0.999297,-0.037500, 1.000000,0.000510,0.000039, 1.000000,0.000508,0.000038, 0.000000,-0.047673,-0.998863, 0.000000,-0.047673,-0.998863, 0.000001,-0.850746,-0.525577, 0.000000,-0.047673,-0.998863, 0.000000,-0.047673,-0.998863, 0.000000,-0.850751,-0.525568, 0.000001,-0.999297,-0.037500, 0.000000,-0.999297,-0.037500, 0.000000,-0.621121,-0.783715, 0.000001,-0.999297,-0.037500, 0.000000,-0.999297,-0.037500, 0.000000,-0.621117,-0.783718, 0.000000,-0.293852,-0.955851, 0.000000,-0.293853,-0.955850, 0.000000,-0.889392,-0.457146, 0.000000,-0.293852,-0.955851, 0.000000,-0.293853,-0.955851, 0.000000,-0.889389,-0.457152, 0.000000,-0.987932,-0.154888, 0.000000,-0.987932,-0.154889, 0.000002,-0.496747,-0.867896, 0.000000,-0.987932,-0.154888, 0.000000,-0.987932,-0.154889, 0.000000,-0.496745,-0.867896, 0.000002,-0.411896,-0.911231, 0.000000,-0.411894,-0.911232, 0.000002,-0.794491,-0.607276, 0.000002,-0.411896,-0.911231, 0.000000,-0.411894,-0.911232, 0.000000,-0.794488,-0.607279, 0.000001,-0.931203,-0.364502, 0.000000,-0.931202,-0.364504, 0.000000,-0.612831,-0.790214, 0.000001,-0.931203,-0.364502, 0.000000,-0.931202,-0.364504, 0.000000,-0.612828,-0.790216, 0.000000,-0.507221,-0.861816, 0.000000,-0.507224,-0.861814, -0.000001,0.866805,-0.498648, -0.000001,0.866805,-0.498647, 0.000000,0.866804,-0.498648, 0.000000,0.866804,-0.498648, -0.000000,0.414041,0.910258, 0.000002,0.271589,0.962413, 0.000000,0.271589,0.962413, 0.000000,0.414050,0.910254, 0.000000,0.919122,0.393973, -0.000020,0.919123,0.393970, -0.000000,0.747036,0.664784, -0.000000,0.919122,0.393972, -0.000020,0.919123,0.393970, -0.000007,0.747036,0.664784, -0.000000,0.362344,0.932044, 0.000000,0.362344,0.932045, 0.000000,0.442096,0.896968, 0.000000,0.362344,0.932044, 0.000000,0.362344,0.932045, 0.000000,0.442102,0.896965, 0.000000,0.972139,0.234406, 0.000000,0.972139,0.234406, 0.000000,0.832721,0.553692, 0.000000,0.972139,0.234405, 0.000000,0.972139,0.234405, 0.000000,0.832722,0.553691, 0.000000,0.205127,0.978735, 0.000000,0.205126,0.978736, -0.000000,0.520285,0.853993, -0.000000,0.205127,0.978735, -0.000000,0.205126,0.978736, -0.000009,0.520288,0.853991, -0.000000,0.993337,0.115244, -0.000000,0.993337,0.115243, 0.000000,0.787034,0.616910, 0.000000,0.993337,0.115243, 0.000000,0.993337,0.115243, 0.000000,0.787028,0.616917, 0.000000,0.003694,0.999993, 0.000000,0.003694,0.999993, 0.000000,0.636704,0.771108, 0.000000,0.003694,0.999993, 0.000000,0.003694,0.999993, 0.000000,0.627700,0.778455, -0.000045,0.271578,0.962417, 0.000000,0.271587,0.962414, -0.000000,0.271581,0.962416, -0.000049,0.271580,0.962416, 0.000004,0.271581,0.962416, 0.000003,0.271587,0.962414, 0.000000,0.271584,0.962415, 0.000000,0.271581,0.962416, -1.000000,0.000063,0.000149, -1.000000,0.000063,0.000149, -1.000000,0.000064,0.000149, -1.000000,0.000064,0.000149, 0.000002,-0.507222,-0.861816, 0.000002,-0.507232,-0.861810, 0.000000,-0.507236,-0.861807, 0.000000,-0.507249,-0.861799, 0.000000,-0.507221,-0.861816, -0.000000,-0.507232,-0.861810, -0.000027,-0.507238,-0.861806, -0.000025,-0.507236,-0.861807, 1.000000,0.000064,0.000149, 1.000000,0.000064,0.000149, 1.000000,0.000065,0.000149, 1.000000,0.000065,0.000149, 0.000000,0.975108,0.221731, 0.000000,0.975107,0.221734, 0.000000,-0.992855,-0.119324, 0.000000,-0.992855,-0.119325, 1.000000,0.000076,0.000176, 1.000000,0.000076,0.000176, -0.000029,0.271590,0.962413, 0.000000,0.271589,0.962413, 0.000002,0.271589,0.962413, 0.000000,0.271589,0.962413, -1.000000,0.000076,0.000176, -1.000000,0.000076,0.000176, 0.000000,-0.507221,-0.861816, 0.000000,-0.507224,-0.861814, 0.000000,-0.507221,-0.861816, -0.000001,-0.507221,-0.861816, 0.636719,-0.771073,0.006002, -0.905856,0.418928,-0.062639, 0.906751,0.419557,-0.042116, 0.010583,0.999126,-0.040441, }; static GLfloat otherShapeNormals[] = {-0.925292,5.467881,2.365366, -0.942349,5.467881,2.350062, -0.966025,5.467881,2.340038, -0.994004,5.467881,2.336276, -1.023546,5.467881,2.339143, -1.051760,5.467881,2.348360, -1.075883,5.467881,2.363023, -1.093556,5.467881,2.381698, -1.103046,5.467881,2.402557, -1.103426,5.467881,2.423557, -1.094659,5.467881,2.442644, -1.077602,5.467881,2.457948, -1.053926,5.467881,2.467972, -1.025947,5.467881,2.471734, -0.996405,5.467881,2.468867, -0.968191,5.467881,2.459651, -0.944068,5.467881,2.444987, -0.926396,5.467881,2.426312, -0.916905,5.467881,2.405453, -0.916525,5.467881,2.384453, -0.842694,5.491274,2.327679, -0.876387,5.491274,2.297448, -0.923157,5.491274,2.277647, -0.978426,5.491274,2.270214, -1.036783,5.491274,2.275878, -1.092515,5.491274,2.294084, -1.140169,5.491274,2.323050, -1.175078,5.491274,2.359941, -1.193825,5.491274,2.401144, -1.194576,5.491274,2.442628, -1.177257,5.491274,2.480331, -1.143564,5.491274,2.510562, -1.096794,5.491274,2.530364, -1.041525,5.491274,2.537796, -0.983168,5.491274,2.532132, -0.927436,5.491274,2.513926, -0.879783,5.491274,2.484960, -0.844874,5.491274,2.448070, -0.826126,5.491274,2.406866, -0.825375,5.491274,2.365382, -0.764214,5.529622,2.291872, -0.813715,5.529622,2.247457, -0.882427,5.529622,2.218366, -0.963624,5.529622,2.207447, -1.049359,5.529622,2.215768, -1.131238,5.529622,2.242516, -1.201248,5.529622,2.285071, -1.252534,5.529622,2.339268, -1.280077,5.529622,2.399802, -1.281181,5.529622,2.460747, -1.255737,5.529622,2.516139, -1.206236,5.529622,2.560553, -1.137524,5.529622,2.589644, -1.056327,5.529622,2.600563, -0.970592,5.529622,2.592242, -0.888713,5.529622,2.565495, -0.818703,5.529622,2.522939, -0.767417,5.529622,2.468742, -0.739874,5.529622,2.408208, -0.738770,5.529622,2.347263, -0.691786,5.581980,2.258825, -0.755875,5.581980,2.201321, -0.844837,5.581980,2.163657, -0.949964,5.581980,2.149520, -1.060966,5.581980,2.160293, -1.166976,5.581980,2.194923, -1.257617,5.581980,2.250020, -1.324018,5.581980,2.320189, -1.359678,5.581980,2.398563, -1.361107,5.581980,2.477470, -1.328165,5.581980,2.549185, -1.264076,5.581980,2.606689, -1.175114,5.581980,2.644353, -1.069987,5.581980,2.658490, -0.958985,5.581980,2.647717, -0.852976,5.581980,2.613087, -0.762334,5.581980,2.557990, -0.695933,5.581980,2.487821, -0.660273,5.581980,2.409447, -0.658844,5.581980,2.330540, -0.627193,5.647060,2.229353, -0.704292,5.647060,2.160175, -0.811314,5.647060,2.114866, -0.937782,5.647060,2.097859, -1.071317,5.647060,2.110820, -1.198847,5.647060,2.152479, -1.307889,5.647060,2.218760, -1.387769,5.647060,2.303174, -1.430668,5.647060,2.397459, -1.432387,5.647060,2.492383, -1.392757,5.647060,2.578657, -1.315658,5.647060,2.647835, -1.208637,5.647060,2.693145, -1.082169,5.647060,2.710151, -0.948634,5.647060,2.697191, -0.821104,5.647060,2.655531, -0.712062,5.647060,2.589250, -0.632182,5.647060,2.504836, -0.589283,5.647060,2.410552, -0.587564,5.647060,2.315627, -0.572026,5.723258,2.204182, -0.660237,5.723258,2.125034, -0.782682,5.723258,2.073194, -0.927377,5.723258,2.053736, -1.080157,5.723258,2.068565, -1.226068,5.723258,2.116229, -1.350825,5.723258,2.192062, -1.442218,5.723258,2.288642, -1.491300,5.723258,2.396515, -1.493267,5.723258,2.505121, -1.447925,5.723258,2.603828, -1.359714,5.723258,2.682976, -1.237269,5.723258,2.734816, -1.092574,5.723258,2.754274, -0.939794,5.723258,2.739445, -0.793884,5.723258,2.691781, -0.669126,5.723258,2.615948, -0.577733,5.723258,2.519368, -0.528651,5.723258,2.411495, -0.526685,5.723258,2.302890, -0.527642,5.808699,2.183931, -0.624792,5.808699,2.096762, -0.759647,5.808699,2.039668, -0.919006,5.808699,2.018238, -1.087270,5.808699,2.034570, -1.247967,5.808699,2.087064, -1.385368,5.808699,2.170583, -1.486023,5.808699,2.276951, -1.540080,5.808699,2.395756, -1.542245,5.808699,2.515368, -1.492309,5.808699,2.624079, -1.395158,5.808699,2.711248, -1.260303,5.808699,2.768342, -1.100945,5.808699,2.789772, -0.932681,5.808699,2.773440, -0.771984,5.808699,2.720946, -0.634583,5.808699,2.637427, -0.533928,5.808699,2.531059, -0.479872,5.808699,2.412254, -0.477706,5.808699,2.292642, -0.495135,5.901279,2.169099, -0.598833,5.901279,2.076055, -0.742776,5.901279,2.015113, -0.912875,5.901279,1.992239, -1.092479,5.901279,2.009671, -1.264007,5.901279,2.065704, -1.410668,5.901279,2.154851, -1.518107,5.901279,2.268388, -1.575806,5.901279,2.395200, -1.578118,5.901279,2.522873, -1.524816,5.901279,2.638911, -1.421118,5.901279,2.731955, -1.277175,5.901279,2.792897, -1.107076,5.901279,2.815771, -0.927472,5.901279,2.798339, -0.755944,5.901279,2.742306, -0.609283,5.901279,2.653158, -0.501844,5.901279,2.539622, -0.444145,5.901279,2.412810, -0.441833,5.901279,2.285137, -0.475304,5.998718,2.160051, -0.582997,5.998718,2.063423, -0.732485,5.998718,2.000134, -0.909135,5.998718,1.976379, -1.095657,5.998718,1.994483, -1.273791,5.998718,2.052673, -1.426102,5.998718,2.145255, -1.537679,5.998718,2.263165, -1.597600,5.998718,2.394861, -1.600001,5.998718,2.527452, -1.544646,5.998718,2.647959, -1.436954,5.998718,2.744587, -1.287466,5.998718,2.807876, -1.110816,5.998718,2.831631, -0.924294,5.998718,2.813527, -0.746160,5.998718,2.755337, -0.593849,5.998718,2.662755, -0.482272,5.998718,2.544846, -0.422351,5.998718,2.413149, -0.419950,5.998718,2.280558, -0.468640,6.098616,2.157010, -0.577674,6.098616,2.059178, -0.729026,6.098616,1.995100, -0.907878,6.098616,1.971049, -1.096725,6.098616,1.989378, -1.277080,6.098616,2.048294, -1.431289,6.098616,2.142030, -1.544257,6.098616,2.261409, -1.604925,6.098616,2.394747, -1.607356,6.098616,2.528991, -1.551311,6.098616,2.651000, -1.442276,6.098616,2.748832, -1.290925,6.098616,2.812910, -1.112073,6.098616,2.836961, -0.923226,6.098616,2.818632, -0.742871,6.098616,2.759716, -0.588662,6.098616,2.665981, -0.475695,6.098616,2.546601, -0.415026,6.098616,2.413263, -0.412595,6.098616,2.279019, -0.475304,6.198514,2.160051, -0.582997,6.198514,2.063423, -0.732485,6.198514,2.000134, -0.909135,6.198514,1.976379, -1.095657,6.198514,1.994483, -1.273791,6.198514,2.052673, -1.426102,6.198514,2.145255, -1.537679,6.198514,2.263165, -1.597600,6.198514,2.394861, -1.600001,6.198514,2.527452, -1.544646,6.198514,2.647959, -1.436954,6.198514,2.744587, -1.287466,6.198514,2.807876, -1.110816,6.198514,2.831631, -0.924294,6.198514,2.813527, -0.746160,6.198514,2.755337, -0.593849,6.198514,2.662755, -0.482272,6.198514,2.544846, -0.422351,6.198514,2.413149, -0.419950,6.198514,2.280558, -0.495135,6.295953,2.169099, -0.598833,6.295953,2.076055, -0.742776,6.295953,2.015113, -0.912875,6.295953,1.992239, -1.092479,6.295953,2.009671, -1.264007,6.295953,2.065704, -1.410668,6.295953,2.154851, -1.518107,6.295953,2.268388, -1.575806,6.295953,2.395200, -1.578118,6.295953,2.522873, -1.524816,6.295953,2.638911, -1.421118,6.295953,2.731955, -1.277175,6.295953,2.792897, -1.107076,6.295953,2.815771, -0.927472,6.295953,2.798339, -0.755944,6.295953,2.742306, -0.609283,6.295953,2.653158, -0.501844,6.295953,2.539622, -0.444145,6.295953,2.412810, -0.441833,6.295953,2.285137, -0.527642,6.388533,2.183931, -0.624792,6.388533,2.096762, -0.759647,6.388533,2.039668, -0.919006,6.388533,2.018238, -1.087270,6.388533,2.034570, -1.247967,6.388533,2.087064, -1.385368,6.388533,2.170583, -1.486023,6.388533,2.276951, -1.540080,6.388533,2.395756, -1.542245,6.388533,2.515368, -1.492309,6.388533,2.624079, -1.395158,6.388533,2.711248, -1.260303,6.388533,2.768342, -1.100945,6.388533,2.789772, -0.932681,6.388533,2.773440, -0.771984,6.388533,2.720946, -0.634583,6.388533,2.637427, -0.533928,6.388533,2.531059, -0.479872,6.388533,2.412254, -0.477706,6.388533,2.292642, -0.572026,6.473974,2.204182, -0.660237,6.473974,2.125034, -0.782682,6.473974,2.073194, -0.927377,6.473974,2.053736, -1.080157,6.473974,2.068565, -1.226068,6.473974,2.116229, -1.350825,6.473974,2.192062, -1.442218,6.473974,2.288642, -1.491300,6.473974,2.396515, -1.493267,6.473974,2.505121, -1.447925,6.473974,2.603828, -1.359714,6.473974,2.682976, -1.237269,6.473974,2.734816, -1.092574,6.473974,2.754274, -0.939794,6.473974,2.739445, -0.793884,6.473974,2.691781, -0.669126,6.473974,2.615948, -0.577733,6.473974,2.519368, -0.528651,6.473974,2.411495, -0.526685,6.473974,2.302890, -0.627193,6.550172,2.229353, -0.704292,6.550172,2.160175, -0.811314,6.550172,2.114866, -0.937782,6.550172,2.097859, -1.071317,6.550172,2.110820, -1.198847,6.550172,2.152479, -1.307889,6.550172,2.218760, -1.387769,6.550172,2.303174, -1.430668,6.550172,2.397459, -1.432387,6.550172,2.492383, -1.392757,6.550172,2.578657, -1.315658,6.550172,2.647835, -1.208637,6.550172,2.693145, -1.082169,6.550172,2.710151, -0.948634,6.550172,2.697191, -0.821104,6.550172,2.655531, -0.712062,6.550172,2.589250, -0.632182,6.550172,2.504836, -0.589283,6.550172,2.410552, -0.587564,6.550172,2.315627, -0.691786,6.615252,2.258825, -0.755875,6.615252,2.201321, -0.844837,6.615252,2.163657, -0.949964,6.615252,2.149520, -1.060966,6.615252,2.160293, -1.166976,6.615252,2.194923, -1.257617,6.615252,2.250020, -1.324018,6.615252,2.320189, -1.359678,6.615252,2.398563, -1.361107,6.615252,2.477470, -1.328165,6.615252,2.549185, -1.264076,6.615252,2.606689, -1.175114,6.615252,2.644353, -1.069987,6.615252,2.658490, -0.958985,6.615252,2.647717, -0.852976,6.615252,2.613087, -0.762334,6.615252,2.557990, -0.695933,6.615252,2.487821, -0.660273,6.615252,2.409447, -0.658844,6.615252,2.330540, -0.764214,6.667610,2.291872, -0.813715,6.667610,2.247457, -0.882427,6.667610,2.218366, -0.963624,6.667610,2.207447, -1.049359,6.667610,2.215768, -1.131238,6.667610,2.242516, -1.201248,6.667610,2.285071, -1.252534,6.667610,2.339268, -1.280077,6.667610,2.399802, -1.281181,6.667610,2.460747, -1.255737,6.667610,2.516139, -1.206236,6.667610,2.560553, -1.137524,6.667610,2.589644, -1.056327,6.667610,2.600563, -0.970592,6.667610,2.592242, -0.888713,6.667610,2.565495, -0.818703,6.667610,2.522939, -0.767417,6.667610,2.468742, -0.739874,6.667610,2.408208, -0.738770,6.667610,2.347263, -0.842694,6.705958,2.327679, -0.876387,6.705958,2.297448, -0.923157,6.705958,2.277647, -0.978426,6.705958,2.270214, -1.036783,6.705958,2.275878, -1.092515,6.705958,2.294084, -1.140169,6.705958,2.323050, -1.175078,6.705958,2.359941, -1.193825,6.705958,2.401144, -1.194576,6.705958,2.442628, -1.177257,6.705958,2.480331, -1.143564,6.705958,2.510562, -1.096794,6.705958,2.530364, -1.041525,6.705958,2.537796, -0.983168,6.705958,2.532132, -0.927436,6.705958,2.513926, -0.879783,6.705958,2.484960, -0.844874,6.705958,2.448070, -0.826126,6.705958,2.406866, -0.825375,6.705958,2.365382, -0.925292,6.729351,2.365366, -0.942349,6.729351,2.350062, -0.966025,6.729351,2.340038, -0.994004,6.729351,2.336276, -1.023546,6.729351,2.339143, -1.051760,6.729351,2.348360, -1.075883,6.729351,2.363023, -1.093556,6.729351,2.381698, -1.103046,6.729351,2.402557, -1.103426,6.729351,2.423557, -1.094659,6.729351,2.442644, -1.077602,6.729351,2.457948, -1.053926,6.729351,2.467972, -1.025947,6.729351,2.471734, -0.996405,6.729351,2.468867, -0.968191,6.729351,2.459651, -0.944068,6.729351,2.444987, -0.926396,6.729351,2.426312, -0.916905,6.729351,2.405453, -0.916525,6.729351,2.384453, -1.009976,5.460019,2.404005, -1.009976,6.737213,2.404005, -2.471197,5.467881,2.365366, -2.454140,5.467881,2.350062, -2.430463,5.467881,2.340038, -2.402485,5.467881,2.336276, -2.372942,5.467881,2.339143, -2.344729,5.467881,2.348360, -2.320605,5.467881,2.363023, -2.302933,5.467881,2.381698, -2.293442,5.467881,2.402557, -2.293062,5.467881,2.423557, -2.301830,5.467881,2.442644, -2.318886,5.467881,2.457948, -2.342563,5.467881,2.467972, -2.370542,5.467881,2.471734, -2.400084,5.467881,2.468867, -2.428297,5.467881,2.459651, -2.452421,5.467881,2.444987, -2.470093,5.467881,2.426312, -2.479584,5.467881,2.405453, -2.479964,5.467881,2.384453, -2.553795,5.491274,2.327679, -2.520102,5.491274,2.297448, -2.473331,5.491274,2.277647, -2.418063,5.491274,2.270214, -2.359706,5.491274,2.275878, -2.303973,5.491274,2.294084, -2.256320,5.491274,2.323050, -2.221411,5.491274,2.359941, -2.202663,5.491274,2.401144, -2.201912,5.491274,2.442628, -2.219231,5.491274,2.480331, -2.252925,5.491274,2.510562, -2.299695,5.491274,2.530364, -2.354963,5.491274,2.537796, -2.413320,5.491274,2.532132, -2.469053,5.491274,2.513926, -2.516706,5.491274,2.484960, -2.551615,5.491274,2.448070, -2.570363,5.491274,2.406866, -2.571114,5.491274,2.365382, -2.632274,5.529622,2.291872, -2.582774,5.529622,2.247457, -2.514062,5.529622,2.218366, -2.432864,5.529622,2.207447, -2.347130,5.529622,2.215768, -2.265250,5.529622,2.242516, -2.195241,5.529622,2.285071, -2.143954,5.529622,2.339268, -2.116412,5.529622,2.399802, -2.115308,5.529622,2.460747, -2.140752,5.529622,2.516139, -2.190253,5.529622,2.560553, -2.258965,5.529622,2.589644, -2.340162,5.529622,2.600563, -2.425897,5.529622,2.592242, -2.507776,5.529622,2.565495, -2.577785,5.529622,2.522939, -2.629072,5.529622,2.468742, -2.656615,5.529622,2.408208, -2.657718,5.529622,2.347263, -2.704702,5.581980,2.258825, -2.640613,5.581980,2.201321, -2.551651,5.581980,2.163657, -2.446524,5.581980,2.149520, -2.335523,5.581980,2.160293, -2.229513,5.581980,2.194923, -2.138871,5.581980,2.250020, -2.072471,5.581980,2.320189, -2.036810,5.581980,2.398563, -2.035382,5.581980,2.477470, -2.068324,5.581980,2.549185, -2.132413,5.581980,2.606689, -2.221375,5.581980,2.644353, -2.326502,5.581980,2.658490, -2.437503,5.581980,2.647717, -2.543513,5.581980,2.613087, -2.634155,5.581980,2.557990, -2.700556,5.581980,2.487821, -2.736216,5.581980,2.409447, -2.737644,5.581980,2.330540, -2.769295,5.647060,2.229353, -2.692196,5.647060,2.160175, -2.585175,5.647060,2.114866, -2.458707,5.647060,2.097859, -2.325172,5.647060,2.110820, -2.197642,5.647060,2.152479, -2.088600,5.647060,2.218760, -2.008719,5.647060,2.303174, -1.965820,5.647060,2.397459, -1.964101,5.647060,2.492383, -2.003731,5.647060,2.578657, -2.080830,5.647060,2.647835, -2.187852,5.647060,2.693145, -2.314320,5.647060,2.710151, -2.447854,5.647060,2.697191, -2.575384,5.647060,2.655531, -2.684427,5.647060,2.589250, -2.764307,5.647060,2.504836, -2.807206,5.647060,2.410552, -2.808925,5.647060,2.315627, -2.824463,5.723258,2.204182, -2.736252,5.723258,2.125034, -2.613806,5.723258,2.073194, -2.469111,5.723258,2.053736, -2.316331,5.723258,2.068565, -2.170421,5.723258,2.116229, -2.045663,5.723258,2.192062, -1.954271,5.723258,2.288642, -1.905189,5.723258,2.396515, -1.903222,5.723258,2.505121, -1.948563,5.723258,2.603828, -2.036774,5.723258,2.682976, -2.159220,5.723258,2.734816, -2.303915,5.723258,2.754274, -2.456695,5.723258,2.739445, -2.602605,5.723258,2.691781, -2.727363,5.723258,2.615948, -2.818755,5.723258,2.519368, -2.867837,5.723258,2.411495, -2.869804,5.723258,2.302890, -2.868847,5.808699,2.183931, -2.771696,5.808699,2.096762, -2.636841,5.808699,2.039668, -2.477482,5.808699,2.018238, -2.309219,5.808699,2.034570, -2.148521,5.808699,2.087064, -2.011120,5.808699,2.170583, -1.910465,5.808699,2.276951, -1.856409,5.808699,2.395756, -1.854243,5.808699,2.515368, -1.904180,5.808699,2.624079, -2.001330,5.808699,2.711248, -2.136185,5.808699,2.768342, -2.295544,5.808699,2.789772, -2.463808,5.808699,2.773440, -2.624505,5.808699,2.720946, -2.761906,5.808699,2.637427, -2.862561,5.808699,2.531059, -2.916617,5.808699,2.412254, -2.918783,5.808699,2.292642, -2.901354,5.901279,2.169099, -2.797656,5.901279,2.076055, -2.653712,5.901279,2.015113, -2.483613,5.901279,1.992239, -2.304009,5.901279,2.009671, -2.132482,5.901279,2.065704, -1.985820,5.901279,2.154851, -1.878382,5.901279,2.268388, -1.820682,5.901279,2.395200, -1.818371,5.901279,2.522873, -1.871672,5.901279,2.638911, -1.975370,5.901279,2.731955, -2.119314,5.901279,2.792897, -2.289413,5.901279,2.815771, -2.469017,5.901279,2.798339, -2.640544,5.901279,2.742306, -2.787206,5.901279,2.653158, -2.894644,5.901279,2.539622, -2.952344,5.901279,2.412810, -2.954656,5.901279,2.285137, -2.921184,5.998718,2.160051, -2.813492,5.998718,2.063423, -2.664004,5.998718,2.000134, -2.487353,5.998718,1.976379, -2.300832,5.998718,1.994483, -2.122697,5.998718,2.052673, -1.970387,5.998718,2.145255, -1.858810,5.998718,2.263165, -1.798888,5.998718,2.394861, -1.796487,5.998718,2.527452, -1.851842,5.998718,2.647959, -1.959534,5.998718,2.744587, -2.109022,5.998718,2.807876, -2.285673,5.998718,2.831631, -2.472195,5.998718,2.813527, -2.650329,5.998718,2.755337, -2.802639,5.998718,2.662755, -2.914216,5.998718,2.544846, -2.974138,5.998718,2.413149, -2.976539,5.998718,2.280558, -2.927849,6.098616,2.157010, -2.818814,6.098616,2.059178, -2.667463,6.098616,1.995100, -2.488610,6.098616,1.971049, -2.299764,6.098616,1.989378, -2.119409,6.098616,2.048294, -1.965200,6.098616,2.142030, -1.852232,6.098616,2.261409, -1.791563,6.098616,2.394747, -1.789133,6.098616,2.528991, -1.845177,6.098616,2.651000, -1.954212,6.098616,2.748832, -2.105563,6.098616,2.812910, -2.284416,6.098616,2.836961, -2.473263,6.098616,2.818632, -2.653617,6.098616,2.759716, -2.807826,6.098616,2.665981, -2.920794,6.098616,2.546601, -2.981463,6.098616,2.413263, -2.983893,6.098616,2.279019, -2.921184,6.198514,2.160051, -2.813492,6.198514,2.063423, -2.664004,6.198514,2.000134, -2.487353,6.198514,1.976379, -2.300832,6.198514,1.994483, -2.122697,6.198514,2.052673, -1.970387,6.198514,2.145255, -1.858810,6.198514,2.263165, -1.798888,6.198514,2.394861, -1.796487,6.198514,2.527452, -1.851842,6.198514,2.647959, -1.959534,6.198514,2.744587, -2.109022,6.198514,2.807876, -2.285673,6.198514,2.831631, -2.472195,6.198514,2.813527, -2.650329,6.198514,2.755337, -2.802639,6.198514,2.662755, -2.914216,6.198514,2.544846, -2.974138,6.198514,2.413149, -2.976539,6.198514,2.280558, -2.901354,6.295953,2.169099, -2.797656,6.295953,2.076055, -2.653712,6.295953,2.015113, -2.483613,6.295953,1.992239, -2.304009,6.295953,2.009671, -2.132482,6.295953,2.065704, -1.985820,6.295953,2.154851, -1.878382,6.295953,2.268388, -1.820682,6.295953,2.395200, -1.818371,6.295953,2.522873, -1.871672,6.295953,2.638911, -1.975370,6.295953,2.731955, -2.119314,6.295953,2.792897, -2.289413,6.295953,2.815771, -2.469017,6.295953,2.798339, -2.640544,6.295953,2.742306, -2.787206,6.295953,2.653158, -2.894644,6.295953,2.539622, -2.952344,6.295953,2.412810, -2.954656,6.295953,2.285137, -2.868847,6.388533,2.183931, -2.771696,6.388533,2.096762, -2.636841,6.388533,2.039668, -2.477482,6.388533,2.018238, -2.309219,6.388533,2.034570, -2.148521,6.388533,2.087064, -2.011120,6.388533,2.170583, -1.910465,6.388533,2.276951, -1.856409,6.388533,2.395756, -1.854243,6.388533,2.515368, -1.904180,6.388533,2.624079, -2.001330,6.388533,2.711248, -2.136185,6.388533,2.768342, -2.295544,6.388533,2.789772, -2.463808,6.388533,2.773440, -2.624505,6.388533,2.720946, -2.761906,6.388533,2.637427, -2.862561,6.388533,2.531059, -2.916617,6.388533,2.412254, -2.918783,6.388533,2.292642, -2.824463,6.473974,2.204182, -2.736252,6.473974,2.125034, -2.613806,6.473974,2.073194, -2.469111,6.473974,2.053736, -2.316331,6.473974,2.068565, -2.170421,6.473974,2.116229, -2.045663,6.473974,2.192062, -1.954271,6.473974,2.288642, -1.905189,6.473974,2.396515, -1.903222,6.473974,2.505121, -1.948563,6.473974,2.603828, -2.036774,6.473974,2.682976, -2.159220,6.473974,2.734816, -2.303915,6.473974,2.754274, -2.456695,6.473974,2.739445, -2.602605,6.473974,2.691781, -2.727363,6.473974,2.615948, -2.818755,6.473974,2.519368, -2.867837,6.473974,2.411495, -2.869804,6.473974,2.302890, -2.769295,6.550172,2.229353, -2.692196,6.550172,2.160175, -2.585175,6.550172,2.114866, -2.458707,6.550172,2.097859, -2.325172,6.550172,2.110820, -2.197642,6.550172,2.152479, -2.088600,6.550172,2.218760, -2.008719,6.550172,2.303174, -1.965820,6.550172,2.397459, -1.964101,6.550172,2.492383, -2.003731,6.550172,2.578657, -2.080830,6.550172,2.647835, -2.187852,6.550172,2.693145, -2.314320,6.550172,2.710151, -2.447854,6.550172,2.697191, -2.575384,6.550172,2.655531, -2.684427,6.550172,2.589250, -2.764307,6.550172,2.504836, -2.807206,6.550172,2.410552, -2.808925,6.550172,2.315627, -2.704702,6.615252,2.258825, -2.640613,6.615252,2.201321, -2.551651,6.615252,2.163657, -2.446524,6.615252,2.149520, -2.335523,6.615252,2.160293, -2.229513,6.615252,2.194923, -2.138871,6.615252,2.250020, -2.072471,6.615252,2.320189, -2.036810,6.615252,2.398563, -2.035382,6.615252,2.477470, -2.068324,6.615252,2.549185, -2.132413,6.615252,2.606689, -2.221375,6.615252,2.644353, -2.326502,6.615252,2.658490, -2.437503,6.615252,2.647717, -2.543513,6.615252,2.613087, -2.634155,6.615252,2.557990, -2.700556,6.615252,2.487821, -2.736216,6.615252,2.409447, -2.737644,6.615252,2.330540, -2.632274,6.667610,2.291872, -2.582774,6.667610,2.247457, -2.514062,6.667610,2.218366, -2.432864,6.667610,2.207447, -2.347130,6.667610,2.215768, -2.265250,6.667610,2.242516, -2.195241,6.667610,2.285071, -2.143954,6.667610,2.339268, -2.116412,6.667610,2.399802, -2.115308,6.667610,2.460747, -2.140752,6.667610,2.516139, -2.190253,6.667610,2.560553, -2.258965,6.667610,2.589644, -2.340162,6.667610,2.600563, -2.425897,6.667610,2.592242, -2.507776,6.667610,2.565495, -2.577785,6.667610,2.522939, -2.629072,6.667610,2.468742, -2.656615,6.667610,2.408208, -2.657718,6.667610,2.347263, -2.553795,6.705958,2.327679, -2.520102,6.705958,2.297448, -2.473331,6.705958,2.277647, -2.418063,6.705958,2.270214, -2.359706,6.705958,2.275878, -2.303973,6.705958,2.294084, -2.256320,6.705958,2.323050, -2.221411,6.705958,2.359941, -2.202663,6.705958,2.401144, -2.201912,6.705958,2.442628, -2.219231,6.705958,2.480331, -2.252925,6.705958,2.510562, -2.299695,6.705958,2.530364, -2.354963,6.705958,2.537796, -2.413320,6.705958,2.532132, -2.469053,6.705958,2.513926, -2.516706,6.705958,2.484960, -2.551615,6.705958,2.448070, -2.570363,6.705958,2.406866, -2.571114,6.705958,2.365382, -2.471197,6.729351,2.365366, -2.454140,6.729351,2.350062, -2.430463,6.729351,2.340038, -2.402485,6.729351,2.336276, -2.372942,6.729351,2.339143, -2.344729,6.729351,2.348360, -2.320605,6.729351,2.363023, -2.302933,6.729351,2.381698, -2.293442,6.729351,2.402557, -2.293062,6.729351,2.423557, -2.301830,6.729351,2.442644, -2.318886,6.729351,2.457948, -2.342563,6.729351,2.467972, -2.370542,6.729351,2.471734, -2.400084,6.729351,2.468867, -2.428297,6.729351,2.459651, -2.452421,6.729351,2.444987, -2.470093,6.729351,2.426312, -2.479584,6.729351,2.405453, -2.479964,6.729351,2.384453, -2.386513,5.460019,2.404005, -2.386513,6.737213,2.404005, 0.057670,5.087197,1.533989, -0.102047,4.365159,1.382592, -0.881261,7.298335,1.415414, -0.987978,4.917868,-0.246023, -0.974552,4.409359,-0.036269, -0.903951,0.749098,1.391734, -0.974303,4.409359,2.816492, -0.968446,5.044930,3.219364, -0.947550,6.093818,-0.294746, -0.056276,6.063547,1.382712, -0.919355,3.770889,-0.220217, -0.919355,3.770482,2.881249, -0.914841,2.787169,-0.400768, 0.049385,2.754805,1.383785, -0.914841,2.784340,3.124811, -0.769807,0.936079,0.519125, -0.243203,0.949899,1.280022, -0.769807,0.913853,2.045039, -0.970041,4.116695,-0.085176, -0.339285,4.204705,1.382317, -0.965795,4.116695,2.820796, -0.903951,0.747350,1.129156, -0.263255,0.958107,1.164677, 0.006338,2.771655,1.108842, -0.382242,4.198182,1.162986, -0.112810,4.380757,1.172501, 0.042487,5.078936,1.289916, -0.069142,6.062789,1.117887, -0.876611,7.259965,1.129791, -0.427216,5.047376,2.923791, -0.593694,4.387524,2.589641, -0.675777,4.110213,2.483343, -0.614823,3.773632,2.538345, -0.458546,2.814924,2.765382, -0.517748,0.984320,1.847788, -0.369035,0.828165,1.387861, -0.386876,0.843451,1.174411, -0.547582,0.984320,0.640333, -0.522590,2.814980,-0.126730, -0.678866,3.773632,0.037297, -0.705639,4.110213,0.155798, -0.669705,4.387524,0.201283, -0.574621,4.920313,0.013852, -0.597288,6.076719,-0.077097, -0.645874,7.141519,1.124683, -0.623528,7.182167,1.578647, -0.963127,5.571717,-0.307560, -0.588554,5.562149,-0.042053, -0.085435,5.614791,1.197907, -0.073208,5.618431,1.456039, -0.498653,5.621378,2.847872, -0.961774,5.761299,3.166481, -1.698244,5.864260,3.331484, -0.943858,7.043404,0.282648, -0.675851,6.960458,0.462048, -0.323897,6.862718,1.120785, -0.322395,6.862293,1.373783, -0.607414,6.954706,2.223694, -0.946132,6.974571,2.437299, -0.261999,0.971441,1.519049, 0.009034,2.825547,1.771860, -0.292981,3.774096,1.949335, -0.377977,4.087495,1.774561, -0.118180,4.354620,1.920697, 0.055295,5.065518,2.118013, -0.079791,5.608879,1.960065, -0.105532,6.061719,1.832686, -0.380312,6.843057,1.827643, -0.623827,7.049770,1.945767, -0.952122,7.181439,2.146182, -0.903951,0.788215,0.723091, -0.404107,0.848597,0.844320, -0.294266,0.970800,0.986304, -0.060231,2.824781,0.700535, -0.362245,3.773992,0.702399, -0.448811,4.107238,0.872799, -0.211467,4.374547,0.847586, -0.055978,5.010606,0.861139, -0.186021,5.587756,0.767223, -0.171065,6.061682,0.708352, -0.413410,6.860390,0.836084, -0.664414,7.079231,0.818597, -0.942487,7.195107,0.738507, -0.976257,5.189802,-0.275046, -0.581193,5.186581,-0.012515, -0.105804,5.246365,0.816844, -0.006375,5.295219,1.265352, 0.009324,5.301299,1.527132, 0.007765,5.285341,2.100242, -0.446424,5.276807,2.943500, -0.963800,5.324973,3.252408, -0.954779,5.814537,-0.300693, -0.593235,5.800931,-0.060833, -0.169143,5.804809,0.735675, -0.067859,5.817973,1.155025, -0.055326,5.820059,1.416559, -0.106800,5.814581,1.878414, -0.529191,5.823655,2.659953, -0.954779,5.881487,2.944999, -1.698244,4.703660,3.262273, -0.948543,4.711505,3.095775, -0.452096,4.701213,2.824726, 0.053545,4.702866,2.058227, 0.057109,4.718699,1.476428, 0.044943,4.712667,1.245263, -0.053540,4.676924,0.854029, -0.613702,4.640808,0.112180, -0.980934,4.651100,-0.135984, -0.913139,2.213289,-0.454368, -0.486260,2.257506,-0.105870, 0.082235,2.270942,0.685180, 0.148804,2.250844,1.109722, 0.191851,2.237848,1.384249, 0.151500,2.271958,1.881583, -0.349334,2.257506,2.737437, -0.913139,2.197093,3.199742, -0.911879,1.645413,-0.336864, -0.459366,1.697518,-0.043052, 0.096500,1.713605,0.742826, 0.163068,1.689854,1.132649, 0.206115,1.674495,1.384724, 0.165765,1.714806,1.911453, -0.359686,1.697518,2.626396, -0.911879,1.615023,3.126537, -0.947004,6.581815,2.762738, -0.142735,6.411491,1.775650, -0.094933,6.415290,1.380401, -0.108600,6.415017,1.156040, -0.211985,6.414767,0.752173, -0.600062,6.542871,0.136945, -0.946958,6.638655,-0.069632, 0.958574,9.131655,0.804982, 0.958627,9.131409,0.943057, 0.990627,9.088882,0.934102, 0.991134,9.088237,0.812212, 0.897699,9.131989,0.954000, 0.897500,9.132488,0.813334, 0.994048,8.911921,0.950501, 0.874186,9.022608,0.993856, 0.743127,9.075932,0.974741, 0.743157,9.074427,0.831805, 0.873017,9.020750,0.778398, 0.992796,8.911350,0.817274, 0.905173,8.568007,0.994870, 0.690931,8.789373,1.058586, 0.454229,8.913900,1.031349, 0.455247,8.908087,0.865289, 0.681977,8.739902,0.807096, 0.899821,8.567520,0.850462, 0.701104,7.993618,1.114974, 0.368849,8.372566,1.228599, 0.097470,8.652485,1.166076, 0.100131,8.636230,0.944242, 0.358962,8.354746,0.873649, 0.687003,7.994727,0.921542, 0.181380,7.298546,1.263226, -0.185262,7.707785,1.427603, -0.536543,7.892033,1.310704, -0.532004,7.863885,1.044464, -0.201208,7.678016,1.005114, 0.156708,7.299812,1.028695, -0.903951,0.748172,1.252597, -0.378489,0.829974,1.274758, -0.253828,0.954248,1.218903, 0.183305,1.682633,1.251153, 0.169041,2.244735,1.238782, 0.026575,2.767045,1.238098, 0.220396,7.322308,1.143040, 0.776364,8.058407,1.009148, 1.003778,8.671892,0.909786, 1.100010,9.035316,0.862095, 1.097401,9.222527,0.854986, 1.063186,9.268047,0.863212, 0.998660,9.268785,0.868669, 0.835194,9.208342,0.889353, 0.530257,9.034527,0.936226, 0.142826,8.741142,1.047150, -0.526005,7.934400,1.175402, 0.098432,8.048140,1.325717, -0.232167,8.276009,1.236659, -0.205104,8.342941,1.109739, -0.228591,8.253950,0.993152, 0.085588,8.024487,0.937806, 0.435652,7.648150,0.973835, 0.512916,7.691302,1.074490, 0.454911,7.646967,1.187324, -0.037793,7.095860,1.187992, -0.060302,7.085267,1.309731, -0.369617,7.486686,1.491139, -0.722361,7.597817,1.354750, -0.722213,7.622202,1.217490, -0.717775,7.565369,1.080356, -0.388255,7.452339,1.055410, -0.088758,7.086179,1.067431, 1.327202,4.183860,1.238666, 1.225364,4.322377,1.241945, 1.300674,4.186663,1.155817, 1.206437,4.322325,1.164943, 1.394849,3.822612,1.243497, 1.377561,3.830822,1.182107, 1.280543,3.881208,1.161924, 1.287245,4.193879,1.129957, 1.248257,3.913034,1.112946, 1.144749,4.173510,1.068935, 1.168384,4.277771,1.141677, 1.120334,4.253908,1.113299, 1.197337,4.159590,1.343356, 1.299905,3.897092,1.294805, 1.172575,4.237403,1.309767, -0.142786,4.086818,1.720610, -0.106437,4.201802,1.365566, -0.144527,4.192169,1.151698, -0.201697,4.102872,0.907065, -0.128483,3.790758,0.757271, 0.128762,2.983847,0.839578, 0.185833,2.932255,1.110601, 0.203430,2.927307,1.220935, 0.223757,2.916123,1.365615, 0.190032,2.983745,1.708340, -0.067156,3.790874,1.872433, -0.000785,4.108957,1.708089, 0.035856,4.222895,1.354978, -0.001313,4.212289,1.135149, -0.056035,4.123796,0.904168, 0.013400,3.826861,0.757729, 0.258416,3.059251,0.843451, 0.312997,3.007881,1.135627, 0.329971,3.002559,1.224745, 0.349867,2.991742,1.351844, 0.318130,3.058703,1.690706, 0.073200,3.826988,1.851524, -0.245851,3.771950,1.923091, -0.328297,4.070077,1.753743, -0.289927,4.186761,1.377970, -0.331164,4.179299,1.163504, -0.394691,4.088732,0.887477, -0.312319,3.771844,0.724254, -0.024563,2.867772,0.809167, 0.038938,2.815217,1.112937, 0.058292,2.810618,1.236136, 0.080208,2.798682,1.379125, 0.041893,2.868349,1.750579, -0.917236,3.310895,-0.304968, -0.605509,3.323608,-0.039698, -0.220478,3.328424,0.694770, -0.177245,3.347466,0.717575, -0.007731,3.411988,0.753728, 0.128412,3.466539,0.756348, 1.193336,4.051241,1.074913, 1.335144,4.070605,1.136400, 1.347968,4.063218,1.161263, 1.370530,4.059274,1.239104, 1.245483,4.036371,1.341840, 0.188172,3.466349,1.855691, 0.053570,3.412002,1.877588, -0.110782,3.347793,1.930344, -0.151213,3.328840,1.957306, -0.541466,3.323608,2.653147, -0.917236,3.307580,3.003808, 0.578632,4.185386,1.569926, 0.605104,4.276092,1.300686, 0.569244,4.264621,1.105660, 0.521167,4.194170,0.964978, 0.578987,3.999374,0.858887, 0.677112,3.746380,0.864680, 0.788025,3.460409,0.940155, 0.835590,3.417889,1.127361, 0.851042,3.411844,1.184683, 0.870441,3.403982,1.301072, 0.845103,3.458336,1.548285, 0.734309,3.745486,1.664682, 0.636292,3.999523,1.664615, -0.329724,0.632038,1.393826, -0.336746,0.637758,1.258982, -0.864640,0.636274,1.397699, -0.862208,0.643725,1.236822, -0.337607,0.644317,1.150743, -0.439458,0.653863,0.882592, -0.854681,0.646182,1.105488, -0.820308,0.662357,0.774735, -0.863115,0.641414,2.059591, -0.324554,0.642680,1.881856, -0.665903,0.752117,2.752851, -0.501522,0.776396,2.730588, -0.660956,0.637800,2.753470, -0.479954,0.661780,2.740634, -0.349413,0.870273,2.332838, -0.299186,0.655284,2.356786, -0.863641,0.632687,2.360420, -0.890676,0.829417,2.345926, -0.354473,0.861853,1.860197, -0.893424,0.839568,2.032612, -0.929711,1.284713,2.916079, -0.468907,1.362125,2.485898, -0.017587,1.377703,1.848973, 0.016391,1.341527,1.382425, -0.002816,1.348830,1.263685, -0.019857,1.355310,1.158337, -0.075912,1.376625,0.811797, -0.539441,1.362125,0.141687, -0.929711,1.318459,-0.091674, -0.361843,0.842228,1.621137, -0.327170,0.635448,1.634853, -0.863887,0.636966,1.724592, -0.898752,0.807160,1.708249, -0.392515,0.737309,0.839928, -0.899061,0.718481,0.718699, -0.936522,0.691296,1.116041, -0.941601,0.690301,1.243858, -0.943242,0.686586,1.395039, -0.939910,0.709960,1.717304, -0.936495,0.729778,2.047560, -0.906967,0.720416,2.353957, -0.659826,0.700469,2.753194, -0.489648,0.724583,2.736154, -0.276446,0.751155,2.346106, -0.280378,0.744378,1.872197, -0.286147,0.724758,1.628737, -0.291775,0.719498,1.391167, -0.301648,0.723474,1.266017, -0.306784,0.733117,1.161298, -1.580214,2.375488,-0.587190, -1.579997,1.637858,-0.435824, -1.582775,1.316912,-0.211739, -1.558411,0.936079,0.457171, -1.578628,0.932213,0.670993, -1.578628,0.866328,1.110834, -1.578628,0.859135,1.244544, -1.578628,0.851028,1.395254, -1.558265,0.921551,2.263827, -1.582647,1.290928,3.047654, -1.579997,1.615023,3.261336, -1.580214,2.197093,3.345907, -1.580508,2.784340,3.270392, -1.580922,3.307580,3.141421, -1.581288,3.770482,3.011813, -1.588441,4.116695,2.965993, -1.590674,4.396653,2.934396, -1.588183,4.704839,3.234818, -1.588843,5.848781,3.306518, -1.587402,5.901728,3.087314, -1.586154,6.118466,2.996354, -1.585878,6.620039,2.914546, -1.585452,7.033372,2.549348, -1.585870,7.271367,2.204748, -1.575217,7.382180,1.421581, -1.574518,7.345311,1.112024, -1.584422,7.229289,0.572227, -1.585110,7.103171,0.193342, -1.585871,6.676898,-0.190094, -1.586154,6.118466,-0.435783, -1.587402,5.834776,-0.440241, -1.588843,5.586868,-0.445388, -1.591109,5.196948,-0.410170, -1.593132,4.918644,-0.378732, -1.591305,4.644433,-0.259541, -1.589649,4.396653,-0.151531, -1.588943,4.117214,-0.204506, -1.581287,3.775185,-0.350780, -1.580922,3.319687,-0.442581, -1.580508,2.791816,-0.546349, -1.580508,9.573938,-6.455655, -1.580214,8.661811,-8.041217, -0.664639,0.772027,2.634483, -0.635681,0.706173,2.740634, -0.650345,0.642808,2.636551, -0.710971,0.638799,2.359437, -0.710971,0.638798,2.359437, -0.513965,0.774991,2.623301, -0.536713,0.719618,2.753720, -0.507004,0.720555,2.736133, -0.536541,0.652509,2.756616, -0.501881,0.659630,2.633209, -0.441105,0.649602,2.357700, -0.536831,0.778177,2.742141, -0.429862,0.780086,2.725852, -0.414167,0.725978,2.732626, -0.404806,0.661335,2.731349, -0.736167,0.756910,2.749205, -0.733125,0.702190,2.753275, -0.728515,0.637340,2.752712, -0.863114,0.641414,2.059591, -0.710965,0.638799,2.359437, -1.580508,2.971131,-1.334923, -1.580214,2.517949,-1.772559, -1.580508,3.868606,-1.338238, -1.580214,3.370322,-1.813240, -1.580508,3.986215,-2.351965, -1.580214,3.410797,-2.891809, -1.580508,5.144774,-2.594779, -1.580214,4.471087,-3.217767, -1.580508,5.432286,-3.787165, -1.580214,4.669659,-4.484341, -1.580508,6.836013,-4.332883, -1.580214,6.002525,-5.086825, -1.580508,7.494373,-5.868810, -1.580214,6.709111,-6.891956, -0.618090,0.828845,0.727195, -0.629921,0.729280,0.720370, -0.634952,0.650851,0.765782, -0.609618,0.639503,1.126935, -0.602569,0.634583,1.247771, -0.593404,0.627345,1.395736, -0.583009,0.629571,1.677630, -0.574285,0.636016,1.964272, -0.563257,0.638866,2.358486, -0.602857,0.876577,1.939657, -0.635980,0.835111,1.659906, -0.666453,0.792727,1.434825, 1.421183,4.243867,1.197475, 1.337923,4.415346,1.211464, 1.394656,4.246670,1.114626, 1.318996,4.415294,1.134463, 1.489383,3.872406,1.187091, 1.463739,4.054178,1.184952, 1.472094,3.880615,1.125701, 1.441176,4.058121,1.107110, 1.437226,4.321624,1.200138, 1.414759,4.321478,1.118050, 1.495777,4.213895,1.112908, 1.522828,4.206408,1.194373, 1.523913,4.110361,1.186941, 1.503446,4.106149,1.108043, 1.493877,3.986062,1.109743, 1.516551,3.985150,1.185224, 1.385108,3.827238,1.208905, 1.501789,3.862202,1.152498, 1.525923,4.003533,1.142692, 1.451025,4.056400,1.141090, 1.534529,4.104760,1.142483, 1.520489,4.228389,1.148470, 1.406235,4.245447,1.150793, 1.454881,4.327962,1.153883, 1.331588,4.439969,1.168076, 1.214699,4.322348,1.198557, -0.047618,7.091235,1.241135, 0.203365,7.311935,1.195505, 0.487594,7.671948,1.123744, 0.743510,8.030125,1.055343, 0.960735,8.626543,0.946927, 1.053754,8.981451,0.900687, 1.050791,9.164186,0.889522, 1.017542,9.208401,0.898067, 0.954589,9.209070,0.905918, 0.795004,9.150541,0.926628, 0.497069,8.981871,0.977750, 0.123027,8.702441,1.099065, -0.216918,8.313724,1.165143, -0.530605,7.915905,1.234465, -0.722278,7.611556,1.277408, 1.086644,4.229877,1.392710, 1.116923,4.276338,1.250444, 1.106249,4.276047,1.202302, 1.097978,4.275821,1.165004, 1.081700,4.275868,1.136466, 1.033645,4.245264,1.077724, 1.062894,4.148316,1.024431, 1.118649,4.007133,1.030381, 1.181670,3.847549,1.073832, 1.216166,3.814175,1.156924, 1.228786,3.806815,1.182480, 1.236465,3.803253,1.212752, 1.246379,3.798656,1.251827, 1.234104,3.833613,1.376781, 1.171526,3.994286,1.433852, 1.116164,4.136432,1.435139, 1.110877,4.372215,1.249998, 1.086045,4.382377,1.201900, 1.192063,4.408942,1.241500, 1.192316,4.419441,1.198155, 1.091554,4.371696,1.164647, 1.172758,4.408889,1.164586, 1.333285,3.698454,1.182228, 1.415715,3.793313,1.178382, 1.311368,3.716410,1.160465, 1.393929,3.811291,1.160092, 1.327572,3.706759,1.229994, 1.409829,3.801590,1.221664, 1.386384,3.904989,1.241969, 1.538447,3.917676,1.186263, 1.551179,3.927525,1.147819, 1.519276,3.924606,1.118452, 1.368752,3.900003,1.175901, 1.163262,4.296011,1.246813, 1.144036,4.410665,1.244089, 1.131544,4.422323,1.198572, 1.121841,4.409384,1.163220, 1.165358,4.304712,1.164967, 1.339771,3.813725,1.246588, 1.388151,3.722811,1.214615, 1.401069,3.716182,1.177351, 1.376596,3.737669,1.148661, 1.309108,3.819776,1.182279, 1.273363,4.257090,1.240400, 1.381760,4.373972,1.206465, 1.440773,4.418344,1.161319, 1.414175,4.403211,1.126802, 1.248684,4.261507,1.160851, 1.223967,4.238540,1.136197, 1.314006,4.125005,1.133558, 1.325311,4.122357,1.158654, 1.543030,4.165524,1.110462, 1.571085,4.170799,1.145400, 1.543522,4.161433,1.190893, 1.362282,4.082989,1.239021, -0.614409,0.767085,2.745790, -0.607033,0.711338,2.748685, -0.601310,0.647606,2.750835, -0.813811,0.840561,2.344068, -0.784507,0.635855,2.359911, -0.402718,0.870151,2.334127, -0.359016,0.652889,2.357172, -1.698244,5.791654,3.336877, -1.610155,5.845484,3.325988, -1.698244,5.855844,3.349727, -1.698244,5.799290,3.349555, -1.661435,5.848361,3.344789, -1.698244,5.828704,3.354529, -1.589470,5.698263,3.359675, -1.589820,5.563888,3.357332, -0.962747,5.437913,3.230454, -1.208515,5.491799,3.279040, -1.224732,5.327922,3.313256, -1.326378,5.044930,3.304751, -1.588640,4.744855,3.251590, -1.406615,4.896911,3.266648, -0.961991,5.567183,3.205083, -1.698244,5.621775,3.374165, -1.407115,5.501751,3.323772, -1.589820,5.563888,3.357332, -1.407115,5.501751,3.323773, -1.589602,5.563888,3.320037, -1.207239,5.491799,3.242457, -1.222854,5.327922,3.276789, -1.406379,5.501751,3.286695, -1.324595,5.044930,3.267469, -1.405225,4.896911,3.228594, -1.588120,4.744855,3.212049, -1.638752,5.263128,3.270032, -1.639657,5.092899,3.247207, -1.638379,5.400507,3.242821, -1.409176,5.357777,3.195753, -1.418671,5.260640,3.217078, -1.528485,5.363675,3.222360, -1.480389,5.092899,3.208196, -1.528993,5.005163,3.184189, -1.638104,4.915033,3.173187, -0.985790,6.312657,2.831864, -0.771753,6.561685,2.677636, -0.533609,6.527696,2.451436, -0.457330,6.431335,2.335210, -0.388024,6.052183,2.309137, -0.534362,5.845429,2.635531, -0.949258,5.998186,2.871266, -0.984830,6.096311,2.866145, -0.750270,5.852077,2.792109, -0.396441,6.305063,2.315657, -0.440919,5.927769,2.469016, -0.745022,5.852983,2.805657, -1.585989,6.348099,2.989172, -0.902739,6.489412,2.774276, -0.561777,6.521027,2.428095, -0.794369,6.556392,2.648263, -0.488863,6.424162,2.316060, -0.428366,6.300253,2.296690, -0.473512,5.920745,2.452239, -0.420579,6.047197,2.291606, -0.552645,5.854095,2.624991, -0.769599,5.843473,2.761565, -0.967985,5.990165,2.840247, -1.003414,6.090391,2.834562, -1.004036,6.309879,2.799362, -0.921979,6.486332,2.742249, -0.718097,6.344914,2.424743, -0.719135,6.227723,2.460972, -0.824699,6.357667,2.524581, -0.815134,6.238385,2.537379, -0.687120,6.304993,2.376165, -0.657812,6.231863,2.367441, -0.715203,6.118613,2.483947, -0.681200,6.041281,2.448604, -0.654912,6.106788,2.390732, -0.710565,6.006950,2.523134, -0.807485,6.000689,2.580007, -0.812911,6.118616,2.550638, -0.904713,6.074048,2.618325, -0.921988,6.126617,2.614732, -0.921769,6.239607,2.596076, -0.882718,6.326315,2.567729, -1.208762,5.475520,3.245857, -1.209987,5.476682,3.282183, -0.454092,0.872504,2.334875, -0.779400,0.845707,2.343236, -0.607048,0.873761,2.339615, -0.576261,0.877223,2.337900, -3.454159,5.087197,1.533989, -3.294441,4.365159,1.382592, -2.515228,7.298335,1.415414, -2.408511,4.917868,-0.246023, -2.421936,4.409359,-0.036269, -2.492537,0.749098,1.391734, -2.422185,4.409359,2.816492, -2.428042,5.044930,3.219364, -2.448938,6.093818,-0.294746, -3.340212,6.063547,1.382712, -2.477133,3.770889,-0.220217, -2.477133,3.770482,2.881249, -2.481647,2.787169,-0.400768, -3.445873,2.754805,1.383785, -2.481647,2.784340,3.124811, -2.626682,0.936079,0.519125, -3.153286,0.949899,1.280022, -2.626682,0.913853,2.045039, -2.426448,4.116695,-0.085176, -3.057204,4.204705,1.382317, -2.430693,4.116695,2.820796, -2.492537,0.747350,1.129156, -3.133233,0.958107,1.164677, -3.402827,2.771655,1.108842, -3.014247,4.198182,1.162986, -3.251532,4.380757,1.172501, -3.406849,5.078936,1.289916, -3.295183,6.062789,1.117887, -2.519877,7.259965,1.129791, -2.969273,5.047376,2.923791, -2.802795,4.387524,2.589641, -2.720712,4.110213,2.483343, -2.781666,3.773632,2.538345, -2.937942,2.814924,2.765382, -2.878740,0.984320,1.847788, -3.027453,0.828165,1.387861, -3.009612,0.843451,1.174411, -2.848907,0.984320,0.640333, -2.873899,2.814980,-0.126730, -2.717622,3.773632,0.037297, -2.690849,4.110213,0.155798, -2.726783,4.387524,0.201283, -2.821867,4.920313,0.013852, -2.799201,6.076719,-0.077097, -2.750615,7.141519,1.124683, -2.772961,7.182167,1.578647, -2.433361,5.571717,-0.307560, -2.807934,5.562149,-0.042053, -3.278902,5.614791,1.197907, -3.323281,5.618431,1.456039, -2.897836,5.621378,2.847872, -2.434714,5.761299,3.166481, -2.452630,7.043404,0.282648, -2.720638,6.960458,0.462048, -3.040428,6.862718,1.120785, -3.074094,6.862293,1.373783, -2.789074,6.954706,2.223694, -2.450356,6.974571,2.437299, -3.134489,0.971441,1.519049, -3.405523,2.825547,1.771860, -3.103508,3.774096,1.949335, -3.018511,4.087495,1.774561, -3.278309,4.354620,1.920697, -3.451784,5.065518,2.118013, -3.316697,5.608879,1.960065, -3.290957,6.061719,1.832686, -3.016177,6.843057,1.827643, -2.772662,7.049770,1.945767, -2.444366,7.181439,2.146182, -2.492537,0.788215,0.723091, -2.992382,0.848597,0.844320, -3.102222,0.970800,0.986304, -3.336257,2.824781,0.700535, -3.034243,3.773992,0.702399, -2.947678,4.107238,0.872799, -3.185022,4.374547,0.847586, -3.340511,5.010606,0.861139, -3.210467,5.587756,0.767223, -3.225423,6.061682,0.708352, -2.983078,6.860390,0.836084, -2.732075,7.079231,0.818597, -2.454002,7.195107,0.738507, -2.420231,5.189802,-0.275046, -2.815296,5.186581,-0.012515, -3.290684,5.246365,0.816844, -3.357982,5.295219,1.265352, -3.405812,5.301299,1.527132, -3.404253,5.285341,2.100242, -2.950065,5.276807,2.943500, -2.432688,5.324973,3.252408, -2.441709,5.814537,-0.300693, -2.803254,5.800931,-0.060833, -3.227345,5.804809,0.735675, -3.296466,5.817973,1.155025, -3.341163,5.820059,1.416559, -3.289688,5.814581,1.878414, -2.867297,5.823655,2.659953, -2.441709,5.881487,2.944999, -2.447946,4.711505,3.095775, -2.944393,4.701213,2.824726, -3.450033,4.702866,2.058227, -3.453597,4.718699,1.476428, -3.409303,4.712667,1.245263, -3.342948,4.676924,0.854029, -2.782786,4.640808,0.112180, -2.415554,4.651100,-0.135984, -2.483349,2.213289,-0.454368, -2.910228,2.257506,-0.105870, -3.478724,2.270942,0.685180, -3.545292,2.250844,1.109722, -3.588339,2.237848,1.384249, -3.547989,2.271958,1.881583, -3.047154,2.257506,2.737437, -2.483349,2.197093,3.199742, -2.484609,1.645413,-0.336864, -2.937123,1.697518,-0.043052, -3.492988,1.713605,0.742826, -3.559556,1.689854,1.132649, -3.602603,1.674495,1.384724, -3.562253,1.714806,1.911453, -3.036803,1.697518,2.626396, -2.484609,1.615023,3.126537, -2.449484,6.581815,2.762738, -3.253753,6.411491,1.775650, -3.301555,6.415290,1.380401, -3.255725,6.415017,1.156040, -3.184504,6.414767,0.752173, -2.796426,6.542871,0.136945, -2.449530,6.638655,-0.069632, -4.355062,9.131655,0.804982, -4.355115,9.131409,0.943057, -4.387115,9.088882,0.934102, -4.387622,9.088237,0.812212, -4.294188,9.131989,0.954000, -4.293989,9.132488,0.813334, -4.390536,8.911921,0.950501, -4.270675,9.022608,0.993856, -4.139616,9.075932,0.974741, -4.139646,9.074427,0.831805, -4.269506,9.020750,0.778398, -4.389284,8.911350,0.817274, -4.301661,8.568007,0.994870, -4.087420,8.789373,1.058586, -3.850718,8.913900,1.031349, -3.851735,8.908087,0.865289, -4.078466,8.739902,0.807096, -4.296309,8.567520,0.850462, -4.097592,7.993618,1.114974, -3.765338,8.372566,1.228599, -3.493958,8.652485,1.166076, -3.496620,8.636230,0.944242, -3.755450,8.354746,0.873649, -4.083491,7.994727,0.921542, -3.577868,7.298546,1.263226, -3.211226,7.707785,1.427603, -2.859945,7.892033,1.310704, -2.864484,7.863885,1.044464, -3.195281,7.678016,1.005114, -3.553196,7.299812,1.028695, -2.492537,0.748172,1.252597, -3.018000,0.829974,1.274758, -3.142660,0.954248,1.218903, -3.579793,1.682633,1.251153, -3.565529,2.244735,1.238782, -3.423063,2.767045,1.238098, -3.616885,7.322308,1.143040, -4.172853,8.058407,1.009148, -4.400266,8.671892,0.909786, -4.496499,9.035316,0.862095, -4.493889,9.222527,0.854986, -4.459674,9.268047,0.863212, -4.395149,9.268785,0.868669, -4.231682,9.208342,0.889353, -3.926745,9.034527,0.936226, -3.539314,8.741142,1.047150, -2.870483,7.934400,1.175402, -3.494920,8.048140,1.325717, -3.164321,8.276009,1.236659, -3.191385,8.342941,1.109739, -3.167898,8.253950,0.993152, -3.482076,8.024487,0.937806, -3.832140,7.648150,0.973835, -3.909404,7.691302,1.074490, -3.851400,7.646967,1.187324, -3.358696,7.095860,1.187992, -3.336187,7.085267,1.309731, -3.026872,7.486686,1.491139, -2.674128,7.597817,1.354750, -2.674275,7.622202,1.217490, -2.678713,7.565369,1.080356, -3.008234,7.452339,1.055410, -3.307731,7.086179,1.067431, -4.723691,4.183860,1.238666, -4.621852,4.322377,1.241945, -4.697162,4.186663,1.155817, -4.602925,4.322325,1.164943, -4.791337,3.822612,1.243497, -4.774049,3.830822,1.182107, -4.677032,3.881208,1.161924, -4.683733,4.193879,1.129957, -4.644745,3.913034,1.112946, -4.541237,4.173510,1.068935, -4.564873,4.277771,1.141677, -4.516822,4.253908,1.113299, -4.593825,4.159590,1.343356, -4.696393,3.897092,1.294805, -4.569064,4.237403,1.309767, -3.253703,4.086818,1.720610, -3.290051,4.201802,1.365566, -3.251962,4.192169,1.151698, -3.194791,4.102872,0.907065, -3.268005,3.790758,0.757271, -3.525250,2.983847,0.839578, -3.582321,2.932255,1.110601, -3.599918,2.927307,1.220935, -3.620245,2.916123,1.365615, -3.586521,2.983745,1.708340, -3.329332,3.790874,1.872433, -3.395704,4.108957,1.708089, -3.432344,4.222895,1.354978, -3.395176,4.212289,1.135149, -3.340454,4.123796,0.904168, -3.409888,3.826861,0.757729, -3.654904,3.059251,0.843451, -3.709486,3.007881,1.135627, -3.726460,3.002559,1.224745, -3.746355,2.991742,1.351844, -3.714619,3.058703,1.690706, -3.469688,3.826988,1.851524, -3.150637,3.771950,1.923091, -3.068192,4.070077,1.753743, -3.106561,4.186761,1.377970, -3.065324,4.179299,1.163504, -3.001798,4.088732,0.887477, -3.084169,3.771844,0.724254, -3.371925,2.867772,0.809167, -3.435427,2.815217,1.112937, -3.454781,2.810618,1.236136, -3.476696,2.798682,1.379125, -3.438381,2.868349,1.750579, -2.479252,3.310895,-0.304968, -2.790979,3.323608,-0.039698, -3.176011,3.328424,0.694770, -3.219244,3.347466,0.717575, -3.388758,3.411988,0.753728, -3.524901,3.466539,0.756348, -4.589825,4.051241,1.074913, -4.731633,4.070605,1.136400, -4.744456,4.063218,1.161263, -4.767018,4.059274,1.239104, -4.641971,4.036371,1.341840, -3.584661,3.466349,1.855691, -3.450058,3.412002,1.877588, -3.285707,3.347793,1.930344, -3.245276,3.328840,1.957306, -2.855023,3.323608,2.653147, -2.479252,3.307580,3.003808, -3.975121,4.185386,1.569926, -4.001593,4.276092,1.300686, -3.965733,4.264621,1.105660, -3.917655,4.194170,0.964978, -3.975475,3.999374,0.858887, -4.073600,3.746380,0.864680, -4.184514,3.460409,0.940155, -4.232079,3.417889,1.127361, -4.247530,3.411844,1.184683, -4.266930,3.403982,1.301072, -4.241592,3.458336,1.548285, -4.130797,3.745486,1.664682, -4.032781,3.999523,1.664615, -3.066764,0.632038,1.393826, -3.059742,0.637758,1.258982, -2.531849,0.636274,1.397699, -2.534280,0.643725,1.236822, -3.058882,0.644317,1.150743, -2.957030,0.653863,0.882592, -2.541807,0.646182,1.105488, -2.576181,0.662357,0.774735, -2.533374,0.641414,2.059591, -3.071934,0.642680,1.881856, -2.730586,0.752117,2.752851, -2.894966,0.776396,2.730588, -2.735533,0.637800,2.753470, -2.916534,0.661780,2.740634, -3.047076,0.870273,2.332838, -3.097302,0.655284,2.356786, -2.532847,0.632687,2.360420, -2.505813,0.829417,2.345926, -3.042016,0.861853,1.860197, -2.503064,0.839568,2.032612, -2.466778,1.284713,2.916079, -2.927581,1.362125,2.485898, -3.378902,1.377703,1.848973, -3.412879,1.341527,1.382425, -3.393672,1.348830,1.263685, -3.376632,1.355310,1.158337, -3.320576,1.376625,0.811797, -2.857048,1.362125,0.141687, -2.466778,1.318459,-0.091674, -3.034646,0.842228,1.621137, -3.069318,0.635448,1.634853, -2.532602,0.636966,1.724592, -2.497736,0.807160,1.708249, -3.003973,0.737309,0.839928, -2.497427,0.718481,0.718699, -2.459966,0.691296,1.116041, -2.454887,0.690301,1.243858, -2.453247,0.686586,1.395039, -2.456578,0.709960,1.717304, -2.459993,0.729778,2.047560, -2.489522,0.720416,2.353957, -2.736662,0.700469,2.753194, -2.906840,0.724583,2.736154, -3.120042,0.751155,2.346106, -3.116110,0.744378,1.872197, -3.110342,0.724758,1.628737, -3.104713,0.719498,1.391167, -3.094840,0.723474,1.266017, -3.089704,0.733117,1.161298, -1.816274,2.375488,-0.587190, -1.816491,1.637858,-0.435824, -1.813713,1.316912,-0.211739, -1.838078,0.936079,0.457171, -1.817860,0.932213,0.670993, -1.817860,0.866328,1.110834, -1.817860,0.859135,1.244544, -1.817860,0.851028,1.395254, -1.838223,0.921551,2.263827, -1.813841,1.290928,3.047654, -1.816491,1.615023,3.261336, -1.816274,2.197093,3.345907, -1.815980,2.784340,3.270392, -1.815567,3.307580,3.141421, -1.815201,3.770482,3.011813, -1.808047,4.116695,2.965993, -1.805814,4.396653,2.934396, -1.808306,4.704839,3.234818, -1.807646,5.848781,3.306518, -1.809087,5.901728,3.087314, -1.810334,6.118466,2.996354, -1.810611,6.620039,2.914546, -1.811036,7.033372,2.549348, -1.810618,7.271367,2.204748, -1.821271,7.382180,1.421581, -1.821970,7.345311,1.112024, -1.812067,7.229289,0.572227, -1.811378,7.103171,0.193342, -1.810618,6.676898,-0.190094, -1.810334,6.118466,-0.435783, -1.809087,5.834776,-0.440241, -1.807646,5.586868,-0.445388, -1.805379,5.196948,-0.410170, -1.803356,4.918644,-0.378732, -1.805184,4.644433,-0.259541, -1.806839,4.396653,-0.151531, -1.807546,4.117214,-0.204506, -1.815201,3.775185,-0.350780, -1.815567,3.319687,-0.442581, -1.815980,2.791816,-0.546349, -1.815980,9.573938,-6.455655, -1.816274,8.661811,-8.041217, -2.731849,0.772027,2.634483, -2.760807,0.706173,2.740634, -2.746143,0.642808,2.636551, -2.685517,0.638799,2.359437, -2.685518,0.638798,2.359437, -2.882524,0.774991,2.623301, -2.859775,0.719618,2.753720, -2.889485,0.720555,2.736133, -2.859948,0.652509,2.756616, -2.894608,0.659630,2.633209, -2.955384,0.649602,2.357700, -2.859658,0.778177,2.742141, -2.966626,0.780086,2.725852, -2.982322,0.725978,2.732626, -2.991682,0.661335,2.731349, -2.660321,0.756910,2.749205, -2.663363,0.702190,2.753275, -2.667973,0.637340,2.752712, -2.533374,0.641414,2.059591, -2.685524,0.638799,2.359437, -1.815980,2.971131,-1.334923, -1.816274,2.517949,-1.772559, -1.815980,3.868606,-1.338238, -1.816274,3.370322,-1.813240, -1.815980,3.986215,-2.351965, -1.816274,3.410797,-2.891809, -1.815980,5.144774,-2.594779, -1.816274,4.471087,-3.217767, -1.815980,5.432286,-3.787165, -1.816274,4.669659,-4.484341, -1.815980,6.836013,-4.332883, -1.816274,6.002525,-5.086825, -1.815980,7.494373,-5.868810, -1.816274,6.709111,-6.891956, -2.778398,0.828845,0.727195, -2.766567,0.729280,0.720370, -2.761537,0.650851,0.765782, -2.786870,0.639503,1.126935, -2.793919,0.634583,1.247771, -2.803084,0.627345,1.395736, -2.813479,0.629571,1.677630, -2.822204,0.636016,1.964272, -2.833231,0.638866,2.358486, -2.793632,0.876577,1.939657, -2.760508,0.835111,1.659906, -2.730036,0.792727,1.434825, -4.817671,4.243867,1.197475, -4.734412,4.415346,1.211464, -4.791144,4.246670,1.114626, -4.715484,4.415294,1.134463, -4.885871,3.872406,1.187091, -4.860228,4.054178,1.184952, -4.868583,3.880615,1.125701, -4.837664,4.058121,1.107110, -4.833714,4.321624,1.200138, -4.811247,4.321478,1.118050, -4.892265,4.213895,1.112908, -4.919316,4.206408,1.194373, -4.920402,4.110361,1.186941, -4.899935,4.106149,1.108043, -4.890365,3.986062,1.109743, -4.913040,3.985150,1.185224, -4.781596,3.827238,1.208905, -4.898278,3.862202,1.152498, -4.922411,4.003533,1.142692, -4.847514,4.056400,1.141090, -4.931017,4.104760,1.142483, -4.916977,4.228389,1.148470, -4.802724,4.245447,1.150793, -4.851370,4.327962,1.153883, -4.728076,4.439969,1.168076, -4.611187,4.322348,1.198557, -3.348870,7.091235,1.241135, -3.599853,7.311935,1.195505, -3.884083,7.671948,1.123744, -4.139999,8.030125,1.055343, -4.357224,8.626543,0.946927, -4.450243,8.981451,0.900687, -4.447279,9.164186,0.889522, -4.414031,9.208401,0.898067, -4.351078,9.209070,0.905918, -4.191493,9.150541,0.926628, -3.893557,8.981871,0.977750, -3.519515,8.702441,1.099065, -3.179571,8.313724,1.165143, -2.865883,7.915905,1.234465, -2.674211,7.611556,1.277408, -4.483132,4.229877,1.392710, -4.513412,4.276338,1.250444, -4.502737,4.276047,1.202302, -4.494466,4.275821,1.165004, -4.478189,4.275868,1.136466, -4.430134,4.245264,1.077724, -4.459383,4.148316,1.024431, -4.515137,4.007133,1.030381, -4.578158,3.847549,1.073832, -4.612655,3.814175,1.156924, -4.625274,3.806815,1.182480, -4.632954,3.803253,1.212752, -4.642867,3.798656,1.251827, -4.630592,3.833613,1.376781, -4.568014,3.994286,1.433852, -4.512652,4.136432,1.435139, -4.507366,4.372215,1.249998, -4.482533,4.382377,1.201900, -4.588552,4.408942,1.241500, -4.588805,4.419441,1.198155, -4.488043,4.371696,1.164647, -4.569246,4.408889,1.164586, -4.729774,3.698454,1.182228, -4.812203,3.793313,1.178382, -4.707856,3.716410,1.160465, -4.790418,3.811291,1.160092, -4.724060,3.706759,1.229994, -4.806317,3.801590,1.221664, -4.782873,3.904989,1.241969, -4.934935,3.917676,1.186263, -4.947668,3.927525,1.147819, -4.915764,3.924606,1.118452, -4.765240,3.900003,1.175901, -4.559751,4.296011,1.246813, -4.540524,4.410665,1.244089, -4.528033,4.422323,1.198572, -4.518330,4.409384,1.163220, -4.561847,4.304712,1.164967, -4.736259,3.813725,1.246588, -4.784639,3.722811,1.214615, -4.797557,3.716182,1.177351, -4.773084,3.737669,1.148661, -4.705597,3.819776,1.182279, -4.669852,4.257090,1.240400, -4.778249,4.373972,1.206465, -4.837262,4.418344,1.161319, -4.810664,4.403211,1.126802, -4.645172,4.261507,1.160851, -4.620456,4.238540,1.136197, -4.710495,4.125005,1.133558, -4.721799,4.122357,1.158654, -4.939518,4.165524,1.110462, -4.967574,4.170799,1.145400, -4.940010,4.161433,1.190893, -4.758770,4.082989,1.239021, -2.782079,0.767085,2.745790, -2.789455,0.711338,2.748685, -2.795178,0.647606,2.750835, -2.582677,0.840561,2.344068, -2.611981,0.635855,2.359911, -2.993771,0.870151,2.334127, -3.037473,0.652889,2.357172, -1.786334,5.845484,3.325988, -1.735053,5.848361,3.344789, -1.807018,5.698263,3.359675, -1.806668,5.563888,3.357332, -2.433742,5.437913,3.230454, -2.187973,5.491799,3.279040, -2.171756,5.327922,3.313257, -2.070111,5.044930,3.304751, -1.807848,4.744855,3.251590, -1.989874,4.896911,3.266648, -2.434497,5.567183,3.205083, -1.989373,5.501751,3.323772, -1.806668,5.563888,3.357332, -1.989373,5.501751,3.323773, -1.806887,5.563888,3.320037, -2.189250,5.491799,3.242457, -2.173635,5.327922,3.276789, -1.990110,5.501751,3.286695, -2.071893,5.044930,3.267469, -1.991263,4.896911,3.228594, -1.808369,4.744855,3.212049, -1.757737,5.263128,3.270032, -1.756831,5.092899,3.247207, -1.758109,5.400507,3.242821, -1.987313,5.357777,3.195753, -1.977817,5.260640,3.217078, -1.868003,5.363675,3.222360, -1.916099,5.092899,3.208196, -1.867495,5.005163,3.184189, -1.758384,4.915033,3.173187, -2.410699,6.312657,2.831864, -2.624735,6.561685,2.677636, -2.862879,6.527696,2.451436, -2.939159,6.431335,2.335210, -3.008465,6.052183,2.309137, -2.862126,5.845429,2.635531, -2.447231,5.998186,2.871266, -2.411658,6.096311,2.866145, -2.646218,5.852077,2.792109, -3.000047,6.305063,2.315657, -2.955569,5.927769,2.469016, -2.651466,5.852983,2.805657, -1.810499,6.348099,2.989172, -2.493750,6.489412,2.774276, -2.834711,6.521027,2.428095, -2.602119,6.556392,2.648263, -2.907626,6.424162,2.316060, -2.968122,6.300253,2.296690, -2.922976,5.920745,2.452239, -2.975910,6.047197,2.291606, -2.843843,5.854095,2.624991, -2.626890,5.843473,2.761565, -2.428504,5.990165,2.840247, -2.393074,6.090391,2.834562, -2.392453,6.309879,2.799362, -2.474510,6.486332,2.742250, -2.678391,6.344914,2.424743, -2.677353,6.227723,2.460972, -2.571789,6.357667,2.524581, -2.581355,6.238385,2.537379, -2.709368,6.304993,2.376165, -2.738676,6.231863,2.367441, -2.681286,6.118613,2.483947, -2.715289,6.041281,2.448604, -2.741577,6.106788,2.390732, -2.685923,6.006950,2.523134, -2.589004,6.000689,2.580007, -2.583577,6.118616,2.550638, -2.491776,6.074048,2.618325, -2.474501,6.126617,2.614732, -2.474719,6.239607,2.596076, -2.513770,6.326315,2.567729, -2.187726,5.475520,3.245857, -2.186501,5.476682,3.282183, -2.942396,0.872504,2.334875, -2.617088,0.845707,2.343236, -2.789440,0.873761,2.339615, -2.820227,0.877223,2.337900, -3.054643,5.819695,2.315773, -3.155654,5.614651,2.395473, -3.293834,5.281953,2.502879, -3.330316,5.058368,2.503896, -3.317967,4.702261,2.387961, -3.181071,4.362402,2.087501, -0.345693,5.819776,2.322833, -0.246511,5.614870,2.412127, -0.109019,5.281710,2.532455, -0.074560,5.057756,2.537837, -0.088819,4.702205,2.419147, -0.224516,4.363168,2.104115, -1.580508,5.123054,-2.590227, -1.815980,5.123054,-2.590227, -1.816274,4.451208,-3.211656, -1.580214,4.451208,-3.211656, -1.580508,5.431260,-3.782909, -1.815980,5.431260,-3.782909, -1.816274,4.668951,-4.479819, -1.580214,4.668951,-4.479819, -1.815980,6.820806,-4.326971, -1.816274,5.988086,-5.080298, -1.580214,5.988086,-5.080298, -1.580508,6.820806,-4.326971, -1.580508,7.491214,-5.861439, -1.815980,7.491214,-5.861439, -1.816274,6.705720,-6.883294, -1.580214,6.705720,-6.883294, -1.580508,2.798428,-0.575424, -1.815980,2.798428,-0.575424, -1.816274,2.380740,-0.630895, -1.580214,2.380740,-0.630895, -1.580508,2.965073,-1.308278, -1.815980,2.965073,-1.308278, -1.816274,2.513136,-1.732507, -1.580214,2.513136,-1.732507, -1.580508,3.848260,-1.338163, -1.815980,3.848260,-1.338163, -1.816274,3.350998,-1.812318, -1.580214,3.350998,-1.812318, -1.580508,3.983708,-2.330358, -1.815980,3.983708,-2.330358, -1.816274,3.409934,-2.868819, -1.580214,3.409934,-2.868819, -1.801704,2.517949,-1.772559, -1.801704,3.350998,-1.812318, -1.801704,3.370322,-1.813240, -1.801704,3.409934,-2.868819, -1.801704,3.410797,-2.891809, -1.801704,4.451208,-3.211656, -1.801704,4.471087,-3.217767, -1.801704,4.668951,-4.479819, -1.801704,4.669659,-4.484341, -1.801704,5.988086,-5.080298, -1.801704,6.002525,-5.086825, -1.801704,6.705720,-6.883294, -1.801704,6.709111,-6.891956, -1.801704,8.661811,-8.041217, -1.801447,9.573938,-6.455655, -1.801447,7.494373,-5.868810, -1.801447,7.491214,-5.861439, -1.801447,6.836013,-4.332883, -1.801447,6.820806,-4.326971, -1.801447,5.432286,-3.787165, -1.801447,5.431260,-3.782909, -1.801447,5.144774,-2.594779, -1.801447,5.123054,-2.590227, -1.801447,3.986216,-2.351965, -1.801447,3.983708,-2.330358, -1.801447,3.868606,-1.338238, -1.801447,3.848260,-1.338163, -1.801447,2.971131,-1.334923, -1.596075,2.517949,-1.772559, -1.596075,3.350998,-1.812318, -1.596075,3.370322,-1.813240, -1.596075,3.409935,-2.868819, -1.596075,3.410797,-2.891809, -1.596075,4.451208,-3.211656, -1.596075,4.471087,-3.217767, -1.596075,4.668951,-4.479819, -1.596075,4.669660,-4.484341, -1.596075,5.988086,-5.080298, -1.596075,6.002526,-5.086825, -1.596075,6.705720,-6.883294, -1.596075,6.709111,-6.891956, -1.596075,8.661812,-8.041217, -1.596329,9.573938,-6.455656, -1.596329,7.494373,-5.868810, -1.596329,7.491214,-5.861440, -1.596329,6.836013,-4.332883, -1.596329,6.820807,-4.326971, -1.596329,5.432286,-3.787165, -1.596329,5.431260,-3.782909, -1.596329,5.144774,-2.594779, -1.596329,5.123054,-2.590227, -1.596329,3.986215,-2.351965, -1.596329,3.983708,-2.330358, -1.596329,3.868606,-1.338238, -1.596329,3.848260,-1.338163, -1.596329,2.971131,-1.334923, -1.580508,9.553594,-6.449914, -1.596329,9.553594,-6.449914, -1.801447,9.553594,-6.449914, -1.815980,9.553594,-6.449914, -1.816274,8.642708,-8.029973, -1.801704,8.642708,-8.029973, -1.596075,8.642709,-8.029973, -1.580214,8.642708,-8.029973, -1.801957,2.965073,-1.308278, -1.595774,2.965073,-1.308278, -1.595518,2.513136,-1.732507, -1.802215,2.513136,-1.732507, -1.580214,2.543245,-1.773766, -1.580508,2.997765,-1.335021, -1.596329,2.997765,-1.335021, -1.801447,2.997765,-1.335021, -1.815980,2.997765,-1.335021, -1.816274,2.543245,-1.773766, -1.801704,2.543245,-1.773766, -1.596075,2.543245,-1.773766, -1.580508,3.872131,-1.368616, -1.596329,3.872131,-1.368616, -1.801447,3.872131,-1.368616, -1.815980,3.872131,-1.368616, -1.816274,3.371535,-1.845561, -1.801704,3.371535,-1.845561, -1.596075,3.371536,-1.845561, -1.580214,3.371535,-1.845561, -1.580214,3.456778,-2.905944, -1.580508,4.036458,-2.362495, -1.596329,4.036458,-2.362495, -1.801447,4.036458,-2.362495, -1.815980,4.036458,-2.362495, -1.816274,3.456778,-2.905944, -1.801704,3.456778,-2.905944, -1.596075,3.456778,-2.905944, -1.580508,5.155410,-2.638890, -1.596329,5.155410,-2.638890, -1.801447,5.155410,-2.638890, -1.815980,5.155410,-2.638890, -1.816274,4.478433,-3.264623, -1.801704,4.478433,-3.264623, -1.596075,4.478433,-3.264623, -1.580214,4.478433,-3.264623, -1.580214,4.703861,-4.499801, -1.580508,5.468307,-3.801169, -1.596329,5.468307,-3.801169, -1.801447,5.468307,-3.801169, -1.815980,5.468307,-3.801169, -1.816274,4.703861,-4.499801, -1.801704,4.703861,-4.499801, -1.596075,4.703862,-4.499801, -1.580508,6.845256,-4.354446, -1.596329,6.845256,-4.354446, -1.801447,6.845256,-4.354446, -1.815980,6.845256,-4.354446, -1.816274,6.012445,-5.112168, -1.801704,6.012445,-5.112168, -1.596075,6.012446,-5.112168, -1.580214,6.012445,-5.112168, -1.580214,6.741378,-6.910947, -1.580508,7.528737,-5.878507, -1.596329,7.528737,-5.878507, -1.801447,7.528736,-5.878507, -1.815980,7.528737,-5.878507, -1.816274,6.741378,-6.910947, -1.801704,6.741378,-6.910947, -1.596075,6.741378,-6.910947, -1.580508,9.546431,-6.447893, -1.596329,9.546431,-6.447893, -1.801447,9.546431,-6.447893, -1.815980,9.546431,-6.447893, -1.816274,8.635982,-8.026014, -1.801704,8.635982,-8.026014, -1.596075,8.635983,-8.026014, -1.580214,8.635982,-8.026014, }; static GLint otherShapeIndices[] = {1,1,1,2,2,2,22,3,3,21,4,4, 2,2,2,3,5,5,23,6,6,22,3,3, 3,5,5,4,7,7,24,8,8,23,6,6, 4,7,7,5,9,9,25,10,10,24,8,8, 5,9,9,6,11,11,26,12,12,25,10,10, 6,11,11,7,13,13,27,14,14,26,12,12, 7,13,13,8,15,15,28,16,16,27,14,14, 8,15,15,9,17,17,29,18,18,28,16,16, 9,17,17,10,19,19,30,20,20,29,18,18, 10,19,19,11,21,21,31,22,22,30,20,20, 11,21,21,12,23,23,32,24,24,31,22,22, 12,23,23,13,25,25,33,26,26,32,24,24, 13,25,25,14,27,27,34,28,28,33,26,26, 14,27,27,15,29,29,35,30,30,34,28,28, 15,29,29,16,31,31,36,32,32,35,30,30, 16,31,31,17,33,33,37,34,34,36,32,32, 17,33,33,18,35,35,38,36,36,37,34,34, 18,35,35,19,37,37,39,38,38,38,36,36, 19,37,37,20,39,39,40,40,40,39,38,38, 20,39,39,1,1,1,21,4,4,40,40,40, 21,4,4,22,3,3,42,41,41,41,42,42, 22,3,3,23,6,6,43,43,43,42,41,41, 23,6,6,24,8,8,44,44,44,43,43,43, 24,8,8,25,10,10,45,45,45,44,44,44, 25,10,10,26,12,12,46,46,46,45,45,45, 26,12,12,27,14,14,47,47,47,46,46,46, 27,14,14,28,16,16,48,48,48,47,47,47, 28,16,16,29,18,18,49,49,49,48,48,48, 29,18,18,30,20,20,50,50,50,49,49,49, 30,20,20,31,22,22,51,51,51,50,50,50, 31,22,22,32,24,24,52,52,52,51,51,51, 32,24,24,33,26,26,53,53,53,52,52,52, 33,26,26,34,28,28,54,54,54,53,53,53, 34,28,28,35,30,30,55,55,55,54,54,54, 35,30,30,36,32,32,56,56,56,55,55,55, 36,32,32,37,34,34,57,57,57,56,56,56, 37,34,34,38,36,36,58,58,58,57,57,57, 38,36,36,39,38,38,59,59,59,58,58,58, 39,38,38,40,40,40,60,60,60,59,59,59, 40,40,40,21,4,4,41,42,42,60,60,60, 41,42,42,42,41,41,62,61,61,61,62,62, 42,41,41,43,43,43,63,63,63,62,61,61, 43,43,43,44,44,44,64,64,64,63,63,63, 44,44,44,45,45,45,65,65,65,64,64,64, 45,45,45,46,46,46,66,66,66,65,65,65, 46,46,46,47,47,47,67,67,67,66,66,66, 47,47,47,48,48,48,68,68,68,67,67,67, 48,48,48,49,49,49,69,69,69,68,68,68, 49,49,49,50,50,50,70,70,70,69,69,69, 50,50,50,51,51,51,71,71,71,70,70,70, 51,51,51,52,52,52,72,72,72,71,71,71, 52,52,52,53,53,53,73,73,73,72,72,72, 53,53,53,54,54,54,74,74,74,73,73,73, 54,54,54,55,55,55,75,75,75,74,74,74, 55,55,55,56,56,56,76,76,76,75,75,75, 56,56,56,57,57,57,77,77,77,76,76,76, 57,57,57,58,58,58,78,78,78,77,77,77, 58,58,58,59,59,59,79,79,79,78,78,78, 59,59,59,60,60,60,80,80,80,79,79,79, 60,60,60,41,42,42,61,62,62,80,80,80, 61,62,62,62,61,61,82,81,81,81,82,82, 62,61,61,63,63,63,83,83,83,82,81,81, 63,63,63,64,64,64,84,84,84,83,83,83, 64,64,64,65,65,65,85,85,85,84,84,84, 65,65,65,66,66,66,86,86,86,85,85,85, 66,66,66,67,67,67,87,87,87,86,86,86, 67,67,67,68,68,68,88,88,88,87,87,87, 68,68,68,69,69,69,89,89,89,88,88,88, 69,69,69,70,70,70,90,90,90,89,89,89, 70,70,70,71,71,71,91,91,91,90,90,90, 71,71,71,72,72,72,92,92,92,91,91,91, 72,72,72,73,73,73,93,93,93,92,92,92, 73,73,73,74,74,74,94,94,94,93,93,93, 74,74,74,75,75,75,95,95,95,94,94,94, 75,75,75,76,76,76,96,96,96,95,95,95, 76,76,76,77,77,77,97,97,97,96,96,96, 77,77,77,78,78,78,98,98,98,97,97,97, 78,78,78,79,79,79,99,99,99,98,98,98, 79,79,79,80,80,80,100,100,100,99,99,99, 80,80,80,61,62,62,81,82,82,100,100,100, 81,82,82,82,81,81,102,101,101,101,102,102, 82,81,81,83,83,83,103,103,103,102,101,101, 83,83,83,84,84,84,104,104,104,103,103,103, 84,84,84,85,85,85,105,105,105,104,104,104, 85,85,85,86,86,86,106,106,106,105,105,105, 86,86,86,87,87,87,107,107,107,106,106,106, 87,87,87,88,88,88,108,108,108,107,107,107, 88,88,88,89,89,89,109,109,109,108,108,108, 89,89,89,90,90,90,110,110,110,109,109,109, 90,90,90,91,91,91,111,111,111,110,110,110, 91,91,91,92,92,92,112,112,112,111,111,111, 92,92,92,93,93,93,113,113,113,112,112,112, 93,93,93,94,94,94,114,114,114,113,113,113, 94,94,94,95,95,95,115,115,115,114,114,114, 95,95,95,96,96,96,116,116,116,115,115,115, 96,96,96,97,97,97,117,117,117,116,116,116, 97,97,97,98,98,98,118,118,118,117,117,117, 98,98,98,99,99,99,119,119,119,118,118,118, 99,99,99,100,100,100,120,120,120,119,119,119, 100,100,100,81,82,82,101,102,102,120,120,120, 101,102,102,102,101,101,122,121,121,121,122,122, 102,101,101,103,103,103,123,123,123,122,121,121, 103,103,103,104,104,104,124,124,124,123,123,123, 104,104,104,105,105,105,125,125,125,124,124,124, 105,105,105,106,106,106,126,126,126,125,125,125, 106,106,106,107,107,107,127,127,127,126,126,126, 107,107,107,108,108,108,128,128,128,127,127,127, 108,108,108,109,109,109,129,129,129,128,128,128, 109,109,109,110,110,110,130,130,130,129,129,129, 110,110,110,111,111,111,131,131,131,130,130,130, 111,111,111,112,112,112,132,132,132,131,131,131, 112,112,112,113,113,113,133,133,133,132,132,132, 113,113,113,114,114,114,134,134,134,133,133,133, 114,114,114,115,115,115,135,135,135,134,134,134, 115,115,115,116,116,116,136,136,136,135,135,135, 116,116,116,117,117,117,137,137,137,136,136,136, 117,117,117,118,118,118,138,138,138,137,137,137, 118,118,118,119,119,119,139,139,139,138,138,138, 119,119,119,120,120,120,140,140,140,139,139,139, 120,120,120,101,102,102,121,122,122,140,140,140, 121,122,122,122,121,121,142,141,141,141,142,142, 122,121,121,123,123,123,143,143,143,142,141,141, 123,123,123,124,124,124,144,144,144,143,143,143, 124,124,124,125,125,125,145,145,145,144,144,144, 125,125,125,126,126,126,146,146,146,145,145,145, 126,126,126,127,127,127,147,147,147,146,146,146, 127,127,127,128,128,128,148,148,148,147,147,147, 128,128,128,129,129,129,149,149,149,148,148,148, 129,129,129,130,130,130,150,150,150,149,149,149, 130,130,130,131,131,131,151,151,151,150,150,150, 131,131,131,132,132,132,152,152,152,151,151,151, 132,132,132,133,133,133,153,153,153,152,152,152, 133,133,133,134,134,134,154,154,154,153,153,153, 134,134,134,135,135,135,155,155,155,154,154,154, 135,135,135,136,136,136,156,156,156,155,155,155, 136,136,136,137,137,137,157,157,157,156,156,156, 137,137,137,138,138,138,158,158,158,157,157,157, 138,138,138,139,139,139,159,159,159,158,158,158, 139,139,139,140,140,140,160,160,160,159,159,159, 140,140,140,121,122,122,141,142,142,160,160,160, 141,142,142,142,141,141,162,161,161,161,162,162, 142,141,141,143,143,143,163,163,163,162,161,161, 143,143,143,144,144,144,164,164,164,163,163,163, 144,144,144,145,145,145,165,165,165,164,164,164, 145,145,145,146,146,146,166,166,166,165,165,165, 146,146,146,147,147,147,167,167,167,166,166,166, 147,147,147,148,148,148,168,168,168,167,167,167, 148,148,148,149,149,149,169,169,169,168,168,168, 149,149,149,150,150,150,170,170,170,169,169,169, 150,150,150,151,151,151,171,171,171,170,170,170, 151,151,151,152,152,152,172,172,172,171,171,171, 152,152,152,153,153,153,173,173,173,172,172,172, 153,153,153,154,154,154,174,174,174,173,173,173, 154,154,154,155,155,155,175,175,175,174,174,174, 155,155,155,156,156,156,176,176,176,175,175,175, 156,156,156,157,157,157,177,177,177,176,176,176, 157,157,157,158,158,158,178,178,178,177,177,177, 158,158,158,159,159,159,179,179,179,178,178,178, 159,159,159,160,160,160,180,180,180,179,179,179, 160,160,160,141,142,142,161,162,162,180,180,180, 161,162,162,162,161,161,182,181,181,181,182,182, 162,161,161,163,163,163,183,183,183,182,181,181, 163,163,163,164,164,164,184,184,184,183,183,183, 164,164,164,165,165,165,185,185,185,184,184,184, 165,165,165,166,166,166,186,186,186,185,185,185, 166,166,166,167,167,167,187,187,187,186,186,186, 167,167,167,168,168,168,188,188,188,187,187,187, 168,168,168,169,169,169,189,189,189,188,188,188, 169,169,169,170,170,170,190,190,190,189,189,189, 170,170,170,171,171,171,191,191,191,190,190,190, 171,171,171,172,172,172,192,192,192,191,191,191, 172,172,172,173,173,173,193,193,193,192,192,192, 173,173,173,174,174,174,194,194,194,193,193,193, 174,174,174,175,175,175,195,195,195,194,194,194, 175,175,175,176,176,176,196,196,196,195,195,195, 176,176,176,177,177,177,197,197,197,196,196,196, 177,177,177,178,178,178,198,198,198,197,197,197, 178,178,178,179,179,179,199,199,199,198,198,198, 179,179,179,180,180,180,200,200,200,199,199,199, 180,180,180,161,162,162,181,182,182,200,200,200, 181,182,182,182,181,181,202,201,201,201,202,202, 182,181,181,183,183,183,203,203,203,202,201,201, 183,183,183,184,184,184,204,204,204,203,203,203, 184,184,184,185,185,185,205,205,205,204,204,204, 185,185,185,186,186,186,206,206,206,205,205,205, 186,186,186,187,187,187,207,207,207,206,206,206, 187,187,187,188,188,188,208,208,208,207,207,207, 188,188,188,189,189,189,209,209,209,208,208,208, 189,189,189,190,190,190,210,210,210,209,209,209, 190,190,190,191,191,191,211,211,211,210,210,210, 191,191,191,192,192,192,212,212,212,211,211,211, 192,192,192,193,193,193,213,213,213,212,212,212, 193,193,193,194,194,194,214,214,214,213,213,213, 194,194,194,195,195,195,215,215,215,214,214,214, 195,195,195,196,196,196,216,216,216,215,215,215, 196,196,196,197,197,197,217,217,217,216,216,216, 197,197,197,198,198,198,218,218,218,217,217,217, 198,198,198,199,199,199,219,219,219,218,218,218, 199,199,199,200,200,200,220,220,220,219,219,219, 200,200,200,181,182,182,201,202,202,220,220,220, 201,202,202,202,201,201,222,221,221,221,222,222, 202,201,201,203,203,203,223,223,223,222,221,221, 203,203,203,204,204,204,224,224,224,223,223,223, 204,204,204,205,205,205,225,225,225,224,224,224, 205,205,205,206,206,206,226,226,226,225,225,225, 206,206,206,207,207,207,227,227,227,226,226,226, 207,207,207,208,208,208,228,228,228,227,227,227, 208,208,208,209,209,209,229,229,229,228,228,228, 209,209,209,210,210,210,230,230,230,229,229,229, 210,210,210,211,211,211,231,231,231,230,230,230, 211,211,211,212,212,212,232,232,232,231,231,231, 212,212,212,213,213,213,233,233,233,232,232,232, 213,213,213,214,214,214,234,234,234,233,233,233, 214,214,214,215,215,215,235,235,235,234,234,234, 215,215,215,216,216,216,236,236,236,235,235,235, 216,216,216,217,217,217,237,237,237,236,236,236, 217,217,217,218,218,218,238,238,238,237,237,237, 218,218,218,219,219,219,239,239,239,238,238,238, 219,219,219,220,220,220,240,240,240,239,239,239, 220,220,220,201,202,202,221,222,222,240,240,240, 221,222,222,222,221,221,242,241,241,241,242,242, 222,221,221,223,223,223,243,243,243,242,241,241, 223,223,223,224,224,224,244,244,244,243,243,243, 224,224,224,225,225,225,245,245,245,244,244,244, 225,225,225,226,226,226,246,246,246,245,245,245, 226,226,226,227,227,227,247,247,247,246,246,246, 227,227,227,228,228,228,248,248,248,247,247,247, 228,228,228,229,229,229,249,249,249,248,248,248, 229,229,229,230,230,230,250,250,250,249,249,249, 230,230,230,231,231,231,251,251,251,250,250,250, 231,231,231,232,232,232,252,252,252,251,251,251, 232,232,232,233,233,233,253,253,253,252,252,252, 233,233,233,234,234,234,254,254,254,253,253,253, 234,234,234,235,235,235,255,255,255,254,254,254, 235,235,235,236,236,236,256,256,256,255,255,255, 236,236,236,237,237,237,257,257,257,256,256,256, 237,237,237,238,238,238,258,258,258,257,257,257, 238,238,238,239,239,239,259,259,259,258,258,258, 239,239,239,240,240,240,260,260,260,259,259,259, 240,240,240,221,222,222,241,242,242,260,260,260, 241,242,242,242,241,241,262,261,261,261,262,262, 242,241,241,243,243,243,263,263,263,262,261,261, 243,243,243,244,244,244,264,264,264,263,263,263, 244,244,244,245,245,245,265,265,265,264,264,264, 245,245,245,246,246,246,266,266,266,265,265,265, 246,246,246,247,247,247,267,267,267,266,266,266, 247,247,247,248,248,248,268,268,268,267,267,267, 248,248,248,249,249,249,269,269,269,268,268,268, 249,249,249,250,250,250,270,270,270,269,269,269, 250,250,250,251,251,251,271,271,271,270,270,270, 251,251,251,252,252,252,272,272,272,271,271,271, 252,252,252,253,253,253,273,273,273,272,272,272, 253,253,253,254,254,254,274,274,274,273,273,273, 254,254,254,255,255,255,275,275,275,274,274,274, 255,255,255,256,256,256,276,276,276,275,275,275, 256,256,256,257,257,257,277,277,277,276,276,276, 257,257,257,258,258,258,278,278,278,277,277,277, 258,258,258,259,259,259,279,279,279,278,278,278, 259,259,259,260,260,260,280,280,280,279,279,279, 260,260,260,241,242,242,261,262,262,280,280,280, 261,262,262,262,261,261,282,281,281,281,282,282, 262,261,261,263,263,263,283,283,283,282,281,281, 263,263,263,264,264,264,284,284,284,283,283,283, 264,264,264,265,265,265,285,285,285,284,284,284, 265,265,265,266,266,266,286,286,286,285,285,285, 266,266,266,267,267,267,287,287,287,286,286,286, 267,267,267,268,268,268,288,288,288,287,287,287, 268,268,268,269,269,269,289,289,289,288,288,288, 269,269,269,270,270,270,290,290,290,289,289,289, 270,270,270,271,271,271,291,291,291,290,290,290, 271,271,271,272,272,272,292,292,292,291,291,291, 272,272,272,273,273,273,293,293,293,292,292,292, 273,273,273,274,274,274,294,294,294,293,293,293, 274,274,274,275,275,275,295,295,295,294,294,294, 275,275,275,276,276,276,296,296,296,295,295,295, 276,276,276,277,277,277,297,297,297,296,296,296, 277,277,277,278,278,278,298,298,298,297,297,297, 278,278,278,279,279,279,299,299,299,298,298,298, 279,279,279,280,280,280,300,300,300,299,299,299, 280,280,280,261,262,262,281,282,282,300,300,300, 281,282,282,282,281,281,302,301,301,301,302,302, 282,281,281,283,283,283,303,303,303,302,301,301, 283,283,283,284,284,284,304,304,304,303,303,303, 284,284,284,285,285,285,305,305,305,304,304,304, 285,285,285,286,286,286,306,306,306,305,305,305, 286,286,286,287,287,287,307,307,307,306,306,306, 287,287,287,288,288,288,308,308,308,307,307,307, 288,288,288,289,289,289,309,309,309,308,308,308, 289,289,289,290,290,290,310,310,310,309,309,309, 290,290,290,291,291,291,311,311,311,310,310,310, 291,291,291,292,292,292,312,312,312,311,311,311, 292,292,292,293,293,293,313,313,313,312,312,312, 293,293,293,294,294,294,314,314,314,313,313,313, 294,294,294,295,295,295,315,315,315,314,314,314, 295,295,295,296,296,296,316,316,316,315,315,315, 296,296,296,297,297,297,317,317,317,316,316,316, 297,297,297,298,298,298,318,318,318,317,317,317, 298,298,298,299,299,299,319,319,319,318,318,318, 299,299,299,300,300,300,320,320,320,319,319,319, 300,300,300,281,282,282,301,302,302,320,320,320, 301,302,302,302,301,301,322,321,321,321,322,322, 302,301,301,303,303,303,323,323,323,322,321,321, 303,303,303,304,304,304,324,324,324,323,323,323, 304,304,304,305,305,305,325,325,325,324,324,324, 305,305,305,306,306,306,326,326,326,325,325,325, 306,306,306,307,307,307,327,327,327,326,326,326, 307,307,307,308,308,308,328,328,328,327,327,327, 308,308,308,309,309,309,329,329,329,328,328,328, 309,309,309,310,310,310,330,330,330,329,329,329, 310,310,310,311,311,311,331,331,331,330,330,330, 311,311,311,312,312,312,332,332,332,331,331,331, 312,312,312,313,313,313,333,333,333,332,332,332, 313,313,313,314,314,314,334,334,334,333,333,333, 314,314,314,315,315,315,335,335,335,334,334,334, 315,315,315,316,316,316,336,336,336,335,335,335, 316,316,316,317,317,317,337,337,337,336,336,336, 317,317,317,318,318,318,338,338,338,337,337,337, 318,318,318,319,319,319,339,339,339,338,338,338, 319,319,319,320,320,320,340,340,340,339,339,339, 320,320,320,301,302,302,321,322,322,340,340,340, 321,322,322,322,321,321,342,341,341,341,342,342, 322,321,321,323,323,323,343,343,343,342,341,341, 323,323,323,324,324,324,344,344,344,343,343,343, 324,324,324,325,325,325,345,345,345,344,344,344, 325,325,325,326,326,326,346,346,346,345,345,345, 326,326,326,327,327,327,347,347,347,346,346,346, 327,327,327,328,328,328,348,348,348,347,347,347, 328,328,328,329,329,329,349,349,349,348,348,348, 329,329,329,330,330,330,350,350,350,349,349,349, 330,330,330,331,331,331,351,351,351,350,350,350, 331,331,331,332,332,332,352,352,352,351,351,351, 332,332,332,333,333,333,353,353,353,352,352,352, 333,333,333,334,334,334,354,354,354,353,353,353, 334,334,334,335,335,335,355,355,355,354,354,354, 335,335,335,336,336,336,356,356,356,355,355,355, 336,336,336,337,337,337,357,357,357,356,356,356, 337,337,337,338,338,338,358,358,358,357,357,357, 338,338,338,339,339,339,359,359,359,358,358,358, 339,339,339,340,340,340,360,360,360,359,359,359, 340,340,340,321,322,322,341,342,342,360,360,360, 341,342,342,342,341,341,362,361,361,361,362,362, 342,341,341,343,343,343,363,363,363,362,361,361, 343,343,343,344,344,344,364,364,364,363,363,363, 344,344,344,345,345,345,365,365,365,364,364,364, 345,345,345,346,346,346,366,366,366,365,365,365, 346,346,346,347,347,347,367,367,367,366,366,366, 347,347,347,348,348,348,368,368,368,367,367,367, 348,348,348,349,349,349,369,369,369,368,368,368, 349,349,349,350,350,350,370,370,370,369,369,369, 350,350,350,351,351,351,371,371,371,370,370,370, 351,351,351,352,352,352,372,372,372,371,371,371, 352,352,352,353,353,353,373,373,373,372,372,372, 353,353,353,354,354,354,374,374,374,373,373,373, 354,354,354,355,355,355,375,375,375,374,374,374, 355,355,355,356,356,356,376,376,376,375,375,375, 356,356,356,357,357,357,377,377,377,376,376,376, 357,357,357,358,358,358,378,378,378,377,377,377, 358,358,358,359,359,359,379,379,379,378,378,378, 359,359,359,360,360,360,380,380,380,379,379,379, 360,360,360,341,342,342,361,362,362,380,380,380, 2,2,2,1,1,1,381,381,381, 3,5,5,2,2,2,381,381,381, 4,7,7,3,5,5,381,381,381, 5,9,9,4,7,7,381,381,381, 6,11,11,5,9,9,381,381,381, 7,13,13,6,11,11,381,381,381, 8,15,15,7,13,13,381,381,381, 9,17,17,8,15,15,381,381,381, 10,19,19,9,17,17,381,381,381, 11,21,21,10,19,19,381,381,381, 12,23,23,11,21,21,381,381,381, 13,25,25,12,23,23,381,381,381, 14,27,27,13,25,25,381,381,381, 15,29,29,14,27,27,381,381,381, 16,31,31,15,29,29,381,381,381, 17,33,33,16,31,31,381,381,381, 18,35,35,17,33,33,381,381,381, 19,37,37,18,35,35,381,381,381, 20,39,39,19,37,37,381,381,381, 1,1,1,20,39,39,381,381,381, 361,362,362,362,361,361,382,382,382, 362,361,361,363,363,363,382,382,382, 363,363,363,364,364,364,382,382,382, 364,364,364,365,365,365,382,382,382, 365,365,365,366,366,366,382,382,382, 366,366,366,367,367,367,382,382,382, 367,367,367,368,368,368,382,382,382, 368,368,368,369,369,369,382,382,382, 369,369,369,370,370,370,382,382,382, 370,370,370,371,371,371,382,382,382, 371,371,371,372,372,372,382,382,382, 372,372,372,373,373,373,382,382,382, 373,373,373,374,374,374,382,382,382, 374,374,374,375,375,375,382,382,382, 375,375,375,376,376,376,382,382,382, 376,376,376,377,377,377,382,382,382, 377,377,377,378,378,378,382,382,382, 378,378,378,379,379,379,382,382,382, 379,379,379,380,380,380,382,382,382, 380,380,380,361,362,362,382,382,382, 383,383,383,384,384,384,404,385,385,403,386,386, 384,384,384,385,387,387,405,388,388,404,385,385, 385,387,387,386,389,389,406,390,390,405,388,388, 386,389,389,387,391,391,407,392,392,406,390,390, 387,391,391,388,393,393,408,394,394,407,392,392, 388,393,393,389,395,395,409,396,396,408,394,394, 389,395,395,390,397,397,410,398,398,409,396,396, 390,397,397,391,399,399,411,400,400,410,398,398, 391,399,399,392,401,401,412,402,402,411,400,400, 392,401,401,393,403,403,413,404,404,412,402,402, 393,403,403,394,405,405,414,406,406,413,404,404, 394,405,405,395,407,407,415,408,408,414,406,406, 395,407,407,396,409,409,416,410,410,415,408,408, 396,409,409,397,411,411,417,412,412,416,410,410, 397,411,411,398,413,413,418,414,414,417,412,412, 398,413,413,399,415,415,419,416,416,418,414,414, 399,415,415,400,417,417,420,418,418,419,416,416, 400,417,417,401,419,419,421,420,420,420,418,418, 401,419,419,402,421,421,422,422,422,421,420,420, 402,421,421,383,383,383,403,386,386,422,422,422, 403,386,386,404,385,385,424,423,423,423,424,424, 404,385,385,405,388,388,425,425,425,424,423,423, 405,388,388,406,390,390,426,426,426,425,425,425, 406,390,390,407,392,392,427,427,427,426,426,426, 407,392,392,408,394,394,428,428,428,427,427,427, 408,394,394,409,396,396,429,429,429,428,428,428, 409,396,396,410,398,398,430,430,430,429,429,429, 410,398,398,411,400,400,431,431,431,430,430,430, 411,400,400,412,402,402,432,432,432,431,431,431, 412,402,402,413,404,404,433,433,433,432,432,432, 413,404,404,414,406,406,434,434,434,433,433,433, 414,406,406,415,408,408,435,435,435,434,434,434, 415,408,408,416,410,410,436,436,436,435,435,435, 416,410,410,417,412,412,437,437,437,436,436,436, 417,412,412,418,414,414,438,438,438,437,437,437, 418,414,414,419,416,416,439,439,439,438,438,438, 419,416,416,420,418,418,440,440,440,439,439,439, 420,418,418,421,420,420,441,441,441,440,440,440, 421,420,420,422,422,422,442,442,442,441,441,441, 422,422,422,403,386,386,423,424,424,442,442,442, 423,424,424,424,423,423,444,443,443,443,444,444, 424,423,423,425,425,425,445,445,445,444,443,443, 425,425,425,426,426,426,446,446,446,445,445,445, 426,426,426,427,427,427,447,447,447,446,446,446, 427,427,427,428,428,428,448,448,448,447,447,447, 428,428,428,429,429,429,449,449,449,448,448,448, 429,429,429,430,430,430,450,450,450,449,449,449, 430,430,430,431,431,431,451,451,451,450,450,450, 431,431,431,432,432,432,452,452,452,451,451,451, 432,432,432,433,433,433,453,453,453,452,452,452, 433,433,433,434,434,434,454,454,454,453,453,453, 434,434,434,435,435,435,455,455,455,454,454,454, 435,435,435,436,436,436,456,456,456,455,455,455, 436,436,436,437,437,437,457,457,457,456,456,456, 437,437,437,438,438,438,458,458,458,457,457,457, 438,438,438,439,439,439,459,459,459,458,458,458, 439,439,439,440,440,440,460,460,460,459,459,459, 440,440,440,441,441,441,461,461,461,460,460,460, 441,441,441,442,442,442,462,462,462,461,461,461, 442,442,442,423,424,424,443,444,444,462,462,462, 443,444,444,444,443,443,464,463,463,463,464,464, 444,443,443,445,445,445,465,465,465,464,463,463, 445,445,445,446,446,446,466,466,466,465,465,465, 446,446,446,447,447,447,467,467,467,466,466,466, 447,447,447,448,448,448,468,468,468,467,467,467, 448,448,448,449,449,449,469,469,469,468,468,468, 449,449,449,450,450,450,470,470,470,469,469,469, 450,450,450,451,451,451,471,471,471,470,470,470, 451,451,451,452,452,452,472,472,472,471,471,471, 452,452,452,453,453,453,473,473,473,472,472,472, 453,453,453,454,454,454,474,474,474,473,473,473, 454,454,454,455,455,455,475,475,475,474,474,474, 455,455,455,456,456,456,476,476,476,475,475,475, 456,456,456,457,457,457,477,477,477,476,476,476, 457,457,457,458,458,458,478,478,478,477,477,477, 458,458,458,459,459,459,479,479,479,478,478,478, 459,459,459,460,460,460,480,480,480,479,479,479, 460,460,460,461,461,461,481,481,481,480,480,480, 461,461,461,462,462,462,482,482,482,481,481,481, 462,462,462,443,444,444,463,464,464,482,482,482, 463,464,464,464,463,463,484,483,483,483,484,484, 464,463,463,465,465,465,485,485,485,484,483,483, 465,465,465,466,466,466,486,486,486,485,485,485, 466,466,466,467,467,467,487,487,487,486,486,486, 467,467,467,468,468,468,488,488,488,487,487,487, 468,468,468,469,469,469,489,489,489,488,488,488, 469,469,469,470,470,470,490,490,490,489,489,489, 470,470,470,471,471,471,491,491,491,490,490,490, 471,471,471,472,472,472,492,492,492,491,491,491, 472,472,472,473,473,473,493,493,493,492,492,492, 473,473,473,474,474,474,494,494,494,493,493,493, 474,474,474,475,475,475,495,495,495,494,494,494, 475,475,475,476,476,476,496,496,496,495,495,495, 476,476,476,477,477,477,497,497,497,496,496,496, 477,477,477,478,478,478,498,498,498,497,497,497, 478,478,478,479,479,479,499,499,499,498,498,498, 479,479,479,480,480,480,500,500,500,499,499,499, 480,480,480,481,481,481,501,501,501,500,500,500, 481,481,481,482,482,482,502,502,502,501,501,501, 482,482,482,463,464,464,483,484,484,502,502,502, 483,484,484,484,483,483,504,503,503,503,504,504, 484,483,483,485,485,485,505,505,505,504,503,503, 485,485,485,486,486,486,506,506,506,505,505,505, 486,486,486,487,487,487,507,507,507,506,506,506, 487,487,487,488,488,488,508,508,508,507,507,507, 488,488,488,489,489,489,509,509,509,508,508,508, 489,489,489,490,490,490,510,510,510,509,509,509, 490,490,490,491,491,491,511,511,511,510,510,510, 491,491,491,492,492,492,512,512,512,511,511,511, 492,492,492,493,493,493,513,513,513,512,512,512, 493,493,493,494,494,494,514,514,514,513,513,513, 494,494,494,495,495,495,515,515,515,514,514,514, 495,495,495,496,496,496,516,516,516,515,515,515, 496,496,496,497,497,497,517,517,517,516,516,516, 497,497,497,498,498,498,518,518,518,517,517,517, 498,498,498,499,499,499,519,519,519,518,518,518, 499,499,499,500,500,500,520,520,520,519,519,519, 500,500,500,501,501,501,521,521,521,520,520,520, 501,501,501,502,502,502,522,522,522,521,521,521, 502,502,502,483,484,484,503,504,504,522,522,522, 503,504,504,504,503,503,524,523,523,523,524,524, 504,503,503,505,505,505,525,525,525,524,523,523, 505,505,505,506,506,506,526,526,526,525,525,525, 506,506,506,507,507,507,527,527,527,526,526,526, 507,507,507,508,508,508,528,528,528,527,527,527, 508,508,508,509,509,509,529,529,529,528,528,528, 509,509,509,510,510,510,530,530,530,529,529,529, 510,510,510,511,511,511,531,531,531,530,530,530, 511,511,511,512,512,512,532,532,532,531,531,531, 512,512,512,513,513,513,533,533,533,532,532,532, 513,513,513,514,514,514,534,534,534,533,533,533, 514,514,514,515,515,515,535,535,535,534,534,534, 515,515,515,516,516,516,536,536,536,535,535,535, 516,516,516,517,517,517,537,537,537,536,536,536, 517,517,517,518,518,518,538,538,538,537,537,537, 518,518,518,519,519,519,539,539,539,538,538,538, 519,519,519,520,520,520,540,540,540,539,539,539, 520,520,520,521,521,521,541,541,541,540,540,540, 521,521,521,522,522,522,542,542,542,541,541,541, 522,522,522,503,504,504,523,524,524,542,542,542, 523,524,524,524,523,523,544,543,543,543,544,544, 524,523,523,525,525,525,545,545,545,544,543,543, 525,525,525,526,526,526,546,546,546,545,545,545, 526,526,526,527,527,527,547,547,547,546,546,546, 527,527,527,528,528,528,548,548,548,547,547,547, 528,528,528,529,529,529,549,549,549,548,548,548, 529,529,529,530,530,530,550,550,550,549,549,549, 530,530,530,531,531,531,551,551,551,550,550,550, 531,531,531,532,532,532,552,552,552,551,551,551, 532,532,532,533,533,533,553,553,553,552,552,552, 533,533,533,534,534,534,554,554,554,553,553,553, 534,534,534,535,535,535,555,555,555,554,554,554, 535,535,535,536,536,536,556,556,556,555,555,555, 536,536,536,537,537,537,557,557,557,556,556,556, 537,537,537,538,538,538,558,558,558,557,557,557, 538,538,538,539,539,539,559,559,559,558,558,558, 539,539,539,540,540,540,560,560,560,559,559,559, 540,540,540,541,541,541,561,561,561,560,560,560, 541,541,541,542,542,542,562,562,562,561,561,561, 542,542,542,523,524,524,543,544,544,562,562,562, 543,544,544,544,543,543,564,563,563,563,564,564, 544,543,543,545,545,545,565,565,565,564,563,563, 545,545,545,546,546,546,566,566,566,565,565,565, 546,546,546,547,547,547,567,567,567,566,566,566, 547,547,547,548,548,548,568,568,568,567,567,567, 548,548,548,549,549,549,569,569,569,568,568,568, 549,549,549,550,550,550,570,570,570,569,569,569, 550,550,550,551,551,551,571,571,571,570,570,570, 551,551,551,552,552,552,572,572,572,571,571,571, 552,552,552,553,553,553,573,573,573,572,572,572, 553,553,553,554,554,554,574,574,574,573,573,573, 554,554,554,555,555,555,575,575,575,574,574,574, 555,555,555,556,556,556,576,576,576,575,575,575, 556,556,556,557,557,557,577,577,577,576,576,576, 557,557,557,558,558,558,578,578,578,577,577,577, 558,558,558,559,559,559,579,579,579,578,578,578, 559,559,559,560,560,560,580,580,580,579,579,579, 560,560,560,561,561,561,581,581,581,580,580,580, 561,561,561,562,562,562,582,582,582,581,581,581, 562,562,562,543,544,544,563,564,564,582,582,582, 563,564,564,564,563,563,584,583,583,583,584,584, 564,563,563,565,565,565,585,585,585,584,583,583, 565,565,565,566,566,566,586,586,586,585,585,585, 566,566,566,567,567,567,587,587,587,586,586,586, 567,567,567,568,568,568,588,588,588,587,587,587, 568,568,568,569,569,569,589,589,589,588,588,588, 569,569,569,570,570,570,590,590,590,589,589,589, 570,570,570,571,571,571,591,591,591,590,590,590, 571,571,571,572,572,572,592,592,592,591,591,591, 572,572,572,573,573,573,593,593,593,592,592,592, 573,573,573,574,574,574,594,594,594,593,593,593, 574,574,574,575,575,575,595,595,595,594,594,594, 575,575,575,576,576,576,596,596,596,595,595,595, 576,576,576,577,577,577,597,597,597,596,596,596, 577,577,577,578,578,578,598,598,598,597,597,597, 578,578,578,579,579,579,599,599,599,598,598,598, 579,579,579,580,580,580,600,600,600,599,599,599, 580,580,580,581,581,581,601,601,601,600,600,600, 581,581,581,582,582,582,602,602,602,601,601,601, 582,582,582,563,564,564,583,584,584,602,602,602, 583,584,584,584,583,583,604,603,603,603,604,604, 584,583,583,585,585,585,605,605,605,604,603,603, 585,585,585,586,586,586,606,606,606,605,605,605, 586,586,586,587,587,587,607,607,607,606,606,606, 587,587,587,588,588,588,608,608,608,607,607,607, 588,588,588,589,589,589,609,609,609,608,608,608, 589,589,589,590,590,590,610,610,610,609,609,609, 590,590,590,591,591,591,611,611,611,610,610,610, 591,591,591,592,592,592,612,612,612,611,611,611, 592,592,592,593,593,593,613,613,613,612,612,612, 593,593,593,594,594,594,614,614,614,613,613,613, 594,594,594,595,595,595,615,615,615,614,614,614, 595,595,595,596,596,596,616,616,616,615,615,615, 596,596,596,597,597,597,617,617,617,616,616,616, 597,597,597,598,598,598,618,618,618,617,617,617, 598,598,598,599,599,599,619,619,619,618,618,618, 599,599,599,600,600,600,620,620,620,619,619,619, 600,600,600,601,601,601,621,621,621,620,620,620, 601,601,601,602,602,602,622,622,622,621,621,621, 602,602,602,583,584,584,603,604,604,622,622,622, 603,604,604,604,603,603,624,623,623,623,624,624, 604,603,603,605,605,605,625,625,625,624,623,623, 605,605,605,606,606,606,626,626,626,625,625,625, 606,606,606,607,607,607,627,627,627,626,626,626, 607,607,607,608,608,608,628,628,628,627,627,627, 608,608,608,609,609,609,629,629,629,628,628,628, 609,609,609,610,610,610,630,630,630,629,629,629, 610,610,610,611,611,611,631,631,631,630,630,630, 611,611,611,612,612,612,632,632,632,631,631,631, 612,612,612,613,613,613,633,633,633,632,632,632, 613,613,613,614,614,614,634,634,634,633,633,633, 614,614,614,615,615,615,635,635,635,634,634,634, 615,615,615,616,616,616,636,636,636,635,635,635, 616,616,616,617,617,617,637,637,637,636,636,636, 617,617,617,618,618,618,638,638,638,637,637,637, 618,618,618,619,619,619,639,639,639,638,638,638, 619,619,619,620,620,620,640,640,640,639,639,639, 620,620,620,621,621,621,641,641,641,640,640,640, 621,621,621,622,622,622,642,642,642,641,641,641, 622,622,622,603,604,604,623,624,624,642,642,642, 623,624,624,624,623,623,644,643,643,643,644,644, 624,623,623,625,625,625,645,645,645,644,643,643, 625,625,625,626,626,626,646,646,646,645,645,645, 626,626,626,627,627,627,647,647,647,646,646,646, 627,627,627,628,628,628,648,648,648,647,647,647, 628,628,628,629,629,629,649,649,649,648,648,648, 629,629,629,630,630,630,650,650,650,649,649,649, 630,630,630,631,631,631,651,651,651,650,650,650, 631,631,631,632,632,632,652,652,652,651,651,651, 632,632,632,633,633,633,653,653,653,652,652,652, 633,633,633,634,634,634,654,654,654,653,653,653, 634,634,634,635,635,635,655,655,655,654,654,654, 635,635,635,636,636,636,656,656,656,655,655,655, 636,636,636,637,637,637,657,657,657,656,656,656, 637,637,637,638,638,638,658,658,658,657,657,657, 638,638,638,639,639,639,659,659,659,658,658,658, 639,639,639,640,640,640,660,660,660,659,659,659, 640,640,640,641,641,641,661,661,661,660,660,660, 641,641,641,642,642,642,662,662,662,661,661,661, 642,642,642,623,624,624,643,644,644,662,662,662, 643,644,644,644,643,643,664,663,663,663,664,664, 644,643,643,645,645,645,665,665,665,664,663,663, 645,645,645,646,646,646,666,666,666,665,665,665, 646,646,646,647,647,647,667,667,667,666,666,666, 647,647,647,648,648,648,668,668,668,667,667,667, 648,648,648,649,649,649,669,669,669,668,668,668, 649,649,649,650,650,650,670,670,670,669,669,669, 650,650,650,651,651,651,671,671,671,670,670,670, 651,651,651,652,652,652,672,672,672,671,671,671, 652,652,652,653,653,653,673,673,673,672,672,672, 653,653,653,654,654,654,674,674,674,673,673,673, 654,654,654,655,655,655,675,675,675,674,674,674, 655,655,655,656,656,656,676,676,676,675,675,675, 656,656,656,657,657,657,677,677,677,676,676,676, 657,657,657,658,658,658,678,678,678,677,677,677, 658,658,658,659,659,659,679,679,679,678,678,678, 659,659,659,660,660,660,680,680,680,679,679,679, 660,660,660,661,661,661,681,681,681,680,680,680, 661,661,661,662,662,662,682,682,682,681,681,681, 662,662,662,643,644,644,663,664,664,682,682,682, 663,664,664,664,663,663,684,683,683,683,684,684, 664,663,663,665,665,665,685,685,685,684,683,683, 665,665,665,666,666,666,686,686,686,685,685,685, 666,666,666,667,667,667,687,687,687,686,686,686, 667,667,667,668,668,668,688,688,688,687,687,687, 668,668,668,669,669,669,689,689,689,688,688,688, 669,669,669,670,670,670,690,690,690,689,689,689, 670,670,670,671,671,671,691,691,691,690,690,690, 671,671,671,672,672,672,692,692,692,691,691,691, 672,672,672,673,673,673,693,693,693,692,692,692, 673,673,673,674,674,674,694,694,694,693,693,693, 674,674,674,675,675,675,695,695,695,694,694,694, 675,675,675,676,676,676,696,696,696,695,695,695, 676,676,676,677,677,677,697,697,697,696,696,696, 677,677,677,678,678,678,698,698,698,697,697,697, 678,678,678,679,679,679,699,699,699,698,698,698, 679,679,679,680,680,680,700,700,700,699,699,699, 680,680,680,681,681,681,701,701,701,700,700,700, 681,681,681,682,682,682,702,702,702,701,701,701, 682,682,682,663,664,664,683,684,684,702,702,702, 683,684,684,684,683,683,704,703,703,703,704,704, 684,683,683,685,685,685,705,705,705,704,703,703, 685,685,685,686,686,686,706,706,706,705,705,705, 686,686,686,687,687,687,707,707,707,706,706,706, 687,687,687,688,688,688,708,708,708,707,707,707, 688,688,688,689,689,689,709,709,709,708,708,708, 689,689,689,690,690,690,710,710,710,709,709,709, 690,690,690,691,691,691,711,711,711,710,710,710, 691,691,691,692,692,692,712,712,712,711,711,711, 692,692,692,693,693,693,713,713,713,712,712,712, 693,693,693,694,694,694,714,714,714,713,713,713, 694,694,694,695,695,695,715,715,715,714,714,714, 695,695,695,696,696,696,716,716,716,715,715,715, 696,696,696,697,697,697,717,717,717,716,716,716, 697,697,697,698,698,698,718,718,718,717,717,717, 698,698,698,699,699,699,719,719,719,718,718,718, 699,699,699,700,700,700,720,720,720,719,719,719, 700,700,700,701,701,701,721,721,721,720,720,720, 701,701,701,702,702,702,722,722,722,721,721,721, 702,702,702,683,684,684,703,704,704,722,722,722, 703,704,704,704,703,703,724,723,723,723,724,724, 704,703,703,705,705,705,725,725,725,724,723,723, 705,705,705,706,706,706,726,726,726,725,725,725, 706,706,706,707,707,707,727,727,727,726,726,726, 707,707,707,708,708,708,728,728,728,727,727,727, 708,708,708,709,709,709,729,729,729,728,728,728, 709,709,709,710,710,710,730,730,730,729,729,729, 710,710,710,711,711,711,731,731,731,730,730,730, 711,711,711,712,712,712,732,732,732,731,731,731, 712,712,712,713,713,713,733,733,733,732,732,732, 713,713,713,714,714,714,734,734,734,733,733,733, 714,714,714,715,715,715,735,735,735,734,734,734, 715,715,715,716,716,716,736,736,736,735,735,735, 716,716,716,717,717,717,737,737,737,736,736,736, 717,717,717,718,718,718,738,738,738,737,737,737, 718,718,718,719,719,719,739,739,739,738,738,738, 719,719,719,720,720,720,740,740,740,739,739,739, 720,720,720,721,721,721,741,741,741,740,740,740, 721,721,721,722,722,722,742,742,742,741,741,741, 722,722,722,703,704,704,723,724,724,742,742,742, 723,724,724,724,723,723,744,743,743,743,744,744, 724,723,723,725,725,725,745,745,745,744,743,743, 725,725,725,726,726,726,746,746,746,745,745,745, 726,726,726,727,727,727,747,747,747,746,746,746, 727,727,727,728,728,728,748,748,748,747,747,747, 728,728,728,729,729,729,749,749,749,748,748,748, 729,729,729,730,730,730,750,750,750,749,749,749, 730,730,730,731,731,731,751,751,751,750,750,750, 731,731,731,732,732,732,752,752,752,751,751,751, 732,732,732,733,733,733,753,753,753,752,752,752, 733,733,733,734,734,734,754,754,754,753,753,753, 734,734,734,735,735,735,755,755,755,754,754,754, 735,735,735,736,736,736,756,756,756,755,755,755, 736,736,736,737,737,737,757,757,757,756,756,756, 737,737,737,738,738,738,758,758,758,757,757,757, 738,738,738,739,739,739,759,759,759,758,758,758, 739,739,739,740,740,740,760,760,760,759,759,759, 740,740,740,741,741,741,761,761,761,760,760,760, 741,741,741,742,742,742,762,762,762,761,761,761, 742,742,742,723,724,724,743,744,744,762,762,762, 384,384,384,383,383,383,763,763,763, 385,387,387,384,384,384,763,763,763, 386,389,389,385,387,387,763,763,763, 387,391,391,386,389,389,763,763,763, 388,393,393,387,391,391,763,763,763, 389,395,395,388,393,393,763,763,763, 390,397,397,389,395,395,763,763,763, 391,399,399,390,397,397,763,763,763, 392,401,401,391,399,399,763,763,763, 393,403,403,392,401,401,763,763,763, 394,405,405,393,403,403,763,763,763, 395,407,407,394,405,405,763,763,763, 396,409,409,395,407,407,763,763,763, 397,411,411,396,409,409,763,763,763, 398,413,413,397,411,411,763,763,763, 399,415,415,398,413,413,763,763,763, 400,417,417,399,415,415,763,763,763, 401,419,419,400,417,417,763,763,763, 402,421,421,401,419,419,763,763,763, 383,383,383,402,421,421,763,763,763, 743,744,744,744,743,743,764,764,764, 744,743,743,745,745,745,764,764,764, 745,745,745,746,746,746,764,764,764, 746,746,746,747,747,747,764,764,764, 747,747,747,748,748,748,764,764,764, 748,748,748,749,749,749,764,764,764, 749,749,749,750,750,750,764,764,764, 750,750,750,751,751,751,764,764,764, 751,751,751,752,752,752,764,764,764, 752,752,752,753,753,753,764,764,764, 753,753,753,754,754,754,764,764,764, 754,754,754,755,755,755,764,764,764, 755,755,755,756,756,756,764,764,764, 756,756,756,757,757,757,764,764,764, 757,757,757,758,758,758,764,764,764, 758,758,758,759,759,759,764,764,764, 759,759,759,760,760,760,764,764,764, 760,760,760,761,761,761,764,764,764, 761,761,761,762,762,762,764,764,764, 762,762,762,743,744,744,764,764,764, 851,862,765,852,765,766,765,766,767,791,858,768, 1289,770,769,864,772,770,1103,783,771, 791,858,768,765,766,767,868,789,772,869,859,773, 832,790,774,833,791,775,822,793,776, 1207,794,777,897,795,778,898,809,779,1206,810,780, 842,839,781,807,807,782,849,846,783,850,847,784, 870,866,785,871,867,786,807,807,782,842,839,781, 928,922,787,781,780,788,800,800,789,927,921,790, 799,799,791,800,800,789,824,823,792, 1957,813,793,1958,814,794,867,815,795,829,816,796, 853,817,797,1956,820,798,1957,813,793,829,816,796, 893,889,799,894,890,800,819,819,801,845,842,802, 820,864,803,821,821,804,891,822,805,892,865,806, 832,790,774,1314,827,807,1315,828,808,890,829,809, 839,836,810,804,804,811,805,805,812,840,837,813, 1175,1180,814,1259,1269,815,1260,1270,816,1198,1204,817, 796,796,818,797,797,819,826,825,820,827,826,821, 838,835,822,803,803,823,1008,1011,824,1009,1012,825, 1192,1198,826,1189,1195,827,1244,1254,828,1245,1255,829, 1022,1025,830,798,798,831,825,824,832,1021,1024,833, 1063,1066,834,1064,1067,835,882,878,836,883,879,837, 929,923,838,885,881,839,1060,1063,840,1061,1064,841, 887,883,842,1058,1061,843,1059,1062,844,886,882,845, 840,837,813,805,805,812,806,806,846,841,838,847, 790,851,848,766,830,849,784,831,850,789,855,851, 1959,848,852,827,849,821,828,850,853, 787,786,854,801,801,855,836,833,856,837,834,857, 884,880,858,1062,1065,859,1063,1066,834,883,879,837, 1014,1017,860,965,967,861,967,968,862,1013,1016,863, 969,971,864,1263,1273,865,968,969,866,970,970,867, 790,851,848,789,855,851,840,856,813,841,857,847, 791,858,768,869,859,773,870,860,785,842,861,781, 851,862,765,791,858,768,842,861,781,850,863,784, 820,864,803,892,865,806,893,885,799,845,886,802, 845,886,802,846,887,868,809,888,869,820,864,803, 822,793,776,833,791,775,834,892,870,823,893,871, 823,893,871,1313,894,872,1314,827,807,822,793,776, 855,895,873,772,896,874,794,897,875,854,898,876, 865,899,877,866,900,878,794,897,875,772,896,874, 771,901,879,785,902,880,796,903,818,795,904,881, 785,784,880,776,775,882,797,797,819,796,796,818, 1023,1026,883,779,778,884,798,798,831,1022,1025,830, 888,884,885,1057,1060,886,1058,1061,843,887,883,842, 770,769,887,1173,1179,888,799,799,791,782,781,889, 1166,1172,890,1167,1173,891,1039,1042,892,1040,1043,893, 1164,1170,894,1165,1171,895,1043,1046,896,1044,1047,897, 882,878,836,1064,1067,835,1065,1068,898,881,877,899, 1008,1011,824,803,803,823,777,776,900,1007,1010,901, 805,805,812,804,804,811,775,773,902,783,782,903, 806,806,846,805,805,812,783,782,903,769,768,904, 807,807,782,871,867,786,872,868,905,768,767,906, 849,846,783,807,807,782,768,767,906,848,845,907, 819,819,801,894,890,800,895,891,908,818,818,909, 847,905,910,793,906,911,809,888,869,846,887,868, 1208,907,912,900,908,913,897,795,778,1207,794,777, 857,853,914,812,812,915,811,811,916,856,852,917, 812,812,915,857,853,914,858,854,918,843,840,919, 859,909,920,813,910,921,843,911,919,858,912,918, 859,909,920,860,913,922,814,914,923,813,910,921, 861,915,924,1954,916,925,1955,917,926,830,918,927, 1323,919,928,815,927,929,862,928,930, 846,843,868,819,819,801,818,818,909,847,844,910, 1167,1173,891,1168,1174,931,1068,1071,932,1039,1042,892, 800,800,789,781,780,788,824,823,792, 885,881,839,886,882,845,1059,1062,844,1060,1063,840, 1016,1019,933,1017,1020,934,972,973,935,1243,1253,936, 960,964,937,973,974,938,971,972,939,1258,1268,940, 766,830,849,828,850,853,827,849,821,784,831,850, 765,766,767,829,816,796,867,815,795,868,789,772, 852,765,766,853,817,797,829,816,796,765,766,767, 860,913,922,861,915,924,830,918,927,814,914,923, 832,790,774,890,829,809,891,822,805,821,821,804, 810,929,941,833,791,775,832,790,774,821,821,804, 834,892,870,833,791,775,810,929,941,767,930,942, 780,779,943,802,802,944,1162,1168,945,835,832,946, 836,833,856,802,802,944,837,834,857, 846,843,868,845,842,802,819,819,801, 812,812,915,849,846,783,848,845,907,811,811,916, 849,846,783,812,812,915,843,840,919,850,847,784, 813,910,921,851,862,765,850,863,784,843,911,919, 813,910,921,814,914,923,852,765,766,851,862,765, 814,914,923,830,918,927,853,817,797,852,765,766, 1955,917,926,1956,820,798,853,817,797,830,918,927, 816,931,947,1291,932,948,815,927,929, 808,808,949,857,853,914,856,852,917,773,771,950, 857,853,914,808,808,949,844,841,951,858,854,918, 792,933,952,859,909,920,858,912,918,844,934,951, 792,933,952,774,935,953,860,913,922,859,909,920, 774,935,953,831,936,954,861,915,924,860,913,922, 831,936,954,1316,937,955,1954,916,925,861,915,924, 1317,938,956,1320,939,957,1323,919,928,862,928,930, 865,899,877,771,901,879,795,904,881,866,900,878, 1958,814,794,1959,848,852,828,850,853,867,815,795, 868,789,772,867,815,795,828,850,853,766,830,849, 868,789,772,766,830,849,790,851,848,869,859,773, 870,860,785,869,859,773,790,851,848,841,857,847, 841,838,847,806,806,846,871,867,786,870,866,785, 872,868,905,871,867,786,806,806,846,769,768,904, 803,803,823,874,870,958,873,869,959,777,776,900, 875,871,960,874,870,958,803,803,823,838,835,822, 788,787,961,876,872,962,875,871,960,838,835,822, 931,925,963,778,777,964,877,873,965,930,924,966, 778,777,964,825,824,832,878,874,967,877,873,965, 798,798,831,879,875,968,878,874,967,825,824,832, 779,778,884,880,876,969,879,875,968,798,798,831, 874,870,958,882,878,836,881,877,899,873,869,959, 883,879,837,882,878,836,874,870,958,875,871,960, 876,872,962,884,880,858,883,879,837,875,871,960, 930,924,966,877,873,965,885,881,839,929,923,838, 877,873,965,878,874,967,886,882,845,885,881,839, 879,875,968,887,883,842,886,882,845,878,874,967, 880,876,969,888,884,885,887,883,842,879,875,968, 1313,894,872,889,940,970,1325,941,971, 890,829,809,1315,828,808,1321,942,972, 891,822,805,890,829,809,831,936,954,774,935,953, 891,822,805,774,935,953,792,933,952,892,865,806, 893,885,799,892,865,806,792,933,952,844,934,951, 844,841,951,808,808,949,894,890,800,893,889,799, 895,891,908,894,890,800,808,808,949,773,771,950, 810,929,973,821,821,974,952,943,975,953,944,976, 951,1222,977,820,864,978,958,947,979, 820,864,980,809,888,981,957,946,982,958,947,983, 1214,949,984,767,930,985,954,948,986, 767,930,987,810,929,973,953,944,976,954,948,988, 809,888,981,793,906,989,956,950,990,957,946,982, 903,951,991,902,952,992,898,809,993,897,795,994, 904,953,995,903,951,991,897,795,994,900,908,996, 1209,954,997,904,953,998,900,908,999,1208,907,1000, 906,955,1001,905,956,1002,901,957,1003,896,958,1004, 907,959,1005,906,955,1001,896,958,1004,899,960,1006, 902,952,1007,1205,961,1008,1206,810,1009,898,809,1010, 909,962,1011,908,977,1012,902,952,992,903,951,991, 910,1001,1013,909,962,1011,903,951,991,904,953,995, 1210,1002,1014,910,1001,1015,904,953,998,1209,954,997, 912,1105,1016,911,1106,1017,905,956,1002,906,955,1001, 913,1107,1018,912,1105,1016,906,955,1001,907,959,1005, 908,977,1019,1204,1108,1020,1205,961,1008,902,952,1007, 915,1109,1021,914,1110,1022,908,977,1012,909,962,1011, 916,1111,1023,915,1109,1021,909,962,1011,910,1001,1013, 1211,1112,1024,916,1111,1025,910,1001,1015,1210,1002,1014, 918,1113,1026,917,1114,1027,911,1106,1017,912,1105,1016, 919,1115,1028,918,1113,1026,912,1105,1016,913,1107,1018, 914,1110,1029,1203,1116,1030,1204,1108,1020,908,977,1019, 921,1206,1031,920,1207,1032,950,1208,1033,943,1209,1034, 922,1210,1035,921,1206,1031,943,1209,1034,944,1211,1036, 1213,1212,1037,922,1210,1038,944,1211,1039,1212,1213,1040, 924,1214,1041,923,1215,1042,946,1216,1043,947,1217,1044, 925,1218,1045,924,1214,1041,947,1217,1044,948,1219,1046, 920,1207,1047,1201,1220,1048,1202,1221,1049,950,1208,1050, 1165,1171,895,1166,1172,890,1040,1043,893,1043,1046,896, 928,922,787,927,921,790,801,801,855,787,786,854, 929,923,838,1061,1064,841,1062,1065,859,884,880,858, 930,924,966,929,923,838,884,880,858,876,872,962, 931,925,963,930,924,966,876,872,962,788,787,961, 1015,1018,1051,1247,1257,1052,965,967,861,1014,1017,860, 962,963,1053,1262,1272,1054,1263,1273,865,969,971,864, 949,1223,1055,932,1224,1056,925,1218,1057,948,1219,1058, 934,1287,1059,933,1288,1060,919,1115,1061,913,1107,1062, 935,1289,1063,934,1287,1059,913,1107,1062,907,959,1064, 936,1290,1065,935,1289,1063,907,959,1064,899,960,1066, 896,958,1067,937,1291,1068,936,1290,1069,899,960,1070, 901,957,1071,938,1292,1072,937,1291,1068,896,958,1067, 905,956,1073,939,1293,1074,938,1292,1075,901,957,1076, 911,1106,1077,940,1294,1078,939,1293,1074,905,956,1073, 917,1114,1079,941,1295,1080,940,1294,1078,911,1106,1077, 923,1215,1081,942,1296,1082,945,1297,1083,946,1216,1084, 944,1211,1036,943,1209,1034,915,1109,1021,916,1111,1023, 1212,1213,1040,944,1211,1039,916,1111,1025,1211,1112,1024, 946,1216,1084,945,1297,1083,941,1295,1080,917,1114,1079, 947,1217,1044,946,1216,1043,917,1114,1027,918,1113,1026, 948,1219,1046,947,1217,1044,918,1113,1026,919,1115,1028, 933,1288,1060,949,1223,1055,948,1219,1058,919,1115,1061, 950,1208,1050,1202,1221,1049,1203,1116,1030,914,1110,1029, 943,1209,1034,950,1208,1033,914,1110,1022,915,1109,1021, 952,943,1085,1200,945,1086,1201,1220,1048,920,1207,1047, 953,944,976,952,943,975,920,1207,1032,921,1206,1031, 954,948,988,953,944,976,921,1206,1031,922,1210,1035, 1214,949,984,954,948,986,922,1210,1038,1213,1212,1037, 956,950,1087,955,1298,1088,942,1296,1082,923,1215,1081, 957,946,982,956,950,990,923,1215,1042,924,1214,1041, 958,947,983,957,946,982,924,1214,1041,925,1218,1045, 932,1224,1056,951,1222,977,958,947,979,925,1218,1057, 789,855,1089,784,831,1090,998,1299,1091,999,1300,1092, 1004,1007,1093,1005,1008,1094,778,777,1095,931,925,1096, 788,787,1097,838,835,1098,1002,1005,1099,1003,1006,1100, 838,835,1101,1009,1012,1102,1010,1013,1103,1002,1005,1104, 839,836,1105,840,837,1106,1000,1003,1107,1001,1004,1108, 840,856,1109,789,855,1089,999,1300,1092,1000,1301,1110, 1021,1024,1111,825,824,1112,1006,1009,1113,1020,1023,1114, 825,824,1115,778,777,1095,1005,1008,1094,1006,1009,1116, 784,831,1090,827,849,1117,997,1302,1118,998,1299,1091, 827,826,1119,826,825,1120,996,998,1121,997,999,1122, 931,925,1096,788,787,1097,1003,1006,1100,1004,1007,1093, 975,976,1123,974,975,1124,985,987,1125,986,988,1126, 975,1303,1123,986,1304,1126,987,1306,1127,976,1305,1128, 977,979,1129,976,978,1128,987,989,1127,988,990,1130, 978,980,1131,977,979,1132,988,990,1133,989,991,1134, 979,981,1135,1011,1014,1136,1012,1015,1137,990,992,1138, 980,982,1139,979,981,1140,990,992,1141,991,993,1142, 981,983,1143,980,982,1139,991,993,1142,992,994,1144, 992,994,1144,993,995,1145,982,984,1146,981,983,1143, 983,985,1147,982,984,1146,993,995,1145,994,996,1148, 1019,1022,1149,983,985,1150,994,996,1151,1018,1021,1152, 974,975,1153,984,986,1154,995,997,1155,985,987,1156, 986,988,1126,985,987,1125,1024,1027,1157,1025,1028,1158, 986,988,1126,1025,1028,1158,1026,1029,1159,987,989,1127, 988,990,1130,987,989,1127,1026,1029,1159,1027,1030,1160, 989,991,1134,988,990,1133,1027,1030,1161,1028,1031,1162, 990,992,1138,1012,1015,1137,1029,1032,1163,1030,1033,1164, 991,993,1142,990,992,1141,1030,1033,1165,1031,1034,1166, 992,994,1144,991,993,1142,1031,1034,1166,1032,1035,1167, 1032,1035,1167,1033,1036,1168,993,995,1145,992,994,1144, 994,996,1148,993,995,1145,1033,1036,1168,1034,1037,1169, 1018,1021,1152,994,996,1151,1034,1037,1170,1035,1038,1171, 985,987,1156,995,997,1155,1036,1039,1172,1024,1027,1173, 997,999,1122,996,998,1121,984,986,1154,974,975,1153, 998,1000,1091,997,999,1118,974,975,1124,975,976,1123, 998,1299,1091,975,1303,1123,976,1305,1128,999,1300,1092, 1000,1301,1110,999,1300,1092,976,1305,1128,977,1307,1129, 1001,1004,1108,1000,1003,1107,977,979,1132,978,980,1131, 1002,1005,1104,1010,1013,1103,1011,1014,1136,979,981,1135, 1003,1006,1100,1002,1005,1099,979,981,1140,980,982,1139, 1004,1007,1093,1003,1006,1100,980,982,1139,981,983,1143, 981,983,1143,982,984,1146,1005,1008,1094,1004,1007,1093, 1006,1009,1116,1005,1008,1094,982,984,1146,983,985,1147, 1020,1023,1114,1006,1009,1113,983,985,1150,1019,1022,1149, 804,804,811,1008,1011,824,1007,1010,901,775,773,902, 1009,1012,825,1008,1011,824,804,804,811,839,836,810, 1010,1013,1103,1009,1012,1102,839,836,1105,1001,1004,1108, 1011,1014,1136,1010,1013,1103,1001,1004,1108,978,980,1131, 1012,1015,1137,1011,1014,1136,978,980,1131,989,991,1134, 1029,1032,1163,1012,1015,1137,989,991,1134,1028,1031,1162, 1013,1016,863,1264,1274,1174,1014,1017,860, 1264,1274,1174,1265,1275,1175,1015,1018,1051,1014,1017,860, 1267,1277,1176,1268,1278,1177,1186,1192,1178,1194,1200,1179, 1269,1279,1180,1017,1020,934,1016,1019,933, 995,997,1155,1018,1021,1152,1035,1038,1171,1036,1039,1172, 984,986,1154,1019,1022,1149,1018,1021,1152,995,997,1155, 996,998,1121,1020,1023,1114,1019,1022,1149,984,986,1154, 826,825,1120,1021,1024,1111,1020,1023,1114,996,998,1121, 797,797,819,1022,1025,830,1021,1024,833,826,825,820, 776,775,882,1023,1026,883,1022,1025,830,797,797,819, 1025,1028,1158,1024,1027,1157,1215,1225,1181,1216,1226,1182, 1025,1028,1158,1216,1226,1182,1217,1227,1183, 1027,1030,1160,1026,1029,1159,1219,1229,1184,1220,1230,1185, 1028,1031,1162,1027,1030,1161,1220,1230,1186,1221,1231,1187, 1222,1232,1188,1029,1032,1163,1028,1031,1162,1221,1231,1187, 1030,1033,1164,1029,1032,1163,1222,1232,1188,1223,1233,1189, 1031,1034,1166,1030,1033,1165,1223,1233,1190,1224,1234,1191, 1032,1035,1167,1031,1034,1166,1224,1234,1191,1225,1235,1192, 1226,1236,1193,1227,1237,1194,1033,1036,1168, 1034,1037,1169,1033,1036,1168,1227,1237,1194,1228,1238,1195, 1035,1038,1171,1034,1037,1170,1228,1238,1196,1229,1239,1197, 1036,1039,1172,1035,1038,1171,1229,1239,1197,1230,1240,1198, 1024,1027,1173,1036,1039,1172,1230,1240,1198,1215,1225,1199, 800,800,1200,1083,1086,1201,1084,1087,1202,927,921,1203, 1073,1076,1204,1074,1077,1205,770,769,1206,926,920,1207, 836,833,1208,801,801,1209,1085,1088,1210,1070,1073,1211, 786,785,1212,835,832,1213,1071,1074,1214,1072,1075,1215, 835,832,1216,1162,1168,1217,1163,1169,1218,1071,1074,1219, 1270,1280,1220,1271,1281,1221,1134,1140,1222,1139,1145,1223, 801,801,1209,927,921,1203,1084,1087,1202,1085,1088,1210, 926,920,1207,786,785,1212,1072,1075,1215,1073,1076,1204, 1056,1059,1224,1076,1079,1225,1077,1080,1226,1054,1057,1227, 1081,1084,1228,1055,1058,1229,1051,1054,1230,1080,1083,1231, 1080,1083,1231,1051,1054,1230,1140,1146,1232,1141,1147,1233, 1147,1153,1234,1131,1137,1235,1132,1138,1236, 1143,1149,1237,1144,1150,1238,1078,1081,1239,1047,1051,1240, 800,800,1200,1066,1069,1241,1082,1085,1242,1083,1086,1201, 1172,1178,1243,1173,1179,888,770,769,887,1069,1072,1244, 1075,1078,1245,1069,1072,1246,770,769,1206,1074,1077,1205, 1058,1061,843,1057,1060,886,782,781,889,799,799,791, 1059,1062,844,1058,1061,843,799,799,791,824,823,792, 1060,1063,840,1059,1062,844,824,823,792,781,780,788, 1060,1063,840,781,780,788,928,922,787,1061,1064,841, 1062,1065,859,1061,1064,841,928,922,787,787,786,854, 1063,1066,834,1062,1065,859,787,786,854,837,834,857, 837,834,857,802,802,944,1064,1067,835,1063,1066,834, 1065,1068,898,1064,1067,835,802,802,944,780,779,943, 1066,1069,1241,1055,1058,1229,1081,1084,1228,1082,1085,1242, 1045,1049,1247,1068,1071,932,1146,1152,1248, 1146,1152,1248,1068,1071,932,1169,1175,1249, 1168,1174,931,1169,1175,1249,1068,1071,932, 1076,1079,1225,1056,1059,1224,1069,1072,1246,1075,1078,1245, 1171,1177,1250,1172,1178,1243,1069,1072,1244,1056,1059,1251, 1071,1074,1219,1163,1169,1218,1164,1170,1252,1044,1047,1253, 1072,1075,1215,1071,1074,1214,1044,1047,1254,1043,1046,1255, 1073,1076,1204,1072,1075,1215,1043,1046,1255,1040,1043,1256, 1040,1043,1256,1039,1042,1257,1074,1077,1205,1073,1076,1204, 1068,1071,1258,1075,1078,1245,1074,1077,1205,1039,1042,1257, 1045,1049,1259,1076,1079,1225,1075,1078,1245,1068,1071,1258, 1077,1080,1226,1076,1079,1225,1045,1049,1259,1053,1056,1260, 1078,1081,1239,1144,1150,1238,1145,1151,1261,1049,1052,1262, 1271,1281,1221,1272,1282,1263,1136,1142,1264,1134,1140,1222, 1052,1055,1265,1080,1083,1231,1141,1147,1233,1142,1148,1266, 1046,1048,1267,1081,1084,1228,1080,1083,1231,1052,1055,1265, 1082,1085,1242,1081,1084,1228,1046,1048,1267,1067,1070,1268, 1083,1086,1201,1082,1085,1242,1067,1070,1268,1037,1041,1269, 1083,1086,1201,1037,1041,1269,1038,1040,1270,1084,1087,1202, 1085,1088,1210,1084,1087,1202,1038,1040,1270,1041,1045,1271, 1070,1073,1211,1085,1088,1210,1041,1045,1271,1042,1044,1272, 1087,1090,1273,1086,1089,1274,873,869,959,881,877,899, 1065,1068,898,1088,1091,1275,1087,1090,1273,881,877,899, 1089,1092,1276,1088,1091,1275,1065,1068,898,780,779,943, 1090,1093,1277,1089,1092,1276,780,779,943,835,832,946, 1091,1094,1278,1090,1093,1277,835,832,946,786,785,1279, 1092,1095,1280,1091,1094,1278,786,785,1279,926,920,1281, 926,920,1281,770,769,887,1093,1096,1282,1092,1095,1280, 782,781,889,1094,1097,1283,1093,1096,1282,770,769,887, 1095,1098,1284,1094,1097,1283,782,781,889,1057,1060,886, 888,884,885,1096,1099,1285,1095,1098,1284,1057,1060,886, 880,876,969,1097,1100,1286,1096,1099,1285,888,884,885, 779,778,884,1098,1101,1287,1097,1100,1286,880,876,969, 1023,1026,883,1099,1102,1288,1098,1101,1287,779,778,884, 776,775,882,1100,1103,1289,1099,1102,1288,1023,1026,883, 785,784,880,1101,1104,1290,1100,1103,1289,776,775,882, 771,901,879,1102,1308,1291,1101,1309,1290,785,902,880, 1103,783,771,1102,1308,1291,771,901,879,865,899,877, 772,896,874,1288,1310,1292,1290,1311,1293,865,899,877, 855,895,873,1287,1312,1294,1288,1310,1292,772,896,874, 816,931,947,1104,1313,1295,1283,1314,1296,1291,932,948, 863,1315,1297,1105,1316,1298,1104,1313,1295,816,931,947, 1318,1317,1299,1319,1318,1300,863,1315,1297, 1107,1319,1301,1324,1320,1302,1312,1321,1303,889,940,970, 823,893,871,1108,1322,1304,1107,1319,1301,889,940,970, 834,892,870,1109,1323,1305,1108,1322,1304,823,893,871, 767,930,942,1110,1324,1306,1109,1323,1305,834,892,870, 767,930,942,793,906,911,1111,1325,1307,1110,1324,1306, 847,844,910,1112,1118,1308,1111,1117,1307,793,792,911, 1113,1119,1309,1112,1118,1308,847,844,910,818,818,909, 895,891,908,1114,1120,1310,1113,1119,1309,818,818,909, 1115,1121,1311,1114,1120,1310,895,891,908,773,771,950, 1116,1122,1312,1115,1121,1311,773,771,950,856,852,917, 1117,1123,1313,1116,1122,1312,856,852,917,811,811,916, 1118,1124,1314,1117,1123,1313,811,811,916,848,845,907, 1119,1125,1315,1118,1124,1314,848,845,907,768,767,906, 872,868,905,1120,1126,1316,1119,1125,1315,768,767,906, 1121,1127,1317,1120,1126,1316,872,868,905,769,768,904, 1122,1128,1318,1121,1127,1317,769,768,904,783,782,903, 1123,1129,1319,1122,1128,1318,783,782,903,775,773,902, 1124,1130,1320,1123,1129,1319,775,773,902,1007,1010,901, 1125,1131,1321,1124,1130,1320,1007,1010,901,777,776,900, 1086,1089,1274,1125,1131,1321,777,776,900,873,869,959, 1125,1131,1322,1086,1089,1323,1979,2028,1324,1976,2025,1325, 1978,2027,1326,1979,2028,1327,1086,1089,1328,1679,1597,1329, 1129,1135,1330,1128,1134,1331,1047,1051,1332,1078,1081,1333, 1130,1136,1334,1129,1135,1330,1078,1081,1333,1049,1052,1335, 1049,1052,1336,1132,1138,1236,1131,1137,1235,1130,1136,1337, 1132,1138,1236,1049,1052,1336,1145,1151,1338,1274,1284,1339, 1142,1148,1340,1276,1286,1341,1052,1055,1342, 1079,1082,1343,1135,1141,1344,1137,1143,1345,1050,1053,1346, 1048,1050,1347,1133,1139,1348,1135,1141,1344,1079,1082,1343, 1356,1354,1349,1133,1139,1350,1048,1050,1351,1275,1285,1352, 1136,1142,1264,1137,1143,1345,1135,1141,1344,1134,1140,1222, 1134,1140,1222,1135,1141,1344,1133,1139,1348,1139,1145,1223, 1141,1147,1233,1140,1146,1232,1048,1050,1353,1079,1082,1354, 1142,1148,1266,1141,1147,1233,1079,1082,1354,1050,1053,1355, 1054,1057,1227,1077,1080,1226,1144,1150,1238,1143,1149,1237, 1145,1151,1261,1144,1150,1238,1077,1080,1226,1053,1056,1260, 1053,1056,1356,1274,1284,1339,1145,1151,1338, 1359,1357,1357,1358,1356,1358,1270,1280,1359,1139,1145,1360, 1045,1049,1361,1274,1284,1339,1053,1056,1356, 1055,1058,1362,1356,1354,1349,1275,1285,1352, 1171,1177,1250,1358,1356,1358,1359,1357,1357, 1276,1286,1341,1046,1048,1363,1052,1055,1342, 1272,1282,1364,1170,1176,1365,1136,1142,1366, 1169,1175,1367,1170,1176,1365,1147,1153,1234,1146,1152,1368, 2067,2116,1369,2060,2109,1370,1149,1155,1371,2020,2069,1372, 1148,1154,1373,1149,1155,1374,2060,2109,1375,2061,2110,1376, 2075,2124,1377,1151,1157,1378,2022,2071,1379,2074,2123,1380, 1150,1156,1381,1151,1157,1382,2075,2124,1383,2068,2117,1384, 2083,2132,1385,2076,2125,1386,1153,1159,1387,2024,2073,1388, 1152,1158,1389,1153,1159,1390,2076,2125,1391,2077,2126,1392, 2091,2140,1393,1155,1161,1394,2026,2075,1395,2090,2139,1396, 1154,1160,1397,1155,1161,1398,2091,2140,1399,2084,2133,1400, 2099,2148,1401,2092,2141,1402,1157,1163,1403,2028,2077,1404, 1156,1162,1405,1157,1163,1406,2092,2141,1407,2093,2142,1408, 2107,2156,1409,1159,1165,1410,2030,2079,1411,2106,2155,1412, 1158,1164,1413,1159,1165,1414,2107,2156,1415,2100,2149,1416, 2115,2164,1417,2108,2157,1418,1161,1167,1419,2032,2081,1420, 1160,1166,1421,1161,1167,1422,2108,2157,1423,2109,2158,1424, 1162,1168,945,802,802,944,836,833,856, 1163,1169,1218,1162,1168,1217,836,833,1425,1070,1073,1426, 1164,1170,1252,1163,1169,1218,1070,1073,1426,1042,1044,1427, 1042,1044,1428,1041,1045,1429,1165,1171,895,1164,1170,894, 1041,1045,1429,1038,1040,1430,1166,1172,890,1165,1171,895, 1037,1041,1431,1167,1173,891,1166,1172,890,1038,1040,1430, 1067,1070,1432,1168,1174,931,1167,1173,891,1037,1041,1431, 1046,1048,1433,1169,1175,1249,1168,1174,931,1067,1070,1432, 1138,1144,1434,1170,1176,1365,1169,1175,1367,1046,1048,1363, 1170,1176,1365,1138,1144,1434,1137,1143,1435,1136,1142,1366, 1055,1058,1362,1171,1177,1250,1359,1357,1357,1356,1354,1349, 1066,1069,1436,1172,1178,1243,1171,1177,1250,1055,1058,1362, 800,800,789,1173,1179,888,1172,1178,1243,1066,1069,1436, 799,799,791,1173,1179,888,800,800,789, 960,964,1437,1258,1268,1438,1259,1269,1439,1175,1180,1440, 1261,1271,1441,1262,1272,1442,962,963,1443,1177,1183,1444, 1199,1205,1445,960,964,1446,1175,1180,1447,1198,1204,1448, 1016,1019,1449,1189,1195,1450,1179,1184,1451, 963,965,1452,1190,1196,1453,1191,1197,1454,1178,1185,1455, 1246,1256,1456,1247,1257,1457,1015,1018,1458,1188,1194,1459, 1268,1278,1460,1269,1279,1461,1016,1019,1449,1186,1192,1462, 1015,1018,1458,1265,1275,1463,1266,1276,1464,1187,1193,1465, 1182,1188,1466,959,774,1467,1174,1181,1468, 1197,1203,1469,1182,1188,1470,1174,1181,1471,1196,1202,1472, 961,926,1473,1183,1189,1474,1176,1182,1475, 1184,1190,1476,961,926,1473,1176,1182,1475, 1174,1181,1471,1185,1191,1477,1195,1201,1478,1196,1202,1472, 959,774,1467,1185,1191,1479,1174,1181,1468, 1186,1192,1462,1016,1019,1449,1179,1184,1451, 1194,1200,1179,1186,1192,1178,1179,1184,1480,1193,1199,1481, 1015,1018,1458,1187,1193,1465,1181,1187,1482, 1188,1194,1459,1015,1018,1458,1181,1187,1482, 1179,1184,1480,1189,1195,827,1192,1198,826,1193,1199,1481, 1016,1019,1449,1243,1253,1483,1244,1254,1484,1189,1195,1450, 1191,1197,1454,1190,1196,1453,964,966,1485,1180,1186,1486, 1188,1194,1487,1192,1198,826,1245,1255,829,1246,1256,1488, 1193,1199,1481,1192,1198,826,1188,1194,1487,1181,1187,1489, 1187,1193,1490,1194,1200,1179,1193,1199,1481,1181,1187,1489, 1266,1276,1491,1267,1277,1176,1194,1200,1179,1187,1193,1490, 1196,1202,1472,1195,1201,1478,1184,1190,1492,1176,1182,1493, 1183,1189,1494,1197,1203,1469,1196,1202,1472,1176,1182,1493, 1198,1204,817,1260,1270,816,1261,1271,1495,1177,1183,1496, 962,963,1497,1199,1205,1445,1198,1204,1448,1177,1183,1498, 1201,1220,1048,1200,945,1086,951,1222,977,932,1224,1056, 1202,1221,1049,1201,1220,1048,932,1224,1056,949,1223,1055, 1203,1116,1030,1202,1221,1049,949,1223,1055,933,1288,1060, 1204,1108,1020,1203,1116,1030,933,1288,1060,934,1287,1059, 1205,961,1008,1204,1108,1020,934,1287,1059,935,1289,1063, 1206,810,1009,1205,961,1008,935,1289,1063,936,1290,1065, 937,1291,1068,1207,794,777,1206,810,780,936,1290,1069, 938,1292,1072,1208,907,912,1207,794,777,937,1291,1068, 939,1293,1074,1209,954,997,1208,907,1000,938,1292,1075, 940,1294,1078,1210,1002,1014,1209,954,997,939,1293,1074, 941,1295,1080,1211,1112,1024,1210,1002,1014,940,1294,1078, 945,1297,1083,1212,1213,1040,1211,1112,1024,941,1295,1080, 942,1296,1082,1213,1212,1037,1212,1213,1040,945,1297,1083, 955,1298,1088,1214,949,984,1213,1212,1037,942,1296,1082, 1216,1226,1182,1215,1225,1181,973,974,1499,1248,1258,1500, 1232,1241,1501,1231,1242,1502,1249,1259,1503,1250,1260,1504, 1235,1245,1505,1232,1241,1501,1250,1260,1504,1251,1261,1506, 1219,1229,1184,1218,1228,1507,1252,1262,1508,969,971,1509, 1220,1230,1185,1219,1229,1184,969,971,1509,970,970,1510, 1221,1231,1187,1220,1230,1186,970,970,1511,968,969,1512, 1013,1016,1513,1222,1232,1188,1221,1231,1187,968,969,1512, 1223,1233,1189,1222,1232,1188,1013,1016,1513,967,968,1514, 1224,1234,1191,1223,1233,1190,967,968,1515,965,967,1516, 1257,1267,1517,965,967,1516,964,966,1518, 1238,1250,1519,1255,1265,1520,1256,1266,1521,1240,1249,1522, 1254,1264,1523,1255,1265,1520,1238,1250,1519,1242,1252,1524, 972,973,1525,1253,1263,1526,963,965,1527, 1229,1239,1197,1228,1238,1196,972,973,1528,1017,1020,1529, 1230,1240,1198,1229,1239,1197,1017,1020,1529,971,972,1530, 1215,1225,1199,1230,1240,1198,971,972,1530,973,974,1531, 1217,1227,1532,1216,1226,1533,1231,1242,1534,1232,1241,1535, 1216,1226,1536,1248,1258,1537,1249,1259,1538,1231,1242,1539, 960,964,1540,1199,1205,1541,1234,1244,1542,1233,1243,1543, 1218,1228,1544,1217,1227,1532,1232,1241,1535,1235,1245,1545, 1199,1205,1541,962,963,1546,1236,1246,1547,1234,1244,1542, 1251,1261,1548,1252,1262,1549,1218,1228,1550,1235,1245,1551, 1226,1236,1552,1225,1235,1553,1239,1248,1554,1237,1247,1555, 1256,1266,1556,1257,1267,1557,964,966,1558,1240,1249,1559, 964,966,1560,1190,1196,1561,1238,1250,1562,1240,1249,1563, 1227,1237,1564,1226,1236,1552,1237,1247,1555,1241,1251,1565, 1190,1196,1561,963,965,1566,1242,1252,1567,1238,1250,1562, 963,965,1568,1253,1263,1569,1254,1264,1570,1242,1252,1571, 1243,1253,936,972,973,935,963,965,1572, 1244,1254,1484,1243,1253,1483,963,965,1573,1178,1185,1574, 1245,1255,829,1244,1254,828,1178,1185,1575,1191,1197,1576, 1246,1256,1488,1245,1255,829,1191,1197,1576,1180,1186,1577, 964,966,1578,1247,1257,1457,1246,1256,1456,1180,1186,1579, 965,967,861,1247,1257,1052,964,966,1580, 1248,1258,1500,973,974,1499,960,964,1581, 1249,1259,1538,1248,1258,1537,960,964,1582,1233,1243,1583, 1250,1260,1504,1249,1259,1503,1233,1243,1584,1234,1244,1585, 1251,1261,1506,1250,1260,1504,1234,1244,1585,1236,1246,1586, 962,963,1587,1252,1262,1549,1251,1261,1548,1236,1246,1588, 969,971,1509,1252,1262,1508,962,963,1589, 1228,1238,1195,1227,1237,1194,1253,1263,1526,972,973,1525, 1254,1264,1570,1253,1263,1569,1227,1237,1590,1241,1251,1591, 1241,1251,1592,1237,1247,1593,1255,1265,1520,1254,1264,1523, 1256,1266,1521,1255,1265,1520,1237,1247,1593,1239,1248,1594, 1225,1235,1595,1257,1267,1557,1256,1266,1556,1239,1248,1596, 1225,1235,1192,1224,1234,1191,965,967,1516,1257,1267,1517, 1258,1268,940,971,972,939,959,774,1597, 1259,1269,1439,1258,1268,1438,959,774,1467,1182,1188,1466, 1260,1270,816,1259,1269,815,1182,1188,1470,1197,1203,1469, 1261,1271,1495,1260,1270,816,1197,1203,1469,1183,1189,1494, 961,926,1473,1262,1272,1442,1261,1271,1441,1183,1189,1474, 1263,1273,865,1262,1272,1054,961,926,1598,966,788,1599, 968,969,866,1263,1273,865,966,788,1599, 966,788,1599,1264,1274,1174,1013,1016,863,968,969,866, 961,926,1598,1265,1275,1175,1264,1274,1174,966,788,1599, 1266,1276,1464,1265,1275,1463,961,926,1473,1184,1190,1476, 1184,1190,1492,1195,1201,1478,1267,1277,1176,1266,1276,1491, 1195,1201,1478,1185,1191,1477,1268,1278,1177,1267,1277,1176, 959,774,1467,1269,1279,1461,1268,1278,1460,1185,1191,1479, 959,774,1597,971,972,939,1017,1020,934,1269,1279,1180, 1129,1135,1330,1271,1281,1221,1270,1280,1220,1128,1134,1331, 1130,1136,1334,1272,1282,1263,1271,1281,1221,1129,1135,1330, 1147,1153,1234,1170,1176,1365,1131,1137,1235, 1272,1282,1364,1130,1136,1337,1170,1176,1365, 1131,1137,1235,1170,1176,1365,1130,1136,1337, 1273,1283,1600,1056,1059,1251,1054,1057,1601, 1143,1149,1602,1273,1283,1600,1054,1057,1601, 1045,1049,1361,1146,1152,1368,1274,1284,1339, 1132,1138,1236,1274,1284,1339,1147,1153,1234, 1146,1152,1368,1147,1153,1234,1274,1284,1339, 1051,1054,1603,1275,1285,1352,1140,1146,1604, 1055,1058,1362,1275,1285,1352,1051,1054,1603, 1138,1144,1434,1276,1286,1341,1142,1148,1340,1050,1053,1605, 1138,1144,1434,1046,1048,1363,1276,1286,1341, 1137,1143,1435,1138,1144,1434,1050,1053,1605, 1140,1146,1604,1275,1285,1352,1048,1050,1351, 1281,1326,1606,1279,1327,1607,1282,1328,1608, 1104,1313,1295,817,1329,1609,1279,1327,1610,1278,1330,1611, 1277,1331,1612,1104,1313,1613,1278,1330,1614,1280,1332,1615, 1278,1330,1616,1279,1327,1617,1281,1326,1618, 1280,1332,1619,1278,1330,1620,1281,1326,1621,1282,1328,1622, 1307,1333,1623,1306,1334,1624,1308,1335,1625, 1309,1336,1626,1307,1333,1623,1303,1337,1627,1304,1338,1628, 1311,1339,1629,1310,1340,1630,1309,1336,1626,1304,1338,1628, 1286,1341,1631,1291,932,948,1283,1314,1296,1293,1342,1632, 815,927,929,1291,932,948,1285,1343,1633,854,898,876, 1285,1343,1633,1291,932,948,1286,1341,1631,1355,1344,1634, 1293,1342,1632,1283,1314,1296,1284,1345,1635, 1307,1333,1623,1308,1335,1625,1305,1346,1636,1303,1337,1627, 1284,1345,1637,1292,1347,1638,1294,1348,1639, 1286,1341,1640,1293,1342,1641,1295,1349,1642, 1293,1342,1643,1284,1345,1644,1294,1348,1645,1295,1349,1646, 1296,1350,1647,1294,1348,1648,1884,1352,1649, 1884,1352,1649,1294,1348,1648,1882,1351,1650, 1294,1348,1648,1292,1347,1651,1882,1351,1650, 1286,1341,1652,1297,1353,1653,1354,1358,1654,1355,1344,1655, 1286,1341,1656,1295,1349,1657,1299,1359,1658,1297,1353,1659, 1288,1310,1660,1287,1312,1661,1298,1362,1662,1300,1363,1663, 1289,770,1664,1290,1311,1665,1301,1364,1666,1302,1365,1667, 1290,1311,1668,1288,1310,1669,1300,1363,1670,1301,1364,1671, 1295,1349,1672,1294,1348,1673,1296,1350,1674,1299,1359,1675, 1305,1346,1676,1296,1350,1677,1884,1352,1678,1893,1368,1679, 1297,1353,1680,1306,1334,1681,1354,1358,1682, 1297,1353,1683,1299,1359,1684,1308,1335,1685,1306,1334,1686, 1300,1363,1687,1298,1362,1688,1307,1333,1689,1309,1336,1690, 1302,1365,1691,1301,1364,1692,1310,1340,1693,1311,1339,1694, 1301,1364,1695,1300,1363,1696,1309,1336,1697,1310,1340,1698, 1299,1359,1699,1296,1350,1700,1305,1346,1701,1308,1335,1702, 1339,1369,1703,1338,1370,1704,1340,1371,1705,1341,1372,1706, 1342,1373,1707,1338,1370,1704,1339,1369,1703,1343,1374,1708, 1344,1376,1709,1345,1377,1710,1346,1378,1711, 1348,1379,1712,1347,1380,1713,1344,1376,1709,1349,1381,1714, 1351,1382,1715,1350,1383,1716,1348,1379,1712,1349,1381,1714, 1352,1384,1717,1351,1382,1715,1349,1381,1714,1341,1372,1706, 863,1315,1297,1320,939,957,1318,1317,1299, 890,829,809,1321,942,972,1316,937,955,831,936,954, 1344,1376,1709,1347,1380,1713,1345,1377,1710, 823,893,871,889,940,970,1313,894,872, 1323,919,928,1320,939,957,863,1315,1297, 863,1315,1297,816,931,947,815,927,929,1323,919,928, 1344,1376,1709,1346,1378,1711,1343,1374,1708,1339,1369,1703, 1312,1321,1303,1324,1320,1302,1106,1395,1718,1319,1318,1300, 1339,1369,1703,1341,1372,1706,1349,1381,1714,1344,1376,1709, 1340,1371,1705,1353,1396,1719,1341,1372,1706, 1325,941,971,889,940,970,1312,1321,1303, 1341,1372,1706,1353,1396,1719,1352,1384,1717, 863,1315,1297,1319,1318,1300,1106,1395,1718,1105,1316,1298, 1314,827,1720,1313,894,1721,1327,1397,1722,1326,1398,1723, 1315,828,1724,1314,827,1720,1326,1398,1723,1328,1399,1725, 1321,942,1726,1315,828,1727,1328,1399,1728,1329,1400,1729, 1322,1407,1730,1316,937,1731,1331,1408,1732,1330,1409,1733, 1320,939,1734,1317,938,1735,1332,1410,1736,1333,1411,1737, 1319,1318,1738,1318,1317,1739,1334,1412,1740,1335,1413,1741, 1318,1317,1742,1320,939,1743,1333,1411,1744,1334,1412,1745, 1312,1321,1746,1319,1318,1738,1335,1413,1741,1336,1414,1747, 1317,938,1735,1322,1407,1730,1330,1409,1733,1332,1410,1736, 1316,937,1748,1321,942,1726,1329,1400,1729,1331,1408,1749, 1313,894,1721,1325,941,1750,1337,1464,1751,1327,1397,1722, 1325,941,1752,1312,1321,1746,1336,1414,1747,1337,1464,1753, 1326,1398,1723,1327,1397,1722,1340,1371,1754,1338,1370,1755, 1328,1399,1725,1326,1398,1723,1338,1370,1755,1342,1373,1756, 1329,1400,1729,1328,1399,1728,1342,1373,1757,1343,1374,1758, 1330,1409,1733,1331,1408,1732,1346,1378,1759,1345,1377,1760, 1333,1411,1737,1332,1410,1736,1347,1380,1761,1348,1379,1762, 1335,1413,1741,1334,1412,1740,1350,1383,1763,1351,1382,1764, 1334,1412,1745,1333,1411,1744,1348,1379,1765,1350,1383,1766, 1336,1414,1747,1335,1413,1741,1351,1382,1764,1352,1384,1767, 1332,1410,1736,1330,1409,1733,1345,1377,1760,1347,1380,1761, 1331,1408,1749,1329,1400,1729,1343,1374,1758,1346,1378,1768, 1327,1397,1722,1337,1464,1751,1353,1396,1769,1340,1371,1754, 1337,1464,1753,1336,1414,1747,1352,1384,1767,1353,1396,1770, 865,899,877,1290,1311,1293,1289,770,769,1103,783,771, 1354,1358,1682,1306,1334,1681,1307,1333,1771,1298,1362,1772, 1355,1344,1655,1354,1358,1654,1298,1362,1773,1287,1312,1774, 1285,1343,1633,1355,1344,1634,1287,1312,1294,855,895,873, 854,898,876,1285,1343,1633,855,895,873, 1133,1139,1350,1356,1354,1349,1359,1357,1357,1139,1145,1360, 1357,1355,1775,1056,1059,1251,1273,1283,1600, 1143,1149,1602,1047,1051,1776,1357,1355,1775,1273,1283,1600, 1357,1355,1775,1047,1051,1776,1128,1134,1777, 1357,1355,1775,1358,1356,1358,1171,1177,1250,1056,1059,1251, 1270,1280,1359,1358,1356,1358,1357,1355,1775,1128,1134,1777, 1701,1466,1778,1108,1322,1304,1109,1323,1305,1702,1465,1779, 1093,1096,1282,1094,1097,1283,1687,1360,1780,1686,1361,1781, 1303,1337,1627,1891,1468,1782,1892,1469,1783,1304,1338,1628, 1118,1124,1314,1119,1125,1315,1712,1367,1784,1711,1366,1785, 1878,1488,1786,1696,1489,1787,864,772,770, 1119,1125,1315,1120,1126,1316,1713,1375,1788,1712,1367,1784, 1426,1494,1789,1416,1495,1790,1427,1496,1791, 1800,1497,1792,1799,1498,1793,1491,1499,1794,1490,1500,1795, 1436,1385,1796,1444,1388,1797,1443,1387,1798,1402,1386,1799, 1463,1389,1800,1436,1385,1796,1402,1386,1799,1464,1390,1801, 1394,1393,1802,1418,1394,1803,1395,1392,1804, 1389,1530,1805,1951,1531,1806,1952,1540,1807,1459,1541,1808, 1950,1542,1809,1951,1531,1806,1389,1530,1805,1448,1543,1810, 1113,1119,1309,1114,1120,1310,1707,1401,1811,1706,1402,1812, 1486,1403,1813,1439,1406,1814,1413,1405,1815,1487,1404,1816, 1416,1495,1790,1426,1494,1789,1902,1548,1817, 1107,1319,1301,1108,1322,1304,1701,1466,1778,1700,1549,1818, 1122,1128,1318,1123,1129,1319,1716,1416,1819,1715,1415,1820, 1433,1417,1821,1434,1420,1822,1400,1419,1823,1399,1418,1824, 1768,1421,1825,1791,1424,1826,1853,1423,1827,1852,1422,1828, 1391,1425,1829,1421,1428,1830,1420,1427,1831,1392,1426,1832, 1693,1430,1833,1100,1103,1289,1101,1104,1290,1694,1429,1834, 1124,1130,1320,1125,1131,1321,1718,1432,1835,1717,1431,1836, 1432,1433,1837,1602,1436,1838,1601,1435,1839,1398,1434,1840, 1785,1437,1841,1838,1440,1842,1837,1439,1843,1782,1438,1844, 1615,1441,1845,1614,1444,1846,1419,1443,1847,1393,1442,1848, 1691,1446,1849,1098,1101,1287,1099,1102,1288,1692,1445,1850, 1087,1090,1273,1088,1091,1275,1681,1447,1851,1680,1448,1852, 1656,1449,1853,1476,1452,1854,1475,1451,1855,1657,1450,1856, 1480,1455,1857,1479,1458,1858,1652,1457,1859,1651,1456,1860, 1095,1098,1284,1096,1099,1285,1689,1459,1861,1688,1460,1862, 1121,1127,1317,1122,1128,1318,1715,1415,1820,1714,1461,1863, 1434,1420,1822,1435,1463,1864,1401,1462,1865,1400,1419,1823, 1390,1567,1866,1953,1568,1867,1421,1569,1830,1391,1570,1829, 1694,1576,1834,1101,1309,1290,1102,1308,1291,1695,1575,1868, 1090,1093,1277,1091,1094,1278,1684,1471,1869,1683,1470,1870, 1382,1472,1871,1431,1475,1872,1430,1474,1873,1396,1473,1874, 1477,1476,1875,1476,1452,1854,1656,1449,1853,1655,1477,1876, 1607,1478,1877,1606,1481,1878,1560,1480,1879,1558,1479,1880, 1562,1482,1881,1563,1485,1882,1561,1484,1883,1856,1483,1884, 1385,1577,1885,1435,1578,1864,1434,1579,1822,1384,1580,1886, 1386,1581,1887,1436,1582,1796,1463,1583,1800,1462,1598,1888, 1445,1599,1889,1444,1600,1797,1436,1582,1796,1386,1581,1887, 1414,1601,1890,1439,1602,1814,1486,1603,1813,1485,1604,1891, 1439,1602,1814,1414,1601,1890,1404,1605,1892,1440,1606,1893, 1704,1493,1894,1111,1117,1307,1112,1118,1308,1705,1492,1895, 1416,1495,1790,1417,1607,1896,1428,1608,1897,1427,1496,1791, 1417,1607,1896,1416,1495,1790,1902,1548,1817,1901,1609,1898, 1449,1610,1899,1448,1543,1810,1389,1530,1805,1367,1611,1900, 1367,1611,1900,1389,1530,1805,1459,1541,1808,1458,1612,1901, 1366,1613,1902,1390,1567,1866,1391,1570,1829,1380,1614,1903, 1380,1501,1903,1391,1425,1829,1392,1426,1832,1371,1502,1904, 1393,1442,1848,1374,1504,1905,1616,1503,1906,1615,1441,1845, 1481,1505,1907,1480,1455,1857,1651,1456,1860,1650,1506,1908, 1365,1507,1909,1377,1509,1910,1394,1393,1802,1766,1508,1911, 1757,1512,1912,1637,1515,1913,1636,1514,1914,1758,1513,1915, 1475,1451,1855,1474,1517,1916,1658,1516,1917,1657,1450,1856, 1601,1435,1839,1600,1519,1918,1372,1518,1919,1398,1434,1840, 1400,1419,1823,1378,1521,1920,1370,1520,1921,1399,1418,1824, 1401,1462,1865,1364,1522,1922,1378,1521,1920,1400,1419,1823, 1402,1386,1799,1363,1524,1923,1465,1523,1924,1464,1390,1801, 1443,1387,1798,1442,1525,1925,1363,1524,1923,1402,1386,1799, 1413,1405,1815,1412,1527,1926,1488,1526,1927,1487,1404,1816, 1441,1615,1928,1440,1606,1893,1404,1605,1892,1388,1616,1929, 1801,1617,1930,1800,1497,1792,1490,1500,1795,1493,1618,1931, 1116,1122,1312,1117,1123,1313,1710,1533,1932,1709,1532,1933, 1451,1534,1934,1450,1537,1935,1406,1536,1936,1407,1535,1937, 1407,1535,1937,1437,1539,1938,1452,1538,1939,1451,1534,1934, 1453,1619,1940,1452,1620,1939,1437,1621,1938,1408,1622,1941, 1948,1625,1942,1949,1626,1943,1410,1627,1944,1456,1628,1945, 1911,1629,1946,1456,1628,1945,1410,1627,1944, 817,1329,1609,1698,1630,1947,1697,1631,1948, 1705,1492,1895,1112,1118,1308,1113,1119,1309,1706,1402,1812, 1440,1490,1893,1441,1528,1928,1412,1527,1926,1413,1405,1815, 1760,1510,1949,1632,1511,1950,1661,1552,1951,1761,1551,1952, 1395,1392,1804,1418,1394,1803,1376,1391,1953, 1478,1453,1954,1653,1454,1955,1652,1457,1859,1479,1458,1858, 1609,1553,1956,1836,1556,1957,1565,1555,1958,1610,1554,1959, 1553,1557,1960,1851,1560,1961,1564,1559,1962,1566,1558,1963, 1361,1550,1964,1379,1561,1965,1421,1569,1830,1422,1632,1966, 1360,1487,1967,1461,1491,1968,1460,1633,1969,1423,1634,1970, 1446,1486,1971,1360,1487,1967,1423,1634,1970,1447,1635,1972, 1454,1623,1973,1409,1624,1974,1424,1636,1975,1455,1637,1976, 1426,1494,1789,1415,1544,1977,1484,1545,1978,1483,1546,1979, 1405,1638,1980,1415,1544,1977,1426,1494,1789,1427,1496,1791, 1428,1608,1897,1362,1639,1981,1405,1638,1980,1427,1496,1791, 1702,1465,1779,1109,1323,1305,1110,1324,1306,1703,1467,1982, 1089,1092,1276,1090,1093,1277,1683,1470,1870,1682,1562,1983, 1375,1563,1984,1429,1566,1985,1755,1565,1986,1397,1564,1987, 1430,1474,1873,1431,1475,1872,1397,1564,1987, 1440,1490,1893,1413,1405,1815,1439,1406,1814, 1117,1123,1313,1118,1124,1314,1711,1366,1785,1710,1533,1932, 1407,1535,1937,1406,1536,1936,1442,1525,1925,1443,1387,1798, 1443,1387,1798,1444,1388,1797,1437,1539,1938,1407,1535,1937, 1408,1622,1941,1437,1621,1938,1444,1600,1797,1445,1599,1889, 1409,1624,1974,1446,1486,1971,1447,1635,1972,1424,1636,1975, 1410,1627,1944,1949,1626,1943,1950,1542,1809,1448,1543,1810, 1411,1640,1988,1410,1627,1944,1880,1641,1989, 1277,1331,1990,1697,1631,1948,1872,1642,1991, 1115,1121,1311,1116,1122,1312,1709,1532,1933,1708,1571,1992, 1403,1572,1993,1368,1573,1994,1450,1537,1935,1451,1534,1934, 1451,1534,1934,1452,1538,1939,1438,1574,1995,1403,1572,1993, 1387,1643,1996,1438,1644,1995,1452,1620,1939,1453,1619,1940, 1369,1645,1997,1454,1623,1973,1455,1637,1976,1425,1646,1998, 1905,1647,1999,1456,1628,1945,1911,1629,1946,1908,1648,2000, 1698,1630,1947,1105,1316,1298,1106,1395,1718,1699,1649,2001, 1696,1489,1787,1103,783,771,864,772,770, 1459,1541,1808,1390,1567,1866,1366,1613,1902,1458,1612,1901, 1459,1541,1808,1952,1540,1807,1953,1568,1867,1390,1567,1866, 1461,1491,1968,1361,1550,1964,1422,1632,1966,1460,1633,1969, 1463,1583,1800,1435,1578,1864,1385,1577,1885,1462,1598,1888, 1435,1463,1864,1463,1389,1800,1464,1390,1801,1401,1462,1865, 1465,1523,1924,1364,1522,1922,1401,1462,1865,1464,1390,1801, 1713,1375,1788,1120,1126,1316,1121,1127,1317,1714,1461,1863, 1127,1133,2002,2033,2082,2003,2034,2083,2004,1126,1132,2005, 1398,1434,1840,1372,1518,1919,1466,1587,2006,1467,1586,2007, 1468,1588,2008,1432,1433,1837,1398,1434,1840,1467,1586,2007, 1383,1589,2009,1432,1433,1837,1468,1588,2008,1469,1590,2010, 1373,1591,2011,1470,1592,2012,1471,1593,2013,1419,1443,1847, 1393,1442,1848,1419,1443,1847,1471,1593,2013,1472,1594,2014, 1374,1504,1905,1393,1442,1848,1472,1594,2014,1473,1595,2015, 1690,1596,2016,1097,1100,1286,1098,1101,1287,1691,1446,1849, 1086,1089,1274,1087,1090,1273,1680,1448,1852,1679,1597,2017, 1467,1586,2007,1466,1587,2006,1474,1517,1916,1475,1451,1855, 1476,1452,1854,1468,1588,2008,1467,1586,2007,1475,1451,1855, 1469,1590,2010,1468,1588,2008,1476,1452,1854,1477,1476,1875, 1470,1592,2012,1478,1453,1954,1479,1458,1858,1471,1593,2013, 1472,1594,2014,1471,1593,2013,1479,1458,1858,1480,1455,1857, 1473,1595,2015,1472,1594,2014,1480,1455,1857,1481,1505,1907, 1689,1459,1861,1096,1099,1285,1097,1100,1286,1690,1596,2016, 1324,1320,1302,1107,1319,1301,1700,1549,1818,1912,1650,2018, 1901,1609,1898,1913,1664,2019,1482,1665,2020, 1483,1546,1979,1909,1666,2021,1903,1547,2022, 1484,1545,1978,1369,1645,1997,1425,1646,1998,1483,1546,1979, 1486,1603,1813,1438,1644,1995,1387,1643,1996,1485,1604,1891, 1438,1574,1995,1486,1403,1813,1487,1404,1816,1403,1572,1993, 1488,1526,1927,1368,1573,1994,1403,1572,1993,1487,1404,1816, 1707,1401,1811,1114,1120,1310,1115,1121,1311,1708,1571,1992, 1405,1638,2023,1546,1667,2024,1545,1668,2025,1415,1544,2026, 1415,1544,2027,1545,1668,2028,1793,1669,2029, 1414,1601,2030,1551,1670,2031,1550,1671,2032,1404,1605,2033, 1362,1639,2034,1547,1673,2035,1546,1667,2024,1405,1638,2023, 1404,1605,2033,1550,1671,2032,1549,1674,2036,1388,1616,2037, 1496,1675,2038,1490,1500,2039,1491,1499,2040,1495,1676,2041, 1497,1677,2042,1493,1618,2043,1490,1500,2039,1496,1675,2038, 1802,1678,2044,1801,1617,2045,1493,1618,2046,1497,1677,2047, 1499,1679,2048,1489,1680,2049,1494,1681,2050,1498,1682,2051, 1500,1683,2052,1492,1684,2053,1489,1680,2049,1499,1679,2048, 1495,1676,2054,1491,1499,2055,1799,1498,2056,1798,1685,2057, 1502,1686,2058,1496,1675,2038,1495,1676,2041,1501,1687,2059, 1503,1688,2060,1497,1677,2042,1496,1675,2038,1502,1686,2058, 1803,1689,2061,1802,1678,2044,1497,1677,2047,1503,1688,2062, 1505,1697,2063,1499,1679,2048,1498,1682,2051,1504,1703,2064, 1506,1820,2065,1500,1683,2052,1499,1679,2048,1505,1697,2063, 1501,1687,2066,1495,1676,2054,1798,1685,2057,1797,1821,2067, 1508,1822,2068,1502,1686,2058,1501,1687,2059,1507,1823,2069, 1509,1824,2070,1503,1688,2060,1502,1686,2058,1508,1822,2068, 1804,1825,2071,1803,1689,2061,1503,1688,2062,1509,1824,2072, 1511,1826,2073,1505,1697,2063,1504,1703,2064,1510,1909,2074, 1512,1910,2075,1506,1820,2065,1505,1697,2063,1511,1826,2073, 1507,1823,2076,1501,1687,2066,1797,1821,2067,1796,1911,2077, 1514,1912,2078,1536,1913,2079,1543,1914,2080,1513,1915,2081, 1515,1916,2082,1537,1917,2083,1536,1913,2079,1514,1912,2078, 1806,1918,2084,1805,1919,2085,1537,1917,2086,1515,1916,2087, 1517,1920,2088,1540,1921,2089,1539,1922,2090,1516,1923,2091, 1518,1924,2092,1541,1925,2093,1540,1921,2089,1517,1920,2088, 1513,1915,2094,1543,1914,2095,1795,1926,2096,1794,1927,2097, 1091,1094,1278,1092,1095,1280,1685,1651,2098,1684,1471,1869, 1758,1513,1915,1636,1514,1914,1633,1653,2099,1759,1652,2100, 1521,1654,2101,1382,1472,1871,1396,1473,1874,1520,1655,2102, 1522,1656,2103,1477,1476,1875,1655,1477,1876,1654,1657,2104, 1523,1658,2105,1469,1590,2010,1477,1476,1875,1522,1656,2103, 1524,1659,2106,1383,1589,2009,1469,1590,2010,1523,1658,2105, 1608,1660,2107,1607,1478,1877,1558,1479,1880,1840,1661,2108, 1555,1662,2109,1562,1482,1881,1856,1483,1884,1855,1663,2110, 1385,1577,1885,1384,1580,1886,1379,1561,1965,1361,1550,1964, 1461,1491,1968,1462,1598,1888,1385,1577,1885,1361,1550,1964, 1386,1581,1887,1462,1598,1888,1461,1491,1968,1360,1487,1967, 1445,1599,1889,1386,1581,1887,1360,1487,1967,1446,1486,1971, 1408,1622,1941,1445,1599,1889,1446,1486,1971,1409,1624,1974, 1453,1619,1940,1408,1622,1941,1409,1624,1974,1454,1623,1973, 1387,1643,1996,1453,1619,1940,1454,1623,1973,1369,1645,1997, 1484,1545,1978,1485,1604,1891,1387,1643,1996,1369,1645,1997, 1414,1601,1890,1485,1604,1891,1484,1545,1978,1415,1544,1977, 1793,1669,2029,1544,1928,2111,1414,1601,2112,1415,1544,2027, 1542,1929,2113,1541,1925,2114,1518,1924,2115,1525,1930,2116, 1527,1931,2117,1506,1820,2118,1512,1910,2119,1526,1932,2120, 1528,1933,2121,1500,1683,2122,1506,1820,2118,1527,1931,2117, 1529,1934,2123,1492,1684,2124,1500,1683,2122,1528,1933,2121, 1489,1680,2125,1492,1684,2126,1529,1934,2127,1530,1935,2128, 1494,1681,2129,1489,1680,2125,1530,1935,2128,1531,1936,2130, 1498,1682,2131,1494,1681,2132,1531,1936,2133,1532,1937,2134, 1504,1703,2135,1498,1682,2131,1532,1937,2134,1533,1938,2136, 1510,1909,2137,1504,1703,2135,1533,1938,2136,1534,1939,2138, 1516,1923,2139,1539,1922,2140,1538,1940,2141,1535,1941,2142, 1388,1616,2143,1549,1674,2144,1548,1942,2145, 1110,1324,1306,1111,1325,1307,1704,1943,1894,1703,1467,1982, 1537,1917,2083,1509,1824,2070,1508,1822,2068,1536,1913,2079, 1805,1919,2085,1804,1825,2071,1509,1824,2072,1537,1917,2086, 1539,1922,2140,1510,1909,2137,1534,1939,2138,1538,1940,2141, 1540,1921,2089,1511,1826,2073,1510,1909,2074,1539,1922,2090, 1541,1925,2093,1512,1910,2075,1511,1826,2073,1540,1921,2089, 1526,1932,2120,1512,1910,2119,1541,1925,2114,1542,1929,2113, 1543,1914,2095,1507,1823,2076,1796,1911,2077,1795,1926,2096, 1536,1913,2079,1508,1822,2068,1507,1823,2069,1543,1914,2080, 1545,1668,2028,1513,1915,2094,1794,1927,2097,1793,1669,2029, 1546,1667,2024,1514,1912,2078,1513,1915,2081,1545,1668,2025, 1547,1673,2035,1515,1916,2082,1514,1912,2078,1546,1667,2024, 1807,1672,2146,1806,1918,2084,1515,1916,2087,1547,1673,2147, 1549,1674,2144,1516,1923,2139,1535,1941,2142,1548,1942,2145, 1550,1671,2032,1517,1920,2088,1516,1923,2091,1549,1674,2036, 1551,1670,2031,1518,1924,2092,1517,1920,2088,1550,1671,2032, 1525,1930,2116,1518,1924,2115,1551,1670,2148,1544,1928,2111, 1383,1589,2149,1596,1693,2150,1595,1692,2151,1432,1433,2152, 1432,1433,2153,1595,1692,2154,1603,1694,2155,1602,1436,2156, 1433,1417,2157,1594,1696,2158,1593,1695,2159,1434,1420,2160, 1434,1579,2161,1593,1945,2162,1592,1946,2163,1384,1580,2164, 1614,1444,2165,1613,1699,2166,1599,1698,2167,1419,1443,2168, 1419,1443,2169,1599,1698,2170,1598,1691,2171,1373,1591,2172, 1379,1561,2173,1591,1944,2174,1590,1947,2175,1421,1569,2176, 1421,1428,2177,1590,1700,2178,1589,1701,2179,1420,1427,2180, 1524,1659,2181,1597,1702,2182,1596,1693,2150,1383,1589,2149, 1568,1704,2183,1579,1707,2184,1578,1706,2185,1567,1705,2186, 1570,1710,2187,1581,1711,2188,1580,1709,2189,1569,1708,2190, 1571,1712,2191,1582,1713,2192,1581,1711,2193,1570,1710,2194, 1572,1714,2195,1583,1717,2196,1605,1716,2197,1604,1715,2198, 1573,1718,2199,1584,1719,2200,1583,1717,2201,1572,1714,2202, 1574,1720,2203,1585,1721,2204,1584,1719,2200,1573,1718,2199, 1576,1724,2205,1587,1725,2206,1586,1723,2207,1575,1722,2208, 1612,1726,2209,1611,1727,2210,1587,1725,2211,1576,1724,2212, 1567,1705,2213,1578,1706,2214,1588,1729,2215,1577,1728,2216, 1579,1707,2184,1618,1731,2217,1617,1730,2218,1578,1706,2185, 1581,1711,2188,1620,1733,2219,1619,1732,2220,1580,1709,2189, 1582,1713,2192,1621,1734,2221,1620,1733,2222,1581,1711,2193, 1583,1717,2196,1623,1736,2223,1622,1735,2224,1605,1716,2197, 1584,1719,2200,1624,1737,2225,1623,1736,2226,1583,1717,2201, 1585,1721,2204,1625,1738,2227,1624,1737,2225,1584,1719,2200, 1587,1725,2206,1627,1740,2228,1626,1739,2229,1586,1723,2207, 1611,1727,2210,1628,1741,2230,1627,1740,2231,1587,1725,2211, 1578,1706,2214,1617,1730,2232,1629,1742,2233,1588,1729,2215, 1590,1700,2178,1567,1705,2213,1577,1728,2216,1589,1701,2179, 1591,1690,2174,1568,1704,2183,1567,1705,2186,1590,1700,2175, 1593,1945,2162,1570,1949,2187,1569,1948,2190,1592,1946,2163, 1594,1696,2158,1571,1712,2191,1570,1710,2194,1593,1695,2159, 1595,1692,2154,1572,1714,2195,1604,1715,2198,1603,1694,2155, 1596,1693,2150,1573,1718,2199,1572,1714,2202,1595,1692,2151, 1597,1702,2182,1574,1720,2203,1573,1718,2199,1596,1693,2150, 1599,1698,2170,1576,1724,2205,1575,1722,2208,1598,1691,2171, 1613,1699,2166,1612,1726,2209,1576,1724,2212,1599,1698,2167, 1123,1129,1319,1124,1130,1320,1717,1431,1836,1716,1416,1819, 1399,1418,1824,1370,1520,1921,1600,1519,1918,1601,1435,1839, 1602,1436,1838,1433,1417,1821,1399,1418,1824,1601,1435,1839, 1603,1694,2155,1594,1696,2158,1433,1417,2157,1602,1436,2156, 1604,1715,2198,1571,1712,2191,1594,1696,2158,1603,1694,2155, 1605,1716,2197,1582,1713,2192,1571,1712,2191,1604,1715,2198, 1622,1735,2224,1621,1734,2221,1582,1713,2192,1605,1716,2197, 1606,1481,1878,1607,1478,1877,1857,1743,2234, 1857,1743,2234,1607,1478,1877,1608,1660,2107,1858,1744,2235, 1860,1745,2236,1787,1748,2237,1779,1747,2238,1861,1746,2239, 1862,1749,2240,1609,1553,1956,1610,1554,1959, 1588,1729,2215,1629,1742,2233,1628,1741,2230,1611,1727,2210, 1577,1728,2216,1588,1729,2215,1611,1727,2210,1612,1726,2209, 1589,1701,2179,1577,1728,2216,1612,1726,2209,1613,1699,2166, 1420,1427,2180,1589,1701,2179,1613,1699,2166,1614,1444,2165, 1392,1426,1832,1420,1427,1831,1614,1444,1846,1615,1441,1845, 1371,1502,1904,1392,1426,1832,1615,1441,1845,1616,1503,1906, 1692,1445,1850,1099,1102,1288,1100,1103,1289,1693,1430,1833, 1618,1731,2217,1809,1751,2241,1808,1750,2242,1617,1730,2218, 1620,1733,2219,1813,1755,2243,1812,1754,2244,1619,1732,2220, 1621,1734,2221,1814,1756,2245,1813,1755,2246,1620,1733,2222, 1815,1757,2247,1814,1756,2245,1621,1734,2221,1622,1735,2224, 1623,1736,2223,1816,1758,2248,1815,1757,2247,1622,1735,2224, 1624,1737,2225,1817,1759,2249,1816,1758,2250,1623,1736,2226, 1625,1738,2227,1818,1760,2251,1817,1759,2249,1624,1737,2225, 1627,1740,2228,1821,1763,2252,1820,1762,2253,1626,1739,2229, 1628,1741,2230,1822,1764,2254,1821,1763,2255,1627,1740,2231, 1629,1742,2233,1823,1765,2256,1822,1764,2254,1628,1741,2230, 1617,1730,2232,1808,1750,2257,1823,1765,2256,1629,1742,2233, 1430,1474,2258,1663,1769,2259,1678,1768,2260,1396,1473,2261, 1381,1770,2262,1665,1772,2263,1664,1771,2264,1429,1566,2265, 1429,1566,2266,1664,1771,2267,1756,1773,2268,1755,1565,2269, 1863,1774,2270,1732,1777,2271,1727,1776,2272,1864,1775,2273, 1396,1473,2261,1678,1768,2260,1677,1778,2274,1520,1655,2275, 1519,1779,2276,1666,1780,2277,1665,1772,2263,1381,1770,2262, 1649,1781,2278,1647,1784,2279,1670,1783,2280,1669,1782,2281, 1674,1785,2282,1673,1788,2283,1644,1787,2284,1648,1786,2285, 1673,1788,2283,1734,1790,2286,1733,1789,2287,1644,1787,2284, 1740,1791,2288,1725,1793,2289,1724,1792,2290, 1736,1794,2291,1640,1797,2292,1671,1796,2293,1737,1795,2294, 1395,1392,2295,1676,1766,2296,1675,1799,2297,1659,1798,2298, 1765,1800,2299,1662,1801,2300,1365,1507,1909,1766,1508,1911, 1668,1802,2301,1667,1767,2302,1365,1507,2303,1662,1801,2304, 1687,1360,1780,1094,1097,1283,1095,1098,1284,1688,1460,1862, 1651,1456,1860,1394,1393,1802,1377,1509,1910,1650,1506,1908, 1652,1457,1859,1418,1394,1803,1394,1393,1802,1651,1456,1860, 1653,1454,1955,1376,1391,1953,1418,1394,1803,1652,1457,1859, 1655,1477,1876,1382,1472,1871,1521,1654,2101,1654,1657,2104, 1656,1449,1853,1431,1475,1872,1382,1472,1871,1655,1477,1876, 1431,1475,1872,1656,1449,1853,1657,1450,1856,1397,1564,1987, 1658,1516,1917,1375,1563,1984,1397,1564,1987,1657,1450,1856, 1681,1447,1851,1088,1091,1275,1089,1092,1276,1682,1562,1983, 1659,1798,2298,1675,1799,2297,1674,1785,2282,1648,1786,2285, 1739,1804,2305,1762,1803,2306,1638,1805,2307, 1638,1805,2307,1762,1803,2306,1661,1552,1951, 1761,1551,1952,1661,1552,1951,1762,1803,2306, 1669,1782,2281,1668,1802,2301,1662,1801,2304,1649,1781,2278, 1764,1806,2308,1649,1781,2309,1662,1801,2300,1765,1800,2299, 1664,1771,2267,1637,1515,2310,1757,1512,2311,1756,1773,2268, 1665,1772,2263,1636,1514,2312,1637,1515,2313,1664,1771,2264, 1666,1780,2277,1633,1653,2314,1636,1514,2312,1665,1772,2263, 1661,1552,2315,1632,1511,2316,1667,1767,2302,1668,1802,2301, 1638,1805,2317,1661,1552,2315,1668,1802,2301,1669,1782,2281, 1670,1783,2280,1646,1807,2318,1638,1805,2317,1669,1782,2281, 1671,1796,2293,1642,1809,2319,1738,1808,2320,1737,1795,2294, 1864,1775,2273,1727,1776,2272,1729,1811,2321,1865,1810,2322, 1645,1812,2323,1735,1813,2324,1734,1790,2286,1673,1788,2283, 1639,1814,2325,1645,1812,2323,1673,1788,2283,1674,1785,2282, 1675,1799,2297,1660,1815,2326,1639,1814,2325,1674,1785,2282, 1676,1766,2296,1630,1816,2327,1660,1815,2326,1675,1799,2297, 1678,1768,2260,1634,1818,2328,1631,1817,2329,1677,1778,2274, 1663,1769,2259,1635,1819,2330,1634,1818,2328,1678,1768,2260, 1680,1448,1852,1474,1517,1916,1466,1587,2006,1679,1597,2017, 1658,1516,1917,1474,1517,1916,1680,1448,1852,1681,1447,1851, 1682,1562,1983,1375,1563,1984,1658,1516,1917,1681,1447,1851, 1683,1470,1870,1429,1566,1985,1375,1563,1984,1682,1562,1983, 1684,1471,1869,1381,1770,2331,1429,1566,1985,1683,1470,1870, 1685,1651,2098,1519,1779,2332,1381,1770,2331,1684,1471,1869, 1377,1509,1910,1365,1507,1909,1686,1361,1781,1687,1360,1780, 1688,1460,1862,1650,1506,1908,1377,1509,1910,1687,1360,1780, 1481,1505,1907,1650,1506,1908,1688,1460,1862,1689,1459,1861, 1473,1595,2015,1481,1505,1907,1689,1459,1861,1690,1596,2016, 1374,1504,1905,1473,1595,2015,1690,1596,2016,1691,1446,1849, 1616,1503,1906,1374,1504,1905,1691,1446,1849,1692,1445,1850, 1371,1502,1904,1616,1503,1906,1692,1445,1850,1693,1430,1833, 1380,1501,1903,1371,1502,1904,1693,1430,1833,1694,1429,1834, 1366,1613,1902,1380,1614,1903,1694,1576,1834,1695,1575,1868, 1696,1489,1787,1458,1612,1901,1366,1613,1902,1695,1575,1868, 1367,1611,1900,1458,1612,1901,1879,1951,2333,1877,1952,2334, 1449,1610,1899,1367,1611,1900,1877,1952,2334,1876,1953,2335, 1411,1640,1988,1880,1641,1989,1872,1642,1991,1697,1631,1948, 1457,1954,2336,1411,1640,1988,1697,1631,1948,1698,1630,1947, 1906,1955,2337,1457,1954,2336,1907,1956,2338, 1700,1549,1818,1482,1665,2020,1900,1957,2339,1912,1650,2018, 1417,1607,1896,1482,1665,2020,1700,1549,1818,1701,1466,1778, 1428,1608,1897,1417,1607,1896,1701,1466,1778,1702,1465,1779, 1362,1639,1981,1428,1608,1897,1702,1465,1779,1703,1467,1982, 1703,1467,1982,1704,1943,1894,1388,1616,1929,1362,1639,1981, 1441,1528,1928,1388,1529,1929,1704,1493,1894,1705,1492,1895, 1706,1402,1812,1412,1527,1926,1441,1528,1928,1705,1492,1895, 1488,1526,1927,1412,1527,1926,1706,1402,1812,1707,1401,1811, 1708,1571,1992,1368,1573,1994,1488,1526,1927,1707,1401,1811, 1709,1532,1933,1450,1537,1935,1368,1573,1994,1708,1571,1992, 1710,1533,1932,1406,1536,1936,1450,1537,1935,1709,1532,1933, 1711,1366,1785,1442,1525,1925,1406,1536,1936,1710,1533,1932, 1712,1367,1784,1363,1524,1923,1442,1525,1925,1711,1366,1785, 1465,1523,1924,1363,1524,1923,1712,1367,1784,1713,1375,1788, 1714,1461,1863,1364,1522,1922,1465,1523,1924,1713,1375,1788, 1715,1415,1820,1378,1521,1920,1364,1522,1922,1714,1461,1863, 1716,1416,1819,1370,1520,1921,1378,1521,1920,1715,1415,1820, 1717,1431,1836,1600,1519,1918,1370,1520,1921,1716,1416,1819, 1718,1432,1835,1372,1518,1919,1600,1519,1918,1717,1431,1836, 1679,1597,2017,1466,1587,2006,1372,1518,1919,1718,1432,1835, 1125,1131,2340,1976,2025,2341,1977,2026,2342,1718,1432,2343, 1718,1432,2344,1977,2026,2345,1978,2027,2346,1679,1597,2347, 1722,1829,2348,1671,1796,2349,1640,1797,2350,1721,1830,2351, 1723,1831,2352,1642,1809,2353,1671,1796,2349,1722,1829,2348, 1642,1809,2354,1723,1831,2355,1724,1792,2290,1725,1793,2289, 1725,1793,2289,1867,1832,2356,1738,1808,2357,1642,1809,2354, 1735,1813,2358,1645,1812,2359,1869,1833,2360, 1672,1834,2361,1643,1837,2362,1730,1836,2363,1728,1835,2364, 1641,1838,2365,1672,1834,2361,1728,1835,2364,1726,1839,2366, 1944,1840,2367,1868,1841,2368,1641,1838,2369,1726,1839,2370, 1729,1811,2321,1727,1776,2272,1728,1835,2364,1730,1836,2363, 1727,1776,2272,1732,1777,2271,1726,1839,2366,1728,1835,2364, 1734,1790,2286,1672,1834,2371,1641,1838,2372,1733,1789,2287, 1735,1813,2324,1643,1837,2373,1672,1834,2371,1734,1790,2286, 1647,1784,2279,1736,1794,2291,1737,1795,2294,1670,1783,2280, 1738,1808,2320,1646,1807,2318,1670,1783,2280,1737,1795,2294, 1646,1807,2374,1738,1808,2357,1867,1832,2356, 1947,1842,2375,1732,1777,2376,1863,1774,2377,1946,1843,2378, 1638,1805,2379,1646,1807,2374,1867,1832,2356, 1648,1786,2380,1868,1841,2368,1944,1840,2367, 1764,1806,2308,1947,1842,2375,1946,1843,2378, 1869,1833,2360,1645,1812,2359,1639,1814,2381, 1865,1810,2382,1729,1811,2383,1763,1844,2384, 1762,1803,2385,1739,1804,2386,1740,1791,2288,1763,1844,2384, 2061,2110,2387,2062,2111,2388,2047,2096,2389,1148,1154,2390, 1741,1827,2391,2064,2113,2392,2065,2114,2393,1742,1828,2394, 2068,2117,2395,2069,2118,2396,2045,2094,2397,1150,1156,2398, 1743,1845,2399,2071,2120,2400,2072,2121,2401,1744,1846,2402, 2077,2126,2403,2078,2127,2404,2043,2092,2405,1152,1158,2406, 1745,1847,2407,2080,2129,2408,2081,2130,2409,1746,1848,2410, 2084,2133,2411,2085,2134,2412,2041,2090,2413,1154,1160,2414, 1747,1849,2415,2087,2136,2416,2088,2137,2417,1748,1850,2418, 2093,2142,2419,2094,2143,2420,2039,2088,2421,1156,1162,2422, 1749,1851,2423,2096,2145,2424,2097,2146,2425,1750,1852,2426, 2100,2149,2427,2101,2150,2428,2037,2086,2429,1158,1164,2430, 1751,1853,2431,2103,2152,2432,2104,2153,2433,1752,1854,2434, 2109,2158,2435,2110,2159,2436,2035,2084,2437,1160,1166,2438, 1753,1855,2439,2112,2161,2440,2113,2162,2441,1754,1856,2442, 1755,1565,1986,1430,1474,1873,1397,1564,1987, 1756,1773,2268,1663,1769,2443,1430,1474,2444,1755,1565,2269, 1757,1512,2311,1635,1819,2445,1663,1769,2443,1756,1773,2268, 1635,1819,2446,1757,1512,1912,1758,1513,1915,1634,1818,2447, 1634,1818,2447,1758,1513,1915,1759,1652,2100,1631,1817,2448, 1660,1815,2449,1630,1816,2450,1760,1510,1949,1761,1551,1952, 1639,1814,2451,1660,1815,2449,1761,1551,1952,1762,1803,2306, 1731,1857,2452,1639,1814,2381,1762,1803,2385,1763,1844,2384, 1763,1844,2384,1729,1811,2383,1730,1836,2453,1731,1857,2452, 1648,1786,2380,1944,1840,2367,1947,1842,2375,1764,1806,2308, 1659,1798,2454,1648,1786,2380,1764,1806,2308,1765,1800,2299, 1395,1392,1804,1659,1798,2454,1765,1800,2299,1766,1508,1911, 1394,1393,1802,1395,1392,1804,1766,1508,1911, 1553,1557,2455,1768,1421,2456,1852,1422,2457,1851,1560,2458, 1854,1858,2459,1770,1859,2460,1555,1662,2461,1855,1663,2462, 1792,1860,2463,1791,1424,2464,1768,1421,2465,1553,1557,2466, 1609,1553,2467,1772,1861,2468,1782,1438,2469, 1556,1862,2470,1771,1865,2471,1784,1864,2472,1783,1863,2473, 1839,1866,2474,1781,1867,2475,1608,1660,2476,1840,1661,2477, 1861,1746,2478,1779,1747,2479,1609,1553,2467,1862,1749,2480, 1608,1660,2476,1780,1869,2481,1859,1868,2482,1858,1744,2483, 1775,1870,2484,1767,1872,2485,1552,1871,2486, 1790,1873,2487,1789,1874,2488,1767,1872,2489,1775,1870,2490, 1554,1875,2491,1769,1877,2492,1776,1876,2493, 1777,1878,2494,1769,1877,2492,1554,1875,2491, 1767,1872,2489,1789,1874,2488,1788,1880,2495,1778,1879,2496, 1552,1871,2486,1767,1872,2485,1778,1879,2497, 1779,1747,2479,1772,1861,2468,1609,1553,2467, 1787,1748,2237,1786,1881,2498,1772,1861,2499,1779,1747,2238, 1608,1660,2476,1774,1882,2500,1780,1869,2481, 1781,1867,2475,1774,1882,2500,1608,1660,2476, 1772,1861,2499,1786,1881,2498,1785,1437,1841,1782,1438,1844, 1609,1553,2467,1782,1438,2469,1837,1439,2501,1836,1556,2502, 1685,1651,2098,1092,1095,1280,1093,1096,1282,1686,1361,1781, 1519,1779,2332,1685,1651,2098,1686,1361,1781,1365,1507,1909, 1666,1780,2277,1519,1779,2276,1365,1507,2303,1667,1767,2302, 1633,1653,2314,1666,1780,2277,1667,1767,2302,1632,1511,2316, 1759,1652,2100,1633,1653,2099,1632,1511,1950,1760,1510,1949, 1630,1816,2450,1631,1817,2448,1759,1652,2100,1760,1510,1949, 1676,1766,2296,1677,1778,2274,1631,1817,2329,1630,1816,2327, 1395,1392,2295,1520,1655,2275,1677,1778,2274,1676,1766,2296, 1521,1654,2101,1520,1655,2102,1395,1392,1804,1376,1391,1953, 1653,1454,1955,1654,1657,2104,1521,1654,2101,1376,1391,1953, 1522,1656,2103,1654,1657,2104,1653,1454,1955,1478,1453,1954, 1523,1658,2105,1522,1656,2103,1478,1453,1954,1470,1592,2012, 1524,1659,2106,1523,1658,2105,1470,1592,2012,1373,1591,2011, 1597,1702,2182,1524,1659,2181,1373,1591,2172,1598,1691,2171, 1574,1720,2203,1597,1702,2182,1598,1691,2171,1575,1722,2208, 1585,1721,2204,1574,1720,2203,1575,1722,2208,1586,1723,2207, 1625,1738,2227,1585,1721,2204,1586,1723,2207,1626,1739,2229, 1819,1761,2503,1626,1739,2229,1820,1762,2253, 1784,1864,2472,1773,1884,2504,1557,1883,2505,1783,1863,2473, 1781,1867,2506,1839,1866,2507,1838,1440,1842,1785,1437,1841, 1786,1881,2498,1774,1882,2508,1781,1867,2506,1785,1437,1841, 1780,1869,2509,1774,1882,2508,1786,1881,2498,1787,1748,2237, 1859,1868,2510,1780,1869,2509,1787,1748,2237,1860,1745,2236, 1789,1874,2488,1769,1877,2511,1777,1878,2512,1788,1880,2495, 1776,1876,2513,1769,1877,2511,1789,1874,2488,1790,1873,2487, 1791,1424,1826,1770,1859,2514,1854,1858,2515,1853,1423,1827, 1555,1662,2516,1770,1859,2517,1791,1424,2464,1792,1860,2463, 1811,1753,2518,1619,1732,2220,1812,1754,2244, 1579,1707,2184,1580,1709,2189,1619,1732,2220,1618,1731,2217, 1568,1704,2183,1569,1708,2190,1580,1709,2189,1579,1707,2184, 1591,1690,2174,1592,1946,2163,1569,1948,2190,1568,1704,2183, 1384,1580,2164,1592,1946,2163,1591,1944,2174,1379,1561,2173, 1794,1927,2097,1525,1930,2116,1544,1928,2111,1793,1669,2029, 1795,1926,2096,1542,1929,2113,1525,1930,2116,1794,1927,2097, 1796,1911,2077,1526,1932,2120,1542,1929,2113,1795,1926,2096, 1797,1821,2067,1527,1931,2117,1526,1932,2120,1796,1911,2077, 1798,1685,2057,1528,1933,2121,1527,1931,2117,1797,1821,2067, 1799,1498,2056,1529,1934,2123,1528,1933,2121,1798,1685,2057, 1530,1935,2128,1529,1934,2127,1799,1498,1793,1800,1497,1792, 1531,1936,2130,1530,1935,2128,1800,1497,1792,1801,1617,1930, 1532,1937,2134,1531,1936,2133,1801,1617,2045,1802,1678,2044, 1533,1938,2136,1532,1937,2134,1802,1678,2044,1803,1689,2061, 1534,1939,2138,1533,1938,2136,1803,1689,2061,1804,1825,2071, 1538,1940,2141,1534,1939,2138,1804,1825,2071,1805,1919,2085, 1535,1941,2142,1538,1940,2141,1805,1919,2085,1806,1918,2084, 1548,1942,2145,1535,1941,2142,1806,1918,2084,1807,1672,2146, 1809,1751,2241,1841,1885,2519,1566,1558,2520,1808,1750,2242, 1825,1886,2521,1843,1889,2522,1842,1888,2523,1824,1887,2524, 1828,1890,2525,1844,1891,2526,1843,1889,2522,1825,1886,2521, 1812,1754,2244,1562,1482,2527,1845,1892,2528,1811,1753,2518, 1813,1755,2243,1563,1485,2529,1562,1482,2527,1812,1754,2244, 1814,1756,2245,1561,1484,2530,1563,1485,2531,1813,1755,2246, 1606,1481,2532,1561,1484,2530,1814,1756,2245,1815,1757,2247, 1816,1758,2248,1560,1480,2533,1606,1481,2532,1815,1757,2247, 1817,1759,2249,1558,1479,2534,1560,1480,2535,1816,1758,2250, 1850,1893,2536,1557,1883,2537,1558,1479,2534, 1831,1894,2538,1833,1897,2539,1849,1896,2540,1848,1895,2541, 1847,1898,2542,1835,1899,2543,1831,1894,2538,1848,1895,2541, 1565,1555,2544,1556,1862,2545,1846,1900,2546, 1822,1764,2254,1610,1554,2547,1565,1555,2548,1821,1763,2255, 1823,1765,2256,1564,1559,2549,1610,1554,2547,1822,1764,2254, 1808,1750,2257,1566,1558,2550,1564,1559,2549,1823,1765,2256, 1810,1752,2551,1825,1886,2552,1824,1887,2553,1809,1751,2554, 1809,1751,2555,1824,1887,2556,1842,1888,2557,1841,1885,2558, 1553,1557,2559,1826,1902,2560,1827,1901,2561,1792,1860,2562, 1811,1753,2563,1828,1890,2564,1825,1886,2552,1810,1752,2551, 1792,1860,2562,1827,1901,2561,1829,1903,2565,1555,1662,2566, 1844,1891,2567,1828,1890,2568,1811,1753,2569,1845,1892,2570, 1819,1761,2571,1830,1905,2572,1832,1904,2573,1818,1760,2574, 1849,1896,2575,1833,1897,2576,1557,1883,2577,1850,1893,2578, 1557,1883,2579,1833,1897,2580,1831,1894,2581,1783,1863,2582, 1820,1762,2583,1834,1906,2584,1830,1905,2572,1819,1761,2571, 1783,1863,2582,1831,1894,2581,1835,1899,2585,1556,1862,2586, 1556,1862,2587,1835,1899,2588,1847,1898,2589,1846,1900,2590, 1836,1556,1957,1556,1862,2591,1565,1555,1958, 1837,1439,2501,1771,1865,2592,1556,1862,2593,1836,1556,2502, 1838,1440,1842,1784,1864,2594,1771,1865,2595,1837,1439,1843, 1839,1866,2507,1773,1884,2596,1784,1864,2594,1838,1440,1842, 1557,1883,2597,1773,1884,2598,1839,1866,2474,1840,1661,2477, 1558,1479,1880,1557,1883,2599,1840,1661,2108, 1841,1885,2519,1553,1557,2600,1566,1558,2520, 1842,1888,2557,1826,1902,2601,1553,1557,2602,1841,1885,2558, 1843,1889,2522,1827,1901,2603,1826,1902,2604,1842,1888,2523, 1844,1891,2526,1829,1903,2605,1827,1901,2603,1843,1889,2522, 1555,1662,2606,1829,1903,2607,1844,1891,2567,1845,1892,2570, 1562,1482,2527,1555,1662,2608,1845,1892,2528, 1821,1763,2252,1565,1555,2544,1846,1900,2546,1820,1762,2253, 1847,1898,2589,1834,1906,2609,1820,1762,2610,1846,1900,2590, 1834,1906,2611,1847,1898,2542,1848,1895,2541,1830,1905,2612, 1849,1896,2540,1832,1904,2613,1830,1905,2612,1848,1895,2541, 1818,1760,2614,1832,1904,2615,1849,1896,2575,1850,1893,2578, 1818,1760,2251,1850,1893,2536,1558,1479,2534,1817,1759,2249, 1851,1560,1961,1552,1871,2616,1564,1559,1962, 1852,1422,2457,1775,1870,2484,1552,1871,2486,1851,1560,2458, 1853,1423,1827,1790,1873,2487,1775,1870,2490,1852,1422,1828, 1854,1858,2515,1776,1876,2513,1790,1873,2487,1853,1423,1827, 1554,1875,2491,1776,1876,2493,1854,1858,2459,1855,1663,2462, 1856,1483,1884,1559,1907,2617,1554,1875,2618,1855,1663,2110, 1561,1484,1883,1559,1907,2617,1856,1483,1884, 1559,1907,2617,1561,1484,1883,1606,1481,1878,1857,1743,2234, 1554,1875,2618,1559,1907,2617,1857,1743,2234,1858,1744,2235, 1859,1868,2482,1777,1878,2494,1554,1875,2491,1858,1744,2483, 1777,1878,2512,1859,1868,2510,1860,1745,2236,1788,1880,2495, 1788,1880,2495,1860,1745,2236,1861,1746,2239,1778,1879,2496, 1552,1871,2486,1778,1879,2497,1861,1746,2478,1862,1749,2480, 1552,1871,2616,1862,1749,2240,1610,1554,1959,1564,1559,1962, 1722,1829,2348,1721,1830,2351,1863,1774,2270,1864,1775,2273, 1723,1831,2352,1722,1829,2348,1864,1775,2273,1865,1810,2322, 1740,1791,2288,1724,1792,2290,1763,1844,2384, 1865,1810,2382,1763,1844,2384,1723,1831,2355, 1724,1792,2290,1723,1831,2355,1763,1844,2384, 1866,1908,2619,1647,1784,2620,1649,1781,2309, 1736,1794,2621,1647,1784,2620,1866,1908,2619, 1740,1791,2288,1739,1804,2386,1725,1793,2289, 1638,1805,2379,1867,1832,2356,1739,1804,2386, 1739,1804,2386,1867,1832,2356,1725,1793,2289, 1644,1787,2622,1733,1789,2623,1868,1841,2368, 1648,1786,2380,1644,1787,2622,1868,1841,2368, 1731,1857,2452,1643,1837,2624,1735,1813,2358,1869,1833,2360, 1731,1857,2452,1869,1833,2360,1639,1814,2381, 1730,1836,2453,1643,1837,2624,1731,1857,2452, 1733,1789,2623,1641,1838,2369,1868,1841,2368, 1871,1958,2625,1282,1328,2626,1279,1327,2627, 1697,1631,1948,1870,1959,2628,1279,1327,2629,817,1329,1609, 1277,1331,2630,1280,1332,2631,1870,1959,2632,1697,1631,2633, 1870,1959,2634,1871,1958,2635,1279,1327,2636, 1280,1332,2637,1282,1328,2638,1871,1958,2639,1870,1959,2640, 1292,1347,2641,1872,1642,1991,1873,1960,2642, 1305,1346,1636,1893,1368,2643,1891,1468,1782,1303,1337,1627, 1895,1961,2644,1896,1962,2645,1894,1963,2646, 1897,1964,2647,1892,1469,1783,1891,1468,1782,1895,1961,2644, 1899,1965,2648,1892,1469,1783,1897,1964,2647,1898,1966,2649, 1304,1338,1628,1892,1469,1783,1899,1965,2648,1311,1339,1629, 1875,1967,2650,1881,1968,2651,1872,1642,1991,1880,1641,1989, 1410,1627,1944,1448,1543,1810,1874,1969,2652,1880,1641,1989, 1874,1969,2652,1943,1970,2653,1875,1967,2650,1880,1641,1989, 1881,1968,2651,1873,1960,2642,1872,1642,1991, 1895,1961,2644,1891,1468,1782,1893,1368,2643,1896,1962,2645, 1873,1960,2654,1882,1351,2655,1292,1347,2656, 1875,1967,2657,1883,1971,2658,1881,1968,2659, 1881,1968,2660,1883,1971,2661,1882,1351,2662,1873,1960,2663, 1875,1967,2664,1943,1970,2665,1942,1972,2666,1885,1973,2667, 1875,1967,2668,1885,1973,2669,1887,1974,2670,1883,1971,2671, 1877,1952,2672,1888,1975,2673,1886,1976,2674,1876,1953,2675, 1878,1488,2676,1890,1977,2677,1889,1978,2678,1879,1951,2679, 1879,1951,2680,1889,1978,2681,1888,1975,2682,1877,1952,2683, 1302,1365,2684,1890,1977,2685,1289,770,2686, 1289,770,2686,1890,1977,2685,864,772,2687, 1890,1977,2685,1878,1488,2688,864,772,2687, 1883,1971,2689,1887,1974,2690,1884,1352,2691,1882,1351,2692, 1885,1973,2693,1942,1972,2694,1894,1963,2695, 1885,1973,2696,1894,1963,2697,1896,1962,2698,1887,1974,2699, 1888,1975,2700,1897,1964,2701,1895,1961,2702,1886,1976,2703, 1890,1977,2704,1899,1965,2705,1898,1966,2706,1889,1978,2707, 1889,1978,2708,1898,1966,2709,1897,1964,2710,1888,1975,2711, 1311,1339,2712,1899,1965,2713,1890,1977,2714,1302,1365,2715, 1887,1974,2716,1896,1962,2717,1893,1368,2718,1884,1352,2719, 1927,1979,2720,1929,1980,2721,1928,1981,2722,1926,1982,2723, 1930,1983,2724,1931,1984,2725,1927,1979,2720,1926,1982,2723, 1932,1985,2726,1934,1986,2727,1933,1987,2728, 1936,1988,2729,1937,1989,2730,1932,1985,2726,1935,1990,2731, 1939,1991,2732,1937,1989,2730,1936,1988,2729,1938,1992,2733, 1940,1993,2734,1929,1980,2721,1937,1989,2730,1939,1991,2732, 1457,1954,2336,1906,1955,2337,1908,1648,2000, 1483,1546,1979,1425,1646,1998,1904,1994,2735,1909,1666,2021, 1932,1985,2726,1933,1987,2728,1935,1990,2731, 1417,1607,1896,1901,1609,1898,1482,1665,2020, 1911,1629,1946,1457,1954,2336,1908,1648,2000, 1457,1954,2336,1911,1629,1946,1410,1627,1944,1411,1640,1988, 1932,1985,2726,1927,1979,2720,1931,1984,2725,1934,1986,2727, 1699,1649,2001,1106,1395,1718,1324,1320,1302,1912,1650,2018, 1900,1957,2339,1907,1956,2338,1699,1649,2001,1912,1650,2018, 1927,1979,2720,1932,1985,2726,1937,1989,2730,1929,1980,2721, 1928,1981,2722,1929,1980,2721,1941,1995,2736, 1913,1664,2019,1900,1957,2339,1482,1665,2020, 1929,1980,2721,1940,1993,2734,1941,1995,2736, 1457,1954,2336,1698,1630,1947,1699,1649,2001,1907,1956,2338, 1902,1548,2737,1914,1996,2738,1915,1997,2739,1901,1609,2740, 1903,1547,2741,1916,1998,2742,1914,1996,2738,1902,1548,2737, 1909,1666,2743,1917,1999,2744,1916,1998,2745,1903,1547,2746, 1910,2000,2747,1918,2001,2748,1919,2002,2749,1904,1994,2750, 1908,1648,2751,1921,2003,2752,1920,2004,2753,1905,1647,2754, 1907,1956,2755,1923,2005,2756,1922,2006,2757,1906,1955,2758, 1906,1955,2759,1922,2006,2760,1921,2003,2761,1908,1648,2762, 1900,1957,2763,1924,2007,2764,1923,2005,2756,1907,1956,2755, 1905,1647,2754,1920,2004,2753,1918,2001,2748,1910,2000,2747, 1904,1994,2765,1919,2002,2766,1917,1999,2744,1909,1666,2743, 1901,1609,2740,1915,1997,2739,1925,2008,2767,1913,1664,2768, 1913,1664,2769,1925,2008,2770,1924,2007,2764,1900,1957,2763, 1914,1996,2738,1926,1982,2771,1928,1981,2772,1915,1997,2739, 1916,1998,2742,1930,1983,2773,1926,1982,2771,1914,1996,2738, 1917,1999,2744,1931,1984,2774,1930,1983,2775,1916,1998,2745, 1918,2001,2748,1933,1987,2776,1934,1986,2777,1919,2002,2749, 1921,2003,2752,1936,1988,2778,1935,1990,2779,1920,2004,2753, 1923,2005,2756,1939,1991,2780,1938,1992,2781,1922,2006,2757, 1922,2006,2760,1938,1992,2782,1936,1988,2783,1921,2003,2761, 1924,2007,2764,1940,1993,2784,1939,1991,2780,1923,2005,2756, 1920,2004,2753,1935,1990,2779,1933,1987,2776,1918,2001,2748, 1919,2002,2766,1934,1986,2785,1931,1984,2774,1917,1999,2744, 1915,1997,2739,1928,1981,2772,1941,1995,2786,1925,2008,2767, 1925,2008,2770,1941,1995,2787,1940,1993,2784,1924,2007,2764, 1458,1612,1901,1696,1489,1787,1878,1488,1786,1879,1951,2333, 1942,1972,2694,1886,1976,2788,1895,1961,2789,1894,1963,2695, 1943,1970,2665,1876,1953,2790,1886,1976,2791,1942,1972,2666, 1874,1969,2652,1449,1610,1899,1876,1953,2335,1943,1970,2653, 1448,1543,1810,1449,1610,1899,1874,1969,2652, 1726,1839,2370,1732,1777,2376,1947,1842,2375,1944,1840,2367, 1945,1950,2792,1866,1908,2619,1649,1781,2309, 1736,1794,2621,1866,1908,2619,1945,1950,2792,1640,1797,2793, 1945,1950,2792,1721,1830,2794,1640,1797,2793, 1945,1950,2792,1649,1781,2309,1764,1806,2308,1946,1843,2378, 1863,1774,2377,1721,1830,2794,1945,1950,2792,1946,1843,2378, 1904,1994,2735,1948,1625,1942,1910,2000,2795, 1456,1628,1945,1905,1647,1999,1948,1625,1942, 1948,1625,1942,1905,1647,1999,1910,2000,2795, 1695,1575,1868,1102,1308,1291,1103,783,771,1696,1489,1787, 1283,1314,1296,1872,1642,1991,1292,1347,2641, 1283,1314,1296,1292,1347,2641,1284,1345,1635, 817,1329,1609,1105,1316,1298,1698,1630,1947, 1105,1316,1298,817,1329,1609,1104,1313,1295, 1277,1331,1990,1283,1314,1296,1104,1313,1295, 1277,1331,1990,1872,1642,1991,1283,1314,1296, 1425,1646,1998,1455,1637,1976,1948,1625,1942,1904,1994,2735, 1455,1637,1976,1424,1636,1975,1949,1626,1943,1948,1625,1942, 1950,1542,1809,1949,1626,1943,1424,1636,1975,1447,1635,1972, 1447,1635,1972,1423,1634,1970,1951,1531,1806,1950,1542,1809, 1952,1540,1807,1951,1531,1806,1423,1634,1970,1460,1633,1969, 1953,1568,1867,1952,1540,1807,1460,1633,1969,1422,1632,1966, 1421,1569,1830,1953,1568,1867,1422,1632,1966, 1316,937,955,1322,1407,2796,1954,916,925, 862,928,930,1954,916,925,1317,938,956, 1322,1407,2796,1317,938,956,1954,916,925, 1955,917,926,1954,916,925,862,928,930,815,927,929, 815,927,929,854,898,876,1956,820,798,1955,917,926, 1957,813,793,1956,820,798,854,898,876,794,897,875, 794,897,875,866,900,878,1958,814,794,1957,813,793, 866,900,878,795,904,881,1959,848,852,1958,814,794, 795,904,881,796,903,818,827,849,821,1959,848,852, 1154,1160,2414,2041,2090,2413,2042,2091,2797,1960,2009,2798, 1962,2011,2799,1961,2010,2800,1747,1849,2415,1748,1850,2418, 1155,1161,1394,1963,2012,2801,2025,2074,2802,2026,2075,1395, 1960,2009,2803,1963,2012,2804,1155,1161,1398,1154,1160,1397, 1156,1162,2422,2039,2088,2421,2040,2089,2805,1964,2013,2806, 1966,2015,2807,1965,2014,2808,1749,1851,2423,1750,1852,2426, 1157,1163,1403,1967,2016,2809,2027,2076,2810,2028,2077,1404, 1964,2013,2811,1967,2016,2812,1157,1163,1406,1156,1162,1405, 1968,2017,2813,1751,1853,2431,1752,1854,2434,1969,2018,2814, 1159,1165,1410,1970,2019,2815,2029,2078,2816,2030,2079,1411, 1971,2020,2817,1970,2019,2818,1159,1165,1414,1158,1164,1413, 1158,1164,2430,2037,2086,2429,2038,2087,2819,1971,2020,2820, 1160,1166,2438,2035,2084,2437,2036,2085,2821,1972,2021,2822, 1974,2023,2823,1973,2022,2824,1753,1855,2439,1754,1856,2442, 1161,1167,1419,1975,2024,2825,2031,2080,2826,2032,2081,1420, 1972,2021,2827,1975,2024,2828,1161,1167,1422,1160,1166,1421, 1976,2025,2341,1980,2029,2829,2057,2106,2830, 1978,2027,2346,1977,2026,2345,1981,2030,2831,1982,2031,2832, 1982,2031,2833,2059,2108,2834,1978,2027,1326, 1976,2025,1325,1979,2028,1324,1983,2032,2835,1980,2029,2836, 1980,2029,2829,1148,1154,2390,2047,2096,2389,2057,2106,2830, 1982,2031,2832,1981,2030,2831,1741,1827,2391,1742,1828,2394, 1992,2041,2837,2059,2108,2834,1982,2031,2833,1742,1828,2838, 1980,2029,2836,1983,2032,2835,1149,1155,1374,1148,1154,1373, 1150,1156,2398,2045,2094,2397,2046,2095,2839,1984,2033,2840, 1986,2035,2841,1985,2034,2842,1743,1845,2399,1744,1846,2402, 1151,1157,1378,1987,2036,2843,2021,2070,2844,2022,2071,1379, 1984,2033,2845,1987,2036,2846,1151,1157,1382,1150,1156,1381, 1152,1158,2406,2043,2092,2405,2044,2093,2847,1988,2037,2848, 1990,2039,2849,1989,2038,2850,1745,1847,2407,1746,1848,2410, 1153,1159,1387,1991,2040,2851,2023,2072,2852,2024,2073,1388, 1988,2037,2853,1991,2040,2854,1153,1159,1390,1152,1158,1389, 2066,2115,2855,1992,2041,2837,1742,1828,2838,2065,2114,2856, 1994,2043,2857,1993,2042,2858,1986,2035,2859,1744,1846,2860, 2073,2122,2861,1994,2043,2857,1744,1846,2860,2072,2121,2862, 1996,2045,2863,1995,2044,2864,1990,2039,2865,1746,1848,2866, 2082,2131,2867,1996,2045,2863,1746,1848,2866,2081,2130,2868, 1998,2047,2869,1997,2046,2870,1962,2011,2871,1748,1850,2872, 2089,2138,2873,1998,2047,2869,1748,1850,2872,2088,2137,2874, 2000,2049,2875,1999,2048,2876,1966,2015,2877,1750,1852,2878, 2098,2147,2879,2000,2049,2875,1750,1852,2878,2097,2146,2880, 2002,2051,2881,2001,2050,2882,1969,2018,2883,1752,1854,2884, 2105,2154,2885,2002,2051,2881,1752,1854,2884,2104,2153,2886, 2004,2053,2887,2003,2052,2888,1974,2023,2889,1754,1856,2890, 2114,2163,2891,2004,2053,2887,1754,1856,2890,2113,2162,2892, 2006,2055,2893,2005,2054,2894,1720,1585,2895,1719,1584,2896, 2007,2056,2897,2111,2160,2898,2112,2161,2899,1753,1855,2900, 2008,2057,2901,2007,2056,2897,1753,1855,2900,1973,2022,2902, 2009,2058,2903,2102,2151,2904,2103,2152,2905,1751,1853,2906, 2010,2059,2907,2009,2058,2903,1751,1853,2906,1968,2017,2908, 2011,2060,2909,2095,2144,2910,2096,2145,2911,1749,1851,2912, 2012,2061,2913,2011,2060,2909,1749,1851,2912,1965,2014,2914, 2013,2062,2915,2086,2135,2916,2087,2136,2917,1747,1849,2918, 2014,2063,2919,2013,2062,2915,1747,1849,2918,1961,2010,2920, 2015,2064,2921,2079,2128,2922,2080,2129,2923,1745,1847,2924, 2016,2065,2925,2015,2064,2921,1745,1847,2924,1989,2038,2926, 2017,2066,2927,2070,2119,2928,2071,2120,2929,1743,1845,2930, 2018,2067,2931,2017,2066,2927,1743,1845,2930,1985,2034,2932, 2019,2068,2933,2063,2112,2934,2064,2113,2935,1741,1827,2936, 2067,2116,1369,2020,2069,1372,1992,2041,2837,2066,2115,2855, 2022,2071,1379,2021,2070,2844,1993,2042,2858,1994,2043,2857, 2074,2123,1380,2022,2071,1379,1994,2043,2857,2073,2122,2861, 2024,2073,1388,2023,2072,2852,1995,2044,2864,1996,2045,2863, 2083,2132,1385,2024,2073,1388,1996,2045,2863,2082,2131,2867, 2026,2075,1395,2025,2074,2802,1997,2046,2870,1998,2047,2869, 2090,2139,1396,2026,2075,1395,1998,2047,2869,2089,2138,2873, 2028,2077,1404,2027,2076,2810,1999,2048,2876,2000,2049,2875, 2099,2148,1401,2028,2077,1404,2000,2049,2875,2098,2147,2879, 2030,2079,1411,2029,2078,2816,2001,2050,2882,2002,2051,2881, 2106,2155,1412,2030,2079,1411,2002,2051,2881,2105,2154,2885, 2032,2081,1420,2031,2080,2826,2003,2052,2888,2004,2053,2887, 2115,2164,1417,2032,2081,1420,2004,2053,2887,2114,2163,2891, 2034,2083,2004,2033,2082,2003,2005,2054,2894,2006,2055,2893, 2035,2084,2437,2110,2159,2436,2111,2160,2898,2007,2056,2897, 2036,2085,2821,2035,2084,2437,2007,2056,2897,2008,2057,2901, 2037,2086,2429,2101,2150,2428,2102,2151,2904,2009,2058,2903, 2038,2087,2819,2037,2086,2429,2009,2058,2903,2010,2059,2907, 2039,2088,2421,2094,2143,2420,2095,2144,2910,2011,2060,2909, 2040,2089,2805,2039,2088,2421,2011,2060,2909,2012,2061,2913, 2041,2090,2413,2085,2134,2412,2086,2135,2916,2013,2062,2915, 2042,2091,2797,2041,2090,2413,2013,2062,2915,2014,2063,2919, 2043,2092,2405,2078,2127,2404,2079,2128,2922,2015,2064,2921, 2044,2093,2847,2043,2092,2405,2015,2064,2921,2016,2065,2925, 2045,2094,2397,2069,2118,2396,2070,2119,2928,2017,2066,2927, 2046,2095,2839,2045,2094,2397,2017,2066,2927,2018,2067,2931, 2047,2096,2389,2062,2111,2388,2063,2112,2934,2019,2068,2933, 1126,1132,2937,2034,2083,2938,2049,2098,2939,2048,2097,2940, 2050,2099,2941,2049,2098,2939,2034,2083,2938,2006,2055,2942, 2051,2100,2943,2050,2099,2941,2006,2055,2942,1719,1584,2944, 2052,2101,2945,2051,2100,2946,1719,1584,2947,1720,1585,2948, 2005,2054,2949,2053,2102,2950,2052,2101,2951,1720,1585,2952, 2033,2082,2953,2054,2103,2954,2053,2102,2950,2005,2054,2949, 1127,1133,2955,2055,2104,2956,2054,2103,2954,2033,2082,2953, 2048,2097,2957,2055,2104,2958,1127,1133,2959,1126,1132,2960, 2056,2105,2961,2019,2068,2933,1741,1827,2936,1981,2030,2962, 1977,2026,2342,2056,2105,2961,1981,2030,2962, 2057,2106,2830,2047,2096,2389,2019,2068,2933,2056,2105,2961, 1976,2025,2341,2057,2106,2830,2056,2105,2961,1977,2026,2342, 2020,2069,1372,1149,1155,1371,1983,2032,2963,2058,2107,2964, 1979,2028,1327,2058,2107,2964,1983,2032,2963, 2020,2069,1372,2058,2107,2964,2059,2108,2834,1992,2041,2837, 1978,2027,1326,2059,2108,2834,2058,2107,2964,1979,2028,1327, 2061,2110,1376,2060,2109,1375,1987,2036,2846,1984,2033,2845, 1984,2033,2840,2046,2095,2839,2062,2111,2388,2061,2110,2387, 2063,2112,2934,2062,2111,2388,2046,2095,2839,2018,2067,2931, 2064,2113,2935,2063,2112,2934,2018,2067,2931,1985,2034,2932, 2065,2114,2393,2064,2113,2392,1985,2034,2842,1986,2035,2841, 1993,2042,2858,2066,2115,2855,2065,2114,2856,1986,2035,2859, 2021,2070,2844,2067,2116,1369,2066,2115,2855,1993,2042,2858, 1987,2036,2843,2060,2109,1370,2067,2116,1369,2021,2070,2844, 1988,2037,2848,2044,2093,2847,2069,2118,2396,2068,2117,2395, 2070,2119,2928,2069,2118,2396,2044,2093,2847,2016,2065,2925, 2071,2120,2929,2070,2119,2928,2016,2065,2925,1989,2038,2926, 2072,2121,2401,2071,2120,2400,1989,2038,2850,1990,2039,2849, 1995,2044,2864,2073,2122,2861,2072,2121,2862,1990,2039,2865, 2023,2072,2852,2074,2123,1380,2073,2122,2861,1995,2044,2864, 1991,2040,2851,2075,2124,1377,2074,2123,1380,2023,2072,2852, 2068,2117,1384,2075,2124,1383,1991,2040,2854,1988,2037,2853, 2077,2126,1392,2076,2125,1391,1963,2012,2804,1960,2009,2803, 1960,2009,2798,2042,2091,2797,2078,2127,2404,2077,2126,2403, 2079,2128,2922,2078,2127,2404,2042,2091,2797,2014,2063,2919, 2080,2129,2923,2079,2128,2922,2014,2063,2919,1961,2010,2920, 2081,2130,2409,2080,2129,2408,1961,2010,2800,1962,2011,2799, 1997,2046,2870,2082,2131,2867,2081,2130,2868,1962,2011,2871, 2025,2074,2802,2083,2132,1385,2082,2131,2867,1997,2046,2870, 1963,2012,2801,2076,2125,1386,2083,2132,1385,2025,2074,2802, 1964,2013,2806,2040,2089,2805,2085,2134,2412,2084,2133,2411, 2086,2135,2916,2085,2134,2412,2040,2089,2805,2012,2061,2913, 2087,2136,2917,2086,2135,2916,2012,2061,2913,1965,2014,2914, 2088,2137,2417,2087,2136,2416,1965,2014,2808,1966,2015,2807, 1999,2048,2876,2089,2138,2873,2088,2137,2874,1966,2015,2877, 2027,2076,2810,2090,2139,1396,2089,2138,2873,1999,2048,2876, 1967,2016,2809,2091,2140,1393,2090,2139,1396,2027,2076,2810, 2084,2133,1400,2091,2140,1399,1967,2016,2812,1964,2013,2811, 2093,2142,1408,2092,2141,1407,1970,2019,2818,1971,2020,2817, 1971,2020,2820,2038,2087,2819,2094,2143,2420,2093,2142,2419, 2095,2144,2910,2094,2143,2420,2038,2087,2819,2010,2059,2907, 2096,2145,2911,2095,2144,2910,2010,2059,2907,1968,2017,2908, 2097,2146,2425,2096,2145,2424,1968,2017,2813,1969,2018,2814, 2001,2050,2882,2098,2147,2879,2097,2146,2880,1969,2018,2883, 2029,2078,2816,2099,2148,1401,2098,2147,2879,2001,2050,2882, 1970,2019,2815,2092,2141,1402,2099,2148,1401,2029,2078,2816, 1972,2021,2822,2036,2085,2821,2101,2150,2428,2100,2149,2427, 2102,2151,2904,2101,2150,2428,2036,2085,2821,2008,2057,2901, 2103,2152,2905,2102,2151,2904,2008,2057,2901,1973,2022,2902, 2104,2153,2433,2103,2152,2432,1973,2022,2824,1974,2023,2823, 2003,2052,2888,2105,2154,2885,2104,2153,2886,1974,2023,2889, 2031,2080,2826,2106,2155,1412,2105,2154,2885,2003,2052,2888, 1975,2024,2825,2107,2156,1409,2106,2155,1412,2031,2080,2826, 2100,2149,1416,2107,2156,1415,1975,2024,2828,1972,2021,2827, 2109,2158,1424,2108,2157,1423,2123,2172,2965,2116,2165,2966, 2116,2165,2967,2117,2166,2968,2110,2159,2436,2109,2158,2435, 2111,2160,2898,2110,2159,2436,2117,2166,2968,2118,2167,2969, 2112,2161,2899,2111,2160,2898,2118,2167,2969,2119,2168,2970, 2113,2162,2441,2112,2161,2440,2119,2168,2971,2120,2169,2972, 2121,2170,2973,2114,2163,2891,2113,2162,2892,2120,2169,2974, 2122,2171,2975,2115,2164,1417,2114,2163,2891,2121,2170,2973, 2123,2172,2976,2108,2157,1418,2115,2164,1417,2122,2171,2975, 2048,2097,2940,2049,2098,2939,2117,2166,2968,2116,2165,2967, 2118,2167,2969,2117,2166,2968,2049,2098,2939,2050,2099,2941, 2119,2168,2970,2118,2167,2969,2050,2099,2941,2051,2100,2943, 2120,2169,2972,2119,2168,2971,2051,2100,2946,2052,2101,2945, 2053,2102,2950,2121,2170,2973,2120,2169,2974,2052,2101,2951, 2054,2103,2954,2122,2171,2975,2121,2170,2973,2053,2102,2950, 2055,2104,2956,2123,2172,2976,2122,2171,2975,2054,2103,2954, 2116,2165,2966,2123,2172,2965,2055,2104,2958,2048,2097,2957, 1200,945,1086,821,821,2977,820,864,978,951,1222,977, 1200,945,1086,952,943,1085,821,821,2977, 793,906,2978,955,1298,1088,956,950,1087, 767,930,985,1214,949,984,955,1298,1088,793,906,2978, 1362,1639,2979,1807,1672,2146,1547,1673,2147, 1388,1616,2143,1548,1942,2145,1807,1672,2146,1362,1639,2979, 1551,1670,2148,1414,1601,2112,1544,1928,2111, 1026,1029,1159,1218,1228,1507,1219,1229,1184, 1025,1028,1158,1217,1227,1183,1218,1228,1507,1026,1029,1159, 1226,1236,1193,1033,1036,1168,1032,1035,1167,1225,1235,1192, 1618,1731,2217,1810,1752,2980,1809,1751,2241, 1618,1731,2217,1619,1732,2220,1811,1753,2518,1810,1752,2980, 1819,1761,2503,1818,1760,2251,1625,1738,2227,1626,1739,2229, 1902,1548,1817,1426,1494,1789,1483,1546,1979,1903,1547,2022, 822,793,776,1314,827,807,832,790,774, }; void drawOtherShape() { float shininess = 15.0f; float diffuseColor[4] = {0.929524f, 0.796542f, 0.178823f, 1.0f}; float specularColor[4] = {1.00000f, 0.980392f, 0.549020f, 1.0f}; // set color using glMaterial (gold-yellow) glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess); // range 0 ~ 128 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specularColor); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuseColor); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, diffuseColor); // set ambient and diffuse color using glColorMaterial (gold-yellow) glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); glColor3fv(diffuseColor); // start to render polygons glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_VERTEX_ARRAY); glNormalPointer(GL_FLOAT, 0, otherShapeNormals); glVertexPointer(3, GL_FLOAT, 0, otherShapeVertices); glDrawElements(GL_TRIANGLE_STRIP, 384, GL_UNSIGNED_INT, &otherShapeIndices[0]); glDisableClientState(GL_VERTEX_ARRAY); // disable vertex arrays glDisableClientState(GL_NORMAL_ARRAY); // disable normal arrays } #endif
36.561822
83
0.656767
[ "geometry", "render", "model", "3d" ]
c52e2c6f0877530b168be4abe94328467aeb6e34
13,112
c
C
external_packages/mmlda-c-dist/code/mmlda-estimate.c
marielacour81/CBIG
511af756c6ddabbd3a9681ce3514b79ef5aaaf3f
[ "MIT" ]
2
2019-08-31T01:30:34.000Z
2020-03-04T22:18:05.000Z
external_packages/mmlda-c-dist/code/mmlda-estimate.c
marielacour81/CBIG
511af756c6ddabbd3a9681ce3514b79ef5aaaf3f
[ "MIT" ]
null
null
null
external_packages/mmlda-c-dist/code/mmlda-estimate.c
marielacour81/CBIG
511af756c6ddabbd3a9681ce3514b79ef5aaaf3f
[ "MIT" ]
1
2019-12-09T14:19:32.000Z
2019-12-09T14:19:32.000Z
// (C) Copyright 2018, Nanbo Sun (nanbosun@u.nus.edu) // This file is part of MMLDA-C. // MMLDA-C 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. // MMLDA-C 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA #include "mmlda-estimate.h" /* * perform inference on a document and update sufficient statistics * */ double doc_e_step(document* doc1, document* doc2, double* gamma, double** phi1, double** phi2, mmlda_model* model, mmlda_suffstats* ss) { double likelihood; int n, k; // posterior inference likelihood = mmlda_inference(doc1, doc2, model, gamma, phi1, phi2); // update sufficient statistics double gamma_sum = 0; for (k = 0; k < model->num_topics; k++) { gamma_sum += gamma[k]; ss->alpha_suffstats += digamma(gamma[k]); } ss->alpha_suffstats -= model->num_topics * digamma(gamma_sum); for (n = 0; n < doc1->length; n++) { for (k = 0; k < model->num_topics; k++) { ss->class_word1[k][doc1->words[n]] += doc1->counts[n]*phi1[n][k]; ss->class_total1[k] += doc1->counts[n]*phi1[n][k]; } } for (n = 0; n < doc2->length; n++) { for (k = 0; k < model->num_topics; k++) { ss->class_word2[k][doc2->words[n]] += doc2->counts[n]*phi2[n][k]; ss->class_total2[k] += doc2->counts[n]*phi2[n][k]; } } ss->num_docs = ss->num_docs + 1; return(likelihood); } /* * writes the word assignments line for a document to a file * */ void write_word_assignment(FILE* f, document* doc, double** phi, mmlda_model* model) { int n; fprintf(f, "%03d", doc->length); for (n = 0; n < doc->length; n++) { fprintf(f, " %04d:%02d", doc->words[n], argmax(phi[n], model->num_topics)); } fprintf(f, "\n"); fflush(f); } /* * saves the gamma parameters of the current dataset * */ void save_gamma(char* filename, double** gamma, int num_docs, int num_topics) { FILE* fileptr; int d, k; fileptr = fopen(filename, "w"); for (d = 0; d < num_docs; d++) { fprintf(fileptr, "%5.10f", gamma[d][0]); for (k = 1; k < num_topics; k++) { fprintf(fileptr, " %5.10f", gamma[d][k]); } fprintf(fileptr, "\n"); } fclose(fileptr); } /* * run_em * */ void run_em(char* start, char* directory, corpus* corpus1, corpus* corpus2) { int d, n; mmlda_model *model = NULL; double **var_gamma, **phi1, **phi2; // allocate variational parameters var_gamma = malloc(sizeof(double*)*(corpus1->num_docs)); for (d = 0; d < corpus1->num_docs; d++) var_gamma[d] = malloc(sizeof(double) * NTOPICS); int max_length1 = max_corpus_length(corpus1); phi1 = malloc(sizeof(double*)*max_length1); for (n = 0; n < max_length1; n++) phi1[n] = malloc(sizeof(double) * NTOPICS); int max_length2 = max_corpus_length(corpus2); phi2 = malloc(sizeof(double*)*max_length2); for (n = 0; n < max_length2; n++) phi2[n] = malloc(sizeof(double) * NTOPICS); // initialize model char filename[200]; char filename1[200]; char filename2[200]; mmlda_suffstats* ss = NULL; if (strcmp(start, "seeded")==0) { model = new_mmlda_model(corpus1->num_terms, corpus2->num_terms, NTOPICS); ss = new_mmlda_suffstats(model); corpus_initialize_ss(ss, model, corpus1, corpus2); mmlda_mle(model, ss, 0); model->alpha = INITIAL_ALPHA; } else if (strcmp(start, "random")==0) { model = new_mmlda_model(corpus1->num_terms, corpus2->num_terms, NTOPICS); ss = new_mmlda_suffstats(model); random_initialize_ss(ss, model); mmlda_mle(model, ss, 0); model->alpha = INITIAL_ALPHA; } else { model = load_mmlda_model(start); ss = new_mmlda_suffstats(model); } sprintf(filename,"%s/000",directory); save_mmlda_model(model, filename); // run expectation maximization int i = 0; double likelihood, likelihood_old = 0, converged = 1; sprintf(filename, "%s/likelihood.dat", directory); FILE* likelihood_file = fopen(filename, "w"); while (((converged < 0) || (converged > EM_CONVERGED) || (i <= 2)) && (i <= EM_MAX_ITER)) { i++; printf("**** em iteration %d ****\n", i); likelihood = 0; zero_initialize_ss(ss, model); // e-step for (d = 0; d < corpus1->num_docs; d++) { if ((d % 20) == 0) printf("document %d\n",d); likelihood += doc_e_step(&(corpus1->docs[d]), &(corpus2->docs[d]), var_gamma[d], phi1, phi2, model, ss); } // m-step mmlda_mle(model, ss, ESTIMATE_ALPHA); // check for convergence converged = (likelihood_old - likelihood) / (likelihood_old); if (converged < 0) VAR_MAX_ITER = VAR_MAX_ITER * 2; likelihood_old = likelihood; // output model and likelihood fprintf(likelihood_file, "%10.10f\t%5.5e\n", likelihood, converged); fflush(likelihood_file); if ((i % LAG) == 0) { sprintf(filename,"%s/%03d",directory, i); save_mmlda_model(model, filename); sprintf(filename,"%s/%03d.gamma",directory, i); save_gamma(filename, var_gamma, corpus1->num_docs, model->num_topics); } } // output the final model sprintf(filename,"%s/final",directory); save_mmlda_model(model, filename); sprintf(filename,"%s/final.gamma",directory); save_gamma(filename, var_gamma, corpus1->num_docs, model->num_topics); // output the word assignments (for visualization) sprintf(filename1, "%s/word-assignments1.dat", directory); FILE* w_asgn_file1 = fopen(filename1, "w"); sprintf(filename2, "%s/word-assignments2.dat", directory); FILE* w_asgn_file2 = fopen(filename2, "w"); for (d = 0; d < corpus1->num_docs; d++) { if ((d % 20) == 0) printf("final e step document %d\n",d); likelihood += mmlda_inference(&(corpus1->docs[d]), &(corpus2->docs[d]), model, var_gamma[d], phi1, phi2); write_word_assignment(w_asgn_file1, &(corpus1->docs[d]), phi1, model); write_word_assignment(w_asgn_file2, &(corpus2->docs[d]), phi2, model); } fclose(w_asgn_file1); fclose(w_asgn_file2); fclose(likelihood_file); } /* * read settings. * */ void read_settings(char* filename) { FILE* fileptr; char alpha_action[100]; fileptr = fopen(filename, "r"); fscanf(fileptr, "var max iter %d\n", &VAR_MAX_ITER); fscanf(fileptr, "var convergence %f\n", &VAR_CONVERGED); fscanf(fileptr, "em max iter %d\n", &EM_MAX_ITER); fscanf(fileptr, "em convergence %f\n", &EM_CONVERGED); fscanf(fileptr, "alpha %s", alpha_action); if (strcmp(alpha_action, "fixed")==0) { ESTIMATE_ALPHA = 0; } else { ESTIMATE_ALPHA = 1; } fclose(fileptr); } /* * inference based on two modalities * */ void infer(char* model_root, char* save, corpus* corpus1, corpus* corpus2) { FILE* fileptr; char filename[200]; int i, d, n; mmlda_model *model; double **var_gamma, likelihood, **phi1, **phi2; document *doc1, *doc2; model = load_mmlda_model(model_root); var_gamma = malloc(sizeof(double*)*(corpus1->num_docs)); for (i = 0; i < corpus1->num_docs; i++) var_gamma[i] = malloc(sizeof(double)*model->num_topics); sprintf(filename, "%s-lda-lhood.dat", save); fileptr = fopen(filename, "w"); for (d = 0; d < corpus1->num_docs; d++) { if (((d % 1) == 0) && (d>0)) printf("document %d\n",d); doc1 = &(corpus1->docs[d]); phi1 = (double**) malloc(sizeof(double*) * doc1->length); for (n = 0; n < doc1->length; n++) phi1[n] = (double*) malloc(sizeof(double) * model->num_topics); doc2 = &(corpus2->docs[d]); phi2 = (double**) malloc(sizeof(double*) * doc2->length); for (n = 0; n < doc2->length; n++) phi2[n] = (double*) malloc(sizeof(double) * model->num_topics); likelihood = mmlda_inference(doc1, doc2, model, var_gamma[d], phi1, phi2); fprintf(fileptr, "%5.5f\n", likelihood); } fclose(fileptr); sprintf(filename, "%s-gamma.dat", save); save_gamma(filename, var_gamma, corpus1->num_docs, model->num_topics); } /* * inference based on first modality only * */ void infer1(char* model_root, char* save, corpus* corpus1) { FILE* fileptr; char filename[200]; int i, d, n; mmlda_model *model; double **var_gamma, likelihood, **phi1; document *doc1; model = load_mmlda_model(model_root); var_gamma = malloc(sizeof(double*)*(corpus1->num_docs)); for (i = 0; i < corpus1->num_docs; i++) var_gamma[i] = malloc(sizeof(double)*model->num_topics); sprintf(filename, "%s-lda-lhood.dat", save); fileptr = fopen(filename, "w"); for (d = 0; d < corpus1->num_docs; d++) { if (((d % 1) == 0) && (d>0)) printf("document %d\n",d); doc1 = &(corpus1->docs[d]); phi1 = (double**) malloc(sizeof(double*) * doc1->length); for (n = 0; n < doc1->length; n++) phi1[n] = (double*) malloc(sizeof(double) * model->num_topics); likelihood = mmlda_inference1(doc1, model, var_gamma[d], phi1); fprintf(fileptr, "%5.5f\n", likelihood); } fclose(fileptr); sprintf(filename, "%s-gamma.dat", save); save_gamma(filename, var_gamma, corpus1->num_docs, model->num_topics); } /* * inference based on second modality only * */ void infer2(char* model_root, char* save, corpus* corpus2) { FILE* fileptr; char filename[200]; int i, d, n; mmlda_model *model; double **var_gamma, likelihood, **phi2; document *doc2; model = load_mmlda_model(model_root); var_gamma = malloc(sizeof(double*)*(corpus2->num_docs)); for (i = 0; i < corpus2->num_docs; i++) var_gamma[i] = malloc(sizeof(double)*model->num_topics); sprintf(filename, "%s-lda-lhood.dat", save); fileptr = fopen(filename, "w"); for (d = 0; d < corpus2->num_docs; d++) { if (((d % 1) == 0) && (d>0)) printf("document %d\n",d); doc2 = &(corpus2->docs[d]); phi2 = (double**) malloc(sizeof(double*) * doc2->length); for (n = 0; n < doc2->length; n++) phi2[n] = (double*) malloc(sizeof(double) * model->num_topics); likelihood = mmlda_inference2(doc2, model, var_gamma[d], phi2); fprintf(fileptr, "%5.5f\n", likelihood); } fclose(fileptr); sprintf(filename, "%s-gamma.dat", save); save_gamma(filename, var_gamma, corpus2->num_docs, model->num_topics); } /* * main * */ int main(int argc, char* argv[]) { // (est / inf) alpha k settings data (random / seed/ model) (directory / out) corpus* corpus1; corpus* corpus2; long t1; if (argc == 10) { t1 = atol(argv[9]) * 2; } else { (void) time(&t1); } seedMT(t1); // seedMT(4357U); if (argc > 1) { if (strcmp(argv[1], "est")==0) { INITIAL_ALPHA = atof(argv[2]); NTOPICS = atoi(argv[3]); read_settings(argv[4]); corpus1 = read_data(argv[5]); corpus2 = read_data(argv[6]); assert(corpus1->num_docs==corpus2->num_docs); make_directory(argv[8]); run_em(argv[7], argv[8], corpus1, corpus2); } if (strcmp(argv[1], "inf")==0) { read_settings(argv[2]); corpus1 = read_data(argv[4]); corpus2 = read_data(argv[5]); infer(argv[3], argv[6], corpus1, corpus2); } if (strcmp(argv[1], "inf1")==0) { read_settings(argv[2]); corpus1 = read_data(argv[4]); infer1(argv[3], argv[5], corpus1); } if (strcmp(argv[1], "inf2")==0) { read_settings(argv[2]); corpus2 = read_data(argv[4]); infer2(argv[3], argv[5], corpus2); } } else { printf("usage : mmlda est [initial alpha] [k] [settings] [data1] [data2] [random/seeded/*] [directory] [seed]\n"); printf(" mmlda inf [settings] [model] [data1] [data2] [name]\n"); printf(" mmlda inf1 [settings] [model] [data1] [name]\n"); printf(" mmlda inf2 [settings] [model] [data2] [name]\n"); } return(0); }
28.319654
122
0.581452
[ "model" ]
c538bba0f739bdd702e05aaa0394e06b111dfdc6
11,456
h
C
Engine/Threading/QueuedTask.h
Higami69/Leviathan
90f68f9f6e5506d6133bcefcf35c8e84f158483b
[ "BSL-1.0" ]
16
2018-12-22T02:09:05.000Z
2022-03-09T20:38:59.000Z
Engine/Threading/QueuedTask.h
Higami69/Leviathan
90f68f9f6e5506d6133bcefcf35c8e84f158483b
[ "BSL-1.0" ]
46
2018-04-02T11:06:01.000Z
2019-12-14T11:16:04.000Z
Engine/Threading/QueuedTask.h
Higami69/Leviathan
90f68f9f6e5506d6133bcefcf35c8e84f158483b
[ "BSL-1.0" ]
14
2018-04-09T02:26:15.000Z
2021-09-11T03:12:15.000Z
#pragma once // ------------------------------------ // #include "Define.h" // ------------------------------------ // #include <functional> #include "../TimeIncludes.h" //! Default value to pass for ignoring this setting // #define TASK_MUSTBERAN_BEFORE_EXIT 0 //! Makes the task run before current frame ends //! \todo Actually implement callbacks to ThreadingManager for Engine to call this and make this work #define TASK_MUSTBERAN_BEFORE_FRAMEEND 1 namespace Leviathan{ //! \brief Object passed to tasks which has common values //! //! This is passed to improve performance since querying the system clock multiple times by //! every task can be quite slow struct QueuedTaskCheckValues{ //! \brief Constructs a new value holder and automatically fetches the CurrentTime value QueuedTaskCheckValues(); //! Time the task set iteration started (may be slightly off, but it doesn't matter) // WantedClockType::time_point CurrentTime; }; //! \brief Encapsulates a function that can later be ran in a free thread //! \warning Function passed to this class should be thread safe //! \warning This is not explicitly thread safe, it might be through std::Thread class QueuedTask{ public: //! Takes in the function which is ran when the Task is ran DLLEXPORT QueuedTask(std::function<void ()> functorun); DLLEXPORT virtual ~QueuedTask(); //! \brief Runs the stored function DLLEXPORT virtual void RunTask(); // Functions for child classes to implement // //! \brief Function called by ThreadingManager before running this task //! \return By default returns always true, but child classes can perform various checks before returning DLLEXPORT virtual bool CanBeRan(const QueuedTaskCheckValues* const checkvalues); //! \brief Function called by ThreadingManager before certain events to make proper tasks //! finish before certain operations //! \return By default returns true when passed TASK_MUSTBERAN_BEFORE_EXIT, but child //! classes can store internal variables //! to match only certain types DLLEXPORT virtual bool MustBeRanBefore(int eventtypeidentifier); //! \brief Function called by ThreadingManager AFTER running the task // //! \return By default returns always false (so will be removed from queue), but child //! classes can perform various checks or //! an internal state which holds information about repeating the task, such as repeat x //! times or repeat until success etc. //! \note This is guaranteed to be called only once per execution so this can be used to //! implement an execution times monitor DLLEXPORT virtual bool IsRepeating(); private: //! \brief Provided for child classes to do something before running the function virtual void _PreFunctionRun(); //! \brief Provides child classes a way to execute after running the function virtual void _PostFunctionRun(); // ------------------------------------ // //! The function to run std::function<void ()> FunctionToRun; }; // ------------------ Specialized QueuedTasks for common operations ------------------ // //! \brief Encapsulates a function that can later be ran in a free thread //! \warning Function passed to this class should be thread safe class ConditionalTask : public QueuedTask{ public: //! Constructs a task that can be controlled when it can be ran //! \param canberuncheck Is ran when CanBeRan is called, so it should be relatively cheap to call DLLEXPORT ConditionalTask(std::function<void ()> functorun, std::function<bool ()> canberuncheck); DLLEXPORT virtual ~ConditionalTask(); //! \brief Calls the checking function to see if the task can be ran DLLEXPORT virtual bool CanBeRan(const QueuedTaskCheckValues* const checkvalues); protected: //! The function for checking if the task is allowed to be run std::function<bool ()> TaskCheckingFunc; }; //! \brief Encapsulates a function that can later be ran in a free thread //! \warning Function passed to this class should be thread safe class ConditionalDelayedTask : public QueuedTask{ public: //! Constructs a task that can be controlled when it can be ran with an additional check //! to skip checking too often //! \param delaytime The time between checks; time that needs to pass before checking again //! \param canberuncheck Is ran when CanBeRan is called, so it should be relatively cheap to call DLLEXPORT ConditionalDelayedTask(std::function<void ()> functorun, std::function<bool ()> canberuncheck, const MicrosecondDuration &delaytime); DLLEXPORT virtual ~ConditionalDelayedTask(); //! \brief Calls the checking function to see if the task can be ran DLLEXPORT virtual bool CanBeRan(const QueuedTaskCheckValues* const checkvalues); protected: //! The function for checking if the task is allowed to be run std::function<bool ()> TaskCheckingFunc; //! The time after which this task may be checked again WantedClockType::time_point CheckingTime; //! The delay between checks MicrosecondDuration DelayBetweenChecks; }; //! \brief Encapsulates a function that is ran after a time period //! \warning Function passed to this class should be thread safe class DelayedTask : public QueuedTask{ public: //! Constructs a task that can be controlled when it can be ran //! \param delaytime Is used to control when the task can run //! \see QueuedTask DLLEXPORT DelayedTask(std::function<void ()> functorun, const MicrosecondDuration &delaytime); //! Constructs a task that can be controlled when it can be ran //! \param executetime Is used to control when the task can run //! \see QueuedTask DLLEXPORT DelayedTask(std::function<void ()> functorun, const WantedClockType::time_point &executetime); DLLEXPORT virtual ~DelayedTask(); //! \brief Checks if the current time is past the time stamp //! //! Controlled by the value of ExecutionTime DLLEXPORT virtual bool CanBeRan(const QueuedTaskCheckValues* const checkvalues); protected: //! The time after which this task may be ran WantedClockType::time_point ExecutionTime; }; //! \brief Encapsulates a function that is ran after a time period //! \warning Function passed to this class should be thread safe //! \warning The passed task will be repeatedly ran until SetRepeatStatus is called with false //! (or ShouldRunAgain some other way set to false) //! \see SetRepeatStatus class RepeatingDelayedTask : public DelayedTask{ public: //! Constructs a task that can be controlled when it can be ran and how many times it is ran //! \param bothdelays Is the time before first execution AND the time between following executions //! \see DelayedTask DLLEXPORT RepeatingDelayedTask(std::function<void ()> functorun, const MicrosecondDuration &bothdelays); //! Constructs a task that can be controlled when it can be ran and how many times it is ran //! \param initialdelay Is the time before first execution //! \param followingduration Is the time between following executions //! \see DelayedTask DLLEXPORT RepeatingDelayedTask(std::function<void ()> functorun, const MicrosecondDuration &initialdelay, const MicrosecondDuration &followingduration); DLLEXPORT virtual ~RepeatingDelayedTask(); //! \brief Called by ThreadingManager to see if this task still wants to repeat //! \see SetRepeatStatus ShouldRunAgain DLLEXPORT virtual bool IsRepeating(); //! \brief Sets the variable ShouldRunAgain to newvalue //! \note To call this from the task function use TaskThread::GetThreadSpecificThreadObject //! \see ThreadSpecificData ThreadSpecificData::QuickTaskAccess DLLEXPORT void SetRepeatStatus(bool newvalue); protected: //! \brief Used to update the time when to run the task again virtual void _PostFunctionRun(); // ------------------------------------ // MicrosecondDuration TimeBetweenExecutions; //! Controls if the task should still run again bool ShouldRunAgain; }; //! \brief Encapsulates a function that is ran certain amount of times //! \warning Function passed to this class should be thread safe //! \todo Merge common parts from this and RepeatCountedDelayedTask class RepeatCountedTask : public QueuedTask{ public: //! Constructs a task that can be controlled how many times it is ran //! \param repeatcount The task is ran this specified times, or the task calls StopRepeating before that DLLEXPORT RepeatCountedTask(std::function<void ()> functorun, size_t repeatcount); DLLEXPORT virtual ~RepeatCountedTask(); //! \brief Called by ThreadingManager to see if this task still wants to repeat //! \see SetRepeatStatus ShouldRunAgain DLLEXPORT virtual bool IsRepeating(); //! \brief Stops repeating this function after this call //! \note To call this from the task function use TaskThread::GetThreadSpecificThreadObject //! \see ThreadSpecificData ThreadSpecificData::QuickTaskAccess DLLEXPORT void StopRepeating(); //! \brief Gets the number of repeats done //! \note This will only be accurate if IsRepeating is only called once per repeat DLLEXPORT size_t GetRepeatCount() const; //! \brief Checks if this is the last repeat //! //! This is done by checking RepeatedCount+1 >= MaxRepeats DLLEXPORT bool IsThisLastRepeat() const; protected: //! Holds the maximum run count size_t MaxRepeats; //! Keeps track of how many times the task has been ran //! \see IsRepeating size_t RepeatedCount; }; //! \brief Encapsulates a function that is ran after a time period and repeated certain amount //! \warning Function passed to this class should be thread safe class RepeatCountedDelayedTask : public RepeatCountedTask{ public: //! Constructs a task that can be controlled when it can be ran and how many times it is ran //! \param bothdelays Is the time before first execution AND the time between following executions //! \param repeatcount The task is ran this specified times, or the task calls StopRepeating before that //! \see DelayedTask DLLEXPORT RepeatCountedDelayedTask(std::function<void ()> functorun, const MicrosecondDuration &bothdelays, int repeatcount); //! Constructs a task that can be controlled when it can be ran and how many times it is ran //! \param initialdelay Is the time before first execution //! \param followingduration Is the time between following executions //! \param repeatcount The task is ran this specified times, or the task calls StopRepeating before that //! \see DelayedTask DLLEXPORT RepeatCountedDelayedTask(std::function<void ()> functorun, const MicrosecondDuration &initialdelay, const MicrosecondDuration &followingduration, int repeatcount); DLLEXPORT virtual ~RepeatCountedDelayedTask(); //! \brief Checks if the current time is past the time stamp //! //! Controlled by the value of ExecutionTime DLLEXPORT virtual bool CanBeRan(const QueuedTaskCheckValues* const checkvalues); protected: //! \brief Used to update the time when to run the task again virtual void _PostFunctionRun(); // ------------------------------------ // //! Time between executions MicrosecondDuration TimeBetweenExecutions; //! The timepoint after which this function can be ran WantedClockType::time_point ExecutionTime; }; }
41.208633
109
0.728701
[ "object" ]
c53d13452a09ffdc91acd4b4a09e8cfd7be71aa2
14,909
h
C
aws-cpp-sdk-transcribe/include/aws/transcribe/model/CreateMedicalVocabularyRequest.h
Nexuscompute/aws-sdk-cpp
e7ef485e46e6962c9e084b8c9b104c1bfcceaf26
[ "Apache-2.0" ]
1
2022-01-05T18:20:03.000Z
2022-01-05T18:20:03.000Z
aws-cpp-sdk-transcribe/include/aws/transcribe/model/CreateMedicalVocabularyRequest.h
Nexuscompute/aws-sdk-cpp
e7ef485e46e6962c9e084b8c9b104c1bfcceaf26
[ "Apache-2.0" ]
null
null
null
aws-cpp-sdk-transcribe/include/aws/transcribe/model/CreateMedicalVocabularyRequest.h
Nexuscompute/aws-sdk-cpp
e7ef485e46e6962c9e084b8c9b104c1bfcceaf26
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/transcribe/TranscribeService_EXPORTS.h> #include <aws/transcribe/TranscribeServiceRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/transcribe/model/LanguageCode.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/transcribe/model/Tag.h> #include <utility> namespace Aws { namespace TranscribeService { namespace Model { /** */ class AWS_TRANSCRIBESERVICE_API CreateMedicalVocabularyRequest : public TranscribeServiceRequest { public: CreateMedicalVocabularyRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "CreateMedicalVocabulary"; } Aws::String SerializePayload() const override; Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; /** * <p>The name of your new vocabulary.</p> <p>This name is case sensitive, cannot * contain spaces, and must be unique within an Amazon Web Services account. If you * try to create a vocabulary with the same name as a previous vocabulary, you get * a <code>ConflictException</code> error.</p> */ inline const Aws::String& GetVocabularyName() const{ return m_vocabularyName; } /** * <p>The name of your new vocabulary.</p> <p>This name is case sensitive, cannot * contain spaces, and must be unique within an Amazon Web Services account. If you * try to create a vocabulary with the same name as a previous vocabulary, you get * a <code>ConflictException</code> error.</p> */ inline bool VocabularyNameHasBeenSet() const { return m_vocabularyNameHasBeenSet; } /** * <p>The name of your new vocabulary.</p> <p>This name is case sensitive, cannot * contain spaces, and must be unique within an Amazon Web Services account. If you * try to create a vocabulary with the same name as a previous vocabulary, you get * a <code>ConflictException</code> error.</p> */ inline void SetVocabularyName(const Aws::String& value) { m_vocabularyNameHasBeenSet = true; m_vocabularyName = value; } /** * <p>The name of your new vocabulary.</p> <p>This name is case sensitive, cannot * contain spaces, and must be unique within an Amazon Web Services account. If you * try to create a vocabulary with the same name as a previous vocabulary, you get * a <code>ConflictException</code> error.</p> */ inline void SetVocabularyName(Aws::String&& value) { m_vocabularyNameHasBeenSet = true; m_vocabularyName = std::move(value); } /** * <p>The name of your new vocabulary.</p> <p>This name is case sensitive, cannot * contain spaces, and must be unique within an Amazon Web Services account. If you * try to create a vocabulary with the same name as a previous vocabulary, you get * a <code>ConflictException</code> error.</p> */ inline void SetVocabularyName(const char* value) { m_vocabularyNameHasBeenSet = true; m_vocabularyName.assign(value); } /** * <p>The name of your new vocabulary.</p> <p>This name is case sensitive, cannot * contain spaces, and must be unique within an Amazon Web Services account. If you * try to create a vocabulary with the same name as a previous vocabulary, you get * a <code>ConflictException</code> error.</p> */ inline CreateMedicalVocabularyRequest& WithVocabularyName(const Aws::String& value) { SetVocabularyName(value); return *this;} /** * <p>The name of your new vocabulary.</p> <p>This name is case sensitive, cannot * contain spaces, and must be unique within an Amazon Web Services account. If you * try to create a vocabulary with the same name as a previous vocabulary, you get * a <code>ConflictException</code> error.</p> */ inline CreateMedicalVocabularyRequest& WithVocabularyName(Aws::String&& value) { SetVocabularyName(std::move(value)); return *this;} /** * <p>The name of your new vocabulary.</p> <p>This name is case sensitive, cannot * contain spaces, and must be unique within an Amazon Web Services account. If you * try to create a vocabulary with the same name as a previous vocabulary, you get * a <code>ConflictException</code> error.</p> */ inline CreateMedicalVocabularyRequest& WithVocabularyName(const char* value) { SetVocabularyName(value); return *this;} /** * <p>The language code that represents the language of the entries in your custom * vocabulary. Note that U.S. English (<code>en-US</code>) is the only language * supported with Amazon Transcribe Medical.</p> */ inline const LanguageCode& GetLanguageCode() const{ return m_languageCode; } /** * <p>The language code that represents the language of the entries in your custom * vocabulary. Note that U.S. English (<code>en-US</code>) is the only language * supported with Amazon Transcribe Medical.</p> */ inline bool LanguageCodeHasBeenSet() const { return m_languageCodeHasBeenSet; } /** * <p>The language code that represents the language of the entries in your custom * vocabulary. Note that U.S. English (<code>en-US</code>) is the only language * supported with Amazon Transcribe Medical.</p> */ inline void SetLanguageCode(const LanguageCode& value) { m_languageCodeHasBeenSet = true; m_languageCode = value; } /** * <p>The language code that represents the language of the entries in your custom * vocabulary. Note that U.S. English (<code>en-US</code>) is the only language * supported with Amazon Transcribe Medical.</p> */ inline void SetLanguageCode(LanguageCode&& value) { m_languageCodeHasBeenSet = true; m_languageCode = std::move(value); } /** * <p>The language code that represents the language of the entries in your custom * vocabulary. Note that U.S. English (<code>en-US</code>) is the only language * supported with Amazon Transcribe Medical.</p> */ inline CreateMedicalVocabularyRequest& WithLanguageCode(const LanguageCode& value) { SetLanguageCode(value); return *this;} /** * <p>The language code that represents the language of the entries in your custom * vocabulary. Note that U.S. English (<code>en-US</code>) is the only language * supported with Amazon Transcribe Medical.</p> */ inline CreateMedicalVocabularyRequest& WithLanguageCode(LanguageCode&& value) { SetLanguageCode(std::move(value)); return *this;} /** * <p>The Amazon S3 location (URI) of the text file that contains your custom * vocabulary. The URI must be in the same Amazon Web Services Region as the * resource that you're calling.</p> <p>Here's an example URI path:</p> <p> * <code>https://s3.us-east-1.amazonaws.com/my-s3-bucket/my-vocab-file.txt</code> * </p> */ inline const Aws::String& GetVocabularyFileUri() const{ return m_vocabularyFileUri; } /** * <p>The Amazon S3 location (URI) of the text file that contains your custom * vocabulary. The URI must be in the same Amazon Web Services Region as the * resource that you're calling.</p> <p>Here's an example URI path:</p> <p> * <code>https://s3.us-east-1.amazonaws.com/my-s3-bucket/my-vocab-file.txt</code> * </p> */ inline bool VocabularyFileUriHasBeenSet() const { return m_vocabularyFileUriHasBeenSet; } /** * <p>The Amazon S3 location (URI) of the text file that contains your custom * vocabulary. The URI must be in the same Amazon Web Services Region as the * resource that you're calling.</p> <p>Here's an example URI path:</p> <p> * <code>https://s3.us-east-1.amazonaws.com/my-s3-bucket/my-vocab-file.txt</code> * </p> */ inline void SetVocabularyFileUri(const Aws::String& value) { m_vocabularyFileUriHasBeenSet = true; m_vocabularyFileUri = value; } /** * <p>The Amazon S3 location (URI) of the text file that contains your custom * vocabulary. The URI must be in the same Amazon Web Services Region as the * resource that you're calling.</p> <p>Here's an example URI path:</p> <p> * <code>https://s3.us-east-1.amazonaws.com/my-s3-bucket/my-vocab-file.txt</code> * </p> */ inline void SetVocabularyFileUri(Aws::String&& value) { m_vocabularyFileUriHasBeenSet = true; m_vocabularyFileUri = std::move(value); } /** * <p>The Amazon S3 location (URI) of the text file that contains your custom * vocabulary. The URI must be in the same Amazon Web Services Region as the * resource that you're calling.</p> <p>Here's an example URI path:</p> <p> * <code>https://s3.us-east-1.amazonaws.com/my-s3-bucket/my-vocab-file.txt</code> * </p> */ inline void SetVocabularyFileUri(const char* value) { m_vocabularyFileUriHasBeenSet = true; m_vocabularyFileUri.assign(value); } /** * <p>The Amazon S3 location (URI) of the text file that contains your custom * vocabulary. The URI must be in the same Amazon Web Services Region as the * resource that you're calling.</p> <p>Here's an example URI path:</p> <p> * <code>https://s3.us-east-1.amazonaws.com/my-s3-bucket/my-vocab-file.txt</code> * </p> */ inline CreateMedicalVocabularyRequest& WithVocabularyFileUri(const Aws::String& value) { SetVocabularyFileUri(value); return *this;} /** * <p>The Amazon S3 location (URI) of the text file that contains your custom * vocabulary. The URI must be in the same Amazon Web Services Region as the * resource that you're calling.</p> <p>Here's an example URI path:</p> <p> * <code>https://s3.us-east-1.amazonaws.com/my-s3-bucket/my-vocab-file.txt</code> * </p> */ inline CreateMedicalVocabularyRequest& WithVocabularyFileUri(Aws::String&& value) { SetVocabularyFileUri(std::move(value)); return *this;} /** * <p>The Amazon S3 location (URI) of the text file that contains your custom * vocabulary. The URI must be in the same Amazon Web Services Region as the * resource that you're calling.</p> <p>Here's an example URI path:</p> <p> * <code>https://s3.us-east-1.amazonaws.com/my-s3-bucket/my-vocab-file.txt</code> * </p> */ inline CreateMedicalVocabularyRequest& WithVocabularyFileUri(const char* value) { SetVocabularyFileUri(value); return *this;} /** * <p>Adds one or more tags, each in the form of a key:value pair, to a new medical * vocabulary at the time you create the new vocabulary.</p> <p>To learn more about * using tags with Amazon Transcribe, refer to <a * href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging * resources</a>.</p> */ inline const Aws::Vector<Tag>& GetTags() const{ return m_tags; } /** * <p>Adds one or more tags, each in the form of a key:value pair, to a new medical * vocabulary at the time you create the new vocabulary.</p> <p>To learn more about * using tags with Amazon Transcribe, refer to <a * href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging * resources</a>.</p> */ inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } /** * <p>Adds one or more tags, each in the form of a key:value pair, to a new medical * vocabulary at the time you create the new vocabulary.</p> <p>To learn more about * using tags with Amazon Transcribe, refer to <a * href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging * resources</a>.</p> */ inline void SetTags(const Aws::Vector<Tag>& value) { m_tagsHasBeenSet = true; m_tags = value; } /** * <p>Adds one or more tags, each in the form of a key:value pair, to a new medical * vocabulary at the time you create the new vocabulary.</p> <p>To learn more about * using tags with Amazon Transcribe, refer to <a * href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging * resources</a>.</p> */ inline void SetTags(Aws::Vector<Tag>&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } /** * <p>Adds one or more tags, each in the form of a key:value pair, to a new medical * vocabulary at the time you create the new vocabulary.</p> <p>To learn more about * using tags with Amazon Transcribe, refer to <a * href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging * resources</a>.</p> */ inline CreateMedicalVocabularyRequest& WithTags(const Aws::Vector<Tag>& value) { SetTags(value); return *this;} /** * <p>Adds one or more tags, each in the form of a key:value pair, to a new medical * vocabulary at the time you create the new vocabulary.</p> <p>To learn more about * using tags with Amazon Transcribe, refer to <a * href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging * resources</a>.</p> */ inline CreateMedicalVocabularyRequest& WithTags(Aws::Vector<Tag>&& value) { SetTags(std::move(value)); return *this;} /** * <p>Adds one or more tags, each in the form of a key:value pair, to a new medical * vocabulary at the time you create the new vocabulary.</p> <p>To learn more about * using tags with Amazon Transcribe, refer to <a * href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging * resources</a>.</p> */ inline CreateMedicalVocabularyRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; } /** * <p>Adds one or more tags, each in the form of a key:value pair, to a new medical * vocabulary at the time you create the new vocabulary.</p> <p>To learn more about * using tags with Amazon Transcribe, refer to <a * href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging * resources</a>.</p> */ inline CreateMedicalVocabularyRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; } private: Aws::String m_vocabularyName; bool m_vocabularyNameHasBeenSet; LanguageCode m_languageCode; bool m_languageCodeHasBeenSet; Aws::String m_vocabularyFileUri; bool m_vocabularyFileUriHasBeenSet; Aws::Vector<Tag> m_tags; bool m_tagsHasBeenSet; }; } // namespace Model } // namespace TranscribeService } // namespace Aws
47.938907
142
0.688913
[ "vector", "model" ]
c54729545adccd1b64e2cb951e599cb13b87a78d
16,276
c
C
src/rpi_gpio.c
matematik7/rpi-dashboard
9b1382089dd04a0f610f2e8ed7689cda1eb58c3c
[ "Apache-2.0" ]
51
2015-02-14T21:58:19.000Z
2021-01-30T05:38:06.000Z
src/rpi_gpio.c
domenipavec/rpi-dashboard
9b1382089dd04a0f610f2e8ed7689cda1eb58c3c
[ "Apache-2.0" ]
2
2015-08-29T01:06:44.000Z
2017-12-28T21:34:20.000Z
src/rpi_gpio.c
matematik7/rpi-dashboard
9b1382089dd04a0f610f2e8ed7689cda1eb58c3c
[ "Apache-2.0" ]
20
2015-04-29T06:32:01.000Z
2020-04-13T09:45:49.000Z
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Raspberry Pi Dasboard * ===================== * Copyright 2014 Domen Ipavec <domen.ipavec@z-v.si> * * 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 "rpi_gpio.h" #include "rpi_modules.h" #include "rpi_websocket.h" #include "packages/json/json.h" #include "packages/websocket/websocket.h" #include <wiringPi.h> #include <softPwm.h> #include <softTone.h> #include <sys/wait.h> static gpio_pin_t pins[MAX_PINS]; static int npins; static const char *gpio_mode_str[] = { "undefined", "input", "output", "pwm", "tone" }; static const char *gpio_pull_str[] = { "off", "down", "up" }; static int gpio_channel; static void init_pin(int i) { pins[i].mode = GPIO_UNDEFINED; pins[i].pull = PUD_OFF; pins[i].value = 0; pins[i].frequency = 1000; pins[i].range = 100; pins[i].interrupts = 0; } static void recalculate_hw_pwm_clock() { double calc = 19200000.0; calc /= pins[HWPWM].frequency; calc /= pins[HWPWM].range; int div = (int)(calc+0.5); if (div < 2) { div = 2; } pwmSetClock(div); } static void pin_changed(int i) { json_t *object; char key[3]; char *response; if (pins[i].mode != GPIO_INPUT) { delay(1000); return; } sprintf(key, "%d", i); object = json->create_object(); json->add_to_object(object, key, json->create_number((double)digitalRead(i))); response = json->print(object); websocket->broadcast_all((unsigned char *)response, strlen(response), WS_OPCODE_TEXT, gpio_channel); json->delete(object); mem->free(response); } static void isr0(void) { pin_changed(0); } static void isr1(void) { pin_changed(1); } static void isr2(void) { pin_changed(2); } static void isr3(void) { pin_changed(3); } static void isr4(void) { pin_changed(4); } static void isr5(void) { pin_changed(5); } static void isr6(void) { pin_changed(6); } static void isr7(void) { pin_changed(7); } static void isr8(void) { pin_changed(8); } static void isr9(void) { pin_changed(9); } static void isr10(void) { pin_changed(10); } static void isr11(void) { pin_changed(11); } static void isr12(void) { pin_changed(12); } static void isr13(void) { pin_changed(13); } static void isr14(void) { pin_changed(14); } static void isr15(void) { pin_changed(15); } static void isr16(void) { pin_changed(16); } static void isr17(void) { pin_changed(17); } static void isr18(void) { pin_changed(18); } static void isr19(void) { pin_changed(19); } static void isr20(void) { pin_changed(20); } static void gpio_set_edge(int i, const char *edge) { char pin_s[8]; pid_t pid; sprintf(pin_s, "%d", wpiPinToGpio(i)); if ((pid = fork()) < 0) { // Fail msg->err("wiringPiISR: fork failed: %s", strerror(errno)); return; } if (pid == 0) { // Child, exec if (access ("/usr/local/bin/gpio", X_OK) == 0) { execl("/usr/local/bin/gpio", "gpio", "edge", pin_s, edge, (char *)NULL); msg->err("wiringPiISR: execl failed: %s", strerror(errno)); return; } else if (access ("/usr/bin/gpio", X_OK) == 0) { execl ("/usr/bin/gpio", "gpio", "edge", pin_s, edge, (char *)NULL); msg->err("wiringPiISR: execl failed: %s", strerror(errno)); return; } else { msg->err("wiringPiISR: Can't find gpio program"); return; } } else { // Parent, wait wait(NULL); } } static void interrupts_enable(int i) { if (!pins[i].interrupts) { pins[i].interrupts = 1; switch (i) { case 0: wiringPiISR(0, INT_EDGE_BOTH, &isr0); break; case 1: wiringPiISR(1, INT_EDGE_BOTH, &isr1); break; case 2: wiringPiISR(2, INT_EDGE_BOTH, &isr2); break; case 3: wiringPiISR(3, INT_EDGE_BOTH, &isr3); break; case 4: wiringPiISR(4, INT_EDGE_BOTH, &isr4); break; case 5: wiringPiISR(5, INT_EDGE_BOTH, &isr5); break; case 6: wiringPiISR(6, INT_EDGE_BOTH, &isr6); break; case 7: wiringPiISR(7, INT_EDGE_BOTH, &isr7); break; case 8: wiringPiISR(8, INT_EDGE_BOTH, &isr8); break; case 9: wiringPiISR(9, INT_EDGE_BOTH, &isr9); break; case 10: wiringPiISR(10, INT_EDGE_BOTH, &isr10); break; case 11: wiringPiISR(11, INT_EDGE_BOTH, &isr11); break; case 12: wiringPiISR(12, INT_EDGE_BOTH, &isr12); break; case 13: wiringPiISR(13, INT_EDGE_BOTH, &isr13); break; case 14: wiringPiISR(14, INT_EDGE_BOTH, &isr14); break; case 15: wiringPiISR(15, INT_EDGE_BOTH, &isr15); break; case 16: wiringPiISR(16, INT_EDGE_BOTH, &isr16); break; case 17: wiringPiISR(17, INT_EDGE_BOTH, &isr17); break; case 18: wiringPiISR(18, INT_EDGE_BOTH, &isr18); break; case 19: wiringPiISR(19, INT_EDGE_BOTH, &isr19); break; case 20: wiringPiISR(20, INT_EDGE_BOTH, &isr20); break; } } else { gpio_set_edge(i, "both"); } } static void interrupts_disable(int i) { if (pins[i].interrupts) { gpio_set_edge(i, "none"); } } json_t * rpi_gpio_mode_get(duda_request_t *dr, int parameter) { return json->create_string(gpio_mode_str[pins[parameter].mode]); } json_t * rpi_gpio_mode_post(duda_request_t *dr, json_t *data, int parameter) { int i, mode; if (data->type != cJSON_String) { return NULL; } for (mode = -1, i = 1; i < sizeof(gpio_mode_str)/sizeof(const char *); i++) { if (strcmp(data->valuestring, gpio_mode_str[i]) == 0) { mode = i; break; } } if (mode == -1) { return NULL; } if (mode == pins[parameter].mode) { return json->create_string("Successful!"); } if (pins[parameter].mode == GPIO_PWM && parameter != HWPWM) { softPwmStop(parameter); } if (pins[parameter].mode == GPIO_TONE) { softToneStop(parameter); } if (pins[parameter].mode == GPIO_INPUT) { interrupts_disable(parameter); } pins[parameter].mode = mode; switch (mode) { case GPIO_INPUT: pinMode(parameter, INPUT); pullUpDnControl(parameter, pins[parameter].pull); interrupts_enable(parameter); break; case GPIO_OUTPUT: pinMode(parameter, OUTPUT); digitalWrite(parameter, pins[parameter].value); break; case GPIO_PWM: if (parameter == HWPWM) { pinMode(parameter, PWM_OUTPUT); pwmSetMode(PWM_MODE_MS); pwmWrite(parameter, pins[parameter].value); pwmSetRange(pins[parameter].range); recalculate_hw_pwm_clock(); } else { pinMode(parameter, OUTPUT); softPwmCreate(parameter, pins[parameter].value, pins[parameter].range); } break; case GPIO_TONE: pinMode(parameter, OUTPUT); softToneCreate(parameter); if (pins[parameter].value == 0) { softToneWrite(parameter, 0); } else { softToneWrite(parameter, pins[parameter].frequency); } break; } return json->create_string("Successful!"); } json_t * rpi_gpio_pull_get(duda_request_t *dr, int parameter) { return json->create_string(gpio_pull_str[pins[parameter].pull]); } json_t * rpi_gpio_pull_post(duda_request_t *dr, json_t *data, int parameter) { int i, pull; if (data->type != cJSON_String) { return NULL; } for (pull = -1, i = 0; i < sizeof(gpio_pull_str)/sizeof(const char *); i++) { if (strcmp(data->valuestring, gpio_pull_str[i]) == 0) { pull = i; break; } } if (pull == -1) { return NULL; } if (pull == pins[parameter].pull) { return json->create_string("Successful!"); } pins[parameter].pull = pull; if (pins[parameter].mode == GPIO_INPUT) { pullUpDnControl(parameter, pull); } return json->create_string("Successful!"); } json_t * rpi_gpio_value_get(duda_request_t *dr, int parameter) { if (pins[parameter].mode <= GPIO_INPUT) { return json->create_number((double)digitalRead(parameter)); } return json->create_number((double)pins[parameter].value); } json_t * rpi_gpio_value_post(duda_request_t *dr, json_t *data, int parameter) { if (data->type != cJSON_Number) { return NULL; } int value = data->valueint; if (value < 0 || value > pins[parameter].range) { return NULL; } if (value == pins[parameter].value) { return json->create_string("Successful!"); } pins[parameter].value = value; switch (pins[parameter].mode) { case GPIO_UNDEFINED: case GPIO_INPUT: break; case GPIO_OUTPUT: digitalWrite(parameter, value); break; case GPIO_PWM: if (parameter == HWPWM) { pwmWrite(parameter, value); } else { softPwmWrite(parameter, value); } break; case GPIO_TONE: if (value == 0) { softToneWrite(parameter, 0); } else { softToneWrite(parameter, pins[parameter].frequency); } break; } return json->create_string("Successful!"); } json_t * rpi_gpio_frequency_get(duda_request_t *dr, int parameter) { return json->create_number((double)pins[parameter].frequency); } json_t * rpi_gpio_frequency_post(duda_request_t *dr, json_t *data, int parameter) { if (data->type != cJSON_Number) { return NULL; } int frequency = data->valueint; if (frequency < 1) { return NULL; } if (frequency == pins[parameter].frequency) { return json->create_string("Successful!"); } pins[parameter].frequency = frequency; if (pins[parameter].mode == GPIO_TONE && pins[parameter].value != 0) { softToneWrite(parameter, frequency); } if (pins[parameter].mode == GPIO_PWM && parameter == HWPWM) { recalculate_hw_pwm_clock(); } return json->create_string("Successful!"); } json_t * rpi_gpio_range_get(duda_request_t *dr, int parameter) { return json->create_number((double)pins[parameter].range); } json_t * rpi_gpio_range_post(duda_request_t *dr, json_t *data, int parameter) { if (data->type != cJSON_Number) { return NULL; } int range = data->valueint; if (range < 1) { return NULL; } if (range == pins[parameter].range) { return json->create_string("Successful!"); } pins[parameter].range = range; if (pins[parameter].value > range) { pins[parameter].value = range; } if (pins[parameter].mode == GPIO_PWM) { if (parameter == HWPWM) { pwmSetRange(range); recalculate_hw_pwm_clock(); } else { softPwmStop(parameter); softPwmCreate(parameter, pins[parameter].value, range); } } return json->create_string("Successful!"); } json_t * rpi_gpio_pin_post(duda_request_t *dr, json_t *data, int parameter) { json_t *item; json_t *ret; int success = 1; if (data->type != cJSON_Object) { return NULL; } item = json->get_object_item(data, "mode"); if (item != NULL) { if ((ret = rpi_gpio_mode_post(dr, item, parameter)) != NULL) { json->delete(ret); } else { success = 0; } } item = json->get_object_item(data, "pull"); if (item != NULL) { if ((ret = rpi_gpio_pull_post(dr, item, parameter)) != NULL) { json->delete(ret); } else { success = 0; } } item = json->get_object_item(data, "range"); if (item != NULL) { if ((ret = rpi_gpio_range_post(dr, item, parameter)) != NULL) { json->delete(ret); } else { success = 0; } } item = json->get_object_item(data, "value"); if (item != NULL) { if ((ret = rpi_gpio_value_post(dr, item, parameter)) != NULL) { json->delete(ret); } else { success = 0; } } item = json->get_object_item(data, "frequency"); if (item != NULL) { if ((ret = rpi_gpio_frequency_post(dr, item, parameter)) != NULL) { json->delete(ret); } else { success = 0; } } if (success == 0) { return NULL; } return json->create_string("Successful!"); } json_t * rpi_gpio_post(duda_request_t *dr, json_t *data, int parameter) { json_t *child; json_t *ret = json->create_object(); json_t *child_ret; for (child = data->child; child; child = child->next) { parameter = atoi(child->string); if (parameter >= 0 && parameter < npins) { child_ret = rpi_gpio_pin_post(dr, child, parameter); if (child_ret == NULL) { json->add_to_object(ret, child->string, json->create_string("Unsupported action or invalid parameters!")); } else { json->add_to_object(ret, child->string, child_ret); } } else { json->add_to_object(ret, child->string, json->create_string("Unsupported action or invalid parameters!")); } } return ret; } json_t * rpi_gpio_ws(duda_request_t *dr, int parameter) { return rpi_websocket_handshake(dr, gpio_channel); } /* register and initialize module */ void rpi_gpio_init(void) { int i; const char *valueHandle; gpio_channel = rpi_websocket_get_channel(); rpi_module_t *module = rpi_modules_module_init("gpio", NULL, rpi_gpio_post); if (module != NULL) { wiringPiSetup(); if (piBoardRev() == 1) { valueHandle = "%d0:16"; npins = 17; } else { valueHandle = "%d0:20"; npins = 21; } for (i = 0; i < npins; i++) { init_pin(i); } rpi_modules_value_init("ws", rpi_gpio_ws, NULL, &(module->values_head.values)); rpi_module_value_t *pins = rpi_modules_branch_init("pins", NULL, &(module->values_head.values)); rpi_module_value_t *branch = rpi_modules_branch_init(valueHandle, rpi_gpio_pin_post, &(pins->values)); rpi_modules_value_init("mode", rpi_gpio_mode_get, rpi_gpio_mode_post, &(branch->values)); rpi_modules_value_init("pull", rpi_gpio_pull_get, rpi_gpio_pull_post, &(branch->values)); rpi_modules_value_init("value", rpi_gpio_value_get, rpi_gpio_value_post, &(branch->values)); rpi_modules_value_init("frequency", rpi_gpio_frequency_get, rpi_gpio_frequency_post, &(branch->values)); rpi_modules_value_init("range", rpi_gpio_range_get, rpi_gpio_range_post, &(branch->values)); } }
28.15917
122
0.566663
[ "object" ]
68e9799b48e76fa4167ee492e772be36a0f14dd4
1,949
h
C
src/organizer.h
JoelSjogren/video-organizer
fc5a5c1a2fce39f2b9d8343c07c53108321ef260
[ "Apache-2.0" ]
2
2015-04-17T11:28:57.000Z
2016-11-13T13:03:08.000Z
src/organizer.h
JoelSjogren/video-organizer
fc5a5c1a2fce39f2b9d8343c07c53108321ef260
[ "Apache-2.0" ]
null
null
null
src/organizer.h
JoelSjogren/video-organizer
fc5a5c1a2fce39f2b9d8343c07c53108321ef260
[ "Apache-2.0" ]
null
null
null
/********************************** * organizer.h * * * * The core of all organization. * **********************************/ /**************************************************** * When the console arguments have been parsed, an * * Organizer is constructed. Then the following * * functions call each other: * * * * 1. run() * * 2. iterate() * * 3. launch() for each file * * 4. argument action() -> sort() or undo() * ****************************************************/ #pragma once #include "args.h" #include "fileman.h" #include "parser.h" #include <string> #include <vector> #include <boost/function.hpp> // passing functions as arguments class Organizer { /* configuration */ const Args args; /* file operations */ FileMan fileman; /* filename parsing */ std::vector<FilmParser*> filmParsers; std::vector<SeriesParser*> seriesParsers; // find a parser that is capable of parsing *fnam* // returns index int findFilmParser(std::string fnam); int findSeriesParser(std::string fnam); /* console output*/ Console console; void initParsers(); // iterate over input files void iterate(boost::function<void (Organizer*, std::string)> action); void launch(boost::function<void (Organizer*, std::string)> action, std::string full); // a directory is valuable if it contains parsable files bool isValuable(std::string directory); // full - e.g. "somedir/Film.2010.mp4" void undo(std::string full); void sort(std::string full); // known by filename, not filelist static bool isSorted(std::string full); bool shouldClean(std::string directory); friend class OrganizerTest; public: Organizer(const Args& pargs); void run(); ~Organizer(); };
30.453125
63
0.54079
[ "vector" ]
68ebd8a82c6bbe4540a5ffb85f5afe823d374d6e
22,695
c
C
code/tools/xmap/light_trace.c
raynorpat/xreal
2fcbf9179fa22dc6e808bb65b879ac2ee7616ebd
[ "BSD-3-Clause" ]
11
2016-06-03T07:46:15.000Z
2021-09-09T19:35:32.000Z
code/tools/xmap/light_trace.c
raynorpat/xreal
2fcbf9179fa22dc6e808bb65b879ac2ee7616ebd
[ "BSD-3-Clause" ]
1
2016-10-14T23:06:19.000Z
2016-10-14T23:06:19.000Z
code/tools/xmap/light_trace.c
raynorpat/xreal
2fcbf9179fa22dc6e808bb65b879ac2ee7616ebd
[ "BSD-3-Clause" ]
5
2016-10-13T04:43:58.000Z
2019-08-24T14:03:35.000Z
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. Copyright (C) 2006 Robert Beckebans <trebor_7@users.sourceforge.net> This file is part of XreaL source code. XreaL source code 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. XreaL source code 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 XreaL source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ #include "light.h" #define CURVE_FACET_ERROR 8 int c_totalTrace; int c_cullTrace, c_testTrace; int c_testFacets; surfaceTest_t *surfaceTest[MAX_MAP_DRAW_SURFS]; /* ===================== CM_GenerateBoundaryForPoints ===================== */ void CM_GenerateBoundaryForPoints(float boundary[4], float plane[4], vec3_t a, vec3_t b) { vec3_t d1; // amke a perpendicular vector to the edge and the surface VectorSubtract(b, a, d1); CrossProduct(plane, d1, boundary); VectorNormalize(boundary); boundary[3] = DotProduct(a, boundary); } /* ===================== TextureMatrixFromPoints ===================== */ void TextureMatrixFromPoints(cFacet_t * f, drawVert_t * a, drawVert_t * b, drawVert_t * c) { int i, j; float t; float m[3][4]; float s; // This is an incredibly stupid way of solving a three variable equation for(i = 0; i < 2; i++) { m[0][0] = a->xyz[0]; m[0][1] = a->xyz[1]; m[0][2] = a->xyz[2]; m[0][3] = a->st[i]; m[1][0] = b->xyz[0]; m[1][1] = b->xyz[1]; m[1][2] = b->xyz[2]; m[1][3] = b->st[i]; m[2][0] = c->xyz[0]; m[2][1] = c->xyz[1]; m[2][2] = c->xyz[2]; m[2][3] = c->st[i]; if(fabs(m[1][0]) > fabs(m[0][0]) && fabs(m[1][0]) > fabs(m[2][0])) { for(j = 0; j < 4; j++) { t = m[0][j]; m[0][j] = m[1][j]; m[1][j] = t; } } else if(fabs(m[2][0]) > fabs(m[0][0]) && fabs(m[2][0]) > fabs(m[1][0])) { for(j = 0; j < 4; j++) { t = m[0][j]; m[0][j] = m[2][j]; m[2][j] = t; } } s = 1.0 / m[0][0]; m[0][0] *= s; m[0][1] *= s; m[0][2] *= s; m[0][3] *= s; s = m[1][0]; m[1][0] -= m[0][0] * s; m[1][1] -= m[0][1] * s; m[1][2] -= m[0][2] * s; m[1][3] -= m[0][3] * s; s = m[2][0]; m[2][0] -= m[0][0] * s; m[2][1] -= m[0][1] * s; m[2][2] -= m[0][2] * s; m[2][3] -= m[0][3] * s; if(fabs(m[2][1]) > fabs(m[1][1])) { for(j = 0; j < 4; j++) { t = m[1][j]; m[1][j] = m[2][j]; m[2][j] = t; } } s = 1.0 / m[1][1]; m[1][0] *= s; m[1][1] *= s; m[1][2] *= s; m[1][3] *= s; s = m[2][1]; m[2][0] -= m[1][0] * s; m[2][1] -= m[1][1] * s; m[2][2] -= m[1][2] * s; m[2][3] -= m[1][3] * s; s = 1.0 / m[2][2]; m[2][0] *= s; m[2][1] *= s; m[2][2] *= s; m[2][3] *= s; f->textureMatrix[i][2] = m[2][3]; f->textureMatrix[i][1] = m[1][3] - f->textureMatrix[i][2] * m[1][2]; f->textureMatrix[i][0] = m[0][3] - f->textureMatrix[i][2] * m[0][2] - f->textureMatrix[i][1] * m[0][1]; f->textureMatrix[i][3] = 0; /* s = fabs( DotProduct( a->xyz, f->textureMatrix[i] ) - a->st[i] ); if ( s > 0.01 ) { Error( "Bad textureMatrix" ); } s = fabs( DotProduct( b->xyz, f->textureMatrix[i] ) - b->st[i] ); if ( s > 0.01 ) { Error( "Bad textureMatrix" ); } s = fabs( DotProduct( c->xyz, f->textureMatrix[i] ) - c->st[i] ); if ( s > 0.01 ) { Error( "Bad textureMatrix" ); } */ } } /* ===================== CM_GenerateFacetFor3Points ===================== */ qboolean CM_GenerateFacetFor3Points(cFacet_t * f, drawVert_t * a, drawVert_t * b, drawVert_t * c) { // if we can't generate a valid plane for the points, ignore the facet if(!PlaneFromPoints(f->surface, a->xyz, b->xyz, c->xyz, qtrue)) { f->numBoundaries = 0; return qfalse; } // make boundaries f->numBoundaries = 3; CM_GenerateBoundaryForPoints(f->boundaries[0], f->surface, a->xyz, b->xyz); CM_GenerateBoundaryForPoints(f->boundaries[1], f->surface, b->xyz, c->xyz); CM_GenerateBoundaryForPoints(f->boundaries[2], f->surface, c->xyz, a->xyz); VectorCopy(a->xyz, f->points[0]); VectorCopy(b->xyz, f->points[1]); VectorCopy(c->xyz, f->points[2]); TextureMatrixFromPoints(f, a, b, c); return qtrue; } /* ===================== CM_GenerateFacetFor4Points Attempts to use four points as a planar quad ===================== */ #define PLANAR_EPSILON 0.1 qboolean CM_GenerateFacetFor4Points(cFacet_t * f, drawVert_t * a, drawVert_t * b, drawVert_t * c, drawVert_t * d) { float dist; int i; vec4_t plane; // if we can't generate a valid plane for the points, ignore the facet if(!PlaneFromPoints(f->surface, a->xyz, b->xyz, c->xyz, qtrue)) { f->numBoundaries = 0; return qfalse; } // if the fourth point is also on the plane, we can make a quad facet dist = DotProduct(d->xyz, f->surface) - f->surface[3]; if(fabs(dist) > PLANAR_EPSILON) { f->numBoundaries = 0; return qfalse; } // make boundaries f->numBoundaries = 4; CM_GenerateBoundaryForPoints(f->boundaries[0], f->surface, a->xyz, b->xyz); CM_GenerateBoundaryForPoints(f->boundaries[1], f->surface, b->xyz, c->xyz); CM_GenerateBoundaryForPoints(f->boundaries[2], f->surface, c->xyz, d->xyz); CM_GenerateBoundaryForPoints(f->boundaries[3], f->surface, d->xyz, a->xyz); VectorCopy(a->xyz, f->points[0]); VectorCopy(b->xyz, f->points[1]); VectorCopy(c->xyz, f->points[2]); VectorCopy(d->xyz, f->points[3]); for(i = 1; i < 4; i++) { if(!PlaneFromPoints(plane, f->points[i], f->points[(i + 1) % 4], f->points[(i + 2) % 4], qtrue)) { f->numBoundaries = 0; return qfalse; } if(DotProduct(f->surface, plane) < 0.9) { f->numBoundaries = 0; return qfalse; } } TextureMatrixFromPoints(f, a, b, c); return qtrue; } /* =============== SphereFromBounds =============== */ void SphereFromBounds(vec3_t mins, vec3_t maxs, vec3_t origin, float *radius) { vec3_t temp; VectorAdd(mins, maxs, origin); VectorScale(origin, 0.5, origin); VectorSubtract(maxs, origin, temp); *radius = VectorLength(temp); } /* ==================== FacetsForTriangleSurface ==================== */ void FacetsForTriangleSurface(dsurface_t * dsurf, shaderInfo_t * si, surfaceTest_t * test) { int i; drawVert_t *v1, *v2, *v3, *v4; int count; int i1, i2, i3, i4, i5, i6; test->patch = qfalse; test->numFacets = dsurf->numIndexes / 3; test->facets = malloc(sizeof(test->facets[0]) * test->numFacets); test->shader = si; count = 0; for(i = 0; i < test->numFacets; i++) { i1 = drawIndexes[dsurf->firstIndex + i * 3]; i2 = drawIndexes[dsurf->firstIndex + i * 3 + 1]; i3 = drawIndexes[dsurf->firstIndex + i * 3 + 2]; v1 = &drawVerts[dsurf->firstVert + i1]; v2 = &drawVerts[dsurf->firstVert + i2]; v3 = &drawVerts[dsurf->firstVert + i3]; // try and make a quad out of two triangles if(i != test->numFacets - 1) { i4 = drawIndexes[dsurf->firstIndex + i * 3 + 3]; i5 = drawIndexes[dsurf->firstIndex + i * 3 + 4]; i6 = drawIndexes[dsurf->firstIndex + i * 3 + 5]; if(i4 == i3 && i5 == i2) { v4 = &drawVerts[dsurf->firstVert + i6]; if(CM_GenerateFacetFor4Points(&test->facets[count], v1, v2, v4, v3)) { count++; i++; // skip next tri continue; } } } if(CM_GenerateFacetFor3Points(&test->facets[count], v1, v2, v3)) count++; } // we may have turned some pairs into quads test->numFacets = count; } /* ==================== FacetsForPatch ==================== */ void FacetsForPatch(dsurface_t * dsurf, shaderInfo_t * si, surfaceTest_t * test) { int i, j; drawVert_t *v1, *v2, *v3, *v4; int count; mesh_t srcMesh, *subdivided, *mesh; srcMesh.width = dsurf->patchWidth; srcMesh.height = dsurf->patchHeight; srcMesh.verts = &drawVerts[dsurf->firstVert]; //subdivided = SubdivideMesh( mesh, CURVE_FACET_ERROR, 9999 ); mesh = SubdivideMesh(srcMesh, 8, 999); PutMeshOnCurve(*mesh); MakeMeshNormals(*mesh); subdivided = RemoveLinearMeshColumnsRows(mesh); FreeMesh(mesh); test->patch = qtrue; test->numFacets = (subdivided->width - 1) * (subdivided->height - 1) * 2; test->facets = malloc(sizeof(test->facets[0]) * test->numFacets); test->shader = si; count = 0; for(i = 0; i < subdivided->width - 1; i++) { for(j = 0; j < subdivided->height - 1; j++) { v1 = subdivided->verts + j * subdivided->width + i; v2 = v1 + 1; v3 = v1 + subdivided->width + 1; v4 = v1 + subdivided->width; if(CM_GenerateFacetFor4Points(&test->facets[count], v1, v4, v3, v2)) { count++; } else { if(CM_GenerateFacetFor3Points(&test->facets[count], v1, v4, v3)) count++; if(CM_GenerateFacetFor3Points(&test->facets[count], v1, v3, v2)) count++; } } } test->numFacets = count; FreeMesh(subdivided); } /* ===================== InitSurfacesForTesting Builds structures to speed the ray tracing against surfaces ===================== */ void InitSurfacesForTesting(void) { int i, j; dsurface_t *dsurf; surfaceTest_t *test; drawVert_t *dvert; shaderInfo_t *si; for(i = 0; i < numDrawSurfaces; i++) { dsurf = &drawSurfaces[i]; if(!dsurf->numIndexes && !dsurf->patchWidth) { continue; } // don't make surfaces for transparent objects // because we want light to pass through them si = ShaderInfoForShader(dshaders[dsurf->shaderNum].shader); if((si->contents & CONTENTS_TRANSLUCENT) && !(si->surfaceFlags & SURF_ALPHASHADOW)) { continue; } test = malloc(sizeof(*test)); surfaceTest[i] = test; ClearBounds(test->mins, test->maxs); dvert = &drawVerts[dsurf->firstVert]; for(j = 0; j < dsurf->numVerts; j++, dvert++) { AddPointToBounds(dvert->xyz, test->mins, test->maxs); } SphereFromBounds(test->mins, test->maxs, test->origin, &test->radius); if(dsurf->surfaceType == MST_TRIANGLE_SOUP || dsurf->surfaceType == MST_PLANAR) { FacetsForTriangleSurface(dsurf, si, test); } else if(dsurf->surfaceType == MST_PATCH) { FacetsForPatch(dsurf, si, test); } } } /* ===================== GenerateBoundaryForPoints ===================== */ void GenerateBoundaryForPoints(float boundary[4], float plane[4], vec3_t a, vec3_t b) { vec3_t d1; // amke a perpendicular vector to the edge and the surface VectorSubtract(b, a, d1); CrossProduct(plane, d1, boundary); VectorNormalize(boundary); boundary[3] = DotProduct(a, boundary); } /* ================= SetFacetFilter Given a point on a facet, determine the color filter for light passing through ================= */ void SetFacetFilter(traceWork_t * tr, shaderInfo_t * shader, cFacet_t * facet, vec3_t point) { float s, t; int is, it; byte *image; int b; // most surfaces are completely opaque if(!(shader->surfaceFlags & SURF_ALPHASHADOW)) { VectorClear(tr->trace->filter); return; } s = DotProduct(point, facet->textureMatrix[0]) + facet->textureMatrix[0][3]; t = DotProduct(point, facet->textureMatrix[1]) + facet->textureMatrix[1][3]; if(!shader->pixels) { // assume completely solid VectorClear(point); return; } s = s - floor(s); t = t - floor(t); is = s * shader->width; it = t * shader->height; image = shader->pixels + 4 * (it * shader->width + is); // alpha filter b = image[3]; // alpha test makes this a binary option b = b < 128 ? 0 : 255; tr->trace->filter[0] = tr->trace->filter[0] * (255 - b) / 255; tr->trace->filter[1] = tr->trace->filter[1] * (255 - b) / 255; tr->trace->filter[2] = tr->trace->filter[2] * (255 - b) / 255; } /* ==================== TraceAgainstFacet Shader is needed for translucent surfaces ==================== */ void TraceAgainstFacet(traceWork_t * tr, shaderInfo_t * shader, cFacet_t * facet) { int j; float d1, d2, d, f; vec3_t point; float dist; // ignore degenerate facets if(facet->numBoundaries < 3) { return; } dist = facet->surface[3]; // compare the trace endpoints against the facet plane d1 = DotProduct(tr->start, facet->surface) - dist; if(d1 > -1 && d1 < 1) { return; // don't self intersect } d2 = DotProduct(tr->end, facet->surface) - dist; if(d2 > -1 && d2 < 1) { return; // don't self intersect } // calculate the intersection fraction f = (d1 - ON_EPSILON) / (d1 - d2); if(f <= 0) { return; } if(f >= tr->trace->hitFraction) { return; // we have hit something earlier } // calculate the intersection point for(j = 0; j < 3; j++) { point[j] = tr->start[j] + f * (tr->end[j] - tr->start[j]); } // check the point against the facet boundaries for(j = 0; j < facet->numBoundaries; j++) { // adjust the plane distance apropriately for mins/maxs dist = facet->boundaries[j][3]; d = DotProduct(point, facet->boundaries[j]); if(d > dist + ON_EPSILON) { break; // outside the bounds } } if(j != facet->numBoundaries) { return; // we are outside the bounds of the facet } // we hit this facet // if this is a transparent surface, calculate filter value if(shader->surfaceFlags & SURF_ALPHASHADOW) { SetFacetFilter(tr, shader, facet, point); } else { // completely opaque VectorClear(tr->trace->filter); tr->trace->hitFraction = f; } // VectorCopy( facet->surface, tr->trace->plane.normal ); // tr->trace->plane.dist = facet->surface[3]; } /* =============================================================== LINE TRACING =============================================================== */ #define TRACE_ON_EPSILON 0.1 typedef struct tnode_s { int type; vec3_t normal; float dist; int children[2]; int planeNum; } tnode_t; #define MAX_TNODES (MAX_MAP_NODES*4) tnode_t *tnodes, *tnode_p; /* ============== MakeTnode Converts the disk node structure into the efficient tracing structure ============== */ void MakeTnode(int nodenum) { tnode_t *t; dplane_t *plane; int i; dnode_t *node; int leafNum; t = tnode_p++; node = dnodes + nodenum; plane = dplanes + node->planeNum; t->planeNum = node->planeNum; t->type = PlaneTypeForNormal(plane->normal); VectorCopy(plane->normal, t->normal); t->dist = plane->dist; for(i = 0; i < 2; i++) { if(node->children[i] < 0) { leafNum = -node->children[i] - 1; if(dleafs[leafNum].cluster == -1) { // solid t->children[i] = leafNum | (1 << 31) | (1 << 30); } else { t->children[i] = leafNum | (1 << 31); } } else { t->children[i] = tnode_p - tnodes; MakeTnode(node->children[i]); } } } /* ============= InitTrace Loads the node structure out of a .bsp file to be used for light occlusion ============= */ void InitTrace(void) { // 32 byte align the structs tnodes = malloc((MAX_TNODES + 1) * sizeof(tnode_t)); tnodes = (tnode_t *) (((int)tnodes + 31) & ~31); tnode_p = tnodes; MakeTnode(0); InitSurfacesForTesting(); } /* =================== PointInSolid =================== */ qboolean PointInSolid_r(vec3_t start, int node) { tnode_t *tnode; float front; while(!(node & (1 << 31))) { tnode = &tnodes[node]; switch (tnode->type) { case PLANE_X: front = start[0] - tnode->dist; break; case PLANE_Y: front = start[1] - tnode->dist; break; case PLANE_Z: front = start[2] - tnode->dist; break; default: front = (start[0] * tnode->normal[0] + start[1] * tnode->normal[1] + start[2] * tnode->normal[2]) - tnode->dist; break; } if(front == 0) { // exactly on node, must check both sides return (qboolean) (PointInSolid_r(start, tnode->children[0]) | PointInSolid_r(start, tnode->children[1])); } if(front > 0) { node = tnode->children[0]; } else { node = tnode->children[1]; } } if(node & (1 << 30)) { return qtrue; } return qfalse; } /* ============= PointInSolid ============= */ qboolean PointInSolid(vec3_t start) { return PointInSolid_r(start, 0); } /* ============= TraceLine_r Returns qtrue if something is hit and tracing can stop ============= */ int TraceLine_r(int node, const vec3_t start, const vec3_t stop, traceWork_t * tw) { tnode_t *tnode; float front, back; vec3_t mid; float frac; int side; int r; if(node & (1 << 31)) { if(node & (1 << 30)) { VectorCopy(start, tw->trace->hit); tw->trace->passSolid = qtrue; return qtrue; } else { // save the node off for more exact testing if(tw->numOpenLeafs == MAX_MAP_LEAFS) { return qfalse; } tw->openLeafNumbers[tw->numOpenLeafs] = node & ~(3 << 30); tw->numOpenLeafs++; return qfalse; } } tnode = &tnodes[node]; switch (tnode->type) { case PLANE_X: front = start[0] - tnode->dist; back = stop[0] - tnode->dist; break; case PLANE_Y: front = start[1] - tnode->dist; back = stop[1] - tnode->dist; break; case PLANE_Z: front = start[2] - tnode->dist; back = stop[2] - tnode->dist; break; default: front = (start[0] * tnode->normal[0] + start[1] * tnode->normal[1] + start[2] * tnode->normal[2]) - tnode->dist; back = (stop[0] * tnode->normal[0] + stop[1] * tnode->normal[1] + stop[2] * tnode->normal[2]) - tnode->dist; break; } if(front >= -TRACE_ON_EPSILON && back >= -TRACE_ON_EPSILON) { return TraceLine_r(tnode->children[0], start, stop, tw); } if(front < TRACE_ON_EPSILON && back < TRACE_ON_EPSILON) { return TraceLine_r(tnode->children[1], start, stop, tw); } side = front < 0; frac = front / (front - back); mid[0] = start[0] + (stop[0] - start[0]) * frac; mid[1] = start[1] + (stop[1] - start[1]) * frac; mid[2] = start[2] + (stop[2] - start[2]) * frac; r = TraceLine_r(tnode->children[side], start, mid, tw); if(r) { return r; } // trace->planeNum = tnode->planeNum; return TraceLine_r(tnode->children[!side], mid, stop, tw); } //========================================================================================== /* ================ SphereCull ================ */ qboolean SphereCull(vec3_t start, vec3_t stop, vec3_t origin, float radius) { vec3_t v; float d; vec3_t dir; float len; vec3_t on; VectorSubtract(stop, start, dir); len = VectorNormalize(dir); VectorSubtract(origin, start, v); d = DotProduct(v, dir); if(d > len + radius) { return qtrue; // too far ahead } if(d < -radius) { return qtrue; // too far behind } VectorMA(start, d, dir, on); VectorSubtract(on, origin, v); len = VectorLength(v); if(len > radius) { return qtrue; // too far to the side } return qfalse; // must be traced against } /* ================ TraceAgainstSurface ================ */ void TraceAgainstSurface(traceWork_t * tw, surfaceTest_t * surf) { int i; // if surfaces are trans if(SphereCull(tw->start, tw->end, surf->origin, surf->radius)) { if(numthreads == 1) { c_cullTrace++; } return; } if(numthreads == 1) { c_testTrace++; c_testFacets += surf->numFacets; } /* // MrE: backface culling if (!surf->patch && surf->numFacets) { // if the surface does not cast an alpha shadow if ( !(surf->shader->surfaceFlags & SURF_ALPHASHADOW) ) { vec3_t vec; VectorSubtract(tw->end, tw->start, vec); if (DotProduct(vec, surf->facets->surface) > 0) return; } } */ // test against each facet for(i = 0; i < surf->numFacets; i++) { TraceAgainstFacet(tw, surf->shader, surf->facets + i); } } /* ============= TraceLine Follow the trace just through the solid leafs first, and only if it passes that, trace against the objects inside the empty leafs Returns qtrue if the trace hit any traceWork_t is only a parameter to crutch up poor large local allocations on winNT and macOS. It should be allocated in the worker function, but never looked at. leave testAll false if all you care about is if it hit anything at all. if you need to know the exact first point of impact (for a sun trace), set testAll to true ============= */ extern qboolean patchshadows; void TraceLine(const vec3_t start, const vec3_t stop, trace_t * trace, qboolean testAll, traceWork_t * tw) { int r; int i, j; dleaf_t *leaf; float oldHitFrac; surfaceTest_t *test; int surfaceNum; byte surfaceTested[MAX_MAP_DRAW_SURFS / 8]; ; if(numthreads == 1) { c_totalTrace++; } // assume all light gets through, unless the ray crosses // a translucent surface trace->filter[0] = 1.0; trace->filter[1] = 1.0; trace->filter[2] = 1.0; VectorCopy(start, tw->start); VectorCopy(stop, tw->end); tw->trace = trace; tw->numOpenLeafs = 0; trace->passSolid = qfalse; trace->hitFraction = 1.0; r = TraceLine_r(0, start, stop, tw); // if we hit a solid leaf, stop without testing the leaf // surfaces. Note that the plane and endpoint might not // be the first solid intersection along the ray. if(r && !testAll) { return; } if(noSurfaces) { return; } memset(surfaceTested, 0, (numDrawSurfaces + 7) / 8); oldHitFrac = trace->hitFraction; for(i = 0; i < tw->numOpenLeafs; i++) { leaf = &dleafs[tw->openLeafNumbers[i]]; for(j = 0; j < leaf->numLeafSurfaces; j++) { surfaceNum = dleafsurfaces[leaf->firstLeafSurface + j]; // make sure we don't test the same ray against a surface more than once if(surfaceTested[surfaceNum >> 3] & (1 << (surfaceNum & 7))) { continue; } surfaceTested[surfaceNum >> 3] |= (1 << (surfaceNum & 7)); test = surfaceTest[surfaceNum]; if(!test) { continue; } // if(!tw->patchshadows && test->patch) { continue; } TraceAgainstSurface(tw, test); } // if the trace is now solid, we can't possibly hit anything closer if(trace->hitFraction < oldHitFrac) { trace->passSolid = qtrue; break; } } for(i = 0; i < 3; i++) { trace->hit[i] = start[i] + (stop[i] - start[i]) * trace->hitFraction; } }
21.717703
116
0.577837
[ "mesh", "vector", "solid" ]
68f1408e4754eeb5a48d8426852b96472af2001d
9,532
h
C
source/MaterialXRender/ShaderValidators/Osl/OslValidator.h
AndrewJDR/MaterialX
0636df86e0fe5167b77a0b01b6fedf9179cbe6ed
[ "BSL-1.0" ]
null
null
null
source/MaterialXRender/ShaderValidators/Osl/OslValidator.h
AndrewJDR/MaterialX
0636df86e0fe5167b77a0b01b6fedf9179cbe6ed
[ "BSL-1.0" ]
null
null
null
source/MaterialXRender/ShaderValidators/Osl/OslValidator.h
AndrewJDR/MaterialX
0636df86e0fe5167b77a0b01b6fedf9179cbe6ed
[ "BSL-1.0" ]
null
null
null
#ifndef MATERIALX_OslValidator_H #define MATERIALX_OslValidator_H #include <MaterialXRender/ShaderValidators/ShaderValidator.h> #include <MaterialXRender/ShaderValidators/ExceptionShaderValidationError.h> #include <MaterialXRender/Handlers/ImageHandler.h> #include <vector> #include <string> #include <map> namespace MaterialX { // Shared pointer to an OslValidator using OslValidatorPtr = std::shared_ptr<class OslValidator>; /// @class @OslValidator /// Helper class to perform validation of OSL source code generated by an OSL code generator. /// /// The main services provided are: /// - Source code validation: Use of oslc to compile and test output results /// - Introspection check: None at this time. /// - Binding: None at this time. /// - Render validation: Use of "testshade" to output rendered images. Assumes source compliation was success /// as it depends on the existence of corresponding .oso files. /// class OslValidator : public ShaderValidator { public: /// Create an OSL validator instance static OslValidatorPtr create(); /// Destructor virtual ~OslValidator(); /// Color closure OSL string static std::string OSL_CLOSURE_COLOR_STRING; /// @name Setup /// @{ /// Internal initialization required for program validation and rendering. /// An exception is thrown on failure. /// The exception will contain a list of initialization errors. void initialize() override; /// @} /// @name Validation /// @{ /// Validate creation of an OSL program based on an input shader /// /// A valid executable and include path must be specified before calling this method. /// setOslCompilerExecutable(), and setOslIncludePath(). /// /// Additionally setOslOutputFilePath() should be set to allow for output of .osl and .oso /// files to the appropriate path location to be used as input for render validation. /// /// If render validation is not required, then the same temporary name will be used for /// all shaders validated using this method. /// @param shader Input shader void validateCreation(const ShaderPtr shader) override; /// Validate creation of an OSL program based upon a shader string for a given /// shader "stage". There is only one shader stage for OSL thus /// @param stages List of shader strings. Only first string in list is examined. void validateCreation(const std::vector<std::string>& stages) override; /// Validate inputs for the compiled OSL program. /// Note: Currently no validation has been implemented. void validateInputs() override; /// Validate that an appropriate rendered result is produced. /// This is done by using either "testshade" or "testrender". /// Currently only "testshade" is supported. /// /// Usage of both executables requires compiled source (.oso) files as input. /// A shader output must be set before running this test via the setOslOutputName() method to /// ensure that the appropriate .oso files can be located. /// /// @param orthographicView Render orthographically void validateRender(bool orthographicView=true) override; /// @} /// @name Utilities /// @{ /// Save the current contents a rendering to disk. Note that this method /// does not perform any action as validateRender() produces images as part if it's /// execution. /// @param fileName Name of file to save rendered image to. /// @param floatingPoint Format of output image is floating point. void save(const std::string& fileName, bool floatingPoint) override; /// @} /// @name Compilation settings /// @{ /// Set the OSL executable path string. Note that it is assumed that this /// references the location of the oslc executable. /// @param executable Full path to OSL compiler executable void setOslCompilerExecutable(const std::string& executable) { _oslCompilerExecutable = executable; } /// Set the OSL include path string. /// @param includePathString Include path(s) for the OSL compiler. This should include the /// path to stdosl.h void setOslIncludePath(const std::string& includePathString) { _oslIncludePathString = includePathString; } /// Set OSL output name, excluding any extension. /// During compiler checking an OSL file of the given output name will be used if it /// is not empty. If temp then OSL will be written to a temporary file. /// @param filePathString Full path name void setOslOutputFilePath(const std::string& filePathString) { _oslOutputFilePathString = filePathString; } /// Set the OSL shader output. /// This is used during render validation if "testshade" or "testrender" is executed. /// For testrender this value is used to replace the %shader_output% token in the /// input scene file. /// @param outputName Name of shader output /// @param outputName The MaterialX type of the output void setOslShaderOutput(const std::string& outputName, const std::string& outputType) { _oslShaderOutputName = outputName; _oslShaderOutputType = outputType; } /// Set the OSL shading tester path string. Note that it is assumed that this /// references the location of the "testshade" executable. /// @param executable Full path to OSL "testshade" executable void setOslTestShadeExecutable(const std::string& executable) { _oslTestShadeExecutable = executable; } /// Set the OSL rendering tester path string. Note that it is assumed that this /// references the location of the "testrender" executable. /// @param executable Full path to OSL "testrender" executable void setOslTestRenderExecutable(const std::string& executable) { _oslTestRenderExecutable = executable; } /// Set the XML scene file to use for testrender. This is a template file /// with the following tokens for replacement: /// - %shader% : which will be replaced with the name of the shader to use /// - %shader_output% : which will be replace with the name of the shader output to use /// @param templateFileName Scene file name void setOslTestRenderSceneTemplateFile(const std::string& templateFileName) { _oslTestRenderSceneTemplateFile = templateFileName; } /// Set the name of the shader to be used for the input XML scene file. /// The value is used to replace the %shader% token in the file. /// @param shaderName Name of shader void setOslShaderName(const std::string& shaderName) { _oslShaderName = shaderName; } /// Set the search path for dependent shaders (.oso files) which are used /// when rendering with testrender. /// @param osoPath Path to .oso files. void setOslUtilityOSOPath(const std::string& osoPath) { _oslUtilityOSOPath = osoPath; } /// Used to toggle to either use testrender or testshade during render validation /// By default testshade is used. /// @param useTestRender Indicate whether to use testrender. void useTestRender(bool useTestRender) { _useTestRender = useTestRender; } /// /// Compile OSL code stored in a file. Will throw an exception if an error occurs. /// @param oslFileName Name of OSL file void compileOSL(const std::string& oslFileName); /// @} protected: /// /// Shade using OSO input file. Will throw an exception if an error occurs. /// @param outputPath Path to input .oso file. /// @param shaderName Name of OSL shader. A corresponding .oso file is assumed to exist in the output path folder. /// @param outputName Name of OSL shader output to use. void shadeOSL(const std::string& outputPath, const std::string& shaderName, const std::string& outputName); /// /// Render using OSO input file. Will throw an exception if an error occurs. /// @param outputPath Path to input .oso file. /// @param shaderName Name of OSL shader. A corresponding .oso file is assumed to exist in the output path folder. /// @param outputName Name of OSL shader output to use. void renderOSL(const std::string& outputPath, const std::string& shaderName, const std::string& outputName); /// Constructor OslValidator(); private: /// "oslc" executable name` std::string _oslCompilerExecutable; /// OSL include path name std::string _oslIncludePathString; /// Output file path. File name does not include an extension std::string _oslOutputFilePathString; /// "testshade" executable name std::string _oslTestShadeExecutable; /// "testrender" executable name std::string _oslTestRenderExecutable; /// Template scene XML file used for "testrender" std::string _oslTestRenderSceneTemplateFile; /// Name of shader. Used for rendering with "testrender" std::string _oslShaderName; /// Name of output on the shader. Used for rendering with "testshade" and "testrender" std::string _oslShaderOutputName; /// MaterialX type of the output on the shader. Used for rendering with "testshade" and "testrender" std::string _oslShaderOutputType; /// Path for utility shaders (.oso) used when rendering with "testrender" std::string _oslUtilityOSOPath; /// Use "testshade" or "testender" for render validation bool _useTestRender; }; } // namespace MaterialX #endif
40.05042
118
0.698175
[ "render", "vector" ]
68f2297282d4b0dca2cd5ebc2c770379b709c13c
494
h
C
include/ball.h
untoxa/a_kanoid
08b0a39ec0717cd3be32096819c9ffd2e5656407
[ "MIT" ]
2
2020-05-22T07:44:41.000Z
2021-09-04T15:43:45.000Z
include/ball.h
untoxa/a_kanoid
08b0a39ec0717cd3be32096819c9ffd2e5656407
[ "MIT" ]
null
null
null
include/ball.h
untoxa/a_kanoid
08b0a39ec0717cd3be32096819c9ffd2e5656407
[ "MIT" ]
null
null
null
#ifndef __BALL_H_INCLUDE #define __BALL_H_INCLUDE #include <gbdk/platform.h> #include "ring.h" enum ball_state_t { BALL_STUCK, BALL_FLY }; typedef struct { UBYTE idx; UBYTE x, dx; UBYTE y, dy; UBYTE speed; enum ball_state_t state; } ball_object_t; typedef struct ball_t { struct ball_t * next; ring_t ring; ball_object_t object; } ball_t; extern void ball_init_coords(ball_object_t * ball); extern void ball_threadproc(void * arg, void * ctx); #endif
18.296296
52
0.704453
[ "object" ]
68f6b4aa05ffe18c0f66ba0f2fdfe856293b30e9
18,144
h
C
osprey/be/lno/lu_mat.h
sharugupta/OpenUH
daddd76858a53035f5d713f648d13373c22506e8
[ "BSD-2-Clause" ]
null
null
null
osprey/be/lno/lu_mat.h
sharugupta/OpenUH
daddd76858a53035f5d713f648d13373c22506e8
[ "BSD-2-Clause" ]
null
null
null
osprey/be/lno/lu_mat.h
sharugupta/OpenUH
daddd76858a53035f5d713f648d13373c22506e8
[ "BSD-2-Clause" ]
null
null
null
/* * Copyright 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. */ /* Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ // -*-C++-*- /** *** Description: *** *** The factored matrix representation (LU_MAT): This uses MAT, and so *** MAT must be instantiated whenever this is. We provide instantiations *** for double and FRAC, but not for an integral type, since in general *** an integral LU factorization does not necessarily exist for an integer *** matrix. The memory pools are determined using the constructor only. *** There is no other way to create an LU_MAT. *** *** Reserved Prefixes: *** *** LU *** *** Exported Types: *** *** LU_FMAT The same as LU_MAT<FRAC>, a factored matrix of fractions *** LU_DMAT The same as LU_MAT<double>, a factored matrix of doubles *** *** Exported Functions: *** *** LU_MAT<T>::LU_MAT(const MAT<T>&, MEM_POOL*) *** LU_MAT<T>::~LU_MAT() *** *** Generate an LU decomposition from a matrix. This is the only *** constructor. Destructor does the usual. *** *** LU_MAT<T>::LU_MAT(const LU_MAT<T>&); *** LU_MAT<T>& LU_MAT<T>::operator =(const MAT<T>&) *** BOOL LU_MAT<T>::operator ==(const MAT<T>&) const *** BOOL LU_MAT<T>::operator !=(const MAT<T>&) const *** *** Assignment, LU_MAT passing and returning, and comparison *** of LU_MATs are currently illegal. *** *** void LU_MAT<T>::L_Mul(T*) const *** *** Multiply the passed in column (in place) by L. *** *** T* LU_MAT<T>::U_Solve(const T* b, T* x) const *** T* LU_MAT<T>::U_Solve(const T* b, T* x, INT) const *** *** Solves Ux = b, returning 2nd arg, or NULL if can't solve it. *** Any entry in x that is free is given a value of zero except *** if the third arg specifies a free entry, that entry gets a *** value of 1. *** *** BOOL LU_MAT<T>::Particular_Solution(const T*, T*) const; *** *** Return in the second parameter a particular solution. If there *** is none, return false. *** *** MAT<T> LU_MAT<T>::Inv() const *** *** Given the factorization, compute the inverse. Uses the default *** pool for MAT<T>, so it had better be set. *** *** void LU_MAT<T>::Print(FILE*) const *** *** Print this data structure, for debugging. *** *** BOOL LU_MAT<T>::Print_Element(FILE*, T) *** BOOL LU_MAT<T>::Exact_Arithmetic() *** *** Exact_Arithmetic must be supplies when instantiating *** (even though it's private). It indicates whether the T data *** type is exact (e.g. FRAC) or not (e.g. double), so that a *** sensible yet efficient pivoting strategy may be employed. *** Likewise for Print_Element(). **/ // Here are my comments about the internal representation of the LU // matrix. I've reverse engineered this info by fixing a bug, so it's // my best estimate of what is going on. // // The LU decomposition can be though of as a series of elementary // transformations: // U = L_(n-1) * P_(n-1) * ... * L_1 * P_1 * L_0 * P_0 * A // Here, each P is a permutation matrix, and each L is a lower triangular // matrix with 1's on the diagonal. The resulting matrix U is upper tri- // angular. I also believe that it should be row echelon form. By this // I mean that: // If u_i and u_j are two columns of U and i < j then the number of // nonzero elements at the beginning of u_i is <= the number of non- // zero elements at the beginning of u_j. // In addition to other properties that make U an upper triangular matrix. // This additional property is required if the number of pivot columns is // to be equal to the rank of U (and hence of A). See PV #467253 for a // test case where the original code didn't do the right thing. // // The permutation matrices P_i are represented by the array _interch[] // which has at most _interch_sz elements of storage allocated for it. // Initially we have _interch[i] == i for i = 1, 2, ..., n, where n is // the dimension of A. (I'm assuming that A is square, which it always // will be in the cache model analysis. We store separate row and column // info, so it's possible that this works for non-square matrices, but I // don't know whether anyone is actually using it for that, and there are // some areas in the code where I suspect the routines are not sufficiently // general to handle the full m x n case.) The bottom line is that if // _interch[i] == j, then P_i is the permutation matrix which tells us to // interchange rows i and j. Don't expect _interch[] to be a permutation // vector, it's not one. // // The L_i are stored in the sub-diagonal entries of the LU matrix. Spe- // cifically, L_i == I - LU'_i, where I is the n X n identity matrix and // LU'_i is the matrix which is 0 everywhere except for its i-th column // below the diagonal, which has the same entries as the LU matrix there. // // The resulting matrix U is given by the upper triangular portion of the // LU matrix (including the main diagonal). // // There's one more important array _cpvt[] for which we allocate _cpvt_sz // elements. This is a boolean array of n elements, and _cpvt[i] is TRUE // when the i-th column of U is a pivot column. Because we reduce U to // row echelon form, the number of TRUE entries in _cpvt[] tells us the // rank of the matrix U. Since U has be tranformed from A with a series // of elementary transformations, this is also the rank of A. // // This code is used extensively in the cache model to compute LU decom- // positions of both singular and non-singular matrices. When computing // the H and H_s matrices for reference groups, each row represents a // particular array reference pattern (i.e. subscript of an array). // // Here's an example of computing H and H_s matrices with this code: // Suppose: // 0 -1 1 0 -1 1 // H = 0 -1 0 H_s = 0 -1 0 // 1 0 0 0 0 0 // // Note that we got H_s by striking out the last row of H. This last // row represents the stride-1 reference. Note also that H is non-singular // with rank of 3, and H_s is singular with rank of 2. // // Calling the constructor LU_MAT(const MAT<T>&, MEM_POOL*) on H gives the // following result: // // 1 0 0 _interch[0 1 2] = [2 1 2] // LU = 0 -1 0 _cpvt[0 1 2] = [T T T] // 0 1 1 // // This means that: // // 0 0 1 1 0 0 1 0 0 // P_0 = 0 1 0 P_1 = P_2 = L_0 = L_2 = I = 0 1 0 L_1 = 0 1 0 // 1 0 0 0 0 1 0 -1 1 // // 1 0 0 // U = 0 -1 0 = L_1 * P_0 * H // 0 0 1 // // For H_s we get: // // 0 -1 1 _interch[0 1 2] = [0 1 2] // LU = 1 0 -1 _cpvt[0 1 2] = [F T T] // 0 0 0 // // This means that: // // 1 0 0 1 0 0 0 -1 1 // P_0 = P_1 = P_2 = L_1 = L_2 = I = 0 1 0 L_0 = -1 1 0 U = 0 0 -1 // 0 0 1 0 0 1 0 0 0 // // and U = L_0 * H_s // -- Comments by RJC /** $Revision: 1.5 $ *** $Date: 04/12/21 14:57:14-08:00 $ *** $Author: bos@eng-25.internal.keyresearch.com $ *** $Source: /home/bos/bk/kpro64-pending/be/lno/SCCS/s.lu_mat.h $ **/ #ifndef lu_mat_INCLUDED #define lu_mat_INCLUDED "lu_mat.h" static char *lu_mat_rcs_id = lu_mat_INCLUDED "$Revision: 1.5 $"; // system headers #ifndef __STRING_H__ extern "C" { #include "string.h" } #endif // redefine int #ifndef defs_INCLUDED #include "defs.h" #endif // rest of the compiler headers #ifndef CXX_MEMORY_INCLUDED #include "cxx_memory.h" #endif #ifndef ERRORS_INCLUDED #include "errors.h" #endif #ifndef frac_INCLUDED #include "frac.h" #endif #ifndef mat_INCLUDED #include "mat.h" #endif template<class T> class LU_MAT { public: LU_MAT(const MAT<T>&, MEM_POOL*); LU_MAT(const LU_MAT<T>&, MEM_POOL*); LU_MAT(const LU_MAT<T>&); LU_MAT(MEM_POOL*); ~LU_MAT(); T* U_Solve(const T*, T*, INT = -1) const; BOOL Particular_Solution(const T*, T*) const; MAT<T> Inv() const; MAT<T> Unfactor() const; MAT<T> TUnfactor() const; BOOL Is_Pivot(INT col) const {return _cpvt[col];} void L_Mul(T*) const; void Print(FILE*) const; const MAT<T>& LU_Matrix() const {return _lu;} INT Cfactor(T*, INT) const; // factor column, given pivot BOOL Cfactor_And_Insert(T*, BOOL); // overwrites first p. LU_MAT<T>& operator =(const LU_MAT<T>&); private: MAT<T> _lu; // lu decomposition mINT32* _interch; // so can map back to original BOOL* _cpvt; // which columns are pivots MEM_POOL* _pool; // where above data comes from INT _interch_sz; // bytes allocated for _interch INT _cpvt_sz; // bytes allocated for _cpvt static BOOL Exact_Arithmetic(); // user supplied static void Print_Element(FILE* f, T); // These are intentionally not defined in mat.cxx. Don't use them. LU_MAT(); BOOL operator ==(const LU_MAT<T>&) const; BOOL operator !=(const LU_MAT<T>&) const; }; typedef LU_MAT<FRAC> LU_FMAT; typedef LU_MAT<double> LU_DMAT; #ifdef __GNUC__ // Implementation stuff included here because g++ // (rightly) doesn't do implicit .cxx file inclusion. extern MEM_POOL LNO_local_pool; template <class T> LU_MAT<T>& LU_MAT<T>::operator =(const LU_MAT<T>& a) { if (_cpvt_sz < a._cpvt_sz) { if (_cpvt) CXX_DELETE_ARRAY(_cpvt, _pool); _cpvt = CXX_NEW_ARRAY(BOOL, a._cpvt_sz, _pool); _cpvt_sz = a._cpvt_sz; } INT i; for (i = 0; i < a._cpvt_sz; i++) _cpvt[i] = a._cpvt[i]; if (_interch_sz < a._interch_sz) { if (_interch) CXX_DELETE_ARRAY(_interch, _pool); _interch = CXX_NEW_ARRAY(mINT32, a._interch_sz, _pool); _interch_sz = a._interch_sz; } for (i = 0; i < a._interch_sz; i++) _interch[i] = a._interch[i]; _lu = a._lu; return *this; } template<class T> LU_MAT<T>::LU_MAT(MEM_POOL* pool) : _pool(pool), _lu(0,0,pool), _interch(NULL), _cpvt(NULL), _interch_sz(0), _cpvt_sz(0) { } template<class T> LU_MAT<T>::LU_MAT(const LU_MAT<T>& a, MEM_POOL* pool) : _pool(pool), _lu(0,0,pool), _interch(NULL), _cpvt(NULL), _interch_sz(0), _cpvt_sz(0) { *this = a; } template<class T> LU_MAT<T>::LU_MAT(const LU_MAT<T>& a) : _pool(a._pool), _lu(0,0,a._pool), _interch(NULL), _cpvt(NULL), _interch_sz(0), _cpvt_sz(0) { *this = a; } template<class T> LU_MAT<T>::LU_MAT(const MAT<T>& m, MEM_POOL* pool) : _pool(pool), _lu(m.Rows(), 0, pool), _interch(CXX_NEW_ARRAY(mINT32, m.Rows(), pool)), _cpvt(CXX_NEW_ARRAY(BOOL, m.Cols(), pool)), _interch_sz(m.Rows()), _cpvt_sz(m.Cols()) { T* tmpc = CXX_NEW_ARRAY(T, m.Rows(), &LNO_local_pool); INT r; for (r = 0; r < m.Rows(); r++) _interch[r] = r; // no interchanges INT c; for (c = 0; c < m.Cols(); c++) _cpvt[c] = FALSE; // initialize to no pivot cols for (c = 0; c < m.Cols(); c++) { for (r = 0; r < m.Rows(); r++) tmpc[r] = m(r,c); Cfactor_And_Insert(tmpc, FALSE); } CXX_DELETE_ARRAY(tmpc, &LNO_local_pool); } template <class T> BOOL LU_MAT<T>::Particular_Solution(const T* in, T* x) const { T* inx = CXX_NEW_ARRAY(T, _lu.Rows(), &LNO_local_pool); INT i; for (i = 0; i < _lu.Rows(); i++) inx[i] = in[i]; L_Mul(inx); BOOL ok = U_Solve(inx, x) ? TRUE : FALSE; CXX_DELETE_ARRAY(inx, &LNO_local_pool); return ok; } template<class T> LU_MAT<T>::~LU_MAT() { if (_interch) CXX_DELETE_ARRAY(_interch, _pool); if (_cpvt) CXX_DELETE_ARRAY(_cpvt, _pool); } template<class T> MAT<T> LU_MAT<T>::Inv() const { INT n = _lu.Rows(); MAT<T> rval(n, n, 0); T* tmpc = CXX_NEW_ARRAY(T, n, &LNO_local_pool); T* tmpr = CXX_NEW_ARRAY(T, n, &LNO_local_pool); FmtAssert(_lu.Rows() == _lu.Cols(), ("inv(): Matrix is not square")); INT c; for (c = 0; c < n; c++) FmtAssert(_cpvt[c], ("inv(): matrix apparently singular")); INT r, rr; for (r = 0; r < n; r++) { for (rr = 0; rr < n; rr++) tmpc[rr] = T(r == rr); L_Mul(tmpc); T* ok = U_Solve(tmpc, tmpr); FmtAssert(ok, ("LU_MAT<T>::Inv(): U_Solve failed")); rval.D_Update_Col(r, tmpr); } CXX_DELETE_ARRAY(tmpr, &LNO_local_pool); CXX_DELETE_ARRAY(tmpc, &LNO_local_pool); return rval; } template<class T> MAT<T> LU_MAT<T>::Unfactor() const { MAT<T> l = _lu.L(); MAT<T> u = _lu.U(); INT r = _lu.Rows(); INT i; for (i = r - 1; i >= 0; i--) { if(_interch[i] != i) { Is_True(_interch[i] > i, ("Unfactor problem")); INT j; for (j = 0; j < r; j++) { T tmp = l(i,j); l(i,j) = l(_interch[i],j); l(_interch[i],j) = tmp; } } } return l*u; } template<class T> MAT<T> LU_MAT<T>::TUnfactor() const { MAT<T> lut = _lu.Trans(); MAT<T> l = lut.L(); MAT<T> u = lut.U(); INT r = lut.Rows(); INT c = lut.Cols(); INT i; for (i = r - 1; i >= 0; i--) { if(_interch[i] != i) { Is_True(_interch[i] > i, ("Unfactor problem")); INT j; for (j = 0; j < r; j++) { T tmp = l(i,j); l(i,j) = l(_interch[i],j); l(_interch[i],j) = tmp; } } } return l*u; } // Make all free variables are zero except for the one specified. template<class T> T* LU_MAT<T>::U_Solve(const T* in, T* out, INT free) const { INT rows = _lu.Rows(); INT cols = _lu.Cols(); INT zrow = 0; INT c; for (c = 0; c < cols; c++) zrow += _cpvt[c]; INT r; for (r = zrow; r < rows; r++) if (in[r] != T(0)) return NULL; // do the backsolve r = zrow - 1; for (c = cols-1; c >= 0; c--) { if (_cpvt[c]) { T t = in[r]; INT cc; for (cc = c+1; cc < cols; cc++) t -= _lu(r,cc) * out[cc]; out[c] = t/_lu(r,c); r--; } else { out[c] = T(c == free); } } return out; } template<class T> void LU_MAT<T>::L_Mul(T* f) const { INT rows = _lu.Rows(); INT cols = _lu.Cols(); // first, interchanges INT r; for (r = 0; r < rows; r++) { INT rr = _interch[r]; if (r != rr) { T t = f[rr]; f[rr] = f[r]; f[r] = t; } } // now apply L INT c; for (c = 0; c < cols; c++) for (r = c+1; r < rows; r++) f[r] -= f[c] * _lu(r,c); } template<class T> INT LU_MAT<T>::Cfactor(T* col, INT rpvt) const { INT nrpvt; INT rows = _lu.Rows(); INT cols = _lu.Cols(); L_Mul(col); if (rpvt == rows) return rows; if (Exact_Arithmetic()) { // any non-zero pivot will do for (nrpvt = rpvt; nrpvt < rows; nrpvt++) if (col[nrpvt] != T(0)) break; if (nrpvt == rows) nrpvt = rpvt; } else { // select largest pivot T mx = T(0); INT imx = -1; for (nrpvt = rpvt; nrpvt < rows; nrpvt++) { T x = col[nrpvt] < 0 ? -col[nrpvt] : col[nrpvt]; if (x > mx) { mx = x; imx = nrpvt; } } if (imx == -1) nrpvt = rpvt; else nrpvt = imx; } if (nrpvt != rpvt) { T t = col[rpvt]; col[rpvt] = col[nrpvt]; col[nrpvt] = t; } if (col[rpvt] != T(0)) { INT r; for (r = rpvt+1; r < rows; r++) col[r] /= col[rpvt]; } return nrpvt; } template<class T> BOOL LU_MAT<T>::Cfactor_And_Insert(T* w, INT insert_only_nonzero_piv) { INT c = _lu.Cols(); INT r = _lu.Rows(); INT curpivrow = 0; INT i; for (i = 0; i < c; i++) curpivrow += Is_Pivot(i); if(curpivrow == r && insert_only_nonzero_piv) { return FALSE; } Is_True(curpivrow <= r, ("Cfactor_And_Insert: %d <= %d", curpivrow, r)); INT rrr = Cfactor(w, curpivrow); Is_True((curpivrow <= rrr && rrr < r) || (rrr == r && curpivrow == rrr), ("Problem in Cfactor_And_Insert")); if (insert_only_nonzero_piv && w[curpivrow] == T(0)) { return FALSE; } if(curpivrow < r) { _interch[curpivrow] = rrr; if(rrr != curpivrow) _lu.D_Swap_Rows(rrr, curpivrow); if (_cpvt_sz <= c) { BOOL* newpivots = CXX_NEW_ARRAY(BOOL, c+2, _pool); _cpvt_sz = c+2; INT i; for (i = 0; i < c; i++) newpivots[i] = _cpvt[i]; CXX_DELETE_ARRAY(_cpvt, _pool); _cpvt = newpivots; } _cpvt[c] = w[curpivrow] != 0; } else _cpvt[c] = FALSE; // w's entries already swapped if (curpivrow == c) { _lu.D_Add_Col(w); } else { INT i; for (i = curpivrow + 1; i < r; i++) _lu(i,curpivrow) = w[i]; for (i = curpivrow + 1; i < r; i++) w[i] = T(0); _lu.D_Add_Col(w); } return TRUE; } template<class T> void LU_MAT<T>::Print(FILE*f) const { fprintf(f, "LU matrix output (%d x %d)\n", _lu.Rows(), _lu.Cols()); _lu.Print(f); fprintf(f, "interchange vector:"); INT r; for (r = 0; r < _lu.Rows(); r++) fprintf(f, " %d", _interch[r]); fprintf(f, " column pivots: "); INT c; for (c = 0; c < _lu.Cols(); c++) fprintf(f, "%s", _cpvt[c] ? "T" : "F"); fprintf(f, "\n"); } #endif #endif
26.526316
75
0.600033
[ "vector", "model" ]
ec005b1cb9089e8f2e5a5aedf7e5e905b01b5700
657
h
C
include/OnePoint.POM/ThemeElementTypeFactory.h
OnePointGlobal/MySurvey-2.0-App_New
02368bee4a3b5b9e07f95d586c02c20880e35a4b
[ "MIT" ]
null
null
null
include/OnePoint.POM/ThemeElementTypeFactory.h
OnePointGlobal/MySurvey-2.0-App_New
02368bee4a3b5b9e07f95d586c02c20880e35a4b
[ "MIT" ]
12
2019-10-14T10:29:55.000Z
2020-04-23T10:52:13.000Z
include/OnePoint.POM/ThemeElementTypeFactory.h
OnePointGlobal/OnePoint-Global-MySurvey-2.0-App-iOS-Latest
02368bee4a3b5b9e07f95d586c02c20880e35a4b
[ "MIT" ]
1
2022-03-17T08:46:39.000Z
2022-03-17T08:46:39.000Z
//------------------------------------------------------------------------ // Generated on 10/12/2014 09:22:39 for Sachin\Sachin // // This file was autogenerated but you can (and are meant to) edit it as // it will not be overwritten unless explicitly requested. //------------------------------------------------------------------------ #import <Foundation/Foundation.h> #import "ThemeElementTypeFactoryBase.h" #import "ThemeElementType.h" #import "IThemeElementTypeData.h" #import <OnePointFramework/IDisposable.h> //package OnePoint.POM.Model @interface ThemeElementTypeFactory : ThemeElementTypeFactoryBase<IDisposable> { } @end
34.578947
80
0.584475
[ "model" ]
ec12eebd1548cb7daf3d27b653aec454980e5250
20,180
c
C
C_Code/SimpleIDE/Learn/Simple Libraries/Audio/libtext2speech/VocalTract.c
ROBO-BEV/BARISTO
0e87d79966efc111cc38c1a1cf22e2d8ee18c350
[ "CC-BY-3.0", "MIT" ]
8
2018-03-12T04:52:28.000Z
2021-05-19T19:37:01.000Z
C_Code/SimpleIDE/Learn/Simple Libraries/Audio/libtext2speech/VocalTract.c
ROBO-BEV/BARISTO
0e87d79966efc111cc38c1a1cf22e2d8ee18c350
[ "CC-BY-3.0", "MIT" ]
null
null
null
C_Code/SimpleIDE/Learn/Simple Libraries/Audio/libtext2speech/VocalTract.c
ROBO-BEV/BARISTO
0e87d79966efc111cc38c1a1cf22e2d8ee18c350
[ "CC-BY-3.0", "MIT" ]
1
2018-01-30T09:43:36.000Z
2018-01-30T09:43:36.000Z
// // automatically generated by spin2cpp v1.93 on Thu Oct 08 13:24:57 2015 // spin2cpp --ccode --main talk_demo2.spin // /* ┌─────────────────────────────────────────┬────────────────┬────────────────────────┬─────────────────┐ │ Vocal Tract v1.1 │ by Chip Gracey │ (C)2006 Parallax, Inc. │ 28 October 2006 │ ├─────────────────────────────────────────┴────────────────┴────────────────────────┴─────────────────┤ │ │ │ This object synthesizes a human vocal tract in real-time. It requires one cog and at least 80 MHz. │ │ │ │ The vocal tract is controlled via 13 single-byte parameters which must reside in the parent object: │ │ │ │ VAR byte aa,ga,gp,vp,vr,f1,f2,f3,f4,na,nf,fa,ff 'vocal tract parameters │ │ │ │ │ │ aa │ │ ┌────────────┐ │ │ │ ASPIRATION ├──┐ │ │ └────────────┘ │ f1 f2 f3 f4 na nf │ │  ┌────┐ ┌────┐ ┌────┐ ┌────┐ ┌───────┐ │ │ +┣──┤ F1 ├──┤ F2 ├──┤ F3 ├──┤ F4 ├──┤ NASAL ├──┐ │ │ ga gp  └────┘ └────┘ └────┘ └────┘ └───────┘ │ │ │ ┌─────────┐ │  │ │ │ GLOTTAL ├──┘ +┣── OUTPUT │ │ └────┬────┘ fa ff  │ │  ┌───────────┐ │ │ │ vp │ vr │ FRICATION ├──┘ │ │ ┌────┴────┐ └───────────┘ │ │ │ VIBRATO │ │ │ └─────────┘ │ │ │ │ │ │ ┌───────────┬──────────────────────┬─────────────┬────────────────────────────────────────────────┐ │ │ │ parameter │ description │ unit │ notes │ │ │ ├───────────┼──────────────────────┼─────────────┼────────────────────────────────────────────────┤ │ │ │ aa │ aspiration amplitude │ 0..255 │ breath volume: silent..loud, linear │ │ │ │ ga │ glottal amplitude │ 0..255 │ voice volume: silent..loud, linear │ │ │ │ gp │ glottal pitch │ 1/48 octave │ voice pitch: 100 ─ 110.00Hz (musical note A2) │ │ │ │ vp │ vibrato pitch │ 1/48 octave │ voice vibrato pitch: 48 ─ ± 1/2 octave swing │ │ │ │ vr │ vibrato rate │ 0.0763 Hz │ voice vibrato rate: 52 ─ 4 Hz │ │ │ │ f1 │ formant1 frequency │ 19.53 Hz │ 1st resonator frequency: 40 ─ 781 Hz │ │ │ │ f2 │ formant2 frequency │ 19.53 Hz │ 2nd resonator frequency: 56 ─ 1094 Hz │ │ │ │ f3 │ formant3 frequency │ 19.53 Hz │ 3rd resonator frequency: 128 ─ 2500 Hz │ │ │ │ f4 │ formant4 frequency │ 19.53 Hz │ 4th resonator frequency: 179 ─ 3496 Hz │ │ │ │ na │ nasal amplitude │ 0..255 │ anti-resonator level: off..on, linear │ │ │ │ nf │ nasal frequency │ 19.53 Hz │ anti-resonator frequency: 102 ─ 1992 Hz │ │ │ │ fa │ frication amplitude │ 0..255 │ white noise volume: silent..loud, linear │ │ │ │ ff │ frication frequency │ 39.06 Hz │ white noise frequency: 60 ─ 2344 Hz ("Sh") │ │ │ └───────────┴──────────────────────┴─────────────┴────────────────────────────────────────────────┘ │ │ │ │ The parent object alternately modifies one or more of these parameters and then calls the go(time) │ │ method to queue the entire 13-parameter frame for feeding to the vocal tract. The vocal tract will │ │ load one queued frame after another and smoothly interpolate between them over specified amounts of │ │ time without interruption. Up to eight frames will be queued in order to relax the frame-generation │ │ timing requirement of the parent object. If eight frames are queued, the parent must then wait to │ │ queue another frame. If the vocal tract runs out of frames, it will continue generating samples │ │ based on the last frame. When a new frame is queued, it will immediately load it and begin inter- │ │ polating towards it. │ │ │ │ The vocal tract generates audio samples at a continuous rate of 20KHz. These samples can be output │ │ to pins via delta-modulation for RC filtering or direct transducer driving. An FM aural subcarrier │ │ can also be generated for inclusion into a TV broadcast controlled by another cog. Regardless of │ │ any output mode, samples are always streamed into a special variable so that other objects can │ │ access them in real-time. │ │ │ │ In order to achieve optimal sound quality, it is worthwhile to maximize amplitudes such as 'ga' to │ │ the point just shy of numerical overflow. Numerical overflow results in high-amplitude noise bursts │ │ which are quite disruptive. The closeness of 'f1'-'f4' and their relationship to 'gp' can greatly │ │ influence the amount of 'ga' that can be applied before overflow occurs. You must determine through │ │ experimentation what the limits are. By pushing 'ga' close to the overflow point, you will maximize │ │ the signal-to-noise ratio of the vocal tract, resulting in the highest quality sound. Once your │ │ vocal tract programming is complete, the attenuation level can then be used to reduce the overall │ │ output in 3dB steps while preserving the signal-to-noise ratio. │ │ │ ├─────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ Revision History v1.0 released 26 October 2006 │ │ │ │ v1.1 If the vocal tract runs out of frames, its internal parameters will now be brought all the │ │ way to the last frame's values. Before, they were left one interpolation point shy, and then │ │ set to the last frame's values at the start of the next frame. For continuous frames this was │ │ trivial, but it posed a problem during frame gaps because the internal parameters would get │ │ stalled at transition points just shy of the last frame's values. This change makes the vocal │ │ tract behave more sensibly during frame gaps. │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────────────┘ */ #include <propeller.h> #include "text2speech.h" #ifdef __GNUC__ #define INLINE__ static inline #define Yield__() __asm__ volatile( "" ::: "memory" ) #define PostEffect__(X, Y) __extension__({ int32_t tmp__ = (X); (X) = (Y); tmp__; }) #else #define INLINE__ static static int32_t tmp__; #define PostEffect__(X, Y) (tmp__ = (X), (X) = (Y), tmp__) #define Yield__() #define waitcnt(n) _waitcnt(n) #define coginit(id, code, par) _coginit((unsigned)(par)>>2, (unsigned)(code)>>2, id) #define cognew(code, par) coginit(0x8, (code), (par)) #define cogstop(i) _cogstop(i) #endif INLINE__ int32_t Min__(int32_t a, int32_t b) { return a < b ? a : b; } INLINE__ int32_t Max__(int32_t a, int32_t b) { return a > b ? a : b; } INLINE__ int32_t Shr__(uint32_t a, uint32_t b) { return (a>>b); } static uint8_t dat[] = { 0x00, 0x1a, 0xfe, 0xa0, 0x0a, 0x01, 0xbc, 0x80, 0x00, 0x18, 0xfe, 0xe4, 0x1e, 0x48, 0xfe, 0xa0, 0xd4, 0x9a, 0xbe, 0xa0, 0x0b, 0x09, 0xbc, 0x80, 0x01, 0x48, 0x7e, 0x61, 0x02, 0x08, 0xf0, 0x84, 0x04, 0x48, 0xfe, 0xe4, 0xc6, 0xd6, 0xbe, 0xa0, 0x0d, 0x48, 0xfe, 0xa0, 0x08, 0x4a, 0xfe, 0xa0, 0xe9, 0xd8, 0xbe, 0xa0, 0x0b, 0x19, 0xbc, 0x80, 0x0c, 0x4a, 0xfe, 0xe4, 0x08, 0x18, 0xfc, 0x84, 0x01, 0xd6, 0xfd, 0x80, 0x01, 0xda, 0xfd, 0x80, 0x01, 0xe0, 0xfd, 0x80, 0x0b, 0x48, 0xfe, 0xe4, 0xc6, 0xa6, 0xbf, 0xa0, 0xf0, 0x49, 0xbe, 0xa0, 0x08, 0x48, 0xfe, 0x80, 0x04, 0x4a, 0xfe, 0xa0, 0x24, 0xed, 0xbf, 0x08, 0x04, 0x48, 0xfe, 0x80, 0x0a, 0x31, 0xbc, 0x80, 0x18, 0x4a, 0xfe, 0xe4, 0x24, 0x1b, 0xbe, 0x08, 0x04, 0x48, 0xfe, 0x80, 0x24, 0x1d, 0xbe, 0x08, 0xf1, 0x1f, 0xbe, 0xa0, 0x0e, 0x1f, 0xbe, 0x80, 0x0e, 0x1f, 0xbe, 0xf8, 0xf0, 0x49, 0xbe, 0x08, 0x24, 0x45, 0xbe, 0x38, 0x22, 0x49, 0xbe, 0xa0, 0x0a, 0x48, 0xfe, 0x38, 0x0d, 0x49, 0xbe, 0x80, 0x24, 0xf5, 0xbf, 0xa0, 0x22, 0x49, 0xbe, 0xa0, 0x00, 0x49, 0xbe, 0x80, 0x24, 0xf7, 0xbf, 0xa0, 0xf0, 0x49, 0xbe, 0xa0, 0x04, 0x48, 0xfe, 0x80, 0x24, 0x45, 0x3e, 0x08, 0xf3, 0xe4, 0x3d, 0x61, 0x01, 0xe4, 0xfd, 0x34, 0xf3, 0xe4, 0x3d, 0x61, 0x01, 0xe4, 0xfd, 0x34, 0xf3, 0xe4, 0x3d, 0x61, 0x01, 0xe4, 0xfd, 0x34, 0x26, 0x49, 0xbe, 0xa0, 0xf2, 0x4a, 0xbe, 0xa0, 0xd0, 0xd6, 0xfe, 0x5c, 0x08, 0x48, 0xfe, 0x38, 0x24, 0x45, 0xbe, 0xa0, 0x2a, 0x49, 0xbe, 0xa0, 0x0a, 0x48, 0xfe, 0x28, 0x24, 0x2b, 0xbe, 0x80, 0x29, 0x49, 0xbe, 0xa0, 0x15, 0x4b, 0xbe, 0xa0, 0xc7, 0xd6, 0xfe, 0x5c, 0x28, 0x49, 0xbe, 0x80, 0x02, 0x48, 0xfe, 0x28, 0x24, 0x4b, 0xbe, 0xa0, 0x02, 0x4a, 0xfe, 0x28, 0x25, 0x49, 0xbe, 0x80, 0x24, 0x4b, 0xbe, 0xa0, 0x04, 0x4a, 0xfe, 0x28, 0x25, 0x49, 0xbe, 0x80, 0x24, 0x4b, 0xbe, 0xa0, 0x08, 0x4a, 0xfe, 0x28, 0x25, 0x49, 0xbe, 0x80, 0xf1, 0x48, 0xbe, 0x80, 0xbe, 0x8c, 0xfd, 0x5c, 0x25, 0x2d, 0xbe, 0x80, 0x16, 0x49, 0xbe, 0xa0, 0xbe, 0x8c, 0xfd, 0x5c, 0x01, 0x4b, 0xbe, 0x84, 0x27, 0x49, 0xbe, 0xa0, 0xc7, 0xd6, 0xfe, 0x5c, 0x06, 0x48, 0xfe, 0x38, 0x24, 0x45, 0xbe, 0x80, 0x00, 0x46, 0xfe, 0xa0, 0x2b, 0x43, 0xbe, 0xa0, 0x18, 0x45, 0xbe, 0x80, 0x19, 0x47, 0xbe, 0x80, 0xd6, 0xa6, 0xff, 0x5c, 0x22, 0x31, 0xbe, 0xa0, 0x23, 0x33, 0xbe, 0xa0, 0x2c, 0x43, 0xbe, 0xa0, 0x1a, 0x45, 0xbe, 0x80, 0x1b, 0x47, 0xbe, 0x80, 0xd6, 0xa6, 0xff, 0x5c, 0x22, 0x35, 0xbe, 0xa0, 0x23, 0x37, 0xbe, 0xa0, 0x2d, 0x43, 0xbe, 0xa0, 0x1c, 0x45, 0xbe, 0x80, 0x1d, 0x47, 0xbe, 0x80, 0xd6, 0xa6, 0xff, 0x5c, 0x22, 0x39, 0xbe, 0xa0, 0x23, 0x3b, 0xbe, 0xa0, 0x2e, 0x43, 0xbe, 0xa0, 0x1e, 0x45, 0xbe, 0x80, 0x1f, 0x47, 0xbe, 0x80, 0xd6, 0xa6, 0xff, 0x5c, 0x22, 0x3d, 0xbe, 0xa0, 0x23, 0x3f, 0xbe, 0xa0, 0x22, 0x41, 0xbe, 0x80, 0x30, 0x43, 0xbe, 0xa0, 0xd6, 0xa6, 0xff, 0x5c, 0x2f, 0x49, 0xbe, 0xa0, 0x22, 0x4b, 0xbe, 0xa0, 0xd0, 0xd6, 0xfe, 0x5c, 0x20, 0x45, 0xbe, 0xa0, 0x24, 0x41, 0xbe, 0xa4, 0xf2, 0x48, 0xbe, 0xa0, 0x03, 0x48, 0xfe, 0x38, 0x24, 0x2f, 0xbe, 0x80, 0x01, 0x48, 0xfe, 0x38, 0x24, 0x2f, 0xbe, 0x80, 0x32, 0x49, 0xbe, 0xa0, 0x01, 0x48, 0xfe, 0x28, 0x24, 0x2f, 0xbe, 0x80, 0x31, 0x49, 0xbe, 0xa0, 0x17, 0x4b, 0xbe, 0xa0, 0xc7, 0xd6, 0xfe, 0x5c, 0x24, 0x45, 0xbe, 0x80, 0x82, 0x00, 0x3c, 0x5c, 0x83, 0x00, 0x00, 0x00, 0x21, 0x04, 0xfd, 0x5c, 0xf0, 0x23, 0xbe, 0xa0, 0x20, 0x22, 0xfe, 0x80, 0x10, 0x23, 0xbe, 0x80, 0x11, 0x27, 0xbe, 0x08, 0x03, 0x27, 0xbe, 0x62, 0x91, 0x00, 0x54, 0x5c, 0xbc, 0x1a, 0xbd, 0xa0, 0x0d, 0x24, 0xfe, 0xa0, 0x21, 0x04, 0xfd, 0x5c, 0x33, 0x4d, 0xbe, 0xa0, 0x0b, 0x1b, 0xbd, 0x80, 0x8c, 0x24, 0xfe, 0xe4, 0x83, 0x00, 0x7c, 0x5c, 0x01, 0x26, 0xfe, 0x80, 0x13, 0x29, 0xbe, 0xa0, 0x33, 0x39, 0xfd, 0x50, 0x26, 0x3b, 0xfd, 0x54, 0x33, 0x3d, 0xfd, 0x54, 0x40, 0x4d, 0xfd, 0x54, 0x03, 0x22, 0xfe, 0x80, 0x0d, 0x24, 0xfe, 0xa0, 0x21, 0x04, 0xfd, 0x5c, 0x11, 0x49, 0xbe, 0x00, 0x18, 0x48, 0xfe, 0x2c, 0x33, 0x4b, 0xbe, 0xa0, 0x25, 0x4d, 0xbe, 0xa0, 0x24, 0x67, 0xbe, 0xa0, 0x25, 0x49, 0xbe, 0x85, 0x24, 0x49, 0xbe, 0xb0, 0x01, 0xfe, 0x7f, 0x36, 0x08, 0x4a, 0xfe, 0xa0, 0x01, 0x48, 0xfe, 0x2d, 0x13, 0x49, 0xb2, 0x80, 0xa3, 0x4a, 0xfe, 0xe4, 0x24, 0x81, 0xbe, 0xbc, 0x01, 0x38, 0xfd, 0x80, 0x0a, 0x3b, 0xbd, 0x80, 0x0a, 0x3d, 0xbd, 0x80, 0x0a, 0x4d, 0xbd, 0x80, 0x01, 0x22, 0xfe, 0x80, 0x99, 0x24, 0xfe, 0xe4, 0x21, 0x04, 0xfd, 0x5c, 0xbd, 0x62, 0xbd, 0xa0, 0x0d, 0x24, 0xfe, 0xa0, 0x21, 0x04, 0xfd, 0x5c, 0x40, 0x4d, 0xbe, 0x80, 0x0b, 0x63, 0xbd, 0x80, 0xb0, 0x24, 0xfe, 0xe4, 0x13, 0x29, 0xbe, 0x80, 0x02, 0x29, 0x3e, 0x61, 0xad, 0x00, 0x4c, 0x5c, 0x10, 0x22, 0xfe, 0x84, 0x11, 0xff, 0x3f, 0x08, 0x10, 0x20, 0xfe, 0x80, 0x7f, 0x20, 0xfe, 0x60, 0x83, 0x00, 0x7c, 0x5c, 0x33, 0x4d, 0xbe, 0xa0, 0x40, 0x4d, 0xbe, 0x80, 0x24, 0x4b, 0xbe, 0xa0, 0x10, 0x4a, 0xfe, 0x28, 0x1c, 0x48, 0xfe, 0x28, 0x08, 0x4b, 0xbe, 0x60, 0x05, 0x4b, 0xbe, 0x68, 0x25, 0x4b, 0xbe, 0x04, 0x04, 0x4b, 0xbe, 0x68, 0x24, 0x4b, 0xbe, 0x2c, 0x00, 0x00, 0x7c, 0x5c, 0x13, 0x4a, 0xfe, 0x28, 0x07, 0x4b, 0x3e, 0x62, 0x09, 0x4b, 0x3e, 0x61, 0x25, 0x4b, 0xbe, 0xb0, 0x06, 0x4b, 0xbe, 0x68, 0x01, 0x4a, 0xfe, 0x2c, 0x25, 0x4b, 0xbe, 0x04, 0x25, 0x4b, 0xbe, 0xbc, 0x0f, 0x4a, 0xfe, 0x2c, 0x11, 0x48, 0xfe, 0x28, 0x0f, 0x4a, 0xfe, 0x38, 0x0e, 0x4a, 0xfe, 0x2c, 0x4d, 0x01, 0x7c, 0x5c, 0x01, 0x48, 0xfe, 0x39, 0x25, 0x49, 0xb2, 0x80, 0x01, 0x44, 0xfe, 0x38, 0x22, 0x49, 0xbe, 0xa0, 0x03, 0x48, 0xfe, 0x38, 0x24, 0x45, 0xbe, 0x80, 0x22, 0x49, 0xbe, 0xa0, 0x04, 0x48, 0xfe, 0x38, 0x24, 0x45, 0xbe, 0x80, 0x01, 0x46, 0xfe, 0x38, 0x23, 0x49, 0xbe, 0xa0, 0x03, 0x48, 0xfe, 0x38, 0x24, 0x47, 0xbe, 0x80, 0x23, 0x49, 0xbe, 0xa0, 0x04, 0x48, 0xfe, 0x38, 0x24, 0x47, 0xbe, 0x80, 0x22, 0x49, 0xbe, 0xa0, 0x23, 0x45, 0xbe, 0x84, 0x24, 0x47, 0xbe, 0x80, 0x00, 0x43, 0xbe, 0x85, 0x6d, 0x01, 0x7c, 0x5c, 0x21, 0x43, 0xbe, 0xa1, 0x23, 0x49, 0xbe, 0xa0, 0x01, 0x48, 0xfe, 0x38, 0x22, 0x4b, 0xbe, 0xa0, 0x01, 0x4a, 0xfe, 0x38, 0x24, 0x45, 0xbe, 0x94, 0x25, 0x47, 0xbe, 0x90, 0xf4, 0x42, 0xbe, 0x94, 0x00, 0x00, 0x92, 0x66, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x06, 0x80, 0x76, 0x14, 0x90, 0x4b, 0x6d, 0xe1, 0xec, 0x27, 0x50, 0x47, 0x44, 0x14, 0x0c, 0x35, 0x2c, 0x0a, 0x85, 0x5f, 0x17, 0x05, 0x79, 0xd8, 0x8b, 0x02, 0x54, 0xf1, 0x45, 0x01, 0x4d, 0xf9, 0xa2, 0x00, 0xbb, 0x7c, 0x51, 0x00, 0x60, 0xbe, 0x28, 0x00, 0x30, 0x5f, 0x14, 0x00, 0x98, 0x2f, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, }; int32_t VocalTract_start(VocalTract *self, int32_t tract_ptr, int32_t pos_pin, int32_t neg_pin, int32_t fm_offset) { // Start vocal tract driver - starts a cog // returns false if no cog available // // tract_ptr = pointer to vocal tract parameters (13 bytes) // pos_pin = positive delta-modulation pin (-1 to disable) // neg_pin = negative delta-modulation pin (pos_pin must also be enabled, -1 to disable) // fm_offset = offset frequency for fm aural subcarrier generation (-1 to disable, 4_500_000 for NTSC) // Reset driver VocalTract_stop(self); // Remember vocal tract parameters pointer self->tract = tract_ptr; // Initialize pace to 100% self->pace = 100; // If delta-modulation pin(s) enabled, ready output(s) and ready ctrb for duty mode if (pos_pin > (-1)) { (&self->dira_)[((Shr__(pos_pin, 5)) & 0x1)] = (&self->dira_)[((Shr__(pos_pin, 5)) & 0x1)] | ((1<<pos_pin)); self->ctrb_ = 402653184 + (pos_pin & 0x3f); if (neg_pin > (-1)) { (&self->dira_)[((Shr__(neg_pin, 5)) & 0x1)] = (&self->dira_)[((Shr__(neg_pin, 5)) & 0x1)] | ((1<<neg_pin)); self->ctrb_ = self->ctrb_ + (67108864 + ((neg_pin & 0x3f) << 9)); } } // If fm offset is valid, ready ctra for pll mode with divide-by-16 (else disabled) if (fm_offset > (-1)) { self->ctra_ = 92274688; } // Ready frqa value for fm offset { int32_t _idx__0001; for(_idx__0001 = 0; _idx__0001 < 33; _idx__0001++) { self->frqa_ = self->frqa_ << 1; if (fm_offset >= CLKFREQ) { fm_offset = fm_offset - CLKFREQ; (self->frqa_++); } fm_offset = fm_offset << 1; } } // Ready 20KHz sample period self->cnt_ = CLKFREQ / 20000; // Launch vocal tract cog return (self->cog = cognew((int32_t)(&(*(int32_t *)&dat[0])), (int32_t)(&self->attenuation)) + 1); } int32_t VocalTract_stop(VocalTract *self) { // Stop vocal tract driver - frees a cog // If already running, stop vocal tract cog if (self->cog) { cogstop((PostEffect__(self->cog, 0) - 1)); } memset( (void *)&self->index, 0, sizeof(int32_t)*0x29); return 0; } int32_t VocalTract_set_attenuation(VocalTract *self, int32_t level) { // Set master attenuation level (0..7, initially 0) self->attenuation = level; return 0; } int32_t VocalTract_set_pace(VocalTract *self, int32_t percentage) { // Set pace to some percentage (initially 100) self->pace = percentage; return 0; } int32_t VocalTract_go(VocalTract *self, int32_t time) { // Queue current parameters to transition over time // // actual time = integer(time * 100 / pace) #> 2 * 700µs (at least 1400µs, see set_pace) // Wait until frame available (first long will be zeroed) while (self->frames[self->index]) { Yield__(); } // Load parameters into frame memcpy( (void *)(void *)(((int32_t)(&self->frames[self->index]) + 3)), (void *)self->tract, 1*(13)); // Write stepsize into frame (non-0 alerts vocal tract that frame is ready) self->frames[self->index] = self->frames[self->index] | (16777216 / (Max__(((time * 100) / self->pace), 2))); self->index = (self->index + frame_longs) & 0x1f; return 0; } int32_t VocalTract_full(VocalTract *self) { // Returns true if the parameter queue is full // (useful for checking if "go" would have to wait) return self->frames[self->index]; } int32_t VocalTract_empty(VocalTract *self) { int32_t i; int32_t status = 0; // Returns true if the parameter queue is empty // (useful for detecting when the vocal tract is finished) for(i = 0; i <= 0x7; i++) { if (self->frames[(i * frame_longs)]) { /* false */ return status; } } return -1; } int32_t VocalTract_sample_ptr(VocalTract *self) { // Returns the address of the long which receives the audio samples in real-time // (signed 32-bit values updated at 20KHz) return (int32_t)(&self->sample); } int32_t VocalTract_aural_id(VocalTract *self) { // Returns the id of the cog executing the vocal tract algorithm // (for connecting a broadcast tv driver with the aural subcarrier) return (self->cog - 1); }
65.732899
140
0.528295
[ "object" ]
ec16d51ca88a2d9609d302b6ec9d90c11cb0c7f7
56
c
C
src/vector.c
suomela/types
b85c6e623b4a3a463b90b850494a2cfd4c83c595
[ "MIT", "Unlicense", "BSD-2-Clause", "BSD-3-Clause" ]
4
2015-05-06T06:01:14.000Z
2021-09-07T13:21:43.000Z
src/vector.c
suomela/types
b85c6e623b4a3a463b90b850494a2cfd4c83c595
[ "MIT", "Unlicense", "BSD-2-Clause", "BSD-3-Clause" ]
2
2016-02-20T23:34:06.000Z
2018-10-29T22:46:38.000Z
src/vector.c
suomela/types
b85c6e623b4a3a463b90b850494a2cfd4c83c595
[ "MIT", "Unlicense", "BSD-2-Clause", "BSD-3-Clause" ]
1
2016-02-25T12:21:32.000Z
2016-02-25T12:21:32.000Z
#include "vector.h" const zom_t ZOM_NULL_C = { 0, 0 };
14
34
0.642857
[ "vector" ]
ec405479afd896d1d826785d7c1e43c4d600e9ed
866
h
C
Source/GeotiffLandscape/Public/GeotiffHeightmapAsset.h
iwer/GeotiffLandscape
1347bcb250e446c924ee9bda226c1b520c91750f
[ "MIT" ]
30
2020-12-09T08:37:01.000Z
2022-03-14T10:30:32.000Z
Source/GeotiffLandscape/Public/GeotiffHeightmapAsset.h
iwer/GeotiffLandscape
1347bcb250e446c924ee9bda226c1b520c91750f
[ "MIT" ]
3
2021-12-09T15:07:09.000Z
2022-03-18T09:27:43.000Z
Source/GeotiffLandscape/Public/GeotiffHeightmapAsset.h
iwer/GeotiffLandscape
1347bcb250e446c924ee9bda226c1b520c91750f
[ "MIT" ]
7
2021-06-11T21:57:55.000Z
2021-12-27T04:13:30.000Z
// Copyright (c) Iwer Petersen. All rights reserved. #pragma once #include "CoreMinimal.h" #include "UObject/Object.h" #include "UObject/ObjectMacros.h" #include "Engine/Texture2D.h" #include "Engine/DataAsset.h" #include "ROI.h" #include "GeotiffHeightmapAsset.generated.h" /** * */ UCLASS(BlueprintType, hidecategories=(Object)) class GEOTIFFLANDSCAPE_API UGeotiffHeightmapAsset : public UDataAsset { GENERATED_BODY() public: UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GeotiffHeightmapAsset") float MinHeight; UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GeotiffHeightmapAsset") float MaxHeight; UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GeotiffHeightmapAsset") UTexture2D * Texture; UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "GeotiffHeightmapAsset") URegionOfInterest * ROI; };
28.866667
82
0.769053
[ "object" ]
ec4b9be7ce827a890d0ca7bb903b06e38dc20bf9
573
h
C
data/train/cpp/ec4b9be7ce827a890d0ca7bb903b06e38dc20bf9multi_gui_model.h
harshp8l/deep-learning-lang-detection
2a54293181c1c2b1a2b840ddee4d4d80177efb33
[ "MIT" ]
84
2017-10-25T15:49:21.000Z
2021-11-28T21:25:54.000Z
data/train/cpp/ec4b9be7ce827a890d0ca7bb903b06e38dc20bf9multi_gui_model.h
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
5
2018-03-29T11:50:46.000Z
2021-04-26T13:33:18.000Z
data/train/cpp/ec4b9be7ce827a890d0ca7bb903b06e38dc20bf9multi_gui_model.h
vassalos/deep-learning-lang-detection
cbb00b3e81bed3a64553f9c6aa6138b2511e544e
[ "MIT" ]
24
2017-11-22T08:31:00.000Z
2022-03-27T01:22:31.000Z
#ifndef MULTI_GUI_MODEL_H #define MULTI_GUI_MODEL_H #include "gui_model.h" #include <deque> enum multi_gui_model_role : int { AVAILABLE = -1, }; class multi_gui_model : public gui_model { Q_OBJECT std::deque<gui_model *> m_models; public: multi_gui_model (); ~multi_gui_model (); void add_model (gui_model *model); void remove_model (gui_model *model); virtual QVariant data (int role) const; virtual void set_model_data (const std::map<int, QVariant> &data_map); public: bool is_available (gui_model *model) const; }; #endif // MULTI_GUI_MODEL_H
19.758621
72
0.736475
[ "model" ]
57abba353d03e470d0db7821402c6ad6a698b05b
355
h
C
src/launcher/PluginLoader.h
GEEKiDoS/cso2-launcher
7735016be8df408b7d3236afe63e531de6fb13dc
[ "MIT" ]
null
null
null
src/launcher/PluginLoader.h
GEEKiDoS/cso2-launcher
7735016be8df408b7d3236afe63e531de6fb13dc
[ "MIT" ]
null
null
null
src/launcher/PluginLoader.h
GEEKiDoS/cso2-launcher
7735016be8df408b7d3236afe63e531de6fb13dc
[ "MIT" ]
null
null
null
#pragma once #include "PluginExports.h" #include <vector> void LoadPlugins(); void InitPlugins(); typedef bool(*InitPlugin_t)(PluginImports *pImports); class Plugin { public: Plugin(std::string path); InitPlugin_t Init = nullptr; std::string name; std::string author; std::string version; bool loaded; }; static std::vector<Plugin> g_Plugins;
15.434783
53
0.735211
[ "vector" ]
57b444154cc70c6a273f382a6889147814b0cea5
5,163
h
C
jml/utils/fixed_array.h
etnrlz/rtbkit
0d9cd9e2ee2d7580a27453ad0a2d815410d87091
[ "Apache-2.0" ]
737
2015-01-04T01:40:46.000Z
2022-03-07T10:09:23.000Z
jml/utils/fixed_array.h
TuanTranEngineer/rtbkit
502d06acc3f8d90438946b6ae742190f2f4b4fbb
[ "Apache-2.0" ]
56
2015-01-05T16:01:03.000Z
2020-06-22T19:02:37.000Z
jml/utils/fixed_array.h
TuanTranEngineer/rtbkit
502d06acc3f8d90438946b6ae742190f2f4b4fbb
[ "Apache-2.0" ]
329
2015-01-01T06:54:27.000Z
2022-02-12T22:21:02.000Z
/* fixed_array.h -*- C++ -*- Jeremy Barnes, 5 February 2005 Copyright(c) 2005 Jeremy Barnes. All rights reserved. This file is part of "Jeremy's Machine Learning Library", copyright (c) 1999-2005 Jeremy Barnes. This program is available under the GNU General Public License, the terms of which are given by the file "license.txt" in the top level directory of the source code distribution. If this file is missing, you have no right to use the program; please contact the author. 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. --- Fixed array. Just a boost::multi_array, but with a few extra convenience methods. */ #ifndef __utils__fixed_array_h__ #define __utils__fixed_array_h__ #include <boost/multi_array.hpp> #include <boost/type_traits.hpp> #include "jml/utils/multi_array_utils.h" #include <boost/function.hpp> #include <numeric> namespace ML { template<class T> struct array_deleter { array_deleter(T * p) : p(p) {} void operator () () const { delete[] (p); } T * p; }; template<size_t Dim, class Array> size_t product(const Array & array) { size_t result = 1; for (unsigned i = 0; i < Dim; ++i) result *= array[i]; return result; } template<size_t Dim> size_t array_size(const boost::detail::multi_array::extent_gen<Dim> & ex) { size_t result = 1; for (unsigned i = 0; i < Dim; ++i) result *= ex.ranges_[i].size(); return result; } template<typename T, size_t Dim, class Allocator = std::allocator<typename boost::remove_const<T>::type > > class fixed_array_base : public boost::multi_array<T, Dim, Allocator> { public: typedef boost::multi_array<T, Dim, Allocator> base_type; fixed_array_base() { } template <typename ExtentList> explicit fixed_array_base(const ExtentList & sizes, const typename base_type::storage_order_type & store = boost::c_storage_order(), const Allocator & alloc = Allocator()) : base_type(sizes, store, alloc) { } explicit fixed_array_base(const boost::detail::multi_array::extent_gen<Dim> & dims) : base_type(dims) { } fixed_array_base & operator = (const fixed_array_base & other) { fixed_array_base new_me(other); swap(new_me); } size_t dim(int dimension) const { return this->shape()[dimension]; } void fill(T val) { std::fill(data_begin(), data_end(), val); } T * data_begin() { return this->data(); } T * data_end() { return this->data() + this->num_elements(); } const T * data_begin() const { return this->data(); } const T * data_end() const { return this->data() + this->num_elements(); } void swap(fixed_array_base & other) { boost::swap(*this, other); } }; template<typename T, size_t Dim> class fixed_array { }; template<typename T> class fixed_array<T, 1> : public fixed_array_base<T, 1> { typedef fixed_array_base<T, 1> base_type; public: fixed_array(int d0 = 0) : base_type(boost::extents[d0]) { } #if 0 fixed_array(int d0, T * data, bool delete_data = false) : base_type(data, boost::extents[d0]) { if (delete_data) deleter_ = array_deleter<T>(data); } #endif fixed_array(const base_type & base) : base_type(base) { } fixed_array deep_copy() const { return fixed_array(*(const base_type *)this); } }; template<typename T> class fixed_array<T, 2> : public fixed_array_base<T, 2> { typedef fixed_array_base<T, 2> base_type; public: fixed_array(int d0 = 0, int d1 = 0) : base_type(boost::extents[d0][d1]) { } #if 0 fixed_array(int d0, int d1, T * data, bool delete_data = false) : base_type(data, boost::extents[d0][d1]) { if (delete_data) deleter_ = array_deleter<T>(data); } #endif fixed_array(const base_type & base) : base_type(base) { } fixed_array deep_copy() const { return fixed_array(*(const base_type *)this); } }; template<typename T> class fixed_array<T, 3> : public fixed_array_base<T, 3> { typedef fixed_array_base<T, 3> base_type; public: fixed_array(int d0 = 0, int d1 = 0, int d2 = 0) : base_type(boost::extents[d0][d1][d2]) { } #if 0 fixed_array(int d0, int d1, int d2, T * data, bool delete_data = false) : base_type(data, boost::extents[d0][d1][d2]) { if (delete_data) deleter_ = array_deleter<T>(data); } #endif fixed_array(const base_type & base) : base_type(base) { } fixed_array deep_copy() const { return fixed_array(*(const base_type *)this); } }; } // namespace ML #endif /* __utils__fixed_array_h__ */
22.447826
83
0.616502
[ "shape" ]
57d262485618746f1443a4cc02f118b292b175ad
1,008
h
C
GDDataDrivenView/Classes/RenderPresenter/GDDBaseViewDataSource.h
isabella232/GDDataDrivenView
778a146519c77c7d013c687084c7ee81a242107f
[ "MIT" ]
12
2016-07-10T02:06:36.000Z
2021-02-04T09:41:50.000Z
GDDataDrivenView/Classes/RenderPresenter/GDDBaseViewDataSource.h
isabella232/GDDataDrivenView
778a146519c77c7d013c687084c7ee81a242107f
[ "MIT" ]
1
2018-01-16T09:47:38.000Z
2018-01-16T10:51:49.000Z
GDDataDrivenView/Classes/RenderPresenter/GDDBaseViewDataSource.h
isabella232/GDDataDrivenView
778a146519c77c7d013c687084c7ee81a242107f
[ "MIT" ]
6
2016-09-03T03:03:39.000Z
2022-03-26T08:59:28.000Z
// // Created by Larry Tin on 7/9/16. // #import <Foundation/Foundation.h> @class GDDRenderModel; @protocol GDDRender; @protocol GDDRenderPresenter; @interface GDDBaseViewDataSource : NSObject - (instancetype)initWithView:(id)view withOwner:(id)owner; @property (nonatomic, weak) id view; #pragma mark Read model - (GDDRenderModel *)modelForIndexPath:(NSIndexPath *)indexPath; - (GDDRenderModel *)modelForId:(NSString *)mid; - (NSIndexPath *)indexPathForId:(NSString *)mid; // Returns the model describing the section's header, or nil if there is no header. - (GDDRenderModel *)headerModelForSection:(NSInteger)section; - (NSInteger)numberOfSections; - (NSInteger)numberOfItemsInSection:(NSInteger)section; #pragma mark Change model - (void)insertModels:(NSArray<GDDRenderModel *> *)models atIndexPaths:(NSArray<NSIndexPath *> *)indexPaths; - (void)clearModels; #pragma mark Display model - (id <GDDRenderPresenter>)reloadModel:(GDDRenderModel *)model forRender:(id <GDDRender>)render; @end
24.585366
107
0.764881
[ "render", "model" ]
57d802f5043ebb81b600c47d038b3f51b31788b9
320
h
C
src/DebugMenuState/GLevelUpPlayer.h
isabella232/modite-adventure
66c7779271706ec35e0a2f808afe92d7e15e0f85
[ "MIT" ]
5
2020-12-02T12:28:14.000Z
2021-02-16T18:02:09.000Z
src/DebugMenuState/GLevelUpPlayer.h
pedrohyvo/modite-adventure
8c273803bd60747a169be3ba3f06b3419cc0ebff
[ "MIT" ]
2
2021-01-22T18:51:48.000Z
2021-01-28T18:43:43.000Z
src/DebugMenuState/GLevelUpPlayer.h
pedrohyvo/modite-adventure
8c273803bd60747a169be3ba3f06b3419cc0ebff
[ "MIT" ]
2
2021-01-26T23:22:36.000Z
2021-02-03T10:07:03.000Z
#ifndef MODITE_GLevelUpPlayer_H #define MODITE_GLevelUpPlayer_H #include "common/GButtonWidget.h" class GLevelUpPlayer : public GButtonWidget { public: GLevelUpPlayer(); ~GLevelUpPlayer() = default; TInt Render(TInt aX, TInt aY) OVERRIDE; void Select() OVERRIDE; }; #endif //MODITE_GLevelUpPlayer_H
18.823529
45
0.75
[ "render" ]
57ddc1ec4f5698d2402ff93c615505919d708da0
3,209
h
C
include/CEnv.h
colinw7/CUtil
4cd40ef4a8951afd9e8c42552cbaddf8a63ef794
[ "MIT" ]
2
2021-09-18T07:55:01.000Z
2021-12-23T02:24:42.000Z
include/CEnv.h
colinw7/CUtil
4cd40ef4a8951afd9e8c42552cbaddf8a63ef794
[ "MIT" ]
null
null
null
include/CEnv.h
colinw7/CUtil
4cd40ef4a8951afd9e8c42552cbaddf8a63ef794
[ "MIT" ]
2
2019-09-12T05:31:08.000Z
2021-09-18T07:55:06.000Z
#ifndef CEnv_H #define CEnv_H #include <CRefPtr.h> #include <vector> #include <string> #include <climits> #include <sys/types.h> #define CEnvInst CEnv::getInstance() class CEnv { public: using NameList = std::vector<std::string>; using ValueList = std::vector<std::string>; typedef std::pair<std::string,std::string> NameValue; private: struct NameValues { NameList names; ValueList values; NameValues() : names(), values() { } }; using NameValuesP = CRefPtr<NameValues>; public: class const_iterator { public: using value_type = NameValue; private: NameValuesP nameValues_; uint pos_; public: const_iterator() : nameValues_(), pos_(UINT_MAX) { nameValues_ = CEnvInst.getSnapShot(); pos_ = nameValues_->names.size(); } explicit const_iterator(int) : nameValues_(), pos_(0) { nameValues_ = CEnvInst.getSnapShot(); } ~const_iterator() { CEnvInst.releaseSnapShot(); } const_iterator &operator++() { ++pos_; return *this; } bool operator==(const const_iterator &i) { return (pos_ == i.pos_); } bool operator!=(const const_iterator &i) { return ! (*this == i); } value_type operator*() const { return value_type(nameValues_->names[pos_], nameValues_->values[pos_]); } }; public: static CEnv &getInstance(); ~CEnv(); bool exists(const std::string &name) const; std::string get(const std::string &name) const; bool get(const std::string &name, std::string &value) const; bool get(const std::string &name, int &value) const; bool get(const std::string &name, bool &value) const; bool set(const std::string &name, const std::string &value); bool set(const std::string &name, int value); bool unset(const std::string &name); bool unsetAll(); const_iterator begin() { return const_iterator(0); } const_iterator end () { return const_iterator(); } NameList getNames () const; ValueList getValues() const; ValueList getValues(const std::string &name) const; void getNameValues(NameValues &nv) const; void getNameValues(NameList &names, ValueList &values) const; void getSortedNameValues(NameList &names, ValueList &values) const; std::string mostMatchPrefix (const std::string &prefix ); std::string mostMatchPattern(const std::string &pattern); bool matchPrefix (const std::string &prefix , NameList &names); bool matchPattern(const std::string &pattern, NameList &names); void getPathList(const std::string &name, ValueList &paths); NameValuesP getSnapShot() { if (nameValues_.getRef() < 2) { NameValues *nameValues = new NameValues; getNameValues(*nameValues); nameValues_ = nameValues; } return nameValues_; } void releaseSnapShot() { } private: CEnv() { } // not implemented CEnv(const CEnv &env); CEnv &operator=(const CEnv &env); private: void loadNameValues(NameValues &nv) const; void loadNameValues(NameList &names, ValueList &values) const; private: using Allocated = std::vector<char *>; NameValuesP nameValues_; Allocated allocated_; }; #endif
21.393333
77
0.659707
[ "vector" ]
57eda1464f2a3afee1181a192c43db6d7c9af57a
12,070
c
C
BTrees/MergeTemplate.c
azmeuk/BTrees
74f01d5de2f32f85c806b13b59cfbf7aa3bf5aa9
[ "ZPL-2.1" ]
66
2015-02-22T23:33:22.000Z
2021-12-13T07:14:58.000Z
BTrees/MergeTemplate.c
azmeuk/BTrees
74f01d5de2f32f85c806b13b59cfbf7aa3bf5aa9
[ "ZPL-2.1" ]
160
2015-01-05T21:47:16.000Z
2022-03-09T07:12:30.000Z
BTrees/MergeTemplate.c
azmeuk/BTrees
74f01d5de2f32f85c806b13b59cfbf7aa3bf5aa9
[ "ZPL-2.1" ]
21
2015-04-03T04:28:27.000Z
2021-12-02T06:21:06.000Z
/***************************************************************************** Copyright (c) 2001, 2002 Zope Foundation and Contributors. All Rights Reserved. This software is subject to the provisions of the Zope Public License, Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ****************************************************************************/ #define MERGETEMPLATE_C "$Id$\n" /**************************************************************************** Set operations ****************************************************************************/ static int merge_output(Bucket *r, SetIteration *i, int mapping) { if (r->len >= r->size && Bucket_grow(r, -1, !mapping) < 0) return -1; COPY_KEY(r->keys[r->len], i->key); INCREF_KEY(r->keys[r->len]); if (mapping) { COPY_VALUE(r->values[r->len], i->value); INCREF_VALUE(r->values[r->len]); } r->len++; return 0; } /* The "reason" argument is a little integer giving "a reason" for the * error. In the Zope3 codebase, these are mapped to explanatory strings * via zodb/btrees/interfaces.py. */ static PyObject * merge_error(int p1, int p2, int p3, int reason) { PyObject *r; UNLESS (r=Py_BuildValue("iiii", p1, p2, p3, reason)) r=Py_None; if (ConflictError == NULL) { ConflictError = PyExc_ValueError; Py_INCREF(ConflictError); } PyErr_SetObject(ConflictError, r); if (r != Py_None) { Py_DECREF(r); } return NULL; } /* It's hard to explain "the rules" for bucket_merge, in large part because * any automatic conflict-resolution scheme is going to be incorrect for * some endcases of *some* app. The scheme here is pretty conservative, * and should be OK for most apps. It's easier to explain what the code * allows than what it forbids: * * Leaving things alone: it's OK if both s2 and s3 leave a piece of s1 * alone (don't delete the key, and don't change the value). * * Key deletion: a transaction (s2 or s3) can delete a key (from s1), but * only if the other transaction (of s2 and s3) doesn't delete the same key. * However, it's not OK for s2 and s3 to, between them, end up deleting all * the keys. This is a higher-level constraint, due to that the caller of * bucket_merge() doesn't have enough info to unlink the resulting empty * bucket from its BTree correctly. It's also not OK if s2 or s3 are empty, * because the transaction that emptied the bucket unlinked the bucket from * the tree, and nothing we do here can get it linked back in again. * * Key insertion: s2 or s3 can add a new key, provided the other transaction * doesn't insert the same key. It's not OK even if they insert the same * <key, value> pair. * * Mapping value modification: s2 or s3 can modify the value associated * with a key in s1, provided the other transaction doesn't make a * modification of the same key to a different value. It's OK if s2 and s3 * both give the same new value to the key while it's hard to be precise about * why, this doesn't seem consistent with that it's *not* OK for both to add * a new key mapping to the same value). */ static PyObject * bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3) { Bucket *r=0; PyObject *s; SetIteration i1 = {0,0,0}, i2 = {0,0,0}, i3 = {0,0,0}; int cmp12, cmp13, cmp23, mapping, set; /* If either "after" bucket is empty, punt. */ if (s2->len == 0 || s3->len == 0) { merge_error(-1, -1, -1, 12); goto err; } if (initSetIteration(&i1, OBJECT(s1), 1) < 0) goto err; if (initSetIteration(&i2, OBJECT(s2), 1) < 0) goto err; if (initSetIteration(&i3, OBJECT(s3), 1) < 0) goto err; mapping = i1.usesValue | i2.usesValue | i3.usesValue; set = !mapping; if (mapping) r = (Bucket *)PyObject_CallObject((PyObject *)&BucketType, NULL); else r = (Bucket *)PyObject_CallObject((PyObject *)&SetType, NULL); if (r == NULL) goto err; if (i1.next(&i1) < 0) goto err; if (i2.next(&i2) < 0) goto err; if (i3.next(&i3) < 0) goto err; /* Consult zodb/btrees/interfaces.py for the meaning of the last * argument passed to merge_error(). */ /* TODO: This isn't passing on errors raised by value comparisons. */ while (i1.position >= 0 && i2.position >= 0 && i3.position >= 0) { TEST_KEY_SET_OR(cmp12, i1.key, i2.key) goto err; TEST_KEY_SET_OR(cmp13, i1.key, i3.key) goto err; if (cmp12==0) { if (cmp13==0) { if (set || (TEST_VALUE(i1.value, i2.value) == 0)) { /* change in i3 value or all same */ if (merge_output(r, &i3, mapping) < 0) goto err; } else if (set || (TEST_VALUE(i1.value, i3.value) == 0)) { /* change in i2 value */ if (merge_output(r, &i2, mapping) < 0) goto err; } else { /* conflicting value changes in i2 and i3 */ merge_error(i1.position, i2.position, i3.position, 1); goto err; } if (i1.next(&i1) < 0) goto err; if (i2.next(&i2) < 0) goto err; if (i3.next(&i3) < 0) goto err; } else if (cmp13 > 0) { /* insert i3 */ if (merge_output(r, &i3, mapping) < 0) goto err; if (i3.next(&i3) < 0) goto err; } else if (set || (TEST_VALUE(i1.value, i2.value) == 0)) { /* deleted in i3 */ if (i3.position == 1) { /* Deleted the first item. This will modify the parent node, so we don't know if merging will be safe */ merge_error(i1.position, i2.position, i3.position, 13); goto err; } if (i1.next(&i1) < 0) goto err; if (i2.next(&i2) < 0) goto err; } else { /* conflicting del in i3 and change in i2 */ merge_error(i1.position, i2.position, i3.position, 2); goto err; } } else if (cmp13 == 0) { if (cmp12 > 0) { /* insert i2 */ if (merge_output(r, &i2, mapping) < 0) goto err; if (i2.next(&i2) < 0) goto err; } else if (set || (TEST_VALUE(i1.value, i3.value) == 0)) { /* deleted in i2 */ if (i2.position == 1) { /* Deleted the first item. This will modify the parent node, so we don't know if merging will be safe */ merge_error(i1.position, i2.position, i3.position, 13); goto err; } if (i1.next(&i1) < 0) goto err; if (i3.next(&i3) < 0) goto err; } else { /* conflicting del in i2 and change in i3 */ merge_error(i1.position, i2.position, i3.position, 3); goto err; } } else { /* Both keys changed */ TEST_KEY_SET_OR(cmp23, i2.key, i3.key) goto err; if (cmp23==0) { /* dueling inserts or deletes */ merge_error(i1.position, i2.position, i3.position, 4); goto err; } if (cmp12 > 0) { /* insert i2 */ if (cmp23 > 0) { /* insert i3 first */ if (merge_output(r, &i3, mapping) < 0) goto err; if (i3.next(&i3) < 0) goto err; } else { /* insert i2 first */ if (merge_output(r, &i2, mapping) < 0) goto err; if (i2.next(&i2) < 0) goto err; } } else if (cmp13 > 0) { /* Insert i3 */ if (merge_output(r, &i3, mapping) < 0) goto err; if (i3.next(&i3) < 0) goto err; } else { /* 1<2 and 1<3: both deleted 1.key */ merge_error(i1.position, i2.position, i3.position, 5); goto err; } } } while (i2.position >= 0 && i3.position >= 0) { /* New inserts */ TEST_KEY_SET_OR(cmp23, i2.key, i3.key) goto err; if (cmp23==0) { /* dueling inserts */ merge_error(i1.position, i2.position, i3.position, 6); goto err; } if (cmp23 > 0) { /* insert i3 */ if (merge_output(r, &i3, mapping) < 0) goto err; if (i3.next(&i3) < 0) goto err; } else { /* insert i2 */ if (merge_output(r, &i2, mapping) < 0) goto err; if (i2.next(&i2) < 0) goto err; } } while (i1.position >= 0 && i2.position >= 0) { /* remainder of i1 deleted in i3 */ TEST_KEY_SET_OR(cmp12, i1.key, i2.key) goto err; if (cmp12 > 0) { /* insert i2 */ if (merge_output(r, &i2, mapping) < 0) goto err; if (i2.next(&i2) < 0) goto err; } else if (cmp12==0 && (set || (TEST_VALUE(i1.value, i2.value) == 0))) { /* delete i3 */ if (i1.next(&i1) < 0) goto err; if (i2.next(&i2) < 0) goto err; } else { /* Dueling deletes or delete and change */ merge_error(i1.position, i2.position, i3.position, 7); goto err; } } while (i1.position >= 0 && i3.position >= 0) { /* remainder of i1 deleted in i2 */ TEST_KEY_SET_OR(cmp13, i1.key, i3.key) goto err; if (cmp13 > 0) { /* insert i3 */ if (merge_output(r, &i3, mapping) < 0) goto err; if (i3.next(&i3) < 0) goto err; } else if (cmp13==0 && (set || (TEST_VALUE(i1.value, i3.value) == 0))) { /* delete i2 */ if (i1.next(&i1) < 0) goto err; if (i3.next(&i3) < 0) goto err; } else { /* Dueling deletes or delete and change */ merge_error(i1.position, i2.position, i3.position, 8); goto err; } } if (i1.position >= 0) { /* Dueling deletes */ merge_error(i1.position, i2.position, i3.position, 9); goto err; } while (i2.position >= 0) { /* Inserting i2 at end */ if (merge_output(r, &i2, mapping) < 0) goto err; if (i2.next(&i2) < 0) goto err; } while (i3.position >= 0) { /* Inserting i3 at end */ if (merge_output(r, &i3, mapping) < 0) goto err; if (i3.next(&i3) < 0) goto err; } /* If the output bucket is empty, conflict resolution doesn't have * enough info to unlink it from its containing BTree correctly. */ if (r->len == 0) { merge_error(-1, -1, -1, 10); goto err; } finiSetIteration(&i1); finiSetIteration(&i2); finiSetIteration(&i3); if (s1->next) { Py_INCREF(s1->next); r->next = s1->next; } s = bucket_getstate(r); Py_DECREF(r); return s; err: finiSetIteration(&i1); finiSetIteration(&i2); finiSetIteration(&i3); Py_XDECREF(r); return NULL; }
34.485714
78
0.492875
[ "object" ]
57f40d5313ce09f4247fe1242e49b7b32733a61d
2,358
h
C
Engine/src/Components/sprite.h
SpectralCascade/ossium
f9d00de8313c0f91942eb311c20de8d74aa41735
[ "MIT" ]
1
2019-01-02T15:35:05.000Z
2019-01-02T15:35:05.000Z
Engine/src/Components/sprite.h
SpectralCascade/ossium
f9d00de8313c0f91942eb311c20de8d74aa41735
[ "MIT" ]
2
2018-11-11T21:29:05.000Z
2019-01-02T15:34:10.000Z
Engine/src/Components/sprite.h
SpectralCascade/ossium
f9d00de8313c0f91942eb311c20de8d74aa41735
[ "MIT" ]
null
null
null
/** COPYRIGHT NOTICE * * Ossium Engine * Copyright (c) 2018-2020 Tim Lane * * This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. * **/ #ifndef SPRITE_H #define SPRITE_H #include "texture.h" namespace Ossium { class Sprite : public Texture { public: DECLARE_COMPONENT(Texture, Sprite); /// Overrides Texture to account for offsets. void SetRenderWidth(float percent); /// Overrides Texture to account for offsets. void SetRenderHeight(float percent); /// Overrides Texture to account for percent width and percent height. void SetClip(int x, int y, int w = 0, int h = 0, bool autoscale = true); protected: /// Whether or not this sprite has ever had PlayAnimation() called or not. Necessary for configuring dimensions the first time an animation is loaded. bool initialised = false; /// Stores the temporary position offset so the position can be reverted to normal when no longer animating. Point positionOffset = {0, 0}; /// Used in a very similar way to positionOffset. Point originOffset = {0, 0}; /// Stores the temporary width of the sprite as percentage, relative to the actual render width float percentWidth = 1; /// Stores the temporary height of the sprite as percentage, relative to the actual render height float percentHeight = 1; /// The angular offset of the sprite, used in a similar way to positionOffset float angleOffset = 0; }; } #endif // SPRITE_H
38.655738
247
0.699321
[ "render" ]
520216cde2323963090b6a88c87e42c6459c2955
12,580
h
C
include/XSDK/XListBox.h
MultiSight/multisight-xsdk
02268e1aeb1313cfb2f9515d08d131a4389e49f2
[ "BSL-1.0" ]
2
2017-09-16T13:59:15.000Z
2019-04-24T03:25:36.000Z
include/XSDK/XListBox.h
MultiSight/multisight-xsdk
02268e1aeb1313cfb2f9515d08d131a4389e49f2
[ "BSL-1.0" ]
null
null
null
include/XSDK/XListBox.h
MultiSight/multisight-xsdk
02268e1aeb1313cfb2f9515d08d131a4389e49f2
[ "BSL-1.0" ]
1
2019-04-24T03:25:40.000Z
2019-04-24T03:25:40.000Z
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // // XSDK // Copyright (c) 2015 Schneider Electric // // Use, modification, and distribution is subject to the Boost Software License, // Version 1.0 (See accompanying file LICENSE). // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #ifndef XSDK_XListBox_h #define XSDK_XListBox_h #include <algorithm> #include <list> #include "XSDK/XException.h" #include "XSDK/IXIterate.h" #include "XSDK/Errors.h" #include "XSDK/OS.h" class XListBoxTest; namespace XSDK { #ifdef WIN32 #pragma warning(disable:4355) #endif template<class T> class XListBox : public IXIterate<T> { public: typedef int (*SUCompare)(const T& a, const T& b, void* compareContext ); class ListBoxIter : public IXIterate<T> { friend class XListBox; friend class ::XListBoxTest; public: X_API ListBoxIter(const ListBoxIter& other) : _currIter(other._currIter), _currRevIter(other._currRevIter), _pStorage(other._pStorage), _forward(other._forward) {} X_API ListBoxIter& operator =(const ListBoxIter& other) { _currIter = other._currIter; _currRevIter = other._currRevIter; _pStorage = other._pStorage; _forward = other._forward; return *this; } X_API virtual ~ListBoxIter() throw() {} /// Returns the current number of elements in the list. X_API virtual size_t GetElemCount() const { return _pStorage->GetElemCount(); } /// Reset our iterator to the head of the list. X_API virtual void IterStart(bool forward = true) { _forward = forward; if(_forward) _currIter = _pStorage->_storage.begin(); else _currRevIter = _pStorage->_storage.rbegin(); } /// Advance our iterator to the next element in the list. X_API virtual void Iterate() { if(_forward) ++_currIter; else ++_currRevIter; } /// Get the data (T*) _currently pointed to by the iterator. X_API virtual T* IterData() const { return _forward ? &(*_currIter) : &(*_currRevIter); } /// Returns whether or not the iterator is currently pointing at a valid /// object, or has been incremented off the end of the list. X_API virtual bool IterValid() const { return _forward ? _currIter != _pStorage->_storage.end() : _currRevIter != _pStorage->_storage.rend(); } private: X_API ListBoxIter(const XListBox* listBox, bool forward) : _currIter(), _currRevIter(), _pStorage(listBox), _forward(forward) { IterStart(forward); } typename std::list<T>::iterator _currIter; typename std::list<T>::reverse_iterator _currRevIter; const XListBox* _pStorage; bool _forward; }; friend class ListBoxIter; X_API XListBox(std::list<T>& storage, SUCompare su = NULL, void* compareContext = NULL ) : _storage(storage), _iter(this, true), _compFunc(su), _compareContext( compareContext ) {} X_API XListBox(const XListBox& obj) : _storage(obj._storage), _iter(this, true), _compFunc(obj._compFunc), _compareContext( obj._compareContext ) {} X_API virtual ~XListBox() throw() { } X_API XListBox& operator = ( const XListBox& obj ) { _storage = obj._storage; _iter.IterStart(obj._iter._forward); _compFunc = obj._compFunc; _compareContext = obj._compareContext; return *this; } X_API XListBox& operator = ( const std::list<T>& storage ) { _storage = storage; _iter.IterStart(); _compFunc = NULL; _compareContext = NULL; return *this; } X_API void Append( const T& obj ) { if(_compFunc) X_THROW(("XSDK::XListBox::Append() Not Supported: The list is sorted.")); _storage.push_back(obj); } X_API void AppendList(const XListBox<T>& obj) { if(_compFunc) X_THROW(("XSDK::XListBox::AppendList() Not Supported: The list is sorted.")); _storage.insert(_storage.end(), obj._storage.begin(), obj._storage.end()); } X_API void SubList(size_t index, size_t count) { std::list<T> tmp; typename std::list<T>::iterator iter = _storage.begin(); const typename std::list<T>::iterator end = _storage.end(); for(size_t i = 0; i < index; ++i) ++iter; for(size_t i = 0; iter != end && i < count; ++i, ++iter) tmp.push_back(*iter); _storage.swap(tmp); } X_API void Prepend(const T& obj) { if(_compFunc) X_THROW(("XSDK::XListBox::Prepend() Not Supported: The list is sorted.")); _storage.push_front( obj ); } X_API void Push(const T& obj) { if(_compFunc) X_THROW(("XSDK::XListBox::Push() Not Supported: The list is sorted.")); _storage.push_back( obj ); } X_API T Pop() { if( !_storage.empty() ) { const T data = _storage.back(); _storage.pop_back(); return data; } else X_THROW(( "Cannot call Pop() on an empty XSDK::XListBox." )); } X_API void InsertBeforeIter(const T& obj) { InsertBeforeIter(obj, _iter); } X_API void InsertBeforeIter(const T& obj, ListBoxIter iter) { if(_compFunc) X_THROW(("XSDK::XListBox::InsertBeforeIter() Not Supported: The list is sorted.")); if(!iter.IterValid()) X_THROW(("XSDK::XListBox::InsertBeforeIter() Given iterator is invalid.")); if(iter._pStorage != this) X_THROW(("XSDK::XListBox::InsertBeforeIter() Given iterator points to a different container.")); if(!iter._forward) X_THROW(("XSDK::XListBox::InsertBeforeIter() You cannot insert with a reverse iterator.")); if(iter._forward) _storage.insert(iter._currIter, obj); else _storage.insert(iter._currRevIter.base(), obj); } private: class CompFuncGreaterThanFunctor : public std::unary_function<T, bool> { public: CompFuncGreaterThanFunctor(SUCompare compFunc, void* compareContext, const T& value) : _compFunc(compFunc), _compareContext( compareContext ), _value(value) {} bool operator()(const T& other) { return _compFunc( other, _value, _compareContext ) > 0; } private: CompFuncGreaterThanFunctor& operator=(const CompFuncGreaterThanFunctor& obj); SUCompare _compFunc; void* _compareContext; const T& _value; }; public: X_API void InsertSorted(const T& obj) { if(!_compFunc) X_THROW(("XSDK::XListBox::InsertSorted() Not Supported: The list is not sorted.")); _storage.insert(x_find_if(_storage.begin(), _storage.end(), CompFuncGreaterThanFunctor(_compFunc, _compareContext, obj)), obj); } /// Inserts the objects in another list into list via insertion sort. /// \param otherList The other list to be inserted into this one. X_API void InsertListSorted(const XListBox<T>& otherList) { if(!_compFunc) X_THROW(("XSDK::XListBox::InsertListSorted() Not Supported: The list is not sorted.")); if(otherList.Empty()) return; if(otherList.IsSorted()) { if(Empty()) _storage.assign(otherList._storage.begin(), otherList._storage.end()); else { typename std::list<T>::iterator iter = _storage.begin(); typename std::list<T>::iterator end = _storage.end(); typename std::list<T>::iterator otherIter = otherList._storage.begin(); typename std::list<T>::iterator otherEnd = otherList._storage.end(); while(otherIter != otherEnd) { //Grab place to insert into. iter = x_find_if(iter, end, CompFuncGreaterThanFunctor(_compFunc, _compareContext, *otherIter)); //Grab end of set of values to insert before iter. typename std::list<T>::iterator nextOtherIter = otherIter; ++nextOtherIter; if(iter != end) { nextOtherIter = x_find_if(nextOtherIter, otherEnd, CompFuncGreaterThanFunctor(_compFunc, _compareContext, *iter)); } else nextOtherIter = otherEnd; //Insert values. _storage.insert(iter, otherIter, nextOtherIter); otherIter = nextOtherIter; } } } else { for(ListBoxIter iter = otherList.GetIterator(); iter.IterValid(); iter.Iterate()) { InsertSorted(*iter.IterData()); } } } X_API ListBoxIter GetIterator(bool forward = true) const { return ListBoxIter(this, forward); } X_API T* Get(size_t index) const { if(index < GetElemCount()) { ListBoxIter iter(this, true); for(size_t i = 0; i < index; ++i) iter.Iterate(); return iter.IterData(); } else X_THROW(("XSDK::XInternalList::Get() index out of range.")); } X_API bool Contains(const T& obj) const { const typename std::list<T>::iterator end = _storage.end(); return find(_storage.begin(), end, obj) != end; } /// @brief Returns true if this list is sorted. X_API bool IsSorted() const { return _compFunc != NULL; } /// @brief Returns true if this list is sorted. X_API SUCompare GetCompFunc() const { return _compFunc; } X_API void* GetCompContext() const { return _compareContext; } X_API void Remove(const T& obj) { _storage.remove(obj); } X_API void RemoveAtIter() { _iter = RemoveAtIter(_iter); } X_API ListBoxIter RemoveAtIter(ListBoxIter iter) { if(!iter.IterValid()) X_THROW(("XSDK::XListBox::RemoveAtIter() Given iterator is invalid.")); if(iter._pStorage != this) X_THROW(("XSDK::XListBox::RemoveAtIter() Given iterator points to a different container.")); if(!iter._forward) X_THROW(("XSDK::XListBox::RemoveAtIter() You cannot remove with a reverse iterator.")); if(iter._forward) iter._currIter = _storage.erase(iter._currIter); else _storage.erase((++iter._currRevIter).base()); return iter; } X_API virtual void Clear() { _storage.clear(); } /// @brief Returns whether there are any elements in the list. X_API virtual bool Empty() const { return _storage.empty(); } /// Returns the number of T's stored in this collection. X_API virtual size_t GetElemCount() const { return _storage.size(); } /// Resets the internal iterator to the logical beginning of the collection. /// \param forward Determines direction of iteration, defaults to forward. X_API virtual void IterStart( bool forward = true ) { _iter.IterStart(forward); } /// Advances the internal iterator to the next element of the collection. X_API virtual void Iterate() { _iter.Iterate(); } /// Returns a pointer to the T stored at the current location of the iterator. X_API virtual T* IterData() const { return _iter.IterData(); } /// Returns true when the iterator currently points at a valid item. X_API virtual bool IterValid() const { return _iter.IterValid(); } private: XListBox(); std::list<T>& _storage; ListBoxIter _iter; SUCompare _compFunc; void* _compareContext; }; }; #endif
26.995708
138
0.56248
[ "object" ]
d5a240063c243c186ac1c1423763c725f92dfc96
1,911
h
C
BMMBusinessLogic/include/BusinessLogicController.h
melaniaoncea/BookMyMovie
8f5bfab845bf86777f750d71d88bb34e7f5b665e
[ "MIT" ]
null
null
null
BMMBusinessLogic/include/BusinessLogicController.h
melaniaoncea/BookMyMovie
8f5bfab845bf86777f750d71d88bb34e7f5b665e
[ "MIT" ]
null
null
null
BMMBusinessLogic/include/BusinessLogicController.h
melaniaoncea/BookMyMovie
8f5bfab845bf86777f750d71d88bb34e7f5b665e
[ "MIT" ]
null
null
null
/// /// \file BusinessLogicController.h /// /// \brief Contains core controller class of BusinessLogic lib /// /// \author Melania Oncea /// \date 2020 08 17 /// \since 1.0 /// /// Copyright (c) 2020, Melania Oncea. All rights reserved. /// #ifndef BUSINESSLOGICCONTROLLER_H #define BUSINESSLOGICCONTROLLER_H #include <memory> #include <vector> #include <string> #include <MoviesProvider.h> #include <ShowProvider.h> using std::shared_ptr; using std::unique_ptr; using std::vector; using std::string; namespace BMMBusinessLogic { class AbstractAllMovieFetcher; class AbstactShowDetailsFetcher; /// /// \class Movie Movie.h /// class BusinessLogicController { public: /// \brief Create a new BusinessLogicController object /// \param[in] moviesFetcher an object that implements AbstractAllMoviesFetcher and provides a list of movie titles /// \param[in] showFetcher an object that implements AbstactShowDetailsFetcher and returns a list of theaters /// \since 1.0 /// BusinessLogicController(shared_ptr<BMMBusinessLogic::AbstractAllMoviesFetcher> moviesFetcher); /// /// \brief Returns all the available movies and their associated details /// \return The vector<vector<string>, e.g., {{"1", "MovieTitle1"}, {"2", "MovieTitle2"}} /// vector<BMMBusinessLogic::Movie> getAllMovies(); vector<BMMBusinessLogic::Theater> getTheatersByMovieId(unsigned int selectedMovieId); vector<BMMBusinessLogic::Seat> searchAvailableSeatsByMovieAndTheaterIds(unsigned int selectedMovieId, unsigned int selectedTheaterId); private: unique_ptr<BMMBusinessLogic::MoviesProvider> m_moviesProvider {nullptr}; shared_ptr<BMMBusinessLogic::ShowProvider> m_showProvider {nullptr}; // should have been initialized in constructor }; } #endif // BUSINESSLOGICCONTROLLER_H
31.327869
142
0.712716
[ "object", "vector" ]
d5b90be0f9f6bde5d1453cbe7f9ea6e6a9c4b475
3,160
h
C
include/gazer/LLVM/Memory/MemoryModel.h
ftsrg/gazer
66096caeb169b63c39ddb76ae798c5d1a0e74216
[ "Apache-2.0" ]
6
2020-08-09T21:18:17.000Z
2021-11-10T06:23:31.000Z
include/gazer/LLVM/Memory/MemoryModel.h
FTSRG/gazer
66096caeb169b63c39ddb76ae798c5d1a0e74216
[ "Apache-2.0" ]
69
2020-02-10T16:33:09.000Z
2021-02-13T12:56:29.000Z
include/gazer/LLVM/Memory/MemoryModel.h
ftsrg/gazer
66096caeb169b63c39ddb76ae798c5d1a0e74216
[ "Apache-2.0" ]
5
2020-05-17T09:13:11.000Z
2020-08-08T18:29:34.000Z
//==-------------------------------------------------------------*- C++ -*--==// // // Copyright 2019 Contributors to the Gazer project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //===----------------------------------------------------------------------===// #ifndef GAZER_MEMORY_MEMORYMODEL_H #define GAZER_MEMORY_MEMORYMODEL_H #include "gazer/LLVM/Memory/MemorySSA.h" #include "gazer/LLVM/Memory/MemoryInstructionHandler.h" namespace llvm { class Loop; } // end namespace llvm namespace gazer { class Cfa; /// Memory models are responsible for representing memory-related types and instructions. class MemoryModel { public: MemoryModel() = default; MemoryModel(const MemoryModel&) = delete; MemoryModel& operator=(const MemoryModel&) = delete; /// Returns the memory instruction translator of this memory model. virtual MemoryInstructionHandler& getMemoryInstructionHandler(llvm::Function& function) = 0; /// Returns the type translator of this memory model. virtual MemoryTypeTranslator& getMemoryTypeTranslator() = 0; virtual ~MemoryModel() = default; }; //==------------------------------------------------------------------------==// /// HavocMemoryModel - A havoc memory model which does not create any memory /// objects. Load operations return an unknown value and store instructions /// have no effect. No MemoryObjectPhi's are inserted. std::unique_ptr<MemoryModel> CreateHavocMemoryModel(GazerContext& context); //==-----------------------------------------------------------------------==// // FlatMemoryModel - a memory model which represents all memory as a single // array, where loads and stores are reads and writes in said array. std::unique_ptr<MemoryModel> CreateFlatMemoryModel( GazerContext& context, const LLVMFrontendSettings& settings, llvm::Module& module, std::function<llvm::DominatorTree&(llvm::Function&)> dominators ); class MemoryModelWrapperPass : public llvm::ModulePass { public: static char ID; MemoryModelWrapperPass(GazerContext& context, const LLVMFrontendSettings& settings) : ModulePass(ID), mContext(context), mSettings(settings) {} void getAnalysisUsage(llvm::AnalysisUsage& au) const override; bool runOnModule(llvm::Module& module) override; MemoryModel& getMemoryModel() const { return *mMemoryModel; } llvm::StringRef getPassName() const override { return "Memory model wrapper pass"; } private: GazerContext& mContext; const LLVMFrontendSettings& mSettings; std::unique_ptr<MemoryModel> mMemoryModel; }; } // namespace gazer #endif //GAZER_MEMORY_MEMORYMODEL_H
33.263158
96
0.674367
[ "model" ]
d5ba89a05f8ea4384e428838ff1e34c38e2a05d0
37,806
h
C
main.h
RainyEricYe/bamDCS
49101bf8fa797c5294a60a0a8f046c693a1828f9
[ "MIT" ]
null
null
null
main.h
RainyEricYe/bamDCS
49101bf8fa797c5294a60a0a8f046c693a1828f9
[ "MIT" ]
null
null
null
main.h
RainyEricYe/bamDCS
49101bf8fa797c5294a60a0a8f046c693a1828f9
[ "MIT" ]
null
null
null
/* * */ #ifndef MAIN_H_ #define MAIN_H_ #define PROGRAM "bamDCS" #define VERSION "v2.4" #define AUTHORS "yerui" #define CONTACT "yerui@connect.hku.hk" #define REMARKS "(generate double strand consensus reads for low-frequency mutation)" #include <iostream> #include <fstream> #include <sstream> #include <string> #include <vector> #include <map> #include <set> #include <cmath> #include <utility> #include <algorithm> #include "SeqLib/BamReader.h" #include "SeqLib/BamWriter.h" #include "gzstream.h" #include "boost/math/distributions/chi_squared.hpp" using namespace __gnu_cxx; using namespace std; using namespace SeqLib; typedef unsigned long ulong; class Option { public: Option(): baseQuaCutoff(20), mapQuaCutoff(30), minSupOnEachStrand(3), maxSupOnEachStrand(3000), Ncutoff(0.1), minFractionInFam(0.002), freqPrecision(0.00001), lhrGapCutoff(2.0), phredOffset(33), minSupOnHaplotype(3), filtSoftClip(false), outBamFile(""), sscsOut(false), singleOut(false), debug(false), pvalue(0.001), pcrError(1.0e-5), softEndTrim(5), randNread(0) {} ~Option(){} int baseQuaCutoff; int mapQuaCutoff; ulong minSupOnEachStrand; ulong maxSupOnEachStrand; double Ncutoff; double minFractionInFam; double freqPrecision; double lhrGapCutoff; int phredOffset; ulong minSupOnHaplotype; bool filtSoftClip; string outBamFile; bool sscsOut; bool singleOut; bool debug; double pvalue; double pcrError; ulong softEndTrim; size_t randNread; }; typedef map<string, vector<SeqLib::BamRecord> > mStrBrV; typedef map<char,double> mCharDouble; typedef map<char, ulong> mCharUlong; typedef map<string,ulong> mStrUlong; typedef map<char, vector<double> > mCvD; typedef pair<char,ulong> pCharUlong; typedef pair<double, set<char> > pDoubleCharSet; typedef vector< set<char> > vCharSet; typedef vector<string> vString; // descending sort pair inline bool _cmpByFirst(const pDoubleCharSet &a, const pDoubleCharSet &b) { return a.first > b.first; } inline bool _cmpBySecond(const pCharUlong &a, const pCharUlong &b) { return a.second > b.second; } inline double errorRate(const char &q, const Option &opt); inline vector<double> quaToErrorRate(const string &qs, const Option &opt); inline string _itoa( size_t &i ); inline ulong countN(const string &s); inline bool lowQuality(const char &, const Option &); inline string reverseComplement(const string &); void usage(); SeqLib::BamHeader removeReadGroup( const SeqLib::BamHeader & ); void calibrateFam(mStrBrV &); bool testCigarFam(mStrBrV &, mStrBrV &, const string &, const Option &); void printConsensusRead(ogzstream &,ogzstream &,mStrBrV &,mStrBrV &,const string &,const Option &,const string &, SeqLib::BamWriter &); void sscs(mStrBrV &,mStrBrV &,const string &,const Option &,const string &, SeqLib::BamWriter &); void addPcrError( vector< mCvD > &wcHetPos, const Option &opt); string getQuaFromPvalue( const vector< mCvD > &quaV, const string &s, const Option &opt ); string adjust_p(const string &qs, const Option &opt); vector< mCvD > hetPoint(const BamRecordVector &, const Option &); vector< mCvD > zipHetPoint(const vector< mCvD > &, const vector< mCvD > &, const Option &opt); map<string, long> consensusSeq(const BamRecordVector &, const BamRecordVector &, const vector< mCvD > &, const Option &); map<string, long> consensusSeq(const BamRecordVector &wcBrV, const vector< mCvD > &wcHetPos, const Option &opt); mCvD llh_genotype(const string &, const string &, const Option &); string ignoreError(const string &, const vector< mCvD > &); string ignoreError2(const string &s, const vector< mCvD > &v); void trimEnd(SeqLib::BamRecord &br, const Option &opt); size_t getGenomePosition(size_t pos, ulong i, const Cigar &cg); // sub functions void usage() { cout << "Program: " << PROGRAM << " " << REMARKS << "\n" "Version: " << VERSION << "\n" "Authors: " << AUTHORS << "\n" "Contact: " << CONTACT << "\n\n" "Options: " << PROGRAM << " in.bam out_prefix\n\n" " -q [i] base quality cutoff [20]\n" " -Q [i] map quality cutoff [30]\n" " -s [i] min support num on each strand [3]\n" " -S [i] max support num on each strand [3000]\n" " -N [f] max fraction of N on consensus read [0.1]\n" " -f [f] min fraction of alterative allele in a read family [0.002]\n" " -e [f] precision of allele frequency while calculate likelihood ratio [0.00001]\n" " -g [f] gap between likelihood ratios of major and rest genotypes [2.0]\n" " -x [i] Encoding offset for phred quality scores [33]\n" " -t [i] min support num to construct a haplotype seq [3]\n" " -c discard soft-clipping reads [false]\n" " -C [i] soft trim N base from both ends of read [5]\n" " -p [f] expected PCR error rate during library construction [1e-5]\n" " -n [i] N read pairs to be randomly selected and used [0, total]\n" " -o [s] output bam File directly []\n" " -a output single pair-end reads [false]\n" " -b output SSCS [false]\n" " -d debug mode [false]\n" " -h help\n" " -v version\n" "\n"; } SeqLib::BamHeader removeReadGroup( const SeqLib::BamHeader &oldHead ) { istringstream itm( oldHead.AsString() ); string line; string s(""); while (getline(itm, line) ) { size_t i = line.find("@RG"); if ( i == 0 ) { s += "@RG\tID:foo\tSM:bar\n"; } if ( i != 0 ) { s += line + "\n"; } } // add rg if the old head does not have rg if ( s.find("@RG") == string::npos ) { s += "@RG\tID:foo\tSM:bar\n"; } SeqLib::BamHeader newHead(s); return newHead; } inline double errorRate(const char &q, const Option &opt) { return pow( 10, (double)(opt.phredOffset-(int)q)/10 ); } inline vector<double> quaToErrorRate(const string &qs, const Option &opt) { vector<double> eV; for ( size_t i(0); i != qs.size(); i++ ) eV.push_back( errorRate(qs[i], opt) ); return eV; } inline string _itoa( size_t &i ) { ostringstream osm; osm << i; return osm.str(); } inline ulong countN(const string &s) { ulong n(0); for ( size_t i(0); i != s.size(); i++ ) { if ( s[i] == 'N' ) n++; } return n; } inline bool lowQuality(const char &q, const Option &opt) { return ( int(q) - opt.phredOffset < opt.baseQuaCutoff ); } inline string reverseComplement(const string &seq) { string str(""); for ( string::const_reverse_iterator it = seq.rbegin(); it != seq.rend(); it++) { switch (*it) { case 'A': str += "T"; break; case 'C': str += "G"; break; case 'G': str += "C"; break; case 'T': str += "A"; break; case 'N': default: str += "N"; break; } } return str; } inline char errorRateToChar(const double &q, const Option &opt) { return char( opt.phredOffset - (int)(-10 * log(q) / log(10.0) ) ); } void calibrateFam(mStrBrV &) { return; } // check family size on cigar bool testCigarFam(mStrBrV &watsonFam, mStrBrV &crickFam, const string &cg, const Option &opt) { mStrBrV::const_iterator w = watsonFam.find( cg ); mStrBrV::const_iterator c = crickFam.find( cg ); if ( w != watsonFam.end() && c != crickFam.end() && w->second.size() >= opt.minSupOnEachStrand * 2 && c->second.size() >= opt.minSupOnEachStrand * 2 && w->second.size() <= opt.maxSupOnEachStrand * 2 && c->second.size() <= opt.maxSupOnEachStrand * 2 ) return true; else return false; } // output consensus Read pair into fq files void printConsensusRead( ogzstream & fq1, ogzstream & fq2, mStrBrV & watsonFam, mStrBrV & crickFam, const string & cg, const Option & opt, const string & chrBegEnd, SeqLib::BamWriter & writer ) { // length of read1 & read2 are same, So connect them to simplify workflow // 0-based index of heterozygous point --> vector of allele set vector< mCvD > wHetPos, cHetPos, sameHetPos; // find heterzygous point on each fam wHetPos = hetPoint(watsonFam[cg], opt); cHetPos = hetPoint( crickFam[cg], opt); // find consistent het point by comparing watson & crick family sameHetPos = zipHetPoint(wHetPos, cHetPos, opt); // watson & crick should be concordant on hom point. if not, set N map<string, long> mSeqN = consensusSeq(watsonFam[cg], crickFam[cg], sameHetPos, opt); string Qname("@"); Qname += chrBegEnd + ":" + cg + ":"; if ( mSeqN.empty() ) return; double dcsN(0.0); for ( auto p : mSeqN ) dcsN += (double)p.second; int i(0); for ( auto p : mSeqN ) { i++; string seq = p.first; double frac( p.second/dcsN ); size_t length = seq.size()/2; string quaStr = getQuaFromPvalue( sameHetPos, seq, opt ); string rd1 = seq.substr( 0, length ); string rd2 = reverseComplement( seq.substr(length) ); string quaStr1 = quaStr.substr( 0, length ); string quaStr2 = quaStr.substr( length ); reverse( quaStr2.begin(), quaStr2.end() ); if ( opt.outBamFile.size() > 0 ) { SeqLib::BamRecord br1 = watsonFam[cg].at(0); SeqLib::BamRecord br2 = watsonFam[cg].at(1); if ( opt.softEndTrim > 0 ) { trimEnd(br1, opt); trimEnd(br2, opt); } br1.SetSequence( rd1 ); br2.SetSequence( seq.substr(length) ); if ( br1.Position() < 1 || br2.Position() < 1 ) continue; reverse( quaStr2.begin(), quaStr2.end() ); br1.SetQualities( quaStr1, 33 ); br2.SetQualities( quaStr2, 33 ); br1.RemoveAllTags(); br2.RemoveAllTags(); br1.AddZTag("RG", "foo"); br2.AddZTag("RG", "foo"); if ( frac > 0 ) { br1.AddZTag("fr", to_string(frac)); br2.AddZTag("fr", to_string(frac)); ostringstream famSize; famSize << watsonFam[cg].size() << "," << crickFam[cg].size(); br1.AddZTag("fs", famSize.str() ); br2.AddZTag("fs", famSize.str() ); } if ( mSeqN.size() > 1 ) { br1.AddZTag("sp", to_string(i)); br2.AddZTag("sp", to_string(i)); } if ( br1.GetCigar().NumQueryConsumed() != br1.Length() ) { cerr << "WARN: cigar and seq length differ for " << br1 << endl; continue; } if ( br2.GetCigar().NumQueryConsumed() != br2.Length() ) { cerr << "WARN: cigar and seq length differ for " << br2 << endl; continue; } try { writer.WriteRecord( br1 ); writer.WriteRecord( br2 ); } catch ( std::runtime_error &e ) { cerr << "WARN: WriteRecord error, skip\n" << br1 << "\n" << br2 << endl; } } } } void sscs(mStrBrV &watsonFam, mStrBrV &crickFam, const string &cg, const Option &opt, const string &chrBegEnd, SeqLib::BamWriter &writer ) { vector< mCvD > wcHetPos; BamRecordVector wcBrV; size_t w_size(0), c_size(0); // wcBrV contain br from both Fam for ( auto &br : watsonFam[cg] ) { wcBrV.push_back(br); w_size++; } for ( auto &br : crickFam[cg] ) { wcBrV.push_back(br); c_size++; } // only one pair of reads, output directly if ( opt.singleOut && wcBrV.size() == 2 && opt.outBamFile.size() > 0 ) { if ( opt.softEndTrim > 0 ) { trimEnd( wcBrV[0], opt ); trimEnd( wcBrV[1], opt ); } ostringstream famSize; famSize << w_size << "," << c_size; wcBrV[0].AddZTag("fs", famSize.str() ); wcBrV[1].AddZTag("fs", famSize.str() ); writer.WriteRecord( wcBrV[0] ); writer.WriteRecord( wcBrV[1] ); return; } /* // skip sscs if there is indel and not supported by both strands size_t insIt = cg.find('I'); size_t delIt = cg.find('D'); if ( ( insIt != string::npos or delIt != string::npos ) && ( w_size == 0 or c_size == 0 ) ) { return; } */ // more than one pairs of reads, calculate pvalue + PCR error wcHetPos = hetPoint(wcBrV, opt); addPcrError(wcHetPos, opt); map<string, long> mSeqN = consensusSeq(wcBrV, wcHetPos, opt); string Qname("@"); Qname += chrBegEnd + ":" + cg + ":"; if ( mSeqN.empty() ) return; double dcsN(0); for ( auto p : mSeqN ) dcsN += (double)p.second; int i(0); for ( auto p : mSeqN ) { i++; string seq = p.first; double frac( p.second/dcsN ); size_t length = seq.size()/2; string quaStr = getQuaFromPvalue( wcHetPos, seq, opt ); string rd1 = seq.substr( 0, length ); string rd2 = reverseComplement( seq.substr(length) ); string quaStr1 = quaStr.substr( 0, length ); string quaStr2 = quaStr.substr( length ); reverse( quaStr2.begin(), quaStr2.end() ); if ( opt.outBamFile.size() > 0 ) { SeqLib::BamRecord br1 = wcBrV.at(0); SeqLib::BamRecord br2 = wcBrV.at(1); if ( opt.softEndTrim > 0 ) { trimEnd(br1, opt); trimEnd(br2, opt); } br1.SetSequence( rd1 ); br2.SetSequence( seq.substr(length) ); reverse( quaStr2.begin(), quaStr2.end() ); br1.SetQualities( quaStr1, 33 ); br2.SetQualities( quaStr2, 33 ); br1.RemoveAllTags(); br2.RemoveAllTags(); br1.AddZTag("RG", "foo"); br2.AddZTag("RG", "foo"); if (frac > 0) { br1.AddZTag("fr", to_string(frac)); br2.AddZTag("fr", to_string(frac)); ostringstream famSize; famSize << w_size << "," << c_size; br1.AddZTag("fs", famSize.str() ); br2.AddZTag("fs", famSize.str() ); } if ( mSeqN.size() > 1 ) { br1.AddZTag("sp", to_string(i)); br2.AddZTag("sp", to_string(i)); } if ( br1.GetCigar().NumQueryConsumed() != br1.Length() ) { cerr << "WARN: cigar and seq length differ for " << br1 << endl; continue; } if ( br2.GetCigar().NumQueryConsumed() != br2.Length() ) { cerr << "WARN: cigar and seq length differ for " << br2 << endl; continue; } writer.WriteRecord( br1 ); writer.WriteRecord( br2 ); } } return; } // get heterozygous points based on watson or crick family only vector< mCvD > hetPoint(const BamRecordVector &brV, const Option &opt) { vector< mCvD > pt; vString seqV, quaV; // too few reads to support heterozygous point. two reads form a pair. if ( brV.size() < opt.minSupOnEachStrand * 2 ) return pt; string seq(""), qua(""); for ( auto & br : brV ) { if ( !br.ReverseFlag() ) { // + strand seq = br.Sequence(); qua = br.Qualities(); } else { // - strand seq += br.Sequence(); qua += br.Qualities(); seqV.push_back(seq); quaV.push_back(qua); } } size_t length = seq.size(); // fetch each column of alleles and quality scores for ( size_t j(0); j != length; j++ ) { string base(""), qual(""); for ( size_t i(0); i != seqV.size(); i++ ) { base += seqV[i][j]; qual += quaV[i][j]; } pt.push_back( llh_genotype(base, qual, opt) ); } return pt; } void addPcrError( vector< mCvD > &wcHetPos, const Option &opt) { for ( auto &ntPF : wcHetPos ) { for ( mCvD::iterator it = ntPF.begin(); it != ntPF.end(); it++ ) { it->second.at(0) += 10 * opt.pcrError; if ( it->second.at(0) > 1 ) it->second.at(0) = 1.0; } } return; } string getQuaFromPvalue( const vector< mCvD > &quaV, const string &s, const Option &opt ) { ostringstream q(""); for ( size_t i(0); i != s.size(); i++ ) { if ( s[i] == 'N' ) { q << '$'; } else { mCvD::const_iterator it = quaV[i].find( s[i] ); if ( it != quaV[i].end() ) { double f = -10.0 * log( it->second.at(0) )/log(10.0); q << (char)( opt.phredOffset + int(f) ); } else { q << '$'; } } } return q.str(); } vector< mCvD > zipHetPoint(const vector< mCvD > &w, const vector< mCvD > &c, const Option &opt) { vector< mCvD > samePt; if ( w.empty() || c.empty() ) return samePt; for ( size_t j(0); j != w.size(); j++ ) { mCvD nt; for ( mCvD::const_iterator wi = w[j].begin(); wi != w[j].end(); wi++ ) { if ( wi->second.at(0) > opt.pvalue ) continue; mCvD::const_iterator ci = c[j].find( wi->first ); if ( ci != c[j].end() ) { if ( ci->second.at(0) > opt.pvalue ) continue; nt[ wi->first ].push_back( wi->second.at(0) + ci->second.at(0) - wi->second.at(0) * ci->second.at(0) + 10 * pow(opt.pcrError,2) ); nt[ wi->first ].push_back( (wi->second.at(1) + ci->second.at(1)) / 2); } } samePt.push_back(nt); } return samePt; } map<string, long> consensusSeq(const BamRecordVector &w, const BamRecordVector &c, const vector< mCvD > &sameHetPos, const Option &opt) { map<string, long> mSeqN; if ( sameHetPos.empty() ) return mSeqN; mStrUlong mSeqN_w, mSeqN_c; string seq(""); // count N size_t Ncnt(0); for ( auto & p : sameHetPos ) { if ( p.empty() ) Ncnt++; } if ( Ncnt > sameHetPos.size() * opt.Ncutoff ) return mSeqN; // get potential seq based on original read and heterozygous site for ( auto &br : w ) { if ( !br.ReverseFlag() ) { // + strand seq = br.Sequence(); } else { // - strand seq += br.Sequence(); mSeqN_w[ ignoreError(seq, sameHetPos) ]++; } } for ( auto &br : c ) { if ( !br.ReverseFlag() ) { // + strand seq = br.Sequence(); } else { // - strand seq += br.Sequence(); mSeqN_c[ ignoreError(seq, sameHetPos) ]++; } } for ( mStrUlong::iterator it = mSeqN_w.begin(); it != mSeqN_w.end(); it++ ) { if ( it->second >= opt.minSupOnHaplotype ) { size_t len = it->first.size() / 2; if ( countN( it->first.substr( 0,len) ) > opt.Ncutoff * len && countN( it->first.substr(len,len) ) > opt.Ncutoff * len ) continue; mStrUlong::iterator ct = mSeqN_c.find( it->first ); if ( ct != mSeqN_c.end() && ct->second >= opt.minSupOnHaplotype ) mSeqN[ it->first ] = it->second + ct->second; } } return mSeqN; } // for sscs map<string, long> consensusSeq(const BamRecordVector &wcBrV, const vector< mCvD > &wcHetPos, const Option &opt ) { map<string, long> mSeqN; if ( wcHetPos.empty() ) return mSeqN; mStrUlong mSeqN_wc; string seq(""); // count N size_t Ncnt(0); for ( auto & p : wcHetPos ) { if ( p.empty() ) Ncnt++; } if ( Ncnt > wcHetPos.size() * opt.Ncutoff ) return mSeqN; // get potential seq based on original read and heterozygous site for ( auto &br : wcBrV ) { if ( !br.ReverseFlag() ) { // + strand seq = br.Sequence(); } else { // - strand seq += br.Sequence(); mSeqN_wc[ ignoreError(seq, wcHetPos) ]++; } } for ( mStrUlong::iterator it = mSeqN_wc.begin(); it != mSeqN_wc.end(); it++ ) { if ( it->second >= opt.minSupOnHaplotype ) { size_t len = it->first.size() / 2; if ( countN( it->first.substr(0,len) ) > opt.Ncutoff * len && countN( it->first.substr(len,len) ) > opt.Ncutoff * len ) continue; mSeqN[ it->first ] = it->second; } } return mSeqN; } string ignoreError(const string &s, const vector< mCvD > &v) { string seq(""); for ( size_t i(0); i != s.size(); i++ ) { if ( v[i].empty() ) { seq += "N"; } else if ( v[i].size() == 1 ) { seq += v[i].begin()->first; } else { mCvD::const_iterator it = v[i].find( s[i] ); if ( it != v[i].end() ) { seq += s[i]; } else { seq += "N"; } } } return seq; } string ignoreError2(const string &s, const vector< mCvD > &v) { string seq(""); for ( size_t i(0); i != s.size(); i++ ) { if ( v[i].empty() ) { seq += "N"; } else if ( v[i].size() == 1 ) { seq += v[i].begin()->first; } else { seq += "N"; } } return seq; } string adjust_p(const string &qs, const Option &opt) { ostringstream o; map<double, vector<char> > m; vector<double> v = quaToErrorRate(qs, opt); if ( v.size() > 1 ) { sort( v.begin(), v.end() ); ulong total( v.size() ); for ( size_t i(0); i != total; i++ ) { m[ v[i] ].push_back( errorRateToChar(v[i], opt) ); } for ( auto & q : qs) { double e = errorRate(q, opt); o << m[ e ].back(); m[ e ].pop_back(); } return o.str(); } else { return qs; } } void trimEnd(SeqLib::BamRecord &br, const Option &opt) { CigarField sc('S', opt.softEndTrim ); Cigar cg = br.GetCigar(); if ( cg.size() == 0 ) { return; } size_t head(0), tail(0); string ty("=XMIS"); //trim head Cigar nc; //cerr << "old: " << cg << ' ' << br.Position() << ' '; for (size_t i(0); i != cg.size(); i++ ) { if ( ty.find( cg[i].Type() ) != string::npos ) { head += cg[i].Length(); } if ( head >= opt.softEndTrim ) { nc.add(sc); size_t remain = head - opt.softEndTrim; if ( remain > 0 ) { CigarField tmp(cg[i].Type(), remain); nc.add(tmp); for (size_t j(i+1); j != cg.size(); j++) nc.add(cg[j]); } else { for (size_t j(i+1); j != cg.size(); j++) nc.add(cg[j]); } break; } } //trim tail Cigar rc; for ( int i( nc.size()-1 ); i >= 0; i-- ) { if ( ty.find( nc[i].Type() ) != string::npos ) { tail += nc[i].Length(); } if ( tail >= opt.softEndTrim ) { rc.add(sc); int remain = tail - opt.softEndTrim; if ( remain > 0 ) { CigarField tmp(nc[i].Type(), remain); rc.add(tmp); for (int j(i-1); j >= 0; j--) rc.add(nc[j]); } else { for (int j(i-1); j >= 0; j--) rc.add(nc[j]); } break; } } //cerr << " new: " << rc << ' ' << br.Position() << ' '; // deal with I D M near head & tail vector<CigarField> vrc; if ( rc[1].Type() == 'I' || rc[1].Type() == 'S' ) { // combine I & S CigarField tf('S', rc[0].Length() + rc[1].Length() ); vrc.push_back(tf); for ( size_t i(2); i < rc.size(); i++ ) vrc.push_back( rc[i] ); } else if ( rc[1].Type() == 'D' || rc[2].Type() == 'N' ) { // skip D vrc.push_back( rc[0] ); for ( size_t i(2); i < rc.size(); i++ ) vrc.push_back( rc[i] ); } else { for ( auto &p : rc ) vrc.push_back(p); } reverse( vrc.begin(), vrc.end() ); // reverse vrc vector<CigarField> rv; if ( vrc[1].Type() == 'I' || rc[1].Type() == 'S' ) { // combine I & S CigarField tf('S', vrc[0].Length() + vrc[1].Length() ); rv.push_back(tf); for ( size_t i(2); i < vrc.size(); i++ ) rv.push_back( vrc[i] ); } else if ( vrc[1].Type() == 'D' || vrc[2].Type() == 'N' ) { // skip D rv.push_back( vrc[0] ); for ( size_t i(2); i < vrc.size(); i++ ) rv.push_back( vrc[i] ); } else { for ( auto &p : vrc ) rv.push_back(p); } // reverse Cigar rev; for ( auto & p : rv ) { rev.add( p ); } // set new start position of reads size_t rev_S_length = ( rev[0].Type() == 'S' ? rev[0].Length() : 0 ); br.SetPosition( getGenomePosition(br.Position(), rev_S_length, cg) ); //cerr << " final: " << rev << ' ' << br.Position() << endl; br.SetCigar( rev ); } size_t getGenomePosition(size_t pos, ulong i, const Cigar &cg) { for ( vector<CigarField>::const_iterator it = cg.begin(); it != cg.end(); it++ ) { char t = it->Type(); size_t n = it->Length(); switch (t) { case '=': case 'X': case 'M': if (i < n) return (pos+i); else (pos+=n, i-=n); break; case 'I': if (i < n) return pos; else (i -= n); break; case 'S': if (i < n) return -1; else i -= n; break; case 'N': case 'D': pos += n; break; case 'H': case 'P': break; default: cerr << "unknown cigar field: " << cg << endl, exit(1); } } return pos + i; } #include <boost/math/distributions/chi_squared.hpp> // needed by alglib #include "stdafx.h" #include <stdlib.h> #include <stdio.h> #include <math.h> #include "optimization.h" #include "ap.h" struct fn_data { std::string base; std::vector<double> errRateV; }; // composite log likelihood: l_c(theta) // mat theta is a column vector which has 4 elements for A, C, G, T, respectively. // double composite_LogLikelihood ( const string &base, const vector<double> &errRateV, const alglib::real_1d_array &theta ) { double l_c(0.0); for (size_t i(0); i != base.size(); i++ ) { const double &e = errRateV[i]/3; switch( base[i] ) { case 'A': l_c += log( (1-4*e) * theta[0] + e ); break; case 'C': l_c += log( (1-4*e) * theta[1] + e ); break; case 'G': l_c += log( (1-4*e) * theta[2] + e ); break; case 'T': l_c += log( (1-4*e) * theta[3] + e ); break; default: cerr << "unknown base in " << base << endl,exit(1); } } return l_c; } // -composite score function: -U_c(theta) // return a column vector // alglib::real_1d_array composite_score ( const string &base, const vector<double> &errRateV, const alglib::real_1d_array &theta ) { alglib::real_1d_array U_c = "[0,0,0,0]"; for (size_t i(0); i != base.size(); i++ ) { const double &e = errRateV[i]/3; switch( base[i] ) { case 'A': U_c[0] -= (1-4*e) / ( (1-4*e)*theta[0] + e ); break; case 'C': U_c[1] -= (1-4*e) / ( (1-4*e)*theta[1] + e ); break; case 'G': U_c[2] -= (1-4*e) / ( (1-4*e)*theta[2] + e ); break; case 'T': U_c[3] -= (1-4*e) / ( (1-4*e)*theta[3] + e ); break; default: cerr << "unknown base in " << base << endl, exit(1); } } return U_c; } // gradient optimization void function1_grad ( const alglib::real_1d_array &x, double &func, alglib::real_1d_array &grad, void *opt_data ) { fn_data* objfn_data = reinterpret_cast<fn_data*>(opt_data); const std::string &base = objfn_data->base; const std::vector<double> &errRateV = objfn_data->errRateV; func = -composite_LogLikelihood( base, errRateV, x); grad = composite_score( base, errRateV, x ); } string initAlleleFreq ( mCharUlong &fr, const double &depth, const char &except_b ) { ostringstream s; s << '['; if ( depth == fr[except_b] ) { for ( auto b : "ACGT" ) { b == except_b ? s << 0.0 : s << 0.333333333; b == 'T' ? s << ']' : s << ','; if ( b == 'T' ) break; } } else { for ( auto b : "ACGT" ) { b == except_b ? s << 0.0 : s << fr[b] / (depth - fr[except_b]); b == 'T' ? s << ']' : s << ','; if ( b== 'T' ) break; } } return s.str(); } string initAlleleFreq ( mCharUlong &fr, double depth, const set<char> &except_bs ) { ostringstream s; for ( auto b : "ACGT" ) { set<char>::const_iterator it = except_bs.find(b); if ( it != except_bs.end() ) { fr[b] = 0; depth -= fr[b]; } if ( b== 'T' ) break; } if ( depth == 0 ) { s << "[0.25,0.25,0.25,0.25]"; return s.str(); } s << '['; for ( auto b : "ACGT" ) { set<char>::const_iterator it = except_bs.find(b); it != except_bs.end() ? s << 0.0 : s << fr[b] / depth; // depth here don't contain num of except_bs b == 'T' ? s << ']' : s << ','; if ( b== 'T' ) break; } return s.str(); } string _upBoundary(const char except_b) { ostringstream s; s << '['; for ( auto b : "ACGT" ) { b == except_b ? s << 0 : s << 1; b == 'T' ? s << ']' : s << ','; if ( b == 'T' ) break; } return s.str(); } string _upBoundary(const set<char> except_bs) { ostringstream s; s << '['; for ( auto b : "ACGT" ) { set<char>::const_iterator it = except_bs.find(b); it != except_bs.end() ? s << 0 : s << 1; b == 'T' ? s << ']' : s << ','; if ( b == 'T' ) break; } return s.str(); } map<char, vector<double> > llh_genotype(const string &s, const string &q, const Option &opt) { map<char, vector<double> > ntPF; // nt => pvalue, fraction boost::math::chi_squared X2_dist(1); mCharUlong fr; for ( auto b : "ACGTN" ) { fr[b] = 0; if ( b == 'N' ) break; } string new_s(""), new_q(""); for ( size_t i(0); i != s.size(); i++ ) { if ( lowQuality(q[i], opt) || s[i] == 'N' || s[i] == '*' ) continue; // fr['N'] == 0 fr[ s[i] ]++; new_s += s[i]; new_q += q[i]; } double depth(new_s.size()); vector<double> errV = quaToErrorRate(new_q, opt); if ( depth == 0 ) return ntPF; // quick return if equal or less then one allele if ( fr.empty() ) { return ntPF; } // sort by frequent vector<pair<char, ulong> > ntV( fr.begin(), fr.end() ); // only one allele if ( ntV.size() == 1 ) { if ( ntV[0].second >= opt.minSupOnEachStrand ) { ntPF[ ntV[0].first ].push_back(0.0); ntPF[ ntV[0].first ].push_back(1.0); } return ntPF; } if ( ntV.size() > 1 ) sort( ntV.begin(), ntV.end(), _cmpBySecond ); // descending sort // delete pair<allele, supportNum> which has too few support reads or too small fraction while ( ntV.size() ) { if ( ntV.back().second < opt.minSupOnEachStrand || ntV.back().second / depth < opt.minFractionInFam ) ntV.pop_back(); else break; } // none allele remain if ( ntV.empty() ) { return ntPF; } // only one allele if ( ntV.size() == 1 ) { if ( ntV[0].second >= opt.minSupOnEachStrand ) { ntPF[ ntV[0].first ].push_back(0.0); ntPF[ ntV[0].first ].push_back(1.0); } return ntPF; } // more than one allele fn_data data; data.base = new_s; data.errRateV = errV; // var for alglib alglib::minbleicstate state; alglib::minbleicreport rep; double epsg(0.0001); double epsf(0.0); double epsx(0.0); alglib::ae_int_t maxits(0); // constraint: sum of frequency of 4 alleles == 1 alglib::real_2d_array c = "[[1,1,1,1,1]]"; alglib::integer_1d_array ct = "[0]"; alglib::real_1d_array bndl = "[0,0,0,0]"; // four allele maximize double cl_4(0.0); try { string AFstr = initAlleleFreq(fr, depth, 'N'); alglib::real_1d_array alg_x = AFstr.c_str(); alglib::real_1d_array bndu = "[1,1,1,1]"; alglib::minbleiccreate(alg_x, state); alglib::minbleicsetlc(state, c, ct); alglib::minbleicsetbc(state, bndl, bndu); alglib::minbleicsetcond(state, epsg, epsf, epsx, maxits); alglib::minbleicoptimize(state, function1_grad, NULL, &data ); alglib::minbleicresults(state, alg_x, rep); if ( opt.debug ) { printf("%d\n", int(rep.terminationtype)); // EXPECTED: 4 printf("%s\n", alg_x.tostring(20).c_str()); } cl_4 = composite_LogLikelihood( data.base, data.errRateV, alg_x ); if ( opt.debug ) cout << "cl_4: " << setprecision(20) << cl_4 << endl; } catch ( alglib::ap_error &e ) { cerr << "catch error: " << e.msg << " at seq[" << new_s << "] qua[" << new_q << "]" << endl; } map<char, string> init_V; map<char, string> bndu_V; for ( auto b : "ACGT" ) { init_V[b] = initAlleleFreq(fr, depth, b); bndu_V[b] = _upBoundary(b); if ( b == 'T' ) break; } for ( mCharUlong::const_iterator it = fr.begin(); it != fr.end(); it++ ) { if ( it->second < opt.minSupOnEachStrand || it->second/depth < opt.minFractionInFam ) continue; double cl_3(0.0); try { alglib::real_1d_array alg_x = init_V[ it->first ].c_str(); alglib::real_1d_array bndu = bndu_V[ it->first ].c_str(); alglib::minbleiccreate(alg_x, state); alglib::minbleicsetlc(state, c, ct); alglib::minbleicsetbc(state, bndl, bndu); alglib::minbleicsetcond(state, epsg, epsf, epsx, maxits); alglib::minbleicoptimize(state, function1_grad, NULL, &data ); alglib::minbleicresults(state, alg_x, rep); if ( opt.debug ) { printf("%d\n", int(rep.terminationtype)); // EXPECTED: 4 printf("%s\n", alg_x.tostring(20).c_str()); } cl_3 = composite_LogLikelihood( data.base, data.errRateV, alg_x ); if ( opt.debug ) cout << "cl_3: " << cl_3 << endl; } catch ( alglib::ap_error &e ) { cerr << "catch error: " << e.msg << " at seq[" << new_s << "] qua[" << new_q << "] for base[" << it->first << "]" << endl; } if ( cl_4 - cl_3 > opt.lhrGapCutoff ) ntPF[ it->first ].push_back( 1 - boost::math::cdf(X2_dist, 2*(cl_4 - cl_3)) ); } if ( ntPF.size() == 1 ) { ntPF[ ntPF.begin()->first ].push_back(1.0); return ntPF; } else if ( ntPF.size() > 1 ) { set<char> except_bs; for ( auto b : "ACGT" ) { map<char, vector<double> >::const_iterator it = ntPF.find(b); if ( it == ntPF.end() ) { // not in ntPF except_bs.insert(b); } if ( b == 'T' ) break; } string AFstr = initAlleleFreq(fr, depth, except_bs); alglib::real_1d_array alg_x = AFstr.c_str(); /* try { string upBnd = _upBoundary(except_bs); alglib::real_1d_array bndu = upBnd.c_str(); alglib::minbleiccreate(alg_x, state); alglib::minbleicsetlc(state, c, ct); alglib::minbleicsetbc(state, bndl, bndu); alglib::minbleicsetcond(state, epsg, epsf, epsx, maxits); alglib::minbleicoptimize(state, function1_grad, NULL, &data ); alglib::minbleicresults(state, alg_x, rep); if ( opt.debug ) { printf("%d\n", int(rep.terminationtype)); // EXPECTED: 4 printf("%s\n", alg_x.tostring(20).c_str()); } cl_4 = composite_LogLikelihood( data.base, data.errRateV, alg_x ); if ( opt.debug ) cout << "cl_4: " << setprecision(20) << cl_4 << endl; } catch ( alglib::ap_error &e ) { cerr << "catch error: " << e.msg << " at seq[" << new_s << "] qua[" << new_q << "]" << endl; } */ string st = "ACGT"; map<char, double> mBaseFrac; for ( int i(0); i != 4; i++ ) { mBaseFrac[ st[i] ] = alg_x[i]; } for ( auto &p : ntPF ) { ntPF[ p.first ].push_back( mBaseFrac[p.first] ); } return ntPF; } else if ( ntPF.size() > 4 ) { cerr << "ntPF contain unknown base" << endl, exit(1); } else { return ntPF; } } #endif // MAIN_H_
28.319101
146
0.509707
[ "vector" ]
d5d8f531d4f01633ec43b80f23694cffaa228e7c
3,137
h
C
yabause/src/sh2int.h
ircluzar/BizhawkLegacy-Vanguard
cd8b6dfe881f3c9d322b73c29f0d71df2ce3178e
[ "MIT" ]
null
null
null
yabause/src/sh2int.h
ircluzar/BizhawkLegacy-Vanguard
cd8b6dfe881f3c9d322b73c29f0d71df2ce3178e
[ "MIT" ]
null
null
null
yabause/src/sh2int.h
ircluzar/BizhawkLegacy-Vanguard
cd8b6dfe881f3c9d322b73c29f0d71df2ce3178e
[ "MIT" ]
null
null
null
/* Copyright 2003-2005 Guillaume Duhamel Copyright 2004-2005 Theo Berkau This file is part of Yabause. Yabause 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. Yabause 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 Yabause; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef SH2INT_H #define SH2INT_H #define SH2CORE_INTERPRETER 0 #define SH2CORE_DEBUGINTERPRETER 1 #define INSTRUCTION_A(x) ((x & 0xF000) >> 12) #define INSTRUCTION_B(x) ((x & 0x0F00) >> 8) #define INSTRUCTION_C(x) ((x & 0x00F0) >> 4) #define INSTRUCTION_D(x) (x & 0x000F) #define INSTRUCTION_CD(x) (x & 0x00FF) #define INSTRUCTION_BCD(x) (x & 0x0FFF) int SH2InterpreterInit(void); int SH2DebugInterpreterInit(void); void SH2InterpreterDeInit(void); void SH2InterpreterReset(SH2_struct *context); void FASTCALL SH2InterpreterExec(SH2_struct *context, u32 cycles); void FASTCALL SH2DebugInterpreterExec(SH2_struct *context, u32 cycles); void SH2InterpreterGetRegisters(SH2_struct *context, sh2regs_struct *regs); u32 SH2InterpreterGetGPR(SH2_struct *context, int num); u32 SH2InterpreterGetSR(SH2_struct *context); u32 SH2InterpreterGetGBR(SH2_struct *context); u32 SH2InterpreterGetVBR(SH2_struct *context); u32 SH2InterpreterGetMACH(SH2_struct *context); u32 SH2InterpreterGetMACL(SH2_struct *context); u32 SH2InterpreterGetPR(SH2_struct *context); u32 SH2InterpreterGetPC(SH2_struct *context); void SH2InterpreterSetRegisters(SH2_struct *context, const sh2regs_struct *regs); void SH2InterpreterSetGPR(SH2_struct *context, int num, u32 value); void SH2InterpreterSetSR(SH2_struct *context, u32 value); void SH2InterpreterSetGBR(SH2_struct *context, u32 value); void SH2InterpreterSetVBR(SH2_struct *context, u32 value); void SH2InterpreterSetMACH(SH2_struct *context, u32 value); void SH2InterpreterSetMACL(SH2_struct *context, u32 value); void SH2InterpreterSetPR(SH2_struct *context, u32 value); void SH2InterpreterSetPC(SH2_struct *context, u32 value); void SH2InterpreterSendInterrupt(SH2_struct *context, u8 level, u8 vector); int SH2InterpreterGetInterrupts(SH2_struct *context, interrupt_struct interrupts[MAX_INTERRUPTS]); void SH2InterpreterSetInterrupts(SH2_struct *context, int num_interrupts, const interrupt_struct interrupts[MAX_INTERRUPTS]); extern SH2Interface_struct SH2Interpreter; extern SH2Interface_struct SH2DebugInterpreter; typedef u32 (FASTCALL *fetchfunc)(u32); extern fetchfunc fetchlist[0x100]; typedef void (FASTCALL *opcodefunc)(SH2_struct *); extern opcodefunc opcodes[0x10000]; #endif
42.391892
84
0.778132
[ "vector" ]
d5ea85ab00902441d14f621680a9b2dfbb4400f6
116,211
c
C
vtkVmtk/Utilities/Stellar_1.0/src/insertion.c
michelebucelli/vmtk
738bd1d152e8836847ab4d75f7e8360bd574e724
[ "Apache-2.0" ]
217
2015-01-05T19:08:30.000Z
2022-03-31T12:14:59.000Z
vtkVmtk/Utilities/Stellar_1.0/src/insertion.c
mrp089/vmtk
64675f598e31bc6be3d4fba903fb59bf1394f492
[ "Apache-2.0" ]
226
2015-03-31T07:16:06.000Z
2022-03-01T14:59:30.000Z
vtkVmtk/Utilities/Stellar_1.0/src/insertion.c
mrp089/vmtk
64675f598e31bc6be3d4fba903fb59bf1394f492
[ "Apache-2.0" ]
132
2015-02-16T11:38:34.000Z
2022-03-18T04:38:45.000Z
/*****************************************************************************/ /* */ /* Vertex insertion routines */ /* */ /*****************************************************************************/ /* check an array of tets to see if it contains the query tet */ bool tetinlist(tag v1, tag v2, tag v3, tag v4, tag list[][4], int listsize) { int i; for (i=0; i<listsize; i++) { if (sametet(v1, v2, v3, v4, list[i][0], list[i][1], list[i][2], list[i][3])) { return true; } } return false; } /* check an array of faces to see if it contains the query face */ bool faceinlist(tag v1, tag v2, tag v3, tag list[][3], int listsize) { int i; for (i=0; i<listsize; i++) { if (sameface(v1, v2, v3, list[i][0], list[i][1], list[i][2])) { return true; } } return false; } /* removed the specified face from a face list */ void deletelistface(tag v1, tag v2, tag v3, tag list[][3], int *listsize) { int i,j; bool found = false; /* find face in the list */ for (i=0; i<*listsize; i++) { if (sameface(v1, v2, v3, list[i][0], list[i][1], list[i][2])) { found = true; break; } } assert(found); /* slide all the rest of the faces back */ for (j=i; i<*listsize-1; i++) { list[i][0] = list[i+1][0]; list[i][1] = list[i+1][1]; list[i][2] = list[i+1][2]; } /* decrement the list size */ (*listsize)--; } /* removed the specified tet from a tet list */ void deletelisttet(tag v1, tag v2, tag v3, tag v4, tag list[][4], int *listsize) { int i,j; bool found = false; /* find face in the list */ for (i=0; i<*listsize; i++) { if (sametet(v1, v2, v3, v4, list[i][0], list[i][1], list[i][2], list[i][3])) { found = true; break; } } assert(found); /* slide all the rest of the faces back */ for (j=i; i<*listsize-1; i++) { list[i][0] = list[i+1][0]; list[i][1] = list[i+1][1]; list[i][2] = list[i+1][2]; list[i][3] = list[i+1][3]; } /* decrement the list size */ (*listsize)--; } /* add the specified tet to a list */ void addlisttet(tag v1, tag v2, tag v3, tag v4, tag list[][4], int *listsize) { /* check that we're not adding a duplicate */ assert(tetinlist(v1, v2, v3, v4, list, *listsize) == false); list[*listsize][0] = v1; list[*listsize][1] = v2; list[*listsize][2] = v3; list[*listsize][3] = v4; (*listsize)++; } /* add the specified face to a list */ void addlistface(tag v1, tag v2, tag v3, tag list[][3], int *listsize) { list[*listsize][0] = v1; list[*listsize][1] = v2; list[*listsize][2] = v3; (*listsize)++; } #define NOCAVITYTET -1 #define NOCAVITYFACE -1 struct cavityface { tag verts[3]; starreal qual; int child; bool inH; }; struct cavityedge { starreal qual; int parent; int child; int childnum; }; #define EDGELABEL 0 #define TETLABEL 1 struct cavityedgeortet { starreal qual; int label; int parent; int child; int childnum; }; struct cavitytet { tag verts[4]; starreal qual; int numoutfaces; int depth; struct cavityface outfaces[MAXOUTFACES]; int parents[3]; int label; }; void printcavitytet(struct cavitytet *tet) { int i; printf(" Cavity tet with verts (%d %d %d %d)\n", (int) tet->verts[0], (int) tet->verts[1], (int) tet->verts[2], (int) tet->verts[3]); printf(" Label: %d\n", tet->label); printf(" Quality: %g\n", pq(tet->qual)); printf(" Depth: %d\n", tet->depth); printf(" Parents are %d, %d, and %d\n", tet->parents[0], tet->parents[1], tet->parents[2]); printf(" Has %d outgoing faces:\n", tet->numoutfaces); for(i=0; i<tet->numoutfaces; i++) { printf(" Face %d (%d %d %d) has quality %g and child %d\n", i, (int) tet->outfaces[i].verts[0], (int) tet->outfaces[i].verts[1], (int) tet->outfaces[i].verts[2], pq(tet->outfaces[i].qual), tet->outfaces[i].child); } } void printcavitydag(struct tetcomplex *mesh, struct cavitytet cavity[], int cavitysize) { int i; for (i=0; i<cavitysize; i++) { printf("Tet %d/%d:\n", i, cavitysize-1); printcavitytet(&cavity[i]); } /*printf("{"); for (i=0; i<cavitysize; i++) { printtetverts(mesh, cavity[i].verts); printf(";\n"); } printf("};\n");*/ } /* check an array of tets to see if it contains the query tet. if so, return its location. if not, return NOCAVITYTET */ int cavitytetinlist(tag v1, tag v2, tag v3, tag v4, struct cavitytet list[], int listsize) { int i; for (i=0; i<listsize; i++) { if (sametet(v1, v2, v3, v4, list[i].verts[0], list[i].verts[1], list[i].verts[2], list[i].verts[3])) { return i; } } return NOCAVITYTET; } /* check a tet to see if it contains the query face. if so, return its location. if not, return NOCAVITYFACE */ int cavityfaceintet(tag v1, tag v2, tag v3, struct cavitytet *tet) { int i; int numfaces = tet->numoutfaces; for (i=0; i<numfaces; i++) { if (sameface(v1, v2, v3, tet->outfaces[i].verts[0], tet->outfaces[i].verts[1], tet->outfaces[i].verts[2])) { return i; } } return NOCAVITYFACE; } /* add a tet to the cavity */ void addcavitytet(struct cavitytet *tet, struct cavitytet list[], int *listsize) { /* copy the tet into the list */ memcpy(&list[*listsize], tet, sizeof(struct cavitytet)); /* increment list size */ (*listsize)++; } /* return the number of parents a tet has */ int numparents(struct cavitytet *tet) { int numparents = 0; if (tet->parents[0] != NOCAVITYTET) numparents++; if (tet->parents[1] != NOCAVITYTET) numparents++; if (tet->parents[2] != NOCAVITYTET) numparents++; return numparents; } /* add an outgoing face to a cavity tet */ void addcavitytetface(struct cavitytet *tet, struct cavityface *face) { int whichface, parentcount = 0; /* check if this face already exists (i.e., we're updating it) */ whichface = cavityfaceintet(face->verts[0], face->verts[1], face->verts[2], tet); /* we can't add a new face if there are already 3 */ if (whichface == NOCAVITYFACE) { /* make sure that the sum of the parents and outbound faces is 4 */ parentcount = numparents(tet); /* allow more than 3 outfaces for parentless tets */ if (parentcount != 0) { if (parentcount + tet->numoutfaces > 3) { printf("adding face (%d %d %d) with child %d would cause in+out to exceed 4.\n", (int) face->verts[0], (int) face->verts[1], (int) face->verts[2], face->child); printcavitytet(tet); } assert(parentcount + tet->numoutfaces < 4); } whichface = tet->numoutfaces; (tet->numoutfaces)++; } assert(tet->numoutfaces <= MAXOUTFACES); /* copy in the face */ memcpy(&tet->outfaces[whichface], face, sizeof(struct cavityface)); } /* return the number of faces of the tet t that are positively oriented with respect to the vertex v */ int numpositivefaces(struct tetcomplex * mesh, tag t[4], starreal *v) { starreal *c[4]; int numpositive = 0; /* fetch coordinates of tet vertices */ c[0] = ((struct vertex *) tetcomplextag2vertex(mesh, t[0]))->coord; c[1] = ((struct vertex *) tetcomplextag2vertex(mesh, t[1]))->coord; c[2] = ((struct vertex *) tetcomplextag2vertex(mesh, t[2]))->coord; c[3] = ((struct vertex *) tetcomplextag2vertex(mesh, t[3]))->coord; /* test each faces orientation */ /* faces are: (1, 2, 3), (0, 3, 2), (0, 1, 3), (0, 2, 1) */ if (orient3d(&behave, v, c[1], c[2], c[3]) > MINFACING) numpositive++; if (orient3d(&behave, v, c[0], c[3], c[2]) > MINFACING) numpositive++; if (orient3d(&behave, v, c[0], c[1], c[3]) > MINFACING) numpositive++; if (orient3d(&behave, v, c[0], c[2], c[1]) > MINFACING) numpositive++; /* we can have at most 3 positively oriented faces */ assert(numpositive < 4); if (improvebehave.verbosity > 5) { printf("Tet checked has %d faces oriented toward v\n", numpositive); } return numpositive; } /* check the DAG to make sure it's constructed correctly */ bool cavitydagcheck(struct tetcomplex *mesh, struct cavitytet cavity[], int cavitysize) { int i,j,k, parentcount, child; tag othervert; for (i=0; i<cavitysize; i++) { if (improvebehave.verbosity > 5) { printf("checking out tet %d\n", i); printcavitytet(&cavity[i]); } assert(tetexists(mesh, cavity[i].verts[0], cavity[i].verts[1], cavity[i].verts[2], cavity[i].verts[3])); parentcount = numparents(&cavity[i]); /* let "no parent" tets get by */ if (parentcount == 0) { continue; } /* check that numparents + numoutfaces = 4 (i.e., all faces of tet are accounted for) */ assert(parentcount > 0); assert(parentcount + cavity[i].numoutfaces == 4); for (j=0; j<cavity[i].numoutfaces; j++) { /* check that the face has a non-negative quality */ assert(cavity[i].outfaces[j].qual >= 0); /* find the vertex not in this face */ othervert = GHOSTVERTEX; for (k=0; k<4; k++) { if ((cavity[i].verts[k] != cavity[i].outfaces[j].verts[0]) && (cavity[i].verts[k] != cavity[i].outfaces[j].verts[1]) && (cavity[i].verts[k] != cavity[i].outfaces[j].verts[2])) { othervert = cavity[i].verts[k]; } } assert(othervert != GHOSTVERTEX); /* check that the face is oriented outward */ assert(tetexists(mesh, othervert, cavity[i].outfaces[j].verts[2], cavity[i].outfaces[j].verts[1], cavity[i].outfaces[j].verts[0])); /* check that each child of this tet has this tet for a parent */ child = cavity[i].outfaces[j].child; if (child != NOCAVITYTET) { assert(cavity[child].parents[0] == i || cavity[child].parents[1] == i || cavity[child].parents[2] == i); } } } return true; } /* given a vertex, it's position, an initial cavitiy of tets and a set of outward-oriented faces of that cavity, build a DAG representing the largest star-shaped cavity from the point of view of the inserted vertex */ void buildcavitydag(struct tetcomplex *mesh, tag vtag, tag initialC[][4], int initialCsize, tag initialF[][3], int initialFsize, struct cavitytet outcavity[], int *cavitysize, bool allowvertexdeletion) { static tag F[MAXCAVITYFACES][3]; /* candidate face list */ static tag W[MAXCAVITYFACES][3]; /* wall face list */ static tag C[MAXCAVITYTETS][4]; /* cavity tet list */ static tag B[MAXCAVITYTETS][4]; /* blocking tet list */ int Fsize=0, Wsize=0, Csize=0, Bsize=0; tag t[4]; /* current tet */ tag f[3]; /* current face */ tag outin[2]; tag outin2[2]; starreal *c[4]; starreal *v; bool foundface; int Wcount = 0; bool facing = true; int i,j; tag otherfaces[3][3] = {{2,1,0},{3,2,0},{0,1,3}}; int deepest = 0; int numnonwall = 0; tag nonwall[3]; int ii; int depthlimit = improvebehave.cavdepthlimit; /* output cavity stuff */ struct cavitytet cavtet; struct cavityface cavface; struct cavityface cavface2; int tetindex, parentindex; *cavitysize = 0; /* fetch position of new vertex */ v = ((struct vertex *) tetcomplextag2vertex(mesh, vtag))->coord; /* initialize cavity tet list */ for (i=0; i<initialCsize; i++) { addlisttet(initialC[i][0], initialC[i][1], initialC[i][2], initialC[i][3], C, &Csize); /* this tet is sure to be in the final cavity, add it */ cavtet.verts[0] = initialC[i][0]; cavtet.verts[1] = initialC[i][1]; cavtet.verts[2] = initialC[i][2]; cavtet.verts[3] = initialC[i][3]; /* fake the qual because these tets were already split and made worse */ cavtet.qual = 1.0; cavtet.depth = 0; cavtet.parents[0] = NOCAVITYTET; cavtet.parents[1] = NOCAVITYTET; cavtet.parents[2] = NOCAVITYTET; cavtet.numoutfaces = 0; addcavitytet(&cavtet, outcavity, cavitysize); } /* initialize candidate face list */ for (i=0; i<initialFsize; i++) { addlistface(initialF[i][0], initialF[i][1], initialF[i][2], F, &Fsize); } /* now, as long as we have candidate faces */ while (Fsize > 0) { assert(*cavitysize <= MAXCAVITYTETS); assert(Fsize <= MAXCAVITYFACES); assert(Wsize <= MAXCAVITYFACES); assert(Csize <= MAXCAVITYTETS); assert(Bsize <= MAXCAVITYTETS); if (improvebehave.verbosity > 5) { printf("going through face list, size is %d\n", Fsize); printf("Csize = %d, Bsize = %d, Wsize = %d\n", Csize, Bsize, Wsize); } /* pull a face out of F */ f[0] = F[Fsize-1][0]; f[1] = F[Fsize-1][1]; f[2] = F[Fsize-1][2]; Fsize--; if (improvebehave.verbosity > 5) { printf("just pulled face (%d %d %d) out of F\n", (int) f[0], (int) f[1], (int) f[2]); printf("here's F (size = %d):\n", Fsize); for (ii=0; ii<Fsize; ii++) { printf("%d: %d %d %d\n", ii, (int) F[ii][0], (int) F[ii][1], (int) F[ii][2]); } } /* get t, the tet on the other side of this face */ foundface = tetcomplexadjacencies(mesh, f[0], f[1], f[2], outin); if (foundface == 0) { printf("couldn't find face (%d %d %d)", (int) f[0], (int) f[1], (int) f[2]); } assert(foundface); /* make sure the parent tet for this face is there */ assert(outin[1] != GHOSTVERTEX); /* the inward facing tet should already be in the output cavity. find it, and add this face as an outgoing face */ tetindex = cavitytetinlist(outin[1], f[2], f[1], f[0], outcavity, *cavitysize); assert(tetindex != NOCAVITYTET); /* compute the quality of the cavity tet with this face */ cavface.verts[0] = f[0]; cavface.verts[1] = f[1]; cavface.verts[2] = f[2]; cavface.qual = tetquality(mesh, vtag, f[2], f[1], f[0], improvebehave.qualmeasure); assert(cavface.qual > 0); /* check to make sure it's not a ghost vertex */ if (outin[0] == GHOSTVERTEX) { /* note that this face has no child, and assign it to its parent tet */ cavface.child = NOCAVITYTET; addcavitytetface(&outcavity[tetindex], &cavface); /* add this face to the wall list */ addlistface(f[0], f[1], f[2], W, &Wsize); continue; } t[0] = outin[0]; t[1] = f[0]; t[2] = f[1]; t[3] = f[2]; if (improvebehave.verbosity > 5) { printf("investigating tet (%d %d %d %d)\n", (int) t[0], (int) t[1], (int) t[2], (int) t[3]); } /* fetch positions of vertices */ c[0] = ((struct vertex *) tetcomplextag2vertex(mesh, t[0]))->coord; c[1] = ((struct vertex *) tetcomplextag2vertex(mesh, t[1]))->coord; c[2] = ((struct vertex *) tetcomplextag2vertex(mesh, t[2]))->coord; c[3] = ((struct vertex *) tetcomplextag2vertex(mesh, t[3]))->coord; /* is t a cavity tet? */ if (tetinlist(t[0], t[1], t[2], t[3], C, Csize)) { if (improvebehave.verbosity > 4) { printf("it's already a cavity tet. can this happen?\n"); } starexit(1); /* we need to add this face to the parent tet, indicating that it has no child because the tet on the other side doesn't depend in it's removal to exist */ cavface.child = NOCAVITYTET; addcavitytetface(&outcavity[tetindex], &cavface); /* yes, do nothing */ continue; } /* is t a blocking tet? */ if (tetinlist(t[0], t[1], t[2], t[3], B, Bsize)) { if (improvebehave.verbosity > 5) { printf("it's a blocking tet.\n"); } /* if there is one other wall face of this tet, and the other two faces are visible from v, we can add this tet to the cavity. */ Wcount = 1; facing = true; for (i=0; i<3; i++) { /* is this face already marked as a wall ? */ if (faceinlist(t[otherfaces[i][0]], t[otherfaces[i][1]], t[otherfaces[i][2]], W, Wsize)) { Wcount++; } else /* it's not a wall... is it oriented toward v? */ { if (orient3d(&behave, v, c[otherfaces[i][0]], c[otherfaces[i][1]], c[otherfaces[i][2]]) <= MINFACING) { facing = false; } } } if (improvebehave.verbosity > 5) { printf("*** facing = %d, wcount = %d\n", facing, Wcount); } /* only allow tets with three parents if we are allowing vertex deletion */ if ((Wcount == 2 || (Wcount == 3 && allowvertexdeletion)) && facing) { if (Wcount == 2) { if (improvebehave.verbosity > 5) { printf("found a 2-wall face tet to add!\n"); } } else { if (improvebehave.verbosity > 5) { printf("found a 3-wall face tet to add!\n"); } } /* this tet can be added to the cavity */ /* remove it from B */ deletelisttet(t[0], t[1], t[2], t[3], B, &Bsize); /* add it to C */ assert(tetexists(mesh, t[0], t[1], t[2], t[3])); addlisttet(t[0], t[1], t[2], t[3], C, &Csize); /* add this tet to the output cavity */ cavtet.verts[0] = t[0]; cavtet.verts[1] = t[1]; cavtet.verts[2] = t[2]; cavtet.verts[3] = t[3]; /* compute it's original quality */ cavtet.qual = tetquality(mesh, t[0], t[1], t[2], t[3], improvebehave.qualmeasure); assert(cavtet.qual > 0); /* we know one parent must be the one we found above */ cavtet.parents[0] = tetindex; /* the depth is one more than the parent depth */ cavtet.depth = outcavity[tetindex].depth + 1; /* if this is a new deepest, remember it */ if (cavtet.depth > deepest) deepest = cavtet.depth; addcavitytet(&cavtet, outcavity, cavitysize); /* add this face to the parent tet with the correct child */ cavface.child = *cavitysize - 1; addcavitytetface(&outcavity[tetindex], &cavface); /* remove any faces that were in W, add others to F. Handle output tet faces that need to be added */ numnonwall = 0; /* first, handle all wall face so we can set the correct depth */ for (i=0; i<3; i++) { /* is this already a wall face? */ if (faceinlist(t[otherfaces[i][0]], t[otherfaces[i][1]], t[otherfaces[i][2]], W, Wsize)) { deletelistface(t[otherfaces[i][0]], t[otherfaces[i][1]], t[otherfaces[i][2]], W, &Wsize); /* because this face was previously a wall face, it has some cavity tet that it belongs to. find this tet in the output cavity and set it's child face */ foundface = tetcomplexadjacencies(mesh, t[otherfaces[i][0]], t[otherfaces[i][1]], t[otherfaces[i][2]], outin2); assert(foundface); assert(outin2[1] != GHOSTVERTEX); parentindex = cavitytetinlist(outin2[1], t[otherfaces[i][2]], t[otherfaces[i][1]], t[otherfaces[i][0]], outcavity, *cavitysize); assert(parentindex != NOCAVITYTET); /* add this face to the parent tet's outgoing faces */ cavface.verts[0] = t[otherfaces[i][0]]; cavface.verts[1] = t[otherfaces[i][1]]; cavface.verts[2] = t[otherfaces[i][2]]; cavface.qual = tetquality(mesh, vtag, t[otherfaces[i][2]], t[otherfaces[i][1]], t[otherfaces[i][0]], improvebehave.qualmeasure); assert(cavface.qual > 0); cavface.child = *cavitysize - 1; /* make sure that this face is already in this tet */ assert(cavityfaceintet(cavface.verts[0], cavface.verts[1], cavface.verts[2], &outcavity[parentindex]) != NOCAVITYFACE); addcavitytetface(&outcavity[parentindex], &cavface); /* assign the parent tet as the second parent of the new cavity tet */ if (outcavity[*cavitysize -1].parents[1] == NOCAVITYTET) { outcavity[*cavitysize - 1].parents[1] = parentindex; } else { assert(outcavity[*cavitysize -1].parents[2] == NOCAVITYTET); outcavity[*cavitysize - 1].parents[2] = parentindex; } /* if this parent has a lesser depth value, update new tet's depth to be the lesser */ if (outcavity[parentindex].depth < outcavity[*cavitysize - 1].depth) { if (improvebehave.verbosity > 5) { printf("changing depth from %d to %d, this parent is shallower\n", outcavity[*cavitysize - 1].depth, outcavity[parentindex].depth); } outcavity[*cavitysize - 1].depth = outcavity[parentindex].depth; } } else { /* record this non-wall face for potential addition to F later */ nonwall[numnonwall] = i; numnonwall++; } } for (i=0; i<numnonwall; i++) { j = nonwall[i]; /* this is a newly-uncovered face. there could be more tets behind it, so we should add it to F, if the current tet's depth isn't more than the max */ if (outcavity[*cavitysize -1].depth < depthlimit) { if (improvebehave.verbosity > 5) { printf("adding new face uncovered in 2-parent tet to F (%d %d %d)\n", (int) t[otherfaces[j][2]], (int) t[otherfaces[j][1]], (int) t[otherfaces[j][0]]); } addlistface(t[otherfaces[j][2]], t[otherfaces[j][1]], t[otherfaces[j][0]], F, &Fsize); } /* we should artificially make this a wall face so the cavity doesn't get deeper */ else { if (improvebehave.verbosity > 5) { printf("adding new face uncovered in 2-parent tet to W because of depth limit (%d %d %d)\n", (int) t[otherfaces[j][2]], (int) t[otherfaces[j][1]], (int) t[otherfaces[j][0]]); } /* construct output face */ cavface2.verts[0] = t[otherfaces[j][2]]; cavface2.verts[1] = t[otherfaces[j][1]]; cavface2.verts[2] = t[otherfaces[j][0]]; cavface2.qual = tetquality(mesh, vtag, cavface2.verts[2], cavface2.verts[1], cavface2.verts[0], improvebehave.qualmeasure); cavface2.child = NOCAVITYTET; assert(cavface2.qual > 0); /* add it to parent tet */ addcavitytetface(&outcavity[*cavitysize -1], &cavface2); addlistface(t[otherfaces[j][2]], t[otherfaces[j][1]], t[otherfaces[j][0]], W, &Wsize); } } if (improvebehave.verbosity > 5) { printf("just added this 2-wall-face cavity tet (tet %d):\n", *cavitysize - 1); printcavitytet(&outcavity[*cavitysize - 1]); } assert(outcavity[*cavitysize - 1].parents[0] != NOCAVITYTET); assert(outcavity[*cavitysize - 1].parents[1] != NOCAVITYTET); } else { if (improvebehave.verbosity > 5) { printf("found a blocking tet that didn't work out! facing = %d, wcount = %d\n", facing, Wcount); } /* note that this face has no child, and assign it to its parent tet */ cavface.child = NOCAVITYTET; addcavitytetface(&outcavity[tetindex], &cavface); /* add f to W, it borders a blocking tet */ addlistface(f[0], f[1], f[2], W, &Wsize); } continue; } if (improvebehave.verbosity > 5) { printf("it's not in B or C.\n"); } /* t is neither a blocking tet nor a cavity tet */ /* check to see if the three other faces of the tet are facing v */ if ((orient3d(&behave, v, c[2], c[1], c[0]) > MINFACING) && (orient3d(&behave, v, c[3], c[2], c[0]) > MINFACING) && (orient3d(&behave, v, c[0], c[1], c[3]) > MINFACING)) { if (improvebehave.verbosity > 5) { printf("Adding tet to cavity\n"); } /* yes! we can add this tet to the cavity */ assert(tetexists(mesh, t[0], t[1], t[2], t[3])); /* make sure this tet has more than one face oriented toward the new vertex */ assert(numpositivefaces(mesh, t, v) > 1); addlisttet(t[0], t[1], t[2], t[3], C, &Csize); /* add this tet to the output cavity */ cavtet.verts[0] = t[0]; cavtet.verts[1] = t[1]; cavtet.verts[2] = t[2]; cavtet.verts[3] = t[3]; /* compute it's original quality */ cavtet.qual = tetquality(mesh, t[0], t[1], t[2], t[3], improvebehave.qualmeasure); assert(cavtet.qual > 0); /* it's parent must be the parent above */ cavtet.parents[0] = tetindex; /* depth is one deeper than parent */ cavtet.depth = outcavity[tetindex].depth + 1; /* if this is a new deepest, note it */ if (cavtet.depth > deepest) deepest = cavtet.depth; addcavitytet(&cavtet, outcavity, cavitysize); /* note the current face's child in the parent tet */ cavface.child = *cavitysize - 1; addcavitytetface(&outcavity[tetindex], &cavface); /* add t's three (outward oriented) faces to F, if the current tet isn't too deep */ if (cavtet.depth < depthlimit) { addlistface(t[0], t[1], t[2], F, &Fsize); addlistface(t[0], t[2], t[3], F, &Fsize); addlistface(t[0], t[3], t[1], F, &Fsize); } else { if (improvebehave.verbosity > 5) { printf("not adding faces to F because max depth reached...\n"); } /* construct output face */ cavface2.child = NOCAVITYTET; cavface2.verts[0] = t[0]; cavface2.verts[1] = t[1]; cavface2.verts[2] = t[2]; cavface2.qual = tetquality(mesh, vtag, t[2], t[1], t[0], improvebehave.qualmeasure); assert(cavface2.qual > 0); /* add it to parent tet */ addcavitytetface(&outcavity[*cavitysize -1], &cavface2); cavface2.verts[0] = t[0]; cavface2.verts[1] = t[2]; cavface2.verts[2] = t[3]; cavface2.qual = tetquality(mesh, vtag, t[3], t[2], t[0], improvebehave.qualmeasure); assert(cavface2.qual > 0); /* add it to parent tet */ addcavitytetface(&outcavity[*cavitysize -1], &cavface2); cavface2.verts[0] = t[0]; cavface2.verts[1] = t[3]; cavface2.verts[2] = t[1]; cavface2.qual = tetquality(mesh, vtag, t[1], t[3], t[0], improvebehave.qualmeasure); assert(cavface2.qual > 0); /* add it to parent tet */ addcavitytetface(&outcavity[*cavitysize -1], &cavface2); addlistface(t[0], t[1], t[2], W, &Wsize); addlistface(t[0], t[2], t[3], W, &Wsize); addlistface(t[0], t[3], t[1], W, &Wsize); } } else { /* this is a blocking tet, add it to B */ addlisttet(t[0], t[1], t[2], t[3], B, &Bsize); /* note the current face in the parent tet */ cavface.child = NOCAVITYTET; addcavitytetface(&outcavity[tetindex], &cavface); /* add the current face to the wall face list */ addlistface(f[0], f[1], f[2], W, &Wsize); } } /* record the maximum depth */ stats.biggestcavdepths[deepest]++; if (improvebehave.verbosity > 5) { printf("here is the cavity:\n"); printtets(mesh, C, Csize); printf("here is W:\n"); printfaces(mesh, W, Wsize); } } /* debug routine to print out edge list */ void printedgelist(struct cavityedge edges[], int numedges) { int i; for (i=0; i<numedges; i++) { printf("Edge %d/%d:\n", i, numedges-1); printf(" Qual: %g\n", pq(edges[i].qual)); printf(" Parent: %d\n", edges[i].parent); printf(" Child: %d\n", edges[i].child); printf(" Childnum: %d\n", edges[i].childnum); } } /* debug routine to print out combined tet/edge list */ void printedgeortetlist(struct cavityedgeortet edges[], int numedges) { int i; for (i=0; i<numedges; i++) { printf("Edge %d/%d:\n", i, numedges-1); printf(" Label: %d\n", edges[i].label); printf(" Qual: %g\n", pq(edges[i].qual)); printf(" Parent: %d\n", edges[i].parent); printf(" Child: %d\n", edges[i].child); printf(" Childnum: %d\n", edges[i].childnum); } } /* compare two edges, to be used for standard qsort call */ int compareedges(const void * a, const void * b) { if ( ((struct cavityedge *)a)->qual > ((struct cavityedge *)b)->qual) return 1; if ( ((struct cavityedge *)a)->qual < ((struct cavityedge *)b)->qual) return -1; return 0; } /* compare two elements in a hybrid edge/tet list, for qsort */ int compareedgeortets(const void * a, const void * b) { if ( ((struct cavityedgeortet *)a)->qual > ((struct cavityedgeortet *)b)->qual) return 1; if ( ((struct cavityedgeortet *)a)->qual < ((struct cavityedgeortet *)b)->qual) return -1; return 0; } /* function to sort an array of edges */ void sortedges(struct cavityedge array[], int arraylength) { qsort(array, (size_t) arraylength, sizeof(struct cavityedge), compareedges); } /* function to sort an hybrid array of edges/tets */ void sortedgeortets(struct cavityedgeortet array[], int arraylength) { qsort(array, (size_t) arraylength, sizeof(struct cavityedgeortet), compareedgeortets); } #define CAVLABEL 0 #define ANTICAVLABEL 1 #define NOLABEL 2 /* table of factors by which to augment deeper tets TODO automatically select weights somehow */ #define DEPTHTABLESIZE 10 starreal depthtable[DEPTHTABLESIZE] = {1.0, 1.6, 2.3, 2.9, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3}; /* recursively label parents and children as cavity tets */ void cavitylabel(struct cavitytet cavity[], int cavitysize, int tetid) { int i; /* this tet shouldn't yet be labeled */ assert(cavity[tetid].label == NOLABEL); /* label this tet as in the cavity */ cavity[tetid].label = CAVLABEL; if (improvebehave.verbosity > 5) { printf(" In cavitylabel, just labeled tet %d\n", tetid); } /* go through all parents in the original graph */ for (i=0; i<3; i++) { if (cavity[tetid].parents[i] != NOCAVITYTET) { /* if this parent is unlabeled, label it */ if (cavity[cavity[tetid].parents[i]].label == NOLABEL) { if (improvebehave.verbosity > 5) { printf("parent %d = %d is unlabeled. calling cavity() on it\n", i, cavity[tetid].parents[i]); } cavitylabel(cavity, cavitysize, cavity[tetid].parents[i]); } } } /* go through all children in H */ for (i=0; i<cavity[tetid].numoutfaces; i++) { /* check if this edge is in H */ if (cavity[tetid].outfaces[i].inH == true) { /* this can't be an edge leading to t... we should never add those */ assert(cavity[tetid].outfaces[i].child != NOCAVITYTET); if (cavity[cavity[tetid].outfaces[i].child].label == NOLABEL) { if (improvebehave.verbosity > 5) { printf("edge to child %d/%d = %d is in H, and child is unlabeled. calling cavity() on it\n", i, cavity[tetid].numoutfaces-1, cavity[tetid].outfaces[i].child); } cavitylabel(cavity, cavitysize, cavity[tetid].outfaces[i].child); } } } } /* recursively label parents and children as anti-cavity tets */ void anticavitylabel(struct cavitytet cavity[], int cavitysize, int tetid) { int i,j,parent,edgetochild; /* this tet shouldn't yet be labeled */ assert(cavity[tetid].label == NOLABEL); /* label this tet as in the anticavity */ cavity[tetid].label = ANTICAVLABEL; if (improvebehave.verbosity > 5) { printf(" In anticavitylabel, just labeled tet %d\n", tetid); } if (improvebehave.verbosity > 5) { printf("now considering parents in H\n"); } /* go through all parents in H */ for (i=0; i<3; i++) { parent = cavity[tetid].parents[i]; if (improvebehave.verbosity > 5) { printf("considering parent %d = %d\n", i, parent); } if (parent != NOCAVITYTET) { /* is this parent unlabeled ? */ if (cavity[cavity[tetid].parents[i]].label != NOLABEL) { if (improvebehave.verbosity > 5) { printf("this parent is already labeled, moving on.\n"); } continue; } /* find the edge from this parent down to the child */ edgetochild = -1; for (j=0; j<cavity[parent].numoutfaces; j++) { if (cavity[parent].outfaces[j].child == tetid) { if (improvebehave.verbosity > 5) { printf("found edge from parent down to child = %d\n", j); } edgetochild = j; } } /* make sure we found the edge */ assert(edgetochild != -1); /* is this edge in H? */ if (cavity[parent].outfaces[edgetochild].inH == true) { if (improvebehave.verbosity > 5) { printf("parent %d = %d is unlabeled, and edge from it is in H. calling anticavity() on it\n", i, cavity[tetid].parents[i]); } anticavitylabel(cavity, cavitysize, cavity[tetid].parents[i]); } } } if (improvebehave.verbosity > 5) { printf("now considering children in G\n"); } /* go through all children in original graph G */ for (i=0; i<cavity[tetid].numoutfaces; i++) { /* if the child is t, it's the end and is already labeled. move on */ if (cavity[tetid].outfaces[i].child == NOCAVITYTET) { if (improvebehave.verbosity > 5) { printf("child %d is t, moving on\n", i); } continue; } if (cavity[cavity[tetid].outfaces[i].child].label == NOLABEL) { if (improvebehave.verbosity > 5) { printf("edge to child %d/%d = %d is unlabeled. calling anticavity() on it\n", i, cavity[tetid].numoutfaces-1, cavity[tetid].outfaces[i].child); } anticavitylabel(cavity, cavitysize, cavity[tetid].outfaces[i].child); } } } /* ALGORITHM 3 + CONSIDER DELETED TETS*/ /* given the DAG representing the largest possible cavity, find the subcavity that has the lexicographically maximum quality, then dig it out and connect the exposed faces to the new vertex, returning the new tets as well as the worst quality in this cavity */ void lexmaxcavity3(struct tetcomplex *mesh, tag vtag, struct cavitytet cavity[], int cavitysize, tag outtets[][4], int *numouttets, starreal *worstdeleted, starreal *worstincavity) { int i,j; /* loop counters */ int parentless; /* number of tets without parents */ bool foundparent = false; /* did we find face parent? */ static struct cavityedgeortet edges[MAXCAVITYDAGEDGES]; /* list of all edges in the DAG */ int numedges=0; static int unionfind[MAXCAVITYTETS]; /* union-find array */ int unionfindsize = cavitysize + 1; /* size of the union-find array */ int t = cavitysize; /* the virtual node t, at the end of array */ int parentlabel, childlabel; /* the groups that contain parent and child of an edge */ starreal depthfactor; starreal qual; int deepest = 0; int parentcount; static tag outputfaces[MAXCAVITYFACES][3]; int numoutputfaces = 0; /* initialize union-find array */ for (i=0; i<unionfindsize; i++) { unionfind[i] = -1; } if (improvebehave.verbosity > 5) { printf("Here's the initial DAG:\n"); printcavitydag(mesh, cavity, cavitysize); } /* first, we modify the given dag a bit. it may have multiple parentless tets that correspond to the initial cavity in the DAG-building routine. we'll merge them into one "supertet," s, that represents the single root of the dag. We'll add one other node to the DAG, t, and add an edge from all the previously childless faces of the DAG to t. The algorithm will then proceed by taking all the edges of this new DAG, sorted in ascending order of quality, and add them to the DAG iff by adding the edge, we do not connect s to t. */ /* merge all the parentless tets at the start of the DAG into one supertet s */ for (i=1; i<cavitysize; i++) { parentcount = numparents(&cavity[i]); /* check if this tet is parentless */ if (parentcount == 0) { /* copy the outgoing faces back into the first tet */ for (j=0; j<cavity[i].numoutfaces; j++) { /* copy face into the first tet */ addcavitytetface(&cavity[0], &cavity[i].outfaces[j]); /* make the child of this face point back to the first tet */ if (cavity[i].outfaces[j].child != NOCAVITYTET) { /* find the parent pointer that points back to cavity tet i */ if (cavity[cavity[i].outfaces[j].child].parents[0] == i) { cavity[cavity[i].outfaces[j].child].parents[0] = 0; foundparent = true; } if (cavity[cavity[i].outfaces[j].child].parents[1] == i) { assert(foundparent == false); cavity[cavity[i].outfaces[j].child].parents[1] = 0; foundparent = true; } if (cavity[cavity[i].outfaces[j].child].parents[2] == i) { assert(foundparent == false); cavity[cavity[i].outfaces[j].child].parents[2] = 0; foundparent = true; } assert(foundparent == true); foundparent = false; } } /* update the parentless tet whose children we just stole to have zero outgoing faces */ cavity[i].numoutfaces = 0; } else { /* we've reached the end of the parentless tets; bail */ break; } } /* save the number of parentless tets */ parentless = i; /* now, proceed through the DAG, recording all edges, and deleting child information to remove the edges, producing D' */ for (i=0; i<cavitysize; i++) { /* initialize this tet's label. set s = cavity, others no label */ if (i == 0) { cavity[i].label = CAVLABEL; } else { cavity[i].label = NOLABEL; } /* compute how much to exagerrate quality because of depth */ assert(cavity[i].depth >= 0); if (cavity[i].depth < DEPTHTABLESIZE) { depthfactor = depthtable[cavity[i].depth]; } else { depthfactor = depthtable[DEPTHTABLESIZE - 1]; } assert(depthfactor >= 1.0); /* and an edgeortet for this tet, if deleted tets are considered */ if (improvebehave.cavityconsiderdeleted) { if (i > parentless) { edges[numedges].label = TETLABEL; edges[numedges].parent = i; edges[numedges].child = 0; edges[numedges].qual = cavity[i].qual * depthfactor; numedges++; assert(numedges < MAXCAVITYDAGEDGES); } } /* for each outgoing face */ for (j=0; j<cavity[i].numoutfaces; j++) { edges[numedges].label = EDGELABEL; edges[numedges].parent = i; edges[numedges].qual = cavity[i].outfaces[j].qual * depthfactor; /* save which outgoing face this child was */ edges[numedges].childnum = j; if (cavity[i].outfaces[j].child == NOCAVITYTET) { /* if it has no child tet, make up a virtual edge to t */ edges[numedges].child = t; } else { /* set edge child to be actual child */ edges[numedges].child = cavity[i].outfaces[j].child; } numedges++; assert(numedges < MAXCAVITYDAGEDGES); /* initialize H by setting no edges to be in it */ cavity[i].outfaces[j].inH = false; } } /* now, sort the edges in order of ascending quality */ sortedgeortets(edges, numedges); /* go through each edge, adding it to D' iff it doesn't connect s to t */ for (i=0; i<numedges; i++) { /* is this a tet? */ if (edges[i].label == TETLABEL) { if (improvebehave.verbosity > 5) { printf("considering a deleted tet of qual = %g, label = %d\n", pq(edges[i].qual), cavity[edges[i].parent].label); } /* if this tet is unlabeled */ if (cavity[edges[i].parent].label == NOLABEL) { /* label this tet for the cavity */ if (improvebehave.verbosity > 4) { printf("found a deleted tet that we want to grab, qual = %g\n", pq(edges[i].qual)); } cavitylabel(cavity, cavitysize, edges[i].parent); continue; } } /* check parent's label */ parentlabel = cavity[edges[i].parent].label; /* check child's label */ if (edges[i].child == t) { /* this child is labeled automatically as anti-cavity */ childlabel = ANTICAVLABEL; } else { childlabel = cavity[edges[i].child].label; } if (improvebehave.verbosity > 5) { printf("Considering edge %d/%d:\n", i, numedges-1); printf(" label = %d\n", edges[i].label); printf(" qual = %g\n", pq(edges[i].qual)); printf(" parent = %d\n", edges[i].parent); printf(" child = %d\n", edges[i].child); printf(" parentlabel = %d\n", parentlabel); printf(" childlabel = %d\n", childlabel); printf(" t = %d\n", t); } /* if the parent is in the cavity */ if (parentlabel == CAVLABEL) { /* and the child is in the anti-cavity */ if (childlabel == ANTICAVLABEL) { /* record output face from parent to child */ if (improvebehave.verbosity > 5) { printf("this edge goes from cavity to anticavity, represents output tet.\n"); } outputfaces[numoutputfaces][0] = cavity[edges[i].parent].outfaces[edges[i].childnum].verts[0]; outputfaces[numoutputfaces][1] = cavity[edges[i].parent].outfaces[edges[i].childnum].verts[1]; outputfaces[numoutputfaces][2] = cavity[edges[i].parent].outfaces[edges[i].childnum].verts[2]; numoutputfaces++; } /* otherwise, if the child isn't labeled */ else { if (childlabel == NOLABEL) { if (improvebehave.verbosity > 5) { printf("parent is in cavity, child is unlabeled. calling cavity(child)\n"); } cavitylabel(cavity, cavitysize, edges[i].child); } } } /* parent isn't labeled cavity. */ else { /* is the parent wholly unlabeled ? */ if (parentlabel == NOLABEL) { /* is the child labeled anti-cavity ? */ if (childlabel == ANTICAVLABEL) { if (improvebehave.verbosity > 5) { printf("parent is unlabeled, child is labeled anticavity. calling anticavity(parent)\n"); } anticavitylabel(cavity, cavitysize, edges[i].parent); } else /* neither the parent nor the child is labeled */ { /* add the edge from parent to child to H */ if (improvebehave.verbosity > 5) { printf("parent and child unlabeled. adding edge to H\n"); } cavity[edges[i].parent].outfaces[edges[i].childnum].inH = true; } } } } if (improvebehave.verbosity > 5) { printf("Here's the final DAG:\n"); printcavitydag(mesh, cavity, cavitysize); } /* first sanity check: every tet in the dag should be labeled */ if (improvebehave.verbosity > 5) { for (i=0; i<cavitysize; i++) { printf("tet %d has label %d\n", i, cavity[i].label); if (numparents(&cavity[i]) != 0) { if (cavity[i].label == NOLABEL) { printf("uhoh. tet %d has label %d, strange...\n", i, cavity[i].label); } assert(cavity[i].label != NOLABEL); } } if (improvebehave.verbosity > 5) { printf("they are all in one or another yay!\n"); printf("here are the output faces:\n"); printfaces(mesh, outputfaces, numoutputfaces); } } /* delete the non-root parentless tets */ for (i=1; i<parentless; i++) { assert(tetexists(mesh, cavity[i].verts[0], cavity[i].verts[1], cavity[i].verts[2], cavity[i].verts[3])); deletetet(mesh, cavity[i].verts[0], cavity[i].verts[1], cavity[i].verts[2], cavity[i].verts[3], true); } /* keep track of what the deepest tet in the final cavity was */ deepest = 0; /* delete all tets labeled as cavity */ *worstdeleted = HUGEFLOAT; for (i=0; i<cavitysize; i++) { if (cavity[i].label == CAVLABEL) { /* is this the worst quality tet we're deleting? */ if (cavity[i].qual < *worstdeleted) { *worstdeleted = cavity[i].qual; } /* is this the deepest tet we've encountered? */ if (cavity[i].depth > deepest) { deepest = cavity[i].depth; } assert(tetexists(mesh, cavity[i].verts[0], cavity[i].verts[1], cavity[i].verts[2], cavity[i].verts[3])); deletetet(mesh, cavity[i].verts[0], cavity[i].verts[1], cavity[i].verts[2], cavity[i].verts[3], true); } } /* record depth of deepest tet */ stats.lexmaxcavdepths[deepest]++; /* now build the output cavity using the output faces */ *numouttets = 0; for (i=0; i<numoutputfaces; i++) { assert(tetexists(mesh, vtag, outputfaces[i][2], outputfaces[i][1], outputfaces[i][0]) == false); /* the face is oriented outward, so reverse it to point back */ if (improvebehave.verbosity > 5) { printf("about to insert tet (%d %d %d %d)\n", (int) vtag, (int) outputfaces[i][2], (int) outputfaces[i][1], (int) outputfaces[i][0]); } inserttet(mesh, vtag, outputfaces[i][2], outputfaces[i][1], outputfaces[i][0], true); qual = tetquality(mesh, vtag, outputfaces[i][2], outputfaces[i][1], outputfaces[i][0], improvebehave.qualmeasure); assert(qual > 0); if (qual < *worstincavity) *worstincavity = qual; outtets[*numouttets][0] = vtag; outtets[*numouttets][1] = outputfaces[i][2]; outtets[*numouttets][2] = outputfaces[i][1]; outtets[*numouttets][3] = outputfaces[i][0]; (*numouttets)++; } if (improvebehave.verbosity > 5) { printf("here are the output cavity tets:\n"); printtets(mesh, outtets, *numouttets); } } /* given a vertex, it's position, and an initial cavity of tets and a set of outward-oriented faces of that cavity, dig out an optimal cavity around the vertex and connect the central vertex to all of the cavity faces, and return a list of the new tets */ void optimalcavity(struct tetcomplex *mesh, tag vtag, tag initialC[][4], int initialCsize, tag initialF[][3], int initialFsize, tag outtets[][4], int *numouttets, starreal *worstdeleted, starreal *worstincavity, bool allowvertexdeletion) { int cavitysize; static struct cavitytet cavity[MAXCAVITYTETS]; #ifndef NO_TIMER struct timeval tv0, tv1; struct timezone tz; #endif /* not NO_TIMER */ *worstdeleted = HUGEFLOAT; *worstincavity = HUGEFLOAT; /* construct the DAG of the largest possible cavity */ #ifndef NO_TIMER gettimeofday(&tv0, &tz); #endif /* not NO_TIMER */ buildcavitydag(mesh, vtag, initialC, initialCsize, initialF, initialFsize, cavity, &cavitysize, allowvertexdeletion); #ifndef NO_TIMER gettimeofday(&tv1, &tz); stats.biggestcavityusec += usecelapsed(tv0, tv1); #endif /* not NO_TIMER */ if (improvebehave.verbosity > 5) { printf("Largest possible cavity is %d tets\n", cavitysize); } /* keep track of cavity sizes seen */ stats.maxcavitysizes[cavitysize]++; if (improvebehave.verbosity > 5) { printf("here is the DAG of biggest:\n"); printcavitydag(mesh, cavity, cavitysize); } /* check consistency of DAG */ /* assert(cavitydagcheck(mesh, cavity, cavitysize)); */ /* build the cavity of maximum lexicographic quality */ #ifndef NO_TIMER gettimeofday(&tv0, &tz); #endif /* not NO_TIMER */ lexmaxcavity3(mesh, vtag, cavity, cavitysize, outtets, numouttets, worstdeleted, worstincavity); #ifndef NO_TIMER gettimeofday(&tv1, &tz); stats.finalcavityusec += usecelapsed(tv0, tv1); #endif /* not NO_TIMER */ /* keep track of lexmax cavity sizes */ stats.finalcavitysizes[*numouttets]++; if (improvebehave.verbosity > 5) { printf("the lexmax cavity has %d tets, worst cavity qual = %g, worst deleted tet qual = %g:\n", *numouttets, pq(*worstincavity), pq(*worstdeleted)); } /* print out the dag */ /* printcavitydag(mesh, cavity, cavitysize); */ } /* given a cavity of tets built around a single vertex, try to improve the cavity, and return the final quality */ starreal improvecavity(struct tetcomplex *mesh, tag v, tag tets[][4], int numtets, bool tryhard, struct arraypoolstack *outstack, starreal *shortest, starreal *longest) { int i, stackiter=0; starreal quality; struct improvetet *stacktet; starreal smoothworst; starreal topoworst; starreal mean[NUMMEANTHRESHOLDS]; starreal oldworst = 1.0; starreal newworst = 2.0; bool smoothed=true, toposuccess=true; tag newtet[4]; int smoothkinds = 0; struct arraypoolstack stack[2]; struct arraypoolstack influencestack; starreal physworst; /* change qual measure for insertion to consider edge length ratio */ int qualmeasure = improvebehave.qualmeasure; int stacksize = 0; int maxstacksize = MAXCAVITYSTACK; int minimprovement = MINSUBMESHIMPROVEMENT; int maxpasses = MAXSUBMESHITERATIONS; if (improvebehave.facetsmooth) smoothkinds |= SMOOTHFACETVERTICES; if (improvebehave.segmentsmooth) smoothkinds |= SMOOTHSEGMENTVERTICES; if (improvebehave.fixedsmooth) smoothkinds |= SMOOTHFIXEDVERTICES; if (tryhard) { maxstacksize *= TRYHARDFACTOR; minimprovement = TRYHARDMINSUBMESHIMPROVEMENT; maxpasses = TRYHARDMAXSUBMESHITERATIONS; } /* longest and shortest edges of the affected tets */ *longest = HUGEFLOAT; *shortest = 0.0; /* two stacks to keep track of all tets influenced by improvement */ stackinit(&stack[0], sizeof(struct improvetet)); stackinit(&stack[1], sizeof(struct improvetet)); stackinit(&influencestack, sizeof(struct improvetet)); /* initialize stack with all the cavity tets */ for (i=0; i<numtets; i++) { /* compute tet quality */ quality = tetquality(mesh, tets[i][0], tets[i][1], tets[i][2], tets[i][3], improvebehave.qualmeasure); if (quality < oldworst) oldworst = quality; /* push new tet on stack */ stacktet = (struct improvetet *) stackpush(&stack[0]); stacktet->quality = quality; stacktet->verts[0] = tets[i][0]; stacktet->verts[1] = tets[i][1]; stacktet->verts[2] = tets[i][2]; stacktet->verts[3] = tets[i][3]; } /* iteratively try to improve cavity's worst quality */ i = 0; while ((newworst > oldworst + minimprovement) && (i <= maxpasses) && (smoothed || toposuccess)) { if (newworst != 2.0) oldworst = newworst; /* fetch a tet that the new vertex is in */ findtetfromvertex(mesh, v, newtet); /* if the vertex no longer exists, stop improvemet */ if (!tetexistsa(mesh, newtet)) { break; } /* smooth new vertex */ smoothed = nonsmoothsinglevertex(mesh, newtet[0], newtet[1], newtet[2], newtet[3], &smoothworst, smoothkinds); if (improvebehave.verbosity > 5) { printf("singlesmoothworst is %g\n, smoothed = %d", pq(smoothworst), smoothed); } /* improve cavity topology, alternating input/output stacks with bitwise XOR/AND */ toposuccess = topopass(mesh, &stack[stackiter & 1], &stack[(stackiter & 1) ^ 1], qualmeasure, mean, mean, &topoworst, true); stackiter++; if (improvebehave.sizing) { /* compute longest and shortest edge lengths for the output stack */ longshortstack(mesh, &stack[stackiter & 1], longest, shortest); } if (improvebehave.verbosity > 5) { printf("topoworst is %g success = %d\n", pq(topoworst), toposuccess); } /* determine the new worst quality */ if (toposuccess == false && smoothed == false && i == 0) { newworst = oldworst; } newworst = topoworst; if (improvebehave.verbosity > 5) { printf("Cavity improvement iter %d: %g -> %g\n", i, pq(oldworst), pq(newworst)); } i++; } if (improvebehave.verbosity > 5) { printf("in the end, went through %d passes before smooth\n", i); } if (FINALCAVITYSMOOTH) { smoothed = true; while(stacksize < maxstacksize && i < maxpasses && smoothed) { /* at the end, try smoothing pass on all tets of cavity */ smoothed = smoothpass(mesh, &stack[i & 1], &stack[(i & 1) ^ 1], &influencestack, improvebehave.qualmeasure, newworst, mean, mean, &smoothworst, smoothkinds, true); stacksize = stack[(i & 1) ^ 1].top; if (improvebehave.sizing) { /* compute longest and shortest edge lengths for the output stack */ longshortstack(mesh, &stack[(i & 1) ^ 1], longest, shortest); } if (improvebehave.verbosity > 5) { printf("Performed smoothing pass %d (outstack size %d) on all verts, success = %d, %g -> %g\n", i, stacksize, smoothed, pq(newworst), pq(smoothworst)); } if (smoothed && (smoothworst - newworst > minimprovement)) { /* if the smoothing pass claims success, it had better have improved quality */ assert(smoothworst > newworst); newworst = smoothworst; } else { if (improvebehave.verbosity > 5) { printf("broke the loop, smoothed = %d, qualimprove = %g\n", smoothed, pq(smoothworst - newworst)); } break; } i++; } if (stacksize >= maxstacksize && improvebehave.verbosity > 1) { printf("bailing because stacksize %d exceeded max %d\n", stacksize, maxstacksize); } } if (improvebehave.verbosity > 5) { printf("in the end, went through %d passes after final smooth\n", i); } /* if anisotropy is turned on, check for inverted tets in physical space */ if (improvebehave.anisotropic) { improvebehave.anisotropic = false; /* if we did a final smooth */ if (FINALCAVITYSMOOTH && influencestack.top != -1) { /* check the quality of this stack in physical space */ physworst = worststackquality(mesh, &influencestack, improvebehave.qualmeasure); } else { /* check the quality of this stack in physical space */ physworst = worststackquality(mesh, &stack[i & 1], improvebehave.qualmeasure); } improvebehave.anisotropic = true; if (improvebehave.verbosity > 0 && physworst <= 0.0) { printf("PHYSICAL worst quality after cavity improvement is %g\n", physworst); } assert(physworst > 0.0); } /* if there is a non-null output stack */ if (outstack != NULL) { /* if we did a final smooth */ if (FINALCAVITYSMOOTH && influencestack.top != -1) { /* return the entire influence stack */ copystack(&influencestack, outstack); assert(outstack->top != -1); } else { /* just return output from last pass */ copystack(&stack[i & 1], outstack); assert(outstack->top != -1); } } /* clean up stacks */ stackdeinit(&stack[0]); stackdeinit(&stack[1]); stackdeinit(&influencestack); if (improvebehave.verbosity > 5) { printf("After cavity improvement, worst quality is %g\n", pq(newworst)); } if (improvebehave.verbosity > 5) { printf("After cavity improvement, longest edge = %g, shortest = %g, goal = %g\n", *longest, *shortest, improvebehave.targetedgelength); } /* return the best we could do with this cavity */ return newworst; } /* insert a new vertex in the facet specified, returning the new vertex tag, the new vertex position, and the outward-oriented faces of the new tets */ bool facetinsert(struct tetcomplex *mesh, tag v1, tag v2, tag v3, tag v4, tag face[3], tag *vnew, tag newfaces[][3], int *numnewfaces, tag newtets[][4], int *numnewtets) { struct vertex *newvertex; /* pointer to newly allocated vertex */ starreal *point[4]; /* actual vertices of the tet */ starreal barycenter[3] = {0,0,0}; /* barycenter of input tet */ tag tetverts[4]; /* the vertices of the tet starting with the vert not on bound face */ tag newtag; /* the tag of the newly inserted vertex */ tag quadricfaces[3][3]; tag journverts[1]; struct quadric *quadrics[3]; int i; bool quadsuccess; /* find which vertex is not part of the boundary face, and arrange tet vertices so first is the non-boundary-face vertex */ if ((v1 != face[0]) && (v1 != face[1]) && (v1 != face[2])) { tetverts[0] = v1; } else { if ((v2 != face[0]) && (v2 != face[1]) && (v2 != face[2])) { tetverts[0] = v2; } else { if ((v3 != face[0]) && (v3 != face[1]) && (v3 != face[2])) { tetverts[0] = v3; } else { /* v4 must not be one of the face vertices */ assert(((v4 != face[0]) && (v4 != face[1]) && (v4 != face[2]))); tetverts[0] = v4; } } } /* the rest of the tet vertices should be the vertices of the boundary face, reversed in order so the face is oriented toward the fourth vertex */ tetverts[1] = face[2]; tetverts[2] = face[1]; tetverts[3] = face[0]; /* make sure our newly arranged tet exists */ assert(tetexists(mesh, tetverts[0], tetverts[1], tetverts[2], tetverts[3])); /* fetch actual vertex values of face vertices */ point[0] = ((struct vertex *) tetcomplextag2vertex(mesh, face[0]))->coord; point[1] = ((struct vertex *) tetcomplextag2vertex(mesh, face[1]))->coord; point[2] = ((struct vertex *) tetcomplextag2vertex(mesh, face[2]))->coord; /* fetch the ORIGINAL positions of the face vertices, because we want to start the vertex out on the original surface */ quadrics[0] = (struct quadric *) arraypoolforcelookup(&surfacequadrics, face[0]); quadrics[1] = (struct quadric *) arraypoolforcelookup(&surfacequadrics, face[1]); quadrics[2] = (struct quadric *) arraypoolforcelookup(&surfacequadrics, face[2]); if (improvebehave.verbosity > 5) { printf("orig -> current face verts are:\n"); for (i=0; i<3; i++) { printf(" (%g %g %g) -> (%g %g %g)\n", quadrics[i]->origpos[0], quadrics[i]->origpos[1], quadrics[i]->origpos[1], point[i][0], point[i][1], point[i][2]); } } /* compute barycenter of this face */ vadd(barycenter, point[0], barycenter); vadd(barycenter, point[1], barycenter); vadd(barycenter, point[2], barycenter); /* vadd(barycenter, quadrics[0]->origpos, barycenter); vadd(barycenter, quadrics[1]->origpos, barycenter); vadd(barycenter, quadrics[2]->origpos, barycenter); */ vscale(1.0 / 3.0, barycenter, barycenter); /* allocate a new vertex */ newtag = proxipoolnew(mesh->vertexpool, 0, (void **) &newvertex); /* record this vertex insertion in the journal */ journverts[0] = newtag; insertjournalentry(mesh, INSERTVERTEX, journverts, 1, NULL, barycenter); /* start the vertex at the face barycenter */ vcopy(barycenter, newvertex->coord); /* delete the old tet and add the three new ones */ flip13(mesh, tetverts[0], tetverts[1], tetverts[2], tetverts[3], newtag, true); /* make sure all the right tets exist now */ assert(tetexists(mesh, tetverts[0], tetverts[1], newtag, tetverts[3])); assert(tetexists(mesh, tetverts[0], tetverts[2], newtag, tetverts[1])); assert(tetexists(mesh, tetverts[0], tetverts[3], newtag, tetverts[2])); /* assign the vertex type and compute the facet normal */ tetvertexclassify(mesh, newtag, tetverts[0], tetverts[1], tetverts[3]); /* check that we got it right */ /* this isn't necessarily true any more with quadrics */ /* assert(((struct vertextype *) arraypoolforcelookup(&vertexinfo, newtag))->kind == FACETVERTEX); */ /* initialize the quadric for this vertex */ quadricfaces[0][0] = newtag; quadricfaces[0][1] = tetverts[2]; quadricfaces[0][2] = tetverts[1]; quadricfaces[1][0] = newtag; quadricfaces[1][1] = tetverts[3]; quadricfaces[1][2] = tetverts[2]; quadricfaces[2][0] = newtag; quadricfaces[2][1] = tetverts[1]; quadricfaces[2][2] = tetverts[3]; quadsuccess = addquadric(mesh, newtag, quadricfaces, 3); if (quadsuccess == false) { return false; } /* assign outputs */ *vnew = newtag; *numnewtets = 3; newtets[0][0] = tetverts[0]; newtets[0][1] = tetverts[1]; newtets[0][2] = newtag; newtets[0][3] = tetverts[3]; newtets[1][0] = tetverts[0]; newtets[1][1] = tetverts[2]; newtets[1][2] = newtag; newtets[1][3] = tetverts[1]; newtets[2][0] = tetverts[0]; newtets[2][1] = tetverts[3]; newtets[2][2] = newtag; newtets[2][3] = tetverts[2]; /* its possible that insertion fails outright because the vertices may have moved a lot due to smoothing from their original positions. so, check if any of the new tets are inverted, and return false if that's the case. */ for (i=0; i<3; i++) { if (tetquality(mesh, newtets[i][0], newtets[i][1], newtets[i][2], newtets[i][3], improvebehave.qualmeasure) <= MINTETQUALITY) { if (improvebehave.verbosity > 1) { printf("Rejecting facet insertion because tet inverts.\n"); } return false; } } *numnewfaces = 3; /* don't include outward faces on the boundary */ /* newfaces[0][0] = newtag; newfaces[0][1] = tetverts[2]; newfaces[0][2] = tetverts[1]; newfaces[1][0] = newtag; newfaces[1][1] = tetverts[3]; newfaces[1][2] = tetverts[2]; newfaces[2][0] = newtag; newfaces[2][1] = tetverts[1]; newfaces[2][2] = tetverts[3]; */ newfaces[0][0] = tetverts[0]; newfaces[0][1] = tetverts[1]; newfaces[0][2] = tetverts[2]; newfaces[1][0] = tetverts[0]; newfaces[1][1] = tetverts[3]; newfaces[1][2] = tetverts[1]; newfaces[2][0] = tetverts[0]; newfaces[2][1] = tetverts[2]; newfaces[2][2] = tetverts[3]; return true; } void bodyinsert(struct tetcomplex *mesh, tag v1, tag v2, tag v3, tag v4, tag *vnew, tag newfaces[][3], int *numnewfaces, tag newtets[][4], int *numnewtets) { tag newtag; /* the tag of the new vertex */ struct vertex *newvertex; /* pointer to newly allocated vertex */ starreal *point[4]; /* actual vertices of the tet */ starreal barycenter[3] = {0,0,0}; /* barycenter of input tet */ int i; tag journverts[1]; /* fetch actual vertex values of tet vertices */ point[0] = ((struct vertex *) tetcomplextag2vertex(mesh, v1))->coord; point[1] = ((struct vertex *) tetcomplextag2vertex(mesh, v2))->coord; point[2] = ((struct vertex *) tetcomplextag2vertex(mesh, v3))->coord; point[3] = ((struct vertex *) tetcomplextag2vertex(mesh, v4))->coord; /* compute barycenter of this face */ for (i=0; i<4; i++) { vadd(barycenter, point[i], barycenter); } vscale(0.25, barycenter, barycenter); /* allocate a new vertex */ newtag = proxipoolnew(mesh->vertexpool, 0, (void **) &newvertex); /* record this vertex insertion in the journal */ journverts[0] = newtag; insertjournalentry(mesh, INSERTVERTEX, journverts, 1, NULL, barycenter); /* start the vertex at the face barycenter */ vcopy(barycenter, newvertex->coord); /* delete the old tet and add the three new ones */ flip14(mesh, v1, v2, v3, v4, newtag, true); /* assign the vertex type */ tetvertexclassify(mesh, newtag, v1, v3, v2); /* check that we got it right */ assert(((struct vertextype *) arraypoolforcelookup(&vertexinfo, newtag))->kind == FREEVERTEX); /* assign outputs */ *vnew = newtag; *numnewtets = 4; newtets[0][0] = v1; newtets[0][1] = v2; newtets[0][2] = v3; newtets[0][3] = newtag; newtets[1][0] = v1; newtets[1][1] = v3; newtets[1][2] = v4; newtets[1][3] = newtag; newtets[2][0] = v1; newtets[2][1] = v4; newtets[2][2] = v2; newtets[2][3] = newtag; newtets[3][0] = newtag; newtets[3][1] = v2; newtets[3][2] = v3; newtets[3][3] = v4; *numnewfaces = 4; newfaces[0][0] = v1; newfaces[0][1] = v2; newfaces[0][2] = v3; newfaces[1][0] = v1; newfaces[1][1] = v3; newfaces[1][2] = v4; newfaces[2][0] = v1; newfaces[2][1] = v4; newfaces[2][2] = v2; newfaces[3][0] = v2; newfaces[3][1] = v4; newfaces[3][2] = v3; } bool segmentinsert(struct tetcomplex *mesh, tag v1, tag v2, tag v3, tag v4, int numtets, tag tets[][4], tag boundfaces[], tag *vnew, tag newfaces[][3], int *numnewfaces, tag newtets[][4], int *numnewtets, bool boundedge) { tag newtag; /* the tag of the new vertex */ struct vertex *newvertex; /* pointer to newly allocated vertex */ starreal *point[4]; /* actual vertices of the tet */ starreal midpoint[3] = {0.,0.,0.};/* barycenter of boundary edge */ tag splitedge[2]; /* edge that will be split by insertion */ tag quadricfaces[4][3]; /* four surface faces surrounding inserted vertex, used to initialize quadric */ starreal qual; struct quadric *quadrics[2]; int i; tag journverts[1]; bool quadsuccess; /* all input tets should be arranged such that the edge we're splitting is made up of the first two vertices */ /* pull out the edge that we'll be splitting */ splitedge[0] = tets[0][0]; splitedge[1] = tets[0][1]; /* fetch actual vertex values of edge vertices */ point[0] = ((struct vertex *) tetcomplextag2vertex(mesh, splitedge[0]))->coord; point[1] = ((struct vertex *) tetcomplextag2vertex(mesh, splitedge[1]))->coord; /* fetch the ORIGINAL positions of the edge vertices, because we want to start the vertex out on the original surface */ quadrics[0] = (struct quadric *) arraypoolforcelookup(&surfacequadrics, splitedge[0]); quadrics[1] = (struct quadric *) arraypoolforcelookup(&surfacequadrics, splitedge[1]); if (improvebehave.verbosity > 5) { printf("Here is the original surface edge:\n"); printf("[%g %g %g;\n", point[0][0], point[0][1], point[0][2]); printf("%g %g %g];\n", point[1][0], point[1][1], point[1][2]); } if (improvebehave.verbosity > 5) { printf("edge endpoints (%d %d) original positions (%g %g %g) and (%g %g %g)\n", (int) splitedge[0], (int) splitedge[1], quadrics[0]->origpos[0], quadrics[0]->origpos[1], quadrics[0]->origpos[2], quadrics[1]->origpos[0], quadrics[1]->origpos[1], quadrics[1]->origpos[2]); } /* compute midpoint of this edge */ /* vadd(midpoint, quadrics[0]->origpos, midpoint); vadd(midpoint, quadrics[1]->origpos, midpoint); */ vadd(midpoint, point[0], midpoint); vadd(midpoint, point[1], midpoint); vscale(0.5, midpoint, midpoint); /* allocate a new vertex */ newtag = proxipoolnew(mesh->vertexpool, 0, (void **) &newvertex); /* record this vertex insertion in the journal */ journverts[0] = newtag; insertjournalentry(mesh, INSERTVERTEX, journverts, 1, NULL, midpoint); /* start the vertex at the edge midpoint */ vcopy(midpoint, newvertex->coord); *numnewfaces = 0; *numnewtets = 0; *vnew = newtag; /* for every tet that surrounds this edge, perform a 1-2 flip */ for (i=0; i<numtets; i++) { /* make sure the first two verts of this tet are the edge to be split */ assert((tets[i][0] == splitedge[0] && tets[i][1] == splitedge[1]) || (tets[i][0] == splitedge[1] && tets[i][1] == splitedge[0])); /* make sure the old tet exists */ assert(tetexists(mesh, tets[i][0], tets[i][1], tets[i][2], tets[i][3])); /* delete the old tet and add the two new ones */ flip12(mesh, tets[i][0], tets[i][1], tets[i][2], tets[i][3], newtag, true); /* make sure all the right tets exist now */ assert(tetexists(mesh, tets[i][0], tets[i][2], tets[i][3], newtag)); assert(tetexists(mesh, tets[i][1], tets[i][3], tets[i][2], newtag)); /* add these tets to the output */ newtets[*numnewtets][0] = tets[i][0]; newtets[*numnewtets][1] = tets[i][2]; newtets[*numnewtets][2] = tets[i][3]; newtets[*numnewtets][3] = newtag; /* if anisotropy, check if this tet is inverted in PHYSICAL SPACE */ if (improvebehave.anisotropic) { improvebehave.anisotropic = false; qual = tetquality(mesh, newtets[*numnewtets][0], newtets[*numnewtets][1], newtets[*numnewtets][2], newtets[*numnewtets][3], improvebehave.qualmeasure); improvebehave.anisotropic = true; if (qual <= MINSIZETETQUALITY) { if (improvebehave.verbosity > 1) { printf("rejecting segment insert because tet would invert in PHYSICAL SPACE\n"); } return false; } } /* if this tet is inverted, give up */ qual = tetquality(mesh, newtets[*numnewtets][0], newtets[*numnewtets][1], newtets[*numnewtets][2], newtets[*numnewtets][3], improvebehave.qualmeasure); if (improvebehave.verbosity > 5) { printf("New tet (%d %d %d %d) has quality %g\n", (int) newtets[*numnewtets][0], (int) newtets[*numnewtets][1], (int) newtets[*numnewtets][2], (int) newtets[*numnewtets][3], qual); } if (qual <= MINTETQUALITY) { if (improvebehave.verbosity > 1) { printf("rejecting segment insert because tet would invert\n"); } return false; } (*numnewtets)++; newtets[*numnewtets][0] = tets[i][1]; newtets[*numnewtets][1] = tets[i][3]; newtets[*numnewtets][2] = tets[i][2]; newtets[*numnewtets][3] = newtag; /* if anisotropy, check if this tet is inverted in PHYSICAL SPACE */ if (improvebehave.anisotropic) { improvebehave.anisotropic = false; qual = tetquality(mesh, newtets[*numnewtets][0], newtets[*numnewtets][1], newtets[*numnewtets][2], newtets[*numnewtets][3], improvebehave.qualmeasure); improvebehave.anisotropic = true; if (qual <= MINSIZETETQUALITY) { if (improvebehave.verbosity > 1) { printf("rejecting segment insert because tet would invert in PHYSICAL SPACE\n"); } return false; } } qual = tetquality(mesh, newtets[*numnewtets][0], newtets[*numnewtets][1], newtets[*numnewtets][2], newtets[*numnewtets][3], improvebehave.qualmeasure); if (improvebehave.verbosity > 5) { printf("New tet (%d %d %d %d) has quality %g\n", (int) newtets[*numnewtets][0], (int) newtets[*numnewtets][1], (int) newtets[*numnewtets][2], (int) newtets[*numnewtets][3], qual); } if (qual <= MINTETQUALITY) { if (improvebehave.verbosity > 1) { printf("rejecting segment insert because tet would invert\n"); } return false; } (*numnewtets)++; /* add the "external" faces of the new tets to the output */ newfaces[*numnewfaces][0] = tets[i][0]; newfaces[*numnewfaces][1] = tets[i][2]; newfaces[*numnewfaces][2] = tets[i][3]; (*numnewfaces)++; newfaces[*numnewfaces][0] = tets[i][1]; newfaces[*numnewfaces][1] = tets[i][3]; newfaces[*numnewfaces][2] = tets[i][2]; (*numnewfaces)++; } /* check if any of the new tets are inverted, and return false if so */ /* add the last four faces of the split boundary faces to output */ /* actually, exclude these faces because they lie on the boundary */ /* newfaces[*numnewfaces][0] = newtag; newfaces[*numnewfaces][1] = splitedge[1]; newfaces[*numnewfaces][2] = boundfaces[0]; (*numnewfaces)++; newfaces[*numnewfaces][0] = newtag; newfaces[*numnewfaces][1] = boundfaces[0]; newfaces[*numnewfaces][2] = splitedge[0]; (*numnewfaces)++; newfaces[*numnewfaces][0] = newtag; newfaces[*numnewfaces][1] = boundfaces[1]; newfaces[*numnewfaces][2] = splitedge[1]; (*numnewfaces)++; newfaces[*numnewfaces][0] = newtag; newfaces[*numnewfaces][1] = splitedge[0]; newfaces[*numnewfaces][2] = boundfaces[1]; (*numnewfaces)++; */ /* tag outin[2]; bool foundface; foundface = tetcomplexadjacencies(mesh, newtag, splitedge[1], boundfaces[0], outin); assert(foundface); printf("(new, edge[1], bf[0]: out = %d, in = %d\n", outin[0], outin[1]); foundface = tetcomplexadjacencies(mesh, newtag, boundfaces[0], splitedge[0], outin); assert(foundface); printf("(new, bf[0], edge[0]: out = %d, in = %d\n", outin[0], outin[1]); foundface = tetcomplexadjacencies(mesh, newtag, boundfaces[1], splitedge[1], outin); assert(foundface); printf("(new, bf[1], edge[1]: out = %d, in = %d\n", outin[0], outin[1]); foundface = tetcomplexadjacencies(mesh, newtag, splitedge[0], boundfaces[1], outin); assert(foundface); printf("(new, edge[0], bf[1]: out = %d, in = %d\n", outin[0], outin[1]); */ /* initialize the quadric for this vertex */ if (boundedge) { quadricfaces[0][0] = newtag; quadricfaces[0][1] = splitedge[1]; quadricfaces[0][2] = boundfaces[0]; quadricfaces[1][0] = newtag; quadricfaces[1][1] = boundfaces[0]; quadricfaces[1][2] = splitedge[0]; quadricfaces[2][0] = newtag; quadricfaces[2][1] = boundfaces[1]; quadricfaces[2][2] = splitedge[1]; quadricfaces[3][0] = newtag; quadricfaces[3][1] = splitedge[0]; quadricfaces[3][2] = boundfaces[1]; quadsuccess = addquadric(mesh, newtag, quadricfaces, 4); if (quadsuccess == false) { if (improvebehave.verbosity > 0) { printf("segment insertion failed because adding the quadric failed.\n"); } return false; } } /* assign the vertex type and compute the facet normal */ tetvertexclassify(mesh, newtag, tets[0][1], tets[0][2], tets[0][3]); /* check that we got it right; new vertex can either be segment or facet vertex */ /* this is no longer necessarily true because of quadric smoothing */ /* assert((((struct vertextype *) arraypoolforcelookup(&vertexinfo, newtag))->kind == SEGMENTVERTEX) || (((struct vertextype *) arraypoolforcelookup(&vertexinfo, newtag))->kind == FACETVERTEX)); */ return true; } /* general vertex insertion routine */ bool insertvertex(struct tetcomplex *mesh, tag v1, tag v2, tag v3, tag v4, starreal inquality, starreal meshworstquality, starreal *outquality, struct arraypoolstack *outstack, bool tryhard) { int nbverts, nbedges, nbfaces; /* number of boundary components */ tag boundtags[4]; /* boundary vertex tags */ tag boundfacetags[4][3]; /* boundary face tags */ tag boundedgetags[6][2]; /* boundary edge tags */ tag boundedgefaces[6][2]; /* the third vertices of the faces in the ring around an edge that lie on the boundary */ int numboundedgetets[6]; /* number of tets in ring around each boundary edge */ tag boundedgetets[6][MAXRINGTETS][4]; /* the list of the tets in the ring around each edge */ bool bfaces; tag vnew; /* newly inserted vertex tag */ static tag newfaces[MAXCAVITYFACES][3]; /* faces of tets created after insert for seeding cavity drilling */ int numnewfaces; static tag newtets[MAXCAVITYTETS][4]; /* tets that filled in cavity */ int numnewtets; starreal minquality; /* quality we have to beat for inserion to succeed */ starreal origcavityqual; /* quality of the worst tet in the cavity */ starreal worstdeletedqual; /* quality of the worst tet deleted to form the cavity */ starreal cavityqual; /* quality of the improved cavity */ starreal longest, shortest; /* shortest and longest edges in a cavity */ bool success; bool sizeok; struct arraypoolstack cavitystack; /* save the tets affected by cavity improvement */ struct arraypoolstack *cavitystackptr; /* may be null if outstack is null */ #ifndef NO_TIMER struct timeval tv0, tv1; struct timezone tz; #endif /* not NO_TIMER */ int i; /* remember the last journal entry before we change anything */ int beforeid = lastjournalentry(); /* make sure this tet still exists */ if (tetexists(mesh, v1, v2, v3, v4) == false) return false; if (improvebehave.verbosity > 5) { printf("Attempting general vertex insertion on tet (%d %d %d %d)\n", (int) v1, (int) v2, (int) v3, (int) v4); printtetvertssep(mesh, v1, v2, v3, v4); } /* start by gathering boundary information on this tet */ nbverts = boundverts(mesh, v1, v2, v3, v4, boundtags); nbedges = boundedges(mesh, v1, v2, v3, v4, boundedgetags, boundedgefaces, numboundedgetets, boundedgetets); bfaces = boundfaces(mesh, v1, v2, v3, v4, boundfacetags, &nbfaces); /* initialize cavity stack */ stackinit(&cavitystack, sizeof(struct improvetet)); if (outstack == NULL) { cavitystackptr = NULL; } else { cavitystackptr = &cavitystack; } /*************************************/ /********** FACET INSERTION **********/ /*************************************/ /* if the tet has any boundary faces, try insertion on them first */ /* TODO: why? */ if (improvebehave.insertfacet) { for (i=0; i<nbfaces; i++) { if (improvebehave.verbosity > 5) { printf("Attempting facet insertion...\n"); } /* stats */ stats.facetinsertattempts++; /* perform the initial insertion using a 1-3 flip, locating the new vertex at the barycenter of the facet */ success = facetinsert(mesh, v1, v2, v3, v4, boundfacetags[i], &vnew, newfaces, &numnewfaces, newtets, &numnewtets); /* if one of the new tets is inverted, give up */ if (success == false) { invertjournalupto(mesh, beforeid); continue; } /* dig out optimal cavity */ optimalcavity(mesh, vnew, newtets, numnewtets, newfaces, numnewfaces, newtets, &numnewtets, &worstdeletedqual, &origcavityqual, true); if (improvebehave.verbosity > 5) { printf("The quality of the split tet was %g vs worst deleted to form cavity of %g\n", pq(inquality), pq(worstdeletedqual)); } /* the quality we have to beat when improving the cavity is the worst of the split tet and those of the dug-out cavity */ minquality = (worstdeletedqual < inquality) ? worstdeletedqual : inquality; if (improvebehave.verbosity > 5) { printf("Here is the cavity returned (it has %d tets):\n", numnewtets); printtets(mesh, newtets, numnewtets); } /* improve the cavity */ #ifndef NO_TIMER gettimeofday(&tv0, &tz); #endif /* not NO_TIMER */ cavityqual = improvecavity(mesh, vnew, newtets, numnewtets, tryhard, cavitystackptr, &longest, &shortest); #ifndef NO_TIMER gettimeofday(&tv1, &tz); stats.cavityimproveusec += usecelapsed(tv0, tv1); #endif if ( improvebehave.sizing && ((longest > improvebehave.targetedgelength * improvebehave.longerfactor) || (shortest < improvebehave.targetedgelength * improvebehave.shorterfactor)) ) { if (improvebehave.verbosity > 3) { printf("Aborting insertion because it would create bad edge of length %g/%g, target is %g\n", longest, shortest, improvebehave.targetedgelength); } sizeok = false; } else { sizeok = true; } /* did we succeed? */ if (cavityqual > (minquality + MININSERTIONIMPROVEMENT) && sizeok) { /* yes. keep the insertion */ if (improvebehave.verbosity > 4) { printf("Facet vertex insertion succeeded. minqual = %g, cavityqual = %g\n", pq(minquality), pq(cavityqual)); } /* add the affected tets to the output stack */ if (outstack != NULL) { appendstack(&cavitystack, outstack); } stackdeinit(&cavitystack); /* stats */ stats.facetinsertsuccesses++; *outquality = cavityqual; return true; } else { /* no. reverse the damage */ if (improvebehave.verbosity > 5) { printf("Facet vertex insertion failed. minqual = %g, cavityqual = %g\n", pq(minquality), pq(cavityqual)); } invertjournalupto(mesh, beforeid); } } } /*************************************/ /********** BODY INSERTION ***********/ /*************************************/ if (improvebehave.insertbody) { if (improvebehave.verbosity > 5) { printf("Attempting bady insertion...\n"); } /* stats */ stats.bodyinsertattempts++; /* perform the initial insertion using a 1-4 flip, locating the new vertex at the barycenter of the tet */ bodyinsert(mesh, v1, v2, v3, v4, &vnew, newfaces, &numnewfaces, newtets, &numnewtets); /* dig out optimal cavity */ optimalcavity(mesh, vnew, newtets, numnewtets, newfaces, numnewfaces, newtets, &numnewtets, &worstdeletedqual, &origcavityqual, true); if (improvebehave.verbosity > 5) { printf("The quality of the split tet was %g vs worst deleted to form cavity of %g\n", pq(inquality), pq(worstdeletedqual)); } /* the quality we have to beat when improving the cavity is the worst of the split tet and those of the dug-out cavity */ minquality = (worstdeletedqual < inquality) ? worstdeletedqual : inquality; if (improvebehave.verbosity > 5) { printf("Here is the cavity returned (it has %d tets):\n", numnewtets); printtets(mesh, newtets, numnewtets); } /* improve the cavity */ #ifndef NO_TIMER gettimeofday(&tv0, &tz); #endif /* not NO_TIMER */ cavityqual = improvecavity(mesh, vnew, newtets, numnewtets, tryhard, cavitystackptr, &longest, &shortest); #ifndef NO_TIMER gettimeofday(&tv1, &tz); stats.cavityimproveusec += usecelapsed(tv0, tv1); #endif /* not NO_TIMER */ if ( improvebehave.sizing && ((longest > improvebehave.targetedgelength * improvebehave.longerfactor) || (shortest < improvebehave.targetedgelength * improvebehave.shorterfactor)) ) { if (improvebehave.verbosity > 3) { printf("Aborting insertion because it would create bad edge of length %g/%g, target is %g\n", longest, shortest, improvebehave.targetedgelength); } sizeok = false; } else { sizeok = true; } /* did we succeed? */ if (cavityqual > (minquality + MININSERTIONIMPROVEMENT) && sizeok) { /* yes. keep the insertion */ if (improvebehave.verbosity > 4) { printf("Body vertex insertion succeeded. minqual = %g, cavityqual = %g\n", pq(minquality), pq(cavityqual)); if (cavitystackptr != NULL) { printf(" and by the way, the worst stack quality is %g\n", worststackquality(mesh,cavitystackptr,improvebehave.qualmeasure)); } } /* add the affected tets to the output stack */ if (outstack != NULL) { appendstack(&cavitystack, outstack); } stackdeinit(&cavitystack); /* stats */ stats.bodyinsertsuccesses++; *outquality = cavityqual; return true; } else { /* no. reverse the damage */ if (improvebehave.verbosity > 5) { printf("Body vertex insertion failed. minqual = %g, cavityqual = %g\n", pq(minquality), pq(cavityqual)); } invertjournalupto(mesh, beforeid); } } /*************************************/ /******** SEGMENT INSERTION **********/ /*************************************/ if (improvebehave.insertsegment) { for (i=0; i<nbedges; i++) { if (improvebehave.verbosity > 5) { printf("Attempting segment insertion...\n"); } /* stats */ stats.segmentinsertattempts++; /* perform initial vertex insertion */ success = segmentinsert(mesh, v1, v2, v3, v4, numboundedgetets[i], boundedgetets[i], boundedgefaces[i], &vnew, newfaces, &numnewfaces, newtets, &numnewtets, true); /* if one of the new tets is inverted, give up */ if (success == false) { invertjournalupto(mesh, beforeid); continue; } if (improvebehave.verbosity > 5) { printf("segment insertion returned this set of split tets:\n"); printtets(mesh, newtets, numnewtets); } /* dig out optimal cavity */ optimalcavity(mesh, vnew, newtets, numnewtets, newfaces, numnewfaces, newtets, &numnewtets, &worstdeletedqual, &origcavityqual, true); if (improvebehave.verbosity > 5) { printf("The quality of the split tet was %g vs worst deleted to form cavity of %g\n", pq(inquality), pq(worstdeletedqual)); } /* the quality we have to beat when improving the cavity is the worst of the split tet and those of the dug-out cavity */ minquality = (worstdeletedqual < inquality) ? worstdeletedqual : inquality; if (improvebehave.verbosity > 5) { printf("Here is the cavity returned (it has %d tets):\n", numnewtets); printtets(mesh, newtets, numnewtets); } /* improve the cavity */ #ifndef NO_TIMER gettimeofday(&tv0, &tz); #endif /* not NO_TIMER */ cavityqual = improvecavity(mesh, vnew, newtets, numnewtets, tryhard, cavitystackptr, &longest, &shortest); #ifndef NO_TIMER gettimeofday(&tv1, &tz); stats.cavityimproveusec += usecelapsed(tv0, tv1); #endif /* not NO_TIMER */ if ( improvebehave.sizing && ((longest > improvebehave.targetedgelength * improvebehave.longerfactor) || (shortest < improvebehave.targetedgelength * improvebehave.shorterfactor)) ) { if (improvebehave.verbosity > 3) { printf("Aborting insertion because it would create bad edge of length %g/%g, target is %g\n", longest, shortest, improvebehave.targetedgelength); } sizeok = false; } else { sizeok = true; } /* did we succeed? */ if (cavityqual > (minquality + MININSERTIONIMPROVEMENT) && sizeok) { /* yes. keep the insertion */ if (improvebehave.verbosity > 4) { printf("Segment vertex insertion succeeded. minqual = %g, cavityqual = %g\n", pq(minquality), pq(cavityqual)); } /* add the affected tets to the output stack */ if (outstack != NULL) { appendstack(&cavitystack, outstack); } stackdeinit(&cavitystack); /* stats */ stats.segmentinsertsuccesses++; *outquality = cavityqual; return true; } else { /* no. reverse the damage */ if (improvebehave.verbosity > 5) { printf("Segment vertex insertion failed. minqual = %g, cavityqual = %g\n", pq(minquality), pq(cavityqual)); } invertjournalupto(mesh, beforeid); } } } stackdeinit(&cavitystack); return false; } /* attempt insertion on a stack of tets */ bool insertpass(struct tetcomplex *mesh, struct arraypoolstack *tetstack, struct arraypoolstack *outstack, int qualmeasure, starreal meanqualafter[], starreal *minqualafter, starreal okayqual, bool quiet) { struct improvetet *stacktet; bool success = false; starreal minqualbefore; starreal meanqualbefore[NUMMEANTHRESHOLDS]; int attempts=0; int inserts=0; starreal cavityqual; starreal meshworstqual; bool tryhard = false; int beforeid = lastjournalentry(); int origstacksize = tetstack->top + 1; /* reset output stack */ if (outstack != NULL) { /* copy the input stack to output stack */ stackrestart(outstack); copystack(tetstack, outstack); } /* get global worst for paranoid insertion */ meshworstqual = HUGEFLOAT; if (INSERTPARANOID) { meshquality(mesh, qualmeasure, meanqualbefore, &meshworstqual); } /* compute worst input quality. do it global if no output stack */ if (outstack != NULL) { stackquality(mesh, tetstack, qualmeasure, meanqualbefore, &minqualbefore); } else { meshquality(mesh, qualmeasure, meanqualbefore, &minqualbefore); } /* now go through the stack collecting information */ while (tetstack->top != STACKEMPTY) { if (improvebehave.verbosity > 4 && (tetstack->top % 20 == 0)) { textcolor(BRIGHT, MAGENTA, BLACK); printf("%ld remaining tets\r\n", tetstack->top); textcolor(RESET, WHITE, BLACK); } /* pull the top tet off the stack */ stacktet = (struct improvetet *) stackpop(tetstack); /* make sure this tet still exists */ if (tetexists(mesh, stacktet->verts[0], stacktet->verts[1], stacktet->verts[2], stacktet->verts[3]) == false) continue; /* because this tet might have been fixed up in a previous insertion, recompute its quality */ stacktet->quality = tetquality(mesh, stacktet->verts[0], stacktet->verts[1], stacktet->verts[2], stacktet->verts[3], improvebehave.qualmeasure); /* if this tet is already above the demanded quality, don't attempt insertion */ if (stacktet->quality >= okayqual && okayqual > 0.0) { if (improvebehave.verbosity > 5) { printf("skipping insertion attempt because tet quality %g is better than %g\n", pq(stacktet->quality), pq(okayqual)); } continue; } /* determine if we should try extra hard for this insertion to work out */ if (okayqual > 0.0 || stacktet->quality - minqualbefore < CLOSETOWORST) { tryhard = true; } else { tryhard = false; } /* attempt to insert a vertex */ success = insertvertex(mesh, stacktet->verts[0], stacktet->verts[1], stacktet->verts[2], stacktet->verts[3], stacktet->quality, minqualbefore, &cavityqual, outstack, tryhard); attempts++; inserts += success ? 1 : 0; if (INSERTPARANOID) { starreal newworst, newmean[NUMMEANTHRESHOLDS]; meshquality(mesh, qualmeasure, newmean, &newworst); if (success == false) { if (meshworstqual != newworst) { printf("meshworstqual = %g, newworst = %g\n", pq(meshworstqual), pq(newworst)); } assert(meshworstqual == newworst); } else { if (newworst < meshworstqual) { printf("uhoh... worst qual went from %g to %g (diff = %g) on success...\n", pq(meshworstqual), pq(newworst), pq(newworst - meshworstqual)); printjournaltop(5); worsttetreport(mesh, improvebehave.qualmeasure, 1.0); } assert(newworst >= meshworstqual); meshworstqual = newworst; } } success = false; } if (outstack != NULL) { stackquality(mesh, outstack, qualmeasure, meanqualafter, minqualafter); if (improvebehave.verbosity > 1) { printf("just completed insertion improvment pass.\n"); printf(" input stack had %d tets\n", origstacksize); printf(" output stack had %lu tets\n", outstack->top+1); printf(" claimed input quality is %g\n", pq(minqualbefore)); printf(" worst quality in the output stack is %g\n", pq(*minqualafter)); printf(" Insertion successes / attempts: %d/%d\n", inserts, attempts); } /* if the worst quality didn't improve on insertion, undo this insertion pass */ if (*minqualafter < minqualbefore || (*minqualafter == minqualbefore && inserts == 0)) { if (improvebehave.verbosity > 1) { printf("Undoing last insertion pass, minqualbefore was %g but after was %g\n", minqualbefore, *minqualafter); } invertjournalupto(mesh, beforeid); /* reset minimum output quality */ *minqualafter = minqualbefore; return false; } } if (improvebehave.verbosity > 4) { printf("Insertion successes / attempts: %d/%d\n", inserts, attempts); } if (inserts > 0) return true; return false; } /* go after the worst tets. with insertion */ void worsttetattack(struct tetcomplex *mesh, int qualmeasure, starreal percentinsert, starreal outmeanqual[], starreal *outminqual, bool desperate) { starreal minqual, meanqual[NUMMEANTHRESHOLDS];/* quality of the worst tet in the mesh */ struct arraypoolstack tetstack; /* stack of tets */ starreal meshworstqual, origmeshworstqual; starreal fillthresh; /* initialize the tet stack */ stackinit(&tetstack, sizeof(struct improvetet)); meshquality(mesh, qualmeasure, meanqual, &minqual); if (desperate == false) { /* fill the stack of with the worst percent insert tets */ fillstackpercent(mesh, &tetstack, qualmeasure, percentinsert, meanqual, &minqual); if (improvebehave.verbosity > 4) { textcolor(BRIGHT, MAGENTA, BLACK); printf("Attempting vertex insertion on the worst %g percent of tets (%ld).\n", percentinsert * 100.0, tetstack.top); textcolor(RESET, WHITE, BLACK); } } else { if (minqual + QUALFROMDESPERATE < improvebehave.maxinsertquality[improvebehave.qualmeasure]) { fillthresh = minqual + QUALFROMDESPERATE; } else if (minqual > improvebehave.maxinsertquality[improvebehave.qualmeasure]) { fillthresh = minqual + QUALUPFROMDESPERATE; } else { fillthresh = improvebehave.maxinsertquality[improvebehave.qualmeasure]; } fillstackqual(mesh, &tetstack, qualmeasure, fillthresh, meanqual, &minqual); if (improvebehave.verbosity > 4) { textcolor(BRIGHT, MAGENTA, BLACK); printf("Attempting DESPERATE vertex insertion on the %ld tets with qual less than %g (%g degrees).\n", tetstack.top, fillthresh, pq(fillthresh)); textcolor(RESET, WHITE, BLACK); } } origmeshworstqual = meshworstqual = minqual; /* perform insertion pass on stack of tets */ insertpass(mesh, &tetstack, NULL, qualmeasure, NULL, outminqual, -1.0, false); /* free the stack of tets */ stackdeinit(&tetstack); meshquality(mesh, qualmeasure, outmeanqual, outminqual); if (!improvebehave.fixedsmooth) { if (*outminqual < origmeshworstqual) { printf("crap, mesh min qual = %g after insert pass, %g before.\n", pq(*outminqual), pq(origmeshworstqual)); } assert(*outminqual >= origmeshworstqual); } /* print report */ if (improvebehave.verbosity > 3) { if (meshworstqual > origmeshworstqual) { textcolor(BRIGHT, GREEN, BLACK); printf(" Worst angle in mesh improved from %g to %g degrees\n", pq(origmeshworstqual), pq(meshworstqual)); textcolor(RESET, WHITE, BLACK); } } }
35.867593
202
0.492329
[ "mesh" ]
41244870d950cd50135e6933d8e0c75f59558b5f
1,979
h
C
bin/windows/cpp/obj/include/com/haxepunk/Mask.h
DrSkipper/twogames
916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b
[ "MIT" ]
null
null
null
bin/windows/cpp/obj/include/com/haxepunk/Mask.h
DrSkipper/twogames
916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b
[ "MIT" ]
null
null
null
bin/windows/cpp/obj/include/com/haxepunk/Mask.h
DrSkipper/twogames
916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b
[ "MIT" ]
null
null
null
#ifndef INCLUDED_com_haxepunk_Mask #define INCLUDED_com_haxepunk_Mask #ifndef HXCPP_H #include <hxcpp.h> #endif HX_DECLARE_CLASS0(IMap) HX_DECLARE_CLASS2(com,haxepunk,Entity) HX_DECLARE_CLASS2(com,haxepunk,Mask) HX_DECLARE_CLASS2(com,haxepunk,Tweener) HX_DECLARE_CLASS3(com,haxepunk,masks,Hitbox) HX_DECLARE_CLASS3(com,haxepunk,masks,Masklist) HX_DECLARE_CLASS3(com,haxepunk,math,Projection) HX_DECLARE_CLASS3(com,haxepunk,math,Vector) HX_DECLARE_CLASS2(flash,display,Graphics) HX_DECLARE_CLASS2(flash,geom,Point) HX_DECLARE_CLASS2(haxe,ds,StringMap) namespace com{ namespace haxepunk{ class HXCPP_CLASS_ATTRIBUTES Mask_obj : public hx::Object{ public: typedef hx::Object super; typedef Mask_obj OBJ_; Mask_obj(); Void __construct(); public: static hx::ObjectPtr< Mask_obj > __new(); static Dynamic __CreateEmpty(); static Dynamic __Create(hx::DynamicArray inArgs); ~Mask_obj(); HX_DO_RTTI; static void __boot(); static void __register(); void __Mark(HX_MARK_PARAMS); void __Visit(HX_VISIT_PARAMS); ::String __ToString() const { return HX_CSTRING("Mask"); } ::haxe::ds::StringMap _check; ::String _class; virtual Void project( ::com::haxepunk::math::Vector axis,::com::haxepunk::math::Projection projection); Dynamic project_dyn(); virtual Void update( ); Dynamic update_dyn(); virtual Void debugDraw( ::flash::display::Graphics graphics,Float scaleX,Float scaleY); Dynamic debugDraw_dyn(); virtual Void assignTo( ::com::haxepunk::Entity parent); Dynamic assignTo_dyn(); virtual bool collideMasklist( ::com::haxepunk::masks::Masklist other); Dynamic collideMasklist_dyn(); virtual bool collideMask( ::com::haxepunk::Mask other); Dynamic collideMask_dyn(); virtual bool collide( ::com::haxepunk::Mask mask); Dynamic collide_dyn(); ::com::haxepunk::masks::Masklist list; ::com::haxepunk::Entity parent; }; } // end namespace com } // end namespace haxepunk #endif /* INCLUDED_com_haxepunk_Mask */
26.743243
105
0.758969
[ "object", "vector" ]
414db5202babbb1bd14123f54ea66a87a7221a0f
1,490
h
C
Kodgen/Include/Kodgen/Misc/Settings.h
jsoysouvanh/Kodgen
bd6892b3578229652120d30abb96cd12444f72bb
[ "MIT" ]
19
2020-08-07T05:50:09.000Z
2022-03-27T18:44:46.000Z
Kodgen/Include/Kodgen/Misc/Settings.h
Angelysse/Kodgen
a647bc1e552e8e57db4e60de77c853379e4ca4d8
[ "MIT" ]
2
2021-11-19T05:44:16.000Z
2022-03-27T22:43:30.000Z
Kodgen/Include/Kodgen/Misc/Settings.h
Angelysse/Kodgen
a647bc1e552e8e57db4e60de77c853379e4ca4d8
[ "MIT" ]
2
2020-06-12T17:26:42.000Z
2021-12-01T07:07:50.000Z
/** * Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved * * This file is part of the Kodgen library project which is released under the MIT License. * See the LICENSE.md file for full license details. */ #pragma once #include "Kodgen/Misc/Toml11.h" #include "Kodgen/Misc/Filesystem.h" namespace kodgen { //Forward declaration class ILogger; class Settings { protected: /** * @brief Load all settings from the provided toml data. * * @param tomlData Data loaded from a toml file. * @param logger Optional logger used to issue loading logs. Can be nullptr. * * @return true if no error occured during loading, else false. */ virtual bool loadSettingsValues(toml::value const& tomlData, ILogger* logger) noexcept = 0; public: Settings() = default; Settings(Settings const&) = default; Settings(Settings&&) = default; virtual ~Settings() = default; /** * @brief Setup this object's member variables with the provided toml file. * Member variables not specified in the toml file remain unchanged. * * @param pathToSettingsFile Path to the toml file. * @param logger Optional logger used to issue loading logs. * * @return true if a file could be loaded, else false. */ bool loadFromFile(fs::path const& pathToSettingsFile, ILogger* logger = nullptr) noexcept; Settings& operator=(Settings const&) = default; Settings& operator=(Settings&&) = default; }; }
28.113208
90
0.685235
[ "object" ]
4152316e3c3425ef33ded3bfd94d94ebd0218710
6,276
c
C
create.c
guardiansofgardengrove/2019-guardians-of-garden-grove
ed968be1294c6ba0143ef7504d9cc1db957926fb
[ "MIT" ]
null
null
null
create.c
guardiansofgardengrove/2019-guardians-of-garden-grove
ed968be1294c6ba0143ef7504d9cc1db957926fb
[ "MIT" ]
1
2019-04-29T02:41:02.000Z
2019-04-29T02:48:12.000Z
create.c
guardiansofgardengrove/2019-guardians-of-garden-grove
ed968be1294c6ba0143ef7504d9cc1db957926fb
[ "MIT" ]
1
2019-04-29T02:10:37.000Z
2019-04-29T02:10:37.000Z
#include <kipr/botball.h> int main() { printf("This is the create's code\n"); //List integers: int power = 3; int people = 0; int powerP = get_servo_position(power); int peopleP = get_servo_position(people); int quarter = 950; int timer = 0; //startup prerun functions create_connect(); //connect wallaby to create msleep(100); printf("Create Batter Power Before run: %d",get_create_battery_charge()); printf("/n"); msleep(1000); enable_servo(power); msleep(1000); enable_servo(people); set_servo_position(people,2040); set_servo_position(power,600); msleep(500);//wait for light //wait_for_light(5); shut_down_in(119); //stop all code in 120 seconds printf("Create Batter Power at start: %d",get_create_battery_charge()); printf("/n"); //Official start of code: //unfold the robot: //while (get_servo_position(power) < 1550) { //powerP = powerP+25; //msleep(15); //set_servo_position(power,powerP); //} //Task: drive to the powerlines //quick backup check create_drive_direct(-100,-100); msleep(1250); create_stop(); create_drive_direct(400,400); msleep(750); create_stop(); //testing 90 degree turn create_spin_CW(200); msleep(960); create_drive_direct(400,400); msleep(1750); create_stop(); //adjust to push container create_spin_CCW(200); msleep(950); //960 create_drive_direct(200,200); msleep(1500); //1250 1500 ///watch this number create_spin_CW(200); msleep(870); //930 900 870(before mess up) 915 //slowly approach the power lines while (get_create_rbump() == 0 || get_create_lbump() == 0) { create_drive_direct(200,200); //100 timer = timer + 1; msleep(100); if (timer > 30) { break; } } create_stop(); timer = 0; //position for right washer create_spin_CCW(200); msleep(980);//960 1000 960 920 950 (980 norma number) create_drive_direct(-100,-100); msleep(800); //750 1000 //1250 1150 //1075 1000 //create_stop(); //msleep(1000); set_servo_position(power, 1570); //1520 1620 1670 create_stop(); msleep(1000); //connect washer and push container create_drive_direct(-150,-150); msleep(1800); //1200 1500 1675 1725 1825 (1725 was the consistend number used) create_stop(); msleep(250); //unhook and turn for next washer set_servo_position(power, 1800); //1700 create_spin_CCW(200); msleep(480); create_drive_direct(25,25); //50 msleep(250); set_servo_position(power, 800); create_spin_CW(200); msleep(456); //480 456 480 create_drive_direct(200,200); msleep(1950); //1750 1850 //create_stop(); //msleep(500); //connect next washer set_servo_position(power, 1625); //1575 create_stop(); msleep(1000); //added create_drive_direct(150,150); msleep(1800); //1350 1600 1700 create_stop(); msleep(250); //disconnect from washer set_servo_position(power, 1800); create_spin_CW(200); msleep(480); set_servo_position(power, 800); create_drive_direct(100,100); msleep(500); //back up and sweep EVERYTHING create_spin_CCW(200); msleep(480); //check the gray and black line is passed before turning while (analog(0) < 2500){ create_drive_direct(-200,-200); } msleep(333); while (analog(1) > 2500){ create_drive_direct(-200,-200); } create_stop(); //turn to align with the gray and black line create_spin_CW(200); msleep(500); while (timer < 55){ //to change time, add a zero to however many seconds you want it to double line follow //80 if (analog(0) > 2500 && analog(1) > 2500){ create_drive_direct(-250,-250); msleep(100); timer = timer + 1; } else if (analog(0) > 2500 && analog(1) < 2500){ create_drive_direct(0,-250); msleep(100); timer = timer + .5; } else if (analog(0) < 2500 && analog(1) > 2500) { create_drive_direct(-250,0); msleep(100); timer = timer + .5; } else{ create_drive_direct(-250,-125); msleep(100); timer = timer + .5; } } create_stop(); timer = 0; camera_open_black(); msleep(1000); while (timer < 50){ camera_update(); msleep(2); timer = timer + 1; } if (get_object_area(0,0) >=50) //turn if it sees an object 100 { create_drive_direct(0,-200); msleep(800); create_drive_direct(-200,-200); msleep(2500); create_drive_direct(200,200); msleep(2500); create_drive_direct(0,200); msleep(800); } else { create_drive_direct(-200,-200); msleep(1700); create_drive_direct(200,200); msleep(1700); } camera_close(); timer = 0; create_stop(); //give minibot some time create_drive_direct(400,400); msleep(1500); //2500 create_spin_CCW(200); msleep(960); create_drive_direct(-200,-200); msleep(4000); create_stop(); msleep(20000); //drive to people 1 set_servo_position(power,1575); create_drive_direct(200,200); msleep(1000); create_spin_CCW(200); msleep(960); create_drive_direct(400,400); msleep(1000); //2500 create_spin_CW(200); msleep(960); create_drive_direct(-200,-200); msleep(1000); create_drive_direct(400,400); msleep(1000); //1700 //sweep the platforms set_servo_position(people,400); msleep(500); create_drive_direct(200,200); msleep(750); set_servo_position(people,300); msleep(500); create_drive_direct(200,200); msleep(1200); //set_servo_position(people, printf("Create Batter Power after: %d",get_create_battery_charge()); return 0; }
25.408907
115
0.582059
[ "object" ]
4152729fb682597b158b045022b082916eebf371
3,194
h
C
includes/Point2D.h
mtrebi/Rasterizer
75ade449cd873552ededb86af62b2f867410d08d
[ "MIT" ]
74
2018-02-12T13:37:32.000Z
2022-03-20T01:16:44.000Z
includes/Point2D.h
mtrebi/Rasterizer
75ade449cd873552ededb86af62b2f867410d08d
[ "MIT" ]
3
2020-01-07T08:18:22.000Z
2020-10-12T16:43:47.000Z
includes/Point2D.h
mtrebi/Rasterizer
75ade449cd873552ededb86af62b2f867410d08d
[ "MIT" ]
21
2018-07-27T11:00:54.000Z
2022-02-12T14:07:11.000Z
#ifndef __POINT_2D__ #define __POINT_2D__ // Copyright (C) Kevin Suffern 2000-2007. // This C++ code is for non-commercial purposes only. // This C++ code is licensed under the GNU General Public License Version 2. // See the file COPYING.txt for the full license. // 2D points are used to store sample points #include "Vector2D.h" class Point2D { public: double x, y; public: Point2D(void); Point2D(const double arg); Point2D(const double x1, const double y1); Point2D(const Point2D& p); ~Point2D(void); Point2D& // assignment operator operator= (const Point2D& p); Point2D // unary minus operator- (void) const; Vector2D // vector joining two points operator- (const Point2D& p) const; Point2D // addition of a vector operator+ (const Vector2D& v) const; Point2D // subtraction of a vector operator- (const Vector2D& v) const; Point2D // multiplication by a double on the right operator* (const double a) const; double // square of distance bertween two points d_squared(const Point2D& p) const; double // distance bewteen two points distance(const Point2D& p) const; }; // inlined member functions // -------------------------------------------------------------- operator- // unary minus inline Point2D Point2D::operator- (void) const { return (Point2D(-x, -y)); } // -------------------------------------------------------------- operator- // the vector that joins two points inline Vector2D Point2D::operator- (const Point2D& p) const { return (Vector2D(x - p.x, y - p.y)); } // -------------------------------------------------------------- operator+ // addition of a vector to a point that returns a new point inline Point2D Point2D::operator+ (const Vector2D& v) const { return (Point2D(x + v.x, y + v.y)); } // -------------------------------------------------------------- operator- // subtraction of a vector from a point that returns a new point inline Point2D Point2D::operator- (const Vector2D& v) const { return (Point2D(x - v.x, y - v.y)); } // -------------------------------------------------------------- operator* // mutliplication by a double on the right inline Point2D Point2D::operator* (const double a) const { return (Point2D(x * a, y * a)); } // -------------------------------------------------------------- d_squared // the square of the distance between the two points as a member function inline double Point2D::d_squared(const Point2D& p) const { return ((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y)); } // inlined non-member function // -------------------------------------------------------------- operator* // multiplication by a double on the left Point2D // prototype operator* (double a, const Point2D& p); inline Point2D operator* (double a, const Point2D& p) { return (Point2D(a * p.x, a * p.y)); } #endif
25.149606
77
0.516594
[ "vector" ]
4166a007d68688f115005508c8afa0b7cee309ff
1,534
h
C
src/type/graphics_types.h
sdsmith/raytracer
f7c57fd272c798eabb455258c0056bfaec1bbd4c
[ "MIT" ]
null
null
null
src/type/graphics_types.h
sdsmith/raytracer
f7c57fd272c798eabb455258c0056bfaec1bbd4c
[ "MIT" ]
23
2018-07-11T06:34:46.000Z
2018-11-11T05:12:37.000Z
src/type/graphics_types.h
sdsmith/raytracer
f7c57fd272c798eabb455258c0056bfaec1bbd4c
[ "MIT" ]
null
null
null
#pragma once #include "math/ray.h" #include "math/vec3.h" #include "scene/scene.h" #include <memory> #include <ostream> #include <vector> struct Viewport { public: unsigned width; //!< pixel width unsigned height; //!< pixel height float aspect_ratio() const; }; std::ostream& operator<<(std::ostream& os, Viewport const& viewport); // TODO(sdsmith): move to Raytracer struct Config { public: unsigned rand_seed; //!< seed for randomization Viewport viewport; //!< viewport Ray eye; //!< eye position and look direction Vec3 up; //!< up direction float vert_fov; //!< vertical field of view (in degrees) float aperture; //!< aperture diameter float dist_to_focus; //!< camera focus distance unsigned aa_sample_size; //!< anti-aliasing sample size per pixel unsigned max_ray_depth; //!< max ray iterations per pixel std::unique_ptr<Scene> scene; //!< scene to raytrace std::string image_file_name; //!< output image file name unsigned num_threads; //!< number of threads to raytrace with Time_Interval shutter_interval; //!< time interval for the camera shutter }; std::ostream& operator<<(std::ostream& os, Config const& cfg); struct Rbg_Frame { public: using Row = std::vector<Vec3>; std::vector<Row> pixels = {}; //!< [row][column] Rbg_Frame(unsigned height, unsigned width); Rbg_Frame(Viewport const& viewport); unsigned height() const; unsigned width() const; };
30.078431
77
0.654498
[ "vector" ]
4169f1d261d590b71aadf15cd1586439bc187493
2,524
h
C
hyperUI/include/StandardUI/UIHistogram.h
sadcatsoft/hyperui
f26242a9034ad1e0abf54bd7691fe48809262f5b
[ "MIT" ]
2
2019-05-17T16:16:21.000Z
2019-08-21T20:18:22.000Z
hyperUI/python/dist/mac/hyperui/HyperUI.framework/Versions/A/Headers/StandardUI/UIHistogram.h
sadcatsoft/hyperui
f26242a9034ad1e0abf54bd7691fe48809262f5b
[ "MIT" ]
1
2018-10-18T22:05:12.000Z
2018-10-18T22:05:12.000Z
hyperUI/python/dist/mac/hyperui/HyperUI.framework/Versions/A/Headers/StandardUI/UIHistogram.h
sadcatsoft/hyperui
f26242a9034ad1e0abf54bd7691fe48809262f5b
[ "MIT" ]
null
null
null
#pragma once class UIHistogram; /*****************************************************************************/ struct HYPERUI_API SHistSDataSeries { SHistSDataSeries() { myVertexInfo = NULL; myNumVerts = 0; myIsVisible = true; } ~SHistSDataSeries() { clear(); } void clear() { delete[] myVertexInfo; myVertexInfo = NULL; myNumVerts = 0; } void recomputeGeometry(UIHistogram* pHistogram, const SRect2D& srWindowRect); SVertexInfo* getGeometry(UIHistogram* pHistogram, const SRect2D& srWindowRect, int &iNumVertsOut); TRawHistDataEntries myData; SColor myColor; SRect2D myCachedRect; PathTrail myLine; SVertexInfo* myVertexInfo; int myNumVerts; bool myIsVisible; HyperUI::ChannelType myChannelType; static ColorPolyline2D thePolyline; static THistDataEntries theChannelMap; }; typedef vector < SHistSDataSeries* > THistDataSeries; /*****************************************************************************/ class HYPERUI_API UIHistogram: public UIElement { public: DECLARE_STANDARD_UIELEMENT_NO_DESTRUCTOR_DEF(UIHistogram, UiElemHistogram); virtual void onDeallocated(void); virtual void postRender(const SVector2D& svScroll, FLOAT_TYPE fOpacity, FLOAT_TYPE fScale); void clearDataSeries(); void setShowChannels(int iChannels); void setShowForSingleChannel(HyperUI::ChannelType eChannel, bool bIsVisible); bool getIsChannelShown(int iChannels); virtual bool handleAction(string& strAction, UIElement* pSourceElem, IBaseObject* pData); FLOAT_TYPE compressHistogramPixelCounts(const TRawHistDataEntries& rChannelIn, int iMaxBuckets, THistDataEntries& rChannelOut); virtual void updateOwnData(SUpdateInfo& rRefreshInfo); virtual FLOAT_TYPE getMaxRangeValue() const { return 255.0; } //boost::recursive_mutex& getLock() { return myHistogramDataLock; } Mutex& getLock() { return myHistogramDataLock; } protected: void addDataSeries(const TRawHistDataEntries& rData, const SColor* scolOptColor = NULL, HyperUI::ChannelType eChannel = ChannelLastPlaceholder); void syncChannelVisibilityWithUIValues(); private: void recomputeDataSeriesGeometry(); int generateLineTentKernel(int iKernelSize, TFloatTypeLossyDynamicArray& rKernelOut); private: THistDataSeries myDataSeries; //boost::recursive_mutex myHistogramDataLock; Mutex myHistogramDataLock; TFloatTypeLossyDynamicArray *theSmoothingKernel; int thePrevKernelSize; }; /*****************************************************************************/
34.575342
146
0.709984
[ "vector" ]
41868f2102258b939b012029ae35313399921302
7,904
h
C
Vc/common/simdarrayfwd.h
C3NZ/vc-fork
354d8a6612b38eb9732cb8ff754f58aea687ff09
[ "BSD-3-Clause" ]
1,252
2015-05-26T19:15:12.000Z
2022-03-31T19:19:50.000Z
Vc/common/simdarrayfwd.h
C3NZ/vc-fork
354d8a6612b38eb9732cb8ff754f58aea687ff09
[ "BSD-3-Clause" ]
293
2015-07-01T11:58:24.000Z
2022-03-31T15:04:03.000Z
Vc/common/simdarrayfwd.h
C3NZ/vc-fork
354d8a6612b38eb9732cb8ff754f58aea687ff09
[ "BSD-3-Clause" ]
162
2015-06-06T09:12:36.000Z
2022-03-17T08:47:02.000Z
/* This file is part of the Vc library. {{{ Copyright © 2014-2015 Matthias Kretz <kretz@kde.org> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the names of contributing organizations 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 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. }}}*/ #ifndef VC_COMMON_SIMDARRAYFWD_H_ #define VC_COMMON_SIMDARRAYFWD_H_ #include "../scalar/types.h" #include "../sse/types.h" #include "../avx/types.h" #include "utility.h" #include "macros.h" namespace Vc_VERSIONED_NAMESPACE { // specialization of Vector for fixed_size<N> {{{ template <class T, int N> class Vector<T, simd_abi::fixed_size<N>> : public SimdArray<T, N> { using SimdArray<T, N>::SimdArray; public: // overload copy to force argument passing via the stack. This makes the type more // usable on ABI boundaries Vc_INTRINSIC Vector(const Vector &x) : SimdArray<T, N>(x) {} Vc_INTRINSIC Vector &operator=(const Vector &x) { SimdArray<T, N>::operator=(x); return *this; } Vector() = default; using abi_type = simd_abi::fixed_size<N>; using abi = abi_type; Vc_DEPRECATED("use Vector([](int n) { return n; }) instead of " "Vector::IndexesFromZero()") static Vector IndexesFromZero() { return Vector([](size_t i) -> T { return i; }); } Vc_DEPRECATED("use 0 instead of Vector::Zero()") static Vector Zero() { return 0; } Vc_DEPRECATED("use 1 instead of Vector::One()") static Vector One() { return 1; } }; template <class T, int N> class Mask<T, simd_abi::fixed_size<N>> : public SimdMaskArray<T, N> { using SimdMaskArray<T, N>::SimdMaskArray; public: // overload copy to force argument passing via the stack. This makes the type more // usable on ABI boundaries Vc_INTRINSIC Mask(const Mask &x) : SimdMaskArray<T, N>(x) {} Vc_INTRINSIC Mask &operator=(const Mask &x) { SimdMaskArray<T, N>::operator=(x); return *this; } Mask() = default; using abi_type = simd_abi::fixed_size<N>; using abi = abi_type; }; // }}} /** \internal * Simple traits for SimdArray to easily access internal types of non-atomic SimdArray * types. */ template <typename T, std::size_t N> struct SimdArrayTraits { static constexpr std::size_t N0 = Common::left_size<N>(); static constexpr std::size_t N1 = Common::right_size<N>(); using storage_type0 = fixed_size_simd<T, N0>; using storage_type1 = fixed_size_simd<T, N1>; }; template <typename T, std::size_t N, typename VectorType, std::size_t VectorSize> Vc_INTRINSIC_L typename SimdArrayTraits<T, N>::storage_type0 &internal_data0( SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R; template <typename T, std::size_t N, typename VectorType, std::size_t VectorSize> Vc_INTRINSIC_L typename SimdArrayTraits<T, N>::storage_type1 &internal_data1( SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R; template <typename T, std::size_t N, typename VectorType, std::size_t VectorSize> Vc_INTRINSIC_L const typename SimdArrayTraits<T, N>::storage_type0 &internal_data0( const SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R; template <typename T, std::size_t N, typename VectorType, std::size_t VectorSize> Vc_INTRINSIC_L const typename SimdArrayTraits<T, N>::storage_type1 &internal_data1( const SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R; template <typename T, std::size_t N, typename V> Vc_INTRINSIC_L V &internal_data(SimdArray<T, N, V, N> &x) Vc_INTRINSIC_R; template <typename T, std::size_t N, typename V> Vc_INTRINSIC_L const V &internal_data(const SimdArray<T, N, V, N> &x) Vc_INTRINSIC_R; namespace Traits { // is_fixed_size_simd {{{1 template <class T> struct is_fixed_size_simd : std::false_type { }; template <class T, int N> struct is_fixed_size_simd<fixed_size_simd<T, N>> : std::true_type { }; template <class T, int N> struct is_fixed_size_simd<fixed_size_simd_mask<T, N>> : std::true_type { }; // is_simd_vector_internal {{{1 template <class T, int N> struct is_simd_vector_internal<fixed_size_simd<T, N>> : is_valid_vector_argument<T> {}; // is_simd_mask_internal {{{1 template <class T, int N> struct is_simd_mask_internal<fixed_size_simd_mask<T, N>> : is_valid_vector_argument<T> {}; // is_atomic_simdarray_internal {{{1 template <typename T, std::size_t N, typename V> struct is_atomic_simdarray_internal<SimdArray<T, N, V, N>> : is_valid_vector_argument<T> {}; template <typename T, int N> struct is_atomic_simdarray_internal<fixed_size_simd<T, N>> : is_atomic_simdarray_internal<SimdArray<T, N>> { }; // is_atomic_simd_mask_array_internal {{{1 template <typename T, std::size_t N, typename V> struct is_atomic_simd_mask_array_internal<SimdMaskArray<T, N, V, N>> : is_valid_vector_argument<T> { }; template <typename T, int N> struct is_atomic_simd_mask_array_internal<fixed_size_simd_mask<T, N>> : is_atomic_simd_mask_array_internal<SimdMaskArray<T, N>> { }; // is_simdarray_internal {{{1 template <typename T, std::size_t N, typename VectorType, std::size_t M> struct is_simdarray_internal<SimdArray<T, N, VectorType, M>> : is_valid_vector_argument<T> { }; template <typename T, int N> struct is_simdarray_internal<fixed_size_simd<T, N>> : is_valid_vector_argument<T> { }; // is_simd_mask_array_internal {{{1 template <typename T, std::size_t N, typename VectorType, std::size_t M> struct is_simd_mask_array_internal<SimdMaskArray<T, N, VectorType, M>> : is_valid_vector_argument<T> { }; template <typename T, int N> struct is_simd_mask_array_internal<fixed_size_simd_mask<T, N>> : is_valid_vector_argument<T> { }; // is_integral_internal {{{1 template <typename T, std::size_t N, typename V, std::size_t M> struct is_integral_internal<SimdArray<T, N, V, M>, false> : std::is_integral<T> { }; // is_floating_point_internal {{{1 template <typename T, std::size_t N, typename V, std::size_t M> struct is_floating_point_internal<SimdArray<T, N, V, M>, false> : std::is_floating_point<T> { }; // is_signed_internal {{{1 template <typename T, std::size_t N, typename V, std::size_t M> struct is_signed_internal<SimdArray<T, N, V, M>, false> : std::is_signed<T> { }; // is_unsigned_internal {{{1 template <typename T, std::size_t N, typename V, std::size_t M> struct is_unsigned_internal<SimdArray<T, N, V, M>, false> : std::is_unsigned<T> { }; // has_no_allocated_data_impl {{{1 template <typename T, std::size_t N> struct has_no_allocated_data_impl<Vc::SimdArray<T, N>> : std::true_type { }; // }}}1 } // namespace Traits } // namespace Vc #endif // VC_COMMON_SIMDARRAYFWD_H_ // vim: foldmethod=marker
37.459716
92
0.733679
[ "vector" ]
418f7e04af10bbea0cbf9228028fa0ab049b2576
31,954
c
C
recc/recc-implementation/libbootstrap.c
oscourse-tsinghua/OS2018spring-projects-g02
4adfd1c00096b1ff804a5874d9c400043a087d92
[ "MIT" ]
249
2015-04-01T01:25:41.000Z
2022-03-02T03:40:33.000Z
recc/recc-implementation/libbootstrap.c
Hoblovski/OS2018spring-projects-g02
6a4894a1114848b064bcb847362a1f62746b3337
[ "MIT" ]
7
2015-07-03T19:44:04.000Z
2021-07-19T21:25:40.000Z
recc/recc-implementation/libbootstrap.c
Hoblovski/OS2018spring-projects-g02
6a4894a1114848b064bcb847362a1f62746b3337
[ "MIT" ]
22
2015-07-02T08:54:45.000Z
2020-03-18T09:55:19.000Z
/* Copyright 2016 Robert Elder Software Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "libbootstrap.h" #include <stdio.h> #include <stdarg.h> /* An executable is created from this file that takes care of creating all of the specific .c and .h files from generic template .c and .h files. This provides basic data structures for types like map, list that are statically typed. */ struct binary_exponential_buffer create_identifier_friendly_type(unsigned char *); void add_object_build_rule(struct bootstrap_state * state, unsigned char *, unsigned char *); void add_library_dependency_rule(struct bootstrap_state * state, unsigned char *, unsigned char *); void add_file_dependency_rule(struct bootstrap_state * state, unsigned char *, unsigned char *); struct binary_exponential_buffer * make_file_path(unsigned char *); unsigned char * deep_copy_string(unsigned char *); const char * get_file_postfix(enum generated_file_type); const char * get_generic_filename_str(enum generated_file_type); void add_templated_file(struct files_for_type *, unsigned char *, const char *, const char *, const char *, const char *, const char *, struct binary_exponential_buffer, unsigned int, enum templated_file_type); void add_generated_file(struct files_for_type *, const char *, const char *, const char *, const char *, enum templated_file_type); static const char * generated_location = "generated/"; const char * get_file_postfix(enum generated_file_type type){ switch(type){ case GENERATED_FILE_TYPE_MAP_HEADER:{ return "map"; }case GENERATED_FILE_TYPE_MAP_ALGORITHM:{ return "map"; }case GENERATED_FILE_TYPE_MAP_TYPE:{ return "map"; }case GENERATED_FILE_TYPE_LIST_HEADER:{ return "list"; }case GENERATED_FILE_TYPE_LIST_ALGORITHM:{ return "list"; }case GENERATED_FILE_TYPE_LIST_TYPE:{ return "list"; }case GENERATED_FILE_TYPE_BINARY_SEARCH_HEADER:{ return "binary_search"; }case GENERATED_FILE_TYPE_BINARY_SEARCH_ALGORITHM:{ return "binary_search"; }case GENERATED_FILE_TYPE_MERGE_SORT_HEADER:{ return "merge_sort"; }case GENERATED_FILE_TYPE_MERGE_SORT_ALGORITHM:{ return "merge_sort"; }case GENERATED_FILE_TYPE_KEY_VALUE_PAIR_TYPE:{ return "key_value_pair"; }case GENERATED_FILE_TYPE_MEMORY_POOL_HEADER:{ return "memory_pool"; }case GENERATED_FILE_TYPE_MEMORY_POOL_ALGORITHM:{ return "memory_pool"; }case GENERATED_FILE_TYPE_MEMORY_POOL_TYPE:{ return "memory_pool"; }case GENERATED_FILE_TYPE_COMPARE_HEADER:{ return "compare"; }case GENERATED_FILE_TYPE_COMPARE_ALGORITHM:{ return "compare"; }default:{ assert(0); return (const char *)0; } } } const char * get_generic_filename_str(enum generated_file_type type){ switch(type){ case GENERATED_FILE_TYPE_MAP_HEADER:{ return "T0_IDENTIFIER_to_T1_IDENTIFIER_"; }case GENERATED_FILE_TYPE_MAP_ALGORITHM:{ return "T0_IDENTIFIER_to_T1_IDENTIFIER_"; }case GENERATED_FILE_TYPE_MAP_TYPE:{ return "T0_IDENTIFIER_to_T1_IDENTIFIER_"; }case GENERATED_FILE_TYPE_LIST_HEADER:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_LIST_ALGORITHM:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_LIST_TYPE:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_BINARY_SEARCH_HEADER:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_BINARY_SEARCH_ALGORITHM:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_MERGE_SORT_HEADER:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_MERGE_SORT_ALGORITHM:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_KEY_VALUE_PAIR_TYPE:{ return "T0_IDENTIFIER_to_T1_IDENTIFIER_"; }case GENERATED_FILE_TYPE_MEMORY_POOL_HEADER:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_MEMORY_POOL_ALGORITHM:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_MEMORY_POOL_TYPE:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_COMPARE_HEADER:{ return "T0_IDENTIFIER_"; }case GENERATED_FILE_TYPE_COMPARE_ALGORITHM:{ return "T0_IDENTIFIER_"; }default:{ assert(0); return (const char *)0; } } } void add_templated_file(struct files_for_type * files_for_type, unsigned char * template_file, const char * outfile_prefix, const char * file_extension, const char * file_postfix, const char * generic_filename_str, const char * relative_location, struct binary_exponential_buffer header_files, unsigned int is_header, enum templated_file_type type){ /* Build the filename of the input and output file we want to generate later. */ unsigned int i; unsigned int num_literal_types = binary_exponential_buffer_size(&files_for_type->literal_type_names); unsigned char ** types = (unsigned char **)binary_exponential_buffer_data(&files_for_type->literal_type_names); struct templated_file * f = (struct templated_file *)malloc(sizeof(struct templated_file)); struct replacement_context * filename_context = replacement_context_create(); f->type = type; f->is_header = is_header; f->header_files = header_files; f->relative_location = (unsigned char *)relative_location; f->type_name = (unsigned char *)file_postfix; f->type_1_literal = types[0]; f->type_2_literal = (num_literal_types > 1) ? types[1] : (unsigned char *)0; binary_exponential_buffer_create(&f->in_file, sizeof(unsigned char)); binary_exponential_buffer_create(&f->out_file, sizeof(unsigned char)); add_string_to_binary_exponential_buffer_with_null_terminator((void*)template_file, &f->in_file); add_string_to_binary_exponential_buffer((void*)generated_location, &filename_context->in_characters); add_string_to_binary_exponential_buffer((void*)outfile_prefix, &filename_context->in_characters); add_string_to_binary_exponential_buffer((void*)generic_filename_str, &filename_context->in_characters); add_string_to_binary_exponential_buffer((void*)file_postfix, &filename_context->in_characters); add_string_to_binary_exponential_buffer_with_null_terminator((void*)file_extension, &filename_context->in_characters); for(i = 0; i < binary_exponential_buffer_size(&files_for_type->replacement_rules); i++){ struct replacement_rule ** d = (struct replacement_rule **)binary_exponential_buffer_data(&files_for_type->replacement_rules); replacement_context_associate_replacement(filename_context, d[i]); } do_string_replacements(filename_context); add_buffer_to_binary_exponential_buffer(&filename_context->out_characters, &f->out_file); /* Add the new file generation rule */ binary_exponential_buffer_increment(&files_for_type->files, 1); ((struct templated_file **)binary_exponential_buffer_data(&files_for_type->files))[binary_exponential_buffer_size(&files_for_type->files) -1] = f; replacement_context_destroy(filename_context); } void add_generated_file(struct files_for_type * files_for_type, const char * source_file_extension, const char * outfile_extension, const char * file_postfix, const char * generic_filename_str, enum templated_file_type type){ unsigned int i; unsigned int num_literal_types = binary_exponential_buffer_size(&files_for_type->literal_type_names); unsigned char ** types = (unsigned char **)binary_exponential_buffer_data(&files_for_type->literal_type_names); struct templated_file * f = (struct templated_file *)malloc(sizeof(struct templated_file)); struct replacement_context * in_filename_context = replacement_context_create(); struct replacement_context * out_filename_context = replacement_context_create(); f->type = type; f->is_header = 0; f->header_files = make_beb_list(0); f->relative_location = (unsigned char *)""; f->type_name = (unsigned char *)file_postfix; f->type_1_literal = types[0]; f->type_2_literal = (num_literal_types > 1) ? types[1] : (unsigned char *)0; binary_exponential_buffer_create(&f->in_file, sizeof(unsigned char)); binary_exponential_buffer_create(&f->out_file, sizeof(unsigned char)); add_string_to_binary_exponential_buffer((void*)generated_location, &in_filename_context->in_characters); add_string_to_binary_exponential_buffer((void*)generic_filename_str, &in_filename_context->in_characters); add_string_to_binary_exponential_buffer((void*)file_postfix, &in_filename_context->in_characters); add_string_to_binary_exponential_buffer_with_null_terminator((void*)source_file_extension, &in_filename_context->in_characters); add_string_to_binary_exponential_buffer((void*)generated_location, &out_filename_context->in_characters); add_string_to_binary_exponential_buffer((void*)generic_filename_str, &out_filename_context->in_characters); add_string_to_binary_exponential_buffer((void*)file_postfix, &out_filename_context->in_characters); add_string_to_binary_exponential_buffer_with_null_terminator((void*)outfile_extension, &out_filename_context->in_characters); for(i = 0; i < binary_exponential_buffer_size(&files_for_type->replacement_rules); i++){ struct replacement_rule ** d = (struct replacement_rule **)binary_exponential_buffer_data(&files_for_type->replacement_rules); replacement_context_associate_replacement(in_filename_context, d[i]); replacement_context_associate_replacement(out_filename_context, d[i]); } do_string_replacements(in_filename_context); do_string_replacements(out_filename_context); add_buffer_to_binary_exponential_buffer(&in_filename_context->out_characters, &f->in_file); add_buffer_to_binary_exponential_buffer(&out_filename_context->out_characters, &f->out_file); /* Add the new file generation rule */ binary_exponential_buffer_increment(&files_for_type->files, 1); ((struct templated_file **)binary_exponential_buffer_data(&files_for_type->files))[binary_exponential_buffer_size(&files_for_type->files) -1] = f; replacement_context_destroy(in_filename_context); replacement_context_destroy(out_filename_context); } struct files_for_type * make_files_for_type(enum generated_file_type type, const char * template_file, struct binary_exponential_buffer literal_type_names, struct binary_exponential_buffer headers){ struct files_for_type * files_for_type = (struct files_for_type *)malloc(sizeof(struct files_for_type)); const char * generic_filename_str = get_generic_filename_str(type); const char * file_postfix = get_file_postfix(type); binary_exponential_buffer_create(&files_for_type->files, sizeof(struct templated_file *)); binary_exponential_buffer_create(&files_for_type->replacement_rules, sizeof(struct replacement_rule *)); files_for_type->literal_type_names = literal_type_names; make_type_replacement_rules(&files_for_type->replacement_rules, &files_for_type->literal_type_names); binary_exponential_buffer_increment(&headers, 1); ((unsigned char **)binary_exponential_buffer_data(&headers))[binary_exponential_buffer_size(&headers) -1] = (unsigned char *)"recc-implementation/binary_exponential_buffer.h"; switch(type){ case GENERATED_FILE_TYPE_MAP_ALGORITHM:; case GENERATED_FILE_TYPE_LIST_ALGORITHM:; case GENERATED_FILE_TYPE_BINARY_SEARCH_ALGORITHM:; case GENERATED_FILE_TYPE_MERGE_SORT_ALGORITHM:;case GENERATED_FILE_TYPE_MEMORY_POOL_ALGORITHM:;case GENERATED_FILE_TYPE_COMPARE_ALGORITHM:{ add_templated_file(files_for_type, (unsigned char *)template_file, "", ".c", file_postfix, generic_filename_str, "../", headers, 0, TEMPLATED_FILE_TYPE_C_SOURCE); add_generated_file(files_for_type, ".c", ".i", file_postfix, generic_filename_str, TEMPLATED_FILE_TYPE_I_FILE); add_generated_file(files_for_type, ".i", ".l2", file_postfix, generic_filename_str, TEMPLATED_FILE_TYPE_I_TO_L2); add_generated_file(files_for_type, ".c", ".o", file_postfix, generic_filename_str, TEMPLATED_FILE_TYPE_C_TO_O); break; }case GENERATED_FILE_TYPE_MAP_HEADER:; case GENERATED_FILE_TYPE_LIST_HEADER:; case GENERATED_FILE_TYPE_BINARY_SEARCH_HEADER:; case GENERATED_FILE_TYPE_MERGE_SORT_HEADER:;case GENERATED_FILE_TYPE_MEMORY_POOL_HEADER:;case GENERATED_FILE_TYPE_COMPARE_HEADER:{ add_templated_file(files_for_type, (unsigned char *)template_file, "", ".h", file_postfix, generic_filename_str, "../" , headers, 1, TEMPLATED_FILE_TYPE_C_SOURCE); break; }case GENERATED_FILE_TYPE_MAP_TYPE:; case GENERATED_FILE_TYPE_LIST_TYPE:; case GENERATED_FILE_TYPE_KEY_VALUE_PAIR_TYPE:; case GENERATED_FILE_TYPE_MEMORY_POOL_TYPE:{ add_templated_file(files_for_type, (unsigned char *)template_file, "struct_", ".h", file_postfix, generic_filename_str, "../", headers, 1, TEMPLATED_FILE_TYPE_C_SOURCE); break; }default:{ assert(0); } } return files_for_type; } void bootstrap_state_create(struct bootstrap_state * state){ state->library_data_structures_filename = make_file_path((unsigned char*)"library-data-structures"); state->object_data_structures_filename = make_file_path((unsigned char*)"object-data-structures"); state->file_dependencies_data_structures_filename = make_file_path((unsigned char*)"file-dependencies-data-structures"); binary_exponential_buffer_create(&state->object_makefile, sizeof(unsigned char)); binary_exponential_buffer_create(&state->library_dependency, sizeof(unsigned char)); binary_exponential_buffer_create(&state->file_dependencies, sizeof(unsigned char)); add_string_to_binary_exponential_buffer((void*)"DATA_STRUCTURES_OBJECT_FILES=", &state->library_dependency); } void bootstrap_state_destroy(struct bootstrap_state * state){ binary_exponential_buffer_destroy(state->library_data_structures_filename); binary_exponential_buffer_destroy(state->object_data_structures_filename); binary_exponential_buffer_destroy(state->file_dependencies_data_structures_filename); free(state->library_data_structures_filename); free(state->object_data_structures_filename); free(state->file_dependencies_data_structures_filename); binary_exponential_buffer_destroy(&state->object_makefile); binary_exponential_buffer_destroy(&state->library_dependency); binary_exponential_buffer_destroy(&state->file_dependencies); } void bootstrap_state_output_makefiles(struct bootstrap_state * state, const char * current_exec){ add_string_to_binary_exponential_buffer((void*)": ", &state->file_dependencies); add_string_to_binary_exponential_buffer((void*)current_exec, &state->file_dependencies); output_binary_exponential_buffer_to_file(&state->library_dependency, (unsigned char *)binary_exponential_buffer_data(state->library_data_structures_filename)); output_binary_exponential_buffer_to_file(&state->object_makefile, (unsigned char *)binary_exponential_buffer_data(state->object_data_structures_filename)); output_binary_exponential_buffer_to_file(&state->file_dependencies, (unsigned char *)binary_exponential_buffer_data(state->file_dependencies_data_structures_filename)); } void add_unsigned_int_to_binary_exponential_buffer(unsigned int, struct binary_exponential_buffer *); void add_unsigned_int_to_binary_exponential_buffer(unsigned int unsigned_d, struct binary_exponential_buffer * buffer){ unsigned int leading_zero = 1; unsigned int base = 1000000000; unsigned int digit = 0; if(unsigned_d == 0){ binary_exponential_buffer_increment(buffer, 1); ((unsigned char *)binary_exponential_buffer_data(buffer))[binary_exponential_buffer_size(buffer) -1] = (unsigned char)'0'; } while(base){ digit = unsigned_d / base; if(digit){ binary_exponential_buffer_increment(buffer, 1); ((unsigned char *)binary_exponential_buffer_data(buffer))[binary_exponential_buffer_size(buffer) -1] = (unsigned char)('0' + (int)digit); leading_zero = 0; }else{ if(!leading_zero){ binary_exponential_buffer_increment(buffer, 1); ((unsigned char *)binary_exponential_buffer_data(buffer))[binary_exponential_buffer_size(buffer) -1] = (unsigned char)('0' + (int)digit); } } unsigned_d = unsigned_d - (base * digit); base /= 10; } } int add_file_to_binary_exponential_buffer(struct binary_exponential_buffer * buffer, unsigned char * in_file){ FILE *f = NULL; int c = 0; if(!(f = fopen((char *)in_file, "rb"))){ printf("Failed to open file %s for read.\n", in_file); assert(0); return 1; } while (c != EOF) { c = getc(f); if(c == EOF) break; binary_exponential_buffer_increment(buffer, 1); ((unsigned char *)binary_exponential_buffer_data(buffer))[binary_exponential_buffer_size(buffer) -1] = (unsigned char)c; } fclose(f); return 0; } int output_binary_exponential_buffer_to_file(struct binary_exponential_buffer * buffer, unsigned char * out_file){ FILE *f = NULL; unsigned char * data = (unsigned char *)binary_exponential_buffer_data(buffer); unsigned int size = binary_exponential_buffer_size(buffer); unsigned int i; if(!(f = fopen((char *)out_file, "w"))){ printf("Failed to open file %s for write.\n", out_file); assert(0); return 1; } for(i = 0; i < size; i++){ fputc ( data[i] , f); } fclose(f); return 0; } void add_object_build_rule(struct bootstrap_state * state, unsigned char * outfile, unsigned char * infile){ add_string_to_binary_exponential_buffer(outfile, &state->object_makefile); add_string_to_binary_exponential_buffer((void*)": ", &state->object_makefile); add_string_to_binary_exponential_buffer(infile, &state->object_makefile); add_string_to_binary_exponential_buffer((void*)"\n\t@$(HOSTCC) -c ", &state->object_makefile); add_string_to_binary_exponential_buffer(infile, &state->object_makefile); add_string_to_binary_exponential_buffer((void*)" -o ", &state->object_makefile); add_string_to_binary_exponential_buffer(outfile, &state->object_makefile); add_string_to_binary_exponential_buffer((void*)" $(CUSTOM_C89_FLAGS)\n\n", &state->object_makefile); } void add_library_dependency_rule(struct bootstrap_state * state, unsigned char * outfile, unsigned char * infile){ add_string_to_binary_exponential_buffer(outfile, &state->library_dependency); add_string_to_binary_exponential_buffer((void*)" ", &state->library_dependency); (void)infile; } void add_file_dependency_rule(struct bootstrap_state * state, unsigned char * outfile, unsigned char * infile){ add_string_to_binary_exponential_buffer(infile, &state->file_dependencies); add_string_to_binary_exponential_buffer((void*)" ", &state->file_dependencies); (void)outfile; } void add_string_to_binary_exponential_buffer(void * dest, struct binary_exponential_buffer * b){ unsigned int i = 0; unsigned char * str = (unsigned char *)dest; while(*str){ binary_exponential_buffer_increment(b, 1); ((unsigned char *)binary_exponential_buffer_data(b))[binary_exponential_buffer_size(b) -1] = *str; i++; str++; } } void add_buffer_to_binary_exponential_buffer(struct binary_exponential_buffer * src, struct binary_exponential_buffer * dest){ unsigned int src_size = binary_exponential_buffer_size(src); unsigned int i = 0; assert(binary_exponential_buffer_element_size(src) == sizeof(unsigned char) && binary_exponential_buffer_element_size(dest) == sizeof(unsigned char)); while(i < src_size){ unsigned char c = ((unsigned char *)binary_exponential_buffer_data(src))[i]; binary_exponential_buffer_increment(dest, 1); ((unsigned char *)binary_exponential_buffer_data(dest))[binary_exponential_buffer_size(dest) -1] = c; i++; } } void add_string_to_binary_exponential_buffer_with_null_terminator(void * dest, struct binary_exponential_buffer * b){ add_string_to_binary_exponential_buffer(dest, b); binary_exponential_buffer_increment(b, 1); ((unsigned char *)binary_exponential_buffer_data(b))[binary_exponential_buffer_size(b) -1] = 0; } void add_char_ptr_to_list(void * ptr, struct binary_exponential_buffer * b){ binary_exponential_buffer_increment(b, 1); ((unsigned char **)binary_exponential_buffer_data(b))[binary_exponential_buffer_size(b) -1] = (unsigned char *)ptr; } struct binary_exponential_buffer create_identifier_friendly_type(unsigned char * type){ struct binary_exponential_buffer rtn; struct replacement_context * r = replacement_context_create(); struct replacement_rule * space_rule = replacement_rule_create(); struct replacement_rule * ptr_rule = replacement_rule_create(); replacement_context_associate_replacement(r, space_rule); replacement_context_associate_replacement(r, ptr_rule); add_string_to_binary_exponential_buffer_with_null_terminator(type, &r->in_characters); add_string_to_binary_exponential_buffer_with_null_terminator((void*)" ", &space_rule->search); add_string_to_binary_exponential_buffer_with_null_terminator((void*)"_", &space_rule->replace); add_string_to_binary_exponential_buffer_with_null_terminator((void*)"*", &ptr_rule->search); add_string_to_binary_exponential_buffer_with_null_terminator((void*)"ptr", &ptr_rule->replace); do_string_replacements(r); replacement_rule_destroy(space_rule); replacement_rule_destroy(ptr_rule); rtn = binary_exponential_buffer_copy(&r->out_characters); replacement_context_destroy(r); return rtn; } unsigned char * deep_copy_string(unsigned char * str){ unsigned int i = 0; unsigned int num_chars = 0; unsigned char * c = str; unsigned char * rtn; while(*c){ c++; num_chars++; } num_chars++; /* For null terminator */ rtn = (unsigned char *)malloc(num_chars*sizeof(unsigned char)); c = str; while(*c){ rtn[i] = *c; i++; c++; } rtn[i] = '\0'; return rtn; } void build_header_section(struct binary_exponential_buffer * files, struct binary_exponential_buffer * output, unsigned char * relative_location){ unsigned int i; /* Build the list of extra includes that this file requires */ add_string_to_binary_exponential_buffer((void*)"\n", output); for(i = 0; i < binary_exponential_buffer_size(files); i++){ unsigned char * dependency = ((unsigned char **)binary_exponential_buffer_data(files))[i]; printf("It has dependency %s.\n", dependency); add_include_guard(output, dependency); add_include(output, relative_location, dependency); add_endif(output); } add_string_to_binary_exponential_buffer_with_null_terminator((void*)"", output); } void make_type_replacement_rules(struct binary_exponential_buffer * rules, struct binary_exponential_buffer * types){ unsigned int i; unsigned int num_types = binary_exponential_buffer_size(types); unsigned char ** t = (unsigned char **)binary_exponential_buffer_data(types); for(i = 0; i < num_types; i++){ unsigned char * type = t[i]; struct replacement_rule * identifier_rule = replacement_rule_create(); struct replacement_rule * literal_rule = replacement_rule_create(); struct binary_exponential_buffer type_identifier = create_identifier_friendly_type(type); /* Replacement rule for identifier friendly version */ add_string_to_binary_exponential_buffer((void*)"T", &identifier_rule->search); add_unsigned_int_to_binary_exponential_buffer(i, &identifier_rule->search); add_string_to_binary_exponential_buffer_with_null_terminator((void*)"_IDENTIFIER", &identifier_rule->search); add_string_to_binary_exponential_buffer_with_null_terminator((void*)binary_exponential_buffer_data(&type_identifier), &identifier_rule->replace); /* Replacement rule for identifier literal version */ add_string_to_binary_exponential_buffer((void*)"T", &literal_rule->search); add_unsigned_int_to_binary_exponential_buffer(i, &literal_rule->search); add_string_to_binary_exponential_buffer_with_null_terminator((void*)"_LITERAL", &literal_rule->search); add_string_to_binary_exponential_buffer_with_null_terminator(type, &literal_rule->replace); binary_exponential_buffer_destroy(&type_identifier); binary_exponential_buffer_increment(rules, 1); ((struct replacement_rule **)binary_exponential_buffer_data(rules))[binary_exponential_buffer_size(rules) -1] = literal_rule; binary_exponential_buffer_increment(rules, 1); ((struct replacement_rule **)binary_exponential_buffer_data(rules))[binary_exponential_buffer_size(rules) -1] = identifier_rule; } } void make_generated_file(unsigned char * infile, unsigned char * outfile, unsigned char * relative_header_location, struct binary_exponential_buffer * header_files, struct binary_exponential_buffer * replacement_rules, unsigned int is_header){ struct replacement_context * r = replacement_context_create(); struct replacement_rule * header_rule = replacement_rule_create(); unsigned int i; replacement_context_associate_replacement(r, header_rule); for(i = 0; i < binary_exponential_buffer_size(replacement_rules); i++){ struct replacement_rule ** d = (struct replacement_rule **)binary_exponential_buffer_data(replacement_rules); replacement_context_associate_replacement(r, d[i]); } if(is_header){ add_include_guard(&r->in_characters, outfile); add_define_include_guard(&r->in_characters, outfile); } if(infile){ /* If there is no source file, assume it's just a generated header file. */ add_file_to_binary_exponential_buffer(&r->in_characters, infile); }else{ add_string_to_binary_exponential_buffer((unsigned char *)"/*GETS_REPLACED_WITH_INCLUDES*/", &r->in_characters); } if(is_header){ add_endif(&r->in_characters); } build_header_section(header_files, &header_rule->replace, relative_header_location); add_string_to_binary_exponential_buffer_with_null_terminator((unsigned char *)"/*GETS_REPLACED_WITH_INCLUDES*/", &header_rule->search); do_string_replacements(r); output_binary_exponential_buffer_to_file(&r->out_characters, outfile); replacement_rule_destroy(header_rule); replacement_context_destroy(r); } struct files_for_type * make_generated_files(struct bootstrap_state * b, struct files_for_type * files_for_type){ unsigned int i; struct templated_file ** data = (struct templated_file **)binary_exponential_buffer_data(&files_for_type->files); unsigned int num_files = binary_exponential_buffer_size(&files_for_type->files); (void)b; for(i = 0; i < num_files; i++){ struct templated_file * f = data[i]; switch(f->type){ case TEMPLATED_FILE_TYPE_C_SOURCE:{ struct binary_exponential_buffer file_literal_type_names; struct binary_exponential_buffer file_replacement_rules; unsigned int j; binary_exponential_buffer_create(&file_literal_type_names, sizeof(unsigned char *)); binary_exponential_buffer_create(&file_replacement_rules, sizeof(struct replacement_rule *)); binary_exponential_buffer_increment(&file_literal_type_names, 1); ((unsigned char **)binary_exponential_buffer_data(&file_literal_type_names))[binary_exponential_buffer_size(&file_literal_type_names) -1] = f->type_1_literal; if(f->type_2_literal){ binary_exponential_buffer_increment(&file_literal_type_names, 1); ((unsigned char **)binary_exponential_buffer_data(&file_literal_type_names))[binary_exponential_buffer_size(&file_literal_type_names) -1] = f->type_2_literal; } make_type_replacement_rules(&file_replacement_rules, &file_literal_type_names); make_generated_file((unsigned char *)binary_exponential_buffer_data(&f->in_file), (unsigned char *)binary_exponential_buffer_data(&f->out_file), f->relative_location, &f->header_files, &file_replacement_rules, f->is_header); for(j = 0; j < binary_exponential_buffer_size(&file_replacement_rules); j++){ struct replacement_rule ** d = (struct replacement_rule **)binary_exponential_buffer_data(&file_replacement_rules); replacement_rule_destroy(d[j]); } binary_exponential_buffer_destroy(&file_literal_type_names); binary_exponential_buffer_destroy(&file_replacement_rules); break; }case TEMPLATED_FILE_TYPE_C_TO_O:{ make_build_rules(b, (const char *)binary_exponential_buffer_data(&f->out_file), (const char *)binary_exponential_buffer_data(&f->in_file)); break; }default:{ /* Do nothing, used for later stages of compillation. */ } } } return files_for_type; } void cleanup_files_for_type(struct files_for_type * files_for_type){ unsigned int i; struct templated_file ** data = (struct templated_file **)binary_exponential_buffer_data(&files_for_type->files); unsigned int num_files = binary_exponential_buffer_size(&files_for_type->files); for(i = 0; i < num_files; i++){ struct templated_file * f = data[i]; binary_exponential_buffer_destroy(&f->in_file); binary_exponential_buffer_destroy(&f->out_file); binary_exponential_buffer_destroy(&f->header_files); free(f); } binary_exponential_buffer_destroy(&files_for_type->files); binary_exponential_buffer_destroy(&files_for_type->literal_type_names); for(i = 0; i < binary_exponential_buffer_size(&files_for_type->replacement_rules); i++){ struct replacement_rule ** d = (struct replacement_rule **)binary_exponential_buffer_data(&files_for_type->replacement_rules); replacement_rule_destroy(d[i]); } binary_exponential_buffer_destroy(&files_for_type->replacement_rules); free(files_for_type); } void make_build_rules(struct bootstrap_state * state, const char * outfile, const char * infile){ add_object_build_rule(state, (unsigned char *)outfile, (unsigned char *)infile); add_library_dependency_rule(state, (unsigned char *)outfile, (unsigned char *)infile); add_file_dependency_rule(state, (unsigned char *)outfile, (unsigned char *)infile); } struct binary_exponential_buffer * make_file_path(unsigned char * str){ struct binary_exponential_buffer * b = (struct binary_exponential_buffer *)malloc(sizeof(struct binary_exponential_buffer)); binary_exponential_buffer_create(b, sizeof(unsigned char)); add_string_to_binary_exponential_buffer((void*)"recc-implementation/", b); add_string_to_binary_exponential_buffer_with_null_terminator(str, b); return b; } void add_include_guard(struct binary_exponential_buffer * output, unsigned char * filename){ /* Make the include guard based on the file path name. */ add_string_to_binary_exponential_buffer((void *)"#ifndef ", output); add_filepath_macro(output, filename); add_string_to_binary_exponential_buffer((void *)"\n", output); } void add_define_include_guard(struct binary_exponential_buffer * output, unsigned char * filename){ /* Make the include guard based on the file path name. */ add_string_to_binary_exponential_buffer((void *)"#define ", output); add_filepath_macro(output, filename); add_string_to_binary_exponential_buffer((void *)"\n", output); } void add_include(struct binary_exponential_buffer * output, unsigned char * prefix, unsigned char * filename){ add_string_to_binary_exponential_buffer((void *)"#include \"", output); add_string_to_binary_exponential_buffer((void *)prefix, output); add_string_to_binary_exponential_buffer((void *)filename, output); add_string_to_binary_exponential_buffer((void *)"\"\n", output); } void add_filepath_macro(struct binary_exponential_buffer * output, unsigned char * filename){ unsigned char * c = filename; while(*c) { if(*c == '/'){ add_string_to_binary_exponential_buffer((void *)"_DIR_", output); }else if(*c == '.'){ add_string_to_binary_exponential_buffer((void *)"_DOT_", output); }else if(*c == '-'){ add_string_to_binary_exponential_buffer((void *)"_", output); }else{ unsigned char * bu; unsigned int indx; indx = binary_exponential_buffer_size(output); binary_exponential_buffer_increment(output, 1); bu = (unsigned char *)binary_exponential_buffer_data(output); bu[indx] = *c; } c++; } } void add_endif(struct binary_exponential_buffer * output){ unsigned char * c = (unsigned char *)"#endif\n"; add_string_to_binary_exponential_buffer((void *)c, output); }
49.009202
349
0.791732
[ "object" ]
41901e311108155cfb8e7d267d6f33411d689854
1,281
h
C
autode/ext/include/points.h
tlestang/autodE
56fd4c78e7d7e78c5747428190211ff69dc6d94a
[ "MIT" ]
90
2020-03-13T15:03:35.000Z
2022-03-14T13:41:04.000Z
autode/ext/include/points.h
skphy/autodE
fd80995206ac601299d2f78105d0fe4deee8c2cf
[ "MIT" ]
117
2020-06-13T00:11:06.000Z
2022-03-24T08:54:16.000Z
autode/ext/include/points.h
skphy/autodE
fd80995206ac601299d2f78105d0fe4deee8c2cf
[ "MIT" ]
26
2020-08-14T04:52:53.000Z
2022-03-06T13:04:17.000Z
#ifndef ADE_EXT_POINTS_H #define ADE_EXT_POINTS_H #include "vector" namespace autode { class CubePointGenerator { private: // Attributes std::vector<std::vector<double>> s_grad; std::vector<double> delta_point; // Constructor helpers void set_init_random_points(); void shift_box_centre(); // Distance functions void set_delta_point_pbc(int i, int j); double norm_squared_delta_point(); public: int dim = 0; int n = 0; double min_val = 0.0; double max_val = 1.0; double box_length = 1.0; double half_box_length = 0.5; // Gradient functions double norm_grad(); std::vector<std::vector<double>> points; explicit CubePointGenerator(); explicit CubePointGenerator(int n_points, int dimension, double min_val = -3.145, double max_val = 3.145); void set_grad(); void run(double grad_tol, double step_size, int max_iterations); }; } #endif //ADE_EXT_POINTS_H
26.6875
76
0.5121
[ "vector" ]
4198eb4d37c91bd0cdf74a3f1847f052ffa62321
2,409
h
C
course/include/matrix3.h
adevitturi/cppl1_q12020
916162e36a1cd78ab40cd5208dbe41459a65a993
[ "Apache-2.0" ]
null
null
null
course/include/matrix3.h
adevitturi/cppl1_q12020
916162e36a1cd78ab40cd5208dbe41459a65a993
[ "Apache-2.0" ]
1
2020-06-18T13:09:37.000Z
2020-06-18T13:09:37.000Z
course/include/matrix3.h
adevitturi/cppl1_q12020
916162e36a1cd78ab40cd5208dbe41459a65a993
[ "Apache-2.0" ]
null
null
null
#pragma once #include <vector> #include "vector3.h" namespace ekumen { namespace math { // Represents a 3x3 matrix in the real-domain. class Matrix3 { public: // The 3x3 identity matrix; static const Matrix3 kIdentity; // A 3x3 zero-filled matrix. static const Matrix3 kZero; // A 3x3 one-filled matrix. static const Matrix3 kOnes; Matrix3(); Matrix3(const Vector3& row0, const Vector3& row1, const Vector3& row2); Matrix3(const Matrix3& obj); Matrix3(Matrix3&& obj); Matrix3(std::initializer_list<double> matrix); Matrix3& operator=(const Matrix3& obj); Matrix3& operator=(Matrix3&& obj); // Member to member addition. Sums the corresponding components of two // matrices. Matrix3 operator+(const Matrix3& obj) const; // Member to member substraction. Substracts the corresponding components of // two matrices. Matrix3 operator-(const Matrix3& obj) const; // Member to member product. Multiplies the corresponding components of two // matrices. Matrix3 operator*(const Matrix3& obj) const; // Scales the matrix by a factor. Matrix3 operator*(const double& factor) const; // Scales the matrix by a factor. friend Matrix3 operator*(const double& factor, const Matrix3& obj); // Member to member division. Divides the corresponding components of two // matrices. Matrix3 operator/(const Matrix3& obj) const; bool operator==(const Matrix3& rhs) const; const Vector3& operator[](int index) const; Vector3& operator[](int index); // Serializes the matrix to a stream with the format: '[[a11, a12, a13], [a21, // a22, a23], [a31, a32, a33]]'. friend std::ostream& operator<<(std::ostream& os, const Matrix3& obj); // Gets a row by its index. const Vector3& row(int index) const; // Gets a column by its index. Vector3 col(int index) const; // Computes the determinant of the matrix. double det() const; // Computes the product of two Matrix3. Matrix3 product(const Matrix3& obj) const; // Computes the product bewteen a Matrix3 and a Vector3. Vector3 product(const Vector3& vector) const; // Computes the inverse of a Matrix3. Matrix3 inverse() const; private: // Checks that the index to access the member rows is in range. void assertValidAccessIndex(int index) const; static const int comparison_ulps = 5; std::vector<Vector3> rows_; }; } // namespace math } // namespace ekumen
26.766667
80
0.709838
[ "vector" ]
419f1e7438812780e3f017d09e527941f6e63923
4,003
h
C
winp/winp/event/event_manager.h
benbraide/winp
2a20b82708d239a93cc50f239798d69f7217c47b
[ "MIT" ]
null
null
null
winp/winp/event/event_manager.h
benbraide/winp
2a20b82708d239a93cc50f239798d69f7217c47b
[ "MIT" ]
null
null
null
winp/winp/event/event_manager.h
benbraide/winp
2a20b82708d239a93cc50f239798d69f7217c47b
[ "MIT" ]
null
null
null
#pragma once #include <functional> #include <unordered_map> #include "../thread/thread_object.h" #include "../utility/random_number.h" #include "event_object.h" namespace winp::event{ class manager_base{ protected: friend class ui::object; explicit manager_base(thread::item &owner) : owner_(owner){} virtual ~manager_base() = default; virtual std::size_t count_() const = 0; virtual void fire_generic_(object &e) const = 0; virtual void count_changed_(std::size_t previous_count){ owner_.event_handlers_count_changed_(*this, previous_count, count_()); } virtual thread::object &get_thread_(){ return owner_.thread_; } virtual unsigned __int64 get_owner_id_() const{ return owner_.id_; } thread::item &owner_; }; template <class owner_type, class object_type, class group_type> class manager : public manager_base{ public: using m_object_type = object_type; using m_callback_type = std::function<void(m_object_type &)>; using m_no_arg_callback_type = std::function<void()>; using m_map_type = std::unordered_map<unsigned __int64, m_callback_type>; unsigned __int64 operator +=(const m_callback_type &handler){ return bind(handler); } unsigned __int64 operator +=(const m_no_arg_callback_type &handler){ return bind(handler); } bool operator -=(unsigned __int64 id){ return unbind(id); } unsigned __int64 bind(const m_callback_type &handler, const std::function<void(manager_base &, unsigned __int64)> &callback = nullptr){ if (manager_base::get_thread_().is_thread_context()){ auto result = bind_(handler); if (callback != nullptr) callback(*this, result); return result; } if (callback != nullptr){ manager_base::get_thread_().queue.post([=]{ callback(*this, bind_(handler)); }, thread::queue::send_priority, manager_base::get_owner_id_()); return 0u; } return manager_base::get_thread_().queue.execute([=]{ return bind_(handler); }, thread::queue::send_priority, manager_base::get_owner_id_()); } unsigned __int64 bind(const m_no_arg_callback_type &handler, const std::function<void(manager_base &, unsigned __int64)> &callback = nullptr){ return bind([handler](m_object_type &){ return handler(); }, callback); } bool unbind(unsigned __int64 id, const std::function<void(manager_base &, bool)> &callback = nullptr){ if (manager_base::get_thread_().is_thread_context()){ auto result = unbind_(id); if (callback != nullptr) callback(*this, result); return result; } if (callback != nullptr){ manager_base::get_thread_().queue.post([=]{ callback(*this, unbind_(id)); }, thread::queue::send_priority, manager_base::get_owner_id_()); return false; } return manager_base::get_thread_().queue.execute([=]{ return unbind_(id); }, thread::queue::send_priority, manager_base::get_owner_id_()); } protected: friend owner_type; friend group_type; explicit manager(owner_type &owner) : manager_base(owner){} virtual std::size_t count_() const override{ return handlers_.size(); } virtual void fire_generic_(object &e) const override{ fire_(dynamic_cast<m_object_type &>(e)); } virtual void fire_(m_object_type &e) const{ for (auto &item : handlers_){ item.second(e); if ((e.state_ & object::state_type::propagation_stopped) != 0u) break; } } unsigned __int64 bind_(const m_callback_type &handler){ auto id = rand_(1ui64, std::numeric_limits<unsigned __int64>::max()); auto previous_count = handlers_.size(); handlers_[id] = handler; count_changed_(previous_count); return id; } bool unbind_(unsigned __int64 id){ if (handlers_.empty()) return false; auto it = handlers_->find(id); if (it == handlers_->end()) return false; auto previous_count = handlers_.size(); handlers_->erase(it); count_changed_(previous_count); return true; } m_map_type handlers_; utility::random_integral_number rand_; }; }
26.335526
145
0.700724
[ "object" ]
41a20db699be3b6eba0505e5955d774e55aea84d
5,424
c
C
sdk-6.5.20/libs/sdklt/bcmlta/bcmltx/bcm56780_a0/dna_2_4_13/bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
sdk-6.5.20/libs/sdklt/bcmlta/bcmltx/bcm56780_a0/dna_2_4_13/bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
sdk-6.5.20/libs/sdklt/bcmlta/bcmltx/bcm56780_a0/dna_2_4_13/bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler.c
copslock/broadcom_cpri
8e2767676e26faae270cf485591902a4c50cf0c5
[ "Spencer-94" ]
null
null
null
/******************************************************************************* * * DO NOT EDIT THIS FILE! * This file is auto-generated by fltg from Logical Table mapping files. * * Tool: $SDK/INTERNAL/fltg/bin/fltg * * Edits to this file will be lost when it is regenerated. * * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. * * Copyright 2007-2020 Broadcom Inc. All rights reserved. */ /* Logical Table Adaptor for component bcmltx */ /* Handler: bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler */ #include <bcmlrd/bcmlrd_types.h> #include <bcmltd/chip/bcmltd_id.h> #include <bcmltx/bcmltx_field_demux.h> #include <bcmdrd/chip/bcm56780_a0_enum.h> #include <bcmlrd/chip/bcm56780_a0/dna_2_4_13/bcm56780_a0_dna_2_4_13_lrd_xfrm_field_desc.h> extern const bcmltd_field_desc_t bcm56780_a0_dna_2_4_13_lrd_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_src_field_desc_s0[]; static const bcmltd_field_desc_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_dst_field_desc[2] = { { .field_id = BCMLTD_INTERNAL_FIELD_BASE + 72, .field_idx = 0, .minbit = 112, .maxbit = 123, .entry_idx = 0, .sym = "MEMDB_TCAM_IFTA80_MEM4_0m.TCAM_ONLYf.ENTRY0[123:112]", .reserved = 0 }, { .field_id = BCMLTD_INTERNAL_FIELD_BASE + 73, .field_idx = 0, .minbit = 108, .maxbit = 109, .entry_idx = 0, .sym = "MEMDB_TCAM_IFTA80_MEM4_0m.TCAM_ONLYf.ENTRY0[109:108]", .reserved = 0 }, }; static const bcmltd_field_list_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_src_list_s0 = { .field_num = 2, .field_array = bcm56780_a0_dna_2_4_13_lrd_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_src_field_desc_s0 }; static const bcmltd_field_list_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_dst_list_d0 = { .field_num = 2, .field_array = bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_dst_field_desc }; static const uint32_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_transform_src_s0[1] = { BCM56780_A0_DNA_2_4_13_L3_IPV4_UNICAST_DEFIP_TABLEt_VRF_MASKf, }; static const uint32_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_transform_dst_d0[2] = { BCMLTD_INTERNAL_FIELD_BASE + 72, BCMLTD_INTERNAL_FIELD_BASE + 73, }; static const bcmltd_generic_arg_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_comp_data = { .sid = BCM56780_A0_DNA_2_4_13_L3_IPV4_UNICAST_DEFIP_TABLEt, .values = 0, .value = NULL, .user_data = NULL }; static const bcmltd_transform_arg_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler_fwd_arg_s0_d0 = { .values = 0, .value = NULL, .tables = 0, .table = NULL, .fields = 1, .field = bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_transform_src_s0, .field_list = &bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_src_list_s0, .rfields = 2, .rfield = bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_transform_dst_d0, .rfield_list = &bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_dst_list_d0, .comp_data = &bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_comp_data }; static const bcmltd_transform_arg_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler_rev_arg_s0_d0 = { .values = 0, .value = NULL, .tables = 0, .table = NULL, .fields = 2, .field = bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_transform_dst_d0, .field_list = &bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_dst_list_d0, .rfields = 1, .rfield = bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_transform_src_s0, .rfield_list = &bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_src_list_s0, .comp_data = &bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_comp_data }; const bcmltd_xfrm_handler_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler_fwd_s0_d0 = { .transform = bcmltx_field_demux_transform, .arg = &bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler_fwd_arg_s0_d0 }; const bcmltd_xfrm_handler_t bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler_rev_s0_d0 = { .transform = bcmltx_field_mux_transform, .arg = &bcm56780_a0_dna_2_4_13_lta_bcmltx_field_demux_l3_ipv4_unicast_defip_tablet_vrf_maskf_0_xfrm_handler_rev_arg_s0_d0 };
44.097561
135
0.787979
[ "transform" ]
41a23c8b1116b272ff08cd0d42df74be45025e6e
1,947
h
C
MITK/Plugins/uk.ac.ucl.cmic.xnat/src/internal/XnatBrowserView.h
NifTK/NifTK
2358b333c89ff1bba1c232eecbbcdc8003305dfe
[ "BSD-3-Clause" ]
13
2018-07-28T13:36:38.000Z
2021-11-01T19:17:39.000Z
MITK/Plugins/uk.ac.ucl.cmic.xnat/src/internal/XnatBrowserView.h
NifTK/NifTK
2358b333c89ff1bba1c232eecbbcdc8003305dfe
[ "BSD-3-Clause" ]
null
null
null
MITK/Plugins/uk.ac.ucl.cmic.xnat/src/internal/XnatBrowserView.h
NifTK/NifTK
2358b333c89ff1bba1c232eecbbcdc8003305dfe
[ "BSD-3-Clause" ]
10
2018-08-20T07:06:00.000Z
2021-07-07T07:55:27.000Z
/*============================================================================= NifTK: A software platform for medical image computing. Copyright (c) University College London (UCL). All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt in the top level directory for details. =============================================================================*/ #ifndef XnatBrowserView_h #define XnatBrowserView_h #include "ui_XnatBrowserView.h" #include <berryQtViewPart.h> #include <QmitkAbstractView.h> #include <mitkDataNode.h> class QWidget; class XnatBrowserViewPrivate; /** * \class XnatBrowserView * \brief Provides a simple GUI for browsing XNAT databases * \ingroup uk_ac_ucl_cmic_xnat_internal */ class XnatBrowserView : public QmitkAbstractView { // this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT public: explicit XnatBrowserView(); virtual ~XnatBrowserView(); /// \brief Each View for a plugin has its own globally unique ID, this one is /// "uk.ac.ucl.cmic.xnat.browser" and the .cxx file and plugin.xml should match. static const QString VIEW_ID; protected: /// \brief Called by framework, this method creates all the controls for this view virtual void CreateQtPartControl(QWidget *parent) override; /// \brief Called by framework, sets the focus on a specific widget. virtual void SetFocus() override; private: /// \brief All the controls for the main view part. Ui::XnatBrowserView* m_Controls; // Store a reference to the parent widget of this view. QWidget *m_Parent; /// \brief d pointer of the pimpl pattern QScopedPointer<XnatBrowserViewPrivate> d_ptr; Q_DECLARE_PRIVATE(XnatBrowserView); Q_DISABLE_COPY(XnatBrowserView); }; #endif // _XNATBROWSERVIEW_H_INCLUDED
27.422535
107
0.700051
[ "object" ]
41a4f9d095a8855cb51bafe32cc458688660fc44
2,493
h
C
headers/CompElementTemplate.h
jjssobrinho/FemCourseEigenClass2021
25f35e9ce32d92057151b15ee5e9c2fa7db0db4e
[ "MIT" ]
1
2021-06-12T13:21:51.000Z
2021-06-12T13:21:51.000Z
headers/CompElementTemplate.h
Kauehenrik/FemCourseEigenClass2021
d4927d92b541fdd2b2aa1fa424a413dd561ae96e
[ "MIT" ]
1
2021-06-16T12:36:07.000Z
2021-06-16T12:36:07.000Z
headers/CompElementTemplate.h
Kauehenrik/FemCourseEigenClass2021
d4927d92b541fdd2b2aa1fa424a413dd561ae96e
[ "MIT" ]
12
2021-04-26T13:53:32.000Z
2021-07-24T03:12:36.000Z
// // CompElementTemplate.h // FemCourse // // Created by Philippe Devloo on 24/04/18. // #ifndef CompElementTemplate_h #define CompElementTemplate_h #include "CompElement.h" #include "DOF.h" /** @brief Computational element based on @ref shape This class implements the computation of element shape functions and holds the information of DOF objects through their indices @ingroup approximation */ template<class Shape> class CompElementTemplate : public CompElement { // Vector with degrees of freedom indices std::vector<int64_t> dofindexes; // Integration rule object typename Shape::LocIntRule intrule; public: // Default constructor of CompElementTemplate CompElementTemplate(); // Constructor of CompElementTemplate CompElementTemplate(int64_t ind, CompMesh *cmesh, GeoElement *geo); // Copy constructor of CompElementTemplate CompElementTemplate(const CompElementTemplate &); // Operator of copy CompElementTemplate &operator=(const CompElementTemplate &); // Destructor of CompElementTemplate virtual ~CompElementTemplate(); // Method for creating a copy of the element virtual CompElement *Clone() const; // Compute shape functions set at point x virtual void ShapeFunctions(const VecDouble &intpoint, VecDouble &phi, MatrixDouble &dphi) const; // virtual void GetMultiplyingCoeficients(VecDouble &coefs) const; // Return the number of shape functions virtual int NShapeFunctions() const; // Set number of DOF virtual void SetNDOF(int64_t ndof); // Se DOF index in vector position i virtual void SetDOFIndex(int i, int64_t dofindex); // Get DOF index in vector position i virtual int64_t GetDOFIndex(int i) const; // Return the number of degree of freedom virtual int64_t NDOF() const; // Return the number of shape functions stored in the DOF data structure virtual int NShapeFunctions(int doflocindex) const; // Use the Shape template class to compute the number of shape functions virtual int ComputeNShapeFunctions(int doflocindex, int order); // Return space dimension virtual int Dimension() const { return Shape::Dimension; } virtual void Print(std::ostream &out); }; // Create a computational element CompElement *CreateCompEl(GeoElement *gel, CompMesh *mesh, int64_t index); #endif /* CompElementTemplate_h */
27.395604
105
0.71079
[ "mesh", "object", "shape", "vector" ]
41a97fa9d1f0367fca3d2c55b367638fb40d9cf6
2,307
h
C
base/file_version_info.h
Gitman1989/chromium
2b1cceae1075ef012fb225deec8b4c8bbe4bc897
[ "BSD-3-Clause" ]
2
2017-09-02T19:08:28.000Z
2021-11-15T15:15:14.000Z
base/file_version_info.h
Gitman1989/chromium
2b1cceae1075ef012fb225deec8b4c8bbe4bc897
[ "BSD-3-Clause" ]
null
null
null
base/file_version_info.h
Gitman1989/chromium
2b1cceae1075ef012fb225deec8b4c8bbe4bc897
[ "BSD-3-Clause" ]
1
2020-04-13T05:45:10.000Z
2020-04-13T05:45:10.000Z
// Copyright (c) 2006-2008 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. #ifndef BASE_FILE_VERSION_INFO_H__ #define BASE_FILE_VERSION_INFO_H__ #pragma once #include <string> #include "build/build_config.h" class FilePath; // Provides an interface for accessing the version information for a file. // This is the information you access when you select a file in the Windows // explorer, right-click select Properties, then click the Version tab. class FileVersionInfo { public: virtual ~FileVersionInfo() {} #if defined(OS_WIN) || defined(OS_MACOSX) // Creates a FileVersionInfo for the specified path. Returns NULL if something // goes wrong (typically the file does not exit or cannot be opened). The // returned object should be deleted when you are done with it. static FileVersionInfo* CreateFileVersionInfo(const FilePath& file_path); #endif // OS_WIN || OS_MACOSX #if defined(OS_WIN) // This version, taking a wstring, is deprecated and only kept around // until we can fix all callers. static FileVersionInfo* CreateFileVersionInfo(const std::wstring& file_path); #endif // OS_WIN // Creates a FileVersionInfo for the current module. Returns NULL in case // of error. The returned object should be deleted when you are done with it. static FileVersionInfo* CreateFileVersionInfoForCurrentModule(); // Accessors to the different version properties. // Returns an empty string if the property is not found. virtual std::wstring company_name() = 0; virtual std::wstring company_short_name() = 0; virtual std::wstring product_name() = 0; virtual std::wstring product_short_name() = 0; virtual std::wstring internal_name() = 0; virtual std::wstring product_version() = 0; virtual std::wstring private_build() = 0; virtual std::wstring special_build() = 0; virtual std::wstring comments() = 0; virtual std::wstring original_filename() = 0; virtual std::wstring file_description() = 0; virtual std::wstring file_version() = 0; virtual std::wstring legal_copyright() = 0; virtual std::wstring legal_trademarks() = 0; virtual std::wstring last_change() = 0; virtual bool is_official_build() = 0; }; #endif // BASE_FILE_VERSION_INFO_H__
38.45
80
0.749025
[ "object" ]
84b0c28f8a0b92d3d907257145566d77c4c6606a
3,509
h
C
update_engine/chrome_browser_proxy_resolver.h
Keneral/asystem
df12381b72ef3d629c8efc61100cc8c714195320
[ "Unlicense" ]
null
null
null
update_engine/chrome_browser_proxy_resolver.h
Keneral/asystem
df12381b72ef3d629c8efc61100cc8c714195320
[ "Unlicense" ]
null
null
null
update_engine/chrome_browser_proxy_resolver.h
Keneral/asystem
df12381b72ef3d629c8efc61100cc8c714195320
[ "Unlicense" ]
null
null
null
// // Copyright (C) 2011 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #ifndef UPDATE_ENGINE_CHROME_BROWSER_PROXY_RESOLVER_H_ #define UPDATE_ENGINE_CHROME_BROWSER_PROXY_RESOLVER_H_ #include <deque> #include <map> #include <string> #include <utility> #include <gtest/gtest_prod.h> // for FRIEND_TEST #include <brillo/message_loops/message_loop.h> #include "update_engine/libcros_proxy.h" #include "update_engine/proxy_resolver.h" namespace chromeos_update_engine { extern const char kLibCrosServiceName[]; extern const char kLibCrosProxyResolveName[]; extern const char kLibCrosProxyResolveSignalInterface[]; class ChromeBrowserProxyResolver : public ProxyResolver { public: explicit ChromeBrowserProxyResolver(LibCrosProxy* libcros_proxy); ~ChromeBrowserProxyResolver() override; // Initialize the ProxyResolver using the provided DBus proxies. bool Init(); bool GetProxiesForUrl(const std::string& url, ProxiesResolvedFn callback, void* data) override; private: FRIEND_TEST(ChromeBrowserProxyResolverTest, ParseTest); FRIEND_TEST(ChromeBrowserProxyResolverTest, SuccessTest); typedef std::multimap<std::string, std::pair<ProxiesResolvedFn, void*>> CallbacksMap; typedef std::multimap<std::string, brillo::MessageLoop::TaskId> TimeoutsMap; // Called when the signal in UpdateEngineLibcrosProxyResolvedInterface is // connected. void OnSignalConnected(const std::string& interface_name, const std::string& signal_name, bool successful); // Handle a reply from Chrome: void OnProxyResolvedSignal(const std::string& source_url, const std::string& proxy_info, const std::string& error_message); // Handle no reply: void HandleTimeout(std::string source_url); // Parses a string-encoded list of proxies and returns a deque // of individual proxies. The last one will always be kNoProxy. static std::deque<std::string> ParseProxyString(const std::string& input); // Deletes internal state for the first instance of url in the state. // If delete_timer is set, calls CancelTask on the timer id. // Returns the callback in an out parameter. Returns true on success. bool DeleteUrlState(const std::string& url, bool delete_timer, std::pair<ProxiesResolvedFn, void*>* callback); // Shutdown the dbus proxy object. void Shutdown(); // DBus proxies to request a HTTP proxy resolution. The request is done in the // service_interface_proxy() interface and the response is received as a // signal in the ue_proxy_resolved_interface(). LibCrosProxy* libcros_proxy_; int timeout_; TimeoutsMap timers_; CallbacksMap callbacks_; DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProxyResolver); }; } // namespace chromeos_update_engine #endif // UPDATE_ENGINE_CHROME_BROWSER_PROXY_RESOLVER_H_
35.444444
80
0.731832
[ "object" ]
84c861737c1b75c9e03d3ea473185aae1e6a04bd
6,679
h
C
src/conv2d_proj/headers/Conv2DSelect.h
venkate5hgunda/CSE598-Spring22-Group22-NetsDB
6c2dabd1a3b3f5901a97c788423fdd93cc0015d4
[ "Apache-2.0" ]
13
2022-01-17T16:14:26.000Z
2022-03-30T02:06:04.000Z
src/conv2d_proj/headers/Conv2DSelect.h
venkate5hgunda/CSE598-Spring22-Group22-NetsDB
6c2dabd1a3b3f5901a97c788423fdd93cc0015d4
[ "Apache-2.0" ]
1
2022-01-28T23:17:14.000Z
2022-01-28T23:17:14.000Z
src/conv2d_proj/headers/Conv2DSelect.h
venkate5hgunda/CSE598-Spring22-Group22-NetsDB
6c2dabd1a3b3f5901a97c788423fdd93cc0015d4
[ "Apache-2.0" ]
3
2022-01-18T02:13:53.000Z
2022-03-06T19:28:19.000Z
#ifndef CONV2DSELECT_H #define CONV2DSELECT_H #include "SelectionComp.h" #include "Lambda.h" #include "LambdaCreationFunctions.h" #include "TensorData.h" //LA libraries: #include <eigen3/unsupported/Eigen/CXX11/Tensor> #include <cmath> //ATen libraries: #include <ATen/ATen.h> #include <ATen/Functions.h> using namespace pdb; //stride = 1 class Conv2DSelect: public SelectionComp<pdb::TensorData, pdb::TensorData>{ public: ENABLE_DEEP_COPY Conv2DSelect() {} Conv2DSelect(Handle<TensorData> filters, std::string convMode = "aten-conv2d", int stride = 1) { //make sure it's a 3D tensor assert(filters->numRanks = 4); //set up the kernel and kernel dimensions this->kernel = filters; //kernel count this->nk = (*(filters->dimensions))[0]; //C this->zk = (*(filters->dimensions))[1]; //H this->yk = (*(filters->dimensions))[2]; //W this->xk = (*(filters->dimensions))[3]; //set up the mode of the convolutional operation this->conv2dMode = convMode; this->stride = stride; } Lambda<bool> getSelection(Handle<TensorData> checkMe) override { return makeLambda(checkMe, [](Handle<TensorData>& checkMe) { return true; }); } Handle<TensorData> runEigenSpatial(TensorData& input, int z, int y, int x, int stride) { Eigen::TensorMap<Eigen::Tensor<float, 3>> a (input.rawData->c_ptr(), z, y, x); //Eigen::Tensor<float, 3> c = a.convolve(b1) Eigen::TensorMap<Eigen::Tensor<float, 4>> b1(kernel->rawData->c_ptr(), nk, zk, yk, xk); //NumDims of input: 3 //kernelFilters: nk //kernelChannels: zk //kernelRows: yk //kernelCols: xk //kernelRowsEff = kernelRows + (kernelRows-1)*(row_in_stride-1) = yk //kernelColsEff = kernelCols + (kernelCols-1)*(col_in_stride-1) = xk //contract_dims Eigen::array<Eigen::IndexPair<int>, 1> contract_dims; contract_dims[0] = Eigen::IndexPair<int>(1, 0); //out_height = (inputRows - kernelRowsEff) / stride + 1 = (y - yk) / stride + 1 //out_width = (inputCols - kernelColsEff) / stride + 1 = (x - xk) / stride + 1 int oy = calculateOutputDimension(y, yk, stride); int ox = calculateOutputDimension(x, xk, stride); //pre_contract_dims Eigen::array<int, 2> pre_contract_dims; pre_contract_dims[0] = zk * yk * xk; pre_contract_dims[1] = (oy) * (ox); //post_contract_dims Eigen::array<int, 3> post_contract_dims; post_contract_dims[0] = nk; post_contract_dims[1] = (oy); post_contract_dims[2] = (ox); //kernel dims Eigen::array<int, 2> kernel_dims; kernel_dims[0] = nk; kernel_dims[1] = zk * yk * xk; //create the output Handle<Vector<unsigned int>> dimensions = makeObject<Vector<unsigned int>>(3); dimensions->push_back(nk); dimensions->push_back(oy); dimensions->push_back(ox); Handle<TensorData> out = makeObject<TensorData>(3, dimensions); float * mempool = (float *) malloc (nk * oy * ox * sizeof(float)); Eigen::TensorMap<Eigen::Tensor<float, 3>> c (mempool, nk, oy, ox); c = b1.reshape(kernel_dims) .contract( a.extract_image_patches(yk, xk, stride, stride, 1, 1, Eigen::PADDING_VALID) .reshape(pre_contract_dims), contract_dims) .reshape(post_contract_dims); /* c = a.extract_image_patches(yk, xk, 1, 1, 1, 1, Eigen::PADDING_VALID) .reshape(Eigen::array<int, 2>({(y - yk + 1 ) * (x - xk + 1 ), zk * yk * xk})) .contract(b1.reshape(Eigen::array<int, 2>({yk * xk, nk})), contract_dims) .reshape(Eigen::array<int, 3>({ (x - xk + 1 ), (y - yk + 1 ), nk })); */ memcpy (out->rawData->c_ptr(), mempool, nk * oy * ox * sizeof(float)); return out; } Handle<TensorData> runAtenConv2d(TensorData& input, int z, int y, int x, int stride) { //input data at::Tensor a = at::from_blob(input.rawData->c_ptr(), {1, z, y, x}); at::Tensor b = at::from_blob(kernel->rawData->c_ptr(), {nk, zk, yk, xk}); // bias length = kernel count = nk at::Tensor bias = at::zeros({nk}, at::kFloat); //perform the convolutional operation auto c = at::conv2d(a, b, bias, stride); //create the output int oy = calculateOutputDimension(y, yk, stride); int ox = calculateOutputDimension(x, xk, stride); Handle<Vector<unsigned int>> dimensions = makeObject<Vector<unsigned int>>(3); dimensions->push_back(nk); dimensions->push_back(oy); dimensions->push_back(ox); Handle<TensorData> out = makeObject<TensorData>(3, dimensions); memcpy(out->rawData->c_ptr(), c.storage().data(), nk * (oy) * (ox) * sizeof(float)); return out; } Lambda<Handle<TensorData>> getProjection(Handle<TensorData> checkMe) override { return makeLambda(checkMe, [&](Handle<TensorData>& checkMe) { TensorData input = *checkMe; assert (input.numRanks = 3); //set up input dimensions //C int z = (*(input.dimensions))[0]; //H int y = (*(input.dimensions))[1]; //W int x = (*(input.dimensions))[2]; if (conv2dMode == "eigen-spatial") { return runEigenSpatial(input, z, y, x, stride); } else { return runAtenConv2d(input, z, y, x, stride); } }); } private: //multiple 2D-filters, each filter has many channels Handle<TensorData> kernel = nullptr; //conv2d-mode: //--"eigen-spatial": https://github.com/tensorflow/tensorflow/blob/v1.13.1/tensorflow/core/kernels/eigen_spatial_convolutions.h#L1688 //https://github.com/pytorch/pytorch/blob/master/caffe2/operators/conv_op_eigen.cc //--"aten-conv2d": https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/Convolution.cpp String conv2dMode = "aten-conv2d"; int nk; int xk; int yk; int zk; unsigned int stride; static int calculateOutputDimension(int inputDimention, int filterDimention, int stride) { return (inputDimention - filterDimention) / stride + 1; } }; #endif
28.300847
137
0.57299
[ "vector", "3d" ]
84daeeef936b9e01b8b8d555cb92fad32389e3cf
15,778
c
C
basic_programming/libzebra/memory.c
shan3275/c
481bdac8c3e852703b5a78859edf5148732a4452
[ "BSD-2-Clause" ]
null
null
null
basic_programming/libzebra/memory.c
shan3275/c
481bdac8c3e852703b5a78859edf5148732a4452
[ "BSD-2-Clause" ]
null
null
null
basic_programming/libzebra/memory.c
shan3275/c
481bdac8c3e852703b5a78859edf5148732a4452
[ "BSD-2-Clause" ]
null
null
null
/* * Memory management routine * Copyright (C) 1998 Kunihiro Ishiguro * * This file is part of GNU Zebra. * * GNU Zebra 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, or (at your option) any * later version. * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include <zebra.h> /* malloc.h is generally obsolete, however GNU Libc mallinfo wants it. */ #if !defined(HAVE_STDLIB_H) || (defined(GNU_LINUX) && defined(HAVE_MALLINFO)) #include <malloc.h> #endif /* !HAVE_STDLIB_H || HAVE_MALLINFO */ #include "log.h" #include "memory.h" static void alloc_inc (int); static void alloc_dec (int); static void log_memstats(int log_priority); static const struct message mstr [] = { { MTYPE_THREAD, "thread" }, { MTYPE_THREAD_MASTER, "thread_master" }, { MTYPE_VECTOR, "vector" }, { MTYPE_VECTOR_INDEX, "vector_index" }, { MTYPE_IF, "interface" }, { 0, NULL }, }; /* Fatal memory allocation error occured. */ static void __attribute__ ((noreturn)) zerror (const char *fname, int type, size_t size) { zlog_err ("%s : can't allocate memory for `%s' size %d: %s\n", fname, lookup (mstr, type), (int) size, safe_strerror(errno)); log_memstats(LOG_WARNING); /* N.B. It might be preferable to call zlog_backtrace_sigsafe here, since that function should definitely be safe in an OOM condition. But unfortunately zlog_backtrace_sigsafe does not support syslog logging at this time... */ zlog_backtrace(LOG_WARNING); abort(); } /* * Allocate memory of a given size, to be tracked by a given type. * Effects: Returns a pointer to usable memory. If memory cannot * be allocated, aborts execution. */ void * zmalloc (int type, size_t size) { void *memory; memory = malloc (size); if (memory == NULL) zerror ("malloc", type, size); alloc_inc (type); return memory; } /* * Allocate memory as in zmalloc, and also clear the memory. */ void * zcalloc (int type, size_t size) { void *memory; memory = calloc (1, size); if (memory == NULL) zerror ("calloc", type, size); alloc_inc (type); return memory; } /* * Given a pointer returned by zmalloc or zcalloc, free it and * return a pointer to a new size, basically acting like realloc(). * Requires: ptr was returned by zmalloc, zcalloc, or zrealloc with the * same type. * Effects: Returns a pointer to the new memory, or aborts. */ void * zrealloc (int type, void *ptr, size_t size) { void *memory; memory = realloc (ptr, size); if (memory == NULL) zerror ("realloc", type, size); if (ptr == NULL) alloc_inc (type); return memory; } /* * Free memory allocated by z*alloc or zstrdup. * Requires: ptr was returned by zmalloc, zcalloc, or zrealloc with the * same type. * Effects: The memory is freed and may no longer be referenced. */ void zfree (int type, void *ptr) { if (ptr != NULL) { alloc_dec (type); free (ptr); } } /* * Duplicate a string, counting memory usage by type. * Effects: The string is duplicated, and the return value must * eventually be passed to zfree with the same type. The function will * succeed or abort. */ char * zstrdup (int type, const char *str) { void *dup; dup = strdup (str); if (dup == NULL) zerror ("strdup", type, strlen (str)); alloc_inc (type); return dup; } #ifdef MEMORY_LOG static struct { const char *name; long alloc; unsigned long t_malloc; unsigned long c_malloc; unsigned long t_calloc; unsigned long c_calloc; unsigned long t_realloc; unsigned long t_free; unsigned long c_strdup; } mstat [MTYPE_MAX]; static void mtype_log (char *func, void *memory, const char *file, int line, int type) { zlog_debug ("%s: %s %p %s %d", func, lookup (mstr, type), memory, file, line); } void * mtype_zmalloc (const char *file, int line, int type, size_t size) { void *memory; mstat[type].c_malloc++; mstat[type].t_malloc++; memory = zmalloc (type, size); mtype_log ("zmalloc", memory, file, line, type); return memory; } void * mtype_zcalloc (const char *file, int line, int type, size_t size) { void *memory; mstat[type].c_calloc++; mstat[type].t_calloc++; memory = zcalloc (type, size); mtype_log ("xcalloc", memory, file, line, type); return memory; } void * mtype_zrealloc (const char *file, int line, int type, void *ptr, size_t size) { void *memory; /* Realloc need before allocated pointer. */ mstat[type].t_realloc++; memory = zrealloc (type, ptr, size); mtype_log ("xrealloc", memory, file, line, type); return memory; } /* Important function. */ void mtype_zfree (const char *file, int line, int type, void *ptr) { mstat[type].t_free++; mtype_log ("xfree", ptr, file, line, type); zfree (type, ptr); } char * mtype_zstrdup (const char *file, int line, int type, const char *str) { char *memory; mstat[type].c_strdup++; memory = zstrdup (type, str); mtype_log ("xstrdup", memory, file, line, type); return memory; } #else static struct { char *name; long alloc; } mstat [MTYPE_MAX]; #endif /* MEMORY_LOG */ /* Increment allocation counter. */ static void alloc_inc (int type) { mstat[type].alloc++; } /* Decrement allocation counter. */ static void alloc_dec (int type) { mstat[type].alloc--; } /* Looking up memory status from vty interface. */ #include "vector.h" #include "vty.h" #include "command.h" static void log_memstats(int pri) { struct mlist *ml; for (ml = mlists; ml->list; ml++) { struct memory_list *m; zlog (NULL, pri, "Memory utilization in module %s:", ml->name); for (m = ml->list; m->index >= 0; m++) if (m->index && mstat[m->index].alloc) zlog (NULL, pri, " %-30s: %10ld", m->format, mstat[m->index].alloc); } } void log_memstats_stderr (const char *prefix) { struct mlist *ml; struct memory_list *m; int i; int j = 0; for (ml = mlists; ml->list; ml++) { i = 0; for (m = ml->list; m->index >= 0; m++) if (m->index && mstat[m->index].alloc) { if (!i) fprintf (stderr, "%s: memstats: Current memory utilization in module %s:\n", prefix, ml->name); fprintf (stderr, "%s: memstats: %-30s: %10ld%s\n", prefix, m->format, mstat[m->index].alloc, mstat[m->index].alloc < 0 ? " (REPORT THIS BUG!)" : ""); i = j = 1; } } if (j) fprintf (stderr, "%s: memstats: NOTE: If configuration exists, utilization may be " "expected.\n", prefix); else fprintf (stderr, "%s: memstats: No remaining tracked memory utilization.\n", prefix); } static void show_separator(struct vty *vty) { vty_out (vty, "-----------------------------\r\n"); } static int show_memory_vty (struct vty *vty, struct memory_list *list) { struct memory_list *m; int needsep = 0; for (m = list; m->index >= 0; m++) if (m->index == 0) { if (needsep) { show_separator (vty); needsep = 0; } } else if (mstat[m->index].alloc) { vty_out (vty, "%-30s: %10ld\r\n", m->format, mstat[m->index].alloc); needsep = 1; } return needsep; } #ifdef HAVE_MALLINFO static int show_memory_mallinfo (struct vty *vty) { struct mallinfo minfo = mallinfo(); char buf[MTYPE_MEMSTR_LEN]; vty_out (vty, "System allocator statistics:%s", VTY_NEWLINE); vty_out (vty, " Total heap allocated: %s%s", mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.arena), VTY_NEWLINE); vty_out (vty, " Holding block headers: %s%s", mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.hblkhd), VTY_NEWLINE); vty_out (vty, " Used small blocks: %s%s", mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.usmblks), VTY_NEWLINE); vty_out (vty, " Used ordinary blocks: %s%s", mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.uordblks), VTY_NEWLINE); vty_out (vty, " Free small blocks: %s%s", mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fsmblks), VTY_NEWLINE); vty_out (vty, " Free ordinary blocks: %s%s", mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fordblks), VTY_NEWLINE); vty_out (vty, " Ordinary blocks: %ld%s", (unsigned long)minfo.ordblks, VTY_NEWLINE); vty_out (vty, " Small blocks: %ld%s", (unsigned long)minfo.smblks, VTY_NEWLINE); vty_out (vty, " Holding blocks: %ld%s", (unsigned long)minfo.hblks, VTY_NEWLINE); vty_out (vty, "(see system documentation for 'mallinfo' for meaning)%s", VTY_NEWLINE); return 1; } #endif /* HAVE_MALLINFO */ DEFUN (show_memory_all, show_memory_all_cmd, "show memory all", "Show running system information\n" "Memory statistics\n" "All memory statistics\n") { struct mlist *ml; int needsep = 0; #ifdef HAVE_MALLINFO needsep = show_memory_mallinfo (vty); #endif /* HAVE_MALLINFO */ for (ml = mlists; ml->list; ml++) { if (needsep) show_separator (vty); needsep = show_memory_vty (vty, ml->list); } return CMD_SUCCESS; } ALIAS (show_memory_all, show_memory_cmd, "show memory", "Show running system information\n" "Memory statistics\n") DEFUN (show_memory_lib, show_memory_lib_cmd, "show memory lib", SHOW_STR "Memory statistics\n" "Library memory\n") { show_memory_vty (vty, memory_list_lib); return CMD_SUCCESS; } DEFUN (show_memory_zebra, show_memory_zebra_cmd, "show memory zebra", SHOW_STR "Memory statistics\n" "Zebra memory\n") { show_memory_vty (vty, memory_list_zebra); return CMD_SUCCESS; } DEFUN (show_memory_rip, show_memory_rip_cmd, "show memory rip", SHOW_STR "Memory statistics\n" "RIP memory\n") { show_memory_vty (vty, memory_list_rip); return CMD_SUCCESS; } DEFUN (show_memory_ripng, show_memory_ripng_cmd, "show memory ripng", SHOW_STR "Memory statistics\n" "RIPng memory\n") { show_memory_vty (vty, memory_list_ripng); return CMD_SUCCESS; } DEFUN (show_memory_babel, show_memory_babel_cmd, "show memory babel", SHOW_STR "Memory statistics\n" "Babel memory\n") { show_memory_vty (vty, memory_list_babel); return CMD_SUCCESS; } DEFUN (show_memory_bgp, show_memory_bgp_cmd, "show memory bgp", SHOW_STR "Memory statistics\n" "BGP memory\n") { show_memory_vty (vty, memory_list_bgp); return CMD_SUCCESS; } DEFUN (show_memory_ospf, show_memory_ospf_cmd, "show memory ospf", SHOW_STR "Memory statistics\n" "OSPF memory\n") { show_memory_vty (vty, memory_list_ospf); return CMD_SUCCESS; } DEFUN (show_memory_ospf6, show_memory_ospf6_cmd, "show memory ospf6", SHOW_STR "Memory statistics\n" "OSPF6 memory\n") { show_memory_vty (vty, memory_list_ospf6); return CMD_SUCCESS; } DEFUN (show_memory_isis, show_memory_isis_cmd, "show memory isis", SHOW_STR "Memory statistics\n" "ISIS memory\n") { show_memory_vty (vty, memory_list_isis); return CMD_SUCCESS; } DEFUN (show_memory_pim, show_memory_pim_cmd, "show memory pim", SHOW_STR "Memory statistics\n" "PIM memory\n") { show_memory_vty (vty, memory_list_pim); return CMD_SUCCESS; } void memory_init (void) { install_element (RESTRICTED_NODE, &show_memory_cmd); install_element (RESTRICTED_NODE, &show_memory_all_cmd); install_element (RESTRICTED_NODE, &show_memory_lib_cmd); install_element (RESTRICTED_NODE, &show_memory_rip_cmd); install_element (RESTRICTED_NODE, &show_memory_ripng_cmd); install_element (RESTRICTED_NODE, &show_memory_babel_cmd); install_element (RESTRICTED_NODE, &show_memory_bgp_cmd); install_element (RESTRICTED_NODE, &show_memory_ospf_cmd); install_element (RESTRICTED_NODE, &show_memory_ospf6_cmd); install_element (RESTRICTED_NODE, &show_memory_isis_cmd); install_element (VIEW_NODE, &show_memory_cmd); install_element (VIEW_NODE, &show_memory_all_cmd); install_element (VIEW_NODE, &show_memory_lib_cmd); install_element (VIEW_NODE, &show_memory_rip_cmd); install_element (VIEW_NODE, &show_memory_ripng_cmd); install_element (VIEW_NODE, &show_memory_babel_cmd); install_element (VIEW_NODE, &show_memory_bgp_cmd); install_element (VIEW_NODE, &show_memory_ospf_cmd); install_element (VIEW_NODE, &show_memory_ospf6_cmd); install_element (VIEW_NODE, &show_memory_isis_cmd); install_element (VIEW_NODE, &show_memory_pim_cmd); install_element (ENABLE_NODE, &show_memory_cmd); install_element (ENABLE_NODE, &show_memory_all_cmd); install_element (ENABLE_NODE, &show_memory_lib_cmd); install_element (ENABLE_NODE, &show_memory_zebra_cmd); install_element (ENABLE_NODE, &show_memory_rip_cmd); install_element (ENABLE_NODE, &show_memory_ripng_cmd); install_element (ENABLE_NODE, &show_memory_babel_cmd); install_element (ENABLE_NODE, &show_memory_bgp_cmd); install_element (ENABLE_NODE, &show_memory_ospf_cmd); install_element (ENABLE_NODE, &show_memory_ospf6_cmd); install_element (ENABLE_NODE, &show_memory_isis_cmd); install_element (ENABLE_NODE, &show_memory_pim_cmd); } /* Stats querying from users */ /* Return a pointer to a human friendly string describing * the byte count passed in. E.g: * "0 bytes", "2048 bytes", "110kB", "500MiB", "11GiB", etc. * Up to 4 significant figures will be given. * The pointer returned may be NULL (indicating an error) * or point to the given buffer, or point to static storage. */ const char * mtype_memstr (char *buf, size_t len, unsigned long bytes) { unsigned int t, g, m, k; /* easy cases */ if (!bytes) return "0 bytes"; if (bytes == 1) return "1 byte"; if (sizeof (unsigned long) >= 8) /* Hacked to make it not warn on ILP32 machines * Shift will always be 40 at runtime. See below too */ t = bytes >> (sizeof (unsigned long) >= 8 ? 40 : 0); else t = 0; g = bytes >> 30; m = bytes >> 20; k = bytes >> 10; if (t > 10) { /* The shift will always be 39 at runtime. * Just hacked to make it not warn on 'smaller' machines. * Static compiler analysis should mean no extra code */ if (bytes & (1UL << (sizeof (unsigned long) >= 8 ? 39 : 0))) t++; snprintf (buf, len, "%4d TiB", t); } else if (g > 10) { if (bytes & (1 << 29)) g++; snprintf (buf, len, "%d GiB", g); } else if (m > 10) { if (bytes & (1 << 19)) m++; snprintf (buf, len, "%d MiB", m); } else if (k > 10) { if (bytes & (1 << 9)) k++; snprintf (buf, len, "%d KiB", k); } else snprintf (buf, len, "%ld bytes", bytes); return buf; } unsigned long mtype_stats_alloc (int type) { return mstat[type].alloc; }
24.538103
82
0.642921
[ "vector" ]
84e42ec7eb7e9fd6061761ec066f458cf6892216
2,108
h
C
src/rendering/FileReporter.h
skylerpfli/libpag
41adf2754a428569d3513a85908bcc6c1bf3d906
[ "BSL-1.0", "CC0-1.0", "MIT" ]
1,546
2022-01-14T02:09:47.000Z
2022-03-31T10:38:42.000Z
src/rendering/FileReporter.h
skylerpfli/libpag
41adf2754a428569d3513a85908bcc6c1bf3d906
[ "BSL-1.0", "CC0-1.0", "MIT" ]
86
2022-01-14T04:50:28.000Z
2022-03-31T01:54:31.000Z
src/rendering/FileReporter.h
skylerpfli/libpag
41adf2754a428569d3513a85908bcc6c1bf3d906
[ "BSL-1.0", "CC0-1.0", "MIT" ]
207
2022-01-14T02:09:52.000Z
2022-03-31T08:34:49.000Z
///////////////////////////////////////////////////////////////////////////////////////////////// // // Tencent is pleased to support the open source community by making libpag available. // // Copyright (C) 2021 THL A29 Limited, a Tencent company. 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. // ///////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #include <string> #include <unordered_map> #include <vector> #include "pag/pag.h" namespace pag { class FileReporter { public: static std::unique_ptr<FileReporter> Make(std::shared_ptr<PAGLayer> pagLayer); explicit FileReporter(File* file); ~FileReporter(); void recordPerformance(RenderCache* cache); private: void setFileInfo(File* file); void reportData(); std::string pagInfoString; int flushCount = 0; int64_t presentTotalTime = 0; int64_t presentMaxTime = 0; int64_t presentFirstFrameTime = 0; int64_t renderTotalTime = 0; int64_t renderMaxTime = 0; int64_t renderFirstFrameTime = 0; int64_t flushTotalTime = 0; int64_t flushMaxTime = 0; int64_t flushFirstFrameTime = 0; int64_t imageDecodingMaxTime = 0; int64_t hardwareDecodingMaxTime = 0; int64_t hardwareDecodingTotalTime = 0; int64_t hardwareDecodingInitialTime = 0; int hardwareDecodingCount = 0; int64_t softwareDecodingTotalTime = 0; int64_t softwareDecodingMaxTime = 0; int64_t softwareDecodingInitialTime = 0; int softwareDecodingCount = 0; size_t graphicsMemoryMax = 0; size_t graphicsMemoryTotal = 0; }; } // namespace pag
30.114286
97
0.675996
[ "vector" ]
84e5c031a2ba726d3d2948594d775220976b7c3f
473
h
C
CrescentEngine/Core/Defunct/VertexBuffer.h
xRiveria/Crescent-Engine
b6512b6a8dab2d27cf542c562ccc28f21bf2345d
[ "Apache-2.0" ]
2
2020-12-18T03:43:07.000Z
2020-12-23T12:20:00.000Z
CrescentEngine/Core/Defunct/VertexBuffer.h
xRiveria/Crescent-Engine
b6512b6a8dab2d27cf542c562ccc28f21bf2345d
[ "Apache-2.0" ]
null
null
null
CrescentEngine/Core/Defunct/VertexBuffer.h
xRiveria/Crescent-Engine
b6512b6a8dab2d27cf542c562ccc28f21bf2345d
[ "Apache-2.0" ]
null
null
null
#pragma once class VertexBuffer { public: VertexBuffer(const void* data, unsigned int size); ~VertexBuffer(); void Bind() const; void Unbind() const; private: //We know that OpenGL needs an unsigned integer to keep track of every object we create in OpenGL such as Textures, Shaders etc. //Each one gets a unique ID to identify said object. We are calling this a RendererID. Note that this is done similarly in other rendering APIs. unsigned int m_RendererID; };
29.5625
146
0.758985
[ "object" ]
84ec72266abd67b368705efb2838f99eaf862c06
3,823
h
C
include/ecn_visualodom/ar_display.h
ptiwari0664/ecn_visualodom
fa91d51313c76c53b56cd84b0f6aaef97257c8bc
[ "MIT" ]
1
2020-05-10T10:47:42.000Z
2020-05-10T10:47:42.000Z
include/ecn_visualodom/ar_display.h
ptiwari0664/ecn_visualodom
fa91d51313c76c53b56cd84b0f6aaef97257c8bc
[ "MIT" ]
null
null
null
include/ecn_visualodom/ar_display.h
ptiwari0664/ecn_visualodom
fa91d51313c76c53b56cd84b0f6aaef97257c8bc
[ "MIT" ]
null
null
null
#ifndef AR_DISPLAY_H #define AR_DISPLAY_H #include <visp/vpAROgre.h> #include <visp/vpImage.h> #include <visp/vpIoTools.h> #include <visp/vpImageConvert.h> #include <visp/vpTime.h> #include <visp/vpDisplayX.h> #include <sstream> class ModelDisplay { public: ModelDisplay(bool use_ar = false) {init_ = false;use_ar_ = use_ar;} void init(const vpCameraParameters &_cam, vpImage<vpRGBa> &_I) { init_ = true; cam_ = _cam; if(!use_ar_) { display_.init(_I, -1, -1, "Pose display"); return; } // find current ROS distro std::string ros_path = "/opt/ros/indigo/"; if(!vpIoTools::checkDirectory(ros_path)) ros_path = "/opt/ros/kinetic/"; // find current ViSP installation std::vector<int> v = {0,1,2,3,4,5,6,7,8,9}; std::string ogre_path = ""; for(const auto &i: v) { for(const auto &j: v) { for(const auto &k: v) { std::stringstream ss; ss << ros_path << "share/visp-" << i << "." << j << "." << k << "/data/ogre-simulator/resources.cfg"; if(vpIoTools::checkFilename(ss.str())) { ogre_path = ss.str(); ogre_path.resize(ogre_path.size()-13); break; } } if(ogre_path.size()) break; } if(ogre_path.size()) break; } ros_path += "lib/x86_64-linux-gnu/visp/data/ogre-simulator/"; std::cout << "Loading vpAROgre from:" << std::endl; std::cout << " - ROS: " << ros_path << std::endl; std::cout << " - Meshes: " << ogre_path << std::endl; ogre_ = vpAROgre(_cam, _I.getWidth(), _I.getHeight(), ogre_path.c_str(), ros_path.c_str()); ogre_.init(_I); ogre_.load("Robot", "robot.mesh"); ogre_.setScale("Robot", 0.002f,0.002f,0.002f); ogre_.setRotation("Robot", vpRotationMatrix(vpRxyzVector(-M_PI/2, -M_PI/2, 0))); // Add an optional point light source Ogre::Light * light = ogre_.getSceneManager()->createLight(); light->setDiffuseColour(1, 1, 1); // scaled RGB values light->setSpecularColour(1, 1, 1); // scaled RGB values light->setPosition(5, 5, -10); light->setType(Ogre::Light::LT_POINT); } void init(const vpCameraParameters &_cam, cv::Mat &_im) { vpImageConvert::convert(_im, I_); init(_cam, I_); } ModelDisplay(const vpCameraParameters &_cam, vpImage<vpRGBa> &_I, bool use_ar = false) { use_ar_ = use_ar; init(_cam, _I); } // with opencv inputs ModelDisplay(const vpCameraParameters &_cam, cv::Mat &_im, bool use_ar = false) { use_ar_ = use_ar; init(_cam, _im); } inline bool continueRendering() { if(!init_ || !use_ar_) return true; return ogre_.continueRendering(); } inline void display(const vpImage<vpRGBa> &_I, const vpHomogeneousMatrix &_cMw) { if(!init_) return; if(use_ar_) { ogre_.display(_I, _cMw); vpTime::wait(15); } else { vpDisplay::displayFrame(_I, _cMw, cam_, .1); vpDisplay::flush(_I); vpDisplay::display(_I); } } inline void display(cv::Mat &_im, const vpHomogeneousMatrix &_cMw) { vpImageConvert::convert(_im, I_); display(I_, _cMw); } protected: vpAROgre ogre_; vpCameraParameters cam_; vpImage<vpRGBa> I_; vpDisplayX display_; bool init_, use_ar_; }; #endif // AR_DISPLAY_H
27.503597
121
0.529689
[ "mesh", "vector" ]
84fed2fbb27f10a32bffb225ae6a62b4a41e4444
768
h
C
include/Camera.h
gmryuuko/CG-FPSGame
816da7cc491cccb062d56863fa8266fda67066f9
[ "MIT" ]
null
null
null
include/Camera.h
gmryuuko/CG-FPSGame
816da7cc491cccb062d56863fa8266fda67066f9
[ "MIT" ]
null
null
null
include/Camera.h
gmryuuko/CG-FPSGame
816da7cc491cccb062d56863fa8266fda67066f9
[ "MIT" ]
null
null
null
#pragma once #ifndef CAMERA_H #define CAMERA_H #include "Transform.h" #include "Input.h" #include "Light.h" #include "MK14.h" #include "P1911.h" // FPS风格的摄像机 class Camera { private: Light::SpotLight* light; GameObject* gun; public: Transform* transform; float zoom = 45; bool camMoved; double xpos = 0, ypos = 0; double sensitivity = 0.05; glm::vec3 rotation, rotationWithRecoil; Gun* primary, *secondary , *currentGun; Camera(); glm::mat4 GetViewMatrix(); void ProcessInput(glm::vec3& translate); void SetTransform(const Transform& transform); void BindSpotLight(Light::SpotLight* light); void BindGun(GameObject* gun); void SetPosition(const glm::vec3& translate, const glm::vec3& dir); }; #endif
21.333333
71
0.68099
[ "transform" ]
1700fa5e2db81fc2c5d6d9de9ec87a9b44fe4175
415
h
C
FYLib/Classes/Utility/FYVideoHelper.h
fanyingzhao/FYLib
ae5cac0c1438a515a4f5d0adc97af58ce9f2a904
[ "MIT" ]
1
2021-06-29T05:23:15.000Z
2021-06-29T05:23:15.000Z
FYLib/Classes/Utility/FYVideoHelper.h
fanyingzhao/FYLib
ae5cac0c1438a515a4f5d0adc97af58ce9f2a904
[ "MIT" ]
null
null
null
FYLib/Classes/Utility/FYVideoHelper.h
fanyingzhao/FYLib
ae5cac0c1438a515a4f5d0adc97af58ce9f2a904
[ "MIT" ]
null
null
null
// // FYVideoHelper.h // FFKit // // Created by fan on 17/3/14. // Copyright © 2017年 fan. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreGraphics/CoreGraphics.h> @interface FYVideoHelper : NSObject + (void)tailorVideo:(NSString*)path exportPath:(NSString*)exportPath size:(CGSize)size transform:(CGAffineTransform)transform completion:(void(^)(NSError* error))completionBlock; @end
23.055556
178
0.742169
[ "transform" ]
1705834544a70b82b2a6a3a4500a89cc36a9c2c7
2,652
c
C
others/SequentialSequence.c
catarinaacsilva/c-algorithms
958da92cd17024b3135c41a328edc7b364a71ae8
[ "MIT" ]
null
null
null
others/SequentialSequence.c
catarinaacsilva/c-algorithms
958da92cd17024b3135c41a328edc7b364a71ae8
[ "MIT" ]
null
null
null
others/SequentialSequence.c
catarinaacsilva/c-algorithms
958da92cd17024b3135c41a328edc7b364a71ae8
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <assert.h> /* alusão da função que implementa o algoritmo pretendido */ /* allusion to the function that implements the algorithm */ int SequentialSequence (int [], int); /* variável global para contar as operações aritméticas executadas pelo algoritmo */ /* global variable for counting the arithmetic operations executed by the algorithm */ int Sum = 0; int main (void) { /* declaração dos arrays de teste - usar o pretendido para cada execução */ /* declaration of the test arrays - use each one for each execution */ //int Array[] = { 1, 3, 4, 5, 5, 6, 7, 7, 8, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 4, 5, 5, 6, 7, 8, 8, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 3, 6, 8, 8, 8, 9, 9, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 3, 4, 6, 7, 7, 8, 8, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 3, 4, 5, 7, 7, 8, 8, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 3, 4, 5, 6, 8, 8, 9, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 3, 4, 5, 6, 7, 9, 9, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 3, 4, 5, 6, 7, 8, 8, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 9 }; // resultado = num de operaçoes = //int Array[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; // resultado = num de operaçoes = //int Array[] = { }; int NElem = sizeof (Array) / sizeof (int); int Result; /* invocação do algoritmo pretendido - algorithm invocation */ Result = SequentialSequence (Array, NElem); /* apresentação do resultado e do número de operações aritméticas executadas pelo algoritmo */ /* presenting the result and the number of arithmetic operations executed by the algorithm */ if (Result) fprintf (stdout, "Verifica "); else fprintf (stdout, "Nao verifica\n "); fprintf (stdout, "Resultado = %3d N. de operacoes = %3d\n", Result, Sum); exit (EXIT_SUCCESS); } /* implementação do algoritmo pretendido */ /* não se esqueça de contar as operações aritméticas executadas pelo algoritmo usando a variável global */ /* implementation of the pretended algorithm */ /* do not forget to count the arithmetic operations using the global variable */ int SequentialSequence (int array[], int n){ assert (n>1); //verificação de que n tem que ser > 1 if (n < 2) return 0; int num=0, result=0; for(int i=0; i<n-1; i++){ num = array[i]+1; Sum++; // contar o numero de somas if(array[i+1] == num){ result = 1; } else{ result = 0; break; } } return result; }
34.894737
106
0.620664
[ "3d" ]
1705ff1c398e8399725602d8b7e6d69b0225d3b6
2,667
h
C
sys/include/sch.h
apexrtos/apex
9538ab2f5b974035ca30ca8750479bdefe153047
[ "0BSD" ]
15
2020-05-08T06:21:58.000Z
2021-12-11T18:10:43.000Z
sys/include/sch.h
apexrtos/apex
9538ab2f5b974035ca30ca8750479bdefe153047
[ "0BSD" ]
11
2020-05-08T06:46:37.000Z
2021-03-30T05:46:03.000Z
sys/include/sch.h
apexrtos/apex
9538ab2f5b974035ca30ca8750479bdefe153047
[ "0BSD" ]
5
2020-08-31T17:05:03.000Z
2021-12-08T07:09:00.000Z
/*- * Copyright (c) 2005-2007, Kohsuke Ohtani * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. */ #pragma once #include <cstdint> #include <queue.h> struct event; struct thread; /* * DPC (Deferred Procedure Call) object */ struct dpc { queue link; /* Linkage on DPC queue */ int state; /* DPC_* */ void (*func)(void *); /* Callback routine */ void *arg; /* Argument to pass */ }; /* * Scheduler interface */ extern "C" void sch_switch(); thread *sch_active(); unsigned sch_wakeup(event *, int); thread *sch_wakeone(event *); thread *sch_requeue(event *, event *); int sch_prepare_sleep(event *, uint_fast64_t); int sch_continue_sleep(); void sch_cancel_sleep(); void sch_unsleep(thread *, int); void sch_signal(thread *); void sch_suspend(thread *); void sch_resume(thread *); void sch_suspend_resume(thread *, thread *); void sch_elapse(uint_fast32_t); void sch_start(thread *); void sch_stop(thread *); bool sch_testexit(); void sch_lock(); void sch_unlock(); int sch_locks(); int sch_getprio(thread *); void sch_setprio(thread *, int, int); int sch_getpolicy(thread *); int sch_setpolicy(thread *, int); void sch_dpc(dpc *, void (*)(void *), void *); void sch_dump(); void sch_init();
34.192308
77
0.737533
[ "object" ]
170bc8a82491ec4da9bbc4e0867b27fe3f6b7369
1,282
h
C
src/3d/geometry/event.h
wkrzemien/j-pet-mlem
4ed746f3fe79890e4141158cd49d1869938105de
[ "Apache-2.0" ]
null
null
null
src/3d/geometry/event.h
wkrzemien/j-pet-mlem
4ed746f3fe79890e4141158cd49d1869938105de
[ "Apache-2.0" ]
5
2018-08-08T08:26:04.000Z
2020-05-13T13:33:39.000Z
src/3d/geometry/event.h
wkrzemien/j-pet-mlem
4ed746f3fe79890e4141158cd49d1869938105de
[ "Apache-2.0" ]
5
2018-06-04T21:04:29.000Z
2021-07-03T14:19:39.000Z
#pragma once #if !__CUDACC__ #include <ostream> #endif #include "3d/geometry/vector.h" #include "3d/geometry/point.h" #include "2d/barrel/event.h" #include "util/cuda/compat.h" namespace PET3D { /// Generic 3D emission event //// /// Emission event consist of origin (emission) point \f$ origin = (x, y, z) \f$ /// and direction (vector) \f$ direction = (dx, dy, dz) \f$. template <typename FType> class Event { using Vector = PET3D::Vector<FType>; using Vector2D = PET2D::Vector<FType>; using Point = PET3D::Point<FType>; using BarrelEvent = PET2D::Barrel::Event<FType>; public: _ Event(const Point& origin, const Vector& direction) : origin(origin), direction(direction) {} _ BarrelEvent to_barrel_event() const { auto direction_2d = Vector2D(direction.x, direction.y); direction_2d.normalize(); return BarrelEvent(origin.x, origin.y, direction_2d.x, direction_2d.y); } const Point origin; const Vector direction; #if !__CUDACC__ friend std::ostream& operator<<(std::ostream& out, const Event& event) { out << event.origin.x << ' ' << event.origin.y << ' ' << event.origin.z << " "; out << event.direction.x << ' ' << event.direction.y << " " << event.direction.z; return out; } #endif }; } // PET3D
25.64
80
0.656006
[ "geometry", "vector", "3d" ]
41b66e8dc61f51d57bb3f9863bf5145c1e690064
3,178
h
C
src/Nuz/SceneManager/GameObjectFloder.h
SmallLuma/NuzGameEngine
01465469bf2f5c7c2646978576280c4c464cd02a
[ "MIT" ]
null
null
null
src/Nuz/SceneManager/GameObjectFloder.h
SmallLuma/NuzGameEngine
01465469bf2f5c7c2646978576280c4c464cd02a
[ "MIT" ]
null
null
null
src/Nuz/SceneManager/GameObjectFloder.h
SmallLuma/NuzGameEngine
01465469bf2f5c7c2646978576280c4c464cd02a
[ "MIT" ]
null
null
null
#pragma once #include <map> #include <memory> #include <vector> #include <set> #include <queue> #include "../../../include/Nuz/SceneManager/Component.h" namespace Nuz_ { struct DrawTask2D; struct DrawTask3D; class Camera2D; class Camera3D; class GameObjectFloder final { public: enum ParentType { SCENE, GAMEOBJECT }; private: int m_drawLevel = 0; std::map<std::string, std::shared_ptr<Nuz::IComponent>> m_mountName2component; std::vector<std::shared_ptr<Nuz::IComponent>> m_allcomponent; std::map<std::string, std::shared_ptr<Nuz::IGameObject>> m_mountName2go; std::vector<std::shared_ptr<Nuz::IGameObject>> m_allgo; ParentType m_parentType; std::weak_ptr<Nuz::IGameObject> m_goParent; std::weak_ptr<Nuz::IScene> m_scParent; std::weak_ptr<const Nuz::ICamera2D> m_camera2D; std::queue<Nuz::IComponent*> m_unmountCompoTask; std::queue<Nuz::IGameObject*> m_unmountGOTask; void unmountGameObject_Really(Nuz::IGameObject*); void unmountComponent_Really(Nuz::IComponent*); public: void SetParent(const std::shared_ptr<Nuz::IGameObject>& p); void SetParent(const std::shared_ptr<Nuz::IScene>& p); inline void SetCamera2D(const std::shared_ptr<const Nuz::ICamera2D>& p) { m_camera2D = p; } inline std::weak_ptr<const Nuz::ICamera2D> GetCamera2D() { return m_camera2D; } inline ParentType GetParentType() { return m_parentType; } inline std::shared_ptr<Nuz::IGameObject> GetGOParent() { return m_goParent.lock(); } inline std::shared_ptr<Nuz::IScene> GetSCParent() { return m_scParent.lock(); } void MountComponent(const std::shared_ptr<Nuz::IComponent>&, const std::string& mountName = ""); inline void UnmountComponent(const std::string& mountName) { if (m_mountName2component.count(mountName) == 1) { m_unmountCompoTask.push(m_mountName2component.at(mountName).get()); } } inline void UnmountComponent(Nuz::IComponent* p) { m_unmountCompoTask.push(p); } inline std::shared_ptr<Nuz::IComponent> GetMountedComponent(const std::string& mountName) const { if (m_mountName2component.count(mountName) == 0) return std::shared_ptr<Nuz::IComponent>(nullptr); else return m_mountName2component.at(mountName); } void MountGameObject(const std::shared_ptr<Nuz::IGameObject>&, const std::string& mountName = ""); inline void UnmountGameObject(const std::string& mountName) { if (m_mountName2go.count(mountName) == 1) { m_unmountGOTask.push(m_mountName2go.at(mountName).get()); } } inline void UnmountGameObject(Nuz::IGameObject* p) { m_unmountGOTask.push(p); } std::shared_ptr<Nuz::IGameObject> GetMountedGameObject(const std::string& mountName) const; inline void SetDrawLevel(int i) { m_drawLevel = i; } inline int GetDrawLevel() { return m_drawLevel; } void OnUpdate(std::vector<DrawTask2D>& drawTask2D, std::vector<DrawTask3D>& drawTask3D, Camera2D* c2d, Camera3D* c3d); void OnDraw3D(); void OnDraw2D(); //void OnDrawScreenReady(); //void OnDrawScreenFinished(); void OnFadeSwitchOut(int timeLimited); void OnFadeSwitchOutUpdate(float finished); void OnFadeSwitchIn(int timeLimited); void OnFadeSwitchInUpdate(float finished); }; }
34.543478
120
0.735997
[ "vector" ]
41bb0a186f3ae8e2fdc8f2e3a2f429286739edc2
16,837
c
C
drivers/sensor/mpu6050/src/mpu6050.c
Ajit-M/Autopilot
1718a052f1b0a828f97a76826673100611d2e989
[ "Apache-2.0" ]
null
null
null
drivers/sensor/mpu6050/src/mpu6050.c
Ajit-M/Autopilot
1718a052f1b0a828f97a76826673100611d2e989
[ "Apache-2.0" ]
null
null
null
drivers/sensor/mpu6050/src/mpu6050.c
Ajit-M/Autopilot
1718a052f1b0a828f97a76826673100611d2e989
[ "Apache-2.0" ]
1
2021-03-18T11:44:55.000Z
2021-03-18T11:44:55.000Z
/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT invensense_mpu6050 #include <drivers/i2c.h> #include <init.h> #include <sys/byteorder.h> #include <drivers/sensor.h> #include <logging/log.h> #include <stdlib.h> #include <math.h> #include "mpu6050.h" LOG_MODULE_REGISTER(MPU6050, CONFIG_SENSOR_LOG_LEVEL); /* see "Accelerometer Measurements" section from register map description */ static void mpu6050_convert_accel(struct sensor_value *val, int16_t raw_val, uint16_t sensitivity_shift) { int64_t conv_val; conv_val = ((int64_t)raw_val * SENSOR_G) >> sensitivity_shift; val->val1 = conv_val / 1000000; val->val2 = conv_val % 1000000; } /* see "Gyroscope Measurements" section from register map description */ static void mpu6050_convert_gyro(struct sensor_value *val, int16_t raw_val, uint16_t sensitivity_x10) { int64_t conv_val; conv_val = ((int64_t)raw_val * SENSOR_PI * 10) / (sensitivity_x10 * 180U); val->val1 = conv_val / 1000000; val->val2 = conv_val % 1000000; } /* see "Temperature Measurement" section from register map description */ static inline void mpu6050_convert_temp(struct sensor_value *val, int16_t raw_val) { val->val1 = raw_val / 340 + 36; val->val2 = ((int64_t)(raw_val % 340) * 1000000) / 340 + 530000; if (val->val2 < 0) { val->val1--; val->val2 += 1000000; } else if (val->val2 >= 1000000) { val->val1++; val->val2 -= 1000000; } } /* (*) This function is used for accessing the fetched data from the sensor, that is stored in the device object */ static int mpu6050_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *val) { struct mpu6050_data *drv_data = dev->data; switch (chan) { case SENSOR_CHAN_ACCEL_XYZ: mpu6050_convert_accel(val, drv_data->accel_x, drv_data->accel_sensitivity_shift); mpu6050_convert_accel(val + 1, drv_data->accel_y, drv_data->accel_sensitivity_shift); mpu6050_convert_accel(val + 2, drv_data->accel_z, drv_data->accel_sensitivity_shift); break; case SENSOR_CHAN_ACCEL_X: mpu6050_convert_accel(val, drv_data->accel_x, drv_data->accel_sensitivity_shift); break; case SENSOR_CHAN_ACCEL_Y: mpu6050_convert_accel(val, drv_data->accel_y, drv_data->accel_sensitivity_shift); break; case SENSOR_CHAN_ACCEL_Z: mpu6050_convert_accel(val, drv_data->accel_z, drv_data->accel_sensitivity_shift); break; case SENSOR_CHAN_GYRO_XYZ: mpu6050_convert_gyro(val, drv_data->gyro_x, drv_data->gyro_sensitivity_x10); mpu6050_convert_gyro(val + 1, drv_data->gyro_y, drv_data->gyro_sensitivity_x10); mpu6050_convert_gyro(val + 2, drv_data->gyro_z, drv_data->gyro_sensitivity_x10); break; case SENSOR_CHAN_GYRO_X: mpu6050_convert_gyro(val, drv_data->gyro_x, drv_data->gyro_sensitivity_x10); break; case SENSOR_CHAN_GYRO_Y: mpu6050_convert_gyro(val, drv_data->gyro_y, drv_data->gyro_sensitivity_x10); break; case SENSOR_CHAN_GYRO_Z: mpu6050_convert_gyro(val, drv_data->gyro_z, drv_data->gyro_sensitivity_x10); break; default: /* chan == SENSOR_CHAN_DIE_TEMP */ mpu6050_convert_temp(val, drv_data->temp); } return 0; } /* (*) Sample Fetch only runs once but i guess it will be set the sensor enum for choosing the channels (*) Q) So where th */ static int mpu6050_sample_fetch(const struct device *dev, enum sensor_channel chan) { struct mpu6050_data *drv_data = dev->data; const struct mpu6050_config *cfg = dev->config; int16_t buf[7]; /* (*) Burst reading of the device register, it is read and stored in the buffer, which is then shifted to the memory assigned to the device data structure object. (*) A point to note that, before assigning the data to the struct it is converted to the 16-bit integer from big-endian to the host endianness (*) This function needs to be called everytime the task needs the data, then */ if (i2c_burst_read(drv_data->i2c, cfg->i2c_addr, MPU6050_REG_DATA_START, (uint8_t *)buf, 14) < 0) { LOG_ERR("Failed to read data sample."); return -EIO; } /* Endianness conversion */ drv_data->accel_x = sys_be16_to_cpu(buf[0]); drv_data->accel_y = sys_be16_to_cpu(buf[1]); drv_data->accel_z = sys_be16_to_cp if (i2c_burst_read(drv_data->i2c, cfg->i2c_addr, MPU6050_REG_DATA_START, (uint8_t *)buf, 14) < 0) { LOG_ERR("Failed to read data sample."); return -EIO; } u(buf[2]); drv_data->temp = sys_be16_to_cpu(buf[3]); drv_data->gyro_x = sys_be16_to_cpu(buf[4]); drv_data->gyro_y = sys_be16_to_cpu(buf[5]); drv_data->gyro_z = sys_be16_to_cpu(buf[6]); return 0; } static const struct sensor_driver_api mpu6050_driver_api = { #if CONFIG_MPU6050_TRIGGER .trigger_set = mpu6050_trigger_set, #endif .sample_fetch = mpu6050_sample_fetch, .channel_get = mpu6050_channel_get, }; int mpu6050_init(const struct device *dev){ printk("Initialization of the device from the init fuction \n"); struct mpu6050_data *drv_data = dev->data; const struct mpu6050_config *cfg = dev->config; uint8_t id, i; // ------------------------------------------------------------------------------------------------ testConnection(drv_data, cfg); // ------------------------------------------------------------------------------------------------ /* set accelerometer full-scale range */ for (i = 0U; i < 4; i++) { if (BIT(i+1) == CONFIG_MPU6050_ACCEL_FS) { break; } } if (i == 4U) { LOG_ERR("Invalid value for accel full-scale range."); return -EINVAL; } if (i2c_reg_write_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_REG_ACCEL_CFG, i << MPU6050_ACCEL_FS_SHIFT) < 0) { LOG_ERR("Failed to write accel full-scale range."); return -EIO; } drv_data->accel_sensitivity_shift = 14 - i; // ------------------------------------------------------------------------------------------------ /* set gyroscope full-scale range */ for (i = 0U; i < 4; i++) { if (BIT(i) * 250 == CONFIG_MPU6050_GYRO_FS) { break; } } if (i == 4U) { LOG_ERR("Invalid value for gyro full-scale range."); return -EINVAL; } if (i2c_reg_write_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_REG_GYRO_CFG, i << MPU6050_GYRO_FS_SHIFT) < 0) { LOG_ERR("Failed to write gyro full-scale range."); return -EIO; } drv_data->gyro_sensitivity_x10 = mpu6050_gyro_sensitivity_x10[i]; // ------------------------------------------------------------------------------------------------ #ifdef CONFIG_MPU6050_TRIGGER if (mpu6050_init_interrupt(dev) < 0) { LOG_DBG("Failed to initialize interrupts."); return -EIO; } #endif return 0; } /** * @param drv_data User defined struct for storing the read data from the mpu6050 registers. * @param cfg User defined struct for storing the mpu6050 configuration data such as, i2c label, registers * and interrupt pin. * * @brief This function is responsible for looking up if the label exist, testing the connection, checking * the chip ID and waking up the chip. * */ int testConnection(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg) { drv_data->i2c = device_get_binding(cfg->i2c_label); if (drv_data->i2c == NULL) { LOG_ERR("Failed to get pointer to %s device", cfg->i2c_label); return -EINVAL; } /* check chip ID */ if (i2c_reg_read_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_REG_CHIP_ID, &id) < 0) { LOG_ERR("Failed to read chip ID."); return -EIO; } if (id != MPU6050_CHIP_ID) { LOG_ERR("Invalid chip ID."); return -EINVAL; } /* wake up chip */ if (i2c_reg_update_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_REG_PWR_MGMT1, MPU6050_SLEEP_EN, 0) < 0) { LOG_ERR("Failed to wake up chip."); return -EIO; } } /** * @brief User defined Gyro Offset * */ int setXGyroOffset(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg, int8_t offset){ //Wrting the User defined Gyroscope X axis offset if (i2c_reg_write_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_RA_XG_OFFS_USRH, offset) < 0) { LOG_ERR("Failed to write Gyroscope X axis offset."); return -EIO; } } /** * */ int setYGyroOffset(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg, int8_t offset){ //Wrting the User defined Gyroscope Y axis offset if (i2c_reg_write_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_RA_YG_OFFS_USRH, offset) < 0) { LOG_ERR("Failed to write Gyroscope Y axis offset."); return -EIO; } } /** * */ int setZGyroOffset(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg, int8_t offset){ //Wrting the User defined Gyroscope Z axis offset if (i2c_reg_write_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_RA_USER_CTRL, offset) < 0) { LOG_ERR("Failed to write Gyroscope Z axis offset."); return -EIO; } } /** * @brief This function is intended to remove the offsets from the gyroscope and accelerometer measurements, previously * an averaging method was used on the colleted samples (data) of the sensors output and an mean was found. But recently a * guy named "ZHomeSlice" has implemented a faster and simpler method to find offset using PID (mainly PI). * * * Q) Why tf this getDeviceID() < 0x38 ? (I understand that there is difference between registers for the accel offset * but how does this differentiate the things) */ void PID(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg, uint8_t ReadAddress, float kP,float kI, uint8_t Loops){ uint8_t SaveAddress = (ReadAddress == 0x3B)?((getDeviceID() < 0x38 )? 0x06:0x77):0x13; int16_t Data; float Reading; int16_t BitZero[3]; uint8_t shift =(SaveAddress == 0x77)?3:2; float Error, PTerm, ITerm[3]; int16_t eSample; uint32_t eSum; // Serial.write('>'); for (int i = 0; i < 3; i++) { i2c_burst_read(drv_data->i2c, cfg->i2c_addr,SaveAddress + (i * shift), &Data, 2); Reading = Data; if(SaveAddress != 0x13){ BitZero[i] = Data & 1; // Capture Bit Zero to properly handle Accelerometer calibration ITerm[i] = ((float)Reading) * 8; } else { ITerm[i] = Reading * 4; } } for (int L = 0; L < Loops; L++) { eSample = 0; for (int c = 0; c < 100; c++) {// 100 PI Calculations eSum = 0; for (int i = 0; i < 3; i++) { i2c_burst_read(drv_data->i2c, cfg->i2c_addr,ReadAddress + (i * 2), &Data, 2); Reading = Data; if ((ReadAddress == 0x3B)&&(i == 2)) Reading -= 16384; //remove Gravity Error = -Reading; eSum += abs(Reading); // Need to change this function as well this is an arduino function PTerm = kP * Error; ITerm[i] += (Error * 0.001) * kI; // Integral term 1000 Calculations a second = 0.001 if(SaveAddress != 0x13){ Data = round((PTerm + ITerm[i] ) / 8); //Compute PID Output Data = ((Data)&0xFFFE) |BitZero[i]; // Insert Bit0 Saved at beginning } else Data = round((PTerm + ITerm[i] ) / 4); //Compute PID Output i2c_burst_write(drv_data->i2c, cfg->i2c_addr,SaveAddress + (i * shift),&Data, 2); } if((c == 99) && eSum > 1000){ // Error is still to great to continue c = 0; // Serial.write('*'); } if((eSum * ((ReadAddress == 0x3B)?.05: 1)) < 5) eSample++; // Successfully found offsets prepare to advance if((eSum < 100) && (c > 10) && (eSample >= 10)) break; // Advance to next Loop delay(1); } // Serial.write('.'); kP *= .75; kI *= .75; for (int i = 0; i < 3; i++){ if(SaveAddress != 0x13) { Data = round((ITerm[i] ) / 8); //Compute PID Output Data = ((Data)&0xFFFE) |BitZero[i]; // Insert Bit0 Saved at beginning } else Data = round((ITerm[i]) / 4); i2c_burst_write(drv_data->i2c, cfg->i2c_addr,SaveAddress + (i * shift),&Data, 2); } } resetFIFO(drv_data, cfg); resetDMP(); } // USER_CTRL register (DMP function) /** * */ void resetDMP(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg) { if(i2c_reg_update_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_RA_USER_CTRL, MPU6050_USERCTRL_DMP_RESET_BIT, true) < 0){ return -EIO; } } /** Reset the FIFO. * This bit resets the FIFO buffer when set to 1 while FIFO_EN equals 0. This * bit automatically clears to 0 after the reset has been triggered. * @see MPU6050_RA_USER_CTRL * @see MPU6050_USERCTRL_FIFO_RESET_BIT */ void resetFIFO(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg) { if(i2c_reg_update_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_RA_USER_CTRL, MPU6050_USERCTRL_FIFO_RESET_BIT, true) < 0){ return -EIO; } } /** @brief Fully calibrate Gyro from ZERO in about 6-7 Loops 600-700 readings */ int GyroCalibrate(int8_t Loops){ double kP = 0.3; double kI = 90; float x; x = (100 - map(Loops, 1, 5, 20, 0)) * .01; kP *= x; kI *= x; PID( 0x43, kP, kI, Loops); } /** @brief Fully calibrate Accel from ZERO in about 6-7 Loops 600-700 readings */ int AccelCalibrate(int8_t Loops){ float kP = 0.3; float kI = 20; float x; x = (100 - map(Loops, 1, 5, 20, 0)) * .01; //Need to write this map function as well kP *= x; kI *= x; PID( 0x3B, kP, kI, Loops); } /** * */ int setDMPEnabled(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg){ // This function OR's the old value and the new value stored in the register. if (i2c_reg_update_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_RA_ZG_OFFS_USRH, MPU6050_USERCTRL_DMP_EN_BIT, true) < 0) { LOG_ERR("Failed to write Gyroscope Z axis offset."); return -EIO; } } // PWR_MGMT_1 register /** Trigger a full device reset. * A small delay of ~50ms may be desirable after triggering a reset. * @see MPU6050_RA_PWR_MGMT_1 * @see MPU6050_PWR1_DEVICE_RESET_BIT */ int reset(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg){ if (i2c_reg_update_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_RA_USER_CTRL, MPU6050_USERCTRL_SIG_COND_RESET_BIT, true) < 0) { LOG_ERR("Failed to write Gyroscope Z axis offset."); return -EIO; } } /** Set sleep mode status. * @param enabled New sleep mode enabled status * @see getSleepEnabled() * @see MPU6050_RA_PWR_MGMT_1 * @see MPU6050_PWR1_SLEEP_BIT */ void setSleepEnabled(struct mpu6050_data *drv_data, const struct mpu6050_config *cfg, bool enable) { if (i2c_reg_update_byte(drv_data->i2c, cfg->i2c_addr, MPU6050_RA_PWR_MGMT_1, MPU6050_USERCTRL_SIG_COND_RESET_BIT, enable) < 0) { LOG_ERR("Failed to write Gyroscope Z axis offset."); return -EIO; } } /** Set the I2C address of the specified slave (0-3). * @param num Slave number (0-3) * @param address New address for specified slave * @see getSlaveAddress() * @see MPU6050_RA_I2C_SLV0_ADDR */ void setSlaveAddress(uint8_t num, uint8_t address) { if (num > 3) return; I2Cdev::writeByte(devAddr, MPU6050_RA_I2C_SLV0_ADDR + num*3, address); } /** Set I2C Master Mode enabled status. * @param enabled New I2C Master Mode enabled status * @see getI2CMasterModeEnabled() * @see MPU6050_RA_USER_CTRL * @see MPU6050_USERCTRL_I2C_MST_EN_BIT */ void MPU6050::setI2CMasterModeEnabled(bool enabled) { I2Cdev::writeBit(devAddr, MPU6050_RA_USER_CTRL, MPU6050_USERCTRL_I2C_MST_EN_BIT, enabled); } /** Reset the I2C Master. * This bit resets the I2C Master when set to 1 while I2C_MST_EN equals 0. * This bit automatically clears to 0 after the reset has been triggered. * @see MPU6050_RA_USER_CTRL * @see MPU6050_USERCTRL_I2C_MST_RESET_BIT */ void MPU6050::resetI2CMaster() { I2Cdev::writeBit(devAddr, MPU6050_RA_USER_CTRL, MPU6050_USERCTRL_I2C_MST_RESET_BIT, true); } /** * */ int dmpGetFifoPacketSize(){ } /** * */ int getFifoCount() { } /** * */ int resetFifoCount(){ } /** * */ int getFifoBytes(){ } /** * */ int dmpGetQuaternion(){ } /** * */ int dmpGetEuler() { } /** * */ int dmpGetGravity(){ } /** * */ int dmpGetYawPitchRoll(){ } /** * */ int dmpGetAccel(){ } /** * */ int linearAccel(){ } /** * */ int dmpGetLinearAccelInWorld(){ } static struct mpu6050_data mpu6050_driver; static const struct mpu6050_config mpu6050_cfg = { .i2c_label = DT_INST_BUS_LABEL(0), .i2c_addr = DT_INST_REG_ADDR(0), #ifdef CONFIG_MPU6050_TRIGGER .int_pin = DT_INST_GPIO_PIN(0, int_gpios), .int_flags = DT_INST_GPIO_FLAGS(0, int_gpios), .int_label = DT_INST_GPIO_LABEL(0, int_gpios), #endif /* CONFIG_MPU6050_TRIGGER */ }; DEVICE_DT_INST_DEFINE(0, mpu6050_init, device_pm_control_nop, &mpu6050_driver, &mpu6050_cfg, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &mpu6050_driver_api);
24.087268
129
0.663954
[ "object" ]
41cf745428dbb75ca63a95dc1f927f8b8b471288
14,086
h
C
NextBot/NextBotEventResponderInterface.h
jaychellah/survivor_battle_stations_fix
3b1f0ce1602fb941897381d9b6e6b794dbe07ff5
[ "MIT" ]
null
null
null
NextBot/NextBotEventResponderInterface.h
jaychellah/survivor_battle_stations_fix
3b1f0ce1602fb941897381d9b6e6b794dbe07ff5
[ "MIT" ]
null
null
null
NextBot/NextBotEventResponderInterface.h
jaychellah/survivor_battle_stations_fix
3b1f0ce1602fb941897381d9b6e6b794dbe07ff5
[ "MIT" ]
null
null
null
// NextBotEventResponderInterface.h // Interface for propagating and responding to events // Author: Michael Booth, May 2006 // Copyright (c) 2006 Turtle Rock Studios, Inc. - All Rights Reserved #ifndef _NEXT_BOT_EVENT_RESPONDER_INTERFACE_H_ #define _NEXT_BOT_EVENT_RESPONDER_INTERFACE_H_ class Path; class CTakeDamageInfo; class CBaseEntity; struct animevent_t; enum MoveToFailureType { FAIL_NO_PATH_EXISTS, FAIL_STUCK, FAIL_FELL_OFF, }; //-------------------------------------------------------------------------------------------------------------------------- /** * Events propagated to/between components. * To add an event, add its signature here and implement its propagation * to derived classes via FirstContainedResponder() and NextContainedResponder(). * NOTE: Also add a translator to the Action class in NextBotBehavior.h. */ class INextBotEventResponder { public: virtual ~INextBotEventResponder() { } // these methods are used by derived classes to define how events propagate virtual INextBotEventResponder *FirstContainedResponder( void ) const { return NULL; } virtual INextBotEventResponder *NextContainedResponder( INextBotEventResponder *current ) const { return NULL; } #if SOURCE_ENGINE == SE_LEFT4DEAD2 virtual const char *GetDebugString( void ) const { return NULL; } #endif // // Events. All events must be 'extended' by calling the derived class explicitly to ensure propagation. // Each event must implement its propagation in this interface class. // virtual void OnLeaveGround( CBaseEntity *ground ); // invoked when bot leaves ground for any reason virtual void OnLandOnGround( CBaseEntity *ground ); // invoked when bot lands on the ground after being in the air virtual void OnContact( CBaseEntity *other, CGameTrace *result = NULL ); // invoked when bot touches 'other' virtual void OnMoveToSuccess( const Path *path ); // invoked when a bot reaches the end of the given Path virtual void OnMoveToFailure( const Path *path, MoveToFailureType reason ); // invoked when a bot fails to reach the end of the given Path virtual void OnStuck( void ); // invoked when bot becomes stuck while trying to move virtual void OnUnStuck( void ); // invoked when a previously stuck bot becomes un-stuck and can again move virtual void OnPostureChanged( void ); // when bot has assumed new posture (query IBody for posture) virtual void OnAnimationActivityComplete( int activity ); // when animation activity has finished playing virtual void OnAnimationActivityInterrupted( int activity );// when animation activity was replaced by another animation virtual void OnAnimationEvent( animevent_t *event ); // when a QC-file animation event is triggered by the current animation sequence virtual void OnIgnite( void ); // when bot starts to burn virtual void OnInjured( const CTakeDamageInfo &info ); // when bot is damaged by something virtual void OnKilled( const CTakeDamageInfo &info ); // when the bot's health reaches zero virtual void OnOtherKilled( CBaseCombatCharacter *victim, const CTakeDamageInfo &info ); // when someone else dies virtual void OnSight( CBaseEntity *subject ); // when subject initially enters bot's visual awareness virtual void OnLostSight( CBaseEntity *subject ); // when subject leaves enters bot's visual awareness #if SOURCE_ENGINE == SE_LEFT4DEAD || SOURCE_ENGINE == SE_LEFT4DEAD2 virtual void OnThreatChanged( CBaseEntity *threat ); #endif virtual void OnSound( CBaseEntity *source, const Vector &pos, KeyValues *keys ); // when an entity emits a sound. "pos" is world coordinates of sound. "keys" are from sound's GameData virtual void OnSpokeConcept( CBaseCombatCharacter *who, CAI_Concept concept, AI_Response *response ); // when an Actor speaks a concept virtual void OnNavAreaChanged( CNavArea *newArea, CNavArea *oldArea ); // when bot enters a new navigation area virtual void OnModelChanged( void ); // when the entity's model has been changed virtual void OnPickUp( CBaseEntity *item, CBaseCombatCharacter *giver ); // when something is added to our inventory virtual void OnDrop( CBaseEntity *item ); // when something is removed from our inventory #if SOURCE_ENGINE == SE_LEFT4DEAD || SOURCE_ENGINE == SE_LEFT4DEAD2 virtual void OnShoved( CBaseEntity *pusher ); // 'pusher' has shoved me virtual void OnBlinded( CBaseEntity *blinder ); // 'blinder' has blinded me with a flash of light #endif #if SOURCE_ENGINE == SE_LEFT4DEAD2 virtual void OnEnteredSpit( void ); virtual void OnHitByVomitJar( CBaseEntity *thrower ); #endif virtual void OnCommandAttack( CBaseEntity *victim ); // attack the given entity #if SOURCE_ENGINE == SE_LEFT4DEAD2 virtual void OnCommandAssault( void ); #endif virtual void OnCommandApproach( const Vector &pos, float range = 0.0f ); // move to within range of the given position virtual void OnCommandApproach( CBaseEntity *goal ); // follow the given leader virtual void OnCommandRetreat( CBaseEntity *threat, float range = 0.0f ); // retreat from the threat at least range units away (0 == infinite) virtual void OnCommandPause( float duration = 0.0f ); // pause for the given duration (0 == forever) virtual void OnCommandResume( void ); // resume after a pause #if SOURCE_ENGINE == SE_LEFT4DEAD2 virtual void OnCommandString( const char *command ); // for debugging: respond to an arbitrary string representing a generalized command #endif }; inline void INextBotEventResponder::OnLeaveGround( CBaseEntity *ground ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnLeaveGround( ground ); } } inline void INextBotEventResponder::OnLandOnGround( CBaseEntity *ground ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnLandOnGround( ground ); } } inline void INextBotEventResponder::OnContact( CBaseEntity *other, CGameTrace *result ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnContact( other, result ); } } inline void INextBotEventResponder::OnMoveToSuccess( const Path *path ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnMoveToSuccess( path ); } } inline void INextBotEventResponder::OnMoveToFailure( const Path *path, MoveToFailureType reason ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnMoveToFailure( path, reason ); } } inline void INextBotEventResponder::OnStuck( void ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnStuck(); } } inline void INextBotEventResponder::OnUnStuck( void ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnUnStuck(); } } inline void INextBotEventResponder::OnPostureChanged( void ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnPostureChanged(); } } inline void INextBotEventResponder::OnAnimationActivityComplete( int activity ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnAnimationActivityComplete( activity ); } } inline void INextBotEventResponder::OnAnimationActivityInterrupted( int activity ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnAnimationActivityInterrupted( activity ); } } inline void INextBotEventResponder::OnAnimationEvent( animevent_t *event ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnAnimationEvent( event ); } } inline void INextBotEventResponder::OnIgnite( void ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnIgnite(); } } inline void INextBotEventResponder::OnInjured( const CTakeDamageInfo &info ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnInjured( info ); } } inline void INextBotEventResponder::OnKilled( const CTakeDamageInfo &info ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnKilled( info ); } } inline void INextBotEventResponder::OnOtherKilled( CBaseCombatCharacter *victim, const CTakeDamageInfo &info ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnOtherKilled( victim, info ); } } inline void INextBotEventResponder::OnSight( CBaseEntity *subject ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnSight( subject ); } } inline void INextBotEventResponder::OnLostSight( CBaseEntity *subject ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnLostSight( subject ); } } inline void INextBotEventResponder::OnThreatChanged( CBaseEntity *threat ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnThreatChanged( threat ); } } inline void INextBotEventResponder::OnSound( CBaseEntity *source, const Vector &pos, KeyValues *keys ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnSound( source, pos, keys ); } } inline void INextBotEventResponder::OnSpokeConcept( CBaseCombatCharacter *who, CAI_Concept concept, AI_Response *response ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnSpokeConcept( who, concept, response ); } } inline void INextBotEventResponder::OnNavAreaChanged( CNavArea *newArea, CNavArea *oldArea ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnNavAreaChanged( newArea, oldArea ); } } inline void INextBotEventResponder::OnModelChanged( void ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnModelChanged(); } } inline void INextBotEventResponder::OnPickUp( CBaseEntity *item, CBaseCombatCharacter *giver ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnPickUp( item, giver ); } } inline void INextBotEventResponder::OnDrop( CBaseEntity *item ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnDrop( item ); } } inline void INextBotEventResponder::OnShoved( CBaseEntity *pusher ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnShoved( pusher ); } } inline void INextBotEventResponder::OnBlinded( CBaseEntity *blinder ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnBlinded( blinder ); } } inline void INextBotEventResponder::OnEnteredSpit( void ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnEnteredSpit(); } } inline void INextBotEventResponder::OnHitByVomitJar( CBaseEntity *thrower ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnHitByVomitJar( thrower ); } } inline void INextBotEventResponder::OnCommandAttack( CBaseEntity *victim ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnCommandAttack( victim ); } } inline void INextBotEventResponder::OnCommandAssault() { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnCommandAssault(); } } inline void INextBotEventResponder::OnCommandApproach( const Vector &pos, float range ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnCommandApproach( pos, range ); } } inline void INextBotEventResponder::OnCommandApproach( CBaseEntity *goal ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnCommandApproach( goal ); } } inline void INextBotEventResponder::OnCommandRetreat( CBaseEntity *threat, float range ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnCommandRetreat( threat, range ); } } inline void INextBotEventResponder::OnCommandPause( float duration ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnCommandPause( duration ); } } inline void INextBotEventResponder::OnCommandResume( void ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnCommandResume(); } } inline void INextBotEventResponder::OnCommandString( const char *command ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { sub->OnCommandString( command ); } } #endif // _NEXT_BOT_EVENT_RESPONDER_INTERFACE_H_
36.210797
188
0.724762
[ "vector", "model" ]
41d7da0fd6d49cf17057cbf7161238b6f1296cb8
40,073
c
C
dpsk_boost_vmc.X/sources/power_control/devices/dev_boost_pconfig.c
microchip-pic-avr-examples/dpsk3-power-boost-voltage-mode-control
f21139a7f4a729f4d3611dc8c589193f62cacfdd
[ "ADSL" ]
2
2021-11-05T20:54:44.000Z
2022-02-14T09:41:09.000Z
dpsk_boost_vmc.X/sources/power_control/devices/dev_boost_pconfig.c
microchip-pic-avr-examples/dpsk3-power-boost-voltage-mode-control
f21139a7f4a729f4d3611dc8c589193f62cacfdd
[ "ADSL" ]
null
null
null
dpsk_boost_vmc.X/sources/power_control/devices/dev_boost_pconfig.c
microchip-pic-avr-examples/dpsk3-power-boost-voltage-mode-control
f21139a7f4a729f4d3611dc8c589193f62cacfdd
[ "ADSL" ]
2
2022-02-08T06:22:33.000Z
2022-02-26T11:13:51.000Z
/* * File: drv_boost_pconfig.c * Author: M91406 * * Created on March 12, 2020, 4:31 PM */ #if (__XC16_VERSION__ > 1500) #pragma message ("Warning: Library file '" __FILE__ "' has not been tested with the recently selected compiler version") #endif #include <xc.h> // include processor files - each processor file is guarded. #include <stdint.h> // include standard integer types header file #include <stdbool.h> // include standard boolean types header file #include "dev_boost_pconfig.h" #include "dev_boost_templates.h" /* PRIVATE VARIABLES */ /** * @var adcore_mask * @ingroup lib-layer-boost-pconfig-properties-variables * @brief This variable is use to set the ADC core mask */ volatile uint16_t adcore_mask=0; /** * @var adcore_diff_mask * @ingroup lib-layer-boost-pconfig-properties-variables * @brief This variable is use to set the ADC core mask */ volatile uint16_t adcore_diff_mask=0; /* PRIVATE FUNCTION CALL PROTOTYPES */ volatile uint16_t boostGPIO_PrivateInitialize(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance); /******************************************************************************* * @fn uint16_t boostPWM_ModuleInitialize(volatile struct BOOST_CONVERTER_s* boostInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief Initializes the boost PWM module by resetting its registers to default * @param boostInstance Pointer to a Boost Converter data object of type struct BOOST_CONVERTER_s * @return unsigned integer (0=failure, 1=success) * * @details * This function initializes the boost PWM module base registers with default * values for maximum performance. * * Default configuration: * - all PWM peripheral power is enabled * - all PWM generators are disabled * - default PWM Module configurations are written in boost PWM module base registers *********************************************************************************/ volatile uint16_t boostPWM_ModuleInitialize(volatile struct BOOST_CONVERTER_s* boostInstance) { volatile uint16_t retval=1; volatile struct P33C_PWM_MODULE_s* pwm; // Make sure power to the peripheral is enabled volatile bool _pmdlock = PMDCONbits.PMDLOCK; // Copy state of PMD lock bit PMDCONbits.PMDLOCK = 0; // Unlock PMD register writes PMD1bits.PWMMD = 0; // PWM Module Disable: PWM module is enabled PMDCONbits.PMDLOCK = _pmdlock; // set previous state of PMD lock // DISABLE ALL PWM GENERATORS PG1CONLbits.ON = 0; // PWM Generator #1 Enable: PWM Generator is not enabled PG2CONLbits.ON = 0; // PWM Generator #2 Enable: PWM Generator is not enabled PG3CONLbits.ON = 0; // PWM Generator #3 Enable: PWM Generator is not enabled PG4CONLbits.ON = 0; // PWM Generator #4 Enable: PWM Generator is not enabled #if defined (PG5CONL) PG5CONLbits.ON = 0; // PWM Generator #5 Enable: PWM Generator is not enabled #endif #if defined (PG6CONL) PG6CONLbits.ON = 0; // PWM Generator #6 Enable: PWM Generator is not enabled #endif #if defined (PG7CONL) PG7CONLbits.ON = 0; // PWM Generator #7 Enable: PWM Generator is not enabled #endif #if defined (PG8CONL) PG8CONLbits.ON = 0; // PWM Generator #8 Enable: PWM Generator is not enabled #endif // Write default PWM Module configuration to PWM module base registers pwm = p33c_PwmModule_GetHandle(); retval &= p33c_PwmModule_ConfigWrite(boostPwmModuleConfig); // If boost converter has been configured in MASTER PERIOD mode if (boostInstance->sw_node[0].master_period_enable) // If master period mode is enabled... pwm->vMPER.value = boostInstance->sw_node[0].period; // Set Period of phase #1 return(retval); } /******************************************************************************* * @fn uint16_t boostPWM_ChannelInitialize(volatile struct BOOST_CONVERTER_s* boostInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function initializes the output pins for the PWM output and the default boost PWM settings * @param boostInstance Pointer to a Boost Converter data object of type struct BOOST_CONVERTER_s * @return unsigned integer (0=failure, 1=success) * * @details * This function initializes the boost PWM channel with default values for maximum performance. * * Default configuration: * - selected PWM outputs are enabled * - PWM timing settings are loaded (i.e., duty cycle, period, dead-times, blanking) * - PWM synchronization is established *********************************************************************************/ volatile uint16_t boostPWM_ChannelInitialize(volatile struct BOOST_CONVERTER_s* boostInstance) { volatile uint16_t retval=1; volatile uint16_t _i=0; volatile struct P33C_GPIO_INSTANCE_s* gpio; volatile struct P33C_PWM_GENERATOR_s* pg; volatile uint16_t pwm_Instance; volatile uint16_t gpio_Instance; for (_i=0; _i<boostInstance->set_values.no_of_phases; _i++) { // LOAD PERIPHERAL INSTANCES FROM BOOST CONVERTER OBJECT pwm_Instance = boostInstance->sw_node[_i].pwm_instance; gpio_Instance = boostInstance->sw_node[_i].gpio_instance; // CAPTURE MEMORY ADDRESS OF GIVEN PWM GENERATOR INSTANCE gpio = p33c_GpioInstance_GetHandle(gpio_Instance); // WRITE GPIO CONFIGURATION OF PWM OUTPUT(S) gpio->LATx.value &= ~(0x0001 << boostInstance->sw_node[_i].gpio_high); // Clear PWMxH output LOW gpio->LATx.value &= ~(0x0001 << boostInstance->sw_node[_i].gpio_low); // Clear PWMxL output LOW gpio->TRISx.value &= ~(0x0001 << boostInstance->sw_node[_i].gpio_high); // Clear PWMxH output to OUTPUT gpio->TRISx.value &= ~(0x0001 << boostInstance->sw_node[_i].gpio_low); // Clear PWMxL output to OUTPUT gpio->CNPDx.value |= (0x0001 << boostInstance->sw_node[_i].gpio_high); // Enable intern pull down register (PWM1H) gpio->CNPDx.value |= (0x0001 << boostInstance->sw_node[_i].gpio_low); // Enable intern pull down register (PWM1L) // COPY CONFIGURATION FROM TEMPLATE TO PWM GENERATOR x CONTROL REGISTERS pg = p33c_PwmGenerator_GetHandle(pwm_Instance); retval &= p33c_PwmGenerator_ConfigWrite(boostInstance->sw_node[_i].pwm_instance, boostPwmGeneratorConfig); // LOAD PWM GENERATOR TIMING SETTINGS FROM BOOST CONVERTER OBJECT pg->PGxCONH.bits.MPERSEL = (uint16_t)boostInstance->sw_node[_i].master_period_enable; pg->PGxCONL.bits.HREN = (uint16_t)boostInstance->sw_node[_i].high_resolution_enable; pg->PGxDC.value = boostInstance->sw_node[_i].duty_ratio_min; // PGxDC: PWM GENERATOR x DUTY CYCLE REGISTER pg->PGxPER.value = boostInstance->sw_node[_i].period; // PGxPER: PWM GENERATOR x PERIOD REGISTER pg->PGxDTL.value = boostInstance->sw_node[_i].dead_time_falling; // PGxDTL: PWM GENERATOR x DEAD-TIME REGISTER LOW pg->PGxDTH.value = boostInstance->sw_node[_i].dead_time_rising; // PGxDTH: PWM GENERATOR x DEAD-TIME REGISTER HIGH pg->PGxLEBL.value = boostInstance->sw_node[_i].leb_period; // PWM GENERATOR x LEADING-EDGE BLANKING REGISTER LOW // Select if PWMxH/PWMxL pins should be swapped pg->PGxIOCONL.bits.SWAP = boostInstance->sw_node[_i].swap_outputs; // PGxIOCONL: PWM GENERATOR x I/O CONTROL REGISTER LOW -> SWAP: Swap PWM Signals to PWMxH and PWMxL Device Pins bit // ToDo: PWM Synchronization needs to be more universaL // PWM synchronization only work within groups of 4 (PG1-PG4 or PG5-PG8) // Multiphase boost converter auto PWM phase synchronization if ((_i == 0) && ((uint16_t)(boostInstance->set_values.no_of_phases) > 1U)) { // First phase is always master phase pg->PGxCONH.bits.MSTEN = 1; // Enable Master synchronization mode pg->PGxCONH.bits.SOCS = 0b0000; // Master PWM always triggers itself pg->PGxEVTL.bits.PGTRGSEL = 0b011; // PGxTRIGC is always used as PWM synchronization trigger output pg->PGxTRIGC.value = boostInstance->sw_node[_i+1].phase; // Set phase shift between master phase and first synchronized phase pg->PGxCONH.bits.UPDMOD = 0b001; // Immediate update pg->PGxEVTL.bits.UPDTRG = 0b11; // A write of the PGxTRIGA register automatically sets the UPDATE bit } else if ((0 < _i) && (_i < (boostInstance->set_values.no_of_phases-1))) { // Every synchronized phase is synchronized to previous phase while being master to following pg->PGxCONH.bits.MSTEN = 1; // Enable Master synchronization mode pg->PGxCONH.bits.SOCS = boostInstance->sw_node[_i-1].pwm_instance; // synchronized PWM is always triggered by previous generator while providing trigger for following pg->PGxEVTL.bits.PGTRGSEL = 0b011; // PGxTRIGC is always used as PWM synchronization trigger output pg->PGxTRIGC.value = boostInstance->sw_node[_i+1].phase; // Set phase shift between master phase and first synchronized phase pg->PGxCONH.bits.UPDMOD = 0b011; // Sync immediate update pg->PGxEVTL.bits.UPDTRG = 0; // User must set the UPDREQ bit (PGxSTAT[3]) manually } else if ((0 < _i) && (_i == (boostInstance->set_values.no_of_phases-1))) { // Last phase does not provide any master trigger pg->PGxCONH.bits.MSTEN = 0; // Disable Master synchronization mode pg->PGxCONH.bits.SOCS = boostInstance->sw_node[_i-1].pwm_instance; // synchronized PWM is always triggered by previous generator while providing trigger for following pg->PGxEVTL.bits.PGTRGSEL = 0b000; // EOC is the general trigger output pg->PGxTRIGC.value = 0x0000; // Clear phase shift value pg->PGxCONH.bits.UPDMOD = 0b011; // Sync immediate update pg->PGxEVTL.bits.UPDTRG = 0; // User must set the UPDREQ bit (PGxSTAT[3]) manually } else if (boostInstance->set_values.no_of_phases == 1U) { // This is only a single phase system (no PWM dependencies) pg->PGxCONH.bits.MSTEN = 0; // Disable Master synchronization mode pg->PGxCONH.bits.SOCS = 0b0000; // Master PWM always triggers itself pg->PGxEVTL.bits.PGTRGSEL = 0b011; // PGxTRIGC is always used as PWM synchronization trigger output pg->PGxTRIGC.value = 0x0000; // Clear phase shift between master phase and first synchronized phase pg->PGxCONH.bits.UPDMOD = 0b001; // Immediate update pg->PGxEVTL.bits.UPDTRG = 0b11; // A write of the PGxTRIGA register automatically sets the UPDATE bit } else { /* continue */ } // Update PWM generator timing registers pg->PGxSTAT.bits.UPDREQ = 1; // Manually set the Update Request bit pg->PGxCONH.bits.TRGMOD = 1; // all PWM generators are in retriggerable mode } return(retval); } /******************************************************************************* * @fn uint16_t boostPWM_Start(volatile struct BOOST_CONVERTER_s* boostInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function enables the boost PWM operation * @param boostInstance Pointer to a Boost Converter data object of type struct BOOST_CONVERTER_s * @return unsigned integer (0=failure, 1=success) * * @details * This function starts the operation of the boost PWM by enabling the PWM * generator and its output pins. *********************************************************************************/ volatile uint16_t boostPWM_Start(volatile struct BOOST_CONVERTER_s* boostInstance) { volatile uint16_t retval=1; volatile uint16_t _i=0; volatile uint16_t timeout=0; volatile uint16_t pwm_Instance=0; volatile uint16_t sync_sw_mask=0; volatile struct P33C_PWM_GENERATOR_s* pg; // Enable all PWM channels of the recent boost converter configuration for(_i=0; _i< boostInstance->set_values.no_of_phases; _i++) { // Capture PWM instance of the recent channel pwm_Instance = boostInstance->sw_node[_i].pwm_instance; // CAPTURE MEMORY ADDRESS OF GIVEN PWM GENERATOR INSTANCE pg = p33c_PwmGenerator_GetHandle(pwm_Instance); pg->PGxIOCONL.value |= P33C_PGxIOCONL_OVREN_SYNC; // PWMxH/L Output Override Enable: PWM generator controls the PWMxH output pin pg->PGxIOCONH.value &= ~(P33C_PGxIOCONH_PEN_SYNC); // PWMxH/L Output Port Disable: PWM generator controls the PWMxH output pin pg->PGxCONL.bits.ON = 1; // PWM Generator Enable: PWM Generator is enabled pg->PGxSTAT.bits.UPDREQ = 1; // Update all PWM timing registers if(pg->PGxCONL.value & P33C_PGxCONL_HRES_EN) // If high resolution is enabled { while((!PCLKCONbits.HRRDY) && (timeout++ < 5000)); // wait for high resolution to get ready if ((timeout >= 5000) || (PCLKCONbits.HRERR)) // if there is an error ... return(0); // ... exit returning ERROR } // Select the control bits for either synchronous or asynchronous PWM drive // note: swapping PWMs changes H/L assignments and the 'active' pin has to // selected in asynchronous mode if (boostInstance->sw_node[_i].sync_drive) sync_sw_mask = P33C_PGxIOCONH_PEN_SYNC; else { if (boostInstance->sw_node[_i].swap_outputs) sync_sw_mask = P33C_PGxIOCONH_PEN_ASYNC_SWAP; else sync_sw_mask = P33C_PGxIOCONH_PEN_ASYNC; } // PWMxH/L Output Port Enable: PWM generator controls the PWMxH output pin pg->PGxIOCONH.value |= sync_sw_mask; // Turn on PWM generator retval &= (volatile uint16_t)(pg->PGxCONL.bits.ON); } return(retval); } /******************************************************************************* * @fn uint16_t boostPWM_Stop(volatile struct BOOST_CONVERTER_s* boostInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function stops the boost PWM output * @param boostInstance Pointer to a Boost Converter data object of type struct BOOST_CONVERTER_s * @return unsigned integer (0=failure, 1=success) * * @details * This function shuts down the PWM output by disabling all PWM channels of the recent boost * converter object, overriding the output pins and resetting the boost PWM duty cycle to * its minimum duty ratio. * * If the Power Good output is enabled, this output pin will also be reset. *********************************************************************************/ volatile uint16_t boostPWM_Stop(volatile struct BOOST_CONVERTER_s* boostInstance) { volatile uint16_t retval=1; volatile uint16_t _i=0; volatile uint16_t pwm_Instance=0; volatile struct P33C_PWM_GENERATOR_s* pg; // Disable all PWM channels of the recent boost converter configuration for(_i=0; _i< boostInstance->set_values.no_of_phases; _i++) { // Capture PWM instance of the recent channel pwm_Instance = boostInstance->sw_node[_i].pwm_instance; // CAPTURE MEMORY ADDRESS OF GIVEN PWM GENERATOR INSTANCE pg = p33c_PwmGenerator_GetHandle(pwm_Instance); pg->PGxIOCONL.value |= P33C_PGxIOCONL_OVREN_SYNC; // PWMxH/L Output Override Enable pg->PGxIOCONH.value &= ~(P33C_PGxIOCONH_PEN_SYNC); // PWMxH/L Output Pint Control Disable pg->PGxCONL.value &= ~(P33C_PGxCONL_PWM_ON); // PWM Generator Disable pg->PGxDC.value = boostInstance->sw_node[_i].duty_ratio_min; // Reset Duty Cycle pg->PGxSTAT.value |= P33C_PGxSTAT_UPDREQ; // Set the Update Request bit to update PWM timing retval &= (volatile uint16_t)((volatile bool)(pg->PGxCONL.bits.ON == 0)); } // If defined, reset POWER_GOOD output if(boostInstance->gpio.PowerGood.enabled) retval &= boostGPIO_Clear(&boostInstance->gpio.PowerGood); return(retval); } /******************************************************************************* * @fn uint16_t boostPWM_Suspend(volatile struct BOOST_CONVERTER_s* boostInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function disables the PWM generator IOs * @param boostInstance Pointer to a Boost Converter data object of type struct BOOST_CONVERTER_s * @return unsigned integer (0=failure, 1=success) * * @details * This function suspends the boost PWM operation by disabling all PWM outputs of the recent * boost converter configuration, overriding the PWM output pins and setting the * duty cycle to 0. *********************************************************************************/ volatile uint16_t boostPWM_Suspend(volatile struct BOOST_CONVERTER_s* boostInstance) { volatile uint16_t retval=1; volatile uint16_t _i=0; volatile uint16_t pwm_Instance; volatile struct P33C_PWM_GENERATOR_s* pg; // Disable all PWM outputs of the recent boost converter configuration for(_i=0; _i< boostInstance->set_values.no_of_phases; _i++) { // Capture PWM instance of the recent channel pwm_Instance = boostInstance->sw_node[_i].pwm_instance; // CAPTURE MEMORY ADDRESS OF GIVEN PWM GENERATOR INSTANCE pg = p33c_PwmGenerator_GetHandle(pwm_Instance); pg->PGxIOCONL.value |= P33C_PGxIOCONL_OVREN_SYNC; // PWMxH/L Output Override Enable pg->PGxDC.value = 0; // Reset Duty Cycle pg->PGxSTAT.value |= P33C_PGxSTAT_UPDREQ; // Set the Update Request bit to update PWM timing retval &= (bool)(pg->PGxIOCONL.value & P33C_PGxIOCONL_OVREN_SYNC); } // If defined and enabled, reset POWER_GOOD output if(boostInstance->gpio.PowerGood.enabled) retval &= boostGPIO_Clear(&boostInstance->gpio.PowerGood); return(retval); } /******************************************************************************* * @fn uint16_t boostPWM_Resume(volatile struct BOOST_CONVERTER_s* boostInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function resumes the boost PWM operation * @param boostInstance Pointer to a Boost Converter data object of type struct BOOST_CONVERTER_s * @return unsigned integer (0=failure, 1=success) * * @details * THis function updates the PWM timing bit and the PWM output pins are enabled. *********************************************************************************/ volatile uint16_t boostPWM_Resume(volatile struct BOOST_CONVERTER_s* boostInstance) { volatile uint16_t retval=1; volatile uint16_t _i=0; volatile bool sync_mode=false; volatile uint16_t pwm_Instance=0; volatile uint16_t sync_sw_mask=0; volatile struct P33C_PWM_GENERATOR_s* pg; // Disable all PWM channels of the recent boost converter configuration for(_i=0; _i< boostInstance->set_values.no_of_phases; _i++) { // Capture PWM instance of the recent channel pwm_Instance = (uint16_t)boostInstance->sw_node[_i].pwm_instance; // CAPTURE MEMORY ADDRESS OF GIVEN PWM GENERATOR INSTANCE pg = p33c_PwmGenerator_GetHandle(pwm_Instance); // Select the control bits for either synchronous or asynchronous PWM drive sync_mode = boostInstance->sw_node[_i].sync_drive; sync_mode &= (~boostInstance->status.bits.async_mode); // Select which pins should be enabled based on sync or async mode // note: swapping PWMs does not change the H/L assignment. When swapped, // OVRENH will control the PWMxL pin and vice versa if (sync_mode) { sync_sw_mask = P33C_PGxIOCONL_OVREN_SYNC; } else { if (boostInstance->sw_node[_i].swap_outputs) sync_sw_mask = P33C_PGxIOCONL_OVREN_ASYNC_SWAP; else sync_sw_mask = P33C_PGxIOCONL_OVREN_ASYNC; } // Clear selected override bits pg->PGxSTAT.bits.UPDREQ = 1; // Set the Update Request bit to update PWM timing pg->PGxIOCONL.value &= (volatile uint16_t)(~(sync_sw_mask)); // PWMxH/L Output Override Disable retval &= (uint16_t)((bool)(!(pg->PGxIOCONL.value & sync_sw_mask))); } return(retval); } /******************************************************************************* * @fn uint16_t boostADC_ModuleInitialize(void) * @ingroup lib-layer-boost-pconfig-functions * @brief This fucntion initializes the boost by resetting all its registers to default * @param void * @return unsigned integer (0=failure, 1=success) * * @details * The ADC initialization covers basic configurations like data format, clock sources and dividers * as well as specific configurations for ADC cores. These settings are general, basic settings * and not related to specific analog inputs. The standard configuration set here sets up the * ADC module and ADC cores for maximum performance. *********************************************************************************/ volatile uint16_t boostADC_ModuleInitialize(void) { volatile uint16_t retval=1; // Make sure power to peripheral is enabled volatile bool _pmdlock = PMDCONbits.PMDLOCK; // Copy state of PMD lock bit PMDCONbits.PMDLOCK = 0; // Unlock PMD register writes PMD1bits.ADC1MD = 0; // ADC Module Power Disable: ADC module power is enabled PMDCONbits.PMDLOCK = _pmdlock; // set previous state of PMD lock // ADCON1L: ADC CONTROL REGISTER 1 LOW ADCON1Lbits.ADON = 0; // ADC Enable: ADC module is off during configuration ADCON1Lbits.ADSIDL = 0; // ADC Stop in Idle Mode: Continues module operation in Idle mode // ADCON1H: ADC CONTROL REGISTER 1 HIGH ADCON1Hbits.SHRRES = 0b11; // Shared ADC Core Resolution Selection: 12-bit resolution ADC resolution = 12-bit (0...4095 ticks) ADCON1Hbits.FORM = 0; // Fractional Data Output Format: Integer // ADCON2L: ADC CONTROL REGISTER 2 LOW ADCON2Lbits.REFCIE = 0;; // Band Gap and Reference Voltage Ready Common Interrupt Enable: Common interrupt is disabled for the band gap ready event ADCON2Lbits.REFERCIE = 0; // Band Gap or Reference Voltage Error Common Interrupt Enable: Disabled ADCON2Lbits.EIEN = 1; // Early Interrupts Enable: The early interrupt feature is enabled ADCON2Lbits.SHREISEL = 0b111; // Shared Core Early Interrupt Time Selection: Early interrupt is set and interrupt is generated 8 TADCORE clocks prior to when the data are ready ADCON2Lbits.SHRADCS = 0b0000001; // Shared ADC Core Input Clock Divider: 2:1 (minimum) // ADCON2H: ADC CONTROL REGISTER 2 HIGH ADCON2Hbits.SHRSAMC = 8; // Shared ADC Core Sample Time Selection: 8x TADs sampling time ADCON2Hbits.REFERR = 0; // reset error flag ADCON2Hbits.REFRDY = 0; // reset bandgap status bit // ADCON3L: ADC CONTROL REGISTER 3 LOW ADCON3Lbits.REFSEL = 0b000; // ADC Reference Voltage Selection: AVDD-toAVSS ADCON3Lbits.SUSPEND = 0; // All ADC Core Triggers Disable: All ADC cores can be triggered ADCON3Lbits.SUSPCIE = 0; // Suspend All ADC Cores Common Interrupt Enable: Common interrupt is not generated for suspend ADC cores ADCON3Lbits.SUSPRDY = 0; // All ADC Cores Suspended Flag: ADC cores have previous conversions in progress ADCON3Lbits.SHRSAMP = 0; // Shared ADC Core Sampling Direct Control: use hardware trigger ADCON3Lbits.CNVRTCH = 0; // Software Individual Channel Conversion Trigger: Next individual channel conversion trigger can be generated (not used) ADCON3Lbits.SWLCTRG = 0; // Software Level-Sensitive Common Trigger: No software, level-sensitive common triggers are generated (not used) ADCON3Lbits.SWCTRG = 0; // Software Common Trigger: Ready to generate the next software common trigger (not used) ADCON3Lbits.CNVCHSEL = 0; // Channel Number Selection for Software Individual Channel Conversion Trigger: AN0 (not used) // ADCON3H: ADC CONTROL REGISTER 3 HIGH ADCON3Hbits.CLKSEL = 0b01; // ADC Module Clock Source Selection: AVCODIV ADCON3Hbits.CLKDIV = 0b000000; // ADC Module Clock Source Divider: 1 Source Clock Period ADCON3Hbits.SHREN = 0; // Shared ADC Core Enable: Shared ADC core is disabled ADCON3Hbits.C0EN = 0; // Dedicated ADC Core 0 Enable: Dedicated ADC Core 0 is disabled ADCON3Hbits.C1EN = 0; // Dedicated ADC Core 1 Enable: Dedicated ADC Core 1 is disabled // ADCON4L: ADC CONTROL REGISTER 4 LOW ADCON4Lbits.SAMC0EN = 0; // Dedicated ADC Core 0 Conversion Delay Enable: Immediate conversion ADCON4Lbits.SAMC1EN = 0; // Dedicated ADC Core 1 Conversion Delay Enable: Immediate conversion // ADCON4H: ADC CONTROL REGISTER 4 HIGH ADCON4Hbits.C0CHS = 0b00; // Dedicated ADC Core 0 Input Channel Selection: AN0 ADCON4Hbits.C1CHS = 0b00; // Dedicated ADC Core 1 Input Channel Selection: AN1 // ADCON5L: ADC CONTROL REGISTER 5 LOW // ADCON5Lbits.SHRRDY: Shared ADC Core Ready Flag (read only) // ADCON5Lbits.C0RDY: Dedicated ADC Core 0 Ready Flag (read only) // ADCON5Lbits.C1RDY: Dedicated ADC Core 1 Ready Flag (read only) ADCON5Lbits.SHRPWR = 0; // Shared ADC Core Power Enable: ADC core is off ADCON5Lbits.C0PWR = 0; // Dedicated ADC Core 0 Power Enable: ADC core is off ADCON5Lbits.C1PWR = 0; // Dedicated ADC Core 1 Power Enable: ADC core is off // ADCON5H: ADC CONTROL REGISTER 5 HIGH ADCON5Hbits.WARMTIME = 0b1111; // ADC Dedicated Core x Power-up Delay: 32768 Source Clock Periods ADCON5Hbits.SHRCIE = 0; // Shared ADC Core Ready Common Interrupt Enable: Common interrupt is disabled for an ADC core ready event ADCON5Hbits.C0CIE = 0; // C1CIE: Dedicated ADC Core 0 Ready Common Interrupt Enable: Common interrupt is disabled ADCON5Hbits.C1CIE = 0; // C1CIE: Dedicated ADC Core 1 Ready Common Interrupt Enable: Common interrupt is disabled // ADCORExL: DEDICATED ADC CORE x CONTROL REGISTER LOW ADCORE1Lbits.SAMC = 0b0000000000; // Dedicated ADC Core 1 Conversion Delay Selection: 2 TADCORE (minimum) ADCORE0Lbits.SAMC = 0b0000000000; // Dedicated ADC Core 0 Conversion Delay Selection: 2 TADCORE (minimum) // ADCORExH: DEDICATED ADC CORE x CONTROL REGISTER HIGH ADCORE0Hbits.RES = 0b11; // ADC Core x Resolution Selection: 12 bit ADCORE0Hbits.ADCS = 0b0000000; // ADC Core x Input Clock Divider: 2 Source Clock Periods ADCORE0Hbits.EISEL = 0b111; // Early interrupt is set and an interrupt is generated 8 TADCORE clocks prior ADCORE1Hbits.RES = 0b11; // ADC Core x Resolution Selection: 12 bit ADCORE1Hbits.ADCS = 0b0000000; // ADC Core x Input Clock Divider: 2 Source Clock Periods ADCORE1Hbits.EISEL = 0b111; // Early interrupt is set and an interrupt is generated 8 TADCORE clocks prior return(retval); } /******************************************************************************* * @fn uint16_t boostADC_ChannelInitialize(volatile struct BOOST_ADC_INPUT_SETTINGS_s* adcInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function initializes the settings for the ADC channel * @param adcInstance Pointer to an ADC Input Configuration data object of type struct BOOST_ADC_INPUT_SETTINGS_s * @return unsigned integer (0=failure, 1=success) * * @details * This function initializes the ADC input registers based on the selected ADC channel. * This function sets the input channel trigger source, input mode, and the ADC core * connected to the selected channel. *********************************************************************************/ volatile uint16_t boostADC_ChannelInitialize(volatile struct BOOST_ADC_INPUT_SETTINGS_s* adcInstance) { volatile uint16_t retval=1; volatile uint8_t* ptrADCRegister; volatile uint8_t bit_offset; // Initialize ADC input registers if (adcInstance->enabled) { // Write level trigger setting if (adcInstance->adc_input < 16) { ADLVLTRGL |= ((uint16_t)(adcInstance->level_trigger) << adcInstance->adc_input); ADEIEL |= ((uint16_t)(adcInstance->early_interrupt_enable) << adcInstance->adc_input); ADIEL |= ((uint16_t)(adcInstance->interrupt_enable) << adcInstance->adc_input); } else if (adcInstance->adc_input < 32) { ADLVLTRGH |= ((uint16_t)(adcInstance->level_trigger) << (adcInstance->adc_input - 16)); ADEIEH |= ((uint16_t)(adcInstance->early_interrupt_enable) << (adcInstance->adc_input - 16)); ADIEH |= ((uint16_t)(adcInstance->interrupt_enable) << (adcInstance->adc_input - 16)); } else { return(0); // ADC input number out of range } // write input mode setting if (adcInstance->adc_input < 8) bit_offset = (2 * adcInstance->adc_input); else if (adcInstance->adc_input < 16) bit_offset = (2 * (adcInstance->adc_input-8)); else if (adcInstance->adc_input < 24) bit_offset = (2 * (adcInstance->adc_input-16)); else if (adcInstance->adc_input < 32) bit_offset = (2 * (adcInstance->adc_input-24)); else return(0); // ADC input number out of range ptrADCRegister = (volatile uint8_t *) ((volatile uint8_t *)&ADMOD0L + (volatile uint8_t)(adcInstance->adc_input >> 8)); *ptrADCRegister |= ((unsigned int)adcInstance->signed_result << bit_offset); *ptrADCRegister |= ((unsigned int)adcInstance->differential_input << (bit_offset + 1)); // Write ADC trigger source setting ptrADCRegister = (volatile uint8_t *) ((volatile uint8_t *)&ADTRIG0L + (volatile uint8_t)adcInstance->adc_input); *ptrADCRegister = (volatile uint8_t)adcInstance->trigger_source; // Register ADC core to be active switch (adcInstance->adc_core) { case 0: adcore_mask |= ADC_CORE0_MASK_INDEX; if (adcInstance->differential_input) adcore_diff_mask |= ADC_CORE0_MASK_INDEX; break; case 1: adcore_mask |= ADC_CORE1_MASK_INDEX; if (adcInstance->differential_input) adcore_diff_mask |= ADC_CORE1_MASK_INDEX; break; case 2: adcore_mask |= ADC_CORE2_MASK_INDEX; if (adcInstance->differential_input) adcore_diff_mask |= ADC_CORE2_MASK_INDEX; break; case 3: adcore_mask |= ADC_CORE3_MASK_INDEX; if (adcInstance->differential_input) adcore_diff_mask |= ADC_CORE3_MASK_INDEX; break; default: adcore_mask |= ADC_SHRCORE_MASK_INDEX; if (adcInstance->differential_input) adcore_diff_mask |= ADC_SHRCORE_MASK_INDEX; break; } } return(retval); } /******************************************************************************* * @fn uint16_t boostADC_Start(void) * @ingroup lib-layer-boost-pconfig-functions * @brief This function enables the ADC module and starts the ADC cores analog inputs for the required input signals * @param void * @return unsigned integer (0=failure, 1=success) * * @details * This function enables the ADC module, powers-up and enables the ADC cores used and waits * until ADC cores are ready. *********************************************************************************/ volatile uint16_t boostADC_Start(void) { volatile uint16_t retval=1; volatile uint16_t timeout=0; volatile uint16_t adcore_mask_compare=0; // Turn on ADC module ADCON1Lbits.ADON = 1; ADCON5L = adcore_mask; // Enable power to all used ADC cores adcore_mask_compare = ((adcore_mask << 8) | adcore_mask); // Set ADC Core Ready Bit Mask while ((ADCON5L != adcore_mask_compare) & (timeout++ < ADC_POWERUP_TIMEOUT)); // Wait until ADC cores are ready if (timeout >= ADC_POWERUP_TIMEOUT) return(0); // Skip if powering up ADC cores was unsuccessful ADCON3H = adcore_mask; // Enable ADC cores return(retval); } /******************************************************************************* * @fn uint16_t boostGPIO_Set(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function sets the selected general purpose input/ouput pins * @param boostGPIOInstance Pointer to a GPIO instance data object of type struct BOOST_GPIO_INSTANCE_s * @return unsigned integer (0=failure, 1=success) * * @details * This function captures the user selected pin to be activated through LAT register. *********************************************************************************/ volatile uint16_t boostGPIO_Set(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance) { volatile uint16_t retval=1; volatile uint16_t filter_mask=0; volatile struct P33C_GPIO_INSTANCE_s* gpio; // Capture register of GPIO port gpio = p33c_GpioInstance_GetHandle(boostGPIOInstance->port); // Capture filter mask filter_mask = (0x0001 << boostGPIOInstance->pin); // Set pin to ACTIVE state if (boostGPIOInstance->polarity == 0) gpio->LATx.value |= (filter_mask); // Set pin bit in register else gpio->LATx.value &= ~(filter_mask); // Clear pin bit in register // Verifying the set state is applied at the pin retval = (bool)((gpio->LATx.value & filter_mask) == (gpio->PORTx.value & filter_mask)); return(retval); } /******************************************************************************* * @fn uint16_t boostGPIO_Clear(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function clears the selected general purpose input/output pin * @param boostGPIOInstance Pointer to a GPIO instance data object of type struct BOOST_GPIO_INSTANCE_s * @return unsigned integer (0=failure, 1=success) * * @details * This function captures the pin that the use desired to be put in inactive state. *********************************************************************************/ volatile uint16_t boostGPIO_Clear(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance) { volatile uint16_t retval=1; volatile uint16_t filter_mask=0; volatile struct P33C_GPIO_INSTANCE_s* gpio; // Capture register of GPIO port gpio = p33c_GpioInstance_GetHandle(boostGPIOInstance->port); // Capture filter mask filter_mask = (0x0001 << boostGPIOInstance->pin); // Set pin to INACTIVE state if (boostGPIOInstance->polarity == 0) gpio->LATx.value &= ~(filter_mask); // Clear pin bit in register else gpio->LATx.value |= (filter_mask); // Set pin bit in register // Verifying the set state is applied at the pin retval = (bool)((gpio->LATx.value & filter_mask) == (gpio->PORTx.value & filter_mask)); return(retval); } /******************************************************************************* * @fn bool boostGPIO_GetPinState(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function gets the state of the selected pin * @param boostGPIOInstance Pointer to a GPIO instance data object of type struct BOOST_GPIO_INSTANCE_s * @return unsigned integer (0=failure, 1=success) * * @details * This function captures the selected pin and read its state. *********************************************************************************/ volatile bool boostGPIO_GetPinState(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance) { volatile bool retval=1; volatile P33C_GPIO_INSTANCE_t* gpio; // Capture register of GPIO port gpio = p33c_GpioInstance_GetHandle(boostGPIOInstance->port); // Read pin retval = (bool)(gpio->PORTx.value & (0x0001 << boostGPIOInstance->pin)); // If polarity is inverted (ACTIVE LOW), invert result if(boostGPIOInstance->polarity == 1) retval = (1-retval); return(retval); } /******************************************************************************* * @fn uint16_t boostGPIO_Initialize(volatile struct BOOST_CONVERTER_s* boostInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function initializes the boost input pins * @param boostInstance Pointer to a Boost Converter data object of type struct BOOST_CONVERTER_s * @return unsigned integer (0=failure, 1=success) * * @details * This function initializes the ENABLE input pin and POWER GOOD output pin using the * boost GPIO_PrivateInitialize (URL = @ref boostGPIO_PrivateInitialize). *********************************************************************************/ volatile uint16_t boostGPIO_Initialize(volatile struct BOOST_CONVERTER_s* boostInstance) { volatile uint16_t retval=1; // Initialize ENABLE input pin if(boostInstance->gpio.EnableInput.enabled) retval = boostGPIO_PrivateInitialize(&boostInstance->gpio.EnableInput); // Initialize POWER GOOD output pin if(boostInstance->gpio.PowerGood.enabled) retval = boostGPIO_PrivateInitialize(&boostInstance->gpio.PowerGood); // If defined, reset POWER_GOOD output if(boostInstance->gpio.PowerGood.enabled) retval &= boostGPIO_Clear(&boostInstance->gpio.PowerGood); return(retval); } /******************************************************************************* * @fn uint16_t boostGPIO_PrivateInitialize(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance) * @ingroup lib-layer-boost-pconfig-functions * @brief This function sets the pin as input or output * @param boostGPIOInstance Pointer to a GPIO instance data object of type struct BOOST_GPIO_INSTANCE_s * @return unsigned integer (0=failure, 1=success) * * @details * This function captures the user selected pin then set the pin to inactive and * set it as digital input or output pin. *********************************************************************************/ volatile uint16_t boostGPIO_PrivateInitialize(volatile struct BOOST_GPIO_INSTANCE_s* boostGPIOInstance) { volatile uint16_t retval=1; volatile struct P33C_GPIO_INSTANCE_s* gpio; // Capture register of GPIO port gpio = p33c_GpioInstance_GetHandle(boostGPIOInstance->port); // Set pin to INACTIVE state if (boostGPIOInstance->polarity == 0) gpio->LATx.value &= ~(0x0001 << boostGPIOInstance->pin); // Clear pin bit in register else gpio->LATx.value |= (0x0001 << boostGPIOInstance->pin); // Set pin bit in register // Set INPUT or OUTPUT in TRIS register if(boostGPIOInstance->io_type == 1) gpio->TRISx.value |= (0x0001 << boostGPIOInstance->pin); // Set pin bit in register else gpio->TRISx.value &= ~(0x0001 << boostGPIOInstance->pin); // Clear pin bit in register // Set Pin in Open Drain Configuration if(boostGPIOInstance->io_type == 2) gpio->ODCx.value |= (0x0001 << boostGPIOInstance->pin); // Set pin bit in register else gpio->ODCx.value &= ~(0x0001 << boostGPIOInstance->pin); // Clear pin bit in register // Set pin as DIGITAL IO gpio->ANSELx.value &= ~(0x0001 << boostGPIOInstance->pin); // Clear pin bit in register // ToDo: Enable register value testing to validate function result retval = 1; return(retval); } // end of file
48.573333
190
0.654755
[ "object" ]
41d8e51890f86196865d88bc7b0ec9c8a4415ba8
678
h
C
Source/moja.flint/include/moja/flint/recordutils.h
moja-global/flint
2c65c5808d908247ce8ee4d9f87f11c7dd57794e
[ "BSL-1.0" ]
null
null
null
Source/moja.flint/include/moja/flint/recordutils.h
moja-global/flint
2c65c5808d908247ce8ee4d9f87f11c7dd57794e
[ "BSL-1.0" ]
1
2020-07-12T11:30:00.000Z
2020-07-18T14:50:16.000Z
Source/moja.flint/include/moja/flint/recordutils.h
moja-global/flint
2c65c5808d908247ce8ee4d9f87f11c7dd57794e
[ "BSL-1.0" ]
null
null
null
#ifndef MOJA_FLINT_RECORD_UTILS_H_ #define MOJA_FLINT_RECORD_UTILS_H_ #include "moja/flint/_flint_exports.h" #include "moja/flint/record.h" #include <moja/types.h> #include <Poco/Tuple.h> #include <vector> namespace moja { namespace flint { template <class TPersistable> struct RecordHasher { std::size_t operator()(Record<TPersistable>* record) const { return record->hash(); } }; template <class TPersistable> struct RecordComparer { bool operator()(Record<TPersistable>* lhs, const Record<TPersistable>* rhs) const { return lhs->operator==(*rhs); } }; } // namespace flint } // namespace moja #endif // MOJA_FLINT_RECORD_UTILS_H_
23.37931
119
0.713864
[ "vector" ]
41dabf47d1c02604449c49fa98aca3348f3c2ed3
2,089
h
C
Tools/MedusaExport/max9/include/XRef/iXrefObjMgr.h
CarysT/medusa
8e79f7738534d8cf60577ec42ed86621533ac269
[ "MIT" ]
32
2016-05-22T23:09:19.000Z
2022-03-13T03:32:27.000Z
Tools/MedusaExport/max9/include/XRef/iXrefObjMgr.h
CarysT/medusa
8e79f7738534d8cf60577ec42ed86621533ac269
[ "MIT" ]
2
2016-05-30T19:45:58.000Z
2018-01-24T22:29:51.000Z
Tools/MedusaExport/max9/include/XRef/iXrefObjMgr.h
CarysT/medusa
8e79f7738534d8cf60577ec42ed86621533ac269
[ "MIT" ]
17
2016-05-27T11:01:42.000Z
2022-03-13T03:32:30.000Z
//**************************************************************************/ // Copyright (c) 1998-2005 Autodesk, Inc. // All rights reserved. // // These coded instructions, statements, and computer programs contain // unpublished proprietary information written by Autodesk, Inc., and are // protected by Federal copyright law. They may not be disclosed to third // parties or copied or duplicated in any form, in whole or in part, without // the prior written consent of Autodesk, Inc. //**************************************************************************/ // DESCRIPTION: Legacy Object Xref SDK // AUTHOR: Nikolai Sander - created July.07.2000 //***************************************************************************/ #ifndef _IXREF_OBJ_MGR_H_ #define _IXREF_OBJ_MGR_H_ class IXRefObject; //! \brief Legacy interface for managing object xrefs /*! \remarks This interface should be considered obsolete. Please use IObjXRefManager8 instead. Note that this interface does not provide full support for multiple object xref records/links created from the same source file. \see IObjXRefManager8 */ class IObjXRefManager : public FPStaticInterface { public: // function IDs enum { fnIdAddXRefObject, fnIdGetNumXRefObjects, fnIdGetXRefObject, fnIdGetNumFiles, fnIdGetFileName, fnIdReloadFile, fnIdIsFileUnresolved, fnIdIsFileDisabled, fnIdGetAllXRefObjects, }; virtual IXRefObject *AddXRefObject(TCHAR *fname, TCHAR *obname, int xFlags = 0)=0; virtual int GetNumXRefObjects(TCHAR *fname)=0; virtual IXRefObject *GetXRefObject(TCHAR *fname, int i)=0; virtual int GetNumFiles()=0; virtual TCHAR *GetFileName(int fidx)=0; virtual BOOL ReloadFile(TCHAR *fname)=0; virtual BOOL IsFileUnresolved(TCHAR *fname)=0; virtual BOOL IsFileDisabled(TCHAR *fname)=0; virtual void GetAllXRefObjects(Tab<IXRefObject*> &objs)=0; }; #define OBJXREFMANAGER_INTERFACE Interface_ID(0x7ede1c65, 0x353d271f) inline IObjXRefManager* GetObjXRefManager () { return (IObjXRefManager*)GetCOREInterface(OBJXREFMANAGER_INTERFACE); } #endif //_IXREF_OBJ_MGR_H_
34.816667
117
0.692197
[ "object" ]
41dc94c6d384ed0fd0abb47fd4825dd128e30ab3
8,278
h
C
src/loader/ImageLoader.h
tippesi/Atlas-Engine
9d135d79e24de0b826ad119b546b26802ca42207
[ "BSD-3-Clause" ]
41
2020-07-12T13:53:05.000Z
2022-03-31T14:36:42.000Z
src/loader/ImageLoader.h
hzqst/Atlas-Engine
fe45c5529815d6ca28a3bad7920d95281efc0028
[ "BSD-3-Clause" ]
4
2019-12-19T11:36:45.000Z
2022-03-18T00:23:51.000Z
src/loader/ImageLoader.h
hzqst/Atlas-Engine
fe45c5529815d6ca28a3bad7920d95281efc0028
[ "BSD-3-Clause" ]
4
2020-07-26T04:21:42.000Z
2022-03-08T16:23:46.000Z
#ifndef AE_IMAGELOADER_H #define AE_IMAGELOADER_H #include "../System.h" #include "../common/Image.h" #include "AssetLoader.h" #include "../Log.h" #include <vector> #include <algorithm> #include <iostream> #include <fstream> #include "libraries/stb/stb_image.h" #include "libraries/stb/stb_image_write.h" namespace Atlas { namespace Loader { class ImageLoader { public: /** * Loads an image with 8 bits per channel. * @param filename The name of the image file. * @param colorSpaceConversion Whether or not gamma to linear color space conversion is needed. * @param forceChannels The number of channels to be forced. Default is zero, which means no force. * @param maxImageResolution The maximum resolution on both axis of the image. If larger it gets resized. * @return An Image object with all the important data. */ template<typename T> static Common::Image<T> LoadImage(std::string filename, bool colorSpaceConversion = false, int32_t forceChannels = 0, int32_t maxImageResolution = 8192) { Common::Image<T> image; auto fileStream = AssetLoader::ReadFile(filename, std::ios::in | std::ios::binary); if (!fileStream.is_open()) { Log::Error("Failed to load image " + filename); return image; } auto buffer = AssetLoader::GetFileContent(fileStream); fileStream.close(); int32_t width, height, channels; void* data = nullptr; if constexpr (std::is_same_v<T, uint8_t>) { data = static_cast<void*>(stbi_load_from_memory((unsigned char*)buffer.data(), (int32_t)buffer.size(), &width, &height, &channels, forceChannels)); } else if constexpr (std::is_same_v<T, uint16_t>) { data = static_cast<void*>(stbi_load_16_from_memory((unsigned char*)buffer.data(), (int32_t)buffer.size(), &width, &height, &channels, forceChannels)); } else if constexpr (std::is_same_v<T, float>) { data = static_cast<void*>(stbi_loadf_from_memory((unsigned char*)buffer.data(), (int32_t)buffer.size(), &width, &height, &channels, forceChannels)); } if (forceChannels > 0) { channels = forceChannels; } image = Common::Image<T>(width, height, channels); std::vector<T> imageData(width * height * channels); imageData.assign(static_cast<T*>(data), static_cast<T*>(data) + width * height * channels); stbi_image_free(static_cast<T*>(data)); image.SetData(imageData); if (image.width > maxImageResolution || image.height > maxImageResolution) { width = width > maxImageResolution ? maxImageResolution : width; height = height > maxImageResolution ? maxImageResolution : height; image.Resize(width, height); } if (colorSpaceConversion) { image.GammaToLinear(); } auto fileFormatPosition = filename.find_last_of('.') + 1; auto fileFormat = filename.substr(fileFormatPosition, filename.length()); std::transform(fileFormat.begin(), fileFormat.end(), fileFormat.begin(), ::tolower); if (fileFormat == "png") { image.fileFormat = AE_IMAGE_PNG; } else if (fileFormat == "jpg" || fileFormat == "jpeg") { image.fileFormat = AE_IMAGE_JPG; } else if (fileFormat == "bmp") { image.fileFormat = AE_IMAGE_BMP; } else if (fileFormat == "pgm") { image.fileFormat = AE_IMAGE_PGM; } else if (fileFormat == "hdr") { image.fileFormat = AE_IMAGE_HDR; } Log::Message("Loaded image " + filename); return image; } /** * Save an image to the hard drive. * @param image The image to be stored * @param filename The filename that the image should have * @note By changing the fileFormat in the Image object the output file changes as well. */ template<typename T> static void SaveImage(Common::Image<T>& image, std::string filename) { std::ofstream imageStream; if (image.fileFormat == AE_IMAGE_PGM) { imageStream = AssetLoader::WriteFile(filename, std::ios::out); } else { imageStream = AssetLoader::WriteFile(filename, std::ios::out | std::ios::binary); } if (!imageStream.is_open()) { Log::Error("Couldn't write image " + filename); return; } auto lambda = [](void* context, void* data, int32_t size) { auto imageStream = (std::ofstream*)context; imageStream->write((char*)data, size); }; if (image.fileFormat == AE_IMAGE_JPG) { if constexpr (std::is_same_v<T, uint8_t>) { stbi_write_jpg_to_func(lambda, &imageStream, image.width, image.height, image.channels, image.GetData().data(), 100); } } else if (image.fileFormat == AE_IMAGE_BMP) { if constexpr (std::is_same_v<T, uint8_t>) { stbi_write_bmp_to_func(lambda, &imageStream, image.width, image.height, image.channels, image.GetData().data()); } } else if (image.fileFormat == AE_IMAGE_PNG) { if constexpr (std::is_same_v<T, uint8_t>) { stbi_write_png_to_func(lambda, &imageStream, image.width, image.height, image.channels, image.GetData().data(), image.channels * image.width); } } else if (image.fileFormat == AE_IMAGE_PGM) { if constexpr (std::is_same_v<T, uint8_t> || std::is_same_v<T, uint16_t>) { SavePGM(image, imageStream); } } else if (image.fileFormat == AE_IMAGE_HDR) { if constexpr (std::is_same_v<T, float>) { stbi_write_hdr_to_func(lambda, &imageStream, image.width, image.height, image.channels, image.GetData().data()); } } imageStream.close(); } private: template<typename T> static void SavePGM(Common::Image<T>& image, std::ofstream& imageStream) { static_assert(std::is_same_v<T, uint8_t> || std::is_same_v<T, uint16_t>, "Unsupported PGM format. Supported are uint8_t, uint16_t"); std::string header; // Create image header header.append("P2 "); header.append(std::to_string(image.width) + " "); header.append(std::to_string(image.height) + " "); if constexpr (std::is_same_v<T, uint8_t>) { header.append("255\n"); } else if constexpr (std::is_same_v<T, uint16_t>) { header.append("65535\n"); } imageStream << header; auto imageData = image.GetData(); for (auto data : imageData) { imageStream << data; imageStream << " "; } } }; } } #endif
38.502326
129
0.50157
[ "object", "vector", "transform" ]
41e42d46b013a9809e6003c78675511df365007f
1,200
c
C
src/math/eigen.c
briling/aepm
4c9b4984f33d22dbd096948b96bc9aa4e61b728a
[ "MIT" ]
1
2020-01-09T13:51:34.000Z
2020-01-09T13:51:34.000Z
src/math/eigen.c
briling/aepm
4c9b4984f33d22dbd096948b96bc9aa4e61b728a
[ "MIT" ]
null
null
null
src/math/eigen.c
briling/aepm
4c9b4984f33d22dbd096948b96bc9aa4e61b728a
[ "MIT" ]
2
2020-01-09T13:55:26.000Z
2022-03-18T14:16:40.000Z
#include "matrix.h" typedef struct{ double value ; double * vector; } eigstr; static int cmpev(const void * p1, const void * p2){ double d; d = (*((eigstr *)p1)).value - (*((eigstr *)p2)).value; if (d > 0) return 1; else if (d < 0) return -1; else return 0; } void eigensort(int n, double * val, double * vec){ double * tval = malloc((n*n+n)*sizeof(double)); double * tvec = tval + n; if(!tval){ abort(); } veccp(n, tval, val); veccp(n*n, tvec, vec); eigstr * eig = malloc(n*sizeof(eigstr)); if(!eig){ abort(); } for(int i=0; i<n; i++){ eig[i].value = tval[i]; eig[i].vector = tvec + n*i; } qsort(eig, n, sizeof(eigstr), cmpev); for(int i=0; i<n; i++){ val[i] = eig[i].value; veccp(n, vec+i*n, eig[i].vector); } free(tval); free(eig); return; } double * smalldiag(int n, double * A){ double * a = malloc(sizeof(double)*symsize(n)); double * v = malloc(sizeof(double)*(n+n*n)); double * b = v + n; veccp(symsize(n), a, A); mx_id(n, b); jacobi(a, b, v, n, 1e-15, 20, NULL); #if 0 vecprint(n, v, "\n", stdout); mx_print(n, b, stdout); #endif eigensort(n, v, b); free(a); return v; }
19.047619
56
0.546667
[ "vector" ]
41e5f64d4a194cb4b4d1e815c3cbbae358cd53d6
10,031
h
C
cups/service-private.h
michaelrsweet/xcs
d85d45b2d727ab28055ab59caa052f0d19982314
[ "Apache-2.0" ]
null
null
null
cups/service-private.h
michaelrsweet/xcs
d85d45b2d727ab28055ab59caa052f0d19982314
[ "Apache-2.0" ]
null
null
null
cups/service-private.h
michaelrsweet/xcs
d85d45b2d727ab28055ab59caa052f0d19982314
[ "Apache-2.0" ]
null
null
null
/* * Private CUPS service definitions. * * Copyright © 2007-2018 by Apple Inc. * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. */ #ifndef _CUPS_SERVICE_PRIVATE_H_ # define _CUPS_SERVICE_PRIVATE_H_ /* * Include necessary headers... */ #include "service.h" #include "thread-private.h" /* * C++ magic... */ # ifdef __cplusplus extern "C" { # endif /* __cplusplus */ /* * Constants... */ /* Maximum number of resources per job/printer */ # define CUPSS_RESOURCES_MAX 100 /* Maximum lease duration value from RFC 3995 - 2^26-1 seconds or ~2 years */ # define CUPSS_NOTIFY_LEASE_DURATION_MAX 67108863 /* But a value of 0 means "never expires"... */ # define CUPSS_NOTIFY_LEASE_DURATION_FOREVER 0 /* Default duration is 1 day */ # define CUPSS_NOTIFY_LEASE_DURATION_DEFAULT 86400 /* ippget event lifetime is 5 minutes */ # define CUPSS_IPPGET_EVENT_LIFE 300 /* URL schemes and DNS-SD types for IPP and web resources... */ # define CUPSS_IPP_SCHEME "ipp" # define CUPSS_IPP_TYPE "_ipp._tcp" # define CUPSS_IPPS_SCHEME "ipps" # define CUPSS_IPPS_TYPE "_ipps._tcp" # define CUPSS_IPPS_3D_TYPE "_ipps-3d._tcp" # define CUPSS_WEB_TYPE "_http._tcp" # define CUPSS_HTTP_SCHEME "http" # define CUPSS_HTTPS_SCHEME "https" /* Access scopes */ # define CUPSS_SCOPE_ADMIN "admin" # define CUPSS_SCOPE_ALL "all" # define CUPSS_SCOPE_DEFAULT "default" # define CUPSS_SCOPE_NONE "none" # define CUPSS_SCOPE_OWNER "owner" /* Group constants */ # define CUPSS_GROUP_NONE (gid_t)-1 # define CUPSS_GROUP_WHEEL (gid_t)0 /* * Types and structures... */ struct _cupss_client_s /**** Client (Connection) Object ****/ { int number; /* Client number */ http_t *http; /* HTTP connection */ ipp_t *request, /* IPP request */ *response; /* IPP response */ time_t start; /* Request start time */ http_state_t operation; /* Request operation */ ipp_op_t operation_id; /* IPP operation-id */ char uri[1024], /* Request URI */ *options; /* URI options */ http_addr_t addr; /* Client address */ char hostname[256], /* Client hostname */ username[32]; /* Client authenticated username */ cupss_printer_t *printer; /* Printer */ cupss_job_t *job; /* Current job, if any */ int fetch_compression, /* Compress file? */ fetch_file; /* File to fetch */ }; typedef struct _cupss_device_s /**** Output Device data ****/ { _cups_rwlock_t rwlock; /* Printer lock */ char *name, /* printer-name (mapped to output-device) */ *uuid; /* output-device-uuid */ ipp_t *attrs; /* All printer attributes */ ipp_pstate_t state; /* printer-state value */ cupss_preason_t reasons; /* printer-state-reasons values */ } _cupss_device_t; struct _cupss_document_s /**** Document Object ****/ { }; typedef struct _cupss_filter_s /**** Attribute filter ****/ { cups_array_t *ra; /* Requested attributes */ cups_array_t *pa; /* Private attributes */ ipp_tag_t group_tag; /* Group to copy */ } _cupss_filter_t; struct _cupss_job_s /**** Job Object ****/ { int id; /* job-id */ _cups_rwlock_t rwlock; /* Job lock */ const char *name, /* job-name */ *username, /* job-originating-user-name */ *format; /* document-format */ int priority; /* job-priority */ char *dev_uuid; /* output-device-uuid-assigned */ ipp_jstate_t state, /* job-state value */ dev_state; /* output-device-job-state value */ cupss_jreason_t state_reasons, /* job-state-reasons values */ dev_state_reasons; /* output-device-job-state-reasons values */ char *dev_state_message; /* output-device-job-state-message value */ time_t hold_until, /* job-hold-until time */ created, /* time-at-creation value */ processing, /* time-at-processing value */ completed; /* time-at-completed value */ int impressions, /* job-impressions value */ impcompleted; /* job-impressions-completed value */ ipp_t *attrs; /* Attributes */ int cancel; /* Non-zero when job canceled */ char *filename; /* Print file name */ int fd; /* Print file descriptor */ int transform_pid; /* Transform process ID, if any */ cupss_printer_t *printer; /* Printer */ int num_resources, /* Number of job resources */ resources[CUPSS_RESOURCES_MAX]; /* Job resource IDs */ }; typedef struct _cupss_lang_s /**** Localization data ****/ { char *lang, /* Language code */ *filename; /* Strings file */ } _cupss_lang_t; typedef struct _cupss_listener_s /**** Listener data ****/ { int fd; /* Listener socket */ char host[256]; /* Hostname, if any */ int port; /* Port number */ } _cupss_listener_t; struct _cupss_printer_s /**** Printer (Service) Object ****/ { int id; /* Printer ID */ cupss_type_t type; /* Type of printer/service */ _cups_rwlock_t rwlock; /* Printer lock */ cupss_srv_t ipp_ref, /* Bonjour IPP service */ #ifdef HAVE_SSL ipps_ref, /* Bonjour IPPS service */ #endif /* HAVE_SSL */ http_ref, /* Bonjour HTTP(S) service */ printer_ref; /* Bonjour LPD service */ cupss_loc_t geo_ref; /* Bonjour geo-location */ char *default_uri, /* Default/first URI */ *dnssd_name, /* printer-dnssd-name */ *name, /* printer-name */ *resource; /* Resource path */ size_t resourcelen; /* Length of resource path */ cupss_pinfo_t pinfo; /* Printer information */ cups_array_t *devices; /* Associated devices */ ipp_t *dev_attrs; /* Current device attributes */ time_t start_time; /* Startup time */ time_t config_time; /* printer-config-change-time */ char is_accepting, /* printer-is-accepting-jobs value */ is_deleted, /* Is the printer being deleted? */ is_shutdown; /* Is the printer shutdown? */ ipp_pstate_t state, /* printer-state value */ dev_state; /* Current device printer-state value */ cupss_preason_t state_reasons, /* printer-state-reasons values */ dev_reasons; /* Current device printer-state-reasons values */ time_t state_time; /* printer-state-change-time */ cups_array_t *jobs, /* Jobs */ *active_jobs, /* Active jobs */ *completed_jobs;/* Completed jobs */ cupss_job_t *processing_job;/* Current processing job */ int next_job_id; /* Next job-id value */ cupss_identify_t identify_actions; /* identify-actions value, if any */ char *identify_message; /* Identify-Printer message value, if any */ int num_resources, /* Number of printer resources */ resources[CUPSS_RESOURCES_MAX]; /* Printer resource IDs */ ipp_t *attrs; /* Printer attributes */ cups_array_t *strings; /* Strings (resource) files */ gid_t print_group, /* Print group, if any */ proxy_group; /* Proxy group, if any */ void *user_data; /* User data pointer */ }; typedef struct _cupss_privacy_s /**** Privacy Attributes and Scope ****/ { cups_array_t *public_attrs; /* Public attributes */ char *scope; /* Who gets to see private attributes */ } _cupss_privacy_t; struct _cupss_resource_s /**** Resource Object ****/ { int id; /* resource-id */ _cups_rwlock_t rwlock; /* Resource lock */ ipp_t *attrs; /* Resource attributes */ ipp_rstate_t state; /* Resource state */ char *resource, /* External resource path */ *filename, /* Local filename */ *format; /* MIME media type */ int use; /* Use count */ }; struct _cupss_subscription_s /**** Subscription Object ****/ { int id; /* notify-subscription-id */ const char *uuid; /* notify-subscription-uuid */ _cups_rwlock_t rwlock; /* Subscription lock */ cupss_event_t mask; /* Event mask */ cupss_printer_t *printer; /* Printer, if any */ cupss_job_t *job; /* Job, if any */ cupss_resource_t *resource; /* Resource, if any */ ipp_t *attrs; /* Attributes */ const char *username; /* notify-subscriber-user-name */ int lease; /* notify-lease-duration */ int interval; /* notify-time-interval */ time_t expire; /* Lease expiration time */ int first_sequence, /* First notify-sequence-number in cache */ last_sequence; /* Last notify-sequence-number used */ cups_array_t *events; /* Events (ipp_t *'s) */ int pending_delete; /* Non-zero when the subscription is about to be deleted/canceled */ }; struct _cupss_system_s /**** System Service Object ****/ { _cups_rwlock_t rwlock; /* System lock */ const char *uuid; /* system-uuid */ ipp_t *attrs; /* Attributes */ time_t start_time, /* Startup time */ config_time; /* Time of last config change */ int config_changes; /* Number of config changes made */ char *auth_realm, /* HTTP authentication realm */ *auth_scheme; /* HTTP authentication scheme */ _cupss_privacy_t doc_privacy, /* Document privacy attributes/scope */ job_privacy, /* Job privacy attributes/scope */ sub_privacy; /* Subscription privacy attributes/scope */ ipp_t *privacy_attrs; /* Privacy attributes for each service */ cups_array_t *listeners; /* Listeners for service */ cupss_logcb_t log_cb; /* Log callback */ void *log_data; /* User data for log callback */ cupss_loglevel_t log_level; /* Log level */ int MaxJobs , MaxCompletedJobs , NextPrinterId ; cups_array_t *Printers ; int RelaxedConformance ; char *ServerName ; char *SpoolDirectory ; #ifdef HAVE_DNSSD DNSServiceRef DNSSDMaster ; #elif defined(HAVE_AVAHI) AvahiThreadedPoll *DNSSDMaster ; AvahiClient *DNSSDClient ; #endif /* HAVE_DNSSD */ char *DNSSDSubType ; _cups_rwlock_t ResourcesRWLock ; cups_array_t *ResourcesById ; cups_array_t *ResourcesByPath ; int NextResourceId ; _cups_mutex_t NotificationMutex ; _cups_cond_t NotificationCondition ; _cups_rwlock_t SubscriptionsRWLock ; cups_array_t *Subscriptions ; int NextSubscriptionId ; }; /* * Functions... */ # ifdef __cplusplus } # endif /* __cplusplus */ #endif /* !_CUPSE_SERVICE_PRIVATE_H_ */
31.152174
92
0.668627
[ "object", "transform", "3d" ]
510893b0c88d95402a56380c667e627c1161b4a1
31,342
h
C
redist/inc/cmqbc.h
gmarcon83/mq-mqi-nodejs
27d44772254d0d76438022c6305277f603ff6acb
[ "Apache-2.0" ]
null
null
null
redist/inc/cmqbc.h
gmarcon83/mq-mqi-nodejs
27d44772254d0d76438022c6305277f603ff6acb
[ "Apache-2.0" ]
null
null
null
redist/inc/cmqbc.h
gmarcon83/mq-mqi-nodejs
27d44772254d0d76438022c6305277f603ff6acb
[ "Apache-2.0" ]
null
null
null
#if !defined(MQBC_INCLUDED) /* File not yet included? */ #define MQBC_INCLUDED /* Show file now included */ /****************************************************************/ /* */ /* IBM MQ for LinuxIntel */ /* */ /* FILE NAME: CMQBC */ /* */ /* DESCRIPTION: Declarations for MQ Administration */ /* Interface */ /* */ /****************************************************************/ /* */ /* <copyright */ /* notice="lm-source-program" */ /* pids="5724-H72" */ /* years="1993,2021" */ /* crc="2042140514" > */ /* Licensed Materials - Property of IBM */ /* */ /* 5724-H72 */ /* */ /* (C) Copyright IBM Corp. 1993, 2021 All Rights Reserved. */ /* */ /* US Government Users Restricted Rights - Use, duplication or */ /* disclosure restricted by GSA ADP Schedule Contract with */ /* IBM Corp. */ /* </copyright> */ /* */ /****************************************************************/ /* */ /* FUNCTION: This file declares the functions, */ /* structures and named constants for the MQ */ /* administration interface (MQAI). */ /* */ /* PROCESSOR: C */ /* */ /****************************************************************/ /****************************************************************/ /* <BEGIN_BUILDINFO> */ /* Generated on: 11/4/21 3:44 PM */ /* Build Level: p924-L211104 */ /* Build Type: Production */ /* Pointer Size: 32 Bit, 64 Bit */ /* Source File: */ /* @(#) famfiles/xml/approved/cmqbc.xml, famfiles, p000, */ /* p000-L100302 1.11 10/02/27 07:31:45 */ /* <END_BUILDINFO> */ /****************************************************************/ #if defined(__cplusplus) extern "C" { #endif /****************************************************************/ /* Values Related to Specific Functions */ /****************************************************************/ /* Create-Bag Options for mqCreateBag */ #define MQCBO_NONE 0x00000000 #define MQCBO_USER_BAG 0x00000000 #define MQCBO_ADMIN_BAG 0x00000001 #define MQCBO_COMMAND_BAG 0x00000010 #define MQCBO_SYSTEM_BAG 0x00000020 #define MQCBO_GROUP_BAG 0x00000040 #define MQCBO_LIST_FORM_ALLOWED 0x00000002 #define MQCBO_LIST_FORM_INHIBITED 0x00000000 #define MQCBO_REORDER_AS_REQUIRED 0x00000004 #define MQCBO_DO_NOT_REORDER 0x00000000 #define MQCBO_CHECK_SELECTORS 0x00000008 #define MQCBO_DO_NOT_CHECK_SELECTORS 0x00000000 /* Buffer Length for mqAddString and mqSetString */ #define MQBL_NULL_TERMINATED (-1) /* Item Types for mqInquireItemInfo */ #define MQITEM_INTEGER 1 #define MQITEM_STRING 2 #define MQITEM_BAG 3 #define MQITEM_BYTE_STRING 4 #define MQITEM_INTEGER_FILTER 5 #define MQITEM_STRING_FILTER 6 #define MQITEM_INTEGER64 7 #define MQITEM_BYTE_STRING_FILTER 8 /* */ #define MQIT_INTEGER 1 #define MQIT_STRING 2 #define MQIT_BAG 3 /****************************************************************/ /* Values Related to Most Functions */ /****************************************************************/ /* Handle Selectors */ #define MQHA_FIRST 4001 #define MQHA_BAG_HANDLE 4001 #define MQHA_LAST_USED 4001 #define MQHA_LAST 6000 /* Limits for Selectors for Object Attributes */ #define MQOA_FIRST 1 #define MQOA_LAST 9000 /* Integer System Selectors */ #define MQIASY_FIRST (-1) #define MQIASY_CODED_CHAR_SET_ID (-1) #define MQIASY_TYPE (-2) #define MQIASY_COMMAND (-3) #define MQIASY_MSG_SEQ_NUMBER (-4) #define MQIASY_CONTROL (-5) #define MQIASY_COMP_CODE (-6) #define MQIASY_REASON (-7) #define MQIASY_BAG_OPTIONS (-8) #define MQIASY_VERSION (-9) #define MQIASY_LAST_USED (-9) #define MQIASY_LAST (-2000) /* Special Selector Values */ #define MQSEL_ANY_SELECTOR (-30001) #define MQSEL_ANY_USER_SELECTOR (-30002) #define MQSEL_ANY_SYSTEM_SELECTOR (-30003) #define MQSEL_ALL_SELECTORS (-30001) #define MQSEL_ALL_USER_SELECTORS (-30002) #define MQSEL_ALL_SYSTEM_SELECTORS (-30003) /* Special Index Values */ #define MQIND_NONE (-1) #define MQIND_ALL (-2) /* Bag Handles */ #define MQHB_UNUSABLE_HBAG (-1) #define MQHB_NONE (-2) /****************************************************************/ /* Simple Data Types */ /****************************************************************/ typedef MQLONG MQHBAG; typedef MQHBAG MQPOINTER PMQHBAG; /****************************************************************/ /* Short Names for Functions */ /****************************************************************/ #define MQADDBF mqAddByteStringFilter #define MQADDBG mqAddBag #define MQADDBS mqAddByteString #define MQADDIQ mqAddInquiry #define MQADDIN mqAddInteger #define MQADD64 mqAddInteger64 #define MQADDIF mqAddIntegerFilter #define MQADDST mqAddString #define MQADDSF mqAddStringFilter #define MQBG2BF mqBagToBuffer #define MQBF2BG mqBufferToBag #define MQCLRBG mqClearBag #define MQCNTIT mqCountItems #define MQCRTBG mqCreateBag #define MQDELBG mqDeleteBag #define MQDELIT mqDeleteItem #define MQEXEC mqExecute #define MQGETBG mqGetBag #define MQINQBF mqInquireByteStringFilter #define MQINQBG mqInquireBag #define MQINQBS mqInquireByteString #define MQINQIN mqInquireInteger #define MQINQ64 mqInquireInteger64 #define MQINQIF mqInquireIntegerFilter #define MQINQIT mqInquireItemInfo #define MQINQST mqInquireString #define MQINQSF mqInquireStringFilter #define MQPAD mqPad #define MQPUTBG mqPutBag #define MQSETBF mqSetByteStringFilter #define MQSETBS mqSetByteString #define MQSETIN mqSetInteger #define MQSET64 mqSetInteger64 #define MQSETIF mqSetIntegerFilter #define MQSETST mqSetString #define MQSETSF mqSetStringFilter #define MQTRIM mqTrim #define MQTRNBG mqTruncateBag /****************************************************************/ /* mqAddBag Function -- Add Nested Bag to Bag */ /****************************************************************/ void MQENTRY mqAddBag ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQHBAG ItemValue, /* I: Item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqAddByteString Function -- Add Byte String to Bag */ /****************************************************************/ void MQENTRY mqAddByteString ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG BufferLength, /* IL: Length of buffer */ PMQBYTE pBuffer, /* IB: Buffer containing item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqAddByteStringFilter Function -- Add Byte String Filter to */ /* Bag */ /****************************************************************/ void MQENTRY mqAddByteStringFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG BufferLength, /* IL: Length of buffer */ PMQBYTE pBuffer, /* IB: Buffer containing item value */ MQLONG Operator, /* I: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqAddInquiry Function -- Add an Inquiry Item to Bag */ /****************************************************************/ void MQENTRY mqAddInquiry ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Attribute selector */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqAddInteger Function -- Add Integer to Bag */ /****************************************************************/ void MQENTRY mqAddInteger ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemValue, /* I: Item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqAddInteger64 Function -- Add 64-bit Integer to Bag */ /****************************************************************/ void MQENTRY mqAddInteger64 ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQINT64 ItemValue, /* I: Item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqAddIntegerFilter Function -- Add Integer Filter to Bag */ /****************************************************************/ void MQENTRY mqAddIntegerFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemValue, /* I: Item value */ MQLONG Operator, /* I: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqAddString Function -- Add String to Bag */ /****************************************************************/ void MQENTRY mqAddString ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG BufferLength, /* IL: Length of buffer */ PMQCHAR pBuffer, /* IB: Buffer containing item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqAddStringFilter Function -- Add String Filter to Bag */ /****************************************************************/ void MQENTRY mqAddStringFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG BufferLength, /* IL: Length of buffer */ PMQCHAR pBuffer, /* IB: Buffer containing item value */ MQLONG Operator, /* I: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqBagToBuffer Function -- Convert Bag to PCF */ /****************************************************************/ void MQENTRY mqBagToBuffer ( MQHBAG OptionsBag, /* I: Handle of options bag */ MQHBAG DataBag, /* I: Handle of data bag */ MQLONG BufferLength, /* IL: Length of buffer */ PMQVOID pBuffer, /* OB: Buffer to contain PCF */ PMQLONG pDataLength, /* OL: Length of PCF returned in buffer */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqBufferToBag Function -- Convert PCF to Bag */ /****************************************************************/ void MQENTRY mqBufferToBag ( MQHBAG OptionsBag, /* I: Handle of options bag */ MQLONG BufferLength, /* IL: Length of buffer */ PMQVOID pBuffer, /* IB: Buffer containing PCF */ MQHBAG DataBag, /* IO: Handle of bag to contain data */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqClearBag Function -- Delete All Items in Bag */ /****************************************************************/ void MQENTRY mqClearBag ( MQHBAG Bag, /* I: Bag handle */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqCountItems Function -- Count Items in Bag */ /****************************************************************/ void MQENTRY mqCountItems ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ PMQLONG pItemCount, /* O: Number of items */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqCreateBag Function -- Create Bag */ /****************************************************************/ void MQENTRY mqCreateBag ( MQLONG Options, /* I: Bag options */ PMQHBAG pBag, /* O: Handle of bag created */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqDeleteBag Function -- Delete Bag */ /****************************************************************/ void MQENTRY mqDeleteBag ( PMQHBAG pBag, /* IO: Bag handle */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqDeleteItem Function -- Delete Item in Bag */ /****************************************************************/ void MQENTRY mqDeleteItem ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqExecute Function -- Send Admin Command and Receive Reponse */ /****************************************************************/ void MQENTRY mqExecute ( MQHCONN Hconn, /* I: Connection handle */ MQLONG Command, /* I: Command identifier */ MQHBAG OptionsBag, /* I: Handle of options bag */ MQHBAG AdminBag, /* I: Handle of admin bag */ MQHBAG ResponseBag, /* I: Handle of response bag */ MQHOBJ AdminQ, /* I: Handle of admin queue */ MQHOBJ ResponseQ, /* I: Handle of response queue */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqGetBag Function -- Receive PCF Message into Bag */ /****************************************************************/ void MQENTRY mqGetBag ( MQHCONN Hconn, /* I: Connection handle */ MQHOBJ Hobj, /* I: Queue handle */ PMQVOID pMsgDesc, /* IO: Message descriptor */ PMQVOID pGetMsgOpts, /* IO: Get-message options */ MQHBAG Bag, /* IO: Handle of bag to contain message */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqInquireBag Function -- Inquire Handle in Bag */ /****************************************************************/ void MQENTRY mqInquireBag ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ PMQHBAG pItemValue, /* O: Item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqInquireByteString Function -- Inquire Byte String in Bag */ /****************************************************************/ void MQENTRY mqInquireByteString ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG BufferLength, /* IL: Length of buffer */ PMQBYTE pBuffer, /* OB: Buffer to contain string */ PMQLONG pByteStringLength, /* O: Length of byte string returned */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying */ /* CompCode */ /****************************************************************/ /* mqInquireByteStringFilter Function -- Inquire Byte String */ /* Filter in Bag */ /****************************************************************/ void MQENTRY mqInquireByteStringFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG BufferLength, /* IL: Length of buffer */ PMQBYTE pBuffer, /* OB: Buffer to contain string */ PMQLONG pByteStringLength, /* O: Length of byte string returned */ PMQLONG pOperator, /* O: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying */ /* CompCode */ /****************************************************************/ /* mqInquireInteger Function -- Inquire Integer in Bag */ /****************************************************************/ void MQENTRY mqInquireInteger ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ PMQLONG pItemValue, /* O: Item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqInquireInteger64 Function -- Inquire 64-bit Integer in Bag */ /****************************************************************/ void MQENTRY mqInquireInteger64 ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ PMQINT64 pItemValue, /* O: Item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqInquireIntegerFilter Function -- Inquire Integer Filter in */ /* Bag */ /****************************************************************/ void MQENTRY mqInquireIntegerFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ PMQLONG pItemValue, /* O: Item value */ PMQLONG pOperator, /* O: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqInquireItemInfo Function -- Inquire Attributes of Item in */ /* Bag */ /****************************************************************/ void MQENTRY mqInquireItemInfo ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ PMQLONG pOutSelector, /* O: Selector of item */ PMQLONG pItemType, /* O: Data type of item */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqInquireString Function -- Inquire String in Bag */ /****************************************************************/ void MQENTRY mqInquireString ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG BufferLength, /* IL: Length of buffer */ PMQCHAR pBuffer, /* OB: Buffer to contain string */ PMQLONG pStringLength, /* O: Length of string returned */ PMQLONG pCodedCharSetId, /* O: Character-set identifier of */ /* string */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqInquireStringFilter Function -- Inquire String Filter in */ /* Bag */ /****************************************************************/ void MQENTRY mqInquireStringFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG BufferLength, /* IL: Length of buffer */ PMQCHAR pBuffer, /* OB: Buffer to contain string */ PMQLONG pStringLength, /* O: Length of string returned */ PMQLONG pCodedCharSetId, /* O: Character-set identifier of */ /* string */ PMQLONG pOperator, /* O: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqPad Function -- Pad Null-terminated String with Blanks */ /****************************************************************/ void MQENTRY mqPad ( PMQCHAR pString, /* I: Null-terminated string to be padded */ MQLONG BufferLength, /* IL: Length of buffer */ PMQCHAR pBuffer, /* OB: Buffer to contain padded string */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqPutBag Function -- Send Bag as PCF Message */ /****************************************************************/ void MQENTRY mqPutBag ( MQHCONN Hconn, /* I: Connection handle */ MQHOBJ Hobj, /* I: Queue handle */ PMQVOID pMsgDesc, /* IO: Message descriptor */ PMQVOID pPutMsgOpts, /* IO: Put-message options */ MQHBAG Bag, /* I: Handle of bag containing message data */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqSetByteString Function -- Modify Byte String in Bag */ /****************************************************************/ void MQENTRY mqSetByteString ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG BufferLength, /* I: Length of buffer */ PMQBYTE pBuffer, /* I: Buffer containing item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqSetByteStringFilter Function -- Modify Byte String Filter */ /* in Bag */ /****************************************************************/ void MQENTRY mqSetByteStringFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG BufferLength, /* IL: Length of buffer */ PMQBYTE pBuffer, /* IB: Buffer containing item value */ MQLONG Operator, /* I: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqSetInteger Function -- Modify Integer in Bag */ /****************************************************************/ void MQENTRY mqSetInteger ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG ItemValue, /* I: Item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqSetInteger64 Function -- Modify 64-bit Integer in Bag */ /****************************************************************/ void MQENTRY mqSetInteger64 ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQINT64 ItemValue, /* I: Item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqSetIntegerFilter Function -- Modify Integer Filter in Bag */ /****************************************************************/ void MQENTRY mqSetIntegerFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG ItemValue, /* I: Item value */ MQLONG Operator, /* I: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqSetString Function -- Modify String in Bag */ /****************************************************************/ void MQENTRY mqSetString ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG BufferLength, /* IL: Length of buffer */ PMQCHAR pBuffer, /* IB: Buffer containing item value */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqSetStringFilter Function -- Modify String Filter in Bag */ /****************************************************************/ void MQENTRY mqSetStringFilter ( MQHBAG Bag, /* I: Bag handle */ MQLONG Selector, /* I: Item selector */ MQLONG ItemIndex, /* I: Item index */ MQLONG BufferLength, /* IL: Length of buffer */ PMQCHAR pBuffer, /* IB: Buffer containing item value */ MQLONG Operator, /* I: Item operator */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqTrim Function -- Replace Trailing Blanks with Null */ /* Character */ /****************************************************************/ void MQENTRY mqTrim ( MQLONG BufferLength, /* IL: Length of buffer */ PMQCHAR pBuffer, /* IB: Buffer containing blank-padded */ /* string */ PMQCHAR pString, /* O: String with blanks discarded */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ /****************************************************************/ /* mqTruncateBag Function -- Delete Trailing Items in Bag */ /****************************************************************/ void MQENTRY mqTruncateBag ( MQHBAG Bag, /* I: Bag handle */ MQLONG ItemCount, /* I: Number of items to remain in bag */ PMQLONG pCompCode, /* OC: Completion code */ PMQLONG pReason); /* OR: Reason code qualifying CompCode */ #if defined(__cplusplus) } #endif /****************************************************************/ /* End of CMQBC */ /****************************************************************/ #endif /* End of header file */
43.957924
72
0.439634
[ "object" ]
510a761dab8904b8dd7d963ac7a47abc24c1330b
5,392
c
C
test/plugin/INKHttpHooksTrans/INKProto.c
pquerna/trafficserver
43b94d9926bf11573b178f46c01db6e235f1345e
[ "Apache-2.0" ]
1
2017-10-26T12:04:44.000Z
2017-10-26T12:04:44.000Z
test/plugin/INKHttpHooksTrans/INKProto.c
pquerna/trafficserver
43b94d9926bf11573b178f46c01db6e235f1345e
[ "Apache-2.0" ]
null
null
null
test/plugin/INKHttpHooksTrans/INKProto.c
pquerna/trafficserver
43b94d9926bf11573b178f46c01db6e235f1345e
[ "Apache-2.0" ]
null
null
null
/** @file A brief file description @section license License 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 "InkAPI.h" #if 0 /* HTTP transactions */ /* Cached, get as soon as a transaction is available. */ inkapi int INKHttpTxnCachedReqGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset); /* Cached, get as soon as a transaction is available. */ inkapi int INKHttpTxnCachedRespGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset); /* Client port */ inkapi int INKHttpTxnClientIncomingPortGet(INKHttpTxn txnp); /* Client IP for a transaction (not incoming) */ inkapi unsigned int INKHttpTxnClientIPGet(INKHttpTxn txnp); /* Non-cached, * get client req after recieving INK_HTTP_READ_REQUEST_HDR_HOOK */ inkapi int INKHttpTxnClientReqGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset); /* Non-cached, * get "client" req after recieving INK_HTTP_READ_RESPONSE_HDR_HOOK */ inkapi int INKHttpTxnClientRespGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset); /* This is a response to a client (req), which will be executed after reciept * of: * 1. INK_HTTP_OS_DNS_HOOK fails for some reason to do the translation * 2. INK_HTTP_READ_RESPONSE_HDR_HOOK origin server replied with some * type of error. * 3. An error is possible at any point in HTTP processing. */ inkapi void INKHttpTxnErrorBodySet(INKHttpTxn txnp, char *buf, int buflength, char *mimetype); /* DONE */ inkapi void INKHttpTxnHookAdd(INKHttpTxn txnp, INKHttpHookID id, INKCont contp); /* Origin Server (destination) or Parent IP */ inkapi unsigned int INKHttpTxnNextHopIPGet(INKHttpTxn txnp); /* Results if parent proxy not enabled, results if parent proxy is enabled */ inkapi void INKHttpTxnParentProxyGet(INKHttpTxn txnp, char **hostname, int *port); inkapi void INKHttpTxnParentProxySet(INKHttpTxn txnp, char *hostname, int port); /* */ inkapi void INKHttpTxnReenable(INKHttpTxn txnp, INKEvent event); /* Origin Server IP */ inkapi unsigned int INKHttpTxnServerIPGet(INKHttpTxn txnp); /* Need a transaction and a request: earliest point is * not INK_HTTP_TXN_START_HOOK but INK_HTTP_READ_REQUEST_HDR_HOOK * process the request. */ inkapi int INKHttpTxnServerReqGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset); /* Need a transaction and a server response: earliest point is * INK_HTTP_READ_RESPONSE_HDR_HOOK, then process the response. */ inkapi int INKHttpTxnServerRespGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset); /* Call this as soon as a transaction has been created and retrieve the session * and do some processing. */ inkapi INKHttpSsn INKHttpTxnSsnGet(INKHttpTxn txnp); /* Call this before a write to the cache is done, else too late for * current txn: * INK_HTTP_READ_RESPONSE_HDR_HOOK. * default: transformed copy written to cache * on == non-zero, cache_transformed = true (default) * on == zero, cache_transformed = false */ inkapi void INKHttpTxnTransformedRespCache(INKHttpTxn txnp, int on); /* INK_HTTP_READ_RESPONSE_HOOK & INK_HTTP_RESPONSE_HDR_HOOK * Get the transform resp header from the HTTP transaction. * re = 0 if dne, else 1. */ inkapi int INKHttpTxnTransformRespGet(INKHttpTxn txnp, INKMBuffer * bufp, INKMLoc * offset); /* Call this before a write to the cache is done, else too late for * current txn: * INK_HTTP_READ_RESPONSE_HDR_HOOK. * default: un-transformed copy not written to cache * on == non-zero, cache_untransformed = true * on == zero, cache_untransformed = false (default) */ inkapi void INKHttpTxnUntransformedRespCache(INKHttpTxn txnp, int on); #endif /* Run prototype code in this small plug-in. Then place this * code into it's own section. */ static int INKProto(INKCont contp, INKEvent event, void *eData) { INKHttpTxn txnp = (INKHttpTxn) eData; INKHttpSsn ssnp = (INKHttpSsn) eData; switch (event) { case INK_EVENT_HTTP_READ_RESPONSE_HDR: INKDebug("tag", "event %d received\n", event); /* INKHttpSsnReenable(ssnp, INK_EVENT_HTTP_CONTINUE); */ INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE); break; case INK_EVENT_HTTP_RESPONSE_TRANSFORM: INKDebug("tag", "event %d received\n", event); INKHttpSsnReenable(ssnp, INK_EVENT_HTTP_CONTINUE); break; default: INKDebug("tag", "Undefined event %d received\n"); break; } } void INKPluginInit(int argc, const char *argv[]) { INKCont contp = INKContCreate(INKProto, NULL); /* Context: INKHttpTxnTransformRespGet(): * Q: are both of these received and if so, in what order? */ INKHttpHookAdd(INK_HTTP_READ_RESPONSE_HDR_HOOK, contp); INKHttpHookAdd(INK_HTTP_RESPONSE_TRANSFORM_HOOK, contp); }
33.283951
94
0.756677
[ "transform" ]
5de7fc82a02e691c85dd16302a173fa5c7503867
2,064
h
C
sample/eSDK_TP_Native_CPP_Demo/TP_Native_Demo/TP_Native_ScheduleConfDlg.h
lwx294490/eSDK_TP_SDK_Windows_CPP
9bc48389daa1baa206129cc45b0345a012527794
[ "Apache-2.0" ]
null
null
null
sample/eSDK_TP_Native_CPP_Demo/TP_Native_Demo/TP_Native_ScheduleConfDlg.h
lwx294490/eSDK_TP_SDK_Windows_CPP
9bc48389daa1baa206129cc45b0345a012527794
[ "Apache-2.0" ]
null
null
null
sample/eSDK_TP_Native_CPP_Demo/TP_Native_Demo/TP_Native_ScheduleConfDlg.h
lwx294490/eSDK_TP_SDK_Windows_CPP
9bc48389daa1baa206129cc45b0345a012527794
[ "Apache-2.0" ]
1
2019-05-04T01:53:59.000Z
2019-05-04T01:53:59.000Z
/*Copyright 2015 Huawei Technologies Co., Ltd. All rights reserved. eSDK is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.*/ #pragma once //#include "TP_Native_Sheet.h" #include "resource.h" #include "afxcmn.h" #include "afxwin.h" class CTP_Native_Sheet; // CTP_Native_ScheduleConfDlg dialog class CTP_Native_ScheduleConfDlg : public CPropertyPage { DECLARE_DYNAMIC(CTP_Native_ScheduleConfDlg) private: CTP_Native_Sheet *m_sheet; public: CTP_Native_ScheduleConfDlg(); // standard constructor virtual ~CTP_Native_ScheduleConfDlg(); void SetSheet(CTP_Native_Sheet* sheet) {m_sheet = sheet;} void UpdateSiteList(); // Dialog Data enum { IDD = IDD_SCHEDULE_CONF }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog(); afx_msg void OnBnClickedBtnQuerySites(); CListCtrl m_sitesInfoList; afx_msg void OnNMClickList2(NMHDR *pNMHDR, LRESULT *pResult); CString m_confName; CString m_beginTime; CString m_confTime; CString m_confPwd; CString m_accessCode; CString m_chairmanPwd; CComboBox m_cb_rate; CComboBox m_cb_pwdtype; CComboBox m_cb_multi; CComboBox m_cb_vediofm; CComboBox m_cb_vediopr; afx_msg void OnBnClickedBtnCreateconf(); vector<SiteInfoEx> m_allSitesInfo; vector<SiteInfoEx> m_joinConfSitesInfo; CComboBox m_cmbRecurrenceConfFrequency; afx_msg void OnBnClickedCheckRecurrenceConf(); afx_msg void OnBnClickedCheckAdhocConfTemplate(); afx_msg void OnBnClickedButtonAddAdhocConfTemplate(); CEdit m_editRecurrenceConfCount; CEdit m_editRecurrenceConfInterval; };
32.25
72
0.807655
[ "vector" ]
5dee7b8f40f30dab60bab577c5168b9894dea687
8,926
h
C
iotvideo/include/tencentcloud/iotvideo/v20191126/model/CreateStorageServiceRequest.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
43
2019-08-14T08:14:12.000Z
2022-03-30T12:35:09.000Z
iotvideo/include/tencentcloud/iotvideo/v20191126/model/CreateStorageServiceRequest.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
12
2019-07-15T10:44:59.000Z
2021-11-02T12:35:00.000Z
iotvideo/include/tencentcloud/iotvideo/v20191126/model/CreateStorageServiceRequest.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
28
2019-07-12T09:06:22.000Z
2022-03-30T08:04:18.000Z
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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. */ #ifndef TENCENTCLOUD_IOTVIDEO_V20191126_MODEL_CREATESTORAGESERVICEREQUEST_H_ #define TENCENTCLOUD_IOTVIDEO_V20191126_MODEL_CREATESTORAGESERVICEREQUEST_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/AbstractModel.h> namespace TencentCloud { namespace Iotvideo { namespace V20191126 { namespace Model { /** * CreateStorageService请求参数结构体 */ class CreateStorageServiceRequest : public AbstractModel { public: CreateStorageServiceRequest(); ~CreateStorageServiceRequest() = default; std::string ToJsonString() const; /** * 获取云存套餐ID: yc1m3d : 全时3天存储月套餐。 yc1m7d : 全时7天存储月套餐。 yc1m30d :全时30天存储月套餐。 yc1y3d :全时3天存储年套餐。 yc1y7d :全时7天存储年套餐。 yc1y30d :全时30天存储年套餐。 ye1m3d :事件3天存储月套餐。 ye1m7d :事件7天存储月套餐。 ye1m30d :事件30天存储月套餐 。 ye1y3d :事件3天存储年套餐。 ye1y7d :事件7天存储年套餐。 ye1y30d :事件30天存储年套餐。 yc1w7d : 全时7天存储周套餐。 ye1w7d : 事件7天存储周套餐。 * @return PkgId 云存套餐ID: yc1m3d : 全时3天存储月套餐。 yc1m7d : 全时7天存储月套餐。 yc1m30d :全时30天存储月套餐。 yc1y3d :全时3天存储年套餐。 yc1y7d :全时7天存储年套餐。 yc1y30d :全时30天存储年套餐。 ye1m3d :事件3天存储月套餐。 ye1m7d :事件7天存储月套餐。 ye1m30d :事件30天存储月套餐 。 ye1y3d :事件3天存储年套餐。 ye1y7d :事件7天存储年套餐。 ye1y30d :事件30天存储年套餐。 yc1w7d : 全时7天存储周套餐。 ye1w7d : 事件7天存储周套餐。 */ std::string GetPkgId() const; /** * 设置云存套餐ID: yc1m3d : 全时3天存储月套餐。 yc1m7d : 全时7天存储月套餐。 yc1m30d :全时30天存储月套餐。 yc1y3d :全时3天存储年套餐。 yc1y7d :全时7天存储年套餐。 yc1y30d :全时30天存储年套餐。 ye1m3d :事件3天存储月套餐。 ye1m7d :事件7天存储月套餐。 ye1m30d :事件30天存储月套餐 。 ye1y3d :事件3天存储年套餐。 ye1y7d :事件7天存储年套餐。 ye1y30d :事件30天存储年套餐。 yc1w7d : 全时7天存储周套餐。 ye1w7d : 事件7天存储周套餐。 * @param PkgId 云存套餐ID: yc1m3d : 全时3天存储月套餐。 yc1m7d : 全时7天存储月套餐。 yc1m30d :全时30天存储月套餐。 yc1y3d :全时3天存储年套餐。 yc1y7d :全时7天存储年套餐。 yc1y30d :全时30天存储年套餐。 ye1m3d :事件3天存储月套餐。 ye1m7d :事件7天存储月套餐。 ye1m30d :事件30天存储月套餐 。 ye1y3d :事件3天存储年套餐。 ye1y7d :事件7天存储年套餐。 ye1y30d :事件30天存储年套餐。 yc1w7d : 全时7天存储周套餐。 ye1w7d : 事件7天存储周套餐。 */ void SetPkgId(const std::string& _pkgId); /** * 判断参数 PkgId 是否已赋值 * @return PkgId 是否已赋值 */ bool PkgIdHasBeenSet() const; /** * 获取设备TID * @return Tid 设备TID */ std::string GetTid() const; /** * 设置设备TID * @param Tid 设备TID */ void SetTid(const std::string& _tid); /** * 判断参数 Tid 是否已赋值 * @return Tid 是否已赋值 */ bool TidHasBeenSet() const; /** * 获取订单数量,可一次性创建多个订单 * @return OrderCount 订单数量,可一次性创建多个订单 */ int64_t GetOrderCount() const; /** * 设置订单数量,可一次性创建多个订单 * @param OrderCount 订单数量,可一次性创建多个订单 */ void SetOrderCount(const int64_t& _orderCount); /** * 判断参数 OrderCount 是否已赋值 * @return OrderCount 是否已赋值 */ bool OrderCountHasBeenSet() const; /** * 获取云存服务所在的区域,如ap-guangzhou,ap-singapore, na-siliconvalley, eu-frankfurt * @return StorageRegion 云存服务所在的区域,如ap-guangzhou,ap-singapore, na-siliconvalley, eu-frankfurt */ std::string GetStorageRegion() const; /** * 设置云存服务所在的区域,如ap-guangzhou,ap-singapore, na-siliconvalley, eu-frankfurt * @param StorageRegion 云存服务所在的区域,如ap-guangzhou,ap-singapore, na-siliconvalley, eu-frankfurt */ void SetStorageRegion(const std::string& _storageRegion); /** * 判断参数 StorageRegion 是否已赋值 * @return StorageRegion 是否已赋值 */ bool StorageRegionHasBeenSet() const; /** * 获取视频流通道号。(对于存在多路视频流的设备,如NVR设备,与设备实际视频流通道号对应) * @return ChnNum 视频流通道号。(对于存在多路视频流的设备,如NVR设备,与设备实际视频流通道号对应) */ int64_t GetChnNum() const; /** * 设置视频流通道号。(对于存在多路视频流的设备,如NVR设备,与设备实际视频流通道号对应) * @param ChnNum 视频流通道号。(对于存在多路视频流的设备,如NVR设备,与设备实际视频流通道号对应) */ void SetChnNum(const int64_t& _chnNum); /** * 判断参数 ChnNum 是否已赋值 * @return ChnNum 是否已赋值 */ bool ChnNumHasBeenSet() const; /** * 获取设备主人用户在IoT Video平台的注册ID。该参数用于验证Paas/Saas平台的设备/用户关系链是否一致 * @return AccessId 设备主人用户在IoT Video平台的注册ID。该参数用于验证Paas/Saas平台的设备/用户关系链是否一致 */ std::string GetAccessId() const; /** * 设置设备主人用户在IoT Video平台的注册ID。该参数用于验证Paas/Saas平台的设备/用户关系链是否一致 * @param AccessId 设备主人用户在IoT Video平台的注册ID。该参数用于验证Paas/Saas平台的设备/用户关系链是否一致 */ void SetAccessId(const std::string& _accessId); /** * 判断参数 AccessId 是否已赋值 * @return AccessId 是否已赋值 */ bool AccessIdHasBeenSet() const; /** * 获取服务生效时间,若不指定此参数,服务立即生效 * @return EnableTime 服务生效时间,若不指定此参数,服务立即生效 */ int64_t GetEnableTime() const; /** * 设置服务生效时间,若不指定此参数,服务立即生效 * @param EnableTime 服务生效时间,若不指定此参数,服务立即生效 */ void SetEnableTime(const int64_t& _enableTime); /** * 判断参数 EnableTime 是否已赋值 * @return EnableTime 是否已赋值 */ bool EnableTimeHasBeenSet() const; private: /** * 云存套餐ID: yc1m3d : 全时3天存储月套餐。 yc1m7d : 全时7天存储月套餐。 yc1m30d :全时30天存储月套餐。 yc1y3d :全时3天存储年套餐。 yc1y7d :全时7天存储年套餐。 yc1y30d :全时30天存储年套餐。 ye1m3d :事件3天存储月套餐。 ye1m7d :事件7天存储月套餐。 ye1m30d :事件30天存储月套餐 。 ye1y3d :事件3天存储年套餐。 ye1y7d :事件7天存储年套餐。 ye1y30d :事件30天存储年套餐。 yc1w7d : 全时7天存储周套餐。 ye1w7d : 事件7天存储周套餐。 */ std::string m_pkgId; bool m_pkgIdHasBeenSet; /** * 设备TID */ std::string m_tid; bool m_tidHasBeenSet; /** * 订单数量,可一次性创建多个订单 */ int64_t m_orderCount; bool m_orderCountHasBeenSet; /** * 云存服务所在的区域,如ap-guangzhou,ap-singapore, na-siliconvalley, eu-frankfurt */ std::string m_storageRegion; bool m_storageRegionHasBeenSet; /** * 视频流通道号。(对于存在多路视频流的设备,如NVR设备,与设备实际视频流通道号对应) */ int64_t m_chnNum; bool m_chnNumHasBeenSet; /** * 设备主人用户在IoT Video平台的注册ID。该参数用于验证Paas/Saas平台的设备/用户关系链是否一致 */ std::string m_accessId; bool m_accessIdHasBeenSet; /** * 服务生效时间,若不指定此参数,服务立即生效 */ int64_t m_enableTime; bool m_enableTimeHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_IOTVIDEO_V20191126_MODEL_CREATESTORAGESERVICEREQUEST_H_
30.568493
113
0.496639
[ "vector", "model" ]
5dfe6b7adbbca3653850080cb69ac52081161619
2,499
h
C
lib/TomatoOnePixel.h
MRKonrad/OxShmolli2
abe020f4aa08c1037f04fe80e68f0651d03cccd1
[ "MIT" ]
7
2018-12-10T10:11:03.000Z
2021-03-11T14:40:40.000Z
lib/TomatoOnePixel.h
MRKonrad/OxShmolli2
abe020f4aa08c1037f04fe80e68f0651d03cccd1
[ "MIT" ]
10
2019-03-10T11:42:55.000Z
2021-12-10T15:39:41.000Z
lib/TomatoOnePixel.h
MRKonrad/OxShmolli2
abe020f4aa08c1037f04fe80e68f0651d03cccd1
[ "MIT" ]
3
2019-12-04T14:05:54.000Z
2022-02-26T00:24:38.000Z
/*! * \file TomatoOnePixel.h * \author Konrad Werys * \date 2019/11/26 */ #ifndef TOMATO_TOMATOONEPIXEL_H #define TOMATO_TOMATOONEPIXEL_H #include "TomatoOptions.h" #include "tomatolib_export.h" namespace Ox { template<typename MeasureType> std::map<std::string, MeasureType> calculateOnePixel(TomatoOptions<MeasureType> opts) { // alloc and init Calculator<MeasureType> *calculator = FactoryOfCalculators<MeasureType>::newByFactory(&opts); Model<MeasureType> *model = FactoryOfModels<MeasureType>::newByFactory(&opts); Fitter<MeasureType> *fitter = FactoryOfFitters<MeasureType>::newByFactory(&opts); SignCalculator<MeasureType> *signCalculator = FactoryOfSignCalculators<MeasureType>::newByFactory(&opts); StartPointCalculator<MeasureType> *startPointCalculator = FactoryOfStartPointCalculators<MeasureType>::newByFactory(&opts); if (opts.signal_magnitude.size() > 0) { calculator->setNSamples((int)opts.signal_magnitude.size()); calculator->setSigMag(&(opts.signal_magnitude)[0]); } else { throw std::runtime_error("\nNo magnitude signal, I cannot calculate anything"); } if (opts.signal_phase.size() > 0) { calculator->setSigMag(&(opts.signal_phase)[0]); } if (opts.noise.size() > 0) { calculator->setNoise(&(opts.noise)[0]); } if (opts.inversion_times.size() > 0) { calculator->setInvTimes(&(opts.inversion_times)[0]); } if (opts.echo_times.size() > 0) { calculator->setEchoTimes(&(opts.echo_times)[0]); } // configure calculator calculator->setModel(model); calculator->setFitter(fitter); calculator->setSignCalculator(signCalculator); calculator->setStartPointCalculator(startPointCalculator); calculator->calculate(); std::map<std::string, MeasureType> results = calculator->getResults(); // std::cout << "Results: \n"; // for (typename std::map<std::string, MeasureType>::const_iterator it = results.begin(); it != results.end(); ++it) { // std::cout << it->first << " " << it->second << "\n"; // } // std::cout << std::endl; delete model; delete fitter; delete signCalculator; delete startPointCalculator; delete calculator; return results; } } // namespace Ox #endif //TOMATO_TOMATOONEPIXEL_H
33.77027
131
0.635454
[ "model" ]
5dff9eba686acf2689730cca84914666353b3f42
5,074
c
C
glm/source_code_old/GLM/src/glm_const.c
FLARE-forecast/FLAREv1
f64b96afc9e8514601d042b808a3d454e5413cfb
[ "MIT" ]
null
null
null
glm/source_code_old/GLM/src/glm_const.c
FLARE-forecast/FLAREv1
f64b96afc9e8514601d042b808a3d454e5413cfb
[ "MIT" ]
null
null
null
glm/source_code_old/GLM/src/glm_const.c
FLARE-forecast/FLAREv1
f64b96afc9e8514601d042b808a3d454e5413cfb
[ "MIT" ]
null
null
null
/****************************************************************************** * * * glm_const.c * * * * Declaration of constants * * * * Developed by : * * AquaticEcoDynamics (AED) Group * * School of Agriculture and Environment * * The University of Western Australia * * * * http://aquatic.science.uwa.edu.au/ * * * * Copyright 2013 - 2018 - The University of Western Australia * * * * This file is part of GLM (General Lake Model) * * * * GLM is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * GLM is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * ******************************************************************************/ #include "glm.h" #include "glm_const.h" // General constants const AED_REAL g = 9.81; // 9.780310.*(1+(0.00530239.*(sin(abs(lat)).^2) - 0.00000587.*(sin(abs(2*lat)).^2) - (31.55e-8)*alt)); % gravitational acceleration, m/s2 const AED_REAL Pi = PI; const AED_REAL two_Pi = (2.*PI); const AED_REAL halfPi = (PI/2.); const AED_REAL Stefan_Boltzman = 5.67E-8; //# Stefan-Boltzman constant const AED_REAL Kelvin = 273.15; // Used for Celsius to Kelvin conversion // Water const AED_REAL rho0 = 1.0e3; //* Density of water standard to convert specific density to density in kg/m3 const AED_REAL Visc = 0.00000114; const AED_REAL Latent_Heat_Evap= 2.453E+6; // Latent heat of evaporation J/kg // 2.501e6-2370*Ts const AED_REAL SPHEAT = 4185.5; // Specific heat of water J/(kg·K) (15 °C, 101.325 kPa) // Air /****************************************************************************** * -- Ratio of the molecular (or molar) weight of water to dry air [-]: * * mwrw2a = 18.016 / 28.966; // = 0.62197 * * -- The universal gas constant [J mol^-1 K^-1] = 8.31436; * * -- Gas constant for dry air in terms of mass of gas rather than moles * * -- [J kg^-1 K^-1]: * * c_gas = 1.0E3 * 8.31436 / 28.966; * ******************************************************************************/ const AED_REAL mwrw2a = 18.016 / 28.966; const AED_REAL c_gas = 1.0E3 * 8.31436 / 28.966; const AED_REAL cp_air = 1005.0; // Specific heat of air const AED_REAL atm_pressure_sl = 1013.25; //# Atmospheric pressure in hectopascals @ sea level ==101300 Pa //const AED_REAL Rspecific = 287.058; // Gas constant J/kg/K // Factors and conversions (space and time) const AED_REAL AreaFactor = 1.0e6; //* Multiplicative factor to get area to m**2 const AED_REAL MLday2m3sec = 1.0e3/86400.0; //* Multiplicative factor to get ML/day to m**3/s const AED_REAL ML2m3 = 1.0e3; //* Multiplicative factor to get ML to m**3 const AED_REAL PiDeg = 180.0; const AED_REAL deg2rad = PI/180.; const AED_REAL rad2deg = 180./PI; const AED_REAL SecsPerDay = 86400.0; const int iSecsPerDay = 86400; const AED_REAL SecsPerHr = 3600.0; const int iSecsPerHr = 3600; // Numeric / other const AED_REAL missing = MISVAL; const AED_REAL zero = 0.0;
63.425
176
0.42097
[ "model" ]
b9021505b1e4e3a22b86aac0b0ab0ea0155e0234
2,179
h
C
Dyninst-8.2.1/dyninstAPI/src/BPatch_private.h
Vtech181/Path_Armor
9879a85c7ba56b443aeccde730778dcb6d55a39d
[ "BSD-2-Clause" ]
47
2015-10-14T23:12:32.000Z
2022-03-18T11:23:59.000Z
Dyninst-8.2.1/dyninstAPI/src/BPatch_private.h
Vtech181/Path_Armor
9879a85c7ba56b443aeccde730778dcb6d55a39d
[ "BSD-2-Clause" ]
null
null
null
Dyninst-8.2.1/dyninstAPI/src/BPatch_private.h
Vtech181/Path_Armor
9879a85c7ba56b443aeccde730778dcb6d55a39d
[ "BSD-2-Clause" ]
18
2015-11-04T03:44:22.000Z
2021-10-14T10:17:39.000Z
/* * See the dyninst/COPYRIGHT file for copyright information. * * We provide the Paradyn Tools (below described as "Paradyn") * on an AS IS basis, and do not warrant its validity or performance. * We reserve the right to update, modify, or discontinue this * software at any time. We shall have no obligation to supply such * updates or modifications or any other form of support to you. * * By your use of Paradyn, you understand and agree that we (or any * other person or entity with proprietary rights in Paradyn) are * under no obligation to provide either maintenance services, * update services, notices of latent defects, or correction of * defects for Paradyn. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _BPATCH_PRIVATE_H_ #define _BPATCH_PRIVATE_H_ class BPatch_thread; class BPatchSnippetHandle; class BPatch_point; class BPatch_snippet; #include "BPatch_snippet.h" // TODO: this is bpatch-specific, move to BPatch_private.h? struct batchInsertionRecord { // Thread-specific instru BPatch_thread *thread_; // For delayed insertion; vector because there is a vector-insert technique pdvector<BPatch_point *> points_; // This has to be vectorized to handle the multiple-point insertion + edges. pdvector<callWhen> when_; callOrder order_; BPatch_snippet snip; // Make a copy so that the user doesn't have to. BPatchSnippetHandle *handle_; // handle to fill in bool trampRecursive_; }; #endif
37.568966
80
0.751721
[ "vector" ]
b9067becd8cc0a22d6c731a458602cfa66b5b453
57,673
c
C
specs-code/discord/guild.c
PapauloGamerOfc/orca
0c5b04f9c19c5bc54ca994344b7abec1a2ea418f
[ "MIT" ]
null
null
null
specs-code/discord/guild.c
PapauloGamerOfc/orca
0c5b04f9c19c5bc54ca994344b7abec1a2ea418f
[ "MIT" ]
null
null
null
specs-code/discord/guild.c
PapauloGamerOfc/orca
0c5b04f9c19c5bc54ca994344b7abec1a2ea418f
[ "MIT" ]
null
null
null
/* This file is generated from specs/discord/guild.json, Please don't edit it. */ #include "specs.h" /* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure */ void discord_guild_from_json(char *json, size_t len, struct discord_guild *p) { static size_t ret=0; // used for debugging size_t r=0; r=json_extract(json, len, /* specs/discord/guild.json:11:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"id"}' */ "(id):F," /* specs/discord/guild.json:12:66 '{"type":{"base":"char", "dec":"[MAX_NAME_LEN]"}, "name":"name"}' */ "(name):s," /* specs/discord/guild.json:13:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon"}' */ "(icon):?s," /* specs/discord/guild.json:14:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon_hash"}' */ "(icon_hash):?s," /* specs/discord/guild.json:15:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"splash"}' */ "(splash):?s," /* specs/discord/guild.json:16:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"discovery_splash"}' */ "(discovery_splash):?s," /* specs/discord/guild.json:17:42 '{"type":{"base":"bool"}, "name":"owner", "option":true}' */ "(owner):b," /* specs/discord/guild.json:18:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"owner_id"}' */ "(owner_id):F," /* specs/discord/guild.json:19:41 '{"type":{"base":"int"}, "name":"permissions", "option":true}' */ "(permissions):d," /* specs/discord/guild.json:20:68 '{"type":{"base":"char", "dec":"[MAX_REGION_LEN]"}, "name":"region"}' */ "(region):s," /* specs/discord/guild.json:21:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"afk_channel_id"}' */ "(afk_channel_id):F," /* specs/discord/guild.json:22:41 '{"type":{"base":"int"}, "name":"afk_timeout"}' */ "(afk_timeout):d," /* specs/discord/guild.json:23:42 '{"type":{"base":"bool"}, "name":"widget_enabled", "option":true}' */ "(widget_enabled):b," /* specs/discord/guild.json:24:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"widget_channel_id", "option":true}' */ "(widget_channel_id):F," /* specs/discord/guild.json:25:94 '{"type":{"base":"int", "int_alias":"enum discord_guild_verification_level"}, "name":"verification_level"}' */ "(verification_level):d," /* specs/discord/guild.json:27:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_default_message_notification_level"}, "name":"default_message_notifications"}' */ "(default_message_notifications):d," /* specs/discord/guild.json:29:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_explicit_content_filter_level"}, "name":"explicit_content_filter"}' */ "(explicit_content_filter):d," /* specs/discord/guild.json:30:76 '{"type":{"base":"struct discord_guild_role", "dec":"ntl"}, "name":"roles", "todo":true, "comment":"array of role objects"}' */ /* specs/discord/guild.json:32:71 '{"type":{"base":"struct discord_emoji", "dec":"ntl"}, "name":"emojis"}' */ "(emojis):F," /* specs/discord/guild.json:33:57 '{"type":{"base":"ja_str", "dec":"ntl"}, "name":"features", "todo":true", "comment":"array of guild feature strings"}' */ /* specs/discord/guild.json:35:85 '{"type":{"base":"int", "int_alias":"enum discord_guild_mfa_level"}, "name":"mfa_level"}' */ "(mfa_level):d," /* specs/discord/guild.json:36:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"application_id"}' */ "(application_id):F," /* specs/discord/guild.json:37:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"system_channel_id"}' */ "(system_channel_id):F," /* specs/discord/guild.json:38:96 '{"type":{"base":"int", "int_alias":"enum discord_guild_system_channel_flags"}, "name":"system_channel_flags"}' */ "(system_channel_flags):d," /* specs/discord/guild.json:39:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"rules_channel_id"}' */ "(rules_channel_id):F," /* specs/discord/guild.json:40:76 '{"type":{"base":"char", "dec":"*", "converter":"iso8601"}, "name":"joined_at", "option":true}' */ "(joined_at):F," /* specs/discord/guild.json:41:42 '{"type":{"base":"bool"}, "name":"large", "option":true}' */ "(large):b," /* specs/discord/guild.json:42:42 '{"type":{"base":"bool"}, "name":"unavailable", "option":true}' */ "(unavailable):b," /* specs/discord/guild.json:43:41 '{"type":{"base":"int"}, "name":"member_count", "option":true}' */ "(member_count):d," /* specs/discord/guild.json:44:71 '{"type":{"base":"struct discord_voice", "dec":"ntl"}, "name":"voice_states", "todo":true", "comment":"array of partial voice state objects"}' */ /* specs/discord/guild.json:46:78 '{"type":{"base":"struct discord_guild_member", "dec":"ntl"}, "name":"members", "option":true}' */ "(members):F," /* specs/discord/guild.json:47:73 '{"type":{"base":"struct discord_channel", "dec":"ntl"}, "name":"channels", "option":true, "comment":"array of channel objects"}' */ "(channels):F," /* specs/discord/guild.json:49:41 '{"type":{"base":"int"}, "name":"presences", "todo":true, "option":true, "comment":"array of partial presence update objects"}' */ /* specs/discord/guild.json:51:41 '{"type":{"base":"int"}, "name":"max_presences", "option":true}' */ "(max_presences):d," /* specs/discord/guild.json:52:41 '{"type":{"base":"int"}, "name":"max_members", "option":true}' */ "(max_members):d," /* specs/discord/guild.json:53:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"vanity_url"}' */ "(vanity_url):?s," /* specs/discord/guild.json:54:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"description"}' */ "(description):?s," /* specs/discord/guild.json:55:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"banner"}' */ "(banner):?s," /* specs/discord/guild.json:56:88 '{"type":{"base":"int", "int_alias":"enum discord_guild_premium_tier"}, "name":"premium_tier"}' */ "(premium_tier):d," /* specs/discord/guild.json:57:41 '{"type":{"base":"int"}, "name":"premium_subscription_count", "option":true}' */ "(premium_subscription_count):d," /* specs/discord/guild.json:58:68 '{"type":{"base":"char", "dec":"[MAX_LOCALE_LEN]"}, "name":"preferred_locale"}' */ "(preferred_locale):s," /* specs/discord/guild.json:60:27 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"public_updates_channel_id"}' */ "(public_updates_channel_id):F," /* specs/discord/guild.json:61:41 '{"type":{"base":"int"}, "name":"max_video_channel_users", "option":true}' */ "(max_video_channel_users):d," /* specs/discord/guild.json:62:41 '{"type":{"base":"int"}, "name":"approximate_member_count", "option":true}' */ "(approximate_member_count):d," /* specs/discord/guild.json:63:41 '{"type":{"base":"int"}, "name":"approximate_presence_count", "option":true}' */ "(approximate_presence_count):d," /* specs/discord/guild.json:64:84 '{"type":{"base":"struct discord_guild_welcome_screen", "dec":"*"}, "name":"welcome_screen", "option":true}' */ "(welcome_screen):F," "@arg_switches:b" "@record_defined" "@record_null", /* specs/discord/guild.json:11:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"id"}' */ orka_strtoull, &p->id, /* specs/discord/guild.json:12:66 '{"type":{"base":"char", "dec":"[MAX_NAME_LEN]"}, "name":"name"}' */ p->name, /* specs/discord/guild.json:13:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon"}' */ &p->icon, /* specs/discord/guild.json:14:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon_hash"}' */ &p->icon_hash, /* specs/discord/guild.json:15:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"splash"}' */ &p->splash, /* specs/discord/guild.json:16:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"discovery_splash"}' */ &p->discovery_splash, /* specs/discord/guild.json:17:42 '{"type":{"base":"bool"}, "name":"owner", "option":true}' */ &p->owner, /* specs/discord/guild.json:18:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"owner_id"}' */ orka_strtoull, &p->owner_id, /* specs/discord/guild.json:19:41 '{"type":{"base":"int"}, "name":"permissions", "option":true}' */ &p->permissions, /* specs/discord/guild.json:20:68 '{"type":{"base":"char", "dec":"[MAX_REGION_LEN]"}, "name":"region"}' */ p->region, /* specs/discord/guild.json:21:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"afk_channel_id"}' */ orka_strtoull, &p->afk_channel_id, /* specs/discord/guild.json:22:41 '{"type":{"base":"int"}, "name":"afk_timeout"}' */ &p->afk_timeout, /* specs/discord/guild.json:23:42 '{"type":{"base":"bool"}, "name":"widget_enabled", "option":true}' */ &p->widget_enabled, /* specs/discord/guild.json:24:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"widget_channel_id", "option":true}' */ orka_strtoull, &p->widget_channel_id, /* specs/discord/guild.json:25:94 '{"type":{"base":"int", "int_alias":"enum discord_guild_verification_level"}, "name":"verification_level"}' */ &p->verification_level, /* specs/discord/guild.json:27:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_default_message_notification_level"}, "name":"default_message_notifications"}' */ &p->default_message_notifications, /* specs/discord/guild.json:29:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_explicit_content_filter_level"}, "name":"explicit_content_filter"}' */ &p->explicit_content_filter, /* specs/discord/guild.json:30:76 '{"type":{"base":"struct discord_guild_role", "dec":"ntl"}, "name":"roles", "todo":true, "comment":"array of role objects"}' */ /* specs/discord/guild.json:32:71 '{"type":{"base":"struct discord_emoji", "dec":"ntl"}, "name":"emojis"}' */ discord_emoji_list_from_json, &p->emojis, /* specs/discord/guild.json:33:57 '{"type":{"base":"ja_str", "dec":"ntl"}, "name":"features", "todo":true", "comment":"array of guild feature strings"}' */ /* specs/discord/guild.json:35:85 '{"type":{"base":"int", "int_alias":"enum discord_guild_mfa_level"}, "name":"mfa_level"}' */ &p->mfa_level, /* specs/discord/guild.json:36:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"application_id"}' */ orka_strtoull, &p->application_id, /* specs/discord/guild.json:37:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"system_channel_id"}' */ orka_strtoull, &p->system_channel_id, /* specs/discord/guild.json:38:96 '{"type":{"base":"int", "int_alias":"enum discord_guild_system_channel_flags"}, "name":"system_channel_flags"}' */ &p->system_channel_flags, /* specs/discord/guild.json:39:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"rules_channel_id"}' */ orka_strtoull, &p->rules_channel_id, /* specs/discord/guild.json:40:76 '{"type":{"base":"char", "dec":"*", "converter":"iso8601"}, "name":"joined_at", "option":true}' */ orka_iso8601_to_unix_ms, &p->joined_at, /* specs/discord/guild.json:41:42 '{"type":{"base":"bool"}, "name":"large", "option":true}' */ &p->large, /* specs/discord/guild.json:42:42 '{"type":{"base":"bool"}, "name":"unavailable", "option":true}' */ &p->unavailable, /* specs/discord/guild.json:43:41 '{"type":{"base":"int"}, "name":"member_count", "option":true}' */ &p->member_count, /* specs/discord/guild.json:44:71 '{"type":{"base":"struct discord_voice", "dec":"ntl"}, "name":"voice_states", "todo":true", "comment":"array of partial voice state objects"}' */ /* specs/discord/guild.json:46:78 '{"type":{"base":"struct discord_guild_member", "dec":"ntl"}, "name":"members", "option":true}' */ discord_guild_member_list_from_json, &p->members, /* specs/discord/guild.json:47:73 '{"type":{"base":"struct discord_channel", "dec":"ntl"}, "name":"channels", "option":true, "comment":"array of channel objects"}' */ discord_channel_list_from_json, &p->channels, /* specs/discord/guild.json:49:41 '{"type":{"base":"int"}, "name":"presences", "todo":true, "option":true, "comment":"array of partial presence update objects"}' */ /* specs/discord/guild.json:51:41 '{"type":{"base":"int"}, "name":"max_presences", "option":true}' */ &p->max_presences, /* specs/discord/guild.json:52:41 '{"type":{"base":"int"}, "name":"max_members", "option":true}' */ &p->max_members, /* specs/discord/guild.json:53:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"vanity_url"}' */ &p->vanity_url, /* specs/discord/guild.json:54:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"description"}' */ &p->description, /* specs/discord/guild.json:55:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"banner"}' */ &p->banner, /* specs/discord/guild.json:56:88 '{"type":{"base":"int", "int_alias":"enum discord_guild_premium_tier"}, "name":"premium_tier"}' */ &p->premium_tier, /* specs/discord/guild.json:57:41 '{"type":{"base":"int"}, "name":"premium_subscription_count", "option":true}' */ &p->premium_subscription_count, /* specs/discord/guild.json:58:68 '{"type":{"base":"char", "dec":"[MAX_LOCALE_LEN]"}, "name":"preferred_locale"}' */ p->preferred_locale, /* specs/discord/guild.json:60:27 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"public_updates_channel_id"}' */ orka_strtoull, &p->public_updates_channel_id, /* specs/discord/guild.json:61:41 '{"type":{"base":"int"}, "name":"max_video_channel_users", "option":true}' */ &p->max_video_channel_users, /* specs/discord/guild.json:62:41 '{"type":{"base":"int"}, "name":"approximate_member_count", "option":true}' */ &p->approximate_member_count, /* specs/discord/guild.json:63:41 '{"type":{"base":"int"}, "name":"approximate_presence_count", "option":true}' */ &p->approximate_presence_count, /* specs/discord/guild.json:64:84 '{"type":{"base":"struct discord_guild_welcome_screen", "dec":"*"}, "name":"welcome_screen", "option":true}' */ discord_guild_welcome_screen_from_json, p->welcome_screen, p->__M.arg_switches, sizeof(p->__M.arg_switches), p->__M.enable_arg_switches, p->__M.record_defined, sizeof(p->__M.record_defined), p->__M.record_null, sizeof(p->__M.record_null)); ret = r; } static void discord_guild_use_default_inject_settings(struct discord_guild *p) { p->__M.enable_arg_switches = true; /* specs/discord/guild.json:11:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"id"}' */ p->__M.arg_switches[0] = &p->id; /* specs/discord/guild.json:12:66 '{"type":{"base":"char", "dec":"[MAX_NAME_LEN]"}, "name":"name"}' */ p->__M.arg_switches[1] = p->name; /* specs/discord/guild.json:13:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon"}' */ p->__M.arg_switches[2] = p->icon; /* specs/discord/guild.json:14:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon_hash"}' */ p->__M.arg_switches[3] = p->icon_hash; /* specs/discord/guild.json:15:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"splash"}' */ p->__M.arg_switches[4] = p->splash; /* specs/discord/guild.json:16:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"discovery_splash"}' */ p->__M.arg_switches[5] = p->discovery_splash; /* specs/discord/guild.json:17:42 '{"type":{"base":"bool"}, "name":"owner", "option":true}' */ p->__M.arg_switches[6] = &p->owner; /* specs/discord/guild.json:18:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"owner_id"}' */ p->__M.arg_switches[7] = &p->owner_id; /* specs/discord/guild.json:19:41 '{"type":{"base":"int"}, "name":"permissions", "option":true}' */ p->__M.arg_switches[8] = &p->permissions; /* specs/discord/guild.json:20:68 '{"type":{"base":"char", "dec":"[MAX_REGION_LEN]"}, "name":"region"}' */ p->__M.arg_switches[9] = p->region; /* specs/discord/guild.json:21:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"afk_channel_id"}' */ p->__M.arg_switches[10] = &p->afk_channel_id; /* specs/discord/guild.json:22:41 '{"type":{"base":"int"}, "name":"afk_timeout"}' */ p->__M.arg_switches[11] = &p->afk_timeout; /* specs/discord/guild.json:23:42 '{"type":{"base":"bool"}, "name":"widget_enabled", "option":true}' */ p->__M.arg_switches[12] = &p->widget_enabled; /* specs/discord/guild.json:24:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"widget_channel_id", "option":true}' */ p->__M.arg_switches[13] = &p->widget_channel_id; /* specs/discord/guild.json:25:94 '{"type":{"base":"int", "int_alias":"enum discord_guild_verification_level"}, "name":"verification_level"}' */ p->__M.arg_switches[14] = &p->verification_level; /* specs/discord/guild.json:27:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_default_message_notification_level"}, "name":"default_message_notifications"}' */ p->__M.arg_switches[15] = &p->default_message_notifications; /* specs/discord/guild.json:29:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_explicit_content_filter_level"}, "name":"explicit_content_filter"}' */ p->__M.arg_switches[16] = &p->explicit_content_filter; /* specs/discord/guild.json:30:76 '{"type":{"base":"struct discord_guild_role", "dec":"ntl"}, "name":"roles", "todo":true, "comment":"array of role objects"}' */ /* specs/discord/guild.json:32:71 '{"type":{"base":"struct discord_emoji", "dec":"ntl"}, "name":"emojis"}' */ p->__M.arg_switches[18] = p->emojis; /* specs/discord/guild.json:33:57 '{"type":{"base":"ja_str", "dec":"ntl"}, "name":"features", "todo":true", "comment":"array of guild feature strings"}' */ /* specs/discord/guild.json:35:85 '{"type":{"base":"int", "int_alias":"enum discord_guild_mfa_level"}, "name":"mfa_level"}' */ p->__M.arg_switches[20] = &p->mfa_level; /* specs/discord/guild.json:36:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"application_id"}' */ p->__M.arg_switches[21] = &p->application_id; /* specs/discord/guild.json:37:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"system_channel_id"}' */ p->__M.arg_switches[22] = &p->system_channel_id; /* specs/discord/guild.json:38:96 '{"type":{"base":"int", "int_alias":"enum discord_guild_system_channel_flags"}, "name":"system_channel_flags"}' */ p->__M.arg_switches[23] = &p->system_channel_flags; /* specs/discord/guild.json:39:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"rules_channel_id"}' */ p->__M.arg_switches[24] = &p->rules_channel_id; /* specs/discord/guild.json:40:76 '{"type":{"base":"char", "dec":"*", "converter":"iso8601"}, "name":"joined_at", "option":true}' */ p->__M.arg_switches[25] = &p->joined_at; /* specs/discord/guild.json:41:42 '{"type":{"base":"bool"}, "name":"large", "option":true}' */ p->__M.arg_switches[26] = &p->large; /* specs/discord/guild.json:42:42 '{"type":{"base":"bool"}, "name":"unavailable", "option":true}' */ p->__M.arg_switches[27] = &p->unavailable; /* specs/discord/guild.json:43:41 '{"type":{"base":"int"}, "name":"member_count", "option":true}' */ p->__M.arg_switches[28] = &p->member_count; /* specs/discord/guild.json:44:71 '{"type":{"base":"struct discord_voice", "dec":"ntl"}, "name":"voice_states", "todo":true", "comment":"array of partial voice state objects"}' */ /* specs/discord/guild.json:46:78 '{"type":{"base":"struct discord_guild_member", "dec":"ntl"}, "name":"members", "option":true}' */ p->__M.arg_switches[30] = p->members; /* specs/discord/guild.json:47:73 '{"type":{"base":"struct discord_channel", "dec":"ntl"}, "name":"channels", "option":true, "comment":"array of channel objects"}' */ p->__M.arg_switches[31] = p->channels; /* specs/discord/guild.json:49:41 '{"type":{"base":"int"}, "name":"presences", "todo":true, "option":true, "comment":"array of partial presence update objects"}' */ /* specs/discord/guild.json:51:41 '{"type":{"base":"int"}, "name":"max_presences", "option":true}' */ p->__M.arg_switches[33] = &p->max_presences; /* specs/discord/guild.json:52:41 '{"type":{"base":"int"}, "name":"max_members", "option":true}' */ p->__M.arg_switches[34] = &p->max_members; /* specs/discord/guild.json:53:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"vanity_url"}' */ p->__M.arg_switches[35] = p->vanity_url; /* specs/discord/guild.json:54:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"description"}' */ p->__M.arg_switches[36] = p->description; /* specs/discord/guild.json:55:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"banner"}' */ p->__M.arg_switches[37] = p->banner; /* specs/discord/guild.json:56:88 '{"type":{"base":"int", "int_alias":"enum discord_guild_premium_tier"}, "name":"premium_tier"}' */ p->__M.arg_switches[38] = &p->premium_tier; /* specs/discord/guild.json:57:41 '{"type":{"base":"int"}, "name":"premium_subscription_count", "option":true}' */ p->__M.arg_switches[39] = &p->premium_subscription_count; /* specs/discord/guild.json:58:68 '{"type":{"base":"char", "dec":"[MAX_LOCALE_LEN]"}, "name":"preferred_locale"}' */ p->__M.arg_switches[40] = p->preferred_locale; /* specs/discord/guild.json:60:27 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"public_updates_channel_id"}' */ p->__M.arg_switches[41] = &p->public_updates_channel_id; /* specs/discord/guild.json:61:41 '{"type":{"base":"int"}, "name":"max_video_channel_users", "option":true}' */ p->__M.arg_switches[42] = &p->max_video_channel_users; /* specs/discord/guild.json:62:41 '{"type":{"base":"int"}, "name":"approximate_member_count", "option":true}' */ p->__M.arg_switches[43] = &p->approximate_member_count; /* specs/discord/guild.json:63:41 '{"type":{"base":"int"}, "name":"approximate_presence_count", "option":true}' */ p->__M.arg_switches[44] = &p->approximate_presence_count; /* specs/discord/guild.json:64:84 '{"type":{"base":"struct discord_guild_welcome_screen", "dec":"*"}, "name":"welcome_screen", "option":true}' */ p->__M.arg_switches[45] = p->welcome_screen; } size_t discord_guild_to_json(char *json, size_t len, struct discord_guild *p) { size_t r; discord_guild_use_default_inject_settings(p); r=json_inject(json, len, /* specs/discord/guild.json:11:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"id"}' */ "(id):|F|," /* specs/discord/guild.json:12:66 '{"type":{"base":"char", "dec":"[MAX_NAME_LEN]"}, "name":"name"}' */ "(name):s," /* specs/discord/guild.json:13:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon"}' */ "(icon):s," /* specs/discord/guild.json:14:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon_hash"}' */ "(icon_hash):s," /* specs/discord/guild.json:15:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"splash"}' */ "(splash):s," /* specs/discord/guild.json:16:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"discovery_splash"}' */ "(discovery_splash):s," /* specs/discord/guild.json:17:42 '{"type":{"base":"bool"}, "name":"owner", "option":true}' */ "(owner):b," /* specs/discord/guild.json:18:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"owner_id"}' */ "(owner_id):|F|," /* specs/discord/guild.json:19:41 '{"type":{"base":"int"}, "name":"permissions", "option":true}' */ "(permissions):d," /* specs/discord/guild.json:20:68 '{"type":{"base":"char", "dec":"[MAX_REGION_LEN]"}, "name":"region"}' */ "(region):s," /* specs/discord/guild.json:21:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"afk_channel_id"}' */ "(afk_channel_id):|F|," /* specs/discord/guild.json:22:41 '{"type":{"base":"int"}, "name":"afk_timeout"}' */ "(afk_timeout):d," /* specs/discord/guild.json:23:42 '{"type":{"base":"bool"}, "name":"widget_enabled", "option":true}' */ "(widget_enabled):b," /* specs/discord/guild.json:24:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"widget_channel_id", "option":true}' */ "(widget_channel_id):|F|," /* specs/discord/guild.json:25:94 '{"type":{"base":"int", "int_alias":"enum discord_guild_verification_level"}, "name":"verification_level"}' */ "(verification_level):d," /* specs/discord/guild.json:27:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_default_message_notification_level"}, "name":"default_message_notifications"}' */ "(default_message_notifications):d," /* specs/discord/guild.json:29:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_explicit_content_filter_level"}, "name":"explicit_content_filter"}' */ "(explicit_content_filter):d," /* specs/discord/guild.json:30:76 '{"type":{"base":"struct discord_guild_role", "dec":"ntl"}, "name":"roles", "todo":true, "comment":"array of role objects"}' */ /* specs/discord/guild.json:32:71 '{"type":{"base":"struct discord_emoji", "dec":"ntl"}, "name":"emojis"}' */ "(emojis):F," /* specs/discord/guild.json:33:57 '{"type":{"base":"ja_str", "dec":"ntl"}, "name":"features", "todo":true", "comment":"array of guild feature strings"}' */ /* specs/discord/guild.json:35:85 '{"type":{"base":"int", "int_alias":"enum discord_guild_mfa_level"}, "name":"mfa_level"}' */ "(mfa_level):d," /* specs/discord/guild.json:36:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"application_id"}' */ "(application_id):|F|," /* specs/discord/guild.json:37:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"system_channel_id"}' */ "(system_channel_id):|F|," /* specs/discord/guild.json:38:96 '{"type":{"base":"int", "int_alias":"enum discord_guild_system_channel_flags"}, "name":"system_channel_flags"}' */ "(system_channel_flags):d," /* specs/discord/guild.json:39:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"rules_channel_id"}' */ "(rules_channel_id):|F|," /* specs/discord/guild.json:40:76 '{"type":{"base":"char", "dec":"*", "converter":"iso8601"}, "name":"joined_at", "option":true}' */ "(joined_at):|F|," /* specs/discord/guild.json:41:42 '{"type":{"base":"bool"}, "name":"large", "option":true}' */ "(large):b," /* specs/discord/guild.json:42:42 '{"type":{"base":"bool"}, "name":"unavailable", "option":true}' */ "(unavailable):b," /* specs/discord/guild.json:43:41 '{"type":{"base":"int"}, "name":"member_count", "option":true}' */ "(member_count):d," /* specs/discord/guild.json:44:71 '{"type":{"base":"struct discord_voice", "dec":"ntl"}, "name":"voice_states", "todo":true", "comment":"array of partial voice state objects"}' */ /* specs/discord/guild.json:46:78 '{"type":{"base":"struct discord_guild_member", "dec":"ntl"}, "name":"members", "option":true}' */ "(members):F," /* specs/discord/guild.json:47:73 '{"type":{"base":"struct discord_channel", "dec":"ntl"}, "name":"channels", "option":true, "comment":"array of channel objects"}' */ "(channels):F," /* specs/discord/guild.json:49:41 '{"type":{"base":"int"}, "name":"presences", "todo":true, "option":true, "comment":"array of partial presence update objects"}' */ /* specs/discord/guild.json:51:41 '{"type":{"base":"int"}, "name":"max_presences", "option":true}' */ "(max_presences):d," /* specs/discord/guild.json:52:41 '{"type":{"base":"int"}, "name":"max_members", "option":true}' */ "(max_members):d," /* specs/discord/guild.json:53:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"vanity_url"}' */ "(vanity_url):s," /* specs/discord/guild.json:54:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"description"}' */ "(description):s," /* specs/discord/guild.json:55:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"banner"}' */ "(banner):s," /* specs/discord/guild.json:56:88 '{"type":{"base":"int", "int_alias":"enum discord_guild_premium_tier"}, "name":"premium_tier"}' */ "(premium_tier):d," /* specs/discord/guild.json:57:41 '{"type":{"base":"int"}, "name":"premium_subscription_count", "option":true}' */ "(premium_subscription_count):d," /* specs/discord/guild.json:58:68 '{"type":{"base":"char", "dec":"[MAX_LOCALE_LEN]"}, "name":"preferred_locale"}' */ "(preferred_locale):s," /* specs/discord/guild.json:60:27 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"public_updates_channel_id"}' */ "(public_updates_channel_id):|F|," /* specs/discord/guild.json:61:41 '{"type":{"base":"int"}, "name":"max_video_channel_users", "option":true}' */ "(max_video_channel_users):d," /* specs/discord/guild.json:62:41 '{"type":{"base":"int"}, "name":"approximate_member_count", "option":true}' */ "(approximate_member_count):d," /* specs/discord/guild.json:63:41 '{"type":{"base":"int"}, "name":"approximate_presence_count", "option":true}' */ "(approximate_presence_count):d," /* specs/discord/guild.json:64:84 '{"type":{"base":"struct discord_guild_welcome_screen", "dec":"*"}, "name":"welcome_screen", "option":true}' */ "(welcome_screen):F," "@arg_switches:b", /* specs/discord/guild.json:11:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"id"}' */ orka_ulltostr, &p->id, /* specs/discord/guild.json:12:66 '{"type":{"base":"char", "dec":"[MAX_NAME_LEN]"}, "name":"name"}' */ p->name, /* specs/discord/guild.json:13:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon"}' */ p->icon, /* specs/discord/guild.json:14:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon_hash"}' */ p->icon_hash, /* specs/discord/guild.json:15:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"splash"}' */ p->splash, /* specs/discord/guild.json:16:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"discovery_splash"}' */ p->discovery_splash, /* specs/discord/guild.json:17:42 '{"type":{"base":"bool"}, "name":"owner", "option":true}' */ &p->owner, /* specs/discord/guild.json:18:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"owner_id"}' */ orka_ulltostr, &p->owner_id, /* specs/discord/guild.json:19:41 '{"type":{"base":"int"}, "name":"permissions", "option":true}' */ &p->permissions, /* specs/discord/guild.json:20:68 '{"type":{"base":"char", "dec":"[MAX_REGION_LEN]"}, "name":"region"}' */ p->region, /* specs/discord/guild.json:21:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"afk_channel_id"}' */ orka_ulltostr, &p->afk_channel_id, /* specs/discord/guild.json:22:41 '{"type":{"base":"int"}, "name":"afk_timeout"}' */ &p->afk_timeout, /* specs/discord/guild.json:23:42 '{"type":{"base":"bool"}, "name":"widget_enabled", "option":true}' */ &p->widget_enabled, /* specs/discord/guild.json:24:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"widget_channel_id", "option":true}' */ orka_ulltostr, &p->widget_channel_id, /* specs/discord/guild.json:25:94 '{"type":{"base":"int", "int_alias":"enum discord_guild_verification_level"}, "name":"verification_level"}' */ &p->verification_level, /* specs/discord/guild.json:27:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_default_message_notification_level"}, "name":"default_message_notifications"}' */ &p->default_message_notifications, /* specs/discord/guild.json:29:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_explicit_content_filter_level"}, "name":"explicit_content_filter"}' */ &p->explicit_content_filter, /* specs/discord/guild.json:30:76 '{"type":{"base":"struct discord_guild_role", "dec":"ntl"}, "name":"roles", "todo":true, "comment":"array of role objects"}' */ /* specs/discord/guild.json:32:71 '{"type":{"base":"struct discord_emoji", "dec":"ntl"}, "name":"emojis"}' */ discord_emoji_list_to_json, p->emojis, /* specs/discord/guild.json:33:57 '{"type":{"base":"ja_str", "dec":"ntl"}, "name":"features", "todo":true", "comment":"array of guild feature strings"}' */ /* specs/discord/guild.json:35:85 '{"type":{"base":"int", "int_alias":"enum discord_guild_mfa_level"}, "name":"mfa_level"}' */ &p->mfa_level, /* specs/discord/guild.json:36:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"application_id"}' */ orka_ulltostr, &p->application_id, /* specs/discord/guild.json:37:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"system_channel_id"}' */ orka_ulltostr, &p->system_channel_id, /* specs/discord/guild.json:38:96 '{"type":{"base":"int", "int_alias":"enum discord_guild_system_channel_flags"}, "name":"system_channel_flags"}' */ &p->system_channel_flags, /* specs/discord/guild.json:39:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"rules_channel_id"}' */ orka_ulltostr, &p->rules_channel_id, /* specs/discord/guild.json:40:76 '{"type":{"base":"char", "dec":"*", "converter":"iso8601"}, "name":"joined_at", "option":true}' */ orka_unix_ms_to_iso8601, &p->joined_at, /* specs/discord/guild.json:41:42 '{"type":{"base":"bool"}, "name":"large", "option":true}' */ &p->large, /* specs/discord/guild.json:42:42 '{"type":{"base":"bool"}, "name":"unavailable", "option":true}' */ &p->unavailable, /* specs/discord/guild.json:43:41 '{"type":{"base":"int"}, "name":"member_count", "option":true}' */ &p->member_count, /* specs/discord/guild.json:44:71 '{"type":{"base":"struct discord_voice", "dec":"ntl"}, "name":"voice_states", "todo":true", "comment":"array of partial voice state objects"}' */ /* specs/discord/guild.json:46:78 '{"type":{"base":"struct discord_guild_member", "dec":"ntl"}, "name":"members", "option":true}' */ discord_guild_member_list_to_json, p->members, /* specs/discord/guild.json:47:73 '{"type":{"base":"struct discord_channel", "dec":"ntl"}, "name":"channels", "option":true, "comment":"array of channel objects"}' */ discord_channel_list_to_json, p->channels, /* specs/discord/guild.json:49:41 '{"type":{"base":"int"}, "name":"presences", "todo":true, "option":true, "comment":"array of partial presence update objects"}' */ /* specs/discord/guild.json:51:41 '{"type":{"base":"int"}, "name":"max_presences", "option":true}' */ &p->max_presences, /* specs/discord/guild.json:52:41 '{"type":{"base":"int"}, "name":"max_members", "option":true}' */ &p->max_members, /* specs/discord/guild.json:53:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"vanity_url"}' */ p->vanity_url, /* specs/discord/guild.json:54:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"description"}' */ p->description, /* specs/discord/guild.json:55:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"banner"}' */ p->banner, /* specs/discord/guild.json:56:88 '{"type":{"base":"int", "int_alias":"enum discord_guild_premium_tier"}, "name":"premium_tier"}' */ &p->premium_tier, /* specs/discord/guild.json:57:41 '{"type":{"base":"int"}, "name":"premium_subscription_count", "option":true}' */ &p->premium_subscription_count, /* specs/discord/guild.json:58:68 '{"type":{"base":"char", "dec":"[MAX_LOCALE_LEN]"}, "name":"preferred_locale"}' */ p->preferred_locale, /* specs/discord/guild.json:60:27 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"public_updates_channel_id"}' */ orka_ulltostr, &p->public_updates_channel_id, /* specs/discord/guild.json:61:41 '{"type":{"base":"int"}, "name":"max_video_channel_users", "option":true}' */ &p->max_video_channel_users, /* specs/discord/guild.json:62:41 '{"type":{"base":"int"}, "name":"approximate_member_count", "option":true}' */ &p->approximate_member_count, /* specs/discord/guild.json:63:41 '{"type":{"base":"int"}, "name":"approximate_presence_count", "option":true}' */ &p->approximate_presence_count, /* specs/discord/guild.json:64:84 '{"type":{"base":"struct discord_guild_welcome_screen", "dec":"*"}, "name":"welcome_screen", "option":true}' */ discord_guild_welcome_screen_to_json, p->welcome_screen, p->__M.arg_switches, sizeof(p->__M.arg_switches), p->__M.enable_arg_switches); return r; } typedef void (*vfvp)(void *); typedef void (*vfcpsvp)(char *, size_t, void *); typedef size_t (*sfcpsvp)(char *, size_t, void *); void discord_guild_cleanup_v(void *p) { discord_guild_cleanup((struct discord_guild *)p); } void discord_guild_init_v(void *p) { discord_guild_init((struct discord_guild *)p); } void discord_guild_free_v(void *p) { discord_guild_free((struct discord_guild *)p); }; void discord_guild_from_json_v(char *json, size_t len, void *p) { discord_guild_from_json(json, len, (struct discord_guild*)p); } size_t discord_guild_to_json_v(char *json, size_t len, void *p) { return discord_guild_to_json(json, len, (struct discord_guild*)p); } void discord_guild_list_free_v(void **p) { discord_guild_list_free((struct discord_guild**)p); } void discord_guild_list_from_json_v(char *str, size_t len, void *p) { discord_guild_list_from_json(str, len, (struct discord_guild ***)p); } size_t discord_guild_list_to_json_v(char *str, size_t len, void *p){ return discord_guild_list_to_json(str, len, (struct discord_guild **)p); } void discord_guild_cleanup(struct discord_guild *d) { /* specs/discord/guild.json:11:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"id"}' */ //p->id is a scalar /* specs/discord/guild.json:12:66 '{"type":{"base":"char", "dec":"[MAX_NAME_LEN]"}, "name":"name"}' */ //p->name is a scalar /* specs/discord/guild.json:13:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon"}' */ if (d->icon) free(d->icon); /* specs/discord/guild.json:14:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon_hash"}' */ if (d->icon_hash) free(d->icon_hash); /* specs/discord/guild.json:15:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"splash"}' */ if (d->splash) free(d->splash); /* specs/discord/guild.json:16:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"discovery_splash"}' */ if (d->discovery_splash) free(d->discovery_splash); /* specs/discord/guild.json:17:42 '{"type":{"base":"bool"}, "name":"owner", "option":true}' */ //p->owner is a scalar /* specs/discord/guild.json:18:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"owner_id"}' */ //p->owner_id is a scalar /* specs/discord/guild.json:19:41 '{"type":{"base":"int"}, "name":"permissions", "option":true}' */ //p->permissions is a scalar /* specs/discord/guild.json:20:68 '{"type":{"base":"char", "dec":"[MAX_REGION_LEN]"}, "name":"region"}' */ //p->region is a scalar /* specs/discord/guild.json:21:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"afk_channel_id"}' */ //p->afk_channel_id is a scalar /* specs/discord/guild.json:22:41 '{"type":{"base":"int"}, "name":"afk_timeout"}' */ //p->afk_timeout is a scalar /* specs/discord/guild.json:23:42 '{"type":{"base":"bool"}, "name":"widget_enabled", "option":true}' */ //p->widget_enabled is a scalar /* specs/discord/guild.json:24:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"widget_channel_id", "option":true}' */ //p->widget_channel_id is a scalar /* specs/discord/guild.json:25:94 '{"type":{"base":"int", "int_alias":"enum discord_guild_verification_level"}, "name":"verification_level"}' */ //p->verification_level is a scalar /* specs/discord/guild.json:27:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_default_message_notification_level"}, "name":"default_message_notifications"}' */ //p->default_message_notifications is a scalar /* specs/discord/guild.json:29:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_explicit_content_filter_level"}, "name":"explicit_content_filter"}' */ //p->explicit_content_filter is a scalar /* specs/discord/guild.json:30:76 '{"type":{"base":"struct discord_guild_role", "dec":"ntl"}, "name":"roles", "todo":true, "comment":"array of role objects"}' */ //@todo p->(null) /* specs/discord/guild.json:32:71 '{"type":{"base":"struct discord_emoji", "dec":"ntl"}, "name":"emojis"}' */ if (d->emojis) discord_emoji_list_free(d->emojis); /* specs/discord/guild.json:33:57 '{"type":{"base":"ja_str", "dec":"ntl"}, "name":"features", "todo":true", "comment":"array of guild feature strings"}' */ //@todo p->(null) /* specs/discord/guild.json:35:85 '{"type":{"base":"int", "int_alias":"enum discord_guild_mfa_level"}, "name":"mfa_level"}' */ //p->mfa_level is a scalar /* specs/discord/guild.json:36:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"application_id"}' */ //p->application_id is a scalar /* specs/discord/guild.json:37:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"system_channel_id"}' */ //p->system_channel_id is a scalar /* specs/discord/guild.json:38:96 '{"type":{"base":"int", "int_alias":"enum discord_guild_system_channel_flags"}, "name":"system_channel_flags"}' */ //p->system_channel_flags is a scalar /* specs/discord/guild.json:39:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"rules_channel_id"}' */ //p->rules_channel_id is a scalar /* specs/discord/guild.json:40:76 '{"type":{"base":"char", "dec":"*", "converter":"iso8601"}, "name":"joined_at", "option":true}' */ //p->joined_at is a scalar /* specs/discord/guild.json:41:42 '{"type":{"base":"bool"}, "name":"large", "option":true}' */ //p->large is a scalar /* specs/discord/guild.json:42:42 '{"type":{"base":"bool"}, "name":"unavailable", "option":true}' */ //p->unavailable is a scalar /* specs/discord/guild.json:43:41 '{"type":{"base":"int"}, "name":"member_count", "option":true}' */ //p->member_count is a scalar /* specs/discord/guild.json:44:71 '{"type":{"base":"struct discord_voice", "dec":"ntl"}, "name":"voice_states", "todo":true", "comment":"array of partial voice state objects"}' */ //@todo p->(null) /* specs/discord/guild.json:46:78 '{"type":{"base":"struct discord_guild_member", "dec":"ntl"}, "name":"members", "option":true}' */ if (d->members) discord_guild_member_list_free(d->members); /* specs/discord/guild.json:47:73 '{"type":{"base":"struct discord_channel", "dec":"ntl"}, "name":"channels", "option":true, "comment":"array of channel objects"}' */ if (d->channels) discord_channel_list_free(d->channels); /* specs/discord/guild.json:49:41 '{"type":{"base":"int"}, "name":"presences", "todo":true, "option":true, "comment":"array of partial presence update objects"}' */ //@todo p->(null) /* specs/discord/guild.json:51:41 '{"type":{"base":"int"}, "name":"max_presences", "option":true}' */ //p->max_presences is a scalar /* specs/discord/guild.json:52:41 '{"type":{"base":"int"}, "name":"max_members", "option":true}' */ //p->max_members is a scalar /* specs/discord/guild.json:53:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"vanity_url"}' */ if (d->vanity_url) free(d->vanity_url); /* specs/discord/guild.json:54:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"description"}' */ if (d->description) free(d->description); /* specs/discord/guild.json:55:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"banner"}' */ if (d->banner) free(d->banner); /* specs/discord/guild.json:56:88 '{"type":{"base":"int", "int_alias":"enum discord_guild_premium_tier"}, "name":"premium_tier"}' */ //p->premium_tier is a scalar /* specs/discord/guild.json:57:41 '{"type":{"base":"int"}, "name":"premium_subscription_count", "option":true}' */ //p->premium_subscription_count is a scalar /* specs/discord/guild.json:58:68 '{"type":{"base":"char", "dec":"[MAX_LOCALE_LEN]"}, "name":"preferred_locale"}' */ //p->preferred_locale is a scalar /* specs/discord/guild.json:60:27 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"public_updates_channel_id"}' */ //p->public_updates_channel_id is a scalar /* specs/discord/guild.json:61:41 '{"type":{"base":"int"}, "name":"max_video_channel_users", "option":true}' */ //p->max_video_channel_users is a scalar /* specs/discord/guild.json:62:41 '{"type":{"base":"int"}, "name":"approximate_member_count", "option":true}' */ //p->approximate_member_count is a scalar /* specs/discord/guild.json:63:41 '{"type":{"base":"int"}, "name":"approximate_presence_count", "option":true}' */ //p->approximate_presence_count is a scalar /* specs/discord/guild.json:64:84 '{"type":{"base":"struct discord_guild_welcome_screen", "dec":"*"}, "name":"welcome_screen", "option":true}' */ if (d->welcome_screen) discord_guild_welcome_screen_free(d->welcome_screen); } void discord_guild_init(struct discord_guild *p) { memset(p, 0, sizeof(struct discord_guild)); /* specs/discord/guild.json:11:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"id"}' */ /* specs/discord/guild.json:12:66 '{"type":{"base":"char", "dec":"[MAX_NAME_LEN]"}, "name":"name"}' */ /* specs/discord/guild.json:13:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon"}' */ /* specs/discord/guild.json:14:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"icon_hash"}' */ /* specs/discord/guild.json:15:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"splash"}' */ /* specs/discord/guild.json:16:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"discovery_splash"}' */ /* specs/discord/guild.json:17:42 '{"type":{"base":"bool"}, "name":"owner", "option":true}' */ /* specs/discord/guild.json:18:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"owner_id"}' */ /* specs/discord/guild.json:19:41 '{"type":{"base":"int"}, "name":"permissions", "option":true}' */ /* specs/discord/guild.json:20:68 '{"type":{"base":"char", "dec":"[MAX_REGION_LEN]"}, "name":"region"}' */ /* specs/discord/guild.json:21:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"afk_channel_id"}' */ /* specs/discord/guild.json:22:41 '{"type":{"base":"int"}, "name":"afk_timeout"}' */ /* specs/discord/guild.json:23:42 '{"type":{"base":"bool"}, "name":"widget_enabled", "option":true}' */ /* specs/discord/guild.json:24:78 '{"type":{"base":"char", "dec":"*", "converter":"snowflake"}, "name":"widget_channel_id", "option":true}' */ /* specs/discord/guild.json:25:94 '{"type":{"base":"int", "int_alias":"enum discord_guild_verification_level"}, "name":"verification_level"}' */ /* specs/discord/guild.json:27:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_default_message_notification_level"}, "name":"default_message_notifications"}' */ /* specs/discord/guild.json:29:32 '{"type":{"base":"int", "int_alias":"enum discord_guild_explicit_content_filter_level"}, "name":"explicit_content_filter"}' */ /* specs/discord/guild.json:30:76 '{"type":{"base":"struct discord_guild_role", "dec":"ntl"}, "name":"roles", "todo":true, "comment":"array of role objects"}' */ /* specs/discord/guild.json:32:71 '{"type":{"base":"struct discord_emoji", "dec":"ntl"}, "name":"emojis"}' */ /* specs/discord/guild.json:33:57 '{"type":{"base":"ja_str", "dec":"ntl"}, "name":"features", "todo":true", "comment":"array of guild feature strings"}' */ /* specs/discord/guild.json:35:85 '{"type":{"base":"int", "int_alias":"enum discord_guild_mfa_level"}, "name":"mfa_level"}' */ /* specs/discord/guild.json:36:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"application_id"}' */ /* specs/discord/guild.json:37:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"system_channel_id"}' */ /* specs/discord/guild.json:38:96 '{"type":{"base":"int", "int_alias":"enum discord_guild_system_channel_flags"}, "name":"system_channel_flags"}' */ /* specs/discord/guild.json:39:95 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"rules_channel_id"}' */ /* specs/discord/guild.json:40:76 '{"type":{"base":"char", "dec":"*", "converter":"iso8601"}, "name":"joined_at", "option":true}' */ /* specs/discord/guild.json:41:42 '{"type":{"base":"bool"}, "name":"large", "option":true}' */ /* specs/discord/guild.json:42:42 '{"type":{"base":"bool"}, "name":"unavailable", "option":true}' */ /* specs/discord/guild.json:43:41 '{"type":{"base":"int"}, "name":"member_count", "option":true}' */ /* specs/discord/guild.json:44:71 '{"type":{"base":"struct discord_voice", "dec":"ntl"}, "name":"voice_states", "todo":true", "comment":"array of partial voice state objects"}' */ /* specs/discord/guild.json:46:78 '{"type":{"base":"struct discord_guild_member", "dec":"ntl"}, "name":"members", "option":true}' */ /* specs/discord/guild.json:47:73 '{"type":{"base":"struct discord_channel", "dec":"ntl"}, "name":"channels", "option":true, "comment":"array of channel objects"}' */ /* specs/discord/guild.json:49:41 '{"type":{"base":"int"}, "name":"presences", "todo":true, "option":true, "comment":"array of partial presence update objects"}' */ /* specs/discord/guild.json:51:41 '{"type":{"base":"int"}, "name":"max_presences", "option":true}' */ /* specs/discord/guild.json:52:41 '{"type":{"base":"int"}, "name":"max_members", "option":true}' */ /* specs/discord/guild.json:53:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"vanity_url"}' */ /* specs/discord/guild.json:54:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"description"}' */ /* specs/discord/guild.json:55:70 '{"type":{"base":"char", "dec":"*", "nullable":true}, "name":"banner"}' */ /* specs/discord/guild.json:56:88 '{"type":{"base":"int", "int_alias":"enum discord_guild_premium_tier"}, "name":"premium_tier"}' */ /* specs/discord/guild.json:57:41 '{"type":{"base":"int"}, "name":"premium_subscription_count", "option":true}' */ /* specs/discord/guild.json:58:68 '{"type":{"base":"char", "dec":"[MAX_LOCALE_LEN]"}, "name":"preferred_locale"}' */ /* specs/discord/guild.json:60:27 '{"type":{"base":"char", "dec":"*", "converter":"snowflake", "nullable":true}, "name":"public_updates_channel_id"}' */ /* specs/discord/guild.json:61:41 '{"type":{"base":"int"}, "name":"max_video_channel_users", "option":true}' */ /* specs/discord/guild.json:62:41 '{"type":{"base":"int"}, "name":"approximate_member_count", "option":true}' */ /* specs/discord/guild.json:63:41 '{"type":{"base":"int"}, "name":"approximate_presence_count", "option":true}' */ /* specs/discord/guild.json:64:84 '{"type":{"base":"struct discord_guild_welcome_screen", "dec":"*"}, "name":"welcome_screen", "option":true}' */ p->welcome_screen = discord_guild_welcome_screen_alloc(); } struct discord_guild* discord_guild_alloc() { struct discord_guild *p= (struct discord_guild*)malloc(sizeof(struct discord_guild)); discord_guild_init(p); return p; } void discord_guild_free(struct discord_guild *p) { discord_guild_cleanup(p); free(p); } void discord_guild_list_free(struct discord_guild **p) { ntl_free((void**)p, (vfvp)discord_guild_cleanup); } void discord_guild_list_from_json(char *str, size_t len, struct discord_guild ***p) { struct ntl_deserializer d; memset(&d, 0, sizeof(d)); d.elem_size = sizeof(struct discord_guild); d.init_elem = discord_guild_init_v; d.elem_from_buf = discord_guild_from_json_v; d.ntl_recipient_p= (void***)p; extract_ntl_from_json(str, len, &d); } size_t discord_guild_list_to_json(char *str, size_t len, struct discord_guild **p) { return ntl_to_buf(str, len, (void **)p, NULL, discord_guild_to_json_v); }
38.654826
116
0.579318
[ "object" ]
b908f0e383578045ca3b12fa37e52ea2c26f45c3
15,676
c
C
LFSCK_graph_checker/mds.c
DIR-LAB/DIST-LFSCK
bbae957903ab460325281263546aa8cc4b852d3c
[ "MIT" ]
1
2020-05-20T15:57:30.000Z
2020-05-20T15:57:30.000Z
LFSCK_graph_checker/mds.c
DIR-LAB/DIST-LFSCK
bbae957903ab460325281263546aa8cc4b852d3c
[ "MIT" ]
null
null
null
LFSCK_graph_checker/mds.c
DIR-LAB/DIST-LFSCK
bbae957903ab460325281263546aa8cc4b852d3c
[ "MIT" ]
null
null
null
/* libraries for mds inode + attribute reading code*/ #include <math.h> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h>a #include <stdlib.h> #include <unistd.h> #include "ext4_checker.h" #include "xattr_sk.h" #include "/usr/include/linux/swab.h" #include "/usr/include/linux/byteorder/little_endian.h" #include <time.h> /* Neo4j: libraries required foe neo4j client*/ #include <neo4j-client.h> #include <errno.h> #include <time.h> #define FD_DEVICE "mds.vhd" /*mounted file system*/ /*magic.h*/ #define EXT4_SUPER_MAGIC 0xEF53 /*The magic number signifies what kind of filesystem it is.*/ /*super block starts 1024 bytes from the begining of the disk*/ #define BASE_OFFSET 1024 /* locates beginning of the super block (first group) */ #define BLOCK_OFFSET(block) ((block)*block_size) /* to be used to retrieve locations*/ /*xattr.c*/ #define IHDR(inode) \ ((struct ext4_xattr_ibody_header *)((void *)inode + \ EXT4_GOOD_OLD_INODE_SIZE + \ *inode.i_extra_isize)) #define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr) + 1)) #define DIRENT(ed_name) ((struct lustre_mdt_attrs *)((ed_name) + 1)) #define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0) #define EXT4_XATTR_NEXT(entry) \ ((struct ext4_xattr_entry *)((char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len))) #define EXT4_XATTR_LEN(name_len) \ (((name_len) + EXT4_XATTR_ROUND + \ sizeof(struct ext4_xattr_entry)) & \ ~EXT4_XATTR_ROUND) #define EXT4_XATTR_PAD_BITS 2 #define EXT4_XATTR_PAD (1 << EXT4_XATTR_PAD_BITS) #define EXT4_XATTR_ROUND (EXT4_XATTR_PAD - 1) int main(void) { /*accessing the disk*/ int fd; /* open fs device */ if ((fd = open(FD_DEVICE, O_RDONLY)) < 0) { perror(FD_DEVICE); exit(1); /* error while opening the device */ } /* read super-block */ struct ext4_super_block super; /*superblock*/ lseek(fd, BASE_OFFSET, SEEK_SET); read(fd, &super, sizeof(super)); /*check to match ext4 Magic number*/ if (super.s_magic != EXT4_SUPER_MAGIC) { fprintf(stderr, "Not a Ext4 filesystem\n"); exit(1); } //block_size = 2^(10 + super.s_log_block_size) : ext4 documentation static unsigned int block_size = 0; block_size = pow(2, 10 + super.s_log_block_size); /*reading group descriptor*/ struct ext4_group_desc group; /*group descriptor*/ lseek(fd, BLOCK_OFFSET(1), SEEK_SET); read(fd, &group, sizeof(group)); struct ext4_inode cur_inode;/*dong: struct inode is an in-memory data structure; I change it to the on-disk inode structure*/ int inode_table = group.bg_inode_table; /*get inode table location using group descriptor table*/ /*get total number of inodes for this filesystem using info from super block*/ int total_inodes = 0; total_inodes = super.s_inodes_count; /*get size of inode in bytes using info from super block*/ int inode_size = 0; inode_size = super.s_inode_size; /*lma*/ struct lustre_mdt_attrs * lma; /*link*/ struct link_ea_header *leh; struct link_ea_entry *lee; struct lu_fid *pfid; /*lov*/ struct lov_user_md *lum; int l = 0; /*FID in Dirent*/ struct lu_fid * FID; struct ext4_dir_entry_2 *ed; /*scannig code errors*/ int link_junk = 0; int lov_junk=0; /*inode_type*/ int inode_type=0; /*1: directory, 2: file*/ /*Neo4j: initializing neo4j-client*/ neo4j_client_init(); neo4j_connection_t *connection = neo4j_connect("neo4j://neo4j:sk@localhost:7687", NULL, NEO4J_INSECURE); if (connection == NULL) { neo4j_perror(stderr, errno, "Connection failed"); return EXIT_FAILURE; } /*Neo4j: buffer*/ char buffer[10000];/*buffer for neo4j-client*/ neo4j_result_stream_t *results; for (int i = 0; i <= total_inodes; i++) { uint64_t inode_location = BLOCK_OFFSET(inode_table) + i * inode_size; lseek(fd, inode_location, SEEK_SET); read(fd, &cur_inode, inode_size); /*read xattr header*/ struct ext4_xattr_ibody_header *header; header = IHDR(&cur_inode); /*check if the header has right magic number*/ if (header->h_magic == ATTR_MAGIC) { printf("\n\n<-----------------------inode: %d------------------------------>\n", (i+1)); /*pointer to the first xattr entry*/ struct ext4_xattr_entry *first_entry; first_entry = IFIRST(header); /*end of the inode*/ void *end; end = &cur_inode + inode_size; /*"entry" is used to iterate through all the xattr entries*/ struct ext4_xattr_entry *entry = first_entry; while (!IS_LAST_ENTRY(entry)) { /*printing the entry name*/ printf("Entry Name:"); for (int name_itr = 0; name_itr < entry->e_name_len; name_itr++) { printf("%c", entry->e_name[name_itr]); } printf("\t"); /*obtain and print the lov xattr value*/ uint64_t value_location = inode_location + EXT4_GOOD_OLD_INODE_SIZE + cur_inode.i_extra_isize + sizeof(struct ext4_xattr_ibody_header) + entry->e_value_offs; /*print the xattr value in terminal and file1.txt*/ unsigned char value[entry->e_value_size + 1]; memset(value, '\0', sizeof(char) * (entry->e_value_size + 1)); lseek(fd, value_location, SEEK_SET); read(fd, value, entry->e_value_size); /*lma extended attribute*/ /*@comment: after scanning a node, when we read its lma ID, we either create a new node or merge with a placeholder with the same lma ID that already exists*/ /*@comment: If the placeholder node already exists we merge and set node.incomplete=0 node.duplicate=0*/ /*@comment: If the placeholder node is already occupied i.e node.incomplete is already 0, then we append the information to the already existing node and set node.duplicate=1*/ /*@comment: I am facing a challenge : I am using node.incomplete as a condition to further check whether the node is a duplicate or not. But I donot know where to initialize the node.incomplete in the first place.*/ /*@comment: The best place seems like when I am creating the placeholder nodes but it is challenging as seen with further comments.*/ if ((char)entry->e_name[0] == 'l' && (char)entry->e_name[1] == 'm' && (char)entry->e_name[2] == 'a') { lma = (struct lustre_mdt_attrs *) value; printf("LMA FID: [0x%llx:0x%x:0x%x]\n", lma->lma_self_fid.f_seq, lma->lma_self_fid.f_oid, lma->lma_self_fid.f_ver); sprintf(buffer, "merge( n:MDS {lma:'0x%llx:0x%x:0x%x'}) apoc.do.when(n.incomplete=1){set n.inode_number=%d set n.incomplete=0 set n.duplictae=0} apoc.do.when(n.incomplete=0){set n.inode_number2=%d set n.duplicate=1} ", lma->lma_self_fid.f_seq, lma->lma_self_fid.f_oid, lma->lma_self_fid.f_ver, i+1, i+1); } if ((char)entry->e_name[0] == 'l' && (char)entry->e_name[1] == 'i' && (char)entry->e_name[2] == 'n' && (char)entry->e_name[3] == 'k') { leh = (struct link_ea_header *) value; lee = (struct link_ea_entry *)(leh + 1); if (leh->leh_magic == LINK_EA_MAGIC){ printf("Matched LinkEA\n"); struct lu_fid *f = (struct lu_fid *) lee->lee_parent_fid; printf("name of the file: %s\t", lee->lee_name); pfid = (struct lu_fid *)lee->lee_parent_fid; fid_be_to_cpu(pfid, lee->lee_parent_fid); printf("parent FID: [0x%llx:0x%x:0x%x]\n", pfid->f_seq, pfid->f_oid, pfid->f_ver); /*@comment: A placeholder node is created for the parent.*/ /*@comment: challenge is If this parent node already exists then its parent.incomplete will already be set to 0 and it should remain=0.*/ /*@comment: if the parent node was not already existsing, then create a new node and set parent.incomplete=1.*/ /*@comment: The problem is how to use "a node already exists or not" as condition to perform distinct task?.*/ sprintf(buffer + strlen(buffer),"apoc.do.when(n.duplicate=0) {set n.link='0x%llx:0x%x:0x%x' merge(p:MDS{lma:n.link}) merge(n)-[:link]->(p) merge (p)-[:link_reverse]->(n)) apoc.do.when(n.duplicate=1) {set n.link2='0x%llx:0x%x:0x%x' merge(p:MDS{lma:n.link2}) merge(n)-[:link2]->(p) merge (p)-[:link_reverse2]->(n))",pfid->f_seq, pfid->f_oid, pfid->f_ver,pfid->f_seq, pfid->f_oid, pfid->f_ver); } else{ link_junk=1; sprintf(buffer + strlen(buffer),"set n.link='link_junk' "); printf("no match on LINKEA magic\n"); } } /*identify if it is lov xattr: check if the entry name is "lov"*/ if ((char)entry->e_name[0] == 'l' && (char)entry->e_name[1] == 'o' && (char)entry->e_name[2] == 'v') { // /*Neo4j: mark that this mds node has a lov attribute*/ if (S_ISREG(cur_inode.i_mode) != 0) /*to read lov xattr for files only*/ { lum = (struct lov_user_md *) value; int ent_count = 0; if (lum->lmm_magic == LOV_MAGIC_COMP_V1) /*multple entries*/ { //printf("%x",lum.lmm_magic); //comp_v1 = (struct lov_comp_md_v1 *)lum; //ent_count = comp_v1->lcm_entry_count; } else if (lum->lmm_magic == LOV_MAGIC_V1 || lum->lmm_magic == LOV_MAGIC_V3) /*single entry*/ { ent_count = 1; } printf("LOV metadata: "); printf("stripe size: %u bytes, stripe count: %hu, file layout generation: %hu\n", lum->lmm_stripe_size, lum->lmm_stripe_count, lum->lmm_layout_gen); /*the comment in the data structure seems not correct*/ printf("inode id/seq: [0x%llx/0x%llx]\n", lum->lmm_oi.oi.oi_id, lum->lmm_oi.oi.oi_seq); /*information about the OST: per-stripe data*/ printf("OST objects:\n"); int ost_numbers = (lum->lmm_stripe_count == 65535) ? 3 : lum->lmm_stripe_count; if(ost_numbers<3) { for (l = 0; l < ost_numbers; l++) { printf("ost object: %d, ", l); printf("ost_index: %u, ost_generation: %u, ost_object_id: 0x%llx, ost_object_sequence: %llx\n", lum->lmm_objects[l].l_ost_idx, lum->lmm_objects[l].l_ost_gen, lum->lmm_objects[l].l_ost_oi.oi.oi_id, lum->lmm_objects[l].l_ost_oi.oi.oi_seq); /*@comment: a placeholder node will be created for the oss nodes.*/ /*@comment: as we are scanning mds before oss, we know that the oss nodes donot exists already.*/ /*@comment: we will not face the "when to mark a node incomplete" issue in this case.*/ /*need an array for lov here*/ sprintf(buffer + strlen(buffer),"apoc.do.when(n.duplicate=0){set n.lov='0x%llx' set n.lma_p='0x%llx:0x%x' merge (m:OSS {f_oid:'0x%x',ost_index_number:%d}) merge (n)-[:lov]->(m) merge (m)-[:lov_reverse]->(n)} apoc.do.when(n.duplicate=1){set n.lov2='0x%llx' set n.lma_p2='0x%llx:0x%x' merge (m:OSS {f_oid:'0x%x',ost_index_number:%d}) merge (n)-[:lov2]->(m) merge (m)-[:lov_reverse2]->(n)} ",lum->lmm_objects[0].l_ost_oi.oi.oi_id, lma->lma_self_fid.f_seq, lma->lma_self_fid.f_oid, lum->lmm_objects[0].l_ost_oi.oi.oi_id,l,lum->lmm_objects[0].l_ost_oi.oi.oi_id, lma->lma_self_fid.f_seq, lma->lma_self_fid.f_oid, lum->lmm_objects[0].l_ost_oi.oi.oi_id,l); } } else { //lov_junk=1; sprintf(buffer + strlen(buffer)," set n.lov='lov_junk' set n.lma_p='0x%llx:0x%x' ",lma->lma_self_fid.f_seq, lma->lma_self_fid.f_oid); } } } /*iterate to the next entry*/ entry = EXT4_XATTR_NEXT(entry); } // determine whether this is a directory of normal file. if (S_ISDIR(cur_inode.i_mode) != 0) //S_IFDIR { printf("This is a directory: block_size: %u\n", block_size); sprintf(buffer + strlen(buffer),"apoc.do.when(n.duplicate=0){set n.inode_type='directory'}apoc.do.when(n.duplicate=1){set n.inode_type2='directory'} "); void *block_buf = (void *) malloc (block_size); int block_id = 0; int reach_the_end = 0; if (!reach_the_end && block_id < 12) { lseek(fd, cur_inode.i_block[block_id] * block_size, SEEK_SET); read(fd, block_buf, block_size); void *p = block_buf; while (p < block_buf + block_size) { ed = (struct ext4_dir_entry_2 *) p; if (ed->inode != 0) { printf("inode: %d, rec_len: %hu, name: %s \n", ed->inode, ed->rec_len, ed->name); if ((ed->file_type & 16) == 16) /*files with extra attributes*/ { char * extra; extra = ed->name+ed->name_len+1; printf("extra_length: %hhu\n", *extra); struct lu_fid * FID_in_Dirent = (struct lu_fid *) (ed->name+ed->name_len+2); printf("\nFID in DIrent : '0x%llx:0x%x:0x%x'\n",FID_in_Dirent->f_seq,FID_in_Dirent->f_oid,FID_in_Dirent->f_ver); printf("\nI AM HERE\n"); /*comment:segmentation fault occurs on the below instruction*/ fid_be_to_cpu(FID,FID_in_Dirent); printf("\nI AM HERE NOW\n"); //printf("FID: [0x%llx:0x%x:0x%x]\n", FID->f_seq, FID->f_oid, FID->f_ver); sprintf(buffer + strlen(buffer),"apoc.do.when(n.duplicate=0){set n.FID=['0']} apoc.do.when(n.duplicate=1){set n.FID2=['0']} "); if(ed->inode > i+1) { printf("-------------------------------------------ed->inode:%d-------------------------------------------\n",ed->inode); printf("-------------------------------------------INODE NUMBER i = %d-------------------------------------------\n",i+1); /*comment: add inode_number also as a condition to merge MDS nodes*/ /*@comment: we create a placehilder node for file or subdirectories.*/ /*@comment: if the node already exists then we merge and donot change child.incomplete. it will remain as child.incomplete=0.*/ /*@comment: if the node doesnot exists and we are creating an unoccupied node then we should set child.incomplete=1.*/ /*@comment: again we need to identify whether the node already exists or not and use this as a condition to perform distinct tasks.*/ sprintf(buffer + strlen(buffer),"apoc.do.when(n.duplicate=0){set n.FID=n.FID + '0x%llx:0x%x:0x%x' merge (c:MDS{lma:n.FID}) merge (n)-[:dirent]->(c) merge (c)-[:dirent_reverse]->(n)} apoc.do.when(n.duplicate=1) {set n.FID2=n.FID2 + '0x%llx:0x%x:0x%x' merge (c:MDS{lma:n.FID2}) merge (n)-[:dirent2]->(c) merge (c)-[:dirent_reverse2]->(n)};",FID->f_seq, FID->f_oid, FID->f_ver,FID->f_seq, FID->f_oid, FID->f_ver); } } } else { reach_the_end = 1; break; } p = p + ed->rec_len; } block_id += 1; } if (block_id >= 12) { printf("ERROR, we encounter a huge directory and have not implemented the indirect block yet\n"); exit(0); } } else if (S_ISREG(cur_inode.i_mode) != 0) //S_IFREG { printf("This is a file:"); sprintf(buffer + strlen(buffer),"apoc.do.when(n.duplicate=0){set n.inode_type='file'}apoc.do.when(n.duplicate=0){set n.inode_type2='file'};"); } } results = neo4j_run(connection, buffer, neo4j_null); neo4j_close_results(results); } /*Neo4j: closing the connection*/ neo4j_close(connection); neo4j_client_cleanup(); close(fd); exit(0); } //sleep(5); /*combined sprintf commands merge( n:MDS {lma:'000'}) set n.inode_number=0 set n.node_occupied=1 set n.link='001' merge(p:MDS{lma:n.link}) merge(n)-[r1:child_of]->(p) merge (p)-[r2:child_of_reverse]->(n) set n.lov='002' set n.lma_p='00' merge (m:OSS {f_oid:'2',ost_index_number:0}) merge (n)-[r3:parent_of]->(m) merge (m)-[r4:parent_of_reverse]->(n) set n.inode_type='directory' set n.FID=['0'] set n.FID=n.FID + '2' merge (c:MDS{lma:n.FID}) merge (n)-[r5:parent_of]->(c) merge (c)-[r6:parent_of_reverse]->(n); */
37.412888
655
0.633389
[ "object" ]
b90d5edcae7e34b64dd730384e21a473e2b866aa
8,166
h
C
http_connection.h
jonbinney/crow
e02e1d33900b4b120998bcbc366144d421e3b760
[ "BSD-3-Clause" ]
1
2017-10-17T05:54:38.000Z
2017-10-17T05:54:38.000Z
http_connection.h
jonbinney/crow
e02e1d33900b4b120998bcbc366144d421e3b760
[ "BSD-3-Clause" ]
null
null
null
http_connection.h
jonbinney/crow
e02e1d33900b4b120998bcbc366144d421e3b760
[ "BSD-3-Clause" ]
null
null
null
#pragma once #include <boost/asio.hpp> #include <http_parser.h> #include <boost/asio.hpp> #include <boost/algorithm/string/predicate.hpp> #include <boost/array.hpp> #include <boost/lexical_cast.hpp> #include <atomic> #include <chrono> #include "datetime.h" #include "parser.h" #include "http_response.h" #include "logging.h" namespace crow { using namespace boost; using tcp = asio::ip::tcp; template <typename Handler> class Connection { public: Connection(tcp::socket&& socket, Handler* handler, const std::string& server_name) : socket_(std::move(socket)), handler_(handler), parser_(this), server_name_(server_name) { } void start() { do_read(); } void handle() { static std::unordered_map<int, std::string> statusCodes = { {200, "HTTP/1.1 200 OK\r\n"}, {201, "HTTP/1.1 201 Created\r\n"}, {202, "HTTP/1.1 202 Accepted\r\n"}, {204, "HTTP/1.1 204 No Content\r\n"}, {300, "HTTP/1.1 300 Multiple Choices\r\n"}, {301, "HTTP/1.1 301 Moved Permanently\r\n"}, {302, "HTTP/1.1 302 Moved Temporarily\r\n"}, {304, "HTTP/1.1 304 Not Modified\r\n"}, {400, "HTTP/1.1 400 Bad Request\r\n"}, {401, "HTTP/1.1 401 Unauthorized\r\n"}, {403, "HTTP/1.1 403 Forbidden\r\n"}, {404, "HTTP/1.1 404 Not Found\r\n"}, {500, "HTTP/1.1 500 Internal Server Error\r\n"}, {501, "HTTP/1.1 501 Not Implemented\r\n"}, {502, "HTTP/1.1 502 Bad Gateway\r\n"}, {503, "HTTP/1.1 503 Service Unavailable\r\n"}, }; request req = parser_.to_request(); if (parser_.http_major == 1 && parser_.http_minor == 0) { // HTTP/1.0 if (!(req.headers.count("connection") && boost::iequals(req.headers["connection"],"Keep-Alive"))) close_connection_ = true; } else { // HTTP/1.1 if (req.headers.count("connection") && req.headers["connection"] == "close") close_connection_ = true; } res = handler_->handle(req); CROW_LOG_INFO << "HTTP/" << parser_.http_major << "." << parser_.http_minor << ' ' << method_name(req.method) << " " << req.url << " " << res.code << ' ' << close_connection_; static std::string seperator = ": "; static std::string crlf = "\r\n"; buffers_.clear(); buffers_.reserve(4*(res.headers.size()+4)+3); if (res.body.empty() && res.json_value.t() == json::type::Object) { res.body = json::dump(res.json_value); } if (!statusCodes.count(res.code)) res.code = 500; { auto& status = statusCodes.find(res.code)->second; buffers_.emplace_back(status.data(), status.size()); } if (res.code >= 400 && res.body.empty()) res.body = statusCodes[res.code].substr(9); bool has_content_length = false; bool has_date = false; bool has_server = false; for(auto& kv : res.headers) { buffers_.emplace_back(kv.first.data(), kv.first.size()); buffers_.emplace_back(seperator.data(), seperator.size()); buffers_.emplace_back(kv.second.data(), kv.second.size()); buffers_.emplace_back(crlf.data(), crlf.size()); if (boost::iequals(kv.first, "content-length")) has_content_length = true; if (boost::iequals(kv.first, "date")) has_date = true; if (boost::iequals(kv.first, "server")) has_server = true; } if (!has_content_length) { content_length_ = boost::lexical_cast<std::string>(res.body.size()); static std::string content_length_tag = "Content-Length: "; buffers_.emplace_back(content_length_tag.data(), content_length_tag.size()); buffers_.emplace_back(content_length_.data(), content_length_.size()); buffers_.emplace_back(crlf.data(), crlf.size()); } if (!has_server) { static std::string server_tag = "Server: "; buffers_.emplace_back(server_tag.data(), server_tag.size()); buffers_.emplace_back(server_name_.data(), server_name_.size()); buffers_.emplace_back(crlf.data(), crlf.size()); } if (!has_date) { static std::string date_tag = "Date: "; date_str_ = get_cached_date_str(); buffers_.emplace_back(date_tag.data(), date_tag.size()); buffers_.emplace_back(date_str_.data(), date_str_.size()); buffers_.emplace_back(crlf.data(), crlf.size()); } buffers_.emplace_back(crlf.data(), crlf.size()); buffers_.emplace_back(res.body.data(), res.body.size()); do_write(); } private: static std::string get_cached_date_str() { using namespace std::chrono; thread_local auto last = steady_clock::now(); thread_local std::string date_str = DateTime().str(); if (steady_clock::now() - last >= seconds(1)) { last = steady_clock::now(); date_str = DateTime().str(); } return date_str; } void do_read() { life_++; socket_.async_read_some(boost::asio::buffer(buffer_), [this](boost::system::error_code ec, std::size_t bytes_transferred) { bool do_complete_task = false; if (!ec) { bool ret = parser_.feed(buffer_.data(), bytes_transferred); if (ret) do_read(); else do_complete_task = true; } else do_complete_task = true; if (do_complete_task) { parser_.done(); socket_.close(); life_--; if ((int)life_ == 0) delete this; } }); } void do_write() { life_++; boost::asio::async_write(socket_, buffers_, [this](const boost::system::error_code& ec, std::size_t bytes_transferred) { bool should_close = false; if (!ec) { if (close_connection_) { should_close = true; } } else { should_close = true; } if (should_close) { socket_.close(); life_--; if ((int)life_ == 0) delete this; } }); } private: tcp::socket socket_; Handler* handler_; boost::array<char, 8192> buffer_; HTTPParser<Connection> parser_; response res; int life_; bool close_connection_ = false; const std::string& server_name_; std::vector<boost::asio::const_buffer> buffers_; std::string content_length_; std::string date_str_; }; }
33.743802
113
0.462528
[ "object", "vector" ]
b91a92947538474501d635f8cccea8dd8c6d083c
2,095
h
C
clients/cpp-qt5-client/client/OAITextTextAutocorrectApi.h
theunifai/unifai-sdk
b010bd37e5a418881ee3747bd8ec6e8e18e08234
[ "MIT" ]
1
2022-03-30T11:33:28.000Z
2022-03-30T11:33:28.000Z
clients/cpp-qt5-client/client/OAITextTextAutocorrectApi.h
theunifai/unifai-sdk
b010bd37e5a418881ee3747bd8ec6e8e18e08234
[ "MIT" ]
null
null
null
clients/cpp-qt5-client/client/OAITextTextAutocorrectApi.h
theunifai/unifai-sdk
b010bd37e5a418881ee3747bd8ec6e8e18e08234
[ "MIT" ]
null
null
null
/** * FastAPI * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #ifndef OAI_OAITextTextAutocorrectApi_H #define OAI_OAITextTextAutocorrectApi_H #include "OAIHttpRequest.h" #include "OAIHTTPValidationError.h" #include "OAIObject.h" #include <QString> #include <QObject> namespace OpenAPI { class OAITextTextAutocorrectApi: public QObject { Q_OBJECT public: OAITextTextAutocorrectApi(); OAITextTextAutocorrectApi(QString host, QString basePath); ~OAITextTextAutocorrectApi(); QString host; QString basePath; QMap<QString, QString> defaultHeaders; void applyTextTextAutocorrectPost(const QString& sentence, const QString& model); void getVersionsTextTextAutocorrectGet(); private: void applyTextTextAutocorrectPostCallback (OAIHttpRequestWorker * worker); void getVersionsTextTextAutocorrectGetCallback (OAIHttpRequestWorker * worker); signals: void applyTextTextAutocorrectPostSignal(OAIObject summary); void getVersionsTextTextAutocorrectGetSignal(OAIObject summary); void applyTextTextAutocorrectPostSignalFull(OAIHttpRequestWorker* worker, OAIObject summary); void getVersionsTextTextAutocorrectGetSignalFull(OAIHttpRequestWorker* worker, OAIObject summary); void applyTextTextAutocorrectPostSignalE(OAIObject summary, QNetworkReply::NetworkError error_type, QString& error_str); void getVersionsTextTextAutocorrectGetSignalE(OAIObject summary, QNetworkReply::NetworkError error_type, QString& error_str); void applyTextTextAutocorrectPostSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); void getVersionsTextTextAutocorrectGetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); }; } #endif
33.790323
144
0.794272
[ "model" ]
b91badf4f9c5b31d073cb8370d8e577ae430dac0
1,024
c
C
pc_sdl_c/src/lzui/lz_obj_png.c
dh-linghaibin/LZUI
3579739b5a350a3020aeb939e66e948ebb418824
[ "MIT" ]
2
2020-07-29T13:03:18.000Z
2020-12-21T04:37:05.000Z
pc_sdl_c/src/lzui/lz_obj_png.c
dh-linghaibin/LZUI
3579739b5a350a3020aeb939e66e948ebb418824
[ "MIT" ]
null
null
null
pc_sdl_c/src/lzui/lz_obj_png.c
dh-linghaibin/LZUI
3579739b5a350a3020aeb939e66e948ebb418824
[ "MIT" ]
null
null
null
// // Created by LHB on 2020/8/3. // #include "lzui/lz_obj_png.h" #include "lzui/lz_draw.h" static void lz_design (lz_obj_t * obj, lz_point_t *point); static void lz_event(lz_touch_val_t *val); lz_obj_t *lz_create_png(int x, int y) { lz_icon_t * icon = lz_malloc(sizeof(lz_icon_t)); lz_obj_t * obj = lz_create_obj(x,y,0,0,icon,lz_design); lz_obj_set_event(obj,lz_event); return obj; } void lz_icon_set_val(lz_obj_t * obj, struct png_t val) { if(obj == NULL) return; lz_icon_t * icon = obj->val; icon->png = val; lz_obj_set_width(obj, icon->png.width ); lz_obj_set_length(obj, icon->png.lenght ); } static void lz_design(lz_obj_t * obj, lz_point_t *point) { lz_icon_t * png = obj->val; lz_draw_png(point->x,point->y,png->png.width,png->png.lenght,png->png.data); } static void lz_event(lz_touch_val_t *val) { // lz_icon_t * icon = val->obj->val; // if(val->falg == 2) { // icon->mesh = 1; // } // if(val->falg == 0) { // icon->mesh = 0; // } }
24.380952
80
0.634766
[ "mesh" ]
b92075b130116ea08e4b5bc654f32be969065042
7,688
h
C
include/chasing_utils/Observer.h
icsl-Jeon/chasing_utils
adab01863856a11fc23e1298c9d5a84787288a81
[ "MIT" ]
null
null
null
include/chasing_utils/Observer.h
icsl-Jeon/chasing_utils
adab01863856a11fc23e1298c9d5a84787288a81
[ "MIT" ]
null
null
null
include/chasing_utils/Observer.h
icsl-Jeon/chasing_utils
adab01863856a11fc23e1298c9d5a84787288a81
[ "MIT" ]
null
null
null
// // Created by jbs on 21. 3. 21.. // #ifndef AUTO_CHASER2_OBSERVER_H #define AUTO_CHASER2_OBSERVER_H #include <chasing_utils/Utils.h> #define INFEASIBLE_SCORE 0.0 #define INFEASIBLE_SCORE_NORM -1.0 using namespace pcl; namespace chasing_utils { namespace observer { struct ObserverParam{ float scoreWeightSAC = 1.0; float scoreWeightVAO = 1.0; float scoreWeightVAA = 1.0; float discLevel = 0.2; float oscGenStartTime = 0.3; int nMaxStep; // maximum number of step int azimStep; float radMin; float radMax; int radStep; float elevMin; float elevMax; int elevStep; std_msgs::ColorRGBA OL_visOscColor; float OL_visOscRadius; PoseSetInitConfig getPoseInitConfig() { PoseSetInitConfig setConfig; setConfig.step[0] = radStep; setConfig.axisMin[0] = radMin; setConfig.axisMax[0] = radMax; // radius setConfig.step[1] = azimStep; setConfig.axisMin[1] = 0.0; setConfig.axisMax[1] = 2 * M_PI * (setConfig.step[1] - 1) / setConfig.step[1]; // azimuth setConfig.step[2] = elevStep; setConfig.axisMin[2] = elevMin; setConfig.axisMax[2] = elevMax; // elevation return setConfig; } }; struct ScoreTriplet { float sac = INFEASIBLE_SCORE; float vao = INFEASIBLE_SCORE; float vaa = 0.0; }; class OSC; typedef pair<int, int> ObserverTag; //(n,m) typedef vector<ObserverTag> ObserverTagChain; // (0,m_0),(1,m_1),.. (n,m_n) class Observer { friend class ObserverSet; private: ObserverTag tag; Pose pose; ScoreTriplet scoreRaw; //! raw value of scores bool isSacKnown = false; //! was edf calculated based on known cell bool isVaoExact = false; //! were all the cells known along the ray until the observer bool isScoreAssigned[3] = {false, false, false}; string getNameTag() const { return to_string(tag.first) + "_" + to_string(tag.second); } void setScoreSAC(float score) { scoreRaw.sac = score; isScoreAssigned[0] = true; } void setScoreVAO(float score) { scoreRaw.vao = score; isScoreAssigned[1] = true; } void setScoreVAA(float score) { scoreRaw.vaa = score; isScoreAssigned[2] = true; } public: Observer(Pose pose, ObserverTag tag); ObserverTag getTag() const { return tag; } PointXYZI toPntXYZI() const; ScoreTriplet getScoreTripletRaw() const; Point getLocation() const { return pose.getTranslation(); } Pose getPose() const { return pose; }; void applyTransform(Pose T01) { pose.applyTransform(T01); }; bool isAllScoreAssigned() const { return isScoreAssigned[0] and isScoreAssigned[1] and isScoreAssigned[2]; } }; typedef pair<vector<Observer>::const_iterator, vector<Observer>::const_iterator> IterConstObserverRange; typedef pair<vector<Observer>::iterator, vector<Observer>::iterator> IterObserverRange; class ObserverSet { private: ObserverParam param; vector<Observer> observerSet; PointSet directionSet; //! direction defined by azim,elev pair vector<int> directionInnerIndex; //! index of Observer having the minimum radius from target for a direction int nObserverAlongRay; //! = radius step public: ObserverSet(ObserverParam param, int n, Point target); // make surrounding ObserverSet on target int size() const { return observerSet.size(); } pair<ScoreTriplet, ScoreTriplet> getMaxMinScore() const; ScoreTriplet getScoreNormalized(int m) const; float getScoreNormalizedWeightSum(int m) const; Point getPoint(int m) const { return observerSet[m].getLocation(); } Pose getPose(int m) const { return observerSet[m].getPose(); } float getCost(int m) const; void setScoreRaw(int m, int d, float score); vector<PointXYZI> toPntXYZI() const; IterConstObserverRange getConstIterator() const { return make_pair(observerSet.cbegin(), observerSet.cend()); } IterObserverRange getRefIterator() { return make_pair(observerSet.begin(), observerSet.end()); } vector<IterObserverRange> getObserverRefAlongRaySet(); PointSet getDirectionAlongRaySet() const { return directionSet; } }; /** * @brief Observer Set Chain */ class OSC { private: bool isVaoAssigned = false; bool isVaaAssigned = false; unsigned int curChainSize; int camSizePerStep; ObserverParam param; vector<ObserverSet> chain; Traj baseChain; public: //! Only positions of observers will be created here OSC(ObserverParam param, Traj baseChain); /** * Core service functions */ void setScoreRaw(ObserverTag tag, int d, float score); //! make chains by choosing a points from observerSet per time vector<ObserverTagChain> getPermutationPointChain( double *&xArr, double *&yArr, double *&zArr) const; /** * Set and get service functions */ Pose getPose(int n, int m) const { return chain[n].getPose(m); } Observer getObserver(int n, int m) const { return *(chain[n].getConstIterator().first + m); } IterConstObserverRange getAllObserver(int n) const { return chain[n].getConstIterator(); } PointCloud<PointXYZI> getTimeColoredPoints() const; PointCloud<PointXYZI> getBasePoints() const; visualization_msgs::Marker getSphereList(string worldFrameId, string ns = "", int id = 0) const; //! visualization_msgs marker sphere list PoseSet getAllPoseSet() const; pair<PoseSet, vector<ObserverTag>> getAllPoseSetWithTag() const; PointSet getAllPointSet() const; int getCurChainSize() const { return chain.size(); }; int getCurCamSizePerStep() const { return camSizePerStep; } PointSet getDirectionAlongRaySet(int n) const; Point getBasePoint(int n) const { assert (n >= 0 and n < curChainSize); return baseChain.points[n]; } Traj getBaseChain() const { return baseChain; } ScoreTriplet getNormalizedScore(ObserverTag tag) const; vector<IterObserverRange> getObserverRefAlongRaySet(int n) { return chain[n].getObserverRefAlongRaySet(); } void applyTransform(Pose T01); }; //! Generate OSC from making baseChain by discretization of baseTraj OSC spawnOscAroundTraj(ObserverParam param, Traj baseTraj, float t0,float tf,float dt,int maxStep); } } #endif //AUTO_CHASER2_EVALUATOR_H
31.508197
123
0.573491
[ "vector" ]
b92cca9b748202789ca376ca40010df8197fb1a7
57,078
c
C
lib/btree/compaction_daemon.c
CARV-ICS-FORTH/parallax
1b2726f0149a3dfe5aa91c9da8685ce4fee59591
[ "Apache-2.0" ]
20
2021-12-29T17:20:23.000Z
2022-03-24T22:14:32.000Z
lib/btree/compaction_daemon.c
CARV-ICS-FORTH/parallax
1b2726f0149a3dfe5aa91c9da8685ce4fee59591
[ "Apache-2.0" ]
2
2022-02-10T13:41:47.000Z
2022-03-18T00:22:03.000Z
lib/btree/compaction_daemon.c
CARV-ICS-FORTH/parallax
1b2726f0149a3dfe5aa91c9da8685ce4fee59591
[ "Apache-2.0" ]
1
2022-02-27T20:39:00.000Z
2022-02-27T20:39:00.000Z
// Copyright [2021] [FORTH-ICS] // // 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. #define _GNU_SOURCE /* See feature_test_macros(7) */ #include "compaction_daemon.h" #include "../../utilities/dups_list.h" #include "../allocator/device_structures.h" #include "../allocator/log_structures.h" #include "../allocator/redo_undo_log.h" #include "../allocator/volume_manager.h" #include "../common/common.h" #include "../scanner/min_max_heap.h" #include "../scanner/scanner.h" #include "btree.h" #include "conf.h" #include "dynamic_leaf.h" #include "gc.h" #include "index_node.h" #include "medium_log_LRU_cache.h" #include "segment_allocator.h" #include <assert.h> #include <log.h> #include <pthread.h> #include <semaphore.h> #include <spin_loop.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <uthash.h> static void comp_medium_log_set_max_segment_id(struct comp_level_write_cursor *c) { uint64_t max_segment_id = 0; uint64_t max_segment_offt = 0; struct medium_log_segment_map *current_entry = NULL; struct medium_log_segment_map *tmp = NULL; HASH_ITER(hh, c->medium_log_segment_map, current_entry, tmp) { /* Suprresses possible null pointer dereference of cppcheck*/ assert(current_entry); uint64_t segment_id = current_entry->id; if (UINT64_MAX == segment_id) { struct segment_header *segment = REAL_ADDRESS(current_entry->dev_offt); segment_id = segment->segment_id; } // cppcheck-suppress unsignedPositive if (segment_id >= max_segment_id) { max_segment_id = segment_id; max_segment_offt = current_entry->dev_offt; } HASH_DEL(c->medium_log_segment_map, current_entry); free(current_entry); } struct level_descriptor *level_desc = &c->handle->db_desc->levels[c->level_id]; level_desc->medium_in_place_max_segment_id = max_segment_id; level_desc->medium_in_place_segment_dev_offt = max_segment_offt; log_debug("Max segment id touched during medium transfer to in place is %lu and corresponding offt: %lu", max_segment_id, max_segment_offt); } static void fetch_segment_chunk(struct comp_level_write_cursor *c, uint64_t log_chunk_dev_offt, char *segment_buf, ssize_t size) { off_t dev_offt = log_chunk_dev_offt; ssize_t bytes_to_read = 0; while (bytes_to_read < size) { ssize_t bytes = pread(c->handle->db_desc->db_volume->vol_fd, &segment_buf[bytes_to_read], size - bytes_to_read, dev_offt + bytes_to_read); if (bytes == -1) { log_fatal("Failed to read error code"); perror("Error"); BUG_ON(); } bytes_to_read += bytes; } if (c->level_id != c->handle->db_desc->level_medium_inplace) return; uint64_t segment_dev_offt = log_chunk_dev_offt - (log_chunk_dev_offt % SEGMENT_SIZE); struct medium_log_segment_map *entry = NULL; //log_debug("Searching segment offt: %lu log chunk offt %lu mod %lu", segment_dev_offt, log_chunk_dev_offt, // log_chunk_dev_offt % SEGMENT_SIZE); HASH_FIND_PTR(c->medium_log_segment_map, &segment_dev_offt, entry); /*Never seen it before*/ bool found = true; if (!entry) { entry = calloc(1, sizeof(*entry)); entry->dev_offt = segment_dev_offt; found = false; } /*Already seen and set its id, nothing to do*/ if (found && entry->id != UINT64_MAX) return; entry->dev_offt = segment_dev_offt; entry->id = UINT64_MAX; if (0 == log_chunk_dev_offt % SEGMENT_SIZE) { struct segment_header *segment = (struct segment_header *)segment_buf; entry->id = segment->segment_id; } if (!found) HASH_ADD_PTR(c->medium_log_segment_map, dev_offt, entry); } static char *fetch_kv_from_LRU(struct write_dynamic_leaf_args *args, struct comp_level_write_cursor *c) { char *segment_chunk = NULL, *kv_in_seg = NULL; uint64_t segment_offset, which_chunk, segment_chunk_offt; segment_offset = ABSOLUTE_ADDRESS(args->kv_dev_offt) - (ABSOLUTE_ADDRESS(args->kv_dev_offt) % SEGMENT_SIZE); which_chunk = (ABSOLUTE_ADDRESS(args->kv_dev_offt) % SEGMENT_SIZE) / LOG_CHUNK_SIZE; segment_chunk_offt = segment_offset + (which_chunk * LOG_CHUNK_SIZE); if (!chunk_exists_in_LRU(c->medium_log_LRU_cache, segment_chunk_offt)) { if (posix_memalign((void **)&segment_chunk, ALIGNMENT_SIZE, LOG_CHUNK_SIZE + KB(4)) != 0) { log_fatal("MEMALIGN FAILED"); BUG_ON(); } fetch_segment_chunk(c, segment_chunk_offt, segment_chunk, LOG_CHUNK_SIZE + KB(4)); add_to_LRU(c->medium_log_LRU_cache, segment_chunk_offt, segment_chunk); } else segment_chunk = get_chunk_from_LRU(c->medium_log_LRU_cache, segment_chunk_offt); kv_in_seg = &segment_chunk[(ABSOLUTE_ADDRESS(args->kv_dev_offt) % SEGMENT_SIZE) - (which_chunk * LOG_CHUNK_SIZE)]; return kv_in_seg; } static uint32_t comp_calc_offt_in_seg(char *buffer_start, char *addr) { uint64_t start = (uint64_t)buffer_start; uint64_t end = (uint64_t)addr; if (end < start) { log_fatal("End should be greater than start!"); BUG_ON(); } assert(end - start < SEGMENT_SIZE); return (end - start) % SEGMENT_SIZE; } struct compaction_roots { struct node_header *src_root; struct node_header *dst_root; }; static void comp_write_segment(char *buffer, uint64_t dev_offt, uint32_t buf_offt, uint32_t size, int fd) { #if 0 struct node_header *n = (struct node_header *)&buffer[sizeof(struct segment_header)]; switch (n->type) { case rootNode: case internalNode: { uint32_t decoded = sizeof(struct segment_header); while (decoded < SEGMENT_SIZE) { if (n->type == paddedSpace) break; assert(n->type == rootNode || n->type == internalNode); n = (struct node_header *)((char *)n + INDEX_NODE_SIZE); decoded += (INDEX_NODE_SIZE); } break; } case leafNode: case leafRootNode: { int num_leaves = 0; int padded = 0; uint32_t decoded = sizeof(struct segment_header); while (decoded < SEGMENT_SIZE) { if (n->type == paddedSpace) { log_warn("Found padded space in leaf segment ok"); padded = 1; break; } if (n->type != leafNode && n->type != leafRootNode) { log_fatal("Corruption expected leaf got %u decoded was %u", n->type, decoded); BUG_ON(); } ++num_leaves; n = (struct node_header *)((uint64_t)n + LEAF_NODE_SIZE); decoded += LEAF_NODE_SIZE; } if (padded) break; assert(num_leaves == 255); break; } case paddedSpace: break; default: BUG_ON(); } #endif ssize_t total_bytes_written = buf_offt; while (total_bytes_written < size) { ssize_t bytes_written = pwrite(fd, &buffer[total_bytes_written], size - total_bytes_written, dev_offt + total_bytes_written); if (bytes_written == -1) { log_fatal("Failed to writed segment for leaf nodes reason follows"); perror("Reason"); BUG_ON(); } total_bytes_written += bytes_written; } } static void comp_init_dynamic_leaf(struct bt_dynamic_leaf_node *leaf) { leaf->header.type = leafNode; leaf->header.num_entries = 0; leaf->header.fragmentation = 0; leaf->header.leaf_log_size = 0; leaf->header.height = 0; } static void comp_init_read_cursor(struct comp_level_read_cursor *c, db_handle *handle, uint32_t level_id, uint32_t tree_id, int fd) { memset(c, 0, sizeof(struct comp_level_read_cursor)); c->fd = fd; c->offset = 0; c->handle = handle; c->curr_segment = NULL; c->level_id = level_id; c->tree_id = tree_id; c->curr_leaf_entry = 0; c->end_of_level = 0; c->state = COMP_CUR_FETCH_NEXT_SEGMENT; } static void comp_get_next_key(struct comp_level_read_cursor *c) { if (c == NULL) { log_fatal("NULL cursor!"); BUG_ON(); } uint32_t level_leaf_size = c->handle->db_desc->levels[c->level_id].leaf_size; if (c->end_of_level) return; while (1) { fsm_entry: switch (c->state) { case COMP_CUR_CHECK_OFFT: { if (c->offset >= c->handle->db_desc->levels[c->level_id].offset[c->tree_id]) { log_debug("Done read level %u", c->level_id); c->end_of_level = 1; assert(c->offset == c->handle->db_desc->levels[c->level_id].offset[c->tree_id]); return; } if (c->offset % SEGMENT_SIZE == 0) c->state = COMP_CUR_FETCH_NEXT_SEGMENT; else c->state = COMP_CUR_FIND_LEAF; break; } case COMP_CUR_FETCH_NEXT_SEGMENT: { if (c->curr_segment == NULL) { c->curr_segment = c->handle->db_desc->levels[c->level_id].first_segment[c->tree_id]; } else { if (c->curr_segment->next_segment == NULL) { assert((uint64_t)c->curr_segment == (uint64_t)c->handle->db_desc->levels[c->level_id] .last_segment[c->tree_id]); log_debug("Done reading level %u cursor offset %lu total offt %lu", c->level_id, c->offset, c->handle->db_desc->levels[c->level_id].offset[c->tree_id]); assert(c->offset == c->handle->db_desc->levels[c->level_id].offset[c->tree_id]); c->state = COMP_CUR_CHECK_OFFT; //TODO replace goto with continue; //TODO Rename device_offt goto fsm_entry; } else c->curr_segment = (segment_header *)REAL_ADDRESS((uint64_t)c->curr_segment->next_segment); } /*log_info("Fetching next segment id %llu for [%lu][%lu]", c->curr_segment->segment_id, c->level_id, c->tree_id);*/ /*read the segment*/ off_t dev_offt = ABSOLUTE_ADDRESS(c->curr_segment); // log_info("Reading level segment from dev_offt: %llu", dev_offt); ssize_t bytes_read = 0; //sizeof(struct segment_header); while (bytes_read < SEGMENT_SIZE) { ssize_t bytes = pread(c->fd, &c->segment_buf[bytes_read], SEGMENT_SIZE - bytes_read, dev_offt + bytes_read); if (-1 == bytes) { log_fatal("Failed to read error code"); perror("Error"); BUG_ON(); } bytes_read += bytes; } c->offset += sizeof(struct segment_header); c->state = COMP_CUR_FIND_LEAF; break; } case COMP_CUR_DECODE_KV: { struct bt_dynamic_leaf_node *leaf = (struct bt_dynamic_leaf_node *)((uint64_t)c->segment_buf + (c->offset % SEGMENT_SIZE)); // slot array entry if (c->curr_leaf_entry >= leaf->header.num_entries) { // done with this leaf c->curr_leaf_entry = 0; c->offset += level_leaf_size; c->state = COMP_CUR_CHECK_OFFT; break; } else { struct bt_dynamic_leaf_slot_array *slot_array = get_slot_array_offset(leaf); c->category = slot_array[c->curr_leaf_entry].key_category; c->cursor_key.tombstone = slot_array[c->curr_leaf_entry].tombstone; char *kv_loc = get_kv_offset(leaf, level_leaf_size, slot_array[c->curr_leaf_entry].index); switch (c->category) { case SMALL_INPLACE: case MEDIUM_INPLACE: { // Real key in KV_FORMAT c->cursor_key.kv_inplace = fill_keybuf( kv_loc, get_kv_format(slot_array[c->curr_leaf_entry].key_category)); break; } case MEDIUM_INLOG: case BIG_INLOG: { // fill_prefix(&c->cursor_key.P, kv_loc, // slot_array[c->curr_leaf_entry].bitmap); // c->category); c->cursor_key.kv_inlog = (struct bt_leaf_entry *)kv_loc; c->cursor_key.kv_inlog->dev_offt = (uint64_t)REAL_ADDRESS(c->cursor_key.kv_inlog->dev_offt); // log_info("prefix is %.12s dev_offt %llu", // c->cursor_key.in_log->prefix, // c->cursor_key.in_log->device_offt); break; } default: log_fatal("Cannot handle this category"); BUG_ON(); } ++c->curr_leaf_entry; return; } } case COMP_CUR_FIND_LEAF: { /*read four bytes to check what is the node format*/ nodeType_t type = *(uint32_t *)(&c->segment_buf[c->offset % SEGMENT_SIZE]); switch (type) { case leafNode: case leafRootNode: //__sync_fetch_and_add(&leaves, 1); //log_info("Found a leaf!"); c->state = COMP_CUR_DECODE_KV; goto fsm_entry; case rootNode: case internalNode: /*log_info("Found an internal");*/ c->offset += INDEX_NODE_SIZE; c->state = COMP_CUR_CHECK_OFFT; goto fsm_entry; case paddedSpace: /*log_info("Found padded space of size %llu", (SEGMENT_SIZE - (c->offset % SEGMENT_SIZE)));*/ c->offset += (SEGMENT_SIZE - (c->offset % SEGMENT_SIZE)); c->state = COMP_CUR_CHECK_OFFT; goto fsm_entry; default: log_fatal("Faulty read cursor of level %u Wrong node type %u offset " "was %lu total level offset %lu faulty segment offt: %lu", c->level_id, type, c->offset, c->handle->db_desc->levels[c->level_id].offset[0], ABSOLUTE_ADDRESS(c->curr_segment)); BUG_ON(); } break; } default: log_fatal("Error state"); BUG_ON(); } } } static void comp_init_write_cursor(struct comp_level_write_cursor *c, struct db_handle *handle, int level_id, int fd) { memset(c, 0, sizeof(struct comp_level_write_cursor)); c->level_id = level_id; c->tree_height = 0; c->fd = fd; c->handle = handle; comp_get_space(c, 0, leafNode); assert(c->last_segment_btree_level_offt[0]); c->first_segment_btree_level_offt[0] = c->last_segment_btree_level_offt[0]; for (int i = 1; i < MAX_HEIGHT; ++i) { comp_get_space(c, i, internalNode); index_init_node(DO_NOT_ADD_GUARD, (struct index_node *)c->last_index[i], internalNode); c->first_segment_btree_level_offt[i] = c->last_segment_btree_level_offt[i]; assert(c->last_segment_btree_level_offt[i]); } } /*mini allocator*/ static void comp_get_space(struct comp_level_write_cursor *c, uint32_t height, nodeType_t type) { assert(height < MAX_HEIGHT); struct level_descriptor *level_desc = &c->handle->db_desc->levels[c->level_id]; uint32_t level_leaf_size = level_desc->leaf_size; switch (type) { case leafNode: case leafRootNode: { uint32_t remaining_space; if (c->segment_offt[0] == 0) remaining_space = 0; else if (c->segment_offt[0] % SEGMENT_SIZE == 0) remaining_space = 0; else remaining_space = SEGMENT_SIZE - c->segment_offt[0] % SEGMENT_SIZE; if (remaining_space < level_leaf_size) { if (remaining_space > 0) { *(uint32_t *)&c->segment_buf[0][c->segment_offt[0] % SEGMENT_SIZE] = paddedSpace; c->segment_offt[0] += remaining_space; } struct segment_header *new_device_segment = get_segment_for_lsm_level_IO(c->handle->db_desc, c->level_id, 1); struct segment_header *current_segment_mem_buffer = (struct segment_header *)&c->segment_buf[0][0]; if (c->segment_offt[height] != 0) { current_segment_mem_buffer->next_segment = (void *)ABSOLUTE_ADDRESS(new_device_segment); assert(new_device_segment); assert(current_segment_mem_buffer->next_segment); comp_write_segment(c->segment_buf[0], c->last_segment_btree_level_offt[0], 0, SEGMENT_SIZE, c->fd); } memset(&c->segment_buf[0][0], 0x00, sizeof(struct segment_header)); c->last_segment_btree_level_offt[0] = ABSOLUTE_ADDRESS(new_device_segment); c->segment_offt[0] = sizeof(struct segment_header); current_segment_mem_buffer->segment_id = c->segment_id_cnt++; current_segment_mem_buffer->nodetype = type; } c->last_leaf = (struct bt_dynamic_leaf_node *)(&c->segment_buf[0][(c->segment_offt[0] % SEGMENT_SIZE)]); comp_init_dynamic_leaf(c->last_leaf); c->segment_offt[0] += level_leaf_size; break; } case internalNode: case rootNode: { uint32_t remaining_space; if (c->segment_offt[height] == 0) remaining_space = 0; else if (c->segment_offt[height] % SEGMENT_SIZE == 0) remaining_space = 0; else remaining_space = SEGMENT_SIZE - (c->segment_offt[height] % SEGMENT_SIZE); if (remaining_space < INDEX_NODE_SIZE) { if (remaining_space > 0) { *(uint32_t *)(&c->segment_buf[height][c->segment_offt[height] % SEGMENT_SIZE]) = paddedSpace; c->segment_offt[height] += remaining_space; } struct segment_header *new_device_segment = get_segment_for_lsm_level_IO(c->handle->db_desc, c->level_id, 1); struct segment_header *current_segment_mem_buffer = (struct segment_header *)&c->segment_buf[height][0]; if (c->segment_offt[height] != 0) { current_segment_mem_buffer->next_segment = (void *)ABSOLUTE_ADDRESS(new_device_segment); assert(new_device_segment); assert(current_segment_mem_buffer->next_segment); comp_write_segment(c->segment_buf[height], c->last_segment_btree_level_offt[height], 0, SEGMENT_SIZE, c->fd); } memset(&c->segment_buf[height][0], 0x00, sizeof(struct segment_header)); c->segment_offt[height] += sizeof(struct segment_header); c->last_segment_btree_level_offt[height] = ABSOLUTE_ADDRESS(new_device_segment); current_segment_mem_buffer->segment_id = c->segment_id_cnt++; current_segment_mem_buffer->nodetype = type; } c->last_index[height] = (struct index_node *)&c->segment_buf[height][c->segment_offt[height] % SEGMENT_SIZE]; c->segment_offt[height] += INDEX_NODE_SIZE; break; } default: log_fatal("Wrong type"); BUG_ON(); } } #if 0 char *nodetype_tostring(nodeType_t type) { switch (type) { case leafNode: return "leafnode"; case leafRootNode: return "leafRootNode"; case rootNode: return "rootNode"; case internalNode: return "internalnode"; case paddedSpace: return "paddedspace"; default: return "UnknownNode"; } } static void assert_level_segments(db_descriptor *db_desc, uint8_t level_id, uint8_t tree_id) { uint64_t measure_level_bytes = 0; segment_header *segment = db_desc->levels[level_id].first_segment[tree_id]; assert(segment); log_info("First segment in get_assert_level %u %p segment id %lu %s next segment %p", level_id, segment, segment->segment_id, nodetype_tostring(segment->nodetype), segment->next_segment); measure_level_bytes += SEGMENT_SIZE; for (segment = REAL_ADDRESS(segment->next_segment); segment->next_segment; segment = REAL_ADDRESS(segment->next_segment)) { log_info("segment in get_assert_level %u %p segment id %lu %s next %p ", level_id, segment, segment->segment_id, nodetype_tostring(segment->nodetype), segment->next_segment); measure_level_bytes += SEGMENT_SIZE; } log_info("segment in get_assert_level %u %p segment id %lu %s next %p ", level_id, segment, segment->segment_id, nodetype_tostring(segment->nodetype), segment->next_segment); measure_level_bytes += SEGMENT_SIZE; log_debug("Measured %lu offset in level %lu", measure_level_bytes, db_desc->levels[level_id].offset[tree_id]); assert(segment == db_desc->levels[level_id].last_segment[tree_id]); assert(measure_level_bytes == db_desc->levels[level_id].offset[tree_id]); } #endif static void comp_close_write_cursor(struct comp_level_write_cursor *c) { uint32_t level_leaf_size = c->handle->db_desc->levels[c->level_id].leaf_size; for (int32_t i = 0; i < MAX_HEIGHT; ++i) { uint32_t *type; //log_debug("i = %u tree height: %u", i, c->tree_height); if (i <= c->tree_height) { assert(c->segment_offt[i] > 4096); if (i == 0 && c->segment_offt[i] % SEGMENT_SIZE != 0) { type = (uint32_t *)((uint64_t)c->last_leaf + level_leaf_size); //log_info("Marking padded space for %u segment offt %llu", i, c->segment_offt[0]); *type = paddedSpace; } else if (i > 0 && c->segment_offt[i] % SEGMENT_SIZE != 0) { type = (uint32_t *)(((char *)c->last_index[i]) + INDEX_NODE_SIZE); // log_info("Marking padded space for %u segment offt %llu entries of // last node %llu", i, // c->segment_offt[i], c->last_index[i]->header.num_entries); *type = paddedSpace; } } else { type = (uint32_t *)&c->segment_buf[i][sizeof(struct segment_header)]; *type = paddedSpace; //log_debug("Marking full padded space for level_id %u tree height %u", c->level_id, // c->tree_height); } if (i == c->tree_height) { log_debug("Merged level has a height off %u", c->tree_height); if (!index_set_type((struct index_node *)c->last_index[i], rootNode)) { log_fatal("Error setting node type"); BUG_ON(); } uint32_t offt = comp_calc_offt_in_seg(c->segment_buf[i], (char *)c->last_index[i]); c->root_offt = c->last_segment_btree_level_offt[i] + offt; c->handle->db_desc->levels[c->level_id].root_r[1] = REAL_ADDRESS(c->root_offt); } struct segment_header *segment_in_mem_buffer = (struct segment_header *)c->segment_buf[i]; //segment_in_mem_buffer->segment_id = c->segment_id_cnt++; //assert(c->segment_id_cnt != 251); /* segment_in_mem_buffer->nodetype = paddedSpace; */ if (MAX_HEIGHT - 1 == i) { c->handle->db_desc->levels[c->level_id].last_segment[1] = REAL_ADDRESS(c->last_segment_btree_level_offt[i]); assert(c->last_segment_btree_level_offt[i]); segment_in_mem_buffer->next_segment = NULL; } else { assert(c->last_segment_btree_level_offt[i + 1]); segment_in_mem_buffer->next_segment = (void *)c->first_segment_btree_level_offt[i + 1]; } comp_write_segment(c->segment_buf[i], c->last_segment_btree_level_offt[i], 0, SEGMENT_SIZE, c->fd); } #if 0 assert_level_segments(c->handle->db_desc, c->level_id, 1); #endif } static void comp_append_pivot_to_index(int32_t height, struct comp_level_write_cursor *c, uint64_t left_node_offt, struct pivot_key *pivot, uint64_t right_node_offt) { //log_debug("Append pivot %.*s left child offt %lu right child offt %lu", pivot->size, pivot->data, // left_node_offt, right_node_offt); if (c->tree_height < height) c->tree_height = height; struct index_node *node = (struct index_node *)c->last_index[height]; if (index_is_empty(node)) { index_add_guard(node, left_node_offt); index_set_height(node, height); } struct pivot_pointer right = { .child_offt = right_node_offt }; struct insert_pivot_req ins_pivot_req = { .node = node, .key = pivot, .right_child = &right }; while (!index_append_pivot(&ins_pivot_req)) { uint32_t offt_l = comp_calc_offt_in_seg(c->segment_buf[height], (char *)c->last_index[height]); uint64_t left_index_offt = c->last_segment_btree_level_offt[height] + offt_l; struct pivot_key *pivot_copy = index_remove_last_pivot_key(node); struct pivot_pointer *piv_pointer = (struct pivot_pointer *)&((char *)pivot_copy)[PIVOT_KEY_SIZE(pivot_copy)]; comp_get_space(c, height, internalNode); ins_pivot_req.node = (struct index_node *)c->last_index[height]; index_init_node(DO_NOT_ADD_GUARD, ins_pivot_req.node, internalNode); index_add_guard(ins_pivot_req.node, piv_pointer->child_offt); index_set_height(ins_pivot_req.node, height); /*last leaf updated*/ uint32_t offt_r = comp_calc_offt_in_seg(c->segment_buf[height], (char *)c->last_index[height]); uint64_t right_index_offt = c->last_segment_btree_level_offt[height] + offt_r; comp_append_pivot_to_index(height + 1, c, left_index_offt, pivot_copy, right_index_offt); free(pivot_copy); } } static void comp_init_medium_log(struct db_descriptor *db_desc, uint8_t level_id, uint8_t tree_id) { log_debug("Initializing medium log for db: %s", db_desc->db_superblock->db_name); struct segment_header *s = seg_get_raw_log_segment(db_desc, MEDIUM_LOG, level_id, tree_id); db_desc->medium_log.head_dev_offt = ABSOLUTE_ADDRESS(s); db_desc->medium_log.tail_dev_offt = db_desc->medium_log.head_dev_offt; db_desc->medium_log.size = sizeof(segment_header); init_log_buffer(&db_desc->medium_log, MEDIUM_LOG); struct segment_header *seg_in_mem = (struct segment_header *)db_desc->medium_log.tail[0]->buf; seg_in_mem->segment_id = 0; seg_in_mem->prev_segment = NULL; seg_in_mem->next_segment = NULL; } static int comp_append_medium_L1(struct comp_level_write_cursor *c, struct comp_parallax_key *in, struct comp_parallax_key *out) { if (c->level_id != 1) return 0; if (in->kv_category != MEDIUM_INPLACE) return 0; struct db_descriptor *db_desc = c->handle->db_desc; if (db_desc->medium_log.head_dev_offt == 0 && db_desc->medium_log.tail_dev_offt == 0 && db_desc->medium_log.size == 0) { comp_init_medium_log(c->handle->db_desc, c->level_id, 1); } struct bt_insert_req ins_req; ins_req.metadata.handle = c->handle; ins_req.metadata.log_offset = 0; ins_req.metadata.kv_size = sizeof(uint32_t) + KEY_SIZE(in->kv_inplace); ins_req.metadata.kv_size += VALUE_SIZE(in->kv_inplace + ins_req.metadata.kv_size) + sizeof(uint32_t); ins_req.metadata.cat = MEDIUM_INLOG; ins_req.metadata.level_id = c->level_id; ins_req.metadata.tree_id = 1; ins_req.metadata.append_to_log = 1; ins_req.metadata.gc_request = 0; ins_req.metadata.recovery_request = 0; ins_req.metadata.special_split = 0; ins_req.metadata.key_format = KV_FORMAT; ins_req.metadata.tombstone = 0; ins_req.key_value_buf = in->kv_inplace; ins_req.metadata.reorganized_leaf_pos_INnode = NULL; /*For Tebis-parallax currently*/ ins_req.metadata.segment_full_event = 0; ins_req.metadata.log_segment_addr = 0; ins_req.metadata.log_offset_full_event = 0; ins_req.metadata.segment_id = 0; ins_req.metadata.end_of_log = 0; ins_req.metadata.log_padding = 0; struct log_operation log_op; log_op.metadata = &ins_req.metadata; log_op.optype_tolog = insertOp; log_op.ins_req = &ins_req; // log_info("Appending to medium log during compaction"); char *log_location = append_key_value_to_log(&log_op); out->kv_inlog = &out->kvsep; if (ins_req.metadata.kv_size >= PREFIX_SIZE) memcpy(out->kv_inlog, in->kv_inplace + sizeof(uint32_t), PREFIX_SIZE); else { memset(out->kv_inlog, 0x00, PREFIX_SIZE); memcpy(out->kv_inlog, in->kv_inplace + sizeof(uint32_t), ins_req.metadata.kv_size); } out->kv_category = MEDIUM_INLOG; out->kv_type = KV_INLOG; out->kv_inlog->dev_offt = (uint64_t)log_location; out->tombstone = 0; //log_info("Compact key %s", ins_req.key_value_buf + 4); return 1; } static void comp_append_entry_to_leaf_node(struct comp_level_write_cursor *cursor, struct comp_parallax_key *kv) { struct comp_parallax_key trans_medium; struct write_dynamic_leaf_args write_leaf_args; struct comp_parallax_key *curr_key = kv; uint64_t left_leaf_offt = 0; uint64_t right_leaf_offt = 0; uint32_t level_leaf_size = cursor->handle->db_desc->levels[cursor->level_id].leaf_size; uint32_t kv_size = 0; uint8_t append_to_medium_log = 0; if (comp_append_medium_L1(cursor, kv, &trans_medium)) { curr_key = &trans_medium; append_to_medium_log = 1; } write_leaf_args.level_medium_inplace = cursor->handle->db_desc->level_medium_inplace; switch (curr_key->kv_type) { case KV_INPLACE: kv_size = sizeof(uint32_t) + KEY_SIZE(curr_key->kv_inplace); kv_size += VALUE_SIZE(curr_key->kv_inplace + kv_size) + sizeof(uint32_t); write_leaf_args.kv_dev_offt = 0; write_leaf_args.key_value_size = kv_size; write_leaf_args.level_id = cursor->level_id; write_leaf_args.kv_format = KV_FORMAT; write_leaf_args.cat = curr_key->kv_category; write_leaf_args.key_value_buf = curr_key->kv_inplace; write_leaf_args.tombstone = curr_key->tombstone; //log_info("Appending key in_place %u:%s", write_leaf_args.key_value_size, // write_leaf_args.key_value_buf + sizeof(uint32_t)); break; case KV_INLOG: kv_size = sizeof(struct bt_leaf_entry); write_leaf_args.kv_dev_offt = curr_key->kv_inlog->dev_offt; write_leaf_args.key_value_buf = (char *)curr_key->kv_inlog; write_leaf_args.key_value_size = kv_size; write_leaf_args.level_id = cursor->level_id; write_leaf_args.kv_format = KV_PREFIX; write_leaf_args.cat = curr_key->kv_category; write_leaf_args.tombstone = curr_key->tombstone; break; default: log_fatal("Unknown key_type (IN_PLACE,IN_LOG) instead got %u", curr_key->kv_type); BUG_ON(); } if (write_leaf_args.cat == MEDIUM_INLOG && write_leaf_args.level_id == cursor->handle->db_desc->level_medium_inplace) { write_leaf_args.key_value_buf = fetch_kv_from_LRU(&write_leaf_args, cursor); assert(KEY_SIZE(write_leaf_args.key_value_buf) < MAX_KEY_SIZE); write_leaf_args.cat = MEDIUM_INPLACE; kv_size = sizeof(uint32_t) + KEY_SIZE(write_leaf_args.key_value_buf); kv_size += VALUE_SIZE(write_leaf_args.key_value_buf + kv_size) + sizeof(uint32_t); write_leaf_args.key_value_size = kv_size; curr_key->kv_type = KV_INPLACE; curr_key->kv_category = MEDIUM_INPLACE; curr_key->kv_inplace = write_leaf_args.key_value_buf; write_leaf_args.kv_format = KV_FORMAT; #if MEASURE_MEDIUM_INPLACE __sync_fetch_and_add(&cursor->handle->db_desc->count_medium_inplace, 1); #endif } struct split_level_leaf split_metadata = { .leaf = cursor->last_leaf, .leaf_size = level_leaf_size, .kv_size = kv_size, .level_id = cursor->level_id, .key_type = curr_key->kv_type, .cat = curr_key->kv_category, .level_medium_inplace = cursor->handle->db_desc->level_medium_inplace }; int new_leaf = 0; if (is_dynamic_leaf_full(split_metadata)) { // log_info("Time for a split!"); /*keep current aka left leaf offt*/ uint32_t offt_l = comp_calc_offt_in_seg(cursor->segment_buf[0], (char *)cursor->last_leaf); left_leaf_offt = cursor->last_segment_btree_level_offt[0] + offt_l; comp_get_space(cursor, 0, leafNode); /*last leaf updated*/ uint32_t offt_r = comp_calc_offt_in_seg(cursor->segment_buf[0], (char *)cursor->last_leaf); right_leaf_offt = cursor->last_segment_btree_level_offt[0] + offt_r; new_leaf = 1; } write_leaf_args.leaf = cursor->last_leaf; write_leaf_args.dest = get_leaf_log_offset(cursor->last_leaf, level_leaf_size); write_leaf_args.middle = cursor->last_leaf->header.num_entries; write_data_in_dynamic_leaf(&write_leaf_args); // just append and leave ++cursor->last_leaf->header.num_entries; #if ENABLE_BLOOM_FILTERS // TODO XXX #endif // TODO SIZE cursor->handle->db_desc->levels[cursor->level_id].level_size[1] += write_leaf_args.key_value_size; if (new_leaf) { // log_info("keys are %llu for level %u", // c->handle->db_desc->levels[c->level_id].level_size[1], // c->level_id); if (append_to_medium_log) comp_append_pivot_to_index(1, cursor, left_leaf_offt, (struct pivot_key *)kv->kv_inplace, right_leaf_offt); else { switch (write_leaf_args.kv_format) { case KV_FORMAT: comp_append_pivot_to_index(1, cursor, left_leaf_offt, (struct pivot_key *)write_leaf_args.key_value_buf, right_leaf_offt); break; case KV_PREFIX: if (cursor->level_id == 1 && curr_key->kv_category == MEDIUM_INPLACE) comp_append_pivot_to_index(1, cursor, left_leaf_offt, (struct pivot_key *)curr_key->kv_inplace, right_leaf_offt); else { // do a page fault to find the pivot char *pivot_addr = (char *)curr_key->kv_inlog->dev_offt; comp_append_pivot_to_index(1, cursor, left_leaf_offt, (struct pivot_key *)pivot_addr, right_leaf_offt); } break; } } } } struct compaction_request { db_descriptor *db_desc; volume_descriptor *volume_desc; uint64_t l0_start; uint64_t l0_end; uint8_t src_level; uint8_t src_tree; uint8_t dst_level; uint8_t dst_tree; }; void mark_segment_space(db_handle *handle, struct dups_list *list, uint8_t level_id, uint8_t tree_id) { struct dups_node *list_iter; struct dups_list *calculate_diffs; struct large_log_segment_gc_entry *temp_segment_entry; uint64_t segment_dev_offt; calculate_diffs = init_dups_list(); MUTEX_LOCK(&handle->db_desc->segment_ht_lock); for (list_iter = list->head; list_iter; list_iter = list_iter->next) { segment_dev_offt = ABSOLUTE_ADDRESS(list_iter->dev_offt); struct large_log_segment_gc_entry *search_segment; HASH_FIND(hh, handle->db_desc->segment_ht, &segment_dev_offt, sizeof(segment_dev_offt), search_segment); assert(list_iter->kv_size > 0); if (search_segment) { // If the segment is already in the hash table just increase the garbage bytes. search_segment->garbage_bytes += list_iter->kv_size; assert(search_segment->garbage_bytes < SEGMENT_SIZE); } else { // This is the first time we detect garbage bytes in this segment, // allocate a node and insert it in the hash table. temp_segment_entry = calloc(1, sizeof(struct large_log_segment_gc_entry)); temp_segment_entry->segment_dev_offt = segment_dev_offt; temp_segment_entry->garbage_bytes = list_iter->kv_size; temp_segment_entry->segment_moved = 0; HASH_ADD(hh, handle->db_desc->segment_ht, segment_dev_offt, sizeof(temp_segment_entry->segment_dev_offt), temp_segment_entry); } struct dups_node *node = find_element(calculate_diffs, segment_dev_offt); if (node) node->kv_size += list_iter->kv_size; else append_node(calculate_diffs, segment_dev_offt, list_iter->kv_size); } MUTEX_UNLOCK(&handle->db_desc->segment_ht_lock); for (struct dups_node *persist_blob_metadata = calculate_diffs->head; persist_blob_metadata; persist_blob_metadata = persist_blob_metadata->next) { uint64_t txn_id = handle->db_desc->levels[level_id].allocation_txn_id[tree_id]; struct rul_log_entry entry = { .dev_offt = persist_blob_metadata->dev_offt, .txn_id = txn_id, .op_type = BLOB_GARBAGE_BYTES, .blob_garbage_bytes = persist_blob_metadata->kv_size }; rul_add_entry_in_txn_buf(handle->db_desc, &entry); } } static void *compaction(void *_comp_req); void *compaction_daemon(void *args) { struct db_handle *handle = (struct db_handle *)args; struct db_descriptor *db_desc = handle->db_desc; struct compaction_request *comp_req = NULL; pthread_setname_np(pthread_self(), "compactiond"); int next_L0_tree_to_compact = 0; while (1) { /*special care for Level 0 to 1*/ sem_wait(&db_desc->compaction_daemon_interrupts); if (db_desc->stat == DB_TERMINATE_COMPACTION_DAEMON) { log_warn("Compaction daemon instructed to exit because DB %s is closing, " "Bye bye!...", db_desc->db_superblock->db_name); db_desc->stat = DB_IS_CLOSING; return NULL; } struct level_descriptor *level_0 = &handle->db_desc->levels[0]; struct level_descriptor *src_level = &handle->db_desc->levels[1]; int L0_tree = next_L0_tree_to_compact; // is level-0 full and not already compacting? if (level_0->tree_status[L0_tree] == NO_COMPACTION && level_0->level_size[L0_tree] >= level_0->max_level_size) { // Can I issue a compaction to L1? int L1_tree = 0; if (src_level->tree_status[L1_tree] == NO_COMPACTION && src_level->level_size[L1_tree] < src_level->max_level_size) { /*mark them as compacting L0*/ level_0->tree_status[L0_tree] = COMPACTION_IN_PROGRESS; /*mark them as compacting L1*/ src_level->tree_status[L1_tree] = COMPACTION_IN_PROGRESS; /*start a compaction*/ comp_req = (struct compaction_request *)calloc(1, sizeof(struct compaction_request)); assert(comp_req); comp_req->db_desc = handle->db_desc; comp_req->volume_desc = handle->volume_desc; comp_req->src_level = 0; comp_req->src_tree = L0_tree; comp_req->dst_level = 1; comp_req->dst_tree = 1; if (++next_L0_tree_to_compact >= NUM_TREES_PER_LEVEL) next_L0_tree_to_compact = 0; } } /*can I set a different active tree for L0*/ int active_tree = db_desc->levels[0].active_tree; if (db_desc->levels[0].tree_status[active_tree] == COMPACTION_IN_PROGRESS) { int next_active_tree = active_tree != (NUM_TREES_PER_LEVEL - 1) ? active_tree + 1 : 0; if (db_desc->levels[0].tree_status[next_active_tree] == NO_COMPACTION) { /*Acquire guard lock and wait writers to finish*/ if (RWLOCK_WRLOCK(&db_desc->levels[0].guard_of_level.rx_lock)) { log_fatal("Failed to acquire guard lock"); BUG_ON(); } spin_loop(&(db_desc->levels[0].active_operations), 0); /*fill L0 recovery log info*/ db_desc->small_log_start_segment_dev_offt = db_desc->small_log.tail_dev_offt; db_desc->small_log_start_offt_in_segment = db_desc->small_log.size % SEGMENT_SIZE; /*fill big log recovery info*/ db_desc->big_log_start_segment_dev_offt = db_desc->big_log.tail_dev_offt; db_desc->big_log_start_offt_in_segment = db_desc->big_log.size % SEGMENT_SIZE; /*done now atomically change active tree*/ db_desc->levels[0].active_tree = next_active_tree; db_desc->levels[0].scanner_epoch += 1; db_desc->levels[0].epoch[active_tree] = db_desc->levels[0].scanner_epoch; log_info("Next active tree %u for L0 of DB: %s", next_active_tree, db_desc->db_superblock->db_name); /*Acquire a new transaction id for the next_active_tree*/ db_desc->levels[0].allocation_txn_id[next_active_tree] = rul_start_txn(db_desc); /*Release guard lock*/ if (RWLOCK_UNLOCK(&db_desc->levels[0].guard_of_level.rx_lock)) { log_fatal("Failed to acquire guard lock"); BUG_ON(); } MUTEX_LOCK(&db_desc->client_barrier_lock); if (pthread_cond_broadcast(&db_desc->client_barrier) != 0) { log_fatal("Failed to wake up stopped clients"); BUG_ON(); } MUTEX_UNLOCK(&db_desc->client_barrier_lock); } } if (comp_req) { /*Start a compaction from L0 to L1. Flush L0 prior to compaction from L0 to L1*/ log_info("Flushing L0 for region:%s tree:[0][%u]", db_desc->db_superblock->db_name, comp_req->src_tree); pr_flush_L0(db_desc, comp_req->src_tree); db_desc->levels[1].allocation_txn_id[1] = rul_start_txn(db_desc); comp_req->dst_tree = 1; assert(db_desc->levels[0].root_w[comp_req->src_tree] != NULL || db_desc->levels[0].root_r[comp_req->src_tree] != NULL); if (pthread_create(&db_desc->levels[0].compaction_thread[comp_req->src_tree], NULL, compaction, comp_req) != 0) { log_fatal("Failed to start compaction"); BUG_ON(); } comp_req = NULL; } // rest of levels for (int level_id = 1; level_id < MAX_LEVELS - 1; ++level_id) { src_level = &db_desc->levels[level_id]; struct level_descriptor *dst_level = &db_desc->levels[level_id + 1]; uint8_t tree_1 = 0; if (src_level->tree_status[tree_1] == NO_COMPACTION && src_level->level_size[tree_1] >= src_level->max_level_size) { uint8_t tree_2 = 0; if (dst_level->tree_status[tree_2] == NO_COMPACTION && dst_level->level_size[tree_2] < dst_level->max_level_size) { src_level->tree_status[tree_1] = COMPACTION_IN_PROGRESS; dst_level->tree_status[tree_2] = COMPACTION_IN_PROGRESS; /*start a compaction*/ struct compaction_request *comp_req_p = (struct compaction_request *)calloc( 1, sizeof(struct compaction_request)); assert(comp_req_p); comp_req_p->db_desc = db_desc; comp_req_p->volume_desc = handle->volume_desc; comp_req_p->src_level = level_id; comp_req_p->src_tree = tree_1; comp_req_p->dst_level = level_id + 1; comp_req_p->dst_tree = 1; /*Acquire a txn_id for the allocations of the compaction*/ db_desc->levels[comp_req_p->dst_level].allocation_txn_id[comp_req_p->dst_tree] = rul_start_txn(db_desc); assert(db_desc->levels[level_id].root_w[0] != NULL || db_desc->levels[level_id].root_r[0] != NULL); if (pthread_create(&db_desc->levels[comp_req_p->dst_level] .compaction_thread[comp_req_p->dst_tree], NULL, compaction, comp_req_p) != 0) { log_fatal("Failed to start compaction"); BUG_ON(); } } } } } } static void swap_levels(struct level_descriptor *src, struct level_descriptor *dst, int src_active_tree, int dst_active_tree) { dst->first_segment[dst_active_tree] = src->first_segment[src_active_tree]; src->first_segment[src_active_tree] = NULL; dst->last_segment[dst_active_tree] = src->last_segment[src_active_tree]; src->last_segment[src_active_tree] = NULL; dst->offset[dst_active_tree] = src->offset[src_active_tree]; src->offset[src_active_tree] = 0; dst->level_size[dst_active_tree] = src->level_size[src_active_tree]; src->level_size[src_active_tree] = 0; while (!__sync_bool_compare_and_swap(&dst->root_w[dst_active_tree], dst->root_w[dst_active_tree], src->root_w[src_active_tree])) { } // dst->root_w[dst_active_tree] = src->root_w[src_active_tree]; src->root_w[src_active_tree] = NULL; while (!__sync_bool_compare_and_swap(&dst->root_r[dst_active_tree], dst->root_r[dst_active_tree], src->root_r[src_active_tree])) { } // dst->root_r[dst_active_tree] = src->root_r[src_active_tree]; src->root_r[src_active_tree] = NULL; return; } static void comp_fill_heap_node(struct compaction_request *comp_req, struct comp_level_read_cursor *cur, struct sh_heap_node *nd) { nd->level_id = cur->level_id; nd->active_tree = comp_req->src_tree; nd->cat = cur->category; nd->tombstone = cur->cursor_key.tombstone; switch (nd->cat) { case SMALL_INPLACE: case MEDIUM_INPLACE: nd->type = KV_FORMAT; nd->KV = cur->cursor_key.kv_inplace; nd->kv_size = sizeof(uint32_t) + KEY_SIZE(nd->KV); nd->kv_size += VALUE_SIZE(nd->KV + nd->kv_size) + sizeof(uint32_t); break; case BIG_INLOG: case MEDIUM_INLOG: nd->type = KV_PREFIX; // log_info("Prefix %.12s dev_offt %llu", cur->cursor_key.in_log->prefix, // cur->cursor_key.in_log->device_offt); nd->KV = (char *)cur->cursor_key.kv_inlog; nd->kv_size = sizeof(struct bt_leaf_entry); break; default: log_fatal("UNKNOWN_LOG_CATEGORY"); BUG_ON(); } } static void comp_fill_parallax_key(struct sh_heap_node *nd, struct comp_parallax_key *curr_key) { curr_key->kv_category = nd->cat; curr_key->tombstone = nd->tombstone; assert(nd->KV); switch (nd->cat) { case SMALL_INPLACE: case MEDIUM_INPLACE: curr_key->kv_inplace = nd->KV; curr_key->kv_type = KV_INPLACE; break; case BIG_INLOG: case MEDIUM_INLOG: curr_key->kv_inlog = (struct bt_leaf_entry *)nd->KV; curr_key->kv_type = KV_INLOG; break; default: log_info("Unhandle/Unknown category"); BUG_ON(); } } static void print_heap_node_key(struct sh_heap_node *nd) { switch (nd->cat) { case SMALL_INPLACE: case MEDIUM_INPLACE: log_debug("In place Key is %u:%s", *(uint32_t *)nd->KV, (char *)nd->KV + sizeof(uint32_t)); break; case BIG_INLOG: case MEDIUM_INLOG: log_debug("In log Key prefix is %.12s device offt %lu", (char *)nd->KV, *(uint64_t *)(nd->KV + PREFIX_SIZE)); break; default: log_fatal("Unhandle/Unknown category"); BUG_ON(); } } static void choose_compaction_roots(struct db_handle *handle, struct compaction_request *comp_req, struct compaction_roots *comp_roots) { if (handle->db_desc->levels[comp_req->src_level].root_w[comp_req->src_tree] != NULL) comp_roots->src_root = handle->db_desc->levels[comp_req->src_level].root_w[comp_req->src_tree]; else if (handle->db_desc->levels[comp_req->src_level].root_r[comp_req->src_tree] != NULL) comp_roots->src_root = handle->db_desc->levels[comp_req->src_level].root_r[comp_req->src_tree]; else { log_fatal("NULL src root for compaction from level's tree [%u][%u] to " "level's tree[%u][%u] for db %s", comp_req->src_level, comp_req->src_tree, comp_req->dst_level, comp_req->dst_tree, handle->db_desc->db_superblock->db_name); BUG_ON(); } if (handle->db_desc->levels[comp_req->dst_level].root_w[0] != NULL) comp_roots->dst_root = handle->db_desc->levels[comp_req->dst_level].root_w[0]; else if (handle->db_desc->levels[comp_req->dst_level].root_r[0] != NULL) comp_roots->dst_root = handle->db_desc->levels[comp_req->dst_level].root_r[0]; else { comp_roots->dst_root = NULL; } } static void lock_to_update_levels_after_compaction(struct compaction_request *comp_req) { if (RWLOCK_WRLOCK(&(comp_req->db_desc->levels[comp_req->src_level].guard_of_level.rx_lock))) { log_fatal("Failed to acquire guard lock"); BUG_ON(); } if (RWLOCK_WRLOCK(&(comp_req->db_desc->levels[comp_req->dst_level].guard_of_level.rx_lock))) { log_fatal("Failed to acquire guard lock"); BUG_ON(); } spin_loop(&comp_req->db_desc->levels[comp_req->src_level].active_operations, 0); spin_loop(&comp_req->db_desc->levels[comp_req->dst_level].active_operations, 0); } static void unlock_to_update_levels_after_compaction(struct compaction_request *comp_req) { if (RWLOCK_UNLOCK(&(comp_req->db_desc->levels[comp_req->src_level].guard_of_level.rx_lock))) { log_fatal("Failed to acquire guard lock"); BUG_ON(); } if (RWLOCK_UNLOCK(&(comp_req->db_desc->levels[comp_req->dst_level].guard_of_level.rx_lock))) { log_fatal("Failed to acquire guard lock"); BUG_ON(); } } static void compact_level_direct_IO(struct db_handle *handle, struct compaction_request *comp_req) { struct compaction_roots comp_roots = { .src_root = NULL, .dst_root = NULL }; choose_compaction_roots(handle, comp_req, &comp_roots); /*used for L0 only as src*/ struct level_scanner *level_src = NULL; struct comp_level_read_cursor *l_src = NULL; struct comp_level_read_cursor *l_dst = NULL; struct comp_level_write_cursor *merged_level = NULL; if (comp_req->src_level == 0) { RWLOCK_WRLOCK(&handle->db_desc->levels[0].guard_of_level.rx_lock); spin_loop(&handle->db_desc->levels[0].active_operations, 0); pr_flush_log_tail(comp_req->db_desc, &comp_req->db_desc->big_log); #if MEDIUM_LOG_UNSORTED pr_flush_log_tail(comp_req->db_desc, &comp_req->db_desc->medium_log); #endif RWLOCK_UNLOCK(&handle->db_desc->levels[0].guard_of_level.rx_lock); log_debug("Initializing L0 scanner"); level_src = _init_compaction_buffer_scanner(handle, comp_req->src_level, comp_roots.src_root, NULL); } else { if (posix_memalign((void **)&l_src, ALIGNMENT, sizeof(struct comp_level_read_cursor)) != 0) { log_fatal("Posix memalign failed"); perror("Reason: "); BUG_ON(); } comp_init_read_cursor(l_src, handle, comp_req->src_level, 0, FD); comp_get_next_key(l_src); assert(!l_src->end_of_level); } if (comp_roots.dst_root) { if (posix_memalign((void **)&l_dst, ALIGNMENT, sizeof(struct comp_level_read_cursor)) != 0) { log_fatal("Posix memalign failed"); perror("Reason: "); BUG_ON(); } comp_init_read_cursor(l_dst, handle, comp_req->dst_level, 0, FD); comp_get_next_key(l_dst); assert(!l_dst->end_of_level); } log_debug("Initializing write cursor for level %u", comp_req->dst_level); if (posix_memalign((void **)&merged_level, ALIGNMENT, sizeof(struct comp_level_write_cursor)) != 0) { log_fatal("Posix memalign failed"); perror("Reason: "); BUG_ON(); } assert(0 == handle->db_desc->levels[comp_req->dst_level].offset[comp_req->dst_tree]); comp_init_write_cursor(merged_level, handle, comp_req->dst_level, FD); //initialize LRU cache for storing chunks of segments when medium log goes in place if (merged_level->level_id == handle->db_desc->level_medium_inplace) merged_level->medium_log_LRU_cache = init_LRU(); log_debug("Src [%u][%u] size = %lu", comp_req->src_level, comp_req->src_tree, handle->db_desc->levels[comp_req->src_level].level_size[comp_req->src_tree]); if (comp_roots.dst_root) log_debug("Dst [%u][%u] size = %lu", comp_req->dst_level, 0, handle->db_desc->levels[comp_req->dst_level].level_size[0]); else log_debug("Empty dst [%u][%u]", comp_req->dst_level, 0); // initialize and fill min_heap properly struct sh_heap *m_heap = sh_alloc_heap(); sh_init_heap(m_heap, comp_req->src_level, MIN_HEAP); struct sh_heap_node nd_src = { .KV = NULL, .level_id = 0, .active_tree = 0, .duplicate = 0, .type = KV_PREFIX }; struct sh_heap_node nd_dst = { .KV = NULL, .level_id = 0, .active_tree = 0, .duplicate = 0, .type = KV_PREFIX }; struct sh_heap_node nd_min = { .KV = NULL, .level_id = 0, .active_tree = 0, .duplicate = 0, .type = KV_PREFIX }; // init Li cursor if (level_src) { nd_src.KV = level_src->keyValue; nd_src.level_id = comp_req->src_level; nd_src.type = level_src->kv_format; nd_src.cat = level_src->cat; nd_src.kv_size = level_src->kv_size; nd_src.tombstone = level_src->tombstone; nd_src.active_tree = comp_req->src_tree; log_debug("Initializing heap from SRC L0"); } else { log_debug("Initializing heap from SRC read cursor level %u with key:", comp_req->src_level); comp_fill_heap_node(comp_req, l_src, &nd_src); } print_heap_node_key(&nd_src); nd_src.db_desc = comp_req->db_desc; sh_insert_heap_node(m_heap, &nd_src); // init Li+1 cursor (if any) if (l_dst) { comp_fill_heap_node(comp_req, l_dst, &nd_dst); log_debug("Initializing heap from DST read cursor level %u", comp_req->dst_level); print_heap_node_key(&nd_dst); nd_dst.db_desc = comp_req->db_desc; sh_insert_heap_node(m_heap, &nd_dst); } // ############################################################################ enum sh_heap_status stat = GOT_HEAP; do { // TODO: Remove dirty handle->db_desc->dirty = 0x01; // This is to synchronize compactions with flush RWLOCK_RDLOCK(&handle->db_desc->levels[comp_req->dst_level].guard_of_level.rx_lock); stat = sh_remove_top(m_heap, &nd_min); if (stat == EMPTY_HEAP) { RWLOCK_UNLOCK(&handle->db_desc->levels[comp_req->dst_level].guard_of_level.rx_lock); break; } if (!nd_min.duplicate) { struct comp_parallax_key key; memset(&key, 0, sizeof(key)); comp_fill_parallax_key(&nd_min, &key); comp_append_entry_to_leaf_node(merged_level, &key); } // log_info("level size // %llu",comp_req->db_desc->levels[comp_req->dst_level].level_size[comp_req->dst_tree]); /*refill from the appropriate level*/ if (nd_min.level_id == comp_req->src_level) { if (nd_min.level_id == 0) { if (level_scanner_get_next(level_src) != END_OF_DATABASE) { // log_info("Refilling from L0"); nd_min.KV = level_src->keyValue; nd_min.level_id = comp_req->src_level; nd_min.type = level_src->kv_format; nd_min.cat = level_src->cat; nd_min.tombstone = level_src->tombstone; nd_min.kv_size = level_src->kv_size; nd_min.active_tree = comp_req->src_tree; nd_min.db_desc = comp_req->db_desc; sh_insert_heap_node(m_heap, &nd_min); } } else { comp_get_next_key(l_src); if (!l_src->end_of_level) { comp_fill_heap_node(comp_req, l_src, &nd_min); // log_info("Refilling from SRC level read cursor"); nd_min.db_desc = comp_req->db_desc; sh_insert_heap_node(m_heap, &nd_min); } } } else if (l_dst) { comp_get_next_key(l_dst); if (!l_dst->end_of_level) { comp_fill_heap_node(comp_req, l_dst, &nd_min); // log_info("Refilling from DST level read cursor key is %s", // nd_min.KV + 4); nd_min.db_desc = comp_req->db_desc; sh_insert_heap_node(m_heap, &nd_min); } } RWLOCK_UNLOCK(&handle->db_desc->levels[comp_req->dst_level].guard_of_level.rx_lock); } while (stat != EMPTY_HEAP); if (level_src) _close_compaction_buffer_scanner(level_src); else free(l_src); if (comp_roots.dst_root) free(l_dst); mark_segment_space(handle, m_heap->dups, comp_req->dst_level, 1); comp_close_write_cursor(merged_level); sh_destroy_heap(m_heap); merged_level->handle->db_desc->levels[comp_req->dst_level].root_w[1] = (struct node_header *)REAL_ADDRESS(merged_level->root_offt); assert(merged_level->handle->db_desc->levels[comp_req->dst_level].root_w[1]->type == rootNode); if (merged_level->level_id == handle->db_desc->level_medium_inplace) { comp_medium_log_set_max_segment_id(merged_level); destroy_LRU(merged_level->medium_log_LRU_cache); } free(merged_level); /***************************************************************/ struct level_descriptor *ld = &comp_req->db_desc->levels[comp_req->dst_level]; struct db_handle hd = { .db_desc = comp_req->db_desc, .volume_desc = comp_req->volume_desc }; lock_to_update_levels_after_compaction(comp_req); uint64_t space_freed = 0; /*Free L_(i+1)*/ if (l_dst) { uint64_t txn_id = comp_req->db_desc->levels[comp_req->dst_level].allocation_txn_id[comp_req->dst_tree]; /*free dst (L_i+1) level*/ space_freed = seg_free_level(comp_req->db_desc, txn_id, comp_req->dst_level, 0); log_debug("Freed space %lu MB from db:%s destination level %u", space_freed / (1024 * 1024L), comp_req->db_desc->db_superblock->db_name, comp_req->dst_level); } /*Free and zero L_i*/ uint64_t txn_id = comp_req->db_desc->levels[comp_req->dst_level].allocation_txn_id[comp_req->dst_tree]; space_freed = seg_free_level(hd.db_desc, txn_id, comp_req->src_level, comp_req->src_tree); log_debug("Freed space %lu MB from db:%s source level %u", space_freed / (1024 * 1024L), comp_req->db_desc->db_superblock->db_name, comp_req->src_level); seg_zero_level(hd.db_desc, comp_req->src_level, comp_req->src_tree); #if ENABLE_BLOOM_FILTERS if (dst_root) { log_debug("Freeing previous bloom filter for dst level %u", comp_req->dst_level); bloom_free(&handle.db_desc->levels[comp_req->src_level].bloom_filter[0]); } ld->bloom_filter[0] = ld->bloom_filter[1]; memset(&ld->bloom_filter[1], 0x00, sizeof(struct bloom)); #endif #if !MEDIUM_LOG_UNSORTED if (comp_req->dst_level == 1) { log_info("Flushing medium log"); pr_flush_log_tail(comp_req->db_desc, &comp_req->db_desc->medium_log); } #endif /*Finally persist compaction */ pr_flush_compaction(comp_req->db_desc, comp_req->dst_level, comp_req->dst_tree); log_debug("Flushed compaction[%u][%u] successfully", comp_req->dst_level, comp_req->dst_tree); /*set L'_(i+1) as L_(i+1)*/ ld->first_segment[0] = ld->first_segment[1]; ld->first_segment[1] = NULL; ld->last_segment[0] = ld->last_segment[1]; ld->last_segment[1] = NULL; ld->offset[0] = ld->offset[1]; ld->offset[1] = 0; if (ld->root_w[1] != NULL) ld->root_r[0] = ld->root_w[1]; else if (ld->root_r[1] != NULL) ld->root_r[0] = ld->root_r[1]; else { log_fatal("Where is the root?"); BUG_ON(); } ld->root_w[0] = NULL; ld->level_size[0] = ld->level_size[1]; ld->level_size[1] = 0; ld->root_w[1] = NULL; ld->root_r[1] = NULL; unlock_to_update_levels_after_compaction(comp_req); } static void compact_with_empty_destination_level(struct compaction_request *comp_req) { log_debug("Empty level %d time for an optimization :-)", comp_req->dst_level); lock_to_update_levels_after_compaction(comp_req); struct level_descriptor *leveld_src = &comp_req->db_desc->levels[comp_req->src_level]; struct level_descriptor *leveld_dst = &comp_req->db_desc->levels[comp_req->dst_level]; swap_levels(leveld_src, leveld_dst, comp_req->src_tree, 1); pr_flush_compaction(comp_req->db_desc, comp_req->dst_level, comp_req->dst_tree); swap_levels(leveld_dst, leveld_dst, 1, 0); log_debug("Flushed compaction (Swap levels) successfully from src[%u][%u] to dst[%u][%u]", comp_req->src_level, comp_req->src_tree, comp_req->dst_level, comp_req->dst_tree); #if ENABLE_BLOOM_FILTERS log_info("Swapping also bloom filter"); leveld_dst->bloom_filter[0] = leveld_src->bloom_filter[0]; memset(&leveld_src->bloom_filter[0], 0x00, sizeof(struct bloom)); #endif unlock_to_update_levels_after_compaction(comp_req); log_debug("Swapped levels %d to %d successfully", comp_req->src_level, comp_req->dst_level); log_debug("After swapping src tree[%d][%d] size is %lu", comp_req->src_level, 0, leveld_src->level_size[0]); log_debug("After swapping dst tree[%d][%d] size is %lu", comp_req->dst_level, 0, leveld_dst->level_size[0]); assert(leveld_dst->first_segment != NULL); } void *compaction(void *_comp_req) { db_handle handle; struct compaction_request *comp_req = (struct compaction_request *)_comp_req; db_descriptor *db_desc = comp_req->db_desc; pthread_setname_np(pthread_self(), "comp_thread"); log_info("starting compaction from level's tree [%u][%u] to level's tree[%u][%u]", comp_req->src_level, comp_req->src_tree, comp_req->dst_level, comp_req->dst_tree); /*Initialize a scan object*/ handle.db_desc = comp_req->db_desc; handle.volume_desc = comp_req->volume_desc; // optimization check if level below is empty struct node_header *dst_root = NULL; if (handle.db_desc->levels[comp_req->dst_level].root_w[0] != NULL) dst_root = handle.db_desc->levels[comp_req->dst_level].root_w[0]; else if (handle.db_desc->levels[comp_req->dst_level].root_r[0] != NULL) dst_root = handle.db_desc->levels[comp_req->dst_level].root_r[0]; else { dst_root = NULL; } if (comp_req->src_level == 0 || comp_req->dst_level == handle.db_desc->level_medium_inplace || dst_root) compact_level_direct_IO(&handle, comp_req); else compact_with_empty_destination_level(comp_req); log_debug("DONE Compaction from level's tree [%u][%u] to level's tree[%u][%u] " "cleaning src level", comp_req->src_level, comp_req->src_tree, comp_req->dst_level, comp_req->dst_tree); db_desc->levels[comp_req->src_level].tree_status[comp_req->src_tree] = NO_COMPACTION; db_desc->levels[comp_req->dst_level].tree_status[0] = NO_COMPACTION; /*wake up clients*/ if (comp_req->src_level == 0) { log_info("src level %d dst level %d src_tree %d dst_tree %d", comp_req->src_level, comp_req->dst_level, comp_req->src_tree, comp_req->dst_tree); MUTEX_LOCK(&comp_req->db_desc->client_barrier_lock); if (pthread_cond_broadcast(&db_desc->client_barrier) != 0) { log_fatal("Failed to wake up stopped clients"); BUG_ON(); } } MUTEX_UNLOCK(&db_desc->client_barrier_lock); sem_post(&db_desc->compaction_daemon_interrupts); free(comp_req); return NULL; }
36.056854
117
0.720488
[ "object" ]
b92e82492194c73013b9aba760a1738edabe766c
11,453
h
C
src/voglcore/vogl_dxt_image.h
apportable/vogl
4f05918a14ba3c4efc3cbd8b05b6964e625c751b
[ "MIT" ]
5
2016-07-23T00:33:31.000Z
2020-12-18T09:40:35.000Z
src/voglcore/vogl_dxt_image.h
LunarG/vogl
172a86d9c4ee08dccbf4e342caa1ba63f1ea2b0e
[ "MIT" ]
null
null
null
src/voglcore/vogl_dxt_image.h
LunarG/vogl
172a86d9c4ee08dccbf4e342caa1ba63f1ea2b0e
[ "MIT" ]
null
null
null
/************************************************************************** * * Copyright 2013-2014 RAD Game Tools and Valve Software * Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **************************************************************************/ // File: vogl_dxt_image.h #pragma once #include "vogl_core.h" #include "vogl_dxt1.h" #include "vogl_dxt5a.h" #include "vogl_image.h" #include "vogl_rg_etc1.h" #define VOGL_SUPPORT_ATI_COMPRESS 0 namespace vogl { class task_pool; class dxt_image { public: dxt_image(); dxt_image(const dxt_image &other); dxt_image &operator=(const dxt_image &rhs); void clear(); inline bool is_valid() const { return m_blocks_x > 0; } uint get_width() const { return m_width; } uint get_height() const { return m_height; } uint get_blocks_x() const { return m_blocks_x; } uint get_blocks_y() const { return m_blocks_y; } uint get_total_blocks() const { return m_blocks_x * m_blocks_y; } uint get_elements_per_block() const { return m_num_elements_per_block; } uint get_bytes_per_block() const { return m_bytes_per_block; } dxt_format get_format() const { return m_format; } bool has_color() const { return (m_format == cDXT1) || (m_format == cDXT1A) || (m_format == cDXT3) || (m_format == cDXT5) || (m_format == cETC1); } // Will be pretty slow if the image is DXT1, as this method scans for alpha blocks/selectors. bool has_alpha() const; enum element_type { cUnused = 0, cColorDXT1, // DXT1 color block cAlphaDXT3, // DXT3 alpha block (only) cAlphaDXT5, // DXT5 alpha block (only) cColorETC1, // ETC1 color block }; element_type get_element_type(uint element_index) const { VOGL_ASSERT(element_index < m_num_elements_per_block); return m_element_type[element_index]; } //Returns -1 for RGB, or [0,3] int8 get_element_component_index(uint element_index) const { VOGL_ASSERT(element_index < m_num_elements_per_block); return m_element_component_index[element_index]; } struct element { uint8 m_bytes[8]; uint get_le_word(uint index) const { VOGL_ASSERT(index < 4); return m_bytes[index * 2] | (m_bytes[index * 2 + 1] << 8); } uint get_be_word(uint index) const { VOGL_ASSERT(index < 4); return m_bytes[index * 2 + 1] | (m_bytes[index * 2] << 8); } void set_le_word(uint index, uint val) { VOGL_ASSERT((index < 4) && (val <= cUINT16_MAX)); m_bytes[index * 2] = static_cast<uint8>(val & 0xFF); m_bytes[index * 2 + 1] = static_cast<uint8>((val >> 8) & 0xFF); } void set_be_word(uint index, uint val) { VOGL_ASSERT((index < 4) && (val <= cUINT16_MAX)); m_bytes[index * 2 + 1] = static_cast<uint8>(val & 0xFF); m_bytes[index * 2] = static_cast<uint8>((val >> 8) & 0xFF); } void clear() { memset(this, 0, sizeof(*this)); } }; typedef vogl::vector<element> element_vec; bool init(dxt_format fmt, uint width, uint height, bool clear_elements); bool init(dxt_format fmt, uint width, uint height, uint num_elements, element *pElements, bool create_copy); struct pack_params { pack_params() { clear(); } void clear() { m_quality = cCRNDXTQualityUber; m_perceptual = true; m_dithering = false; m_grayscale_sampling = false; m_use_both_block_types = true; m_endpoint_caching = true; m_compressor = cCRNDXTCompressorCRN; m_pProgress_callback = NULL; m_pProgress_callback_user_data_ptr = NULL; m_dxt1a_alpha_threshold = 128; m_num_helper_threads = 0; m_progress_start = 0; m_progress_range = 100; m_use_transparent_indices_for_black = false; m_pTask_pool = NULL; m_color_weights[0] = 1; m_color_weights[1] = 1; m_color_weights[2] = 1; } void init(const vogl_comp_params &params) { m_perceptual = (params.m_flags & cCRNCompFlagPerceptual) != 0; m_num_helper_threads = params.m_num_helper_threads; m_use_both_block_types = (params.m_flags & cCRNCompFlagUseBothBlockTypes) != 0; m_use_transparent_indices_for_black = (params.m_flags & cCRNCompFlagUseTransparentIndicesForBlack) != 0; m_dxt1a_alpha_threshold = params.m_dxt1a_alpha_threshold; m_quality = params.m_dxt_quality; m_endpoint_caching = (params.m_flags & cCRNCompFlagDisableEndpointCaching) == 0; m_grayscale_sampling = (params.m_flags & cCRNCompFlagGrayscaleSampling) != 0; m_compressor = params.m_dxt_compressor_type; } uint m_dxt1a_alpha_threshold; uint m_num_helper_threads; vogl_dxt_quality m_quality; vogl_dxt_compressor_type m_compressor; bool m_perceptual; bool m_dithering; bool m_grayscale_sampling; bool m_use_both_block_types; bool m_endpoint_caching; bool m_use_transparent_indices_for_black; typedef bool (*progress_callback_func)(uint percentage_complete, void *pUser_data_ptr); progress_callback_func m_pProgress_callback; void *m_pProgress_callback_user_data_ptr; uint m_progress_start; uint m_progress_range; task_pool *m_pTask_pool; int m_color_weights[3]; }; bool init(dxt_format fmt, const image_u8 &img, const pack_params &p = dxt_image::pack_params()); bool unpack(image_u8 &img) const; void endian_swap(); uint get_total_elements() const { return m_elements.size(); } const element_vec &get_element_vec() const { return m_elements; } element_vec &get_element_vec() { return m_elements; } const element &get_element(uint block_x, uint block_y, uint element_index) const; element &get_element(uint block_x, uint block_y, uint element_index); const element *get_element_ptr() const { return m_pElements; } element *get_element_ptr() { return m_pElements; } uint get_size_in_bytes() const { return m_elements.size() * sizeof(element); } uint get_row_pitch_in_bytes() const { return m_blocks_x * m_bytes_per_block; } color_quad_u8 get_pixel(uint x, uint y) const; uint get_pixel_alpha(uint x, uint y, uint element_index) const; void set_pixel(uint x, uint y, const color_quad_u8 &c, bool perceptual = true); // get_block_pixels() only sets those components stored in the image! bool get_block_pixels(uint block_x, uint block_y, color_quad_u8 *pPixels) const; struct set_block_pixels_context { dxt1_endpoint_optimizer m_dxt1_optimizer; dxt5_endpoint_optimizer m_dxt5_optimizer; }; void set_block_pixels(uint block_x, uint block_y, const color_quad_u8 *pPixels, const pack_params &p, set_block_pixels_context &context); void set_block_pixels(uint block_x, uint block_y, const color_quad_u8 *pPixels, const pack_params &p); void get_block_endpoints(uint block_x, uint block_y, uint element_index, uint &packed_low_endpoint, uint &packed_high_endpoint) const; // Returns a value representing the component(s) that where actually set, where -1 = RGB. // This method does not always set every component! int get_block_endpoints(uint block_x, uint block_y, uint element_index, color_quad_u8 &low_endpoint, color_quad_u8 &high_endpoint, bool scaled = true) const; // pColors should point to a 16 entry array, to handle DXT3. // Returns the number of block colors: 3, 4, 6, 8, or 16. uint get_block_colors(uint block_x, uint block_y, uint element_index, color_quad_u8 *pColors, uint subblock_index = 0); uint get_subblock_index(uint x, uint y, uint element_index) const; uint get_total_subblocks(uint element_index) const; uint get_selector(uint x, uint y, uint element_index) const; void change_dxt1_to_dxt1a(); bool can_flip(uint axis_index); // Returns true if the texture can actually be flipped. bool flip_x(); bool flip_y(); private: element_vec m_elements; element *m_pElements; uint m_width; uint m_height; uint m_blocks_x; uint m_blocks_y; uint m_total_blocks; uint m_total_elements; uint m_num_elements_per_block; // 1 or 2 uint m_bytes_per_block; // 8 or 16 int8 m_element_component_index[2]; element_type m_element_type[2]; dxt_format m_format; // DXT1, 1A, 3, 5, N/3DC, or 5A bool init_internal(dxt_format fmt, uint width, uint height); void init_task(uint64_t data, void *pData_ptr); #if VOGL_SUPPORT_ATI_COMPRESS bool init_ati_compress(dxt_format fmt, const image_u8 &img, const pack_params &p); #endif void flip_col(uint x); void flip_row(uint y); }; } // namespace vogl
33.390671
165
0.595826
[ "vector" ]
b9313a6acf4a241d4fc119c6d8b0030d857a8fe7
11,203
h
C
include/cetty/bootstrap/ServerBootstrap.h
frankee/cetty2
62ac0cd1438275097e47a9ba471e72efd2746ded
[ "BSL-1.0", "Apache-2.0", "BSD-3-Clause" ]
26
2015-11-08T10:58:21.000Z
2021-02-25T08:27:26.000Z
include/cetty/bootstrap/ServerBootstrap.h
frankee/cetty2
62ac0cd1438275097e47a9ba471e72efd2746ded
[ "BSL-1.0", "Apache-2.0", "BSD-3-Clause" ]
1
2019-02-18T08:46:17.000Z
2019-02-18T08:46:17.000Z
include/cetty/bootstrap/ServerBootstrap.h
frankee/cetty2
62ac0cd1438275097e47a9ba471e72efd2746ded
[ "BSL-1.0", "Apache-2.0", "BSD-3-Clause" ]
8
2016-02-27T02:37:10.000Z
2021-09-29T05:25:00.000Z
#if !defined(CETTY_BOOTSTRAP_SERVERBOOTSTRAP_H) #define CETTY_BOOTSTRAP_SERVERBOOTSTRAP_H /* * Copyright 2009 Red Hat, Inc. * * Red Hat 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. */ /* * Copyright (c) 2010-2011 frankee zhou (frankee.zhou at gmail dot com) * Distributed under under the Apache License, version 2.0 (the "License"). */ #include <vector> #include <cetty/channel/Channel.h> #include <cetty/channel/ChannelFuture.h> #include <cetty/channel/InetAddress.h> #include <cetty/channel/ChannelHandlerWrapper.h> #include <cetty/bootstrap/Bootstrap.h> #include <cetty/bootstrap/ServerBootstrapPtr.h> namespace cetty { namespace bootstrap { using namespace cetty::channel; /** * A helper class which creates a new server-side {@link Channel} and accepts * incoming connections. * * <h3>Only for connection oriented transports</h3> * * This bootstrap is for connection oriented transports only such as TCP/IP * and local transport. Use {@link ConnectionlessBootstrap} instead for * connectionless transports. Do not use this helper if you are using a * connectionless transport such as UDP/IP which does not accept an incoming * connection but receives messages by itself without creating a child channel. * * <h3>Parent channel and its children</h3> * * A parent channel is a channel which is supposed to accept incoming * connections. It is created by this bootstrap's {@link ChannelFactory} via * {@link #bind()} and {@link #bind(InetAddress)}. * <p> * Once successfully bound, the parent channel starts to accept incoming * connections, and the accepted connections become the children of the * parent channel. * * <h3>Configuring channels</h3> * * {@link #setOption(std::string, Object) Options} are used to configure both a * parent channel and its child channels. To configure the child channels, * prepend <tt>"child."</tt> prefix to the actual option names of a child * channel: * * <pre> * {@link ServerBootstrap} b = ...; * * // Options for a parent channel * b.setOption("localAddress", new {@link InetInetAddress}(8080)); * b.setOption("reuseAddress", true); * * // Options for its children * b.setOption("child.tcpNoDelay", true); * b.setOption("child.receiveBufferSize", 1048576); * </pre> * * For the detailed list of available options, please refer to * {@link ChannelConfig} and its sub-types. * * <h3>Configuring a parent channel pipeline</h3> * * It is rare to customize the pipeline of a parent channel because what it is * supposed to do is very typical. However, you might want to add a handler * to deal with some special needs such as degrading the process * <a href="http://en.wikipedia.org/wiki/User_identifier_(Unix)">UID</a> from * a <a href="http://en.wikipedia.org/wiki/Superuser">superuser</a> to a * normal user and changing the current VM security manager for better * security. To support such a case, * the {@link #setParentHandler(ChannelHandler) parentHandler} property is * provided. * * <h3>Configuring a child channel pipeline</h3> * * Every channel has its own {@link ChannelPipeline} and you can configure it * in two ways. * * The recommended approach is to specify a {@link ChannelPipelineFactory} by * calling {@link #setPipelineFactory(ChannelPipelineFactory)}. * * <pre> * {@link ServerBootstrap} b = ...; * b.setPipelineFactory(new MyPipelineFactory()); * * public class MyPipelineFactory implements {@link ChannelPipelineFactory} { * public {@link ChannelPipeline} getPipeline() throws Exception { * // Create and configure a new pipeline for a new channel. * {@link ChannelPipeline} p = {@link Channels}.pipeline(); * p.addLast("encoder", new EncodingHandler()); * p.addLast("decoder", new DecodingHandler()); * p.addLast("logic", new LogicHandler()); * return p; * } * } * </pre> * <p> * The alternative approach, which works only in a certain situation, is to use * the default pipeline and let the bootstrap to shallow-copy the default * pipeline for each new channel: * * <pre> * {@link ServerBootstrap} b = ...; * {@link ChannelPipeline} p = b.getPipeline(); * * // Add handlers to the default pipeline. * p.addLast("encoder", new EncodingHandler()); * p.addLast("decoder", new DecodingHandler()); * p.addLast("logic", new LogicHandler()); * </pre> * * Please note 'shallow-copy' here means that the added {@link ChannelHandler}s * are not cloned but only their references are added to the new pipeline. * Therefore, you cannot use this approach if you are going to open more than * one {@link Channel}s or run a server that accepts incoming connections to * create its child channels. * * <h3>Applying different settings for different {@link Channel}s</h3> * * {@link ServerBootstrap} is just a helper class. It neither allocates nor * manages any resources. What manages the resources is the * {@link ChannelFactory} implementation you specified in the constructor of * {@link ServerBootstrap}. Therefore, it is OK to create as many * {@link ServerBootstrap} instances as you want with the same * {@link ChannelFactory} to apply different settings for different * {@link Channel}s. * * * @author <a href="http://gleamynode.net/">Trustin Lee</a> * * @author <a href="mailto:frankee.zhou@gmail.com">Frankee Zhou</a> * * @apiviz.landmark */ class ServerBootstrap : public Bootstrap<ServerBootstrap> { public: ServerBootstrap(); ServerBootstrap(int parentThreadCnt, int childThreadCnt = 0); ServerBootstrap(const EventLoopPoolPtr& pool); ServerBootstrap(const EventLoopPoolPtr& pool, const EventLoopPoolPtr& child); virtual ~ServerBootstrap(); /** * */ bool daemonize() const; ServerBootstrap& setDaemonize(bool daemon); /** * */ const std::string pidFileName() const; ServerBootstrap& setPidFileName(const std::string& fileName); /** * */ const EventLoopPoolPtr& childLoopPool() const; ServerBootstrap& setChildEventLoopPool(const EventLoopPoolPtr& pool); /** * Set the {@link EventLoopPool} for the parent (acceptor) and the child (client). These * {@link EventLoopPool}'s are used to handle all the events and IO for {@link SocketChannel} and * {@link Channel}'s. */ virtual ServerBootstrap& setEventLoopPool(const EventLoopPoolPtr& pool); /** * */ const ChannelOptions& childOptions() const; /** * */ ServerBootstrap& setChildOptions(const ChannelOptions& options); /** * Allow to specify a {@link ChannelOption} which is used for the {@link Channel} instances once they get created * (after the acceptor accepted the {@link Channel}). Use a value of <code>null</code> to remove a previous set * {@link ChannelOption}. */ ServerBootstrap& setChildOption(const ChannelOption& option, const ChannelOption::Variant& value); /** * Return the {@link Channel::Initializer} which set for the child {@link Channel}. */ const PipelineInitializer& childInitializer() const; /** * Set the {@link Channel::Initializer} which is used to initialize the {@link Channel} * after the acceptor accepted. */ ServerBootstrap& setChildInitializer(const PipelineInitializer& initializer); /** * */ ChannelFuturePtr bind(); /** * Creates a new channel which is bound to the local address with only port. * This method is similar to the following code: * * <pre> * {@link ServerBootstrap} b = ...; * b.bind(InetAddress(port)); * </pre> * * @return a new bound channel which accepts incoming connections * if failed to create a new channel and * bind it to the local address, return null ChannelPtr * */ ChannelFuturePtr bind(int port); /** * Creates a new channel which is bound to the ip and port. This method is * similar to the following code: * * <pre> * {@link ServerBootstrap} b = ...; * b.bind(InetAddress(ip, port)); * </pre> * * @return a new bound channel which accepts incoming connections * if failed to create a new channel and * bind it to the local address, return null ChannelPtr * */ ChannelFuturePtr bind(const std::string& ip, int port); /** * Creates a new channel which is bound to the specified local address. * * @return a new bound channel which accepts incoming connections * if failed to create a new channel and * bind it to the local address, return null ChannelPtr */ ChannelFuturePtr bind(const InetAddress& localAddress); virtual void shutdown(); virtual void waitingForExit(); private: ChannelPtr newChannel(); bool initServerChannel(ChannelPipeline& pipeline); private: bool daemonized_; std::string pidFile_; EventLoopPoolPtr childPool_; ChannelOptions childOptions_; PipelineInitializer childInitializer_; }; inline bool ServerBootstrap::daemonize() const { return daemonized_; } inline ServerBootstrap& ServerBootstrap::setDaemonize(bool deamon) { daemonized_ = deamon; return *this; } inline const std::string ServerBootstrap::pidFileName() const { return pidFile_; } inline ServerBootstrap& ServerBootstrap::setPidFileName(const std::string& fileName) { pidFile_ = fileName; return *this; } inline const ChannelOptions& ServerBootstrap::childOptions() const { return childOptions_; } inline ServerBootstrap& ServerBootstrap::setChildOption(const ChannelOption& option, const ChannelOption::Variant& value) { childOptions_.setOption(option, value); return *this; } inline ServerBootstrap& ServerBootstrap::setChildOptions(const ChannelOptions& options) { childOptions_ = options; return *this; } inline const EventLoopPoolPtr& ServerBootstrap::childLoopPool() const { return childPool_; } inline const ServerBootstrap::PipelineInitializer& ServerBootstrap::childInitializer() const { return childInitializer_; } inline ServerBootstrap& ServerBootstrap::setChildEventLoopPool(const EventLoopPoolPtr& pool) { childPool_ = pool; return *this; } inline ServerBootstrap& ServerBootstrap::setChildInitializer( const ServerBootstrap::PipelineInitializer& initializer) { childInitializer_ = initializer; return *this; } } } #endif //#if !defined(CETTY_BOOTSTRAP_SERVERBOOTSTRAP_H) // Local Variables: // mode: c++ // End:
31.293296
117
0.695885
[ "object", "vector" ]
b9381926483d600a5baad86f62d5f4aae2ce815b
23,255
c
C
usr/src/cmd/mdb/i86pc/modules/unix/i86mmu.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
null
null
null
usr/src/cmd/mdb/i86pc/modules/unix/i86mmu.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
null
null
null
usr/src/cmd/mdb/i86pc/modules/unix/i86mmu.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
1
2020-12-30T00:04:16.000Z
2020-12-30T00:04:16.000Z
/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Copyright 2019 Joyent, Inc. */ /* * This part of the file contains the mdb support for dcmds: * ::memseg_list * and walkers for: * memseg - a memseg list walker for ::memseg_list * */ #include <sys/types.h> #include <sys/machparam.h> #include <sys/controlregs.h> #include <sys/mach_mmu.h> #ifdef __xpv #include <sys/hypervisor.h> #endif #include <vm/as.h> #include <mdb/mdb_modapi.h> #include <mdb/mdb_target.h> #include <vm/page.h> #include <vm/hat_i86.h> #define VA_SIGN_BIT (1UL << 47) #define VA_SIGN_EXTEND(va) (((va) ^ VA_SIGN_BIT) - VA_SIGN_BIT) struct pfn2pp { pfn_t pfn; page_t *pp; }; static int do_va2pa(uintptr_t, struct as *, int, physaddr_t *, pfn_t *); static void init_mmu(void); int platform_vtop(uintptr_t addr, struct as *asp, physaddr_t *pap) { if (asp == NULL) return (DCMD_ERR); init_mmu(); if (mmu.num_level == 0) return (DCMD_ERR); return (do_va2pa(addr, asp, 0, pap, NULL)); } /* * ::memseg_list dcmd and walker to implement it. */ /*ARGSUSED*/ int memseg_list(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { struct memseg ms; if (!(flags & DCMD_ADDRSPEC)) { if (mdb_pwalk_dcmd("memseg", "memseg_list", 0, NULL, 0) == -1) { mdb_warn("can't walk memseg"); return (DCMD_ERR); } return (DCMD_OK); } if (DCMD_HDRSPEC(flags)) mdb_printf("%<u>%?s %?s %?s %?s %?s%</u>\n", "ADDR", "PAGES", "EPAGES", "BASE", "END"); if (mdb_vread(&ms, sizeof (struct memseg), addr) == -1) { mdb_warn("can't read memseg at %#lx", addr); return (DCMD_ERR); } mdb_printf("%0?lx %0?lx %0?lx %0?lx %0?lx\n", addr, ms.pages, ms.epages, ms.pages_base, ms.pages_end); return (DCMD_OK); } /* * walk the memseg structures */ int memseg_walk_init(mdb_walk_state_t *wsp) { if (wsp->walk_addr != 0) { mdb_warn("memseg only supports global walks\n"); return (WALK_ERR); } if (mdb_readvar(&wsp->walk_addr, "memsegs") == -1) { mdb_warn("symbol 'memsegs' not found"); return (WALK_ERR); } wsp->walk_data = mdb_alloc(sizeof (struct memseg), UM_SLEEP); return (WALK_NEXT); } int memseg_walk_step(mdb_walk_state_t *wsp) { int status; if (wsp->walk_addr == 0) { return (WALK_DONE); } if (mdb_vread(wsp->walk_data, sizeof (struct memseg), wsp->walk_addr) == -1) { mdb_warn("failed to read struct memseg at %p", wsp->walk_addr); return (WALK_DONE); } status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data, wsp->walk_cbdata); wsp->walk_addr = (uintptr_t)(((struct memseg *)wsp->walk_data)->next); return (status); } void memseg_walk_fini(mdb_walk_state_t *wsp) { mdb_free(wsp->walk_data, sizeof (struct memseg)); } /* * Now HAT related dcmds. */ static struct hat *khat; /* value of kas.a_hat */ struct hat_mmu_info mmu; uintptr_t kernelbase; /* * stuff for i86xpv images */ static int is_xpv; static uintptr_t mfn_list_addr; /* kernel MFN list address */ uintptr_t xen_virt_start; /* address of mfn_to_pfn[] table */ ulong_t mfn_count; /* number of pfn's in the MFN list */ pfn_t *mfn_list; /* local MFN list copy */ /* * read mmu parameters from kernel */ static void init_mmu(void) { struct as kas; if (mmu.num_level != 0) return; if (mdb_readsym(&mmu, sizeof (mmu), "mmu") == -1) mdb_warn("Can't use HAT information before mmu_init()\n"); if (mdb_readsym(&kas, sizeof (kas), "kas") == -1) mdb_warn("Couldn't find kas - kernel's struct as\n"); if (mdb_readsym(&kernelbase, sizeof (kernelbase), "kernelbase") == -1) mdb_warn("Couldn't find kernelbase\n"); khat = kas.a_hat; /* * Is this a paravirtualized domain image? */ if (mdb_readsym(&mfn_list_addr, sizeof (mfn_list_addr), "mfn_list") == -1 || mdb_readsym(&xen_virt_start, sizeof (xen_virt_start), "xen_virt_start") == -1 || mdb_readsym(&mfn_count, sizeof (mfn_count), "mfn_count") == -1) { mfn_list_addr = 0; } is_xpv = mfn_list_addr != 0; #ifndef _KMDB /* * recreate the local mfn_list */ if (is_xpv) { size_t sz = mfn_count * sizeof (pfn_t); mfn_list = mdb_zalloc(sz, UM_SLEEP); if (mdb_vread(mfn_list, sz, (uintptr_t)mfn_list_addr) == -1) { mdb_warn("Failed to read MFN list\n"); mdb_free(mfn_list, sz); mfn_list = NULL; } } #endif } void free_mmu(void) { #ifdef __xpv if (mfn_list != NULL) mdb_free(mfn_list, mfn_count * sizeof (mfn_t)); #endif } #ifdef __xpv #ifdef _KMDB /* * Convert between MFNs and PFNs. Since we're in kmdb we can go directly * through the machine to phys mapping and the MFN list. */ pfn_t mdb_mfn_to_pfn(mfn_t mfn) { pfn_t pfn; mfn_t tmp; pfn_t *pfn_list; if (mfn_list_addr == 0) return (-(pfn_t)1); pfn_list = (pfn_t *)xen_virt_start; if (mdb_vread(&pfn, sizeof (pfn), (uintptr_t)(pfn_list + mfn)) == -1) return (-(pfn_t)1); if (mdb_vread(&tmp, sizeof (tmp), (uintptr_t)(mfn_list_addr + (pfn * sizeof (mfn_t)))) == -1) return (-(pfn_t)1); if (pfn >= mfn_count || tmp != mfn) return (-(pfn_t)1); return (pfn); } mfn_t mdb_pfn_to_mfn(pfn_t pfn) { mfn_t mfn; init_mmu(); if (mfn_list_addr == 0 || pfn >= mfn_count) return (-(mfn_t)1); if (mdb_vread(&mfn, sizeof (mfn), (uintptr_t)(mfn_list_addr + (pfn * sizeof (mfn_t)))) == -1) return (-(mfn_t)1); return (mfn); } #else /* _KMDB */ /* * Convert between MFNs and PFNs. Since a crash dump doesn't include the * MFN->PFN translation table (it's part of the hypervisor, not our image) * we do the MFN->PFN translation by searching the PFN->MFN (mfn_list) * table, if it's there. */ pfn_t mdb_mfn_to_pfn(mfn_t mfn) { pfn_t pfn; init_mmu(); if (mfn_list == NULL) return (-(pfn_t)1); for (pfn = 0; pfn < mfn_count; ++pfn) { if (mfn_list[pfn] != mfn) continue; return (pfn); } return (-(pfn_t)1); } mfn_t mdb_pfn_to_mfn(pfn_t pfn) { init_mmu(); if (mfn_list == NULL || pfn >= mfn_count) return (-(mfn_t)1); return (mfn_list[pfn]); } #endif /* _KMDB */ static paddr_t mdb_ma_to_pa(uint64_t ma) { pfn_t pfn = mdb_mfn_to_pfn(mmu_btop(ma)); if (pfn == -(pfn_t)1) return (-(paddr_t)1); return (mmu_ptob((paddr_t)pfn) | (ma & (MMU_PAGESIZE - 1))); } #else /* __xpv */ #define mdb_ma_to_pa(ma) (ma) #define mdb_mfn_to_pfn(mfn) (mfn) #define mdb_pfn_to_mfn(pfn) (pfn) #endif /* __xpv */ /* * ::mfntopfn dcmd translates hypervisor machine page number * to physical page number */ /*ARGSUSED*/ int mfntopfn_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { pfn_t pfn; if ((flags & DCMD_ADDRSPEC) == 0) { mdb_warn("MFN missing\n"); return (DCMD_USAGE); } if ((pfn = mdb_mfn_to_pfn((pfn_t)addr)) == -(pfn_t)1) { mdb_warn("Invalid mfn %lr\n", (pfn_t)addr); return (DCMD_ERR); } mdb_printf("%lr\n", pfn); return (DCMD_OK); } /* * ::pfntomfn dcmd translates physical page number to * hypervisor machine page number */ /*ARGSUSED*/ int pfntomfn_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { pfn_t mfn; if ((flags & DCMD_ADDRSPEC) == 0) { mdb_warn("PFN missing\n"); return (DCMD_USAGE); } if ((mfn = mdb_pfn_to_mfn((pfn_t)addr)) == -(pfn_t)1) { mdb_warn("Invalid pfn %lr\n", (pfn_t)addr); return (DCMD_ABORT); } mdb_printf("%lr\n", mfn); if (flags & DCMD_LOOP) mdb_set_dot(addr + 1); return (DCMD_OK); } static pfn_t pte2mfn(x86pte_t pte, uint_t level) { pfn_t mfn; if (level > 0 && (pte & PT_PAGESIZE)) mfn = mmu_btop(pte & PT_PADDR_LGPG); else mfn = mmu_btop(pte & PT_PADDR); return (mfn); } static int do_pte_dcmd(int level, uint64_t pte) { static char *attr[] = { "wrback", "wrthru", "uncached", "uncached", "wrback", "wrthru", "wrcombine", "uncached"}; int pat_index = 0; pfn_t mfn; mdb_printf("pte=0x%llr: ", pte); mfn = pte2mfn(pte, level); mdb_printf("%s=0x%lr ", is_xpv ? "mfn" : "pfn", mfn); if (PTE_GET(pte, mmu.pt_nx)) mdb_printf("noexec "); if (PTE_GET(pte, PT_NOCONSIST)) mdb_printf("noconsist "); if (PTE_GET(pte, PT_NOSYNC)) mdb_printf("nosync "); if (PTE_GET(pte, mmu.pt_global)) mdb_printf("global "); if (level > 0 && PTE_GET(pte, PT_PAGESIZE)) mdb_printf("largepage "); if (level > 0 && PTE_GET(pte, PT_MOD)) mdb_printf("mod "); if (level > 0 && PTE_GET(pte, PT_REF)) mdb_printf("ref "); if (PTE_GET(pte, PT_USER)) mdb_printf("user "); if (PTE_GET(pte, PT_WRITABLE)) mdb_printf("write "); /* * Report non-standard cacheability */ pat_index = 0; if (level > 0) { if (PTE_GET(pte, PT_PAGESIZE) && PTE_GET(pte, PT_PAT_LARGE)) pat_index += 4; } else { if (PTE_GET(pte, PT_PAT_4K)) pat_index += 4; } if (PTE_GET(pte, PT_NOCACHE)) pat_index += 2; if (PTE_GET(pte, PT_WRITETHRU)) pat_index += 1; if (pat_index != 0) mdb_printf("%s", attr[pat_index]); if (PTE_GET(pte, PT_VALID) == 0) mdb_printf(" !VALID "); mdb_printf("\n"); return (DCMD_OK); } /* * Print a PTE in more human friendly way. The PTE is assumed to be in * a level 0 page table, unless -l specifies another level. */ /*ARGSUSED*/ int pte_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { uint64_t level = 0; init_mmu(); if (mmu.num_level == 0) return (DCMD_ERR); if ((flags & DCMD_ADDRSPEC) == 0) return (DCMD_USAGE); if (mdb_getopts(argc, argv, 'l', MDB_OPT_UINT64, &level, NULL) != argc) return (DCMD_USAGE); if (level > mmu.max_level) { mdb_warn("invalid level %lu\n", level); return (DCMD_ERR); } if (addr == 0) return (DCMD_OK); return (do_pte_dcmd((int)level, addr)); } static size_t va2entry(htable_t *htable, uintptr_t addr) { size_t entry = (addr - htable->ht_vaddr); entry >>= mmu.level_shift[htable->ht_level]; return (entry & HTABLE_NUM_PTES(htable) - 1); } static x86pte_t get_pte(hat_t *hat, htable_t *htable, uintptr_t addr) { x86pte_t buf; if (htable->ht_flags & HTABLE_COPIED) { uintptr_t ptr = (uintptr_t)hat->hat_copied_ptes; ptr += va2entry(htable, addr) << mmu.pte_size_shift; return (*(x86pte_t *)ptr); } paddr_t paddr = mmu_ptob((paddr_t)htable->ht_pfn); paddr += va2entry(htable, addr) << mmu.pte_size_shift; if ((mdb_pread(&buf, mmu.pte_size, paddr)) == mmu.pte_size) return (buf); return (0); } static int do_va2pa(uintptr_t addr, struct as *asp, int print_level, physaddr_t *pap, pfn_t *mfnp) { struct as as; struct hat *hatp; struct hat hat; htable_t *ht; htable_t htable; uintptr_t base; int h; int level; int found = 0; x86pte_t pte; physaddr_t paddr; if (asp != NULL) { if (mdb_vread(&as, sizeof (as), (uintptr_t)asp) == -1) { mdb_warn("Couldn't read struct as\n"); return (DCMD_ERR); } hatp = as.a_hat; } else { hatp = khat; } /* * read the hat and its hash table */ if (mdb_vread(&hat, sizeof (hat), (uintptr_t)hatp) == -1) { mdb_warn("Couldn't read struct hat\n"); return (DCMD_ERR); } /* * read the htable hashtable */ for (level = 0; level <= mmu.max_level; ++level) { if (level == TOP_LEVEL(&hat)) base = 0; else base = addr & mmu.level_mask[level + 1]; for (h = 0; h < hat.hat_num_hash; ++h) { if (mdb_vread(&ht, sizeof (htable_t *), (uintptr_t)(hat.hat_ht_hash + h)) == -1) { mdb_warn("Couldn't read htable\n"); return (DCMD_ERR); } for (; ht != NULL; ht = htable.ht_next) { if (mdb_vread(&htable, sizeof (htable_t), (uintptr_t)ht) == -1) { mdb_warn("Couldn't read htable\n"); return (DCMD_ERR); } if (htable.ht_vaddr != base || htable.ht_level != level) continue; pte = get_pte(&hat, &htable, addr); if (print_level) { mdb_printf("\tlevel=%d htable=0x%p " "pte=0x%llr\n", level, ht, pte); } if (!PTE_ISVALID(pte)) { mdb_printf("Address %p is unmapped.\n", addr); return (DCMD_ERR); } if (found) continue; if (PTE_IS_LGPG(pte, level)) paddr = mdb_ma_to_pa(pte & PT_PADDR_LGPG); else paddr = mdb_ma_to_pa(pte & PT_PADDR); paddr += addr & mmu.level_offset[level]; if (pap != NULL) *pap = paddr; if (mfnp != NULL) *mfnp = pte2mfn(pte, level); found = 1; } } } done: if (!found) return (DCMD_ERR); return (DCMD_OK); } int va2pfn_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { uintptr_t addrspace; char *addrspace_str = NULL; int piped = flags & DCMD_PIPE_OUT; pfn_t pfn; pfn_t mfn; int rc; init_mmu(); if (mmu.num_level == 0) return (DCMD_ERR); if (mdb_getopts(argc, argv, 'a', MDB_OPT_STR, &addrspace_str, NULL) != argc) return (DCMD_USAGE); if ((flags & DCMD_ADDRSPEC) == 0) return (DCMD_USAGE); /* * parse the address space */ if (addrspace_str != NULL) addrspace = mdb_strtoull(addrspace_str); else addrspace = 0; rc = do_va2pa(addr, (struct as *)addrspace, !piped, NULL, &mfn); if (rc != DCMD_OK) return (rc); if ((pfn = mdb_mfn_to_pfn(mfn)) == -(pfn_t)1) { mdb_warn("Invalid mfn %lr\n", mfn); return (DCMD_ERR); } if (piped) { mdb_printf("0x%lr\n", pfn); return (DCMD_OK); } mdb_printf("Virtual address 0x%p maps pfn 0x%lr", addr, pfn); if (is_xpv) mdb_printf(" (mfn 0x%lr)", mfn); mdb_printf("\n"); return (DCMD_OK); } /* * Report all hat's that either use PFN as a page table or that map the page. */ static int do_report_maps(pfn_t pfn) { struct hat *hatp; struct hat hat; htable_t *ht; htable_t htable; uintptr_t base; int h; int level; int entry; x86pte_t pte; physaddr_t paddr; size_t len; /* * The hats are kept in a list with khat at the head. */ for (hatp = khat; hatp != NULL; hatp = hat.hat_next) { /* * read the hat and its hash table */ if (mdb_vread(&hat, sizeof (hat), (uintptr_t)hatp) == -1) { mdb_warn("Couldn't read struct hat\n"); return (DCMD_ERR); } /* * read the htable hashtable */ paddr = 0; for (h = 0; h < hat.hat_num_hash; ++h) { if (mdb_vread(&ht, sizeof (htable_t *), (uintptr_t)(hat.hat_ht_hash + h)) == -1) { mdb_warn("Couldn't read htable\n"); return (DCMD_ERR); } for (; ht != NULL; ht = htable.ht_next) { if (mdb_vread(&htable, sizeof (htable_t), (uintptr_t)ht) == -1) { mdb_warn("Couldn't read htable\n"); return (DCMD_ERR); } /* * only report kernel addresses once */ if (hatp != khat && htable.ht_vaddr >= kernelbase) continue; /* * Is the PFN a pagetable itself? */ if (htable.ht_pfn == pfn) { mdb_printf("Pagetable for " "hat=%p htable=%p\n", hatp, ht); continue; } /* * otherwise, examine page mappings */ level = htable.ht_level; if (level > mmu.max_page_level) continue; paddr = mmu_ptob((physaddr_t)htable.ht_pfn); for (entry = 0; entry < HTABLE_NUM_PTES(&htable); ++entry) { base = htable.ht_vaddr + entry * mmu.level_size[level]; /* * only report kernel addresses once */ if (hatp != khat && base >= kernelbase) continue; len = mdb_pread(&pte, mmu.pte_size, paddr + entry * mmu.pte_size); if (len != mmu.pte_size) return (DCMD_ERR); if ((pte & PT_VALID) == 0) continue; if (level == 0 || !(pte & PT_PAGESIZE)) pte &= PT_PADDR; else pte &= PT_PADDR_LGPG; if (mmu_btop(mdb_ma_to_pa(pte)) != pfn) continue; mdb_printf("hat=%p maps addr=%p\n", hatp, (caddr_t)base); } } } } done: return (DCMD_OK); } /* * given a PFN as its address argument, prints out the uses of it */ /*ARGSUSED*/ int report_maps_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { pfn_t pfn; uint_t mflag = 0; init_mmu(); if (mmu.num_level == 0) return (DCMD_ERR); if ((flags & DCMD_ADDRSPEC) == 0) return (DCMD_USAGE); if (mdb_getopts(argc, argv, 'm', MDB_OPT_SETBITS, TRUE, &mflag, NULL) != argc) return (DCMD_USAGE); pfn = (pfn_t)addr; if (mflag) pfn = mdb_mfn_to_pfn(pfn); return (do_report_maps(pfn)); } static int do_ptable_dcmd(pfn_t pfn, uint64_t level) { struct hat *hatp; struct hat hat; htable_t *ht; htable_t htable; uintptr_t base; int h; int entry; uintptr_t pagesize; x86pte_t pte; physaddr_t paddr; size_t len; /* * The hats are kept in a list with khat at the head. */ for (hatp = khat; hatp != NULL; hatp = hat.hat_next) { /* * read the hat and its hash table */ if (mdb_vread(&hat, sizeof (hat), (uintptr_t)hatp) == -1) { mdb_warn("Couldn't read struct hat\n"); return (DCMD_ERR); } /* * read the htable hashtable */ paddr = 0; for (h = 0; h < hat.hat_num_hash; ++h) { if (mdb_vread(&ht, sizeof (htable_t *), (uintptr_t)(hat.hat_ht_hash + h)) == -1) { mdb_warn("Couldn't read htable\n"); return (DCMD_ERR); } for (; ht != NULL; ht = htable.ht_next) { if (mdb_vread(&htable, sizeof (htable_t), (uintptr_t)ht) == -1) { mdb_warn("Couldn't read htable\n"); return (DCMD_ERR); } /* * Is this the PFN for this htable */ if (htable.ht_pfn == pfn) goto found_it; } } } found_it: if (htable.ht_pfn == pfn) { mdb_printf("htable=%p\n", ht); if (level == (uint64_t)-1) { level = htable.ht_level; } else if (htable.ht_level != level) { mdb_warn("htable has level %d but forcing level %lu\n", htable.ht_level, level); } base = htable.ht_vaddr; pagesize = mmu.level_size[level]; } else { if (level == (uint64_t)-1) level = 0; mdb_warn("couldn't find matching htable, using level=%lu, " "base address=0x0\n", level); base = 0; pagesize = mmu.level_size[level]; } paddr = mmu_ptob((physaddr_t)pfn); for (entry = 0; entry < mmu.ptes_per_table; ++entry) { len = mdb_pread(&pte, mmu.pte_size, paddr + entry * mmu.pte_size); if (len != mmu.pte_size) return (DCMD_ERR); if (pte == 0) continue; mdb_printf("[%3d] va=0x%p ", entry, VA_SIGN_EXTEND(base + entry * pagesize)); do_pte_dcmd(level, pte); } done: return (DCMD_OK); } /* * Dump the page table at the given PFN */ /*ARGSUSED*/ int ptable_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { pfn_t pfn; uint_t mflag = 0; uint64_t level = (uint64_t)-1; init_mmu(); if (mmu.num_level == 0) return (DCMD_ERR); if ((flags & DCMD_ADDRSPEC) == 0) return (DCMD_USAGE); if (mdb_getopts(argc, argv, 'm', MDB_OPT_SETBITS, TRUE, &mflag, 'l', MDB_OPT_UINT64, &level, NULL) != argc) return (DCMD_USAGE); if (level != (uint64_t)-1 && level > mmu.max_level) { mdb_warn("invalid level %lu\n", level); return (DCMD_ERR); } pfn = (pfn_t)addr; if (mflag) pfn = mdb_mfn_to_pfn(pfn); return (do_ptable_dcmd(pfn, level)); } static int do_htables_dcmd(hat_t *hatp) { struct hat hat; htable_t *ht; htable_t htable; int h; /* * read the hat and its hash table */ if (mdb_vread(&hat, sizeof (hat), (uintptr_t)hatp) == -1) { mdb_warn("Couldn't read struct hat\n"); return (DCMD_ERR); } /* * read the htable hashtable */ for (h = 0; h < hat.hat_num_hash; ++h) { if (mdb_vread(&ht, sizeof (htable_t *), (uintptr_t)(hat.hat_ht_hash + h)) == -1) { mdb_warn("Couldn't read htable ptr\\n"); return (DCMD_ERR); } for (; ht != NULL; ht = htable.ht_next) { mdb_printf("%p\n", ht); if (mdb_vread(&htable, sizeof (htable_t), (uintptr_t)ht) == -1) { mdb_warn("Couldn't read htable\n"); return (DCMD_ERR); } } } return (DCMD_OK); } /* * Dump the htables for the given hat */ /*ARGSUSED*/ int htables_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { hat_t *hat; init_mmu(); if (mmu.num_level == 0) return (DCMD_ERR); if ((flags & DCMD_ADDRSPEC) == 0) return (DCMD_USAGE); hat = (hat_t *)addr; return (do_htables_dcmd(hat)); } static uintptr_t entry2va(size_t *entries) { uintptr_t va = 0; for (level_t l = mmu.max_level; l >= 0; l--) va += entries[l] << mmu.level_shift[l]; return (VA_SIGN_EXTEND(va)); } static void ptmap_report(size_t *entries, uintptr_t start, boolean_t user, boolean_t writable, boolean_t wflag) { uint64_t curva = entry2va(entries); mdb_printf("mapped %s,%s range of %lu bytes: %a-%a\n", user ? "user" : "kernel", writable ? "writable" : "read-only", curva - start, start, curva - 1); if (wflag && start >= kernelbase) (void) mdb_call_dcmd("whatis", start, DCMD_ADDRSPEC, 0, NULL); } int ptmap_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { physaddr_t paddrs[MAX_NUM_LEVEL] = { 0, }; size_t entry[MAX_NUM_LEVEL] = { 0, }; uintptr_t start = (uintptr_t)-1; boolean_t writable = B_FALSE; boolean_t user = B_FALSE; boolean_t wflag = B_FALSE; level_t curlevel; if ((flags & DCMD_ADDRSPEC) == 0) return (DCMD_USAGE); if (mdb_getopts(argc, argv, 'w', MDB_OPT_SETBITS, TRUE, &wflag, NULL) != argc) return (DCMD_USAGE); init_mmu(); if (mmu.num_level == 0) return (DCMD_ERR); curlevel = mmu.max_level; paddrs[curlevel] = addr & MMU_PAGEMASK; for (;;) { physaddr_t pte_addr; x86pte_t pte; pte_addr = paddrs[curlevel] + (entry[curlevel] << mmu.pte_size_shift); if (mdb_pread(&pte, sizeof (pte), pte_addr) != sizeof (pte)) { mdb_warn("couldn't read pte at %p", pte_addr); return (DCMD_ERR); } if (PTE_GET(pte, PT_VALID) == 0) { if (start != (uintptr_t)-1) { ptmap_report(entry, start, user, writable, wflag); start = (uintptr_t)-1; } } else if (curlevel == 0 || PTE_GET(pte, PT_PAGESIZE)) { if (start == (uintptr_t)-1) { start = entry2va(entry); user = PTE_GET(pte, PT_USER); writable = PTE_GET(pte, PT_WRITABLE); } else if (user != PTE_GET(pte, PT_USER) || writable != PTE_GET(pte, PT_WRITABLE)) { ptmap_report(entry, start, user, writable, wflag); start = entry2va(entry); user = PTE_GET(pte, PT_USER); writable = PTE_GET(pte, PT_WRITABLE); } } else { /* Descend a level. */ physaddr_t pa = mmu_ptob(pte2mfn(pte, curlevel)); paddrs[--curlevel] = pa; entry[curlevel] = 0; continue; } while (++entry[curlevel] == mmu.ptes_per_table) { /* Ascend back up. */ entry[curlevel] = 0; if (curlevel == mmu.max_level) { if (start != (uintptr_t)-1) { ptmap_report(entry, start, user, writable, wflag); } goto out; } curlevel++; } } out: return (DCMD_OK); }
20.744871
79
0.632122
[ "3d" ]
b95f141abd3459b661ec615fbc4c53a43666bc92
7,808
h
C
dbswznm/WznmMDialog.h
mpsitech/wznm-WhizniumSBE
4911d561b28392d485c46e98fb915168d82b3824
[ "MIT" ]
3
2020-09-20T16:24:48.000Z
2021-12-01T19:44:51.000Z
dbswznm/WznmMDialog.h
mpsitech/wznm-WhizniumSBE
4911d561b28392d485c46e98fb915168d82b3824
[ "MIT" ]
null
null
null
dbswznm/WznmMDialog.h
mpsitech/wznm-WhizniumSBE
4911d561b28392d485c46e98fb915168d82b3824
[ "MIT" ]
null
null
null
/** * \file WznmMDialog.h * database access for table TblWznmMDialog (declarations) * \copyright (C) 2016-2020 MPSI Technologies GmbH * \author Alexander Wirthmueller (auto-generation) * \date created: 5 Dec 2020 */ // IP header --- ABOVE #ifndef WZNMMDIALOG_H #define WZNMMDIALOG_H #include <sbecore/Types.h> #if defined(SBECORE_MAR) || defined(SBECORE_MY) #include <sbecore/MyDbs.h> #endif #if defined(SBECORE_PG) #include <sbecore/PgDbs.h> #endif #include <sbecore/Xmlio.h> #define VecWznmVMDialogBasetype TblWznmMDialog::VecVBasetype #define VecWznmVMDialogRefTbl TblWznmMDialog::VecVRefTbl /** * WznmMDialog: record of TblWznmMDialog */ class WznmMDialog { public: WznmMDialog(const Sbecore::ubigint ref = 0, const Sbecore::uint ixVBasetype = 0, const Sbecore::ubigint refWznmMCard = 0, const Sbecore::uint refIxVTbl = 0, const Sbecore::ubigint refUref = 0, const Sbecore::ubigint refWznmMJob = 0, const std::string sref = "", const std::string Comment = ""); public: Sbecore::ubigint ref; Sbecore::uint ixVBasetype; Sbecore::ubigint refWznmMCard; Sbecore::uint refIxVTbl; Sbecore::ubigint refUref; Sbecore::ubigint refWznmMJob; std::string sref; std::string Comment; public: bool operator==(const WznmMDialog& comp); bool operator!=(const WznmMDialog& comp); }; /** * ListWznmMDialog: recordset of TblWznmMDialog */ class ListWznmMDialog { public: ListWznmMDialog(); ListWznmMDialog(const ListWznmMDialog& src); ~ListWznmMDialog(); void clear(); unsigned int size() const; void append(WznmMDialog* rec); WznmMDialog* operator[](const Sbecore::uint ix); ListWznmMDialog& operator=(const ListWznmMDialog& src); bool operator==(const ListWznmMDialog& comp); bool operator!=(const ListWznmMDialog& comp); public: std::vector<WznmMDialog*> nodes; }; /** * TblWznmMDialog: C++ wrapper for table TblWznmMDialog */ class TblWznmMDialog { public: /** * VecVBasetype (full: VecWznmVMDialogBasetype) */ class VecVBasetype { public: static const Sbecore::uint NEW = 1; static const Sbecore::uint SELECT = 2; static const Sbecore::uint FILTER = 3; static const Sbecore::uint MNREL = 4; static const Sbecore::uint MNNEW = 5; static const Sbecore::uint IMPORT = 6; static const Sbecore::uint EXPORT = 7; static const Sbecore::uint JUMP = 8; static const Sbecore::uint RIGHTS = 9; static const Sbecore::uint REPORT = 10; static const Sbecore::uint CUST = 11; static Sbecore::uint getIx(const std::string& sref); static std::string getSref(const Sbecore::uint ix); static std::string getTitle(const Sbecore::uint ix, const Sbecore::uint ixWznmVLocale); static void fillFeed(const Sbecore::uint ixWznmVLocale, Sbecore::Feed& feed); }; /** * VecVRefTbl (full: VecWznmVMDialogRefTbl) */ class VecVRefTbl { public: static const Sbecore::uint VOID = 1; static const Sbecore::uint TBL = 2; static const Sbecore::uint REL = 3; static const Sbecore::uint IEX = 4; static Sbecore::uint getIx(const std::string& sref); static std::string getSref(const Sbecore::uint ix); static std::string getTitle(const Sbecore::uint ix, const Sbecore::uint ixWznmVLocale); static void fillFeed(const Sbecore::uint ixWznmVLocale, Sbecore::Feed& feed); }; public: TblWznmMDialog(); virtual ~TblWznmMDialog(); public: virtual bool loadRecBySQL(const std::string& sqlstr, WznmMDialog** rec); virtual Sbecore::ubigint loadRstBySQL(const std::string& sqlstr, const bool append, ListWznmMDialog& rst); virtual Sbecore::ubigint insertRec(WznmMDialog* rec); Sbecore::ubigint insertNewRec(WznmMDialog** rec = NULL, const Sbecore::uint ixVBasetype = 0, const Sbecore::ubigint refWznmMCard = 0, const Sbecore::uint refIxVTbl = 0, const Sbecore::ubigint refUref = 0, const Sbecore::ubigint refWznmMJob = 0, const std::string sref = "", const std::string Comment = ""); Sbecore::ubigint appendNewRecToRst(ListWznmMDialog& rst, WznmMDialog** rec = NULL, const Sbecore::uint ixVBasetype = 0, const Sbecore::ubigint refWznmMCard = 0, const Sbecore::uint refIxVTbl = 0, const Sbecore::ubigint refUref = 0, const Sbecore::ubigint refWznmMJob = 0, const std::string sref = "", const std::string Comment = ""); virtual void insertRst(ListWznmMDialog& rst, bool transact = false); virtual void updateRec(WznmMDialog* rec); virtual void updateRst(ListWznmMDialog& rst, bool transact = false); virtual void removeRecByRef(Sbecore::ubigint ref); virtual bool loadRecByRef(Sbecore::ubigint ref, WznmMDialog** rec); virtual bool loadRecByJob(Sbecore::ubigint refWznmMJob, WznmMDialog** rec); virtual Sbecore::ubigint loadRefsByCar(Sbecore::ubigint refWznmMCard, const bool append, std::vector<Sbecore::ubigint>& refs); virtual Sbecore::ubigint loadRstByCar(Sbecore::ubigint refWznmMCard, const bool append, ListWznmMDialog& rst); virtual bool loadSrfByRef(Sbecore::ubigint ref, std::string& sref); Sbecore::ubigint loadRstByRefs(std::vector<Sbecore::ubigint>& refs, const bool append, ListWznmMDialog& rst); }; #if defined(SBECORE_MAR) || defined(SBECORE_MY) /** * MyWznmMDialog: C++ wrapper for table TblWznmMDialog (MySQL database) */ class MyTblWznmMDialog : public TblWznmMDialog, public Sbecore::MyTable { public: MyTblWznmMDialog(); ~MyTblWznmMDialog(); public: void initStatements(); public: MYSQL_STMT* stmtInsertRec; MYSQL_STMT* stmtUpdateRec; MYSQL_STMT* stmtRemoveRecByRef; public: bool loadRecBySQL(const std::string& sqlstr, WznmMDialog** rec); Sbecore::ubigint loadRstBySQL(const std::string& sqlstr, const bool append, ListWznmMDialog& rst); Sbecore::ubigint insertRec(WznmMDialog* rec); void insertRst(ListWznmMDialog& rst, bool transact = false); void updateRec(WznmMDialog* rec); void updateRst(ListWznmMDialog& rst, bool transact = false); void removeRecByRef(Sbecore::ubigint ref); bool loadRecByRef(Sbecore::ubigint ref, WznmMDialog** rec); bool loadRecByJob(Sbecore::ubigint refWznmMJob, WznmMDialog** rec); Sbecore::ubigint loadRefsByCar(Sbecore::ubigint refWznmMCard, const bool append, std::vector<Sbecore::ubigint>& refs); Sbecore::ubigint loadRstByCar(Sbecore::ubigint refWznmMCard, const bool append, ListWznmMDialog& rst); bool loadSrfByRef(Sbecore::ubigint ref, std::string& sref); }; #endif #if defined(SBECORE_PG) /** * PgWznmMDialog: C++ wrapper for table TblWznmMDialog (PgSQL database) */ class PgTblWznmMDialog : public TblWznmMDialog, public Sbecore::PgTable { public: PgTblWznmMDialog(); ~PgTblWznmMDialog(); public: void initStatements(); private: bool loadRec(PGresult* res, WznmMDialog** rec); Sbecore::ubigint loadRst(PGresult* res, const bool append, ListWznmMDialog& rst); bool loadRecByStmt(const std::string& srefStmt, const unsigned int N, const char** vals, const int* l, const int* f, WznmMDialog** rec); Sbecore::ubigint loadRstByStmt(const std::string& srefStmt, const unsigned int N, const char** vals, const int* l, const int* f, const bool append, ListWznmMDialog& rst); public: bool loadRecBySQL(const std::string& sqlstr, WznmMDialog** rec); Sbecore::ubigint loadRstBySQL(const std::string& sqlstr, const bool append, ListWznmMDialog& rst); Sbecore::ubigint insertRec(WznmMDialog* rec); void insertRst(ListWznmMDialog& rst, bool transact = false); void updateRec(WznmMDialog* rec); void updateRst(ListWznmMDialog& rst, bool transact = false); void removeRecByRef(Sbecore::ubigint ref); bool loadRecByRef(Sbecore::ubigint ref, WznmMDialog** rec); bool loadRecByJob(Sbecore::ubigint refWznmMJob, WznmMDialog** rec); Sbecore::ubigint loadRefsByCar(Sbecore::ubigint refWznmMCard, const bool append, std::vector<Sbecore::ubigint>& refs); Sbecore::ubigint loadRstByCar(Sbecore::ubigint refWznmMCard, const bool append, ListWznmMDialog& rst); bool loadSrfByRef(Sbecore::ubigint ref, std::string& sref); }; #endif #endif
35.171171
334
0.753714
[ "vector" ]
b965fa9ebf7cf2b388995fcce768292093d4223d
26,090
c
C
misc/Spin/Src6.2.7/main.c
5m477/SQA
7d1c8633b7e41c260b59b8847906c412f11201ee
[ "MIT" ]
11
2016-06-09T03:33:21.000Z
2021-12-01T10:34:54.000Z
misc/Spin/Src6.2.7/main.c
SMShoron/SQA
7d1c8633b7e41c260b59b8847906c412f11201ee
[ "MIT" ]
null
null
null
misc/Spin/Src6.2.7/main.c
SMShoron/SQA
7d1c8633b7e41c260b59b8847906c412f11201ee
[ "MIT" ]
11
2016-03-06T22:36:35.000Z
2022-02-19T16:32:26.000Z
/***** spin: main.c *****/ /* Copyright (c) 1989-2003 by Lucent Technologies, Bell Laboratories. */ /* All Rights Reserved. This software is for educational purposes only. */ /* No guarantee whatsoever is expressed or implied by the distribution of */ /* this code. Permission is given to distribute this code provided that */ /* this introductory message is not removed and no monies are exchanged. */ /* Software written by Gerard J. Holzmann. For tool documentation see: */ /* http://spinroot.com/ */ /* Send all bug-reports and/or questions to: bugs@spinroot.com */ #include <stdlib.h> #include <assert.h> #include "spin.h" #include "version.h" #include <sys/types.h> #include <sys/stat.h> #include <signal.h> #include <time.h> #ifdef PC #include <io.h> extern int unlink(const char *); #else #include <unistd.h> #endif #include "y.tab.h" extern int DstepStart, lineno, tl_terse; extern FILE *yyin, *yyout, *tl_out; extern Symbol *context; extern char *claimproc; extern void repro_src(void); extern void qhide(int); extern char CurScope[MAXSCOPESZ]; extern short has_provided; extern int realread, buzzed; Symbol *Fname, *oFname; int Etimeouts; /* nr timeouts in program */ int Ntimeouts; /* nr timeouts in never claim */ int analyze, columns, dumptab, has_remote, has_remvar; int interactive, jumpsteps, m_loss, nr_errs, cutoff; int s_trail, ntrail, verbose, xspin, notabs, rvopt; int no_print, no_wrapup, Caccess, limited_vis, like_java; int separate; /* separate compilation */ int export_ast; /* pangen5.c */ int old_scope_rules; /* use pre 5.3.0 rules */ int old_priority_rules; /* use pre 6.2.0 rules */ int product, Strict; int merger = 1, deadvar = 1; int ccache = 0; /* oyvind teig: 5.2.0 case caching off by default */ static int preprocessonly, SeedUsed; static int seedy; /* be verbose about chosen seed */ static int inlineonly; /* show inlined code */ static int dataflow = 1; #if 0 meaning of flags on verbose: 1 -g global variable values 2 -l local variable values 4 -p all process actions 8 -r receives 16 -s sends 32 -v verbose 64 -w very verbose #endif static char Operator[] = "operator: "; static char Keyword[] = "keyword: "; static char Function[] = "function-name: "; static char **add_ltl = (char **) 0; static char **ltl_file = (char **) 0; static char **nvr_file = (char **) 0; static char *ltl_claims = (char *) 0; static char formula[4096]; static FILE *fd_ltl = (FILE *) 0; static char *PreArg[64]; static int PreCnt = 0; static char out1[64]; char **trailfilename; /* new option 'k' */ void explain(int); #ifndef CPP /* to use visual C++: #define CPP "CL -E/E" or call spin as: "spin -PCL -E/E" on OS2: #define CPP "icc -E/Pd+ -E/Q+" or call spin as: "spin -Picc -E/Pd+ -E/Q+" */ #if defined(PC) || defined(MAC) #define CPP "gcc -E -x c" /* most systems have gcc or cpp */ /* if gcc-4 is available, this setting is modified below */ #else #ifdef SOLARIS #define CPP "/usr/ccs/lib/cpp" #else #define CPP "cpp" /* #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #define CPP "cpp" #else #define CPP "/lib/cpp" #endif */ #endif #endif #endif static char *PreProc = CPP; extern int depth; /* at least some steps were made */ void alldone(int estatus) { if (preprocessonly == 0 && strlen(out1) > 0) (void) unlink((const char *)out1); if (!buzzed && seedy && !analyze && !export_ast && !s_trail && !preprocessonly && depth > 0) printf("seed used: %d\n", SeedUsed); if (!buzzed && xspin && (analyze || s_trail)) { if (estatus) printf("spin: %d error(s) - aborting\n", estatus); else printf("Exit-Status 0\n"); } if (buzzed && !estatus) { exit( system("cc -o pan pan.c && ./pan -d") ); } exit(estatus); } void preprocess(char *a, char *b, int a_tmp) { char precmd[1024], cmd[2048]; int i; #if defined(WIN32) || defined(WIN64) struct _stat x; /* struct stat x; */ #endif #ifdef PC extern int try_zpp(char *, char *); if (PreCnt == 0 && try_zpp(a, b)) { goto out; } #endif #if defined(WIN32) || defined(WIN64) if (strncmp(PreProc, "gcc -E -x c", strlen("gcc -E -x c")) == 0) { if (stat("/bin/gcc-4.exe", (struct stat *)&x) == 0 /* for PCs with cygwin */ || stat("c:/cygwin/bin/gcc-4.exe", (struct stat *)&x) == 0) { PreProc = "gcc-4 -E -x c"; } else if (stat("/bin/gcc-3.exe", (struct stat *)&x) == 0 || stat("c:/cygwin/bin/gcc-3.exe", (struct stat *)&x) == 0) { PreProc = "gcc-3 -E -x c"; } } #endif assert(strlen(PreProc) < sizeof(precmd)); strcpy(precmd, PreProc); for (i = 1; i <= PreCnt; i++) { strcat(precmd, " "); strcat(precmd, PreArg[i]); } if (strlen(precmd) > sizeof(precmd)) { fprintf(stdout, "spin: too many -D args, aborting\n"); alldone(1); } sprintf(cmd, "%s %s > %s", precmd, a, b); if (system((const char *)cmd)) { (void) unlink((const char *) b); if (a_tmp) (void) unlink((const char *) a); fprintf(stdout, "spin: preprocessing failed\n"); /* 4.1.2 was stderr */ alldone(1); /* no return, error exit */ } #ifdef PC out: #endif if (a_tmp) (void) unlink((const char *) a); } void usage(void) { printf("use: spin [-option] ... [-option] file\n"); printf("\tNote: file must always be the last argument\n"); printf("\t-A apply slicing algorithm\n"); printf("\t-a generate a verifier in pan.c\n"); printf("\t-B no final state details in simulations\n"); printf("\t-b don't execute printfs in simulation\n"); printf("\t-C print channel access info (combine with -g etc.)\n"); printf("\t-c columnated -s -r simulation output\n"); printf("\t-d produce symbol-table information\n"); printf("\t-Dyyy pass -Dyyy to the preprocessor\n"); printf("\t-Eyyy pass yyy to the preprocessor\n"); printf("\t-e compute synchronous product of multiple never claims (modified by -L)\n"); printf("\t-f \"..formula..\" translate LTL "); printf("into never claim\n"); printf("\t-F file like -f, but with the LTL formula stored in a 1-line file\n"); printf("\t-g print all global variables\n"); printf("\t-h at end of run, print value of seed for random nr generator used\n"); printf("\t-i interactive (random simulation)\n"); printf("\t-I show result of inlining and preprocessing\n"); printf("\t-J reverse eval order of nested unlesses\n"); printf("\t-jN skip the first N steps "); printf("in simulation trail\n"); printf("\t-k fname use the trailfile stored in file fname, see also -t\n"); printf("\t-L when using -e, use strict language intersection\n"); printf("\t-l print all local variables\n"); printf("\t-M print msc-flow in Postscript\n"); printf("\t-m lose msgs sent to full queues\n"); printf("\t-N fname use never claim stored in file fname\n"); printf("\t-nN seed for random nr generator\n"); printf("\t-O use old scope rules (pre 5.3.0)\n"); printf("\t-o1 turn off dataflow-optimizations in verifier\n"); printf("\t-o2 don't hide write-only variables in verifier\n"); printf("\t-o3 turn off statement merging in verifier\n"); printf("\t-o4 turn on rendezvous optiomizations in verifier\n"); printf("\t-o5 turn on case caching (reduces size of pan.m, but affects reachability reports)\n"); printf("\t-o6 revert to the old rules for interpreting priority tags (pre version 6.2)\n"); printf("\t-Pxxx use xxx for preprocessing\n"); printf("\t-p print all statements\n"); printf("\t-pp pretty-print (reformat) stdin, write stdout\n"); printf("\t-qN suppress io for queue N in printouts\n"); printf("\t-r print receive events\n"); printf("\t-S1 and -S2 separate pan source for claim and model\n"); printf("\t-s print send events\n"); printf("\t-T do not indent printf output\n"); printf("\t-t[N] follow [Nth] simulation trail, see also -k\n"); printf("\t-Uyyy pass -Uyyy to the preprocessor\n"); printf("\t-uN stop a simulation run after N steps\n"); printf("\t-v verbose, more warnings\n"); printf("\t-w very verbose (when combined with -l or -g)\n"); printf("\t-[XYZ] reserved for use by xspin interface\n"); printf("\t-V print version number and exit\n"); alldone(1); } int optimizations(int nr) { switch (nr) { case '1': dataflow = 1 - dataflow; /* dataflow */ if (verbose&32) printf("spin: dataflow optimizations turned %s\n", dataflow?"on":"off"); break; case '2': /* dead variable elimination */ deadvar = 1 - deadvar; if (verbose&32) printf("spin: dead variable elimination turned %s\n", deadvar?"on":"off"); break; case '3': /* statement merging */ merger = 1 - merger; if (verbose&32) printf("spin: statement merging turned %s\n", merger?"on":"off"); break; case '4': /* rv optimization */ rvopt = 1 - rvopt; if (verbose&32) printf("spin: rendezvous optimization turned %s\n", rvopt?"on":"off"); break; case '5': /* case caching */ ccache = 1 - ccache; if (verbose&32) printf("spin: case caching turned %s\n", ccache?"on":"off"); break; case '6': old_priority_rules = 1; if (verbose&32) printf("spin: using old priority rules (pre version 6.2)\n"); return 0; /* no break */ default: printf("spin: bad or missing parameter on -o\n"); usage(); break; } return 1; } int main(int argc, char *argv[]) { Symbol *s; int T = (int) time((time_t *)0); int usedopts = 0; extern void ana_src(int, int); yyin = stdin; yyout = stdout; tl_out = stdout; strcpy(CurScope, "_"); /* unused flags: y, z, G, L, Q, R, W */ while (argc > 1 && argv[1][0] == '-') { switch (argv[1][1]) { /* generate code for separate compilation: S1 or S2 */ case 'S': separate = atoi(&argv[1][2]); /* fall through */ case 'a': analyze = 1; break; case 'A': export_ast = 1; break; case 'B': no_wrapup = 1; break; case 'b': no_print = 1; break; case 'C': Caccess = 1; break; case 'c': columns = 1; break; case 'D': PreArg[++PreCnt] = (char *) &argv[1][0]; break; /* define */ case 'd': dumptab = 1; break; case 'E': PreArg[++PreCnt] = (char *) &argv[1][2]; break; case 'e': product++; break; /* see also 'L' */ case 'F': ltl_file = (char **) (argv+2); argc--; argv++; break; case 'f': add_ltl = (char **) argv; argc--; argv++; break; case 'g': verbose += 1; break; case 'h': seedy = 1; break; case 'i': interactive = 1; break; case 'I': inlineonly = 1; break; case 'J': like_java = 1; break; case 'j': jumpsteps = atoi(&argv[1][2]); break; case 'k': s_trail = 1; trailfilename = (char **) (argv+2); argc--; argv++; break; case 'L': Strict++; break; /* modified -e */ case 'l': verbose += 2; break; case 'M': columns = 2; break; case 'm': m_loss = 1; break; case 'N': nvr_file = (char **) (argv+2); argc--; argv++; break; case 'n': T = atoi(&argv[1][2]); tl_terse = 1; break; case 'O': old_scope_rules = 1; break; case 'o': usedopts += optimizations(argv[1][2]); break; case 'P': PreProc = (char *) &argv[1][2]; break; case 'p': if (argv[1][2] == 'p') { pretty_print(); alldone(0); } verbose += 4; break; case 'q': if (isdigit((int) argv[1][2])) qhide(atoi(&argv[1][2])); break; case 'r': verbose += 8; break; case 's': verbose += 16; break; case 'T': notabs = 1; break; case 't': s_trail = 1; if (isdigit((int)argv[1][2])) ntrail = atoi(&argv[1][2]); break; case 'U': PreArg[++PreCnt] = (char *) &argv[1][0]; break; /* undefine */ case 'u': cutoff = atoi(&argv[1][2]); break; /* new 3.4.14 */ case 'v': verbose += 32; break; case 'V': printf("%s\n", SpinVersion); alldone(0); break; case 'w': verbose += 64; break; case 'x': buzzed++; /* implies also -a -o3 */ analyze = 1; usedopts += optimizations('3'); break; case 'X': xspin = notabs = 1; #ifndef PC signal(SIGPIPE, alldone); /* not posix... */ #endif break; case 'Y': limited_vis = 1; break; /* used by xspin */ case 'Z': preprocessonly = 1; break; /* used by xspin */ default : usage(); break; } argc--; argv++; } if (usedopts && !analyze) printf("spin: warning -o[1..5] option ignored in simulations\n"); if (ltl_file) { add_ltl = ltl_file-2; add_ltl[1][1] = 'f'; if (!(tl_out = fopen(*ltl_file, "r"))) { printf("spin: cannot open %s\n", *ltl_file); alldone(1); } if (!fgets(formula, 4096, tl_out)) { printf("spin: cannot read %s\n", *ltl_file); } fclose(tl_out); tl_out = stdout; *ltl_file = (char *) formula; } if (argc > 1) { FILE *fd = stdout; char cmd[512], out2[512]; /* must remain in current dir */ strcpy(out1, "pan.pre"); if (add_ltl || nvr_file) { assert(strlen(argv[1]) < sizeof(out2)); sprintf(out2, "%s.nvr", argv[1]); if ((fd = fopen(out2, MFLAGS)) == NULL) { printf("spin: cannot create tmp file %s\n", out2); alldone(1); } fprintf(fd, "#include \"%s\"\n", argv[1]); } if (add_ltl) { tl_out = fd; nr_errs = tl_main(2, add_ltl); fclose(fd); preprocess(out2, out1, 1); } else if (nvr_file) { fprintf(fd, "#include \"%s\"\n", *nvr_file); fclose(fd); preprocess(out2, out1, 1); } else { preprocess(argv[1], out1, 0); } if (preprocessonly) alldone(0); if (!(yyin = fopen(out1, "r"))) { printf("spin: cannot open %s\n", out1); alldone(1); } assert(strlen(argv[1])+1 < sizeof(cmd)); if (strncmp(argv[1], "progress", (size_t) 8) == 0 || strncmp(argv[1], "accept", (size_t) 6) == 0) { sprintf(cmd, "_%s", argv[1]); } else { strcpy(cmd, argv[1]); } oFname = Fname = lookup(cmd); if (oFname->name[0] == '\"') { int i = (int) strlen(oFname->name); oFname->name[i-1] = '\0'; oFname = lookup(&oFname->name[1]); } } else { oFname = Fname = lookup("<stdin>"); if (add_ltl) { if (argc > 0) exit(tl_main(2, add_ltl)); printf("spin: missing argument to -f\n"); alldone(1); } printf("%s\n", SpinVersion); fprintf(stderr, "spin: error, no filename specified"); fflush(stdout); alldone(1); } if (columns == 2) { extern void putprelude(void); if (xspin || verbose&(1|4|8|16|32)) { printf("spin: -c precludes all flags except -t\n"); alldone(1); } putprelude(); } if (columns && !(verbose&8) && !(verbose&16)) verbose += (8+16); if (columns == 2 && limited_vis) verbose += (1+4); Srand((unsigned int) T); /* defined in run.c */ SeedUsed = T; s = lookup("_"); s->type = PREDEF; /* write-only global var */ s = lookup("_p"); s->type = PREDEF; s = lookup("_pid"); s->type = PREDEF; s = lookup("_last"); s->type = PREDEF; s = lookup("_nr_pr"); s->type = PREDEF; /* new 3.3.10 */ s = lookup("_priority"); s->type = PREDEF; /* new 6.2.0 */ yyparse(); fclose(yyin); if (ltl_claims) { Symbol *r; fclose(fd_ltl); if (!(yyin = fopen(ltl_claims, "r"))) { fatal("cannot open %s", ltl_claims); } r = oFname; oFname = Fname = lookup(ltl_claims); lineno = 0; yyparse(); fclose(yyin); oFname = Fname = r; if (0) { (void) unlink(ltl_claims); } } loose_ends(); if (inlineonly) { repro_src(); return 0; } chanaccess(); if (!Caccess) { if (has_provided && merger) { merger = 0; /* cannot use statement merging in this case */ } if (!s_trail && (dataflow || merger)) ana_src(dataflow, merger); sched(); alldone(nr_errs); } return 0; } void ltl_list(char *nm, char *fm) { if (s_trail || analyze || dumptab) /* when generating pan.c or replaying a trace */ { if (!ltl_claims) { ltl_claims = "_spin_nvr.tmp"; if ((fd_ltl = fopen(ltl_claims, MFLAGS)) == NULL) { fatal("cannot open tmp file %s", ltl_claims); } tl_out = fd_ltl; } add_ltl = (char **) emalloc(5 * sizeof(char *)); add_ltl[1] = "-c"; add_ltl[2] = nm; add_ltl[3] = "-f"; add_ltl[4] = (char *) emalloc(strlen(fm)+4); strcpy(add_ltl[4], "!("); strcat(add_ltl[4], fm); strcat(add_ltl[4], ")"); /* add_ltl[4] = fm; */ nr_errs += tl_main(4, add_ltl); fflush(tl_out); /* should read this file after the main file is read */ } } int yywrap(void) /* dummy routine */ { return 1; } void non_fatal(char *s1, char *s2) { extern int yychar; extern char yytext[]; printf("spin: %s:%d, Error: ", Fname?Fname->name:(oFname?oFname->name:"nofilename"), lineno); #if 1 printf(s1, s2); /* avoids a gcc warning, but isn't really better code... */ #else if (s2) printf(s1, s2); else printf(s1); #endif if (yychar > 0) { printf(" saw '"); explain(yychar); printf("'"); } if (strlen(yytext)>1) printf(" near '%s'", yytext); printf("\n"); nr_errs++; } void fatal(char *s1, char *s2) { non_fatal(s1, s2); (void) unlink("pan.b"); (void) unlink("pan.c"); (void) unlink("pan.h"); (void) unlink("pan.m"); (void) unlink("pan.t"); (void) unlink("pan.p"); (void) unlink("pan.pre"); (void) unlink("_spin_nvr.tmp"); alldone(1); } char * emalloc(size_t n) { char *tmp; static unsigned long cnt = 0; if (n == 0) return NULL; /* robert shelton 10/20/06 */ if (!(tmp = (char *) malloc(n))) { printf("spin: allocated %ld Gb, wanted %d bytes more\n", cnt/(1024*1024*1024), (int) n); fatal("not enough memory", (char *)0); } cnt += (unsigned long) n; memset(tmp, 0, n); return tmp; } void trapwonly(Lextok *n /* , char *unused */) { short i = (n->sym)?n->sym->type:0; /* printf("%s realread %d type %d\n", n->sym?n->sym->name:"--", realread, i); */ if (realread && (i == MTYPE || i == BIT || i == BYTE || i == SHORT || i == INT || i == UNSIGNED)) { n->sym->hidden |= 128; /* var is read at least once */ } } void setaccess(Symbol *sp, Symbol *what, int cnt, int t) { Access *a; for (a = sp->access; a; a = a->lnk) if (a->who == context && a->what == what && a->cnt == cnt && a->typ == t) return; a = (Access *) emalloc(sizeof(Access)); a->who = context; a->what = what; a->cnt = cnt; a->typ = t; a->lnk = sp->access; sp->access = a; } Lextok * nn(Lextok *s, int t, Lextok *ll, Lextok *rl) { Lextok *n = (Lextok *) emalloc(sizeof(Lextok)); static int warn_nn = 0; n->uiid = is_inline(); /* record origin of the statement */ n->ntyp = (short) t; if (s && s->fn) { n->ln = s->ln; n->fn = s->fn; } else if (rl && rl->fn) { n->ln = rl->ln; n->fn = rl->fn; } else if (ll && ll->fn) { n->ln = ll->ln; n->fn = ll->fn; } else { n->ln = lineno; n->fn = Fname; } if (s) n->sym = s->sym; n->lft = ll; n->rgt = rl; n->indstep = DstepStart; if (t == TIMEOUT) Etimeouts++; if (!context) return n; if (t == 'r' || t == 's') setaccess(n->sym, ZS, 0, t); if (t == 'R') setaccess(n->sym, ZS, 0, 'P'); if (context->name == claimproc) { int forbidden = separate; switch (t) { case ASGN: printf("spin: Warning, never claim has side-effect\n"); break; case 'r': case 's': non_fatal("never claim contains i/o stmnts",(char *)0); break; case TIMEOUT: /* never claim polls timeout */ if (Ntimeouts && Etimeouts) forbidden = 0; Ntimeouts++; Etimeouts--; break; case LEN: case EMPTY: case FULL: case 'R': case NFULL: case NEMPTY: /* status becomes non-exclusive */ if (n->sym && !(n->sym->xu&XX)) { n->sym->xu |= XX; if (separate == 2) { printf("spin: warning, make sure that the S1 model\n"); printf(" also polls channel '%s' in its claim\n", n->sym->name); } } forbidden = 0; break; case 'c': AST_track(n, 0); /* register as a slice criterion */ /* fall thru */ default: forbidden = 0; break; } if (forbidden) { printf("spin: never, saw "); explain(t); printf("\n"); fatal("incompatible with separate compilation",(char *)0); } } else if ((t == ENABLED || t == PC_VAL) && !(warn_nn&t)) { printf("spin: Warning, using %s outside never claim\n", (t == ENABLED)?"enabled()":"pc_value()"); warn_nn |= t; } else if (t == NONPROGRESS) { fatal("spin: Error, using np_ outside never claim\n", (char *)0); } return n; } Lextok * rem_lab(Symbol *a, Lextok *b, Symbol *c) /* proctype name, pid, label name */ { Lextok *tmp1, *tmp2, *tmp3; has_remote++; c->type = LABEL; /* refered to in global context here */ fix_dest(c, a); /* in case target of rem_lab is jump */ tmp1 = nn(ZN, '?', b, ZN); tmp1->sym = a; tmp1 = nn(ZN, 'p', tmp1, ZN); tmp1->sym = lookup("_p"); tmp2 = nn(ZN, NAME, ZN, ZN); tmp2->sym = a; tmp3 = nn(ZN, 'q', tmp2, ZN); tmp3->sym = c; return nn(ZN, EQ, tmp1, tmp3); #if 0 .---------------EQ-------. / \ 'p' -sym-> _p 'q' -sym-> c (label name) / / '?' -sym-> a (proctype) NAME -sym-> a (proctype name) / b (pid expr) #endif } Lextok * rem_var(Symbol *a, Lextok *b, Symbol *c, Lextok *ndx) { Lextok *tmp1; has_remote++; has_remvar++; dataflow = 0; /* turn off dead variable resets 4.2.5 */ tmp1 = nn(ZN, '?', b, ZN); tmp1->sym = a; tmp1 = nn(ZN, 'p', tmp1, ndx); tmp1->sym = c; return tmp1; #if 0 cannot refer to struct elements only to scalars and arrays 'p' -sym-> c (variable name) / \______ possible arrayindex on c / '?' -sym-> a (proctype) / b (pid expr) #endif } void explain(int n) { FILE *fd = stdout; switch (n) { default: if (n > 0 && n < 256) fprintf(fd, "'%c' = ", n); fprintf(fd, "%d", n); break; case '\b': fprintf(fd, "\\b"); break; case '\t': fprintf(fd, "\\t"); break; case '\f': fprintf(fd, "\\f"); break; case '\n': fprintf(fd, "\\n"); break; case '\r': fprintf(fd, "\\r"); break; case 'c': fprintf(fd, "condition"); break; case 's': fprintf(fd, "send"); break; case 'r': fprintf(fd, "recv"); break; case 'R': fprintf(fd, "recv poll %s", Operator); break; case '@': fprintf(fd, "@"); break; case '?': fprintf(fd, "(x->y:z)"); break; #if 1 case NEXT: fprintf(fd, "X"); break; case ALWAYS: fprintf(fd, "[]"); break; case EVENTUALLY: fprintf(fd, "<>"); break; case IMPLIES: fprintf(fd, "->"); break; case EQUIV: fprintf(fd, "<->"); break; case UNTIL: fprintf(fd, "U"); break; case WEAK_UNTIL: fprintf(fd, "W"); break; case IN: fprintf(fd, "%sin", Keyword); break; #endif case ACTIVE: fprintf(fd, "%sactive", Keyword); break; case AND: fprintf(fd, "%s&&", Operator); break; case ASGN: fprintf(fd, "%s=", Operator); break; case ASSERT: fprintf(fd, "%sassert", Function); break; case ATOMIC: fprintf(fd, "%satomic", Keyword); break; case BREAK: fprintf(fd, "%sbreak", Keyword); break; case C_CODE: fprintf(fd, "%sc_code", Keyword); break; case C_DECL: fprintf(fd, "%sc_decl", Keyword); break; case C_EXPR: fprintf(fd, "%sc_expr", Keyword); break; case C_STATE: fprintf(fd, "%sc_state",Keyword); break; case C_TRACK: fprintf(fd, "%sc_track",Keyword); break; case CLAIM: fprintf(fd, "%snever", Keyword); break; case CONST: fprintf(fd, "a constant"); break; case DECR: fprintf(fd, "%s--", Operator); break; case D_STEP: fprintf(fd, "%sd_step", Keyword); break; case D_PROCTYPE: fprintf(fd, "%sd_proctype", Keyword); break; case DO: fprintf(fd, "%sdo", Keyword); break; case DOT: fprintf(fd, "."); break; case ELSE: fprintf(fd, "%selse", Keyword); break; case EMPTY: fprintf(fd, "%sempty", Function); break; case ENABLED: fprintf(fd, "%senabled",Function); break; case EQ: fprintf(fd, "%s==", Operator); break; case EVAL: fprintf(fd, "%seval", Function); break; case FI: fprintf(fd, "%sfi", Keyword); break; case FULL: fprintf(fd, "%sfull", Function); break; case GE: fprintf(fd, "%s>=", Operator); break; case GET_P: fprintf(fd, "%sget_priority",Function); break; case GOTO: fprintf(fd, "%sgoto", Keyword); break; case GT: fprintf(fd, "%s>", Operator); break; case HIDDEN: fprintf(fd, "%shidden", Keyword); break; case IF: fprintf(fd, "%sif", Keyword); break; case INCR: fprintf(fd, "%s++", Operator); break; case INAME: fprintf(fd, "inline name"); break; case INLINE: fprintf(fd, "%sinline", Keyword); break; case INIT: fprintf(fd, "%sinit", Keyword); break; case ISLOCAL: fprintf(fd, "%slocal", Keyword); break; case LABEL: fprintf(fd, "a label-name"); break; case LE: fprintf(fd, "%s<=", Operator); break; case LEN: fprintf(fd, "%slen", Function); break; case LSHIFT: fprintf(fd, "%s<<", Operator); break; case LT: fprintf(fd, "%s<", Operator); break; case MTYPE: fprintf(fd, "%smtype", Keyword); break; case NAME: fprintf(fd, "an identifier"); break; case NE: fprintf(fd, "%s!=", Operator); break; case NEG: fprintf(fd, "%s! (not)",Operator); break; case NEMPTY: fprintf(fd, "%snempty", Function); break; case NFULL: fprintf(fd, "%snfull", Function); break; case NON_ATOMIC: fprintf(fd, "sub-sequence"); break; case NONPROGRESS: fprintf(fd, "%snp_", Function); break; case OD: fprintf(fd, "%sod", Keyword); break; case OF: fprintf(fd, "%sof", Keyword); break; case OR: fprintf(fd, "%s||", Operator); break; case O_SND: fprintf(fd, "%s!!", Operator); break; case PC_VAL: fprintf(fd, "%spc_value",Function); break; case PNAME: fprintf(fd, "process name"); break; case PRINT: fprintf(fd, "%sprintf", Function); break; case PRINTM: fprintf(fd, "%sprintm", Function); break; case PRIORITY: fprintf(fd, "%spriority", Keyword); break; case PROCTYPE: fprintf(fd, "%sproctype",Keyword); break; case PROVIDED: fprintf(fd, "%sprovided",Keyword); break; case RCV: fprintf(fd, "%s?", Operator); break; case R_RCV: fprintf(fd, "%s??", Operator); break; case RSHIFT: fprintf(fd, "%s>>", Operator); break; case RUN: fprintf(fd, "%srun", Operator); break; case SEP: fprintf(fd, "token: ::"); break; case SEMI: fprintf(fd, ";"); break; case ARROW: fprintf(fd, "->"); break; case SET_P: fprintf(fd, "%sset_priority",Function); break; case SHOW: fprintf(fd, "%sshow", Keyword); break; case SND: fprintf(fd, "%s!", Operator); break; case STRING: fprintf(fd, "a string"); break; case TRACE: fprintf(fd, "%strace", Keyword); break; case TIMEOUT: fprintf(fd, "%stimeout",Keyword); break; case TYPE: fprintf(fd, "data typename"); break; case TYPEDEF: fprintf(fd, "%stypedef",Keyword); break; case XU: fprintf(fd, "%sx[rs]", Keyword); break; case UMIN: fprintf(fd, "%s- (unary minus)", Operator); break; case UNAME: fprintf(fd, "a typename"); break; case UNLESS: fprintf(fd, "%sunless", Keyword); break; } }
28.73348
98
0.608931
[ "model" ]
b96619b260fbad163760c68028c1f1ec75bac547
2,170
h
C
zombie2/pipeline/spritepacker/source/image.h
DavidCoenFish/ancient-code-0
243fb47b9302a77f9b9392b6e3f90bba2ef3c228
[ "Unlicense" ]
null
null
null
zombie2/pipeline/spritepacker/source/image.h
DavidCoenFish/ancient-code-0
243fb47b9302a77f9b9392b6e3f90bba2ef3c228
[ "Unlicense" ]
null
null
null
zombie2/pipeline/spritepacker/source/image.h
DavidCoenFish/ancient-code-0
243fb47b9302a77f9b9392b6e3f90bba2ef3c228
[ "Unlicense" ]
null
null
null
//file: Image.h #ifndef _Image_H_ #define _Image_H_ #include <boost/noncopyable.hpp> #include <boost/shared_ptr.hpp> #include <vector> struct FIBITMAP; /* Image thinks origin is top left FreeImage thinks origin is bottom left */ class Image: public boost::noncopyable { // typedef private: typedef std::vector<unsigned char> TArrayByte; typedef std::vector<bool> TArrayBool; typedef boost::shared_ptr<Image> TPointerImage; //static public methods public: static TPointerImage FactoryBlank( const int in_width, const int in_height ); static TPointerImage FactoryFreeImage( FIBITMAP& in_image ); static void Blit( Image& inout_destinationImage, const Image& in_stampImage, const int in_originX, const int in_originY, const int in_writeWidth, const int in_writeHeight ); static void BlitFreeImage( FIBITMAP& inout_destinationImage, const Image& in_stampImage, const int in_originX, const int in_originY, const int in_writeWidth, const int in_writeHeight ); static const bool TestWritten( const Image& in_image, const int in_originX, const int in_originY, const int in_writeWidth, const int in_writeHeight ); // construction public: Image( const int in_width, const int in_height, const TArrayByte& in_arrayImageData = TArrayByte() ); ~Image(); // accessors public: const bool GetPixel( unsigned char& out_red, unsigned char& out_green, unsigned char& out_blue, unsigned char& out_alpha, const int in_x, const int in_y )const; void SetPixel( const int in_x, const int in_y, const unsigned char in_red, const unsigned char in_green, const unsigned char in_blue, const unsigned char in_alpha, const bool in_markWritten = true ); void SetWritten( const int in_x, const int in_y, const bool in_written ); const bool GetWritten( const int in_x, const int in_y )const; // public accessors public: const int GetWidth()const{ return mWidth; } const int GetHeight()const{ return mHeight; } // private members private: const int mWidth; const int mHeight; TArrayByte mArrayData; TArrayBool mArrayWritten; }; #endif // _Image_H_
19.20354
52
0.736406
[ "vector" ]
b972008b52d8206c7d76f3af528e9d1c2d998d37
1,737
h
C
facecat_macos/facecat_mac/facecat/include/scroll/FCHScrollBar.h
deadzq/facecat
bb623690127c07ffe0ec191a7308249c53f39c03
[ "BSD-2-Clause" ]
2
2021-01-02T05:51:52.000Z
2021-05-10T11:34:46.000Z
facecat_macos/facecat_mac/facecat/include/scroll/FCHScrollBar.h
Samge0/facecat
bb623690127c07ffe0ec191a7308249c53f39c03
[ "BSD-2-Clause" ]
null
null
null
facecat_macos/facecat_mac/facecat/include/scroll/FCHScrollBar.h
Samge0/facecat
bb623690127c07ffe0ec191a7308249c53f39c03
[ "BSD-2-Clause" ]
3
2020-01-27T00:13:45.000Z
2020-06-23T10:12:07.000Z
/*捂脸猫FaceCat框架 v1.0 1.创始人-矿洞程序员-上海宁米科技创始人-脉脉KOL-陶德 (微信号:suade1984); 2.联合创始人-上海宁米科技创始人-袁立涛(微信号:wx627378127); 3.联合创始人-肖添龙(微信号:xiaotianlong_luu); 4.联合开发者-陈晓阳(微信号:chenxiaoyangzxy),助理-朱炜(微信号:cnnic_zhu) 5.该框架开源协议为BSD,欢迎对我们的创业活动进行各种支持,欢迎更多开发者加入。 包含C/C++,Java,C#,iOS,MacOS,Linux六个版本的图形和通讯服务框架。 */ #ifndef __FCHSCROLLBAR_H__ #define __FCHSCROLLBAR_H__ #pragma once #include "stdafx.h" #include "FCScrollBar.h" /* * 横向滚动条 */ namespace FaceCat{ class FCHScrollBar:public FCScrollBar{ protected: /** * 背景按钮的触摸按下事件 */ FCTouchEvent m_backButtonTouchDownEvent; /** * 背景按钮的触摸抬起事件 */ FCTouchEvent m_backButtonTouchUpEvent; /** * 滚动条背景按钮触摸按下回调事件 * @params sender 调用者 * @params touchInfo 触摸信息 */ static void backButtonTouchDown(Object sender, FCTouchInfo touchInfo, Object pInvoke); /** * 滚动条背景按钮触摸抬起回调事件 */ static void backButtonTouchUp(Object sender, FCTouchInfo touchInfo, Object pInvoke); public: /* * 构造函数 */ FCHScrollBar(); /* * 析构函数 */ virtual ~FCHScrollBar(); /** * 获取控件类型 */ virtual String getControlType(); /** * 滚动条背景按钮触摸按下回调方法 */ void onBackButtonTouchDown(FCTouchInfo touchInfo); /** * 滚动条背景按钮触摸抬起方法 */ void onBackButtonTouchUp(FCTouchInfo touchInfo); /** * 拖动滚动方法 */ virtual void onDragScroll(); /** * 添加控件方法 */ virtual void onLoad(); /** * 重新布局方法 */ virtual void update(); }; } #endif
22.558442
94
0.554404
[ "object" ]
b97644c2cfed2ac3293ca762cff8b0f8f9c28279
1,631
h
C
src/node-pango-layout-iter.h
lgyin/node-cairo
41dba60a3b20fca84d45272d5031b061b3cffc0a
[ "Apache-2.0" ]
1
2020-09-18T10:01:27.000Z
2020-09-18T10:01:27.000Z
src/node-pango-layout-iter.h
yinliguo/node-cairo
41dba60a3b20fca84d45272d5031b061b3cffc0a
[ "Apache-2.0" ]
null
null
null
src/node-pango-layout-iter.h
yinliguo/node-cairo
41dba60a3b20fca84d45272d5031b061b3cffc0a
[ "Apache-2.0" ]
null
null
null
#ifndef __NODE_PANGO_LAYOUT_ITER_H__ #define __NODE_PANGO_LAYOUT_ITER_H__ #include <napi.h> #include <pango/pangocairo.h> class NodePangoLayoutIter : public Napi::ObjectWrap<NodePangoLayoutIter> { public: NodePangoLayoutIter(const Napi::CallbackInfo& info); ~NodePangoLayoutIter(); static Napi::Object Init(Napi::Env env, Napi::Object exports); static Napi::Object NewInstance(PangoLayoutIter* iter); static bool HasInstance(const Napi::Value& v); PangoLayoutIter* GetIter(); void SetIter(PangoLayoutIter* iter); Napi::Value Copy(const Napi::CallbackInfo& info); Napi::Value Free(const Napi::CallbackInfo& info); Napi::Value NextRun(const Napi::CallbackInfo& info); Napi::Value NextChar(const Napi::CallbackInfo& info); Napi::Value NextCluster(const Napi::CallbackInfo& info); Napi::Value NextLine(const Napi::CallbackInfo& info); Napi::Value AtLastLine(const Napi::CallbackInfo& info); Napi::Value GetIndex(const Napi::CallbackInfo& info); Napi::Value GetBaseline(const Napi::CallbackInfo& info); Napi::Value GetLine(const Napi::CallbackInfo& info); Napi::Value GetLineReadonly(const Napi::CallbackInfo& info); Napi::Value GetLayout(const Napi::CallbackInfo& info); Napi::Value GetCharExtents(const Napi::CallbackInfo& info); Napi::Value GetClusterExtents(const Napi::CallbackInfo& info); Napi::Value GetRunExtents(const Napi::CallbackInfo& info); Napi::Value GetLineYRange(const Napi::CallbackInfo& info); Napi::Value GetLineExtents(const Napi::CallbackInfo& info); Napi::Value GetLayoutExtents(const Napi::CallbackInfo& info); private: PangoLayoutIter* iter_; }; #endif
37.930233
72
0.765788
[ "object" ]
572c53d008e4e5976d5017d51a0ada28bb0611fd
1,680
h
C
include/summy/analysis/adaptive_rd/adaptive_rd.h
gdslang/summy
bd450278f18859eb94d1f30b7b878bbb1b94c42c
[ "Apache-2.0" ]
null
null
null
include/summy/analysis/adaptive_rd/adaptive_rd.h
gdslang/summy
bd450278f18859eb94d1f30b7b878bbb1b94c42c
[ "Apache-2.0" ]
null
null
null
include/summy/analysis/adaptive_rd/adaptive_rd.h
gdslang/summy
bd450278f18859eb94d1f30b7b878bbb1b94c42c
[ "Apache-2.0" ]
null
null
null
/* * reaching_def.h * * Created on: Sep 25, 2014 * Author: Julian Kranz */ #pragma once #include <cppgdsl/rreil/id/id.h> #include <functional> #include <memory> #include <ostream> #include <set> #include <summy/analysis/adaptive_rd/adaptive_rd_state.h> #include <summy/analysis/fp_analysis.h> #include <summy/analysis/liveness/liveness.h> #include <summy/cfg/cfg.h> #include <summy/cfg/edge/edge.h> #include <vector> namespace analysis { namespace adaptive_rd { typedef std::vector<std::shared_ptr<adaptive_rd_state>> state_t; typedef std::vector<std::map<size_t, shared_ptr<adaptive_rd_state>>> in_states_t; struct adaptive_rd_result : public ::analysis::analysis_result<state_t> { in_states_t &in_states; adaptive_rd_result(state_t &s, in_states_t &in_states) : analysis_result(s), in_states(in_states) {} }; class adaptive_rd : public fp_analysis { private: state_t state; in_states_t in_states; liveness::liveness_result lv_result; std::map<size_t, std::shared_ptr<domain_state>> transform( size_t from, size_t to, const ::cfg::edge *e, size_t from_ctx) override; virtual dependency gen_dependency(size_t from, size_t to) override; virtual void init_state() override; public: adaptive_rd(cfg::cfg *cfg, liveness::liveness_result lv_result); ~adaptive_rd(); std::shared_ptr<domain_state> bottom(); std::shared_ptr<domain_state> start_state(size_t) override; std::shared_ptr<domain_state> get(size_t node) override; void update(analysis_node node, std::shared_ptr<domain_state> state) override; adaptive_rd_result result(); void put(std::ostream &out) override; }; } // namespace reaching_defs } // namespace analysis
27.540984
102
0.754167
[ "vector", "transform" ]