blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
063588b8b3dc497d27f628d70da9ba6c04356620
2624b1062f58a25610fe6c5a8fd197feba76f539
/pref/scatter_pref1.cpp
632256fb241031f3eee7bb6a90561c5e477e59d1
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Survival12138/GaussianElimination
e4fbe4619f278d78ee9aa5bf6c612ecd228ebac7
d31cfc5325702e5ceb8e8fa381916a837d5837c2
refs/heads/master
2023-04-14T13:44:52.535295
2019-10-13T06:25:04
2019-10-13T06:25:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,719
cpp
scatter_pref1.cpp
/*/////////////////////////////////////////////////////////////////////////////////////// // // MIT License // // Copyright (c) 2019 Mohamad Ammar Alsherfawi Aljazaerly (AKA Jasam Sheja) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // //*/ #include <mpi.h> #include "gaussian_elimination.hpp" int my_rank; /* process ID */ int PSIZE; /* number of procs */ int scatter_pref(); int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); /* get proc ID */ MPI_Comm_size(MPI_COMM_WORLD, &PSIZE); /* get # of procs */ scatter_pref(); MPI_Finalize(); } int _blk_scatter_pref(int* array, int* Harray, const int N){ MPI_Barrier(MPI_COMM_WORLD); double start = MPI_Wtime(); //print_mat(array, N, N+1); MPI_CyclicScatter(array, N*(N+1)/2, (N+1), MPI_INT, Harray, N*(N+1)/2, (N+1), MPI_INT, 0, MPI_COMM_WORLD); //print_mat(Harray, N/2, N+1); MPI_Barrier(MPI_COMM_WORLD); double end = MPI_Wtime(); ostringstream ss; ss << "delay[blk]: " << end-start << "s"; if(my_rank==0) log(ss.str()); } int _ins_scatter_pref(int* array, int* Harray, const int N){ MPI_Barrier(MPI_COMM_WORLD); double start = MPI_Wtime(); //print_mat(array, N, N+1); MPI_ICyclicScatter(array, N*(N+1)/2, (N+1), MPI_INT, Harray, N*(N+1)/2, (N+1), MPI_INT, 0, MPI_COMM_WORLD); //print_mat(Harray, N/2, N+1); MPI_Barrier(MPI_COMM_WORLD); double end = MPI_Wtime(); ostringstream ss; ss << "delay[ins]: " << end-start << "s"; if(my_rank==0) log(ss.str()); } int scatter_pref(void) { const int N = 10000; int* array = new int[N*(N+1)]; int* Harray = new int[N*(N+1)/2]; if(my_rank==0) for(int i=0;i<N;++i) for(int j=0;j<=N;++j) array[i*(N+1)+j] = i*(N+1)+j; delete[] array; create_mat(N, array); _ins_scatter_pref(array, Harray, N); delete[] array; create_mat(N, array); _blk_scatter_pref(array, Harray, N); delete[] array; create_mat(N, array); _ins_scatter_pref(array, Harray, N); delete[] array; create_mat(N, array); _blk_scatter_pref(array, Harray, N); delete[] array; create_mat(N, array); _ins_scatter_pref(array, Harray, N); delete[] array; create_mat(N, array); _blk_scatter_pref(array, Harray, N); delete[] array; create_mat(N, array); _ins_scatter_pref(array, Harray, N); delete[] array; create_mat(N, array); _blk_scatter_pref(array, Harray, N); return 0; }
6ab03a6dec60dd211459d81405f4dc2e6d63e737
774e32df20ec1fc5e88d4319e5e413d5f5342cec
/ACM/134.cpp
cd0bf009c7e2e73d5c616b29c9605968f034270a
[]
no_license
pokleung5/coding-challenges
83d7dc9e21b3af22bb5235d34b913c807676060b
3c7209c011d9cf924dc798c97f88a814f31f9d58
refs/heads/master
2023-04-03T06:41:02.488550
2021-04-12T16:47:11
2021-04-12T16:47:11
279,652,963
0
0
null
null
null
null
UTF-8
C++
false
false
1,421
cpp
134.cpp
/***************************************** * (This comment block is added by the Judge System) * Submission ID: 77568 * Submitted at: 2019-02-11 22:46:39 * * User ID: 621 * Username: 54795701 * Problem ID: 134 * Problem Name: Dominos 2 (UVa 11518) */ #include <stdio.h> #include <cstring> #include <vector> #include <set> using namespace std; class node; int noOfInput; int n, m, l; bool *falls; int noOfFell; int temp1, temp2; node** elements; class node { public : int _nodeID; set<int> adjNodes; node(int _nodeID){ this->_nodeID = _nodeID; } int size() { if (falls[_nodeID] == true) return 0; int counter = 0; falls[_nodeID] = true; for(auto _temp : adjNodes){ if (falls[_temp] == false) { counter += elements[_temp]->size(); } } return counter + 1; } }; int main() { scanf("%d", &noOfInput); while (noOfInput-- > 0) { scanf("%d %d %d", &n, &m, &l); falls = new bool[n + 1]; memset(falls, 0, n + 1); elements = new node*[n + 1]; for (int i = 1; i <= n; i++) { elements[i] = new node(i); } while (m-- > 0) { scanf("%d %d", &temp1, &temp2); elements[temp1]->adjNodes.insert(temp2); } noOfFell = 0; while (l-- > 0) { scanf("%d", &temp1); noOfFell += elements[temp1]->size(); } printf("%d\n", noOfFell); for (int i = 1; i <= n; i++) { delete elements[i]; } delete falls; } return 0; }
23506706b0f4b94785a88b5b499af215e1904395
02624fc82fff3045c2759f91acaa06a8850f40b7
/recursion/towerOfHanoi.cpp
133da5c0a6f49420545f8fcd0ee5c6d828102eb2
[]
no_license
paviravirp/dataStructures
b2849b35f4cfbaccc0ebe29f982ac63f337f4b51
b757b26ff5942b742253cd1656708db44596a1e2
refs/heads/master
2020-07-20T07:41:16.742887
2019-09-18T14:38:04
2019-09-18T14:38:04
206,600,551
0
0
null
null
null
null
UTF-8
C++
false
false
644
cpp
towerOfHanoi.cpp
#include <iostream> using namespace std; void towerOfHanoi(int num, char from, char to, char aux) { if(num == 1) { cout << "Move disk 1 from " << from << " to " << to << "\n"; return; } towerOfHanoi(num - 1, from, aux, to); cout << "Move disk " << num << " from " << from << " to " << to << "\n"; towerOfHanoi(num - 1, aux, to, from); } int main() { int num; char from, to, aux; cout << "Enter the number of disks: "; cin >> num; cout << "\n From: "; cin >> from; cout << "\n To: "; cin >> to; cout << "\n Aux: "; cin >> aux; towerOfHanoi(num, from, to, aux); }
d21ec2a947d509e105a10150b2bd07638ef839f5
785df77400157c058a934069298568e47950e40b
/TnbCad2d/TnbLib/Cad2d/Intersection/Edge/Cad2d_EdgeEdgeIntersection.cxx
171d8508bb343907c3eff04bb8d9270d262d30be
[]
no_license
amir5200fx/Tonb
cb108de09bf59c5c7e139435e0be008a888d99d5
ed679923dc4b2e69b12ffe621fc5a6c8e3652465
refs/heads/master
2023-08-31T08:59:00.366903
2023-08-31T07:42:24
2023-08-31T07:42:24
230,028,961
9
3
null
2023-07-20T16:53:31
2019-12-25T02:29:32
C++
UTF-8
C++
false
false
8,328
cxx
Cad2d_EdgeEdgeIntersection.cxx
#include <Cad2d_EdgeEdgeIntersection.hxx> #include <Global_Macros.hxx> #include <Pln_Curve.hxx> #include <Pln_Edge.hxx> #include <Pln_Tools.hxx> #include <Cad2d_IntsctEntity_OrthSegment.hxx> #include <Cad2d_IntsctEntity_TangSegment.hxx> #include <Cad2d_IntsctEntity_Pair.hxx> #include <TnbError.hxx> #include <OSstream.hxx> #include <Geom2dAPI_InterCurveCurve.hxx> #include <Cad2d_VertexEdgeIntersection.hxx> #include <Pln_Vertex.hxx> #include <Pln_Tools.hxx> std::shared_ptr<tnbLib::Cad2d_EdgeEdgeIntersection> tnbLib::Cad2d_EdgeEdgeIntersection::operator() ( const std::shared_ptr<Pln_Edge>& theEdge0, const std::shared_ptr<Pln_Edge>& theEdge1, const Standard_Real theTol ) const { auto ent = Cad2d_EdgeEdgeIntersection::Intersect(theEdge0, theEdge1, theTol); return std::move(ent); } std::tuple < std::shared_ptr<tnbLib::Cad2d_EdgeEdgeIntersection>, std::shared_ptr<tnbLib::Cad2d_EdgeEdgeIntersection> > tnbLib::Cad2d_EdgeEdgeIntersection::ConvertFrom ( const Cad2d_VertexEdgeIntersection & theAlg, const Standard_Real theTol ) { if (NOT theAlg.NbEntities()) { FatalErrorIn(FunctionSIG) << "null intersection" << endl << abort(FatalError); } if (theAlg.NbEntities() > 1) { FatalErrorIn(FunctionSIG) << "multiply intersection points between the vertex and the edge have been detected!" << endl << abort(FatalError); } const auto& vtx = theAlg.Vtx(); const auto& edge = theAlg.Edge(); auto fwd = Pln_Tools::ForwardEdge(vtx); auto bwd = Pln_Tools::BackwardEdge(vtx); if (NOT fwd AND NOT bwd) { FatalErrorIn(FunctionSIG) << "orphan vertex has been detected!" << endl << abort(FatalError); } //Debug_Null_Pointer(fwd); //Debug_Null_Pointer(bwd); std::shared_ptr<Cad2d_EdgeEdgeIntersection> alg0; std::shared_ptr<Cad2d_EdgeEdgeIntersection> alg1; //auto alg0 = std::make_shared<Cad2d_EdgeEdgeIntersection>(); //auto alg1 = std::make_shared<Cad2d_EdgeEdgeIntersection>(); //Debug_Null_Pointer(alg0); //Debug_Null_Pointer(alg1); auto entity1 = std::make_shared<Cad2d_IntsctEntity_OrthSegment>(0); Debug_Null_Pointer(entity1); const auto& pair = theAlg.Entities()[0]; const auto& ent0 = pair->Entity0(); const auto& ent1 = pair->Entity1(); Debug_Null_Pointer(ent0); Debug_Null_Pointer(ent1); if (NOT ent0->IsPoint()) { FatalErrorIn(FunctionSIG) << "contradictory data!" << endl << abort(FatalError); } if (NOT ent1->IsSegment()) { FatalErrorIn(FunctionSIG) << "contradictory data!" << endl << abort(FatalError); } /*auto intsct0 = std::dynamic_pointer_cast<Cad2d_IntsctEntity_Point>(prior0); Debug_Null_Pointer(intsct0);*/ auto intsc1 = std::dynamic_pointer_cast<Cad2d_IntsctEntity_OrthSegment>(ent1); Debug_Null_Pointer(intsc1); entity1->SetParentEdge(edge); entity1->SetParameter(intsc1->Parameter()); entity1->SetCoord(intsc1->Coord()); if (fwd) { alg0 = std::make_shared<Cad2d_EdgeEdgeIntersection>(); Debug_Null_Pointer(alg0); auto& entities = alg0->EntitiesRef(); auto ent = std::make_shared<Cad2d_IntsctEntity_OrthSegment>(0); Debug_Null_Pointer(ent); ent->SetParentEdge(fwd); ent->SetParameter(fwd->Sense() ? fwd->Curve()->FirstParameter() : fwd->Curve()->LastParameter()); ent->SetCoord(fwd->Curve()->Value(ent->Parameter())); if (Distance(ent->Coord(), vtx->Coord()) > theTol) { FatalErrorIn(FunctionSIG) << "contradictory data!" << endl << abort(FatalError); } auto nPair = std::make_shared<Cad2d_IntsctEntity_Pair>(ent, entity1); entities.push_back(std::move(nPair)); } if (bwd) { auto alg1 = std::make_shared<Cad2d_EdgeEdgeIntersection>(); Debug_Null_Pointer(alg1); auto& entities = alg1->EntitiesRef(); auto ent = std::make_shared<Cad2d_IntsctEntity_OrthSegment>(0); Debug_Null_Pointer(ent); ent->SetParentEdge(bwd); ent->SetParameter(bwd->Sense() ? bwd->Curve()->FirstParameter() : bwd->Curve()->LastParameter()); ent->SetCoord(bwd->Curve()->Value(ent->Parameter())); if (Distance(ent->Coord(), vtx->Coord()) > theTol) { FatalErrorIn(FunctionSIG) << "contradictory data!" << endl << abort(FatalError); } auto nPair = std::make_shared<Cad2d_IntsctEntity_Pair>(ent, entity1); entities.push_back(std::move(nPair)); } auto t = std::make_tuple(std::move(alg0), std::move(alg1)); return std::move(t); } std::shared_ptr<tnbLib::Cad2d_EdgeEdgeIntersection> tnbLib::Cad2d_EdgeEdgeIntersection::Intersect ( const std::shared_ptr<Pln_Edge>& theEdge0, const std::shared_ptr<Pln_Edge>& theEdge1, const Standard_Real theTol ) { if (NOT theEdge0) { FatalErrorIn("void tnbLib::Cad2d_EdgeEdgeIntersection::Perform()") << "the edge0 is not loaded!" << endl << abort(FatalError); } if (NOT theEdge1) { FatalErrorIn("void tnbLib::Cad2d_EdgeEdgeIntersection::Perform()") << "the edge1 is not loaded!" << endl << abort(FatalError); } const auto& edge0 = *theEdge0; const auto& edge1 = *theEdge1; if (NOT edge0.Curve()) { FatalErrorIn("void tnbLib::Cad2d_EdgeEdgeIntersection::Perform()") << "the edge0 does not have a geometric curve!" << endl << abort(FatalError); } if (NOT edge1.Curve()) { FatalErrorIn("void tnbLib::Cad2d_EdgeEdgeIntersection::Perform()") << "the edge1 does not have a geometric curve!" << endl << abort(FatalError); } const auto& curve0 = *edge0.Curve(); const auto& curve1 = *edge1.Curve(); if (NOT Pln_Tools::IsBounded(curve0.Geometry())) { FatalErrorIn("void tnbLib::Cad2d_EdgeEdgeIntersection::Perform()") << "the curve0 is not bounded!" << endl << abort(FatalError); } if (NOT Pln_Tools::IsBounded(curve1.Geometry())) { FatalErrorIn("void tnbLib::Cad2d_EdgeEdgeIntersection::Perform()") << "the curve1 is not bounded!" << endl << abort(FatalError); } Geom2dAPI_InterCurveCurve Inter(curve0.Geometry(), curve1.Geometry(), theTol); const auto& alg = Inter.Intersector(); auto ent = std::make_shared<Cad2d_EdgeEdgeIntersection>(theEdge0, theEdge1); Debug_Null_Pointer(ent); ent->SetTolerance(theTol); auto& entities = ent->EntitiesRef(); entities.reserve(alg.NbPoints() + alg.NbSegments()); forThose(Index, 1, alg.NbPoints()) { const auto& pt = alg.Point(Index); auto entity0 = std::make_shared<Cad2d_IntsctEntity_OrthSegment>(Index); auto entity1 = std::make_shared<Cad2d_IntsctEntity_OrthSegment>(Index); Debug_Null_Pointer(entity0); Debug_Null_Pointer(entity1); entity0->SetParentEdge(theEdge0); entity1->SetParentEdge(theEdge1); entity0->SetCoord(pt.Value()); entity1->SetCoord(pt.Value()); entity0->SetParameter(pt.ParamOnFirst()); entity1->SetParameter(pt.ParamOnSecond()); auto pair = std::make_shared<Cad2d_IntsctEntity_Pair> (Index, std::move(entity0), std::move(entity1)); Debug_Null_Pointer(pair); entities.push_back(std::move(pair)); } forThose(Index, 1, alg.NbSegments()) { const auto& seg = alg.Segment(Index); if (NOT seg.HasFirstPoint()) { FatalErrorIn("void Perform()") << endl << "the segment does not have first point!" << endl << abort(FatalError); } if (NOT seg.HasLastPoint()) { FatalErrorIn("void Perform()") << endl << "the segment does not have first point!" << endl << abort(FatalError); } auto entity0 = std::make_shared<Cad2d_IntsctEntity_TangSegment>(Index); auto entity1 = std::make_shared<Cad2d_IntsctEntity_TangSegment>(Index); Debug_Null_Pointer(entity0); Debug_Null_Pointer(entity1); entity0->SetParentEdge(theEdge0); entity1->SetParentEdge(theEdge1); const auto& pt0 = seg.FirstPoint(); const auto& pt1 = seg.LastPoint(); entity0->SetCoord0(pt0.Value()); entity0->SetCoord1(pt1.Value()); entity0->SetParameter0(pt0.ParamOnFirst()); entity0->SetParameter1(pt1.ParamOnFirst()); if (seg.IsOpposite()) { entity1->SetCoord0(pt1.Value()); entity1->SetCoord1(pt0.Value()); entity1->SetParameter0(pt1.ParamOnSecond()); entity1->SetParameter1(pt0.ParamOnSecond()); } else { entity1->SetCoord0(pt0.Value()); entity1->SetCoord1(pt1.Value()); entity1->SetParameter0(pt0.ParamOnSecond()); entity1->SetParameter1(pt1.ParamOnSecond()); } auto pair = std::make_shared<Cad2d_IntsctEntity_Pair> (Index, std::move(entity0), std::move(entity1)); Debug_Null_Pointer(pair); entities.push_back(std::move(pair)); } return std::move(ent); }
6cf3481e175c2449a7671c935ba1fabb357d4369
454ad04d2d9cd6218b61199f8d9c1e153fba3cb9
/file 2/complex.cpp
dd05aefe3c0b59e2e13d188650e45424aea14c2e
[]
no_license
STEPin104272/cpp-intermediate-assignment
21dc3a71ffee51ede0d609a4878aa2880bc78540
6f2bee60b7f685ae2b1d1eef771134abfd2c3e5d
refs/heads/main
2023-02-08T17:14:44.877683
2020-12-23T11:37:21
2020-12-23T11:37:21
323,599,855
0
0
null
null
null
null
UTF-8
C++
false
false
734
cpp
complex.cpp
ifndef __COMPLEX_H #define __COMPLEX_H class Complex { int m_real; int m_imag; public: Complex::Complex(int real,int imag):m-real(0),m_imag(0); { } Complex::Complex(int):m_real(0),m_imag(0); { } Complex::Complex:: operator+(constant Complex& ref) { return Complex(this->m_real+ref.m_real, his->m_imag+ref.m_imag); } Complex::Complex:: operator+(constant Complex& ref) { return Complex(this->m_real-ref.m_real,this->m_imag-ref.m_imag); } Complex::Complex operator*(const Complex& C); { } Complex& Complex::operator++() { this->m_real++; this->m_imag++; return this; } Complex Complex::operator++(int) { } bool Complex::operator==(const Complex&) {
05945be254a35f8597cbfe97506220ffd56db1f4
ae82e05a0b1849cdcc7b2b60c19191f4aa368fbe
/DeviceAdapters/PVCAM/PvRoiCollection.cpp
dbadd4975041183bc6d29d89a8b2dfbcef0556b5
[ "BSD-3-Clause" ]
permissive
mdcurtis/micromanager-upstream
efd0cd7c2dedc46a7015f18f19416ad556619e09
64852cd70f06eb3def0803d40f773c381f8d8f68
refs/heads/master
2020-04-06T07:01:44.069682
2016-07-14T21:16:22
2016-07-14T21:16:22
6,999,340
9
11
null
null
null
null
UTF-8
C++
false
false
5,354
cpp
PvRoiCollection.cpp
#include "PvRoiCollection.h" #include <stdexcept> #include <vector> //============================================================================= PvRoiCollection::PvRoiCollection() : m_capacity(0), m_rois(), m_impliedRoi(0,0,0,0,1,1), m_rgnTypeArray(NULL) { Clear(); } PvRoiCollection::PvRoiCollection(const PvRoiCollection& other) : m_capacity(other.m_capacity), m_rois(other.m_rois), m_impliedRoi(other.m_impliedRoi), m_rgnTypeArray(m_capacity > 0 ? new rgn_type[m_capacity] : NULL) { std::copy(other.m_rgnTypeArray, other.m_rgnTypeArray + m_capacity, m_rgnTypeArray); } PvRoiCollection::~PvRoiCollection() { delete[] m_rgnTypeArray; } //============================================================================= PvRoiCollection& PvRoiCollection::operator=(PvRoiCollection other) { swap(*this, other); return *this; } void PvRoiCollection::swap(PvRoiCollection& first, PvRoiCollection& second) { std::swap(first.m_capacity, second.m_capacity); std::swap(first.m_rois, second.m_rois); std::swap(first.m_impliedRoi, second.m_impliedRoi); std::swap(first.m_rgnTypeArray, second.m_rgnTypeArray); } //============================================================================= void PvRoiCollection::SetCapacity(unsigned int capacity) { m_rois.reserve(capacity); delete[] m_rgnTypeArray; m_rgnTypeArray = new rgn_type[capacity](); m_capacity = capacity; Clear(); } void PvRoiCollection::Add(const PvRoi& newRoi) { const unsigned int oldCount = Count(); if (m_capacity == oldCount) throw std::length_error("Insufficient capacity"); // Add the ROI to our internal array m_rois.push_back(newRoi); // Convert the new ROI to the PVCAM-specific type and add it to the array m_rgnTypeArray[oldCount] = newRoi.ToRgnType(); // Recalculate the implied ROI updateImpliedRoi(); } PvRoi PvRoiCollection::At(unsigned int index) const { return m_rois.at(index); // can throw the out_of_range exc. } void PvRoiCollection::Clear() { m_rois.clear(); m_impliedRoi.SetSensorRgn( (std::numeric_limits<uns16>::max)(), (std::numeric_limits<uns16>::max)(), (std::numeric_limits<uns16>::min)(), (std::numeric_limits<uns16>::min)()); memset(m_rgnTypeArray, 0, sizeof(rgn_type) * m_capacity); } unsigned int PvRoiCollection::Count() const { return static_cast<unsigned int>(m_rois.size()); } void PvRoiCollection::SetBinningX(uns16 bin) { const unsigned int count = Count(); for (unsigned int i = 0; i < count; ++i) { m_rois[i].SetBinningX(bin); m_rgnTypeArray[i].sbin = bin; } m_impliedRoi.SetBinningX(bin); } void PvRoiCollection::SetBinningY(uns16 bin) { const unsigned int count = Count(); for (unsigned int i = 0; i < count; ++i) { m_rois[i].SetBinningY(bin); m_rgnTypeArray[i].pbin = bin; } m_impliedRoi.SetBinningY(bin); } void PvRoiCollection::SetBinning(uns16 bX, uns16 bY) { const unsigned int count = Count(); for (unsigned int i = 0; i < count; ++i) { m_rois[i].SetBinning(bX, bY); m_rgnTypeArray[i].sbin = bX; m_rgnTypeArray[i].pbin = bY; } m_impliedRoi.SetBinning(bX, bY); } void PvRoiCollection::AdjustCoords() { const unsigned int count = Count(); for (unsigned int i = 0; i < count; ++i) { m_rois[i].AdjustCoords(); m_rgnTypeArray[i] = m_rois[i].ToRgnType(); } } uns16 PvRoiCollection::BinX() const { return m_rois[0].BinX(); } uns16 PvRoiCollection::BinY() const { return m_rois[0].BinY(); } PvRoi PvRoiCollection::ImpliedRoi() const { return m_impliedRoi; } rgn_type* PvRoiCollection::ToRgnArray() const { return m_rgnTypeArray; } bool PvRoiCollection::IsValid(uns16 sensorWidth, uns16 sensorHeight) const { const unsigned int count = Count(); for (unsigned int i = 0; i < count; ++i) { if (!m_rois[i].IsValid(sensorWidth, sensorHeight)) return false; } return true; } bool PvRoiCollection::Equals(const PvRoiCollection& other) const { const unsigned int count = Count(); if (count != other.Count()) return false; for (unsigned int i = 0; i < count; ++i) { if (!m_rois[i].Equals(other.At(i))) return false; } return true; } //=================================================================== PROTECTED void PvRoiCollection::updateImpliedRoi() { const unsigned int count = Count(); // Adjust the implied ROI m_impliedRoi = m_rois[0]; for (unsigned int i = 0; i < count; ++i) { const PvRoi& roi = m_rois[i]; const uns16 implX1 = (std::min)(roi.SensorRgnX(), m_impliedRoi.SensorRgnX()); const uns16 implY1 = (std::min)(roi.SensorRgnY(), m_impliedRoi.SensorRgnY()); const uns16 implX2 = (std::max)(roi.SensorRgnX2(), m_impliedRoi.SensorRgnX2()); const uns16 implY2 = (std::max)(roi.SensorRgnY2(), m_impliedRoi.SensorRgnY2()); m_impliedRoi.SetSensorRgn(implX1, implY1, implX2 - implX1 + 1, implY2 - implY1 + 1); } }
2a1886f5f3c91c7a4a0d9d88ec5c434c216cdb31
e2887d9989fdc84a91d02a25d3cc41bf79875924
/MemoryGameV2/src/main.cpp
65bff1d56e6b26100869faba1af7205e5ec8d646
[]
no_license
d-r-72/Memory-GameV2
6ab4f41d45a2e32852913c68dd1b7a789f71883c
3a3f949e1f814039cd10ba3ad3fcdd6b64cbde49
refs/heads/master
2021-01-19T05:07:44.485762
2016-07-06T23:05:50
2016-07-06T23:05:50
62,677,287
0
0
null
null
null
null
UTF-8
C++
false
false
114
cpp
main.cpp
#include <iostream> #include "Game.h" int main(int argc, char* args[]) { Game game; game.Init(); return 0; }
449555070d539ce5469da6822edea657697fe513
86e4eac7ec03c6e959b3e55ae98377d826627c25
/sources/pch.h
cbc27f231b25ad1d64b56346d9766adf8ebffac2
[ "MIT" ]
permissive
Kartonagnick/sqlitedb
a85e0df08742f97910e834e749ef49776ca4261a
307221d1c6b5a96aa04c8c951e61d7af186a9fda
refs/heads/master
2023-03-05T01:11:11.023929
2021-02-18T17:39:37
2021-02-18T17:39:43
332,066,017
0
0
MIT
2021-02-11T17:36:46
2021-01-22T21:25:29
C
UTF-8
C++
false
false
544
h
pch.h
#pragma once #ifdef _MSC_VER #pragma message("pch -> enabled") #include <sqlitedb/confbuild.hpp> #pragma message("sqlitedb: " dFULL_VERSION) #ifdef STABLE_RELEASE #pragma message("Build stable release version") #else #pragma message("Build development version") #endif #endif #include "numeric_cast.hpp" #include <type_traits> #include <sqlite3.h> #include <stdexcept> #include <cassert> #include <cstring> #include <cstdint> #include <memory> #include <string> #include <atomic> #include <tuple>
7e97e074dee60b236db4c96eef7b60637876ab1e
61f81f1d0c79a06ea7acfbfabd8c76bd4a5355e0
/OpenWAM/Source/1DPipes/TPortExtHeat.cpp
7e6a32849bcd6fbf07c2eb2da86fa52bbf00a991
[]
no_license
Greeeder/Program
8e46d46fea6afd61633215f4e8f6fd327cc0731f
b983df23d18a7d05a7fab693e7a9a3af067d48a5
refs/heads/master
2020-05-21T22:15:32.244096
2016-12-02T08:38:05
2016-12-02T08:38:08
63,854,561
3
0
null
null
null
null
WINDOWS-1250
C++
false
false
1,750
cpp
TPortExtHeat.cpp
/* * TPortExtHeat.cpp * * Created on: 3 de feb. de 2016 * Author: farnau */ #include "TPortExtHeat.h" TPortExtHeat::TPortExtHeat() { TComponentArray_ptr Water; Water->resize(1); Water->at(0) = make_shared<TChH2Ol>("Water", __R::Universal, __PM::Air); Cooler = new TFluid(Water); Rho = Eigen::VectorXd::Ones(ncells) * 980; // Engine coolant density; Qrad = Eigen::VectorXd::Zero(ncells); } TPortExtHeat::~TPortExtHeat() { // TODO Auto-generated destructor stub } Eigen::VectorXd TPortExtHeat::Heat(Eigen::VectorXd Twall) { double n1 = 0., n2 = 0.; Tavg = Text; DeltaT = Text - Twall.array(); double Te = Text.mean(); // Usually the external temperature is the same for all cells if(Te < 373) { Visc = Eigen::VectorXd::Ones(ncells) * Cooler->FunVisc(Te); Cond = Eigen::VectorXd::Ones(ncells) * Cooler->Funk(Te); Pr = Eigen::VectorXd::Ones(ncells) * Cooler->Funk(Te); } else { Visc = Eigen::VectorXd::Ones(ncells) * 0.000282; Pr = Eigen::VectorXd::Ones(ncells) * 1.76; Cond = Eigen::VectorXd::Ones(ncells) * 0.6775; } for(int i = 0; i < Twall.size(); i++) { if(Twall(i) < 373) ViscWall(i) = Cooler->FunVisc(Twall(i)); else ViscWall(i) = 0.000282; } Re = Rho * Vext * Lchar / Visc; // Termino de conveccion de Churchill Bernstein for(int i = 0; i < Re.size(); i++) { h(i) = 0.027 * (1 + 24.2 / pow(2.3, 0.7) / pow025(Re(i))) * pow(Re(i), 0.8) * cbrt(Pr(i)) * pow(Visc(i) / ViscWall(i), 0.14) * Cond(i) / (Lchar / 2.3); } Qconv = h * Aext * DeltaT; // Termino de radiación Qtot = Qconv + Qrad; return Qtot.matrix(); } void TPortExtHeat::setVext(double n) { Vext = ArrayXd::Ones(ncells) * 5.64268e-7 * __units::RPMToRPS(n) * TorqueMaxPower / Ncil / pow2(Lchar); }
0bed4b994ece15c7692b55bed46c75b43146b05f
87f7bcbca0ee9cfabb6192054e51eb895a5b4a0a
/DataHelper/MemoryDBHelper.cpp
555f1ed2cb6cbf90fe529406e6085f934e587c91
[]
no_license
zhengbenchang/Baolong
54fefaff2d40f4af345288daf33c8e5c9023c837
aea6267d67ca21a1a6a1da3888408308b7ca6c6b
refs/heads/master
2022-01-05T23:27:17.159649
2018-09-25T00:49:27
2018-09-25T00:49:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,261
cpp
MemoryDBHelper.cpp
#include "MemoryDBHelper.h" MemoryDB m_db; /** * @brief 构造函数 */ MemoryDB::MemoryDB() { pthread_rwlock_init(&m_lock,NULL); } /** * @brief 析构函数 */ MemoryDB::~MemoryDB() {} /** * @brief 根据键名读内存数据库点 * @param 键名 * @return 找不到对应的键值对则返回空字符串 */ string MemoryDB::Read_TagMValue(string key) { pthread_rwlock_rdlock(&m_lock); map<string,TagM>::iterator it = M.find(key); if(it != M.end()) { string res = it->second.value; pthread_rwlock_unlock(&m_lock); return res; } else { pthread_rwlock_unlock(&m_lock); return ""; } } /** * @brief 向内存数据库插入键值对 * @param 键名 * @param 键值 * @return */ bool MemoryDB::Write_TagMValue(string key, string value) { pthread_rwlock_wrlock(&m_lock); map<string,TagM>::iterator it = M.find(key); if(it != M.end()) { it->second.value = value; pthread_rwlock_unlock(&m_lock); return true; } else { TagM m_tag; m_tag.Name = key; m_tag.value = value; M.insert(pair<string,TagM>(m_tag.Name,m_tag)); pthread_rwlock_unlock(&m_lock); return true; } }
64d5c0a4830c36bea9031bd70386b11ee8400285
724bc7ea92e03d244a0065dc9e85b83f855a051e
/src/GpuBuffer.h
08c9d76a8efd794b775780f5c5001d2bf9d61bc7
[ "MIT", "LicenseRef-scancode-public-domain" ]
permissive
jpystynen/vulkantoy
247dc69ae0f55995a7248ae7596284e6dc1dc822
be860c74c1a023cc9d4e49df2b7ed44d3eb24719
refs/heads/master
2020-12-30T14:00:10.969901
2017-05-26T10:07:42
2017-05-26T10:07:42
91,270,207
33
4
null
null
null
null
UTF-8
C++
false
false
10,630
h
GpuBuffer.h
#ifndef CORE_GPU_BUFFER_H #define CORE_GPU_BUFFER_H // Copyright (c) 2017 Johannes Pystynen // This code is licensed under the MIT license (MIT) #include "GfxResources.h" #include <assert.h> #include <algorithm> #include <cstdint> #include <vulkan/vulkan.h> /////////////////////////////////////////////////////////////////////////////// namespace core { // Triple buffered dynamic uniform buffer. class GpuBufferUniform { public: GpuBufferUniform(GfxDevice* const p_gfxDevice, const uint32_t sizeInBytes) // bytesize of a single buffer (even when triple buffered) : mp_device(p_gfxDevice), byteSize(sizeInBytes) { assert(mp_device); assert(mp_device->logicalDevice); assert(byteSize > 0); const uint32_t minByteAlignment = (uint32_t) std::max(mp_device->physicalDeviceProperties.limits.minUniformBufferOffsetAlignment, mp_device->physicalDeviceProperties.limits.minMemoryMapAlignment); byteSize = getAlignedByteSize(byteSize, minByteAlignment); wholeByteSize = byteSize * c_bufferCount; const VkBufferCreateInfo bufferCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType nullptr, // pNext 0, // flags wholeByteSize, // size VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage VK_SHARING_MODE_EXCLUSIVE, // sharingMode 0, // queueFamilyIndexCount nullptr // pQueueFamilyIndices }; CHECK_VK_RESULT_SUCCESS(vkCreateBuffer( mp_device->logicalDevice, // device &bufferCreateInfo, // pCreateInfo nullptr, // pAllocator &buffer)); // pBuffer // allocate memory vkGetBufferMemoryRequirements( mp_device->logicalDevice, // device buffer, // buffer &memoryRequirements); // pMemoryRequirements const VkMemoryPropertyFlags memPropertyFlags = (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); const uint32_t memTypeIndex = getPhysicalDeviceMemoryTypeIndex( mp_device->physicalDeviceMemoryProperties, memoryRequirements, memPropertyFlags); const VkMemoryAllocateInfo memoryAllocateInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType nullptr, // pNext memoryRequirements.size, // allocationSize memTypeIndex, // memoryTypeIndex }; CHECK_VK_RESULT_SUCCESS(vkAllocateMemory( mp_device->logicalDevice, // device &memoryAllocateInfo, // pAllocateInfo nullptr, // pAllocator &m_deviceMemory)); // pMemory CHECK_VK_RESULT_SUCCESS(vkBindBufferMemory( mp_device->logicalDevice, // device buffer, // buffer m_deviceMemory, // memory 0)); // memoryOffset // map the whole coherent buffer CHECK_VK_RESULT_SUCCESS(vkMapMemory( mp_device->logicalDevice, // device m_deviceMemory, // memory 0, // offset wholeByteSize, // size 0, // flags &mp_data)); // ppData } ~GpuBufferUniform() { if (mp_device->logicalDevice) { if (m_deviceMemory) { vkUnmapMemory(mp_device->logicalDevice, m_deviceMemory); vkFreeMemory(mp_device->logicalDevice, m_deviceMemory, nullptr); } if (buffer) { vkDestroyBuffer(mp_device->logicalDevice, buffer, nullptr); } } } GpuBufferUniform(const GpuBufferUniform&) = delete; GpuBufferUniform& operator=(const GpuBufferUniform&) = delete; void copyData(const uint32_t sizeInBytes, const uint8_t* const p_data) { assert(sizeInBytes <= byteSize); // next buffer m_bufferIndex = (m_bufferIndex + 1) % c_bufferCount; const uint32_t minByteSize = std::min((uint32_t)byteSize, sizeInBytes); uint8_t* const offset = (uint8_t*)(mp_data) + m_bufferIndex * byteSize; std::memcpy(offset, p_data, minByteSize); } uint32_t getByteOffset() { return m_bufferIndex * byteSize; } // variables (public for easier access) VkBuffer buffer = nullptr; VkMemoryRequirements memoryRequirements { 0,0,0 }; uint32_t byteSize = 0; // byte size of a single buffer uint32_t wholeByteSize = 0; // byte size of the whole buffer private: const uint32_t c_bufferCount = 3; GfxDevice* const mp_device = nullptr; VkDeviceMemory m_deviceMemory = nullptr; void* mp_data = nullptr; // data pointer for copying data to buffer uint32_t m_bufferIndex = 0; // for triple buffer }; /////////////////////////////////////////////////////////////////////////////// // Staging buffer for copying data to e.g. gpu images. class GpuBufferStaging { public: GpuBufferStaging(GfxDevice* const p_device, const uint32_t sizeInBytes, const uint8_t* const p_inputData) : mp_gfxDevice(p_device), byteSize(sizeInBytes) { assert(mp_gfxDevice); assert(mp_gfxDevice->logicalDevice); assert(byteSize > 0); assert(p_inputData); const uint32_t minByteAlignment = (uint32_t) mp_gfxDevice->physicalDeviceProperties.limits.minMemoryMapAlignment; byteSize = getAlignedByteSize(byteSize, minByteAlignment); const VkBufferCreateInfo bufferCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType nullptr, // pNext 0, // flags byteSize, // size VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, // usage VK_SHARING_MODE_EXCLUSIVE, // sharingMode 0, // queueFamilyIndexCount nullptr // pQueueFamilyIndices }; CHECK_VK_RESULT_SUCCESS(vkCreateBuffer( mp_gfxDevice->logicalDevice,// device &bufferCreateInfo, // pCreateInfo nullptr, // pAllocator &buffer)); // pBuffer // allocate memory vkGetBufferMemoryRequirements( mp_gfxDevice->logicalDevice, // device buffer, // buffer &memoryRequirements); // pMemoryRequirements const VkMemoryPropertyFlags memPropertyFlags = (VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); const uint32_t memTypeIndex = getPhysicalDeviceMemoryTypeIndex( mp_gfxDevice->physicalDeviceMemoryProperties, memoryRequirements, memPropertyFlags); const VkMemoryAllocateInfo memoryAllocateInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, // sType nullptr, // pNext memoryRequirements.size, // allocationSize memTypeIndex, // memoryTypeIndex }; CHECK_VK_RESULT_SUCCESS(vkAllocateMemory( mp_gfxDevice->logicalDevice,// device &memoryAllocateInfo, // pAllocateInfo nullptr, // pAllocator &m_deviceMemory)); // pMemory CHECK_VK_RESULT_SUCCESS(vkBindBufferMemory( mp_gfxDevice->logicalDevice, // device buffer, // buffer m_deviceMemory, // memory 0)); // memoryOffset // copy data to gpu void* p_memOffset = nullptr; CHECK_VK_RESULT_SUCCESS(vkMapMemory( mp_gfxDevice->logicalDevice,// device m_deviceMemory, // memory 0, // offset (VkDeviceSize)byteSize, // size 0, // flags &p_memOffset)); // ppData std::memcpy((uint8_t*)p_memOffset, p_inputData, byteSize); vkUnmapMemory( mp_gfxDevice->logicalDevice, // device m_deviceMemory); // memory } ~GpuBufferStaging() { if (mp_gfxDevice->logicalDevice) { vkDestroyBuffer(mp_gfxDevice->logicalDevice, buffer, nullptr); vkFreeMemory(mp_gfxDevice->logicalDevice, m_deviceMemory, nullptr); } } GpuBufferStaging(const GpuBufferStaging&) = delete; GpuBufferStaging& operator=(const GpuBufferStaging&) = delete; void flushMappedRange() { const VkMappedMemoryRange mappedMemoryRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE, // sType nullptr, // pNext m_deviceMemory, // memory 0, // offset byteSize, // size }; CHECK_VK_RESULT_SUCCESS(vkFlushMappedMemoryRanges( mp_gfxDevice->logicalDevice,// device 1, // memoryRangeCount &mappedMemoryRange)); // pMemoryRanges } // variables (public for easier access) VkBuffer buffer = nullptr; VkMemoryRequirements memoryRequirements = { 0,0,0 }; uint32_t byteSize = 0; // byte size of a single buffer private: GfxDevice* const mp_gfxDevice = nullptr; VkDeviceMemory m_deviceMemory = nullptr; }; } // namespace /////////////////////////////////////////////////////////////////////////////// #endif // CORE_GPU_BUFFER_H
9ef4643b93126fb0dd8f0d7a1a01a9d90cc5aaf8
95e28e3c5169a6d7fa78b5d8d4ffbd8c3bb95714
/src/Connector.h
1b879e51ac3a7342be633be8ccfcaf64479c754a
[]
no_license
emersonmoretto/IMDB
c57763dc10ff5fcaaeafff09b8bcec9791a29f11
714fdc9ef4694a449b49f90198da48cc307792c8
refs/heads/master
2021-01-21T20:47:53.215624
2011-07-12T21:21:27
2011-07-12T21:21:27
2,038,493
1
0
null
null
null
null
UTF-8
C++
false
false
4,713
h
Connector.h
/* * Connector.h * * Created on: 09/12/2010 * Author: root */ #include <string> #include <vector> #include <iostream> #include <cstdlib> #include <iomanip> #include "DTO.h" #include "Util.h" #include "Fonetica.h" #include "Match.h" #include "Levenshtein.h" #ifndef CONNECTOR_H_ #define CONNECTOR_H_ using namespace std; class Connector { private: Connector(); virtual ~Connector(); map <string, DTO *> tree; multimap <string, DTO * > treeName1; //Phono multimap <string, DTO * > treeName2; //multimap <string, DTO * > treeUltimoNomeSoundex; public: static Connector& getInstance() { static Connector * instance = 0; if (!instance) instance = new Connector(); return *instance; } map <string, DTO * > getTree(void){ return tree; } void insert(DTO * dto){ //tree[dto->co_usuario] = dto; tree.insert( pair<string, DTO * > (dto->id, dto) ); treeName1.insert( pair<string, DTO * > (dto->name1, dto) ); treeName2.insert( pair<string, DTO * > (dto->name2, dto) ); } void stats(void){ cout << "Main Tree: " << tree.size() << endl; cout << "\tTree 1 Nome: " << treeName1.size() << endl; //cout << "\tTree Primeiro Nome with key JOSE: " << treePrimeiroNome.count("JOSE") << endl; cout << "\tTree 2 Nome:" << treeName2.size() << endl; // cout << "\tTree treePrimeiroNomeSoundex with key GIUSI: " << treePrimeiroNomeSoundex.count("GIUSI") << endl; //cout << "\tTree treeUltimoNomeSoundex with key SIUVA: " << treeUltimoNomeSoundex.count("SIUVA") << endl; } void searchByPrimeiroNome(string str){ pair<multimap<string, DTO * >::iterator, multimap<string, DTO * >::iterator> ppp; ppp = treeName1.equal_range(str); cout << endl << "Range of "+str+" elements:" << endl; for (multimap<string, DTO * >::iterator it = ppp.first; it != ppp.second; ++it) { DTO * dto = ((DTO *) (*it).second); DTO * dtoCO = tree[dto->id]; cout << " [" << dto->name1 << "]" << endl; if(dto==dtoCO){ cout << "igual " << dto << " " << dtoCO; }else{ cout << "NAOigual " << dto << " " << dtoCO; } } } //RS struct DTOResultSet{ double relevance; DTO * dto; }; //Inverse comparator struct compare { bool operator()(double a, double b) { return a > b; } }; /* multimap <double, DTOResultSet *, compare> searchByNome(string str){ vector<string> result; Util::StringSplit(str,"_", &result); multimap <double, DTOResultSet * , compare> resultSet; if(result.size() < 2) return resultSet; flyweight<string> primeiroNomeSoundex = (flyweight<string>) Fonetica::fonetizar(result.at(0) ); flyweight<string> ultimoNomeSoundex = (flyweight<string>) Fonetica::fonetizar(result.at(1) ); multimap<string, DTO * > * treeToIterate; string treeToIterateKey; bool (*pfmatch)(string,DTO*) = NULL; flyweight<string> matchKey; if(treePrimeiroNomeSoundex.count(primeiroNomeSoundex) > treeUltimoNomeSoundex.count(ultimoNomeSoundex)){ treeToIterate = &treeUltimoNomeSoundex; treeToIterateKey = ultimoNomeSoundex; pfmatch = &matchPrimeiroNome; matchKey = primeiroNomeSoundex; }else{ treeToIterate = &treePrimeiroNomeSoundex; treeToIterateKey = primeiroNomeSoundex; pfmatch = &matchUltimoNome; matchKey = ultimoNomeSoundex; } cout << "treeUltimoNomeSoundex : " << &treeUltimoNomeSoundex << endl; cout << "treePrimeiroNomeSoundex : " << &treePrimeiroNomeSoundex << endl; cout << "Using Tree : " << treeToIterate << endl; cout << "IterateKey : " << treeToIterateKey << endl; cout << "MatchKey : " << matchKey << endl; pair<multimap<string, DTO * >::iterator, multimap<string, DTO * >::iterator> ppp; ppp = treeToIterate->equal_range(treeToIterateKey); for (multimap<string, DTO * >::iterator it = ppp.first; it != ppp.second; ++it) { DTO * dto = ((DTO *) (*it).second); if( (*pfmatch)(matchKey,dto)){ //cout << " [" << dto ->nomeCompleto << "]" << Levenshtein::distance(dto->nomeCompleto, str) << endl; DTOResultSet * dtoTemp = new DTOResultSet; dtoTemp->dto = dto; dtoTemp->relevance = Levenshtein::distance(dto->name1, str) * 100; resultSet.insert( pair<double, DTOResultSet * > (dtoTemp->relevance, dtoTemp) ); } } //Print sorted RS cout << "--- ResultSet ---" << endl; multimap<double, DTOResultSet * >::iterator ii; for( ii = resultSet.begin() ; ii != resultSet.end() ; ++ii) { cout << fixed << setprecision(1) << ((DTOResultSet *) (*ii).second)->relevance << "% \t" << ((DTOResultSet *) (*ii).second)->dto->name1 << endl; } cout << "--- End of ResultSet ---" << endl; //TODO return the resultSet map return resultSet; } */ }; #endif /* CONNECTOR_H_ */
aa6f2d6f78086916c718799b2e3498adb7a94621
7a1b36facabdda1841f152b5c1578bef5c028fb6
/j03-h2-GroupTP/src/managers/GameManager.cpp
7b970b60275088b20ac56cf67b30683176bd232b
[]
no_license
guyllaumedemers/OpenGL-Wolfenstein
2532f52565bf844e0c3e743564e095dc4386994c
b471882447ea923017a09d49455b0408bda1d898
refs/heads/master
2023-05-24T11:31:25.368389
2021-06-16T13:56:12
2021-06-16T13:56:12
367,066,124
1
2
null
null
null
null
UTF-8
C++
false
false
6,650
cpp
GameManager.cpp
// // Created by gdemers on 12/7/2020. // #include "GameManager.h" bool keyPressed = false; GameManager::GameManager() { window = nullptr; context = nullptr; isRunning = false; state = nullptr; m_player = nullptr; isColliding = false; m_skybox = nullptr; uiManager = nullptr; } GameManager::~GameManager() { delete m_player; delete m_skybox; delete uiManager; } void GameManager::initialize(const char *_windowTitle, int _windowPosX, int _windowPosY, int _screenWidth, int _screenHeight, bool fullScreen) { if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { SDL_Log("SDL_Init Failed : ", SDL_GetError()); } if (IMG_Init(IMG_INIT_PNG | IMG_INIT_JPG) == 0) { SDL_Log("IMG_Init Failed : ", IMG_GetError()); } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); GameManager::window = SDL_CreateWindow(_windowTitle, _windowPosX, _windowPosY, _screenWidth, _screenHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN); if (window == NULL) { SDL_Log("Window is NULL"); } GameManager::context = SDL_GL_CreateContext(window); if (context == NULL) { SDL_Log("Context is NULL"); } if (!TTF_WasInit() && TTF_Init() == -1) { printf("TTF_Init: %s\n", TTF_GetError()); exit(1); } if (TTF_Init() == -1) { printf("TTF_Init: %s\n", TTF_GetError()); exit(2); } SDL_SetRelativeMouseMode(SDL_TRUE); SDL_WarpMouseInWindow(window, _screenWidth / 2, _screenHeight / 2); glEnable(GL_DEPTH_TEST); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.1); glMatrixMode(GL_PROJECTION); glLoadIdentity(); TextureManager::init(); MapManager::init(); SoundManager::init(); gluPerspective(70, SCREEN_WIDTH / SCREEN_HEIGHT, 0.1, 500); uiManager = new UiManager(); uiManager->init(); m_player = new Player(25, -25); m_skybox = new Skybox(); Mix_Music *music = SoundManager::getMusic("03 - Get Them Before They Get You E1M1"); if (music != nullptr) { Mix_PlayMusic(music, 1); } GameManager::isRunning = true; // start game loop } void GameManager::handleEvents() { while (SDL_PollEvent(&(GameManager::event))) { if (GameManager::event.type == SDL_MOUSEBUTTONDOWN) { if (GameManager::event.button.button == SDL_BUTTON_LEFT) { if(m_player->getAmmo() >= 1){ // maybe add a rate of fire for the player m_player->fire(); m_player->setAmmo(-1); UiManager::hasFired = true; } } } } GameManager::state = SDL_GetKeyboardState(NULL); SDL_GetRelativeMouseState(&dxMouse, &dyMouse); float oldPlayerXpos = m_player->getCamX(); float oldPlayerZpos = m_player->getCamZ(); float oldPlayerRefX = m_player->getRefX(); float oldPlayerRefZ = m_player->getRefZ(); for (int i = 0; i < WallManager::getWalls().size(); ++i) { isColliding = CollisionManager::checkSphereCollisions(m_player->getSphereCollider(), WallManager::getWalls()[i]->getSphereCollider()); if (isColliding) { break; } } // check enemies collision with walls, if collided change orientation and go the other way EnemyManager::checkCollision(); m_player->move(ROTATE, dxMouse); if (event.type == SDL_QUIT || state[SDL_SCANCODE_ESCAPE]) { isRunning = false; } if (state[SDL_SCANCODE_UP] || state[SDL_SCANCODE_W]) { m_player->move(Direction::FORWARD, -1); } if (state[SDL_SCANCODE_DOWN] || state[SDL_SCANCODE_S]) { m_player->move(Direction::BACKWARD, -1); } if (state[SDL_SCANCODE_LEFT] || state[SDL_SCANCODE_A]) { m_player->move(Direction::LEFT, -1); } if (state[SDL_SCANCODE_RIGHT] || state[SDL_SCANCODE_D]) { m_player->move(Direction::RIGHT, -1); } if (state[SDL_SCANCODE_SPACE]) { //m_player->move(Direction::UP, -1); } if (state[SDL_SCANCODE_C]) { //m_player->move(Direction::DOWN, -1); } if (isColliding) { m_player->setCamX(oldPlayerXpos); m_player->setCamZ(oldPlayerZpos); m_player->setRefX(oldPlayerRefX); m_player->setRefZ(oldPlayerRefZ); } PassiveManager::checkCollision(m_player); } void GameManager::update() { // avoid memory leak m_player->deleteInGameBullets(); // update bullets translation m_player->updateBulletTrajectory(); // need this check otherwise it is doing a collision check with instances of enemy that do not exist if (EnemyManager::checkIsInitialized()) { for (auto it = EnemyManager::s_enemies.begin(); it != EnemyManager::s_enemies.end(); it++) { EnemyManager::checkCollisionBetweenEnemiesAndPlayerBullets(m_player, it->second); } } uiManager->update(m_player); } void GameManager::render() { glClearColor(0.f, 0.f, 0.75f, 1.f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, SCREEN_HEIGHT / 6.f, SCREEN_WIDTH, SCREEN_HEIGHT - (SCREEN_HEIGHT / 6.f)); EnemyManager::initialize(); MapManager::generateWalls(); m_player->cameraPos(); // position de la camera m_skybox->draw(); MapManager::drawPlane(); WallManager::drawWalls(); m_player->drawBullets(); // Enemies update and draw EnemyManager::update(m_player); PassiveManager::draw(); glMatrixMode(GL_PROJECTION_MATRIX); glPushMatrix(); glLoadIdentity(); glOrtho(-6, 25, -1.2, 30, 0, 125); uiManager->render(); glPopMatrix(); glFlush(); SDL_GL_SwapWindow(window); SDL_Delay(15); } void GameManager::quit() { m_player->clear(); EnemyManager::clear(); TextureManager::clear(); WallManager::destructor(); MapManager::destructor(); PassiveManager::destructor(); SoundManager::clear(); uiManager->quit(); SDL_GL_DeleteContext(context); context = nullptr; SDL_DestroyWindow(window); window = nullptr; TTF_Quit(); IMG_Quit(); Mix_Quit(); SDL_Quit(); } bool GameManager::getIsRunning() const { return isRunning; }
73d55c2ba3dc5ac38de7353aa347315f79da8b34
e5292428482181499e59886ad2ee50c83a504f6e
/Reference/Dynamic Programming/Kadane2D.cpp
dae48305cc37a4acb3d5ebd73aafd931af9d6788
[]
no_license
pedrohenriqueos/maratona
fa01ebfe747d647cf4f88c486e1a798b3bcdbb3d
5c9bffa2ec6a321a35c854d4800b4fe7931c1baf
refs/heads/master
2020-03-22T06:35:23.879463
2020-02-27T20:15:53
2020-02-27T20:15:53
139,644,788
0
0
null
null
null
null
UTF-8
C++
false
false
323
cpp
Kadane2D.cpp
int A[N+1][N+1],pd[N+1][N+1]; for(int i=1;i<=N;i++) for(int j=1;j<=N;j++){ scanf("%lld",&A[i][j]); pd[i][j]=pd[i][j-1]+A[i][j]; } int ans=0; for(int i=1;i<=N;i++) for(int j=i+1;j<=N;j++){ int sum=0; for(int k=1;k<=N;k++){ sum += pd[k][j] - pd[k][i-1]; if(sum<0) sum = 0; ans = max(ans, sum); } }
fa52ff19d8a4edc430810676c0695bab5136a779
e6a06912a1ba60afc6dd690b70823464ca489918
/reglib/include/CUndeterminedAutomaton.hpp
2ea63ea79a4f4aac587ad46ed0bb01bc42dc3cba
[]
no_license
Unrealf1/RegularExpressions
80f92dbe33fe1a4c3a83641bbd9414d8bf076776
da7269581c9053153086a4aac2c7fd169a5c2596
refs/heads/master
2020-04-05T05:09:22.309428
2019-03-18T00:06:14
2019-03-18T00:06:14
156,583,283
0
0
null
2019-03-18T00:06:15
2018-11-07T17:25:07
null
UTF-8
C++
false
false
1,358
hpp
CUndeterminedAutomaton.hpp
#pragma once #ifndef CUNDETERMINEDAUTOMATON_HPP_ #define CUNDETERMINEDAUTOMATON_HPP_ //#define DEBUG_ #include <iostream> #include <set> #include <stack> #include <vector> #include "IRegularAutomaton.hpp" #include "General.hpp" #include "UniversalException.hpp" namespace Automatons { struct Node; struct Edge { std::string expression; Node* nd; }; bool operator<(const Edge& left, const Edge& right); struct Node { Node(); int id; static int g_id; std::vector<Edge> children; bool terminal = false; }; class CUndeterminedAutomaton : public IRegularAutomaton { public: CUndeterminedAutomaton(const std::string& regularExpression); ~CUndeterminedAutomaton(); /**check function checks if the word given is in the language*/ bool check(const std::string& word) const; /**print function prints internals of the automaton*/ void print() const; private: Node * root; /**addEpsilon adds all epcilon transitions to the set of active nodes*/ void addEpsilon(std::set<Node*>& active) const; /**build is intended to "relax" all the edges*/ bool build(Node*, std::set<Node*>&); /**buildStackFromExpression returns stack with the last operation on the top and two arguments below*/ std::stack<std::string> buildStackFromExpression(const std::string&) const; }; } #endif //CUNDETERMINEDAUTOMATON_HPP_
9ef32ef36831cfe4cce534ee18155034dea9dc4c
077ad1330f77172a59c7e7621c72bb653d9ff40a
/vulkan-worker/src/common/vulkan_worker.h
bc88497c1fd6b06e1e34cd25ded6858d6470b521
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
google/graphicsfuzz
48e82803e0354c4a92dc913fe36b8f6bae2eaa11
aa32d4cb556647ddaaf2048815bd6bca07d1bdab
refs/heads/master
2023-08-22T18:28:49.278862
2022-03-10T09:08:51
2022-03-10T09:08:51
150,133,859
573
155
Apache-2.0
2023-09-06T18:14:58
2018-09-24T16:31:05
Java
UTF-8
C++
false
false
5,988
h
vulkan_worker.h
// Copyright 2018 The GraphicsFuzz Project Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef __VULKAN_WORKER__ #define __VULKAN_WORKER__ #include <vulkan/vulkan.h> #include <vector> #include "platform.h" #include "gflags/gflags.h" DECLARE_bool(info); DECLARE_bool(skip_render); DECLARE_string(coherence_before); DECLARE_string(coherence_after); DECLARE_int32(num_render); DECLARE_string(png_template); typedef struct Vertex { float x, y, z, w; // position float r, g, b, a; // color } Vertex; typedef struct UniformEntry { size_t size; void *value; } UniformEntry; class VulkanWorker { private: // Platform-specific data PlatformData *platform_data_; // Dimensions uint32_t width_; uint32_t height_; // Shader binaries std::vector<uint32_t> vertex_shader_spv_; std::vector<uint32_t> fragment_shader_spv_; std::vector<uint32_t> coherence_vertex_shader_spv_; std::vector<uint32_t> coherence_fragment_shader_spv_; // Vulkan specific VkInstance instance_; std::vector<VkPhysicalDevice> physical_devices_; VkPhysicalDeviceMemoryProperties physical_device_memory_properties_; VkPhysicalDeviceProperties physical_device_properties_; VkPhysicalDevice physical_device_; std::vector<VkQueueFamilyProperties> queue_family_properties_; uint32_t queue_family_index_; VkQueue queue_; VkDevice device_; VkCommandPool command_pool_; VkCommandBuffer command_buffer_; std::vector<VkCommandBuffer> export_command_buffers_; VkSurfaceKHR surface_; VkFormat format_; VkSwapchainKHR swapchain_; std::vector<VkImage> images_; std::vector<VkImageView> image_views_; VkImage depth_image_; VkDeviceMemory depth_memory_; VkImageView depth_image_view_; std::vector<VkBuffer> uniform_buffers_; std::vector<VkDeviceMemory> uniform_memories_; std::vector<UniformEntry> uniform_entries_; VkDescriptorSetLayout descriptor_set_layout_; VkPipelineLayout pipeline_layout_; VkDescriptorPool descriptor_pool_; VkDescriptorSet descriptor_set_; std::vector<VkDescriptorBufferInfo> descriptor_buffer_infos_; VkRenderPass render_pass_; VkShaderModule vertex_shader_module_; VkShaderModule fragment_shader_module_; VkPipelineShaderStageCreateInfo shader_stages_[2]; std::vector<VkFramebuffer> framebuffers_; VkBuffer vertex_buffer_; VkDeviceMemory vertex_memory_; VkVertexInputBindingDescription vertex_input_binding_description_; VkVertexInputAttributeDescription vertex_input_attribute_description_[2]; VkPipeline graphics_pipeline_; VkSemaphore semaphore_; uint32_t swapchain_image_index_; VkFence fence_; VkImage export_image_; VkDeviceMemory export_image_memory_; VkMemoryRequirements export_image_memory_requirements_; void CreateInstance(); void DestroyInstance(); void EnumeratePhysicalDevices(); void PreparePhysicalDevice(); void GetPhysicalDeviceQueueFamilyProperties(); void FindGraphicsAndPresentQueueFamily(); void CreateDevice(); void DestroyDevice(); void CreateCommandPool(); void DestroyCommandPool(); void AllocateCommandBuffer(); void FreeCommandBuffers(); void CreateSurface(); void FindFormat(); void CreateSwapchain(); void DestroySwapchain(); void GetSwapchainImages(); void CreateSwapchainImageViews(); void DestroySwapchainImageViews(); void CreateDepthImage(); void AllocateDepthMemory(); void BindDepthImageMemory(); void CreateDepthImageView(); void DestroyDepthResources(); void PrepareUniformBuffer(); void DestroyUniformResources(); void CreateDescriptorSetLayout(); void DestroyDescriptorSetLayout(); void CreatePipelineLayout(); void DestroyPipelineLayout(); void CreateDescriptorPool(); void DestroyDescriptorPool(); void AllocateDescriptorSet(); void FreeDescriptorSet(); void UpdateDescriptorSet(); void CreateRenderPass(); void DestroyRenderPass(); void CreateShaderModules(); void DestroyShaderModules(); void PrepareShaderStages(); void CreateFramebuffers(); void DestroyFramebuffers(); void PrepareVertexBufferObject(); void CleanVertexBufferObject(); void CreateGraphicsPipeline(); void DestroyGraphicsPipeline(); void CreateSemaphore(); void DestroySemaphore(); void AcquireNextImage(); void PrepareCommandBuffer(); void CreateFence(); void DestroyFence(); void SubmitCommandBuffer(); void PresentToDisplay(); void LoadUniforms(const char *uniforms_string); void PrepareExport(); void CleanExport(); void ExportPNG(const char *png_filename); void UpdateImageLayout(VkCommandBuffer command_buffer, VkImage image, VkImageLayout old_image_layout, VkImageLayout new_image_layout, VkPipelineStageFlags src_stage_mask, VkPipelineStageFlags dest_stage_mask); void PrepareTest(std::vector<uint32_t> &vertex_spv, std::vector<uint32_t> &fragment_spv, const char *uniforms_string); void CleanTest(); void DrawTest(const char *png_filename, bool skip_render); uint32_t GetMemoryTypeIndex(uint32_t memory_requirements_type_bits, VkMemoryPropertyFlags required_properties); char *GetFileContent(FILE *file); void LoadSpirvFromFile(FILE *source, std::vector<uint32_t> &spv); void LoadSpirvFromArray(unsigned char *array, unsigned int len, std::vector<uint32_t> &spv); public: VulkanWorker(PlatformData *platform_data); ~VulkanWorker(); void RunTest(FILE *vertex_file, FILE *fragment_file, FILE *uniforms_file, bool skip_render); static void DumpWorkerInfo(const char *worker_info_filename); }; #endif
c859b6dfe6f69e3c9c1baf9daef340e5d7d43d00
3aca856b8a0dbc2c4cb6a4fdd38e6514c95aa437
/src/world/Entity.cpp
6b2a53fbbf7f93e419ece3d485d835e61c7763d8
[]
no_license
bauhaus93/blocks
2d612fafe7e7a847c43f0aa78c1b8f2e20dc92f4
8b55d79752fd836e3619128169292e67c9281f8f
refs/heads/master
2021-03-22T04:21:17.198170
2018-12-03T18:37:06
2018-12-03T18:37:06
118,833,320
0
0
null
null
null
null
UTF-8
C++
false
false
1,142
cpp
Entity.cpp
/* Copyright 2018 Jakob Fischer <JakobFischer93@gmail.com> */ #include "Entity.hpp" namespace blocks { Entity::Entity(): position(0.0f), rotation(0.0f, 0.0f, 1.0f), model { glm::mat4(1.0f) } { UpdateModel(); } void Entity::UpdateModel() { model = CreateTranslationMatrix(position) * CreateRotationMatrix(rotation); } void Entity::SetPosition(const Point3f& newPosition) { position = newPosition; UpdateModel(); } void Entity::SetRotation(const Point3f& newRotation) { rotation = newRotation; UpdateModel(); // TODO maybe set flag and only update when next time needed? } void Entity::Move(const Point3f& offset) { position += offset; UpdateModel(); // TODO maybe set flag and only update when next time needed? } void Entity::Rotate(const Point3f& offset) { constexpr float DOUBLE_PI = 2 * M_PI; rotation += offset; for (uint8_t i = 0; i < 3; i++) { if (rotation[i] < 0) { rotation[i] += DOUBLE_PI; } else if (rotation[i] > DOUBLE_PI) { rotation[i] -= DOUBLE_PI; } } UpdateModel(); } } // namespace blocks
acc88c33d0e09634434daa94b31dcbed30096444
c179224f29f2a718d5012a34dc96d90d7d7084f1
/Design_patterns_in_modern_cpp/src/030_Chapter_3/Workspace_unit_test.cpp
62b25cf29eb9f5bea6ee48157b2817ab3e60a677
[ "MIT" ]
permissive
NaPiZip/Programming-basics-cpp
796fd2b0c0fd526949093f2696be119c0e469294
d84bf4baa25fbcf28b12fb06be7a6270c143effc
refs/heads/master
2021-07-08T23:43:04.639204
2020-06-26T12:16:56
2020-06-26T12:16:56
137,138,652
0
0
null
null
null
null
UTF-8
C++
false
false
1,187
cpp
Workspace_unit_test.cpp
// Copyright 2019, Nawin #include "Workspace.h" #include "gtest/gtest.h" #include "gmock/gmock.h" #include <string> #include <sstream> #include <iostream> using ::testing::StartsWith; using ::testing::HasSubstr; using ::testing::StrCaseEq; using ::testing::IsTrue; using ::testing::IsFalse; using std::string_literals::operator""s; namespace { TEST(BasicTest, Positive) { EXPECT_EQ(2 + 3, 5); } TEST(FactoryClass, BasicIntro) { auto p = PointFactory::NewPolar(5, 2.14/2); } TEST(InnerFactoryClass, BasicIntro) { auto p = InnerPoint::Factory::NewPolar(5, 2.14 / 2); } TEST(AbstractFactory, BasicIntro) { auto tea = make_drink("tea"); auto coffee = make_drink("coffee"); } TEST(AbstractFactory, FullFactories) { auto drink_factory = DrinkFactory(); auto tea = drink_factory.make_drink("tea"); auto coffee = drink_factory.make_drink("coffee"); } TEST(FunctionalFactory, FullFactories) { auto drink_factory = DrinkWithVolumeFactory(); auto tea = drink_factory.make_drink("tea"); auto coffee = drink_factory.make_drink("coffee"); } } // namespace
5112e1de0864cfd51227a4253601ae8c8642f38f
e74fbecd30e9ca4b549e97dd3bde0e5af7ae9a2d
/HybridMarkAndCopyGC.cpp
6d3a0de4b4d993832e760c126aaef1994ac20ae4
[]
no_license
dimitroffangel/GarbageCollectors
e02938761e43a429d6f319d04e31ed899057a758
748cd1ffac5fa7485807973e943f80620da81bee
refs/heads/master
2023-07-31T01:35:20.767763
2021-09-03T05:22:35
2021-09-03T05:22:35
400,516,006
0
0
null
null
null
null
UTF-8
C++
false
false
283
cpp
HybridMarkAndCopyGC.cpp
#include "HybridMarkAndCopyGC.h" void HybridMarkAndCopyGC::VisitReference(Object* from, Object** to, void* state) { const auto insert = m_Visited.insert(*to); if (insert.second) { (*to)->VisitReferences(this, state); } } void HybridMarkAndCopyGC::SetRoot(Object** root) { }
087d62746f35660e54207d93cf45c15bec4e4640
fb05550d4ddd7dfdff0eec74e804a0e3abe93f03
/include/object/material/seperable.h
eb987d81c89f0e75b0adde30d7d052a790bcad1b
[]
no_license
FactorialN/chishiki
ee490ae9a95085a42e66c991f678a4eb9dddfdfc
051df0dee224efb0aa76795cdd0068ff5d21b924
refs/heads/master
2020-04-02T13:26:14.298883
2019-10-09T07:23:16
2019-10-09T07:23:16
154,480,998
2
0
null
null
null
null
UTF-8
C++
false
false
484
h
seperable.h
/* * Seperable BSSRDF. */ #ifndef __OBJECT_MATERIAL_SEPERABLE_H__ #define __OBJECT_MATERIAL_SEPERABLE_H__ #include <object/material/bssrdf.h> class SeperableBSSRDF : public BSSRDF{ private: float EPS, rr; public: SeperableBSSRDF(const float &e, const float &r); void sample_r(float &r, float &p, float &fr); void sample_w(const Point &po , const Vector &wo, Vector &wi, float &p); virtual void sample_s(); virtual void sample_sp(const Normal &n); }; #endif
f41bf17825bee3daff1940f68dc0cb18f13f65c8
85423688e100aa844e88e8644402403c8b45a149
/letter/fixed_alphabet_letter/fixed_alphabet_letter.h
aa6e2dd9e516ac6d5301f868bc4a37ec0a35e1c6
[]
no_license
dbezhetskov/huffman
65c9871d5a0c5163c16c61779c7e8f5a9570df70
f8347fe3c925489333652633cc946567c23ada40
refs/heads/master
2023-04-04T19:08:00.656492
2021-04-12T14:43:49
2021-04-12T14:49:26
224,984,891
1
0
null
null
null
null
UTF-8
C++
false
false
4,148
h
fixed_alphabet_letter.h
#ifndef LETTER_FIXED_ALPHABET_LETTER_H_ #define LETTER_FIXED_ALPHABET_LETTER_H_ #include <algorithm> #include <array> #include <cassert> #include <climits> #include <istream> #include <memory> #include <set> #include "bit_io/bit_reader.h" #include "bit_io/bit_writer.h" #include "letter/fixed_alphabet_letter/trie.h" namespace { constexpr std::size_t kParserBufferSizeInBytes = 1024; constexpr std::size_t kMaxLetterSize = 255; } // namespace namespace fixed_alpha_letter { class FixedAlphabetLetterParser final { public: explicit FixedAlphabetLetterParser(std::set<std::string> alphabet, std::shared_ptr<std::istream> input) : input_(std::move(input)) { for (const auto& letter : alphabet) { trie_.Add(letter); } assert(kParserBufferSizeInBytes > trie_.MaxWordLenght()); } std::optional<std::string> Parse() { if (!has_input_ended_ && BufferSize() < trie_.MaxWordLenght()) { if (!FillBuffer()) { return std::nullopt; } } if (IsBufferEmpty()) { return std::nullopt; } auto max = trie_.GetLongestMatchingWord(&buffer_[buffer_start_pos_]); if (max.empty()) { return std::string(1u, buffer_[buffer_start_pos_++]); } buffer_start_pos_ += max.size(); return max; } bool HasNext() const { return BufferSize() > 0 || input_->rdbuf()->in_avail() > 0; } private: std::size_t BufferSize() const { return buffer_end_pos_ - buffer_start_pos_; } std::size_t IsBufferEmpty() const { return BufferSize() == 0u; } bool FillBuffer() { if (has_input_ended_) { // Nothing to do here. return false; } std::copy(std::begin(buffer_) + buffer_start_pos_, std::begin(buffer_) + buffer_end_pos_, std::begin(buffer_)); buffer_end_pos_ = BufferSize(); buffer_start_pos_ = 0u; const std::size_t num_bytes_to_read = kParserBufferSizeInBytes - BufferSize(); input_->read(&buffer_[0] + buffer_end_pos_, num_bytes_to_read); const std::size_t num_bytes_read = input_->gcount(); if (num_bytes_read == 0 || input_->bad()) { return false; } if (input_->fail() || num_bytes_read != num_bytes_to_read) { has_input_ended_ = true; } buffer_end_pos_ += num_bytes_read; return true; } Trie trie_; bool has_input_ended_{false}; std::array<char, kParserBufferSizeInBytes> buffer_; std::size_t buffer_start_pos_{0}; std::size_t buffer_end_pos_{0}; std::shared_ptr<std::istream> input_; }; // namespace fixed_alpha_letter class FixedAlphabetLetterConfig { public: using LetterType = std::string; using LetterParser = FixedAlphabetLetterParser; FixedAlphabetLetterConfig(std::set<std::string> alphabet) : alphabet_(std::move(alphabet)) {} std::unique_ptr<LetterParser> CreateParser( std::shared_ptr<std::istream> input) { return std::make_unique<LetterParser>(alphabet_, std::move(input)); } bool Write(std::ostream& output, LetterType letter) { return static_cast<bool>(output << letter); } bool WriteSerialized(bit_io::BitWriter& bit_output, LetterType letter) { assert(letter.size() < kMaxLetterSize); const auto size = static_cast<std::byte>(letter.size()); if (!bit_output.WriteByte(size)) { return false; } for (const auto symbol : letter) { if (!bit_output.WriteByte(static_cast<std::byte>(symbol))) { return false; } } return true; } std::optional<LetterType> ReadSerialized(bit_io::BitReader& bit_reader) { auto size_byte = bit_reader.ReadByte(); if (!size_byte) { return std::nullopt; } const auto result_size = std::to_integer<std::size_t>(*size_byte); LetterType letter(result_size, '\0'); for (std::size_t num_byte = 0; num_byte < result_size; ++num_byte) { auto byte = bit_reader.ReadByte(); if (!byte) { return std::nullopt; } letter[num_byte] = static_cast<char>(*byte); } return letter; } private: std::set<std::string> alphabet_; }; } // namespace fixed_alpha_letter #endif // LETTER_FIXED_ALPHABET_LETTER_H_
a02b0a8d9f9c2a1b498f50ba8b0126d076e4f446
fafdff5f4a35b6fa0a433b4b957ad66830b99c52
/Function.h
9bfeab64773b88f115691ec17d3c36b72f9dfc54
[]
no_license
DavidSphar/CS5300Project
ee8f639e8cb41d96c775c717a1ab2273f9d6906f
98a5b4c40ed6a9668340d4d640f654ba45eabef1
refs/heads/master
2021-01-24T21:29:58.102280
2016-04-21T00:29:58
2016-04-21T00:29:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,153
h
Function.h
/* * Function.h * * Created on: Apr 7, 2016 * Author: tamnguyen */ #ifndef FUNCTION_H_ #define FUNCTION_H_ #include <iostream> #include <vector> #include <utility> #include "Type.h" class Function { public: Function(std::string n, std::vector<std::pair<std::string, std::shared_ptr<Type>>> a, std::shared_ptr<Type> r, bool d = false): name(n), args(a), returnType(r), defined(d) {} std::string getName() const { return name; } std::vector<std::pair<std::string, std::shared_ptr<Type>>> getArgs() const { return args; } std::shared_ptr<Type> getReturnType() const { return returnType; } bool isDefined() const { return defined; } void setDefined(bool d) { defined = d; } friend std::ostream& operator<<(std::ostream& os, const Function& rhs) { os << rhs.name << std::endl; for (auto& elem: rhs.args) os << elem.first << ", " << elem.second->name() << std::endl; if (rhs.returnType != nullptr) os << rhs.returnType->name() << std::endl; return os; } private: std::string name; std::vector<std::pair<std::string, std::shared_ptr<Type>>> args; std::shared_ptr<Type> returnType; bool defined; }; #endif /* FUNCTION_H_ */
62b64775772af618e4c3bf4521218138582e1f3b
769a9ca492bbadcc1a5806917c2cf0e4f03c8ad8
/132. Palindrome Partitioning II/132. Palindrome Partitioning II/main.cpp
0fc1e06d9e4ad5ec06d74cba7cbe4f304d56f32b
[]
no_license
Lujie1996/Leetcode
7406c84cb6dc9bc004503691a5a4f0e7b02e0e56
1d370ce687ee4b5bde100a31d2c85c12fb78c1de
refs/heads/master
2020-04-04T09:36:05.758785
2019-09-09T01:08:56
2019-09-09T01:08:56
155,824,252
1
0
null
null
null
null
UTF-8
C++
false
false
1,366
cpp
main.cpp
// // main.cpp // 132. Palindrome Partitioning II // // Created by Jie Lu on 2018/4/22. // Copyright © 2018 Jie Lu. All rights reserved. // /* palindrome problems usually traverse in an expansion way : s[i-j], s[i+j] dp solution works in this way: expand from center s[i], while the palindrome substr keep growing to both sides, untill it reaches the boundary or disturbed, then update dp[i+j+i] according to min(dp[i+j+1], dp[i-j]+1); Why use dp[i+j+1] to denote s[0..i+j]? Think of "aba", if dp[i+j] includes the right boundary, then you cannot compare dp[0]+1 and dp[i+j], since dp[0] inclues 'a', here we need to present dp as it excludes dp[i-j]. */ #include <iostream> #include <vector> using namespace std; int minCut(string s) { int n = (int)s.length(); vector<int> dp(n+1, 0); // number of cuts for the first k characters for (int i = 0; i <= n; i++) { dp[i] = i - 1; } for (int i = 0; i < n; i++) { for (int j = 0; i + j < n && i - j >= 0 && s[i-j] == s[i+j]; j++) { dp[i+j+1] = min(dp[i+j+1], dp[i-j] + 1); } for (int j = 1; i + j < n && i - j + 1>= 0 && s[i-j+1] == s[i+j]; j++) { dp[i+j+1] = min(dp[i+j+1], dp[i-j+1] + 1); } } return dp[n]; } int main(int argc, const char * argv[]) { cout<<minCut("ababa")<<endl; return 0; }
e375b67b7791985c0513eab3feef40e9e7dc043f
2fdcf56c5e791dd9a4605a41ef7bc601e2fc9135
/Info/cuburi3/main.cpp
7c224f2d5b7fbb129df46a7237617d5409dd87fd
[]
no_license
DinuCr/CS
42cc4a7920fb5a2ac5e1179930169e4d8d71592e
8d381a622e70dd234d7a978501dcb7cf67e83adc
refs/heads/master
2020-06-02T14:11:49.223214
2020-05-24T01:27:46
2020-05-24T01:27:46
191,174,654
1
0
null
null
null
null
UTF-8
C++
false
false
1,170
cpp
main.cpp
#include <iostream> #include <fstream> #include <utility> #include <algorithm> using namespace std; ifstream fin("cuburi3.in"); ofstream fout("cuburi3.out"); #define f first #define s second #define nmax 4500 pair <int,pair<int,int> > v[nmax]; int d[nmax]; int l[nmax]; int ans[nmax]; int n,i,mx,j,p,poz; bool compare(pair<int,pair<int,int> > a, pair<int,pair<int,int> > b) { return a.f>b.f; } int main() { fin>>n; int a,b; for(i=1; i<=n; ++i) { fin>>a>>b; v[i]=make_pair(a,make_pair(b,i)); } a=0; sort(v+1,v+n+1,compare); for(i=1; i<=n; ++i) { mx=0; p=0; for(j=1; j<i; ++j) if(v[j].s.f>=v[i].s.f) { if(l[j]>=mx) { mx=l[j]; p=j; } } d[i]=d[p]+1; l[i]=mx+v[i].f; ans[i]=p; if(l[i]>a) { a=l[i]; poz=i; } } int k=0; fout<<d[poz]<<' '<<a<<'\n'; while(poz!=0) { ++k; d[k]=v[poz].s.s; poz=ans[poz]; } for(i=k; i>0; --i) fout<<d[i]<<'\n'; }
c644ed363e955c05f318ab5125964bc7470e3dd9
e9bce25b3ee9ebc25b1aa0736f702df8f3e2d4f1
/src/ogre_visuals/marker_with_covariance.cpp
67a48aca8597144f2354d90dd89545cff097283f
[ "BSD-2-Clause" ]
permissive
weilunhuang-jhu/marker_rviz_plugin
32a0ff10c65040dbf1561b19b8e4d6cb3a225c1f
4ec60ec6cb665aec9dd53a3f5d44a118e35090d3
refs/heads/master
2021-01-07T12:25:27.029295
2020-02-19T18:30:17
2020-02-19T18:30:17
241,692,036
0
0
BSD-2-Clause
2020-02-19T18:19:35
2020-02-19T18:19:34
null
UTF-8
C++
false
false
7,416
cpp
marker_with_covariance.cpp
/* * Copyright (c) 2016, Lukas Pfeifhofer <lukas.pfeifhofer@devlabs.pro> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "ogre_visuals/marker_with_covariance.h" #include "rviz/ogre_helpers/shape.h" #include <OGRE/OgreVector3.h> #include <OGRE/OgreSceneNode.h> #define SHAPE_WIDTH_MIN 0.005f // Avoid a complete flat sphere/cylinder namespace marker_rviz_plugin { MarkerWithCovariance::MarkerWithCovariance(Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node, int id) : Marker(scene_manager, parent_node, id) { variance_pos_parent = scene_node_->getParentSceneNode()->createChildSceneNode(); variance_pos_ = new rviz::Shape(rviz::Shape::Sphere, scene_manager_, variance_pos_parent); variance_pos_->setColor(Ogre::ColourValue(1.0, 1.0, 0.0, 0.9f)); variance_pos_->getMaterial()->setReceiveShadows(false); for (int i = 0; i < 3; i++) { variance_rpy_[i] = new rviz::Shape(rviz::Shape::Cylinder, scene_manager_, scene_node_); variance_rpy_[i]->setColor(Ogre::ColourValue((255.0 / 255.0), (85.0 / 255.0), (255.0 / 255.0), 0.6f)); variance_rpy_[i]->getMaterial()->setReceiveShadows(false); } } MarkerWithCovariance::~MarkerWithCovariance() { if(variance_pos_parent) scene_manager_->destroySceneNode(variance_pos_parent); delete variance_pos_; for (int i = 0; i < 3; i++) delete variance_rpy_[i]; } void MarkerWithCovariance::setCovarianceMatrix(boost::array<double, 36> m) { Ogre::Matrix3 cov_xyz = Ogre::Matrix3( m[6 * 0 + 0], m[6 * 0 + 1], m[6 * 0 + 2], m[6 * 1 + 0], m[6 * 1 + 1], m[6 * 1 + 2], m[6 * 2 + 0], m[6 * 2 + 1], m[6 * 2 + 2] ); Ogre::Real eigenvalues[3]; Ogre::Vector3 eigenvectors[3]; cov_xyz.EigenSolveSymmetric(eigenvalues, eigenvectors); if (eigenvalues[0] < 0) eigenvalues[0] = 0; if (eigenvalues[1] < 0) eigenvalues[1] = 0; if (eigenvalues[2] < 0) eigenvalues[2] = 0; variance_pos_parent->setPosition(scene_node_->getPosition()); variance_pos_->setOrientation(Ogre::Quaternion(eigenvectors[0], eigenvectors[1], eigenvectors[2])); variance_pos_->setScale( Ogre::Vector3( fmax(2 * sqrt(eigenvalues[0]), SHAPE_WIDTH_MIN), fmax(2 * sqrt(eigenvalues[1]), SHAPE_WIDTH_MIN), fmax(2 * sqrt(eigenvalues[2]), SHAPE_WIDTH_MIN) ) ); // Roll Ogre::Matrix3 cov_roll = Ogre::Matrix3( m[6 * 4 + 4], m[6 * 4 + 5], 0, m[6 * 5 + 5], m[6 * 5 + 5], 0, 0, 0, 0 ); cov_roll.EigenSolveSymmetric(eigenvalues, eigenvectors); Ogre::Quaternion o = Ogre::Quaternion::IDENTITY; o = o * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Z); o = o * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Y); o = o * (Ogre::Quaternion(Ogre::Matrix3(1, 0, 0, 0, eigenvectors[0][0], eigenvectors[0][1], 0, eigenvectors[1][0], eigenvectors[1][1]))); variance_rpy_[0]->setOrientation(o); variance_rpy_[0]->setPosition(Ogre::Vector3(0.7f, 0.0f, 0.0f)); variance_rpy_[0]->setScale( Ogre::Vector3( fmax(2 * sqrt(eigenvalues[0]), SHAPE_WIDTH_MIN), SHAPE_WIDTH_MIN, fmax(2 * sqrt(eigenvalues[1]), SHAPE_WIDTH_MIN) ) ); // Pitch Ogre::Matrix3 cov_pitch = Ogre::Matrix3( m[6 * 3 + 3], m[6 * 3 + 5], 0, m[6 * 5 + 3], m[6 * 5 + 5], 0, 0, 0, 0 ); cov_pitch.EigenSolveSymmetric(eigenvalues, eigenvectors); o = Ogre::Quaternion::IDENTITY; o = o * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Y); o = o * (Ogre::Quaternion(Ogre::Matrix3(eigenvectors[0][0], 0, eigenvectors[0][1], 0, 1, 0, 0, eigenvectors[1][0], eigenvectors[1][1]))); variance_rpy_[1]->setOrientation(o); variance_rpy_[1]->setPosition(Ogre::Vector3(0.0f, 0.7f, 0.0f)); variance_rpy_[1]->setScale( Ogre::Vector3( fmax(2 * sqrt(eigenvalues[0]), SHAPE_WIDTH_MIN), SHAPE_WIDTH_MIN, fmax(2 * sqrt(eigenvalues[1]), SHAPE_WIDTH_MIN) ) ); // Yaw Ogre::Matrix3 cov_yaw = Ogre::Matrix3( m[6 * 3 + 3], m[6 * 3 + 4], 0, m[6 * 4 + 3], m[6 * 4 + 4], 0, 0, 0, 0 ); cov_yaw.EigenSolveSymmetric(eigenvalues, eigenvectors); o = Ogre::Quaternion::IDENTITY; o = o * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_X); o = o * (Ogre::Quaternion(Ogre::Matrix3(eigenvectors[0][0], eigenvectors[0][1], 0, eigenvectors[1][0], eigenvectors[1][1], 0, 0, 0, 1))); variance_rpy_[2]->setOrientation(o); variance_rpy_[2]->setPosition(Ogre::Vector3(0.0f, 0.0f, 0.7f)); variance_rpy_[2]->setScale( Ogre::Vector3( fmax(2 * sqrt(eigenvalues[0]), SHAPE_WIDTH_MIN), SHAPE_WIDTH_MIN, fmax(2 * sqrt(eigenvalues[1]), SHAPE_WIDTH_MIN) ) ); } void MarkerWithCovariance::setScale(const Ogre::Vector3 &scale) { Marker::setScale(scale); variance_pos_parent->setScale(scale); } }
ee56cbf417f0a9919ea0cb541033a9a6245098b1
d99645b5fc6f74ae42ea7699da31aaaa15e39be4
/P3DPGE/src/systems/SimpleMovementSystem.cpp
f3a567a4a7ac38773d8856ea620757b490b36a30
[ "MIT", "LicenseRef-scancode-public-domain", "Unlicense" ]
permissive
e-sushi/P3DPGE
4107da76b912bc6ac4528023c9acaa4eafa4bd38
64f9799d9db8959e5ffe242b780c74e927c02751
refs/heads/master
2023-03-07T06:27:34.585029
2021-02-17T03:20:09
2021-02-17T03:20:09
310,968,316
1
0
null
null
null
null
UTF-8
C++
false
false
4,581
cpp
SimpleMovementSystem.cpp
#pragma once #include "SimpleMovementSystem.h" #include "../EntityAdmin.h" #include "../internal/olcPixelGameEngine.h" #include "../components/Input.h" #include "../components/Keybinds.h" #include "../components/Camera.h" #include "../components/MovementState.h" #include "../components/Time.h" #include "../components/Screen.h" #include "../internal/imgui/imgui.h" #include "../math/Math.h" EntityAdmin* ladmin; //im not rewriting every function to take admin //turns out there wasnt that many functions void CameraMovement(float deltaTime, Camera* camera, Input* input, Keybinds* binds, uint32 moveState) { if (!ladmin->IMGUI_KEY_CAPTURE) { Vector3 inputs; if (moveState & MOVEMENT_FLYING) { //translate up if (input->KeyDown(binds->movementFlyingUp)) { inputs.y += 1; } //translate down if (input->KeyDown(binds->movementFlyingDown)) { inputs.y -= 1; } } //translate forward if (input->KeyDown(binds->movementFlyingForward)) { inputs += camera->lookDir.yInvert().normalized(); } //translate back if (input->KeyDown(binds->movementFlyingBack)) { inputs -= camera->lookDir.yInvert().normalized(); } //translate right if (input->KeyDown(binds->movementFlyingRight)) { inputs -= camera->lookDir.cross(Vector3::UP).normalized(); } //translate left if (input->KeyDown(binds->movementFlyingLeft)) { inputs += camera->lookDir.cross(Vector3::UP).normalized(); } if (input->KeyHeld(olc::SHIFT)) { camera->position += inputs.normalized() * 16 * deltaTime; } else if (input->KeyHeld(olc::CTRL)) { camera->position += inputs.normalized() * 4 * deltaTime; } else { camera->position += inputs.normalized() * 8 * deltaTime; } } } void CameraRotation(float deltaTime, Camera* camera, Input* input, Keybinds* binds) { if (!ladmin->IMGUI_KEY_CAPTURE) { if (input->KeyPressed(olc::N)) { ladmin->currentCamera->MOUSE_LOOK = !ladmin->currentCamera->MOUSE_LOOK; ladmin->p->bMouseVisible = !ladmin->p->bMouseVisible; } if (!ladmin->currentCamera->MOUSE_LOOK) { //camera rotation up if (input->KeyPressed(binds->cameraRotateUp) || input->KeyHeld(binds->cameraRotateUp)) { if (input->KeyHeld(olc::SHIFT)) { camera->target.z = Math::clamp(camera->target.z + 50 * deltaTime, 1,179); } else if (input->KeyHeld(olc::CTRL)) { camera->target.z = Math::clamp(camera->target.z + 5 * deltaTime, 1,179); } else { camera->target.z = Math::clamp(camera->target.z + 25 * deltaTime, 1,179); } } //camera rotation down if (input->KeyPressed(binds->cameraRotateDown) || input->KeyHeld(binds->cameraRotateDown)) { if (input->KeyHeld(olc::SHIFT)) { camera->target.z = Math::clamp(camera->target.z - 50 * deltaTime, 1,179); } else if (input->KeyHeld(olc::CTRL)) { camera->target.z = Math::clamp(camera->target.z - 5 * deltaTime, 1,179); } else { camera->target.z = Math::clamp(camera->target.z - 25 * deltaTime, 1, 179); } } //camera rotation right if (input->KeyPressed(binds->cameraRotateRight) || input->KeyHeld(binds->cameraRotateRight)) { if (input->KeyHeld(olc::SHIFT)) { camera->target.y -= 50 * deltaTime; } else if (input->KeyHeld(olc::CTRL)) { camera->target.y -= 5 * deltaTime; } else { camera->target.y -= 25 * deltaTime; } } //camera rotation left if (input->KeyPressed(binds->cameraRotateLeft) || input->KeyHeld(binds->cameraRotateLeft)) { if (input->KeyHeld(olc::SHIFT)) { camera->target.y += 50 * deltaTime; } else if (input->KeyHeld(olc::CTRL)) { camera->target.y += 5 * deltaTime; } else { camera->target.y += 25 * deltaTime; } } } else { ladmin->p->bMouseVisible = false; // i have to do this explicitly so the mouse is visible when ImGUI opens the console float x = (ladmin->input->mousePos.x * 2) - ladmin->screen->width; float y = (ladmin->input->mousePos.y * 2) - ladmin->screen->height; camera->target.z = Math::clamp(camera->target.z - 0.09 * y, 1, 179); camera->target.y = camera->target.y - 0.09 * x; ladmin->p->SetMousePositionLocal(ladmin->screen->dimensions / 2); } } else if(ladmin->currentCamera->MOUSE_LOOK) { ladmin->p->bMouseVisible = true; } } void SimpleMovementSystem::Update() { Camera* camera = admin->currentCamera; Input* input = admin->input; Keybinds* binds = admin->currentKeybinds; uint32 moveState = admin->tempMovementState->movementState; float deltaTime = admin->time->deltaTime; ladmin = admin; CameraMovement(deltaTime, camera, input, binds, moveState); CameraRotation(deltaTime, camera, input, binds); }
22cea5dd95364aba1fa972b6c0fc4d75bb2ee974
5095bbe94f3af8dc3b14a331519cfee887f4c07e
/Shared/Components/Data/TDatasource_join.h
c254a030737011df36b30ecd6da736d5aecb2462
[]
no_license
sativa/apsim_development
efc2b584459b43c89e841abf93830db8d523b07a
a90ffef3b4ed8a7d0cce1c169c65364be6e93797
refs/heads/master
2020-12-24T06:53:59.364336
2008-09-17T05:31:07
2008-09-17T05:31:07
64,154,433
0
0
null
null
null
null
UTF-8
C++
false
false
1,698
h
TDatasource_join.h
//--------------------------------------------------------------------------- #ifndef TDatasource_joinH #define TDatasource_joinH //--------------------------------------------------------------------------- #include <SysUtils.hpp> #include <Controls.hpp> #include <Classes.hpp> #include <Forms.hpp> #include "MemTable.hpp" #include <Db.hpp> #include <DBTables.hpp> #include <general\mystring.h> #include <general\myvector.h> #include <set> #include "TDatasource_selection.h" //--------------------------------------------------------------------------- class PACKAGE TDatasource_join : public TMemoryTable { private: class Field { public: string Name; enum TFieldType Type; Field (void) {}; Field (const char* name, enum TFieldType type) : Name (name), Type(type) {} bool operator== (const Field& rhs) const {return (Name == rhs.Name);} bool operator< (const Field& rhs) const {return (Name < rhs.Name);} }; typedef std::set<Field, std::less<Field> > Field_set; TDatasource_selection* FDatasource_selection; void __fastcall DoBeforeOpen(void); void __fastcall DoAfterOpen(void); void Calc_and_store_fields(); void Calc_and_store_records(); void Get_common_fields (vector<TDataSet*> Datasets, Field_set& Common_fields); protected: public: __fastcall TDatasource_join(TComponent* Owner); __published: __property TDatasource_selection* Datasource_selection = {read=FDatasource_selection, write=FDatasource_selection}; }; //--------------------------------------------------------------------------- #endif
c915f7f48f1531b6af101ac7536fa83723573804
d394cc0b4b00523328b9ca79c579f6d3cae5dea7
/client/src/lib/yq_addon/main.cc
c1861dabd5410d95929db8ed2cafa5fc72228e46
[]
no_license
panshangqi/image_scanner_xp
a45730e61f460edee84a559c5b7dd0f60fbcaad6
05e15c8c76d635edffa89aa96e4176fa72ee8f5c
refs/heads/master
2020-04-08T21:46:25.099252
2018-12-29T10:02:30
2018-12-29T10:02:30
159,757,907
0
0
null
null
null
null
UTF-8
C++
false
false
1,233
cc
main.cc
#pragma one #include <node.h> #include <v8.h> #include "./src/delete_files.h" #include "./src/copy_files.h" #include "./src/get_root_files.h" #include "./src/get_disk_info.h" #include "./src/get_folder_size.h" #include "./src/get_root_files_test.h" #include "./src/log.h" // 相当于在 exports 对象中添加 { hello: hello } void init(Handle<Object> exports) { NODE_SET_METHOD(exports, "removeFiles", DF::removeFiles); NODE_SET_METHOD(exports, "copyFiles", CF::copyFiles); // 参数 srcdir(string), dstdir(string), filelist [] (array) NODE_SET_METHOD(exports, "cancelCopyFiles", CF::cancelCopyFiles); // 参数 srcdir(string), dstdir(string), filelist [] (array) NODE_SET_METHOD(exports, "getRootFiles", GRF::getRootFiles); // 参数 dir(string) NODE_SET_METHOD(exports, "getRootFilesTest", GRFT::getRootFilesTest); // 参数 dir(string) NODE_SET_METHOD(exports, "getDiskInfo", GDI::getDiskInfo); // 参数 dir(string) NODE_SET_METHOD(exports, "getFolderSize", GFS::getFolderSize); // 参数 dir(string) NODE_SET_METHOD(exports, "Printf", Log::Printf); // 参数 printf(string) } // 将 export 对象暴露出去s // 原型 `NODE_MODULE(module_name, Initialize)`s NODE_MODULE(yq_addon, init);
f97a969003c00dd26cffa1e3d63226497aace8f3
1e923192b1894160e42f439756da23cb3847c1b7
/RenderLab/src/resources/ResourceManager.h
782ebe9ccdccb3ab1448543fd9fbc6852f6c6b8b
[]
no_license
Doradus/renderLab
f91fca18460b5f4e34064fe78b0a584cbe34996f
c429b1ff3b944397564cce985da9168d9ac5aba2
refs/heads/dev
2021-07-09T10:30:09.253347
2020-08-31T18:53:19
2020-08-31T18:53:19
177,459,371
0
0
null
2019-04-29T05:19:14
2019-03-24T19:27:54
null
UTF-8
C++
false
false
853
h
ResourceManager.h
#pragma once #include "RenderingInterfaceResources.h" #include "FileSystem.h" #include "Image.h" #include <map> class ResourceManager { public: public: static ResourceManager& GetInstance() { static ResourceManager instance; return instance; } private: ResourceManager() {} ResourceManager(ResourceManager const&); void operator=(ResourceManager const&); public: void CreateTextureFromFile(char* fileName, bool generateMipMaps); void GetShaderByteCode(const char* fileName, ShaderStages shaderStage, const ShaderMacro* macros, unsigned int macroCount, unsigned int* byteCodeSize, char** byteCode) const; void AddTexture(std::string name, TextureRI* texture); TextureRI* GetTexture(std::string name) const; void DestroyTexture(std::string name); void DestroyAllTextures(); private: std::map<std::string, TextureRI*> textureCache; };
23f027c41723d35a86cd28f700f33e5a7e20f1cb
cfb178549858b1d1caca7ebb6a43d652f950ab7f
/spellcheckervector.cpp
a18b77831b814ba6b364c855ddb336e849e7ff20
[]
no_license
ErosionXx/SpellChecker
1075b947b96ad8e811675a06286c403b275e886d
12894ac4e32028165d32bb105ad89269d55bf725
refs/heads/master
2020-05-03T17:17:37.803850
2019-05-30T02:21:01
2019-05-30T02:21:01
178,741,498
2
1
null
null
null
null
WINDOWS-1252
C++
false
false
1,615
cpp
spellcheckervector.cpp
#include <iostream> #include <string> #include <cmath> #include <vector> #include <algorithm> using namespace std; int isSimilar(string,string); int main() { vector<string>lis; string input; cin>>input; //11?¡§¡ä¨º¦Ì? while(input!="#"){ lis.push_back(input); cin>>input; } string searchWord; cin>>searchWord; while(searchWord!="#"){ vector<string>::iterator s=find(lis.begin(),lis.end(),searchWord); if(s!=lis.end()) cout<<searchWord<<" is correct"<<endl; else{ cout<<searchWord<<": "; int s = lis.size(); int i=0; while(i<s){ if(isSimilar(searchWord,lis[i])==1) cout<<lis[i]<<" "; i++; } cout<<endl; } cin>>searchWord; } return 0; } //0>> equal;1>>similar;-1>>not similar; int isSimilar(string s1,string s2) { if(s1==s2) return 0; if(s1.length()<s2.length()){ string tmp; tmp= s1; s1=s2; s2=tmp; } int a = s1.length(); int b = s2.length(); if(abs(a-b)>1) return -1; if(a>b){ int i=0; while(i<a) { string tmp = s1.substr(0,i)+s1.substr(i+1,b-i); if(tmp==s2) return 1; else i++; } return -1; } else{ int counter = 0; int i=0; while(i<a){ if(s1[i]!=s2[i]) counter++; i++; } if(counter<=1) return 1; else return -1; } }
3198f2f00094df41122659131dd8246ede7f7d5e
bc38eff56d5b77dad9aba2c5529c9fd576407e0c
/09.Structure/09-01.structure.cpp
61388a23a1b845fd3774203722e2e2044ccb3199
[]
no_license
AllisonLee0507/CPlusPlus_Language_Tutorial
fd58f3c3b53e92f9dcdda258865e4c0f3f4ebc07
84f9b757d80cd5604bb16ebe6585c2fd785cac45
refs/heads/main
2023-07-14T02:59:18.685798
2021-08-22T04:21:13
2021-08-22T04:21:13
398,712,588
0
0
null
null
null
null
UTF-8
C++
false
false
5,930
cpp
09-01.structure.cpp
#if 0 #include <memory> #include <iostream> using namespace std; struct mystruct { int i; int x; int y; }; int main() { mystruct source,destination; source.i = 1; source.x = 2; source.y = 3; memcpy(&destination,&source,sizeof(source)); cout << destination.i << endl; cout << destination.x << endl; cout << destination.y << endl; return 0; } #endif #if 0 #include<iostream.h> #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { struct student { int num; char name[20]; float score; }; struct student stu[4]; struct student *p; int i,temp; float max; for(i=0;i<=4;i++) cin>>stu[i].num>>stu[i].name>>stu[i].score; for(max=stu[0].score,i=1;i<4;i++){ if(stu[i].score>max); { max=stu[i].score;temp=i; } } p=stu+temp; cout<<"maxmum score:"; cout<<"NO.:"<<p->num<<"NAME:"<<p->name<<"SCORE:"<<p->score<<"\n"; } #endif #if 0 #include <iostream.h> struct Time { int hh,mm,ss; }; void Disp1(struct Time t); void Disp2(const Time & t); int main() { Time t1,t2,*p; t1.hh=10; t1.mm=30; t1.ss=0; t2=t1; t2.hh++; p = &t2; cout << "The t2 time is " << p->hh << ":" << t2.mm << ":"<< t1.ss << endl; Disp1(t2); Disp2(t2); return 0; } void Disp1(struct Time t) { cout << "The time is " << t.hh <<":" << t.mm << ":"<< t.ss << endl; } void Disp2(const Time & t) { cout << "The time is " << t.hh <<":" << t.mm << ":"<< t.ss << endl; } #endif #if 0 #include <iostream.h> struct Time { int hh,mm,ss; }; int main() { Time t1,t2,*p; t1.hh=10; t1.mm=30; t1.ss=0; //10:30:0 t2=t1; t2.hh++; //11:30:0 p = &t2; cout << "The t2 time is " << p->hh << ":" << t2.mm << ":"<< t1.ss << endl; return 0; } #endif #if 0 #include <iostream> using std::cout; using std::endl; #include <iostream> struct Name { char firstname[80]; char surname[80]; void show(); }; struct Date { int day; int month; int year; void show(); }; struct Phone { int areacode; int number; void show(); }; struct Person { Name name; Date birthdate; Phone number; void show(); int age(Date& date); }; void Name::show() { std::cout << firstname << " " << surname << std::endl; } void Date::show() { std::cout << month << "/" << day << "/" << year << std::endl; } void Phone::show() { std::cout << areacode << " " << number << std::endl; } void Person::show() { std::cout << std::endl; name.show(); std::cout << "Brithday: "; birthdate.show(); std::cout << "phone: "; number.show(); } int Person::age(Date& date) { if(date.year <= birthdate.year) return 0; int years = date.year - birthdate.year; if((date.month>birthdate.month) || (date.month == birthdate.month && date.day>= birthdate.day)) return years; else return --years; } int main() { Person her = {{ "L", "G" }, // Initializes Name member {1, 4, 1976 }, // Initializes Date member {999,5551234} // Initializes Phone member }; Person actress; actress = her; her.show(); Date today = { 4, 4, 2007 }; cout << endl << "Today is "; today.show(); cout << endl; cout << "Today " << actress.name.firstname << " is " << actress.age(today) << " years old." << endl; return 0; } #endif #if 0 #include <iostream> using std::cout; using std::endl; struct Box { double length; double width; double height; double volume(); }; double Box::volume() { return length * width * height; } int main() { Box aBox = { 1, 2, 3 }; Box* pBox = &aBox; Box* pBox2 = new Box; pBox2->height = pBox->height+5.0; pBox2->length = pBox->length+3.0; pBox2->width = pBox->width+2.0; cout << "Volume of Box in the free store is " << pBox2->volume() << endl; delete pBox; delete pBox2; #endif #if 0 #include <iostream> using std::cout; using std::endl; struct Box { double length; double width; double height; }; int main() { Box firstBox = { 80.0, 50.0, 40.0 }; cout << firstBox.length << firstBox.width << firstBox.height << endl; Box secondBox = firstBox; secondBox.length *= 1.1; secondBox.width *= 1.1; secondBox.height *= 1.1; cout << secondBox.length << secondBox.width << secondBox.height << endl; return 0; } #endif #if 0 #include <iostream> using std::cout; using std::endl; struct Box { double length; double width; double height; }; int main() { Box firstBox = { 80.0, 50.0, 40.0 }; cout << firstBox.length << firstBox.width << firstBox.height << endl; Box secondBox = firstBox; secondBox.length *= 1.1; secondBox.width *= 1.1; secondBox.height *= 1.1; cout << secondBox.length << secondBox.width << secondBox.height << endl; return 0; } #endif #if 0 #include <iostream> #include <math.h> using namespace std; struct math_operations { double data_value; void set_value(double ang) { data_value=ang; } double get_square(void) { double answer; answer=data_value*data_value; return (answer); } double get_square_root(void) { double answer; answer=sqrt(data_value); return (answer); } } math; int main( ) { math.set_value(35.63); cout << "The square of the number is: " << math.get_square( ) << endl; cout << "The square root of the number is: " << math.get_square_root( ) << endl; return (0); } #endif
01286d700a31128a7d4653600363907192d2b32f
a034ec2d52b616c6d319d5a11227bee4eea0f834
/OrcsAndGoblins/MapGenerator.h
48f8d93ee3963a75acea800c3fe297ad4262adb4
[]
no_license
Gijs-W/hairy-bear
86f3cae7dbc5efdd1df540eb9173349666cf5f3c
f0fa33262244371cd83d2c3bd6a13cf834ac6761
refs/heads/master
2021-01-10T21:23:52.492765
2014-11-06T20:36:58
2014-11-06T20:36:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,222
h
MapGenerator.h
#pragma once #include "stdafx.h" #include "Map.h" #include <iostream> #include <string> #include <random> #include <cassert> #include "MapType.h" class MapGenerator { public: virtual ~MapGenerator(); int rngSeed; int x, y; int maxFeatures; int chanceRoom, chanceCorridor; MapGenerator() : rngSeed(std::random_device() ()), x(20), y(20), maxFeatures(100), chanceRoom(90), chanceCorridor(10) { } std::vector<Map>* generate(); private: typedef std::mt19937 RngT; void clearListMap(); bool checkIfUnused(Map& map,int x, int y); bool MakeDungeon(Map& map, RngT& rng, int x, int y); MapType* MakeStairs(Map& map, RngT& rng, int x, int y, int toLevel, Tile type); bool MakeRoom(Map& map, RngT& rng, int x, int y, Direction direction, Tile type, MapType* sourceRoom, int level); bool MakeFirstRoomInDungeon(Map& map, RngT& rng, int x, int y, Tile type); bool MakeCorridor(Map& map, RngT& rng, int x, int y, Direction direction); MapType* getRandomFromCorridor(Map& map, RngT& rng); Direction GetRandomDirection(RngT& rng); int levels = 1; int maxLevels = 5; int xStairs; int yStairs; std::vector<Map>* listMap = new std::vector<Map>(); };
f43eedab583c50173947836913b232deeec4c68a
da457c981a0952aa1bdd9248ea8701a5aad5ba23
/src/sleddebugger/network.h
e44874e9c970b27f57ec65d706f078e2b4b22d8d
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
trixnz/SLED
e9fdabb990a687701646bac42d87249f06f42368
3006d2a20d27db1685cde30129de17e13fb7e63c
refs/heads/master
2021-01-22T21:58:18.603198
2015-07-04T20:53:15
2015-07-04T20:53:15
38,198,759
0
0
null
2015-06-28T12:52:15
2015-06-28T12:52:15
null
UTF-8
C++
false
false
1,953
h
network.h
/* * Copyright (C) Sony Computer Entertainment America LLC. * All Rights Reserved. */ #ifndef __SCE_LIBSLEDDEBUGGER_NETWORK_H__ #define __SCE_LIBSLEDDEBUGGER_NETWORK_H__ #include "params.h" #include "common.h" #include "../sledcore/socket.h" /* target specific headers */ #if SCE_SLEDTARGET_OS_WINDOWS #else #error Not supported #endif /// Namespace for sce classes and functions namespace sce { /// Namespace for Sled classes and functions namespace Sled { class ISequentialAllocator; class SCE_SLED_LINKAGE Network { public: static int32_t create(const NetworkParams& networkParams, void *pLocation, Network **ppNetwork); static int32_t requiredMemory(std::size_t *iRequiredMemory); static int32_t requiredMemoryHelper(ISequentialAllocator *pAllocator, void **ppThis); static void shutdown(Network *pNetwork); public: inline bool isNetworking() const { return m_bNetworking; } inline bool isConnected() const { return m_bConnected; } public: int32_t start(); int32_t stop(); int32_t accept(bool isBlocking); int32_t disconnect(); int32_t send(const uint8_t *pData, const int32_t& iSize); int32_t recv(uint8_t *buf, const int32_t& iSize, bool isBlocking); public: const NetworkParams& getNetworkParams() const { return m_hNetworkParams; } private: Network(const NetworkParams& networkParams, void *pNetworkSeats); ~Network(); Network(const Network&); Network& operator=(const Network&); private: NetworkParams m_hNetworkParams; bool m_bNetworking; bool m_bConnected; bool m_bIpAddrChanged; // For Tcp SceSledPlatformSocket* m_pListenSock; SceSledPlatformSocket* m_pConnectSock; int32_t initializeTcp(); int32_t startTcp(); int32_t stopTcp(); int32_t acceptTcp(bool isBlocking); int32_t sendTcp(const uint8_t *pData, const int32_t& iSize); int32_t recvTcp(uint8_t *buf, const int32_t& iSize, bool isBlocking); }; }} #endif // __SCE_LIBSLEDDEBUGGER_NETWORK_H__
c8e458f9214ab6c33f5dbac78a0a7d0cae99b8cb
9df2f619af3f24ee818ca44730441b35629c8fed
/Bootstrap/Application.h
c99cb65b93a79b768280ef7ddb8c04206f434ea1
[]
no_license
jeremybarzas/OpenGL-Graphics_Engine
db7ef58fd6314efd4b4af6cfccc207a3c445fcc7
f92dd7b2f58948c15c898bcb50c485b7faaebe97
refs/heads/master
2021-01-19T07:28:33.915558
2017-10-18T21:53:27
2017-10-18T21:53:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
407
h
Application.h
#pragma once #include "gl_core_4_4.h" #include <GLFW\glfw3.h> class Application { public: Application(); virtual ~Application(); void run(float width, float height, const char* title, bool fullscreen); protected: virtual void startup() = 0; virtual void update(float) = 0; virtual void draw() = 0; virtual void shutdown() = 0; float prevTime; GLFWmonitor* m_monitor; GLFWwindow* m_window; };
8c7532555c37f1102acf4152b23b99f0afe388e3
6b99453499e7dbe47fcab8f19c6cf2cb3e441183
/src/n-queens/hill_climbing.cc
90e7f26dc1b7b03d4a39f3b74b3b0d11157ffe5d
[ "MIT" ]
permissive
akash-123-svg/puzzle-solver
8d7303de6498106eb105e6e856d3c89d4ac81b0e
b1cd21174faba6afd79a5afd475051a209bcb935
refs/heads/master
2023-01-30T06:59:54.989467
2020-07-07T02:36:02
2020-07-07T02:36:02
302,018,205
0
0
MIT
2020-12-10T17:37:47
2020-10-07T11:42:08
null
UTF-8
C++
false
false
2,062
cc
hill_climbing.cc
// // Created by Islam, Abdullah Al Raqibul on 3/22/20. // #include "core/queen.h" #include "core/board.h" class HillClimbingNQueens : public Solver { public: HillClimbingNQueens(void *_parameter) { HillClimbingNQueens::init(_parameter); } int init(void *_parameter); int run(); void destroy(); private: /* Private Data */ int board_dimension; int mx_sideways_move; bool print_path; vector<NQueenBoard> path; NQueenBoard *initial_state; }; int HillClimbingNQueens::init(void *_parameter) { board_dimension = ((NQueenInitParam *)_parameter)->board_dimension; mx_sideways_move = ((NQueenInitParam *)_parameter)->mx_sideways_move; print_path = ((NQueenInitParam *)_parameter)->print_path; srand (time(NULL)); //initialize random seed initial_state = new NQueenBoard(board_dimension); //initial_state->print_queens(); return 1; } int HillClimbingNQueens::run() { NQueenBoard next = NULL; NQueenBoard current = *initial_state; int iteration = 0; int current_attack = current.calculate_attack(), next_attack; if(print_path) path.push_back(current); while(true) { iteration += 1; next = current.best_successor(); next_attack = next.calculate_attack(); if(print_path) path.push_back(next); //printf("current attack: %d, next attack: %d\n", current_attack, next_attack); if(next_attack == 0) { printf("[success] %d\n", iteration); if(print_path) { int path_size = path.size(); for(int i=0; i<path_size; i+=1) { path[i].print_board(); } } return 1; } else if(current_attack > next_attack) { current = next; current_attack = next_attack; } else if(current_attack <= next_attack) { printf("[failure] %d\n", iteration); return 0; } } } void HillClimbingNQueens::destroy() { free(initial_state); }
c3dab2e42a4e1f03b70b0e7adc812a9cd0d41cba
7a67d0eeafe08eb2d83ead6d0c3408752eafc99f
/cpp/2749.cpp
82083def05cbcd49d95431d2dda39a6ca000a14f
[]
no_license
comicfans/leetcode
73dc02ed12bfb99ecfba78ced622926f4837d46b
1aed41fa4849b24c7bca52561469205499d73213
refs/heads/master
2023-07-06T02:57:20.210937
2023-06-30T02:40:19
2023-06-30T02:40:19
95,645,353
0
0
null
null
null
null
UTF-8
C++
false
false
2,317
cpp
2749.cpp
#include <iostream> using namespace std; class Solution { public: int makeTheIntegerZero(int num1, int num2) { for (int64_t try_number =1; try_number <= 60; ++try_number){ int64_t diff = num1 - num2 * try_number; // can this diff be divided as sum of try_number count 2^i ? (0<=i <= 60) // it can be treated as 10010001 // if number of 1 is larger than try_number , that is impossible // if number of 1 is equal to try_number, just ok // // if number of 1 is smaller than try_number,is it always possible? // always possible if diff >= try_number because // // diff represent as binary, which can be represent as // 1+1+1 .... = diff count, and for any try_number = diff-n // // // why 111 is possible for any 7~3 ? // // 111 7 1,1,1,1,1,1,1 // 111 6 1,1,1,1,1,2 // 111 5 1,1,1,2,2 // 111 4 1,2,2,2 // 111 3 1,2,4 // 101 6 impossible // 101 1 impossible //why 101 is possible for any 5 ~ 2 ? // 101 5 1,1,1,1,1 // 101 4 1,1,1,2 // 101 3 1,2,2 // 101 2 4,1 // // //because this is like 1024 game //for min number just 1 at different binary pos //its always possible to split one value to two value (4->2,2, 2->1,1) //if no one can be split, it just turned into all 1 //and every split just increase 1 count //count how many 1s of binary represent of diff if(diff <1){ return -1; } if(diff < try_number){ continue; } int binary_1s = 0; while((diff >0 ) & (binary_1s < try_number)){ binary_1s += (diff %2 ); diff = diff / 2; } if (diff == 0){ return try_number; } } return -1; } }; int main(){ Solution s; cout<<s.makeTheIntegerZero(3, -2)<<endl; cout<<s.makeTheIntegerZero(5, 7)<<endl; cout<<s.makeTheIntegerZero(112577768,-501662198)<<endl; }
18b0b5efcb739ca9ff3fef02b238ea63edb05d6d
adc310ba0bb94c01e100af390b640418dd03ea88
/DNS Tool source 2/DNS ToolDlg.h
ba308ee479509ffea03649ac9d909819ef950fe6
[]
no_license
faisal82/dns-information-gathering-tool
3d029ce3c37d86dc3fdcb962c0ac14f653e845de
328b12dd536a2443229161e74255129305b3649a
refs/heads/master
2021-01-10T12:10:53.201420
2013-11-28T12:12:56
2013-11-28T12:12:56
51,266,588
0
0
null
null
null
null
UTF-8
C++
false
false
1,537
h
DNS ToolDlg.h
// DNS ToolDlg.h : header file // #pragma once class CDNSToolDlg; #include "afxcmn.h" #include "Shared.h" #include "DlgTLD.h" #include "Serial.h" #include "afxwin.h" // CDNSToolDlg dialog class CDNSToolDlg : public CDialog { // Construction public: CDNSToolDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data enum { IDD = IDD_DNSTOOL_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: CString domain_name; CString from_1; CString from_2; CString from_3; CString from_4; CString to_1; CString to_2; CString to_3; CString to_4; CString number_of_domains; CListCtrl domains_from_ranges; CListCtrl domains_from_domain; CShared* shared; afx_msg void OnBnClickedButton2(); DWORD ThreadId; HANDLE Thread; afx_msg void OnBnClickedButton1(); bool test_running; bool code_ok; CButton but_start; CString status; bool request_cancel; afx_msg void OnStnClickedPic1(); afx_msg void OnBnClickedTip(); BOOL select_all_domain; BOOL select_all_domain2; afx_msg void OnBnClickedCheck1(); afx_msg void OnBnClickedCheck2(); afx_msg void OnBnClickedButton3(); afx_msg void OnBnClickedButton4(); int domains_num; CString* domains; };
c957a422e9f6caf1afdcd488c9c35b1d909af783
ceb64df6ce48b1b63cbbfda4dbb9dc1cc10ae259
/URI/1011 - Sphere/6543231.cpp
2e3132412fd36951a814534b042eb3d9932b66ad
[]
no_license
xack20/Some-of-OJ-s-Solves
672be26c5da7d8d57a2fe0237368cc850466a924
59b6f46ad632ebc43ff295c37dd3e03039f63abb
refs/heads/master
2023-01-31T04:36:13.003736
2020-12-15T22:24:51
2020-12-15T22:24:51
284,292,577
2
0
null
null
null
null
UTF-8
C++
false
false
201
cpp
6543231.cpp
#include <stdio.h> int main() { double R,pi=3.14159,VOLUME; scanf("%lf",&R); VOLUME = (4.0/3)*pi*R*R*R; printf("VOLUME = %.3lf\n",VOLUME); return 0; }
1c829ad670cb1cd114b23f70df4c061923963595
1a2abe960fa8d31017b8a3c05f45c41929d4a7e4
/code/neuralnet_predict/CSVreader.h
867f9492a64cbcbc0c59dd28dd45912b9283f536
[ "MIT" ]
permissive
mcbottcher/ENG5220
86d9b50d46e8097154b9d818e39aaa5872e343cc
e566d7599c2449a4fa3f873eb316cac63cdf98fd
refs/heads/master
2020-12-11T12:17:02.098786
2020-04-19T16:02:50
2020-04-19T16:02:50
233,845,180
4
2
MIT
2020-04-16T13:24:05
2020-01-14T13:15:42
C++
UTF-8
C++
false
false
474
h
CSVreader.h
#include <vector> #include <iostream> using namespace std; class CSVreader{ public: CSVreader(string filename); ~CSVreader(); void readCSV(); void printVectorArray(); vector<vector<float>> getVectorArray(); const long int * getValueArray(); private: string _filename; string line; vector<vector<float>> vectorarray; //TODO dynamically allocate long int valuearray[220]; float fltvaluearray[220]; };
94cfab8073ea508d0e29be30d2f9f50e6cfdde3e
b58cb2c1f8dd04edf29e37d4a12d086a48c4cff7
/src/gui/Util/cleaver_utility.cpp
9414a4a605a9a7efae9dddb73ff441cbb7dbd4e0
[]
no_license
SCIInstitute/cleaver2-cuda
210c9695f9fb677d4f752b6e14fdec0e25058fe7
b3e05aa1365d6dfdd506a09330095ed3c3c6259f
refs/heads/master
2020-04-13T02:50:03.625950
2016-08-08T18:36:56
2016-08-08T18:36:56
20,309,814
0
0
null
null
null
null
UTF-8
C++
false
false
39,760
cpp
cleaver_utility.cpp
/** * @file cleaver_utility.cpp * This file contains the main cleaver operations. * @version Mar. 28, 2014 * @author: Brig Bagley */ #include <cstdlib> #include <cstdio> #include <iostream> #include <fstream> #include <ctime> #include <cmath> #include <cstring> #include <teem/nrrd.h> #include "cleaver_utility.h" #ifdef CUDA_FOUND #include "cleaver_cuda.hh" #endif CleaverUtility::CleaverUtility() : output_("output"), format_("tetgen"), verbose_(true), absolute_resolution_(false), scaled_resolution_(false), data_(nullptr), w_(0), h_(0), d_(0), ww_(0), hh_(0), dd_(0), m_(0), labels_(nullptr), cut_cells_(nullptr), use_GPU_(true), addAir_(false) { device_pointers_[0] = device_pointers_[1] = device_pointers_[2] = NULL; scale_[0] = scale_[1] = scale_[2] = 1.; scalesP_ = nullptr; } CleaverUtility::~CleaverUtility() { if (verbose_) std::cout << "Clean up..." << std::endl; delete[] data_; delete[] labels_; delete[] cut_cells_; delete[] scalesP_; if (verbose_) std::cout << "Done." << std::endl; } void CleaverUtility::ParseInput(int argc, char *argv[]) { if(argc < 2) PrintUsage(); int a = 0; std::string token; while(++a < argc) { token = argv[a]; //------------------------ // Parse Help Flag //------------------------ if(token.compare("-h") == 0) PrintHelp(); //------------------------ // Parse GPU Flag //------------------------ else if(token.compare("--force-CPU") == 0) use_GPU_ = false; //------------------------ // Parse Air Flag //------------------------ else if(token.compare("--add-air") == 0) addAir_ = true; //------------------------ // Parse Silent Flag //------------------------ else if(token.compare("-s") == 0) verbose_ = false; //-------------------------- // Parse Input Flag //-------------------------- else if(token.compare("-i") == 0) { while(++a < argc) { token = argv[a]; if (token.find(".nrrd") == std::string::npos){ token = argv[--a]; break; } inputs_.push_back(token); } m_ = inputs_.size(); } //-------------------------- // Parse Output Flag //-------------------------- else if(token.compare("-o") == 0) { if (++a >= argc) { std::cerr << "No output provided with '-o'." << std::endl; PrintUsage(); } output_ = argv[a]; } //-------------------------- // Parse Format Flag //-------------------------- else if(token.compare("-f") == 0) { if (++a >= argc) { std::cerr << "No format provided with '-f'." << std::endl; PrintUsage(); } format_ = argv[a]; if(!(format_.compare("scirun") == 0 || format_.compare("tetgen") == 0 || format_.compare("matlab") == 0 )) { std::cerr << "invalid output format (-f): " << format_ << std::endl; PrintUsage(); } } //------------------------- // Absolute Resolution Flag //------------------------- else if(token.compare("-ra") == 0) { absolute_resolution_ = true; if(a+3 < argc) { res_[0] = atoi(argv[++a]); res_[1] = atoi(argv[++a]); res_[2] = atoi(argv[++a]); if (res_[0] == 0 || res_[1] == 0 || res_[2] == 0) { std::cerr << "Invalid -ra parameters." << std::endl; PrintUsage(); } } else { std::cerr << "Invalid -ra parameters." << std::endl; PrintUsage(); } } //------------------------- // Scaled Resolution Flag //------------------------- else if(token.compare("-rs") == 0) { scaled_resolution_ = true; if(a+3 < argc) { scale_[0] = atof(argv[++a]); scale_[1] = atof(argv[++a]); scale_[2] = atof(argv[++a]); if (scale_[0] == 0 || scale_[1] == 0 || scale_[2] == 0) { std::cerr << "Invalid -ra parameters." << std::endl; PrintUsage(); } } else { std::cerr << "Invalid -rs parameters." << std::endl; PrintUsage(); } } else { std::cerr << "Unknown option flag: " << token << std::endl; PrintUsage(); } } if (inputs_.size() == 0) { std::cerr << "No inputs were given." << std::endl; PrintUsage(); } } void CleaverUtility::PrintUsage() { std::cerr << "usage: cleaver -i INPUT1.nrrd [INPUT2.nrrd ...] " << "[-h] [-s] [-p] [-as VAL] [-al VAL] [-o NAME] [-f FORMAT] " << "[-ra X Y Z] [-rs X Y Z] \n\n" << std::endl; std::cerr << " -i input filenames minimimum=1 " << std::endl; std::cerr << " -h help " << std::endl; std::cerr << " -s silent mode default=off " << std::endl; // std::cerr << " -as alpha short default=0.357 " << std::endl; // std::cerr << " -al alpha long default=0.203 " << std::endl; std::cerr << " -o output filename default=output" << std::endl; // std::cerr << " -f output format default=tetgen" << std::endl; std::cerr << " -ra x y z absolute resolution" << std::endl; std::cerr << " -rs x y z scaled resolution" << std::endl; std::cerr << " --force-CPU forces CPU only" << std::endl; std::cerr << " --add-air Adds \"Air\" Material" << std::endl; std::cerr << std::endl; // std::cerr << " Valid Parameters: " << std::endl; // std::cerr << " alpha short 0.0 to 1.0" << std::endl; // std::cerr << " alpha long 0.0 to 1.0" << std::endl; // std::cerr << " tetmesh formats tetgen, scirun, matlab" // << std::endl << std::endl; std::cerr << "Examples:" << std::endl; std::cerr << "cleaver -h " << "print help guide" << std::endl; std::cerr << "cleaver -i mat1.nrrd mat2.nrrd " << "basic use" << std::endl; std::cerr << "cleaver -i mat1.nrrd mat2.nrrd -rs .5 .5 .5 " << "scale resolution" << std::endl; std::cerr << "cleaver -i mat1.nrrd mat2.nrrd -o mesh " << "specify target name" << std::endl; std::cerr << "cleaver -i mat1.nrrd mat2.nrrd -ra 100 100 80 " << "absolute resolution" << std::endl; std::cerr << "cleaver -s -i mat1.nrrd mat2.nrrd " << "silent mode" << std::endl << std::endl; exit(0); } void CleaverUtility::PrintHelp() { /********Update Version info Here ****************/ std::string VersionNumber = "1.5.4"; std::string VersionDate = "Dec 20, 2013"; std::string Version = std::string("Version") + " " + VersionNumber + " " + VersionDate; std::cerr << "Cleaver" << std::endl; std::cerr << "A Conforming, Multimaterial, Tetrahedral Mesh Generator" << std::endl; std::cerr << "with Bounded Element Quality." << std::endl; std::cerr << Version << std::endl << std::endl; std::cerr << "Copyright (C) 2013" << std::endl; std::cerr << "Jonathan Bronson" << std::endl; std::cerr << "bronson@sci.utah.edu" << std::endl; std::cerr << "Scientific Computing & Imaging Institute" << std::endl; std::cerr << "University of Utah, School of Computing" << std::endl; std::cerr << "Salt Lake City, Utah" << std::endl << std::endl; std::cerr << "What Can Cleaver Do?" << std::endl << std::endl; std::cerr << " " << "Cleaver generates conforming tetrahedral meshes for" << std::endl; std::cerr << " " << "multimaterial or multiphase volumetric data. Both " << std::endl; std::cerr << " " << "geometric accuracy and element quality are bounded." << std::endl; std::cerr << " " << "The method is a stencil-based approach, and relies " << std::endl; std::cerr << " " << "on an octree structure to provide a coarse level of" << std::endl; std::cerr << " " << "grading in regions of homogeneity. " << std::endl; std::cerr << "What does Cleaver use as input?" << std::endl << std::endl; std::cerr << " " << "The cleaving algorithm works by utilizing indicator" << std::endl; std::cerr << " " << "functions. These functions indicate the strength or" << std::endl; std::cerr << " " << "relative presence of a particular material. At each" << std::endl; std::cerr << " " << "point, only the material with the largest indicator" << std::endl; std::cerr << " " << "value is considered present. In practice, inside- " << std::endl; std::cerr << " " << "outside and distance functions are most common. " << std::endl << std::endl; std::cerr << "What is the input format?" << std::endl; std::cerr << " " << "Cleaver takes the Nearly Raw Raster Data format, or" << std::endl; std::cerr << " " << "NRRD, as input. Information on the format is avail-" << std::endl; std::cerr << " " << "able at the Teem website: " << std::endl; std::cerr << " " << "http://teem.sourceforge.net/nrrd/format.html " << std::endl << std::endl; std::cerr << "What is the output format?" << std::endl; std::cerr << " " << "Cleaver can output into three mesh formats." << std::endl; std::cerr << " " << "1) TetGen: .node, .ele " << std::endl; std::cerr << " " << "2) SCIRun: .pts, .elem, .txt " << std::endl; std::cerr << " " << "3) Matlab: .mat " << std::endl; std::cerr << " " << std::endl; std::cerr << " " << "In addition, Cleaver outputs a .info file " << std::endl; std::cerr << " " << "with more details about the output mesh. " << std::endl << std::endl; PrintUsage(); std::cerr << std::endl << std::endl; } bool CleaverUtility::LoadNRRDs() { clock_t start = clock(); m_ = inputs_.size(); if (m_ <= 0) return false; scales_.clear(); //-------------------------------------------- // Read only headers of each file //------------------------------------------- std::vector<Nrrd*> nins; for(unsigned int i=0; i < inputs_.size(); i++) { // create empty nrrd file container nins.push_back(nrrdNew()); // load only the header, not the data NrrdIoState *nio = nrrdIoStateNew(); nrrdIoStateSet(nio, nrrdIoStateSkipData, AIR_TRUE); // Read in the Header if(verbose_) std::cout << "Reading File: " << inputs_[i] << std::endl; if(nrrdLoad(nins[i], inputs_[i].c_str(), nio)) { char *err = biffGetDone(NRRD); std::cerr << "Trouble Reading File: " << inputs_[i] << " : " << err << std::endl; free(err); nio = nrrdIoStateNix(nio); continue; } // Done with nrrdIoState nio = nrrdIoStateNix(nio); delete nio; if(nins[i]->dim != 3) { std::cerr << "Fatal Error: volume dimension " << nins[i]->dim << ", expected 3." << std::endl; for(size_t j = 0; j < i; j++) nrrdNuke(nins[j]); return false; } } //----------------------------------- // Verify contents match //----------------------------------- bool match = true; for(unsigned i=1; i < inputs_.size(); i++) { if(nins[i]->dim != nins[0]->dim){ std::cerr << "Error, file " << i << " # dims don't match." << std::endl; match = false; } for(unsigned int j=0; j < nins[0]->dim-1; j++) if(nins[i]->axis[j].size != nins[0]->axis[j].size) { std::cerr << "Error, file " << j << " dimensions don't match." << std::endl; match = false; break; } if((int)nrrdElementNumber(nins[i]) != (int)nrrdElementNumber(nins[0])) { std::cerr << "Error, file " << i << " does not contain expected number of elements" << std::endl; std::cerr << "Expected: " << (int)nrrdElementNumber(nins[0]) << std::endl; std::cerr << "Found: " << (int)nrrdElementNumber(nins[i]) << std::endl; match = false; break; } } if(!match) { for (size_t i = 0; i < nins.size(); i++) nrrdNuke(nins[i]); return false; } //----------------------------------- // Save the dimensions //----------------------------------- w_ = ww_ = nins[0]->axis[0].size; h_ = hh_ = nins[0]->axis[1].size; d_ = dd_ = nins[0]->axis[2].size; if(verbose_) std::cout << "Input Dimensions: " << w_ << " x " << h_ << " x " << d_ << std::endl; //--------------------------------------- // Allocate Sufficient Memory //--------------------------------------- size_t total_cells = ww_*hh_*dd_; delete[] data_; data_ = new float[total_cells*m_]; if (!data_) { std::cerr << "failed to allocate data memory." << std::endl; return false; } //-------------------------------------- // Deferred Data Load/Copy //---------------------------------------- for(unsigned int f=0; f < inputs_.size(); f++) { // load nrrd data, reading memory into data array if(nrrdLoad(nins[f], inputs_[f].c_str(), NULL)) { char *err = biffGetDone(NRRD); std::cerr << "trouble reading data in file: " << inputs_[f] << " : " << err << std::endl; free(err); for (size_t i = 0; i < nins.size(); i++) nrrdNuke(nins[i]); return false; } float (*lup)(const void *, size_t I); lup = nrrdFLookup[nins[f]->type]; // cast and copy into large array int s=0; for(size_t k=0; k < d_; k++){ for(size_t j=0; j < h_; j++){ for(size_t i=0; i < w_; i++){ data_[i + j*w_ + k*w_*h_ + f*total_cells ] = lup(nins[f]->data, s++); } } } // set scale float xs = ((Nrrd*)nins[f])->axis[0].spacing; float ys = ((Nrrd*)nins[f])->axis[1].spacing; float zs = ((Nrrd*)nins[f])->axis[2].spacing; // handle NaN cases if(xs != xs) xs = 1.; if(ys != ys) ys = 1.; if(zs != zs) zs = 1.; std::array<float,3> scale = {{ xs, ys, zs }}; scales_.push_back(scale); } if (addAir_ || inputs_.size() == 1) { std::cerr << "Attempting transition mesh with 1 material..." << std::endl; inputs_.resize(inputs_.size()+1); m_ += 1; scales_.resize(scales_.size()+1); scales_[scales_.size()-1] = scales_[0]; float* data2 = new float[total_cells*m_]; for(size_t k=0; k < d_; k++){ for(size_t j=0; j < h_; j++){ for(size_t i=0; i < w_; i++){ for(size_t h=0; h < m_; h++){ size_t base = i + j*w_ + k*w_*h_; size_t base2 = base + h*total_cells; if (h < m_ - 1) data2[base2] = data_[base2]; else { float mx = data_[base]; for(size_t t = 1; t < m_ - 1; t++) mx = std::max(mx,data_[base + t*total_cells]); data2[base2] = -mx; } } } } } delete[] data_; data_ = data2; } delete[] scalesP_; scalesP_ = new float[scales_.size()*3]; for (size_t u = 0; u < scales_.size(); u++) for (size_t v = 0; v < 3; v++) scalesP_[u*3 + v] = scales_.at(u).at(v); //set absolute resolution if(absolute_resolution_ && !scaled_resolution_) { w_ = res_[0]; h_ = res_[1]; d_ = res_[2]; scale_[0] = static_cast<float>(ww_) / static_cast<float>(w_); scale_[1] = static_cast<float>(hh_) / static_cast<float>(h_); scale_[2] = static_cast<float>(dd_) / static_cast<float>(d_); scaled_resolution_ = true; } //scale the resolution else if(scaled_resolution_ && ! absolute_resolution_) { w_ *= scale_[0]; h_ *= scale_[1]; d_ *= scale_[2]; scale_[0] = 1. / scale_[0]; scale_[1] = 1. / scale_[1]; scale_[2] = 1. / scale_[2]; } //scale the resolution and absolute resolution else if(scaled_resolution_ && absolute_resolution_) { w_ = scale_[0] * res_[0]; h_ = scale_[1] * res_[1]; d_ = scale_[2] * res_[2]; scale_[0] = static_cast<float>(ww_) / static_cast<float>(w_); scale_[1] = static_cast<float>(hh_) / static_cast<float>(h_); scale_[2] = static_cast<float>(dd_) / static_cast<float>(d_); } for (size_t i = 0; i < nins.size(); i++) nrrdNuke(nins[i]); //always pad. m_ = inputs_.size()+1; w_++; h_++; d_++; // Allocate memory to find max material in each cell delete[] labels_; labels_ = new char[w_*h_*d_]; if (!labels_) { std::cerr << "Failed to allocate labels char array. " << std::endl; return false; } // Set up a list of booleans for cut/buffer cells. delete[] cut_cells_; cut_cells_ = new bool[w_*h_*d_]; if (!cut_cells_) { std::cerr << "Failed to allocate cuts bool array. " << std::endl; return false; } //set defaults to false for (size_t i = 0; i < w_*h_*d_; i++) cut_cells_[i] = false; double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "\nRead Data:\t\t\t" << duration << " sec." << std::endl; return true; } void CleaverUtility::FindMaxes() { clock_t start = clock(); #ifdef CUDA_FOUND if (use_GPU_) { CleaverCUDA::CallCUDAMaxes(data_,scalesP_,scale_, ww_,hh_,dd_,m_,labels_, w_,h_,d_,device_pointers_); double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Found maxes:\t\t\t" << duration << " sec." << std::endl; return; } #endif for (size_t i = 0; i < w_; i++) for (size_t j = 0; j < h_; j++) for (size_t k = 0; k < d_; k++) { int max = 0; float max_val = CleaverCUDA::DataTransformCUDA( data_,static_cast<float>(i), static_cast<float>(j), static_cast<float>(k), 0,m_,scalesP_,scale_,ww_,hh_,dd_); for (size_t l = 1; l < m_; l++) { float tmp; if ((tmp = CleaverCUDA::DataTransformCUDA( data_,static_cast<float>(i), static_cast<float>(j), static_cast<float>(k), l,m_,scalesP_,scale_,ww_,hh_,dd_)) > max_val) { max_val = tmp; max = l; } } labels_[Idx3(i,j,k)] = max; } double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Found maxes:\t\t\t" << duration << " sec." << std::endl; } void CleaverUtility::FindCutCells() { clock_t start = clock(); for (size_t i = 0; i < w_; i++) for (size_t j = 0; j < h_; j++) for (size_t k = 0; k < d_; k++) { if ((i+1 >= w_) || (j+1 >= h_) || (k+1 >= d_)) continue; if( labels_[Idx3(i,j,k)] != labels_[Idx3(i+1,j,k)] || labels_[Idx3(i,j,k+1)] != labels_[Idx3(i+1,j,k+1)] || labels_[Idx3(i,j,k)] != labels_[Idx3(i,j,k+1)] || labels_[Idx3(i+1,j,k)] != labels_[Idx3(i+1,j,k+1)] || labels_[Idx3(i,j+1,k)] != labels_[Idx3(i+1,j+1,k)] || labels_[Idx3(i,j+1,k+1)] != labels_[Idx3(i+1,j+1,k+1)] || labels_[Idx3(i,j+1,k)] != labels_[Idx3(i,j+1,k+1)] || labels_[Idx3(i+1,j+1,k)] != labels_[Idx3(i+1,j+1,k+1)] || labels_[Idx3(i,j,k)] != labels_[Idx3(i,j+1,k)] || labels_[Idx3(i+1,j,k)] != labels_[Idx3(i+1,j+1,k)] || labels_[Idx3(i,j,k+1)] != labels_[Idx3(i,j+1,k+1)] || labels_[Idx3(i+1,j,k+1)] != labels_[Idx3(i+1,j+1,k+1)]) { cut_cells_[Idx3(i,j,k)] = true; } } //count cells size_t count_cuts = 0; for (size_t i = 0; i < w_*h_*d_; i++) if (cut_cells_[i]) count_cuts++; double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Found cut cells: (" << count_cuts << ")\t" << ((count_cuts < 10000)?"\t":"") << duration << " sec." << std::endl; } size_t CleaverUtility::w() { return w_; } size_t CleaverUtility::h() { return h_; } size_t CleaverUtility::d() { return d_; } size_t CleaverUtility::m() { return m_; } bool CleaverUtility::verbose() { return verbose_; } void CleaverUtility::CalculateCuts(SimpleGeometry& geos) { clock_t start = clock(); #ifdef CUDA_FOUND if (use_GPU_) { size_t count_cuts = CleaverCUDA::CallCUDACuts(device_pointers_[0], device_pointers_[1], device_pointers_[2], ww_,hh_,dd_,m_, w_,h_,d_, geos.GetEdgePointers()[0], geos.GetEdgePointers()[1], geos.GetEdgePointers()[2], cut_cells_); // CleaverCUDA::CallCUDACuts(data_, // scalesP_, // scale_, // ww_,hh_,dd_,m_, // w_,h_,d_, // geos.GetEdgePointers()[0], // geos.GetEdgePointers()[1], // geos.GetEdgePointers()[2], // cut_cells_); // for (size_t tt = 0; tt < 3; tt++) // for (size_t t = 0; t < geos.GetEdgePointersSize()[tt]; t++) // if((geos.GetEdgePointers()[tt][t].isCut_eval & CleaverCUDA::kIsCut)) // std::cout << tt << " - " <<t << " : " << // (int)geos.GetEdgePointers()[tt][t].isCut_eval // << " -- " << geos.GetEdgePointers()[tt][t].cut_loc[0] << ", " // << geos.GetEdgePointers()[tt][t].cut_loc[1] << ", " << // geos.GetEdgePointers()[tt][t].cut_loc[2] << "\n"; double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Found all Cuts: (" << count_cuts << ")\t" << ((count_cuts < 100000)?"\t":"") << duration << " sec." << std::endl; return; } #endif size_t count_cuts = 0; for(size_t i = 0; i < w_; i ++) for(size_t j = 0; j < h_; j ++) for(size_t k = 0; k < d_; k ++) { if(cut_cells_[Idx3(i,j,k)]) { for(size_t l = 0; l < Definitions::kEdgesPerCell; l++) { CleaverCUDA::Edge* edge = geos.GetEdge(Idx3(i,j,k),(CleaverCUDA::edge_index)l); if(!(edge->isCut_eval & CleaverCUDA::kIsEvaluated)) { CleaverCUDA::FindEdgeCutCUDA( data_,scalesP_,scale_,ww_,hh_,dd_,m_,i,j,k,edge, (CleaverCUDA::edge_index)l); if ((edge->isCut_eval & CleaverCUDA::kIsCut)) count_cuts++; } } } } double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Found all Cuts: (" << count_cuts << ")\t" << ((count_cuts < 100000)?"\t":"") << duration << " sec." << std::endl; } std::array<float,3> CleaverUtility::FindTriplePoint( std::array<std::array<float,3>,3> points) { // float epsilon = 1e-5; // float offset = 1e-2; // //get the values of all materials at each point. // std::array<std::vector<float>,3> mats; // for (auto& a : mats) a.resize(m); // for (size_t i = 0; i < 3; i++) // for(size_t j = 0; j < m; j++) // mats[i][j] = data_transform(data,points[i][0], points[i][1], // points[i][2], m,w,h,d); // //get the value of all materials at a point very close to point 1 // // on the line between point 1 and point 2. (X) // float off_pt[3]; // for (auto a = 0; a < 3; a++) // off_pt[a] = offset * points[0][a] + (1.-offset) * points[1][a]; // std::vector<float> off_vals; // for (auto a = 0; a < m; a++) // off_vals.push_back(data_transform(data,off_pt[0], off_pt[1], // off_pt[2], m,w,h,d)); // //find the points on AB and AX where materials are equal. TODO // // //repeat the steps above with AC and CB // // //intersect the 2 lines from both sets of points (the answer.) // // //check that the material values are all very close at this point. // return std::array<float,3>(); std::array<float,3> ans; for (auto a = 0; a < 3; a++) ans[a] = (points[0][a] + points[1][a] + points[2][a]) / 3.; return ans; } void CleaverUtility::CalculateTriples(SimpleGeometry& geos) { clock_t start = clock(); size_t count_trips = 0; for(size_t i = 0; i < w_; i ++) for(size_t j = 0; j < h_; j ++) for(size_t k = 0; k < d_; k ++) { if(cut_cells_[Idx3(i,j,k)]) { for(size_t l = 0; l < Definitions::kFacesPerCell; l++) { SimpleFace* face = geos.GetFace(Idx3(i,j,k), (Definitions::tri_index)l); if(!(face->isCut_eval & CleaverCUDA::kIsEvaluated)) { CalculateTriple(face,(Definitions::tri_index)l,i,j,k,geos); if ((face->isCut_eval & CleaverCUDA::kIsCut)) count_trips++; } } } } double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Found all Triples: (" << count_trips << ")\t" << duration << " sec." << std::endl; } void CleaverUtility::CalculateTriple(SimpleFace *face, Definitions::tri_index num, size_t i, size_t j, size_t k, SimpleGeometry& geos) { face->isCut_eval |= CleaverCUDA::kIsEvaluated; //There are no triples if one of its edges doesn't have a cut. std::array<CleaverCUDA::Edge*,3> edges = geos.GetFaceEdges(Idx3(i,j,k),num,(Definitions::tet_index)(-1)); for (size_t t = 0; t < 3; t++) if (!(edges[t]->isCut_eval & CleaverCUDA::kIsCut)) return; face->isCut_eval |= CleaverCUDA::kIsCut; //get the 3 vertices for the face. // std::array<std::array<float,3>,3> pts; // for (size_t x = 0; x < 3; x++) // for (size_t y = 0; y < 3; y++) // pts[x][y] = edges[x]->cut_loc[y]; // std::array<float,3> res = FindTriplePoint(pts); // for (size_t x = 0; x < 3; x++) // face->cut_loc[x] = res[x]; } void CleaverUtility::CalculateQuadruple(SimpleTet *tet, Definitions::tet_index num, size_t i, size_t j, size_t k, SimpleGeometry& geos) { tet->isCut_eval |= CleaverCUDA::kIsEvaluated; //There are no triples if one of its edges doesn't have a cut. std::array<SimpleFace*,4> faces = geos.GetTetFaces(Idx3(i,j,k),num); //find 3 & 4 edge cut cases. size_t num_cuts = 0; std::array<CleaverCUDA::Edge*,6> edges = geos.GetTetEdges(Idx3(i,j,k),num); for (auto a : edges) if ((a->isCut_eval & CleaverCUDA::kIsCut)) { num_cuts++; if (num_cuts > 2) { tet->isCut_eval |= CleaverCUDA::kHasStencil; break; } } // check for quadruple point for (size_t t = 0; t < 4; t++) if (!(faces[t]->isCut_eval & CleaverCUDA::kIsCut)) return; tet->isCut_eval |= CleaverCUDA::kIsCut; } void CleaverUtility::CalculateQuadruples(SimpleGeometry& geos) { clock_t start = clock(); size_t count_quads = 0; for(size_t i = 0; i < w_; i ++) for(size_t j = 0; j < h_; j ++) for(size_t k = 0; k < d_; k ++) { if(cut_cells_[Idx3(i,j,k)]) { for(size_t l = 0; l < Definitions::kTetsPerCell; l++) { SimpleTet* tet = geos.GetTet(Idx3(i,j,k), (Definitions::tet_index)l); if(!(tet->isCut_eval & CleaverCUDA::kIsEvaluated)) { CalculateQuadruple(tet,(Definitions::tet_index)l,i,j,k,geos); if ((tet->isCut_eval & CleaverCUDA::kIsCut)) count_quads++; } } } } double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Found all Quadruples: (" << count_quads << ")\t" << duration << " sec." << std::endl; } void CleaverUtility::StencilFaces(SimpleGeometry& geos) { clock_t start = clock(); faces_.clear(); verts_.clear(); for(size_t i = 0; i < w_; i ++) for(size_t j = 0; j < h_; j ++) for(size_t k = 0; k < d_; k ++) { if(cut_cells_[Idx3(i,j,k)]) { for (size_t l = 0; l < Definitions::kTetsPerCell; l++) { SimpleTet * tet = geos.GetTet(Idx3(i,j,k), (Definitions::tet_index)l); //don't repeat tets if (!(tet->isCut_eval & CleaverCUDA::kIsStenciled)) { tet->isCut_eval |= CleaverCUDA::kIsStenciled; if ((tet->isCut_eval & CleaverCUDA::kHasStencil)) AccumulateVertsAndFaces( tet,(Definitions::tet_index)l,i,j,k,geos); } } } } double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Generalized/Stenciled Faces.\t" << duration << " sec." << std::endl; } void CleaverUtility::OutputToFile() { clock_t start = clock(); std::ofstream file((output_ + ".ply")); file << "ply" << std::endl; file << "format ascii 1.0" << std::endl; file << "comment " << w_ << " " << h_ << " " << d_ << std::endl; file << "element vertex " << verts_.size() << std::endl; file << "property float x " << std::endl; file << "property float y " << std::endl; file << "property float z " << std::endl; file << "element face " << faces_.size() << std::endl; file << "property list uchar int vertex_index" << std::endl; file << "element color " << faces_.size() << std::endl; file << "property list uchar int face_color" << std::endl; file << "end_header" << std::endl; for(auto a : verts_) file << a[0] << " " << a[1] << " " << a[2] << std::endl; for(auto a : faces_) file << "3 " << a[0] << " " << a[1] << " " << a[2] << std::endl; for(auto a : faces_) file << a[3] << std::endl; file.close(); double duration = ((double)clock() - (double)start) / (double)CLOCKS_PER_SEC; if (verbose_) std::cout << "Wrote faces to file: " << output_ << ".ply\t" << duration << " sec." << std::endl; } std::pair<std::vector<std::array<float,3>>,std::vector<std::array<size_t,4>>> CleaverUtility::GetVertsFacesFromNRRD(std::vector<std::string> &files, float scales[3], std::array<size_t,3> &res, bool useScale, bool useAbs, bool useGPU, bool addAir) { inputs_.clear(); for(auto a : files) inputs_.push_back(a); for(size_t x = 0; x < 3; x++) { if((scaled_resolution_ = useScale)) scale_[x] = scales[x]; if((absolute_resolution_ = useAbs)) res_[x] = res[x]; } this->use_GPU_ = useGPU; this->addAir_ = addAir; /***************************CPU*****************************/ // Load Data if(!LoadNRRDs()) { std::cerr << "Error reading data or allocating memory!" << std::endl; } else { // Find all of the max materials FindMaxes(); // Find all of the cut cells FindCutCells(); //allocate memory for the geometry. size_t w,h,d; w = this->w(); h = this->h(); d = this->d(); SimpleGeometry geos(w,h,d,verbose()); if(!geos.Valid()) { std::cerr << "Error allocating geometric memory!" << std::endl; } else { //geos.TestCells(); // Calculate the cuts CalculateCuts(geos); // Calculate the triples CalculateTriples(geos); // Calculate the quadruples CalculateQuadruples(geos); // Stencil Faces StencilFaces(geos); } } return std::pair<std::vector<std::array<float,3>>, std::vector<std::array<size_t,4>>>(verts_,faces_); } void CleaverUtility::GetVertsFacesFromNRRD(int argc, char *argv[]) { ParseInput(argc,argv); std::vector<std::string> ins; for(auto a : inputs_) ins.push_back(a); GetVertsFacesFromNRRD(ins,scale_,res_, scaled_resolution_,absolute_resolution_, use_GPU_,addAir_); } void CleaverUtility::AccumulateVertsAndFaces( SimpleTet * tet, Definitions::tet_index num, size_t i, size_t j, size_t k, SimpleGeometry& geos) { //set this tet to be evaluated for mesh faces. std::array<Definitions::tri_index,4> tet_faces_num = geos.GetTetFacesNum(num); //first case is when this tet has a quad cut (6 edge cut) if ((tet->isCut_eval & CleaverCUDA::kIsCut)) { //the first vertex is always the quadruple point std::array<float,3> v1 = {{0,0,0}}; std::array<CleaverCUDA::Edge*,6> tedges = geos.GetTetEdges(Idx3(i,j,k),num); for (auto vv : tedges) { for (size_t x = 0; x < 3; x++) v1[x] += (vv->cut_loc[x]); } for (size_t x = 0; x < 3; x++) v1[x] /= 6.; for (size_t f = 0; f < 4; f++) { // the second vertex is 1 of the 4 triples points std::array<float,3> v2 = {{0,0,0}}; std::array<CleaverCUDA::Edge *,3> edges = geos.GetFaceEdges(Idx3(i,j,k),tet_faces_num[f],num); for (size_t e = 0; e < 3; e++) for (size_t x = 0; x < 3; x++) v2[x] += edges[e]->cut_loc[x]; for (size_t x = 0; x < 3; x++) v2[x] /= 3.; for (size_t e = 0; e < 3; e++) { // the third vertex is the cut point for each edge on each face. std::array<float,3> v3 = {{0,0,0}}; for (size_t x = 0; x < 3; x++) v3[x] = edges[e]->cut_loc[x]; AddFace({{ v1, v2, v3 }}, (edges[0]->isCut_eval >> CleaverCUDA::kMaterial)); } } return; } //now look for 2 triple case (5 edge cut) size_t triple_count = 0; std::array<SimpleFace*,4> tet_faces = geos.GetTetFaces(Idx3(i,j,k),num); for (auto a : tet_faces) if ((a->isCut_eval & CleaverCUDA::kIsCut)) triple_count++; if (triple_count == 2) { //get the 2 triple points std::array<float,3> tpA, tpB, shared_cp, fa1, fa2, fb1, fb2; tpA = tpB = shared_cp = fa1 = fa2 = fb1 = fb2 = {{0,0,0}}; std::array<CleaverCUDA::Edge *,3> edges1, edges2, edges3; edges1 = edges2 = edges3 = {{nullptr, nullptr, nullptr}}; for (size_t x = 0; x < 3; x++) { edges1[x] = nullptr; edges2[x] = nullptr; edges3[x] = nullptr; } bool first = true; for (size_t f = 0; f < 4; f++) if ((tet_faces[f]->isCut_eval & CleaverCUDA::kIsCut)) { if (first) { edges1 = geos.GetFaceEdges(Idx3(i,j,k),tet_faces_num[f],num); for (auto aa : edges1) for (size_t x = 0; x < 3; x++) tpA[x] += aa->cut_loc[x]; for (size_t x = 0; x < 3; x++) tpA[x] /= 3.; } else { edges2 = geos.GetFaceEdges(Idx3(i,j,k),tet_faces_num[f],num); for (auto aa : edges2) for (size_t x = 0; x < 3; x++) tpB[x] += aa->cut_loc[x]; for (size_t x = 0; x < 3; x++) tpB[x] /= 3.; } if (!first && edges3[0]) break; first = false; } else if (!edges3[0]) { edges3 = geos.GetFaceEdges(Idx3(i,j,k),tet_faces_num[f],num); } //get the shared edge cut std::array<CleaverCUDA::Edge*,5> edges = {{nullptr,nullptr,nullptr, nullptr,nullptr}}; for (auto& a : edges) a = nullptr; for (auto a: edges1) { for (auto b : edges2) if (a == b) { edges[0] = a; break; } if (edges[0]) break; } //get the independent edge cuts edges[1] = (edges[0]==edges1[0])?edges1[1]:edges1[0]; edges[2] = (edges[0]==edges1[2])?edges1[1]:edges1[2]; edges[3] = (edges[0]==edges2[0])?edges2[1]:edges2[0]; edges[4] = (edges[0]==edges2[2])?edges2[1]:edges2[2]; //determine which face each edge is on bool on_third[4] = { false, false, false, false }; for (size_t t = 0; t < 4; t++) for (size_t u = 0; u < 3; u++) on_third[t] |= (edges3[u] == edges[t+1]); if (on_third[0] != on_third[2]) { CleaverCUDA::Edge * tmp = edges[1]; edges[1] = edges[2]; edges[2] = tmp; } for (size_t x = 0; x < 3; x++) { shared_cp[x] = edges[0]->cut_loc[x]; fa1[x] = edges[1]->cut_loc[x]; fa2[x] = edges[2]->cut_loc[x]; fb1[x] = edges[3]->cut_loc[x]; fb2[x] = edges[4]->cut_loc[x]; } //now add the 5 faces. AddFace({{fa1,tpB,fb1}}, (edges[1]->isCut_eval >> CleaverCUDA::kMaterial)); AddFace({{fa1,tpA,tpB}}, (edges[1]->isCut_eval >> CleaverCUDA::kMaterial)); AddFace({{fa2,tpB,fb2}}, (edges[2]->isCut_eval >> CleaverCUDA::kMaterial)); AddFace({{fa2,tpA,tpB}}, (edges[2]->isCut_eval >> CleaverCUDA::kMaterial)); AddFace({{tpA,tpB,shared_cp}}, (edges[0]->isCut_eval >> CleaverCUDA::kMaterial)); return; } //now deal with 3 & 4 edge cut cases. std::array<CleaverCUDA::Edge *,3> edges = {{nullptr,nullptr,nullptr}}; std::vector<std::pair<std::array<float,3>,std::vector<size_t>> > pts; std::vector<char> mats; for (auto& a : pts) a.first = {{0,0,0}}; for (size_t f = 0; f < 4; f++) { std::array<CleaverCUDA::Edge *,3> edges = geos.GetFaceEdges(Idx3(i,j,k),tet_faces_num[f],num); for(auto a : edges) if ((a->isCut_eval & CleaverCUDA::kIsCut)) { //add the point to list of points. std::array<float,3> pt = {{a->cut_loc[0], a->cut_loc[1],a->cut_loc[2]}}; bool found = false; for(size_t t = 0; t < pts.size(); t++) if ((pts[t].first[0] == pt[0]) && (pts[t].first[1] == pt[1]) && (pts[t].first[2] == pt[2])) { pts[t].second.push_back(f); found = true; break; } if (!found) { std::vector<size_t> tmp; tmp.push_back(f); pts.push_back(std::pair<std::array<float,3>, std::vector<size_t>>(pt,tmp)); mats.push_back(a->isCut_eval >> CleaverCUDA::kMaterial); } } } if (mats.size() == 0) return; //find the most common material. std::vector<std::pair<char,char> > mat_cnts; for (auto a : mats) { bool found = false; for (size_t b = 0; b < mat_cnts.size(); b++) if (mat_cnts[b].first == a) { found = true; mat_cnts[b].second ++; } if (!found) mat_cnts.push_back(std::pair<char,char>(a,1)); } char face_mat = mat_cnts[0].first; char greatest = mat_cnts[0].second; for (size_t b = 1; b < mat_cnts.size(); b++) if (mat_cnts[b].second > greatest) { greatest = mat_cnts[b].second; face_mat = mat_cnts[b].first; } if (pts.size() == 4) { size_t C = 3; if ((pts[0].second[0] != pts[2].second[0]) && (pts[0].second[0] != pts[2].second[1]) && (pts[0].second[1] != pts[2].second[0]) && (pts[0].second[1] != pts[2].second[1])) C = 2; size_t D = (C==2)?3:2; AddFace({{pts[0].first,pts[C].first,pts[1].first}},face_mat); AddFace({{pts[0].first,pts[C].first,pts[D].first}},face_mat); } //now deal with 3 edge cut cases. if (pts.size() == 3) { AddFace({{pts[0].first,pts[1].first,pts[2].first}},face_mat); } } void CleaverUtility::AddFace( std::array<std::array<float,3>,3> face, char mat) { //shift to center on 0,0,0. for (auto &a : face) { a[0] -= (ww_ >> 1); a[1] -= (hh_ >> 1); a[2] -= (dd_ >> 1); } std::array<size_t,4> new_face = {{0,0,0,static_cast<size_t>(mat)}}; for (size_t i = 0; i < 3; i++) { new_face[i] = verts_.size(); verts_.push_back(face[i]); } faces_.push_back(new_face); }
af8454b666dfc02a7b87629e8d58e252084e8593
1911d535c0904709c2f1a5a4e167264db37db555
/F - Copy - Copy/F/PlayerControler.h
60229728bb34d17bb10a458e7460fa2e397e5aaf
[]
no_license
MarcusCallender/MyPortfolioRepository
0c61ba30059d77ecd40c41c08d576d2d495cb1ff
fe7ac0408f833cf2c7c0df88842e84e24d4c511c
refs/heads/master
2021-01-12T13:38:23.479168
2016-10-01T16:43:53
2016-10-01T16:43:53
69,455,857
0
0
null
null
null
null
UTF-8
C++
false
false
232
h
PlayerControler.h
#ifndef __PLAYER_COTROLER__ #define __PLAYER_COTROLER__ #include "BaseControler.h" class C_PlayerControler : C_BaseControler { public: C_PlayerControler(); ~C_PlayerControler(); protected: }; #endif // !__PLAYER_COTROLER__
80eba487301574d91f7bda63a1b9a4832a6711fd
d96ebf4dac46404a46253afba5ba5fc985d5f6fc
/third_party/libwebrtc/modules/audio_processing/aec3/subtractor_output.cc
08fa3d4f69f95afd51fa769dc72a229927b0007f
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
marco-c/gecko-dev-wordified-and-comments-removed
f9de100d716661bd67a3e7e3d4578df48c87733d
74cb3d31740be3ea5aba5cb7b3f91244977ea350
refs/heads/master
2023-08-04T23:19:13.836981
2023-08-01T00:33:54
2023-08-01T00:33:54
211,297,165
1
0
null
null
null
null
UTF-8
C++
false
false
1,671
cc
subtractor_output.cc
# include " modules / audio_processing / aec3 / subtractor_output . h " # include < numeric > namespace webrtc { SubtractorOutput : : SubtractorOutput ( ) = default ; SubtractorOutput : : ~ SubtractorOutput ( ) = default ; void SubtractorOutput : : Reset ( ) { s_refined . fill ( 0 . f ) ; s_coarse . fill ( 0 . f ) ; e_refined . fill ( 0 . f ) ; e_coarse . fill ( 0 . f ) ; E_refined . re . fill ( 0 . f ) ; E_refined . im . fill ( 0 . f ) ; E2_refined . fill ( 0 . f ) ; E2_coarse . fill ( 0 . f ) ; e2_refined = 0 . f ; e2_coarse = 0 . f ; s2_refined = 0 . f ; s2_coarse = 0 . f ; y2 = 0 . f ; } void SubtractorOutput : : ComputeMetrics ( rtc : : ArrayView < const float > y ) { const auto sum_of_squares = [ ] ( float a float b ) { return a + b * b ; } ; y2 = std : : accumulate ( y . begin ( ) y . end ( ) 0 . f sum_of_squares ) ; e2_refined = std : : accumulate ( e_refined . begin ( ) e_refined . end ( ) 0 . f sum_of_squares ) ; e2_coarse = std : : accumulate ( e_coarse . begin ( ) e_coarse . end ( ) 0 . f sum_of_squares ) ; s2_refined = std : : accumulate ( s_refined . begin ( ) s_refined . end ( ) 0 . f sum_of_squares ) ; s2_coarse = std : : accumulate ( s_coarse . begin ( ) s_coarse . end ( ) 0 . f sum_of_squares ) ; s_refined_max_abs = * std : : max_element ( s_refined . begin ( ) s_refined . end ( ) ) ; s_refined_max_abs = std : : max ( s_refined_max_abs - ( * std : : min_element ( s_refined . begin ( ) s_refined . end ( ) ) ) ) ; s_coarse_max_abs = * std : : max_element ( s_coarse . begin ( ) s_coarse . end ( ) ) ; s_coarse_max_abs = std : : max ( s_coarse_max_abs - ( * std : : min_element ( s_coarse . begin ( ) s_coarse . end ( ) ) ) ) ; } }
e53cf16192689bf6187338a2be2f9256025938f4
12ef9b58bd8e5630de2a493cb805f0483395c6c6
/xrand.cpp
9f42c211ca20d0a3d74545c40cef457a5a338dfb
[]
no_license
kuustudio/xlib
c710c050dd8ea72aa90a923eb3937472fee0a71b
4b0a36c62b79fb84222537d5e050a94857e5161f
refs/heads/master
2021-06-05T14:09:16.028150
2016-10-18T05:51:31
2016-10-18T05:51:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
632
cpp
xrand.cpp
#include "xrand.h" #include <stdlib.h> #pragma warning(push) #pragma warning(disable:4244) //warning C4244: “初始化”: 从“ULONG64”转换到“const unsigned int”,可能丢失数据 size_t xrand(const size_t mod) { //! 由于重要性不是很高,随机数的生成可以忽视多线程读写问题 static size_t gk_xrand_seed = 0; const size_t r = __rdtsc(); #if _WIN64 const int l = r % 64; gk_xrand_seed += _rotl64(r,l); #else const int l = r % 32; gk_xrand_seed += _lrotl(r,l); #endif return (mod) ? (gk_xrand_seed % mod) : (gk_xrand_seed); } #pragma warning(pop)
c41252dce6d97ef4cf02f88aa095d76368608832
3782e25b6db35d82d63bb81e398deab85ef2236e
/Drv/LinuxUartDriver/LinuxUartDriver.cpp
b099e7c15c339ca06d3950303067d2b349aedba4
[ "Apache-2.0" ]
permissive
nasa/fprime
e0c8d45dfc0ff08b5ef6c42a31f47430ba92c956
a56426adbb888ce4f5a8c6a2be3071a25b11da16
refs/heads/devel
2023-09-03T15:10:33.578646
2023-08-29T15:39:59
2023-08-29T15:39:59
95,114,723
10,071
1,426
Apache-2.0
2023-09-08T14:31:00
2017-06-22T12:45:27
C++
UTF-8
C++
false
false
13,284
cpp
LinuxUartDriver.cpp
// ====================================================================== // \title LinuxUartDriverImpl.cpp // \author tcanham // \brief cpp file for LinuxUartDriver component implementation class // // \copyright // Copyright 2009-2015, by the California Institute of Technology. // ALL RIGHTS RESERVED. United States Government Sponsorship // acknowledged. // // ====================================================================== #include <unistd.h> #include <Drv/LinuxUartDriver/LinuxUartDriver.hpp> #include <Os/TaskString.hpp> #include "Fw/Types/BasicTypes.hpp" #include <fcntl.h> #include <termios.h> #include <cerrno> //#include <cstdlib> //#include <cstdio> //#define DEBUG_PRINT(x,...) printf(x,##__VA_ARGS__); fflush(stdout) #define DEBUG_PRINT(x, ...) namespace Drv { // ---------------------------------------------------------------------- // Construction, initialization, and destruction // ---------------------------------------------------------------------- LinuxUartDriver ::LinuxUartDriver(const char* const compName) : LinuxUartDriverComponentBase(compName), m_fd(-1), m_allocationSize(-1), m_device("NOT_EXIST"), m_quitReadThread(false) { } void LinuxUartDriver ::init(const NATIVE_INT_TYPE instance) { LinuxUartDriverComponentBase::init(instance); } bool LinuxUartDriver::open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, NATIVE_INT_TYPE allocationSize) { FW_ASSERT(device != nullptr); NATIVE_INT_TYPE fd = -1; NATIVE_INT_TYPE stat = -1; this->m_allocationSize = allocationSize; this->m_device = device; DEBUG_PRINT("Opening UART device %s\n", device); /* The O_NOCTTY flag tells UNIX that this program doesn't want to be the "controlling terminal" for that port. If you don't specify this then any input (such as keyboard abort signals and so forth) will affect your process. Programs like getty(1M/8) use this feature when starting the login process, but normally a user program does not want this behavior. */ fd = ::open(device, O_RDWR | O_NOCTTY); if (fd == -1) { DEBUG_PRINT("open UART device %s failed.\n", device); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, this->m_fd, _err); return false; } else { DEBUG_PRINT("Successfully opened UART device %s fd %d\n", device, fd); } this->m_fd = fd; // Configure blocking reads struct termios cfg; stat = tcgetattr(fd, &cfg); if (-1 == stat) { DEBUG_PRINT("tcgetattr failed: (%d): %s\n", stat, strerror(errno)); close(fd); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, fd, _err); return false; } else { DEBUG_PRINT("tcgetattr passed.\n"); } /* If MIN > 0 and TIME = 0, MIN sets the number of characters to receive before the read is satisfied. As TIME is zero, the timer is not used. If MIN = 0 and TIME > 0, TIME serves as a timeout value. The read will be satisfied if a single character is read, or TIME is exceeded (t = TIME *0.1 s). If TIME is exceeded, no character will be returned. If MIN > 0 and TIME > 0, TIME serves as an inter-character timer. The read will be satisfied if MIN characters are received, or the time between two characters exceeds TIME. The timer is restarted every time a character is received and only becomes active after the first character has been received. If MIN = 0 and TIME = 0, read will be satisfied immediately. The number of characters currently available, or the number of characters requested will be returned. According to Antonino (see contributions), you could issue a fcntl(fd, F_SETFL, FNDELAY); before reading to get the same result. */ cfg.c_cc[VMIN] = 0; cfg.c_cc[VTIME] = 10; // 1 sec timeout on no-data stat = tcsetattr(fd, TCSANOW, &cfg); if (-1 == stat) { DEBUG_PRINT("tcsetattr failed: (%d): %s\n", stat, strerror(errno)); close(fd); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, fd, _err); return false; } else { DEBUG_PRINT("tcsetattr passed.\n"); } // Set flow control if (fc == HW_FLOW) { struct termios t; int stat = tcgetattr(fd, &t); if (-1 == stat) { DEBUG_PRINT("tcgetattr UART fd %d failed\n", fd); close(fd); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, fd, _err); return false; } // modify flow control flags t.c_cflag |= CRTSCTS; stat = tcsetattr(fd, TCSANOW, &t); if (-1 == stat) { DEBUG_PRINT("tcsetattr UART fd %d failed\n", fd); close(fd); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, fd, _err); return false; } } NATIVE_INT_TYPE relayRate = B0; switch (baud) { case BAUD_9600: relayRate = B9600; break; case BAUD_19200: relayRate = B19200; break; case BAUD_38400: relayRate = B38400; break; case BAUD_57600: relayRate = B57600; break; case BAUD_115K: relayRate = B115200; break; case BAUD_230K: relayRate = B230400; break; #if defined TGT_OS_TYPE_LINUX case BAUD_460K: relayRate = B460800; break; case BAUD_921K: relayRate = B921600; break; case BAUD_1000K: relayRate = B1000000; break; case BAUD_1152K: relayRate = B1152000; break; case BAUD_1500K: relayRate = B1500000; break; case BAUD_2000K: relayRate = B2000000; break; #ifdef B2500000 case BAUD_2500K: relayRate = B2500000; break; #endif #ifdef B3000000 case BAUD_3000K: relayRate = B3000000; break; #endif #ifdef B3500000 case BAUD_3500K: relayRate = B3500000; break; #endif #ifdef B4000000 case BAUD_4000K: relayRate = B4000000; break; #endif #endif default: FW_ASSERT(0, baud); break; } struct termios newtio; stat = tcgetattr(fd, &newtio); if (-1 == stat) { DEBUG_PRINT("tcgetattr UART fd %d failed\n", fd); close(fd); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, fd, _err); return false; } // CS8 = 8 data bits, CLOCAL = Local line, CREAD = Enable Receiver /* Even parity (7E1): options.c_cflag |= PARENB options.c_cflag &= ~PARODD options.c_cflag &= ~CSTOPB options.c_cflag &= ~CSIZE; options.c_cflag |= CS7; Odd parity (7O1): options.c_cflag |= PARENB options.c_cflag |= PARODD options.c_cflag &= ~CSTOPB options.c_cflag &= ~CSIZE; options.c_cflag |= CS7; */ newtio.c_cflag |= CS8 | CLOCAL | CREAD; switch (parity) { case PARITY_ODD: newtio.c_cflag |= (PARENB | PARODD); break; case PARITY_EVEN: newtio.c_cflag |= PARENB; break; case PARITY_NONE: newtio.c_cflag &= ~PARENB; break; default: FW_ASSERT(0, parity); break; } // Set baud rate: stat = cfsetispeed(&newtio, relayRate); if (stat) { DEBUG_PRINT("cfsetispeed failed\n"); close(fd); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, fd, _err); return false; } stat = cfsetospeed(&newtio, relayRate); if (stat) { DEBUG_PRINT("cfsetospeed failed\n"); close(fd); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, fd, _err); return false; } // Raw output: newtio.c_oflag = 0; // set input mode (non-canonical, no echo,...) newtio.c_lflag = 0; newtio.c_iflag = INPCK; // Flush old data: (void)tcflush(fd, TCIFLUSH); // Set attributes: stat = tcsetattr(fd, TCSANOW, &newtio); if (-1 == stat) { DEBUG_PRINT("tcsetattr UART fd %d failed\n", fd); close(fd); Fw::LogStringArg _arg = device; Fw::LogStringArg _err = strerror(errno); this->log_WARNING_HI_OpenError(_arg, fd, _err); return false; } // All done! Fw::LogStringArg _arg = device; this->log_ACTIVITY_HI_PortOpened(_arg); if (this->isConnected_ready_OutputPort(0)) { this->ready_out(0); // Indicate the driver is connected } return true; } LinuxUartDriver ::~LinuxUartDriver() { if (this->m_fd != -1) { DEBUG_PRINT("Closing UART device %d\n", this->m_fd); (void)close(this->m_fd); } } // ---------------------------------------------------------------------- // Handler implementations for user-defined typed input ports // ---------------------------------------------------------------------- Drv::SendStatus LinuxUartDriver ::send_handler(const NATIVE_INT_TYPE portNum, Fw::Buffer& serBuffer) { Drv::SendStatus status = Drv::SendStatus::SEND_OK; if (this->m_fd == -1 || serBuffer.getData() == nullptr || serBuffer.getSize() == 0) { status = Drv::SendStatus::SEND_ERROR; } else { unsigned char *data = serBuffer.getData(); NATIVE_INT_TYPE xferSize = serBuffer.getSize(); NATIVE_INT_TYPE stat = ::write(this->m_fd, data, xferSize); if (-1 == stat || stat != xferSize) { Fw::LogStringArg _arg = this->m_device; this->log_WARNING_HI_WriteError(_arg, stat); status = Drv::SendStatus::SEND_ERROR; } } // Deallocate when necessary if (isConnected_deallocate_OutputPort(0)) { deallocate_out(0, serBuffer); } return status; } void LinuxUartDriver ::serialReadTaskEntry(void* ptr) { FW_ASSERT(ptr != nullptr); Drv::RecvStatus status = RecvStatus::RECV_ERROR; // added by m.chase 03.06.2017 LinuxUartDriver* comp = reinterpret_cast<LinuxUartDriver*>(ptr); while (!comp->m_quitReadThread) { Fw::Buffer buff = comp->allocate_out(0, comp->m_allocationSize); // On failed allocation, error and deallocate if (buff.getData() == nullptr) { Fw::LogStringArg _arg = comp->m_device; comp->log_WARNING_HI_NoBuffers(_arg); status = RecvStatus::RECV_ERROR; comp->recv_out(0, buff, status); // to avoid spinning, wait 50 ms Os::Task::delay(50); continue; } // timespec stime; // (void)clock_gettime(CLOCK_REALTIME,&stime); // DEBUG_PRINT("<<< Calling dsp_relay_uart_relay_read() at %d %d\n", stime.tv_sec, stime.tv_nsec); int stat = 0; // Read until something is received or an error occurs. Only loop when // stat == 0 as this is the timeout condition and the read should spin while ((stat == 0) && !comp->m_quitReadThread) { stat = ::read(comp->m_fd, buff.getData(), buff.getSize()); } buff.setSize(0); // On error stat (-1) must mark the read as error // On normal stat (>0) pass a recv ok // On timeout stat (0) and m_quitReadThread, error to return the buffer if (stat == -1) { Fw::LogStringArg _arg = comp->m_device; comp->log_WARNING_HI_ReadError(_arg, stat); status = RecvStatus::RECV_ERROR; } else if (stat > 0) { buff.setSize(stat); status = RecvStatus::RECV_OK; // added by m.chase 03.06.2017 } else { status = RecvStatus::RECV_ERROR; // Simply to return the buffer } comp->recv_out(0, buff, status); // added by m.chase 03.06.2017 } } void LinuxUartDriver ::startReadThread(NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity) { Os::TaskString task("SerReader"); Os::Task::TaskStatus stat = this->m_readTask.start(task, serialReadTaskEntry, this, priority, stackSize, cpuAffinity); FW_ASSERT(stat == Os::Task::TASK_OK, stat); } void LinuxUartDriver ::quitReadThread() { this->m_quitReadThread = true; } Os::Task::TaskStatus LinuxUartDriver ::join(void** value_ptr) { return m_readTask.join(value_ptr); } } // end namespace Drv
c3be74fbb6f2f071ff115e73cbbfd4640da36735
5ba111f40c786210560a7d82290b2924cfa92ce7
/spectrum-analyzer/spectra2.cpp
af89aad083d34645672a0a0330c814fa3702b89f
[]
no_license
asabnis7/dsp-projects
9dd3e9f49683a7953f4b5f40df61d90bb1ed58fb
80781263064e6b185568b058855a563ccbea79a2
refs/heads/master
2020-03-28T16:13:55.064407
2019-10-22T05:39:05
2019-10-22T05:39:05
148,672,293
0
0
null
null
null
null
UTF-8
C++
false
false
5,045
cpp
spectra2.cpp
#include <iostream> #include <cstdlib> #include <cmath> #include <iomanip> #include <string> using namespace std; #define pi 3.1415926 string notes[12] = {"A" "A#" "B" "C" "C#" "D" "D#" "E" "F" "F#" "G" "G#"}; class Octave{ private: double base; int numNotes; double * freqs; public: Octave(int num){ base = 25; numNotes = num; freqs = new double[numNotes]; } ~Octave() { delete[] freqs; } void createOctave(){ for(int f = 0; f < numNotes; f++){ freqs[f] = 440.0*pow(2,((f+base-49)/12));; } } double getFreq(int index){ return freqs[index]; } void print(){ for(int i = 0; i < numNotes; i++){ cout << freqs[i] << endl; } } }; class Complex{ private: double real, imag, angle, mag; public: Complex(): real(0.0), imag(0.0), angle(0.0), mag(0.0) { } Complex(double i) { real = cos(i); imag = sin(i); eulerCalc(); } Complex(double re, double im) { real = re; imag = im; eulerCalc(); } void eulerCalc() { mag = sqrt(pow(real,2)+pow(imag,2)); angle = tan(imag/real); } void cartCalc() { real = mag*cos(angle); imag = mag*sin(angle); } double getRe() const { return real; } double getIm() const { return imag; } void setCart(double r, double i) { real = r; imag = i; eulerCalc(); } double getMag() const { return mag; } double getAngle() const { return angle; } void setEuler(double m, double a) { mag = m; angle = a; cartCalc(); } void print() { cout << real << " + " << imag << "i" << endl; cout << mag << "e^i" << angle << endl; } friend Complex & operator*(double lhs, Complex& rhs); Complex & operator*(double rhs) { real *= rhs; imag *= rhs; eulerCalc(); return *this; } Complex & operator+(Complex& c1) { real += c1.real; imag += c1.imag; eulerCalc(); return *this; } Complex & operator/(double rhs) { real /= rhs; imag /= rhs; eulerCalc(); return *this; } }; Complex & operator*(double lhs, Complex& rhs) { rhs.real *= lhs; rhs.imag *= lhs; rhs.eulerCalc(); return rhs; } double * hamming(int length){ double * window = new double[length]; for(double n = 0; n < length; n++){ window[int(n)] = 0.54-0.46*cos(2*pi*(n/(length-1))); // cout << setprecision(3) << window[int(n)] << endl; } return window; } class qTransform{ private: double fs, fo, fmax, Q, K; int bins; Complex * cq; public: qTransform(double samp, double fund, double max){ fs = samp; fo = fund; fmax = max; bins = 12; Q = 1.0/(pow(2,1.0/bins)-1.0); K = ceil(bins*log2(fmax/fo)); cq = new Complex[(int)K]; for (int i = 0; i < (int)K; i++) cq[i] = Complex(); } ~qTransform() { delete[] cq; } Complex * getValues() { return cq; } int getK() { return (int)K; } void qTransCalc(double signal[], int sigSize) { for (int g = 0; g < sigSize-1000; g += 800) { for (double k = 0; k < (int)K; k++) { int N = (Q*fs)/(fo*pow(2,(k/bins))); double * window = hamming(N); for (int n = 0; n < N; n++) { Complex c1 = Complex(-2*pi*Q*n/N); cq[(int)k] = cq[(int)k] + (signal[n+g]*(window[n]*c1)/N); } } } } }; int main() { Octave oct1(12); oct1.createOctave(); // oct1.print(); // double * hamm = hamming(11); double signal[10000]; int sigSize = sizeof(signal)/sizeof(signal[0]); for (int i = 0; i < sigSize; i++) signal[i] = sin(2*pi*120*(0.01*i)); qTransform spectrum(8192,oct1.getFreq(0), oct1.getFreq(11)); spectrum.qTransCalc(signal, sigSize); Complex * cq = spectrum.getValues(); int Ksize = spectrum.getK(); for (int j = 0; j < Ksize; j++) cq[j].print(); /* Complex c1(1,1); double d1 = 2.0; c1.print(); c1 = c1*d1; c1.print(); c1 = d1*c1; c1.print(); c1 = c1+c1; c1.print(); Complex c2(pi*3.4); c2.print(); c1 = c1 + c2; c1.print(); */ }
4092c432b9190a34ced1725783ac350bf5c4b0b0
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
/generated/src/aws-cpp-sdk-quicksight/include/aws/quicksight/model/StringDefaultValues.h
af5f1d209f2ce8626bb09d3432c224fdfcd9279d
[ "Apache-2.0", "MIT", "JSON" ]
permissive
aws/aws-sdk-cpp
aff116ddf9ca2b41e45c47dba1c2b7754935c585
9a7606a6c98e13c759032c2e920c7c64a6a35264
refs/heads/main
2023-08-25T11:16:55.982089
2023-08-24T18:14:53
2023-08-24T18:14:53
35,440,404
1,681
1,133
Apache-2.0
2023-09-12T15:59:33
2015-05-11T17:57:32
null
UTF-8
C++
false
false
5,094
h
StringDefaultValues.h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/quicksight/QuickSight_EXPORTS.h> #include <aws/quicksight/model/DynamicDefaultValue.h> #include <aws/core/utils/memory/stl/AWSVector.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 QuickSight { namespace Model { /** * <p>The default values of the * <code>StringParameterDeclaration</code>.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/quicksight-2018-04-01/StringDefaultValues">AWS * API Reference</a></p> */ class StringDefaultValues { public: AWS_QUICKSIGHT_API StringDefaultValues(); AWS_QUICKSIGHT_API StringDefaultValues(Aws::Utils::Json::JsonView jsonValue); AWS_QUICKSIGHT_API StringDefaultValues& operator=(Aws::Utils::Json::JsonView jsonValue); AWS_QUICKSIGHT_API Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The dynamic value of the <code>StringDefaultValues</code>. Different defaults * displayed according to users, groups, and values mapping.</p> */ inline const DynamicDefaultValue& GetDynamicValue() const{ return m_dynamicValue; } /** * <p>The dynamic value of the <code>StringDefaultValues</code>. Different defaults * displayed according to users, groups, and values mapping.</p> */ inline bool DynamicValueHasBeenSet() const { return m_dynamicValueHasBeenSet; } /** * <p>The dynamic value of the <code>StringDefaultValues</code>. Different defaults * displayed according to users, groups, and values mapping.</p> */ inline void SetDynamicValue(const DynamicDefaultValue& value) { m_dynamicValueHasBeenSet = true; m_dynamicValue = value; } /** * <p>The dynamic value of the <code>StringDefaultValues</code>. Different defaults * displayed according to users, groups, and values mapping.</p> */ inline void SetDynamicValue(DynamicDefaultValue&& value) { m_dynamicValueHasBeenSet = true; m_dynamicValue = std::move(value); } /** * <p>The dynamic value of the <code>StringDefaultValues</code>. Different defaults * displayed according to users, groups, and values mapping.</p> */ inline StringDefaultValues& WithDynamicValue(const DynamicDefaultValue& value) { SetDynamicValue(value); return *this;} /** * <p>The dynamic value of the <code>StringDefaultValues</code>. Different defaults * displayed according to users, groups, and values mapping.</p> */ inline StringDefaultValues& WithDynamicValue(DynamicDefaultValue&& value) { SetDynamicValue(std::move(value)); return *this;} /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline const Aws::Vector<Aws::String>& GetStaticValues() const{ return m_staticValues; } /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline bool StaticValuesHasBeenSet() const { return m_staticValuesHasBeenSet; } /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline void SetStaticValues(const Aws::Vector<Aws::String>& value) { m_staticValuesHasBeenSet = true; m_staticValues = value; } /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline void SetStaticValues(Aws::Vector<Aws::String>&& value) { m_staticValuesHasBeenSet = true; m_staticValues = std::move(value); } /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline StringDefaultValues& WithStaticValues(const Aws::Vector<Aws::String>& value) { SetStaticValues(value); return *this;} /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline StringDefaultValues& WithStaticValues(Aws::Vector<Aws::String>&& value) { SetStaticValues(std::move(value)); return *this;} /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline StringDefaultValues& AddStaticValues(const Aws::String& value) { m_staticValuesHasBeenSet = true; m_staticValues.push_back(value); return *this; } /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline StringDefaultValues& AddStaticValues(Aws::String&& value) { m_staticValuesHasBeenSet = true; m_staticValues.push_back(std::move(value)); return *this; } /** * <p>The static values of the <code>DecimalDefaultValues</code>.</p> */ inline StringDefaultValues& AddStaticValues(const char* value) { m_staticValuesHasBeenSet = true; m_staticValues.push_back(value); return *this; } private: DynamicDefaultValue m_dynamicValue; bool m_dynamicValueHasBeenSet = false; Aws::Vector<Aws::String> m_staticValues; bool m_staticValuesHasBeenSet = false; }; } // namespace Model } // namespace QuickSight } // namespace Aws
320e4aed00c14abd1f3e827b0774ee288a59df1e
4656e231d8474e6bd2bc47569d9d728060df6d8c
/geo/sphere.cpp
cb80d16b410a2ad0bba9e77e23cbf3bfeb39a761
[]
no_license
svhauwiller/ray_tracer
28725ae7ce5571f2ac5b57c271dd5e3227885a26
9c5ad2fefa2e7cffe5a312f9017e423501c71a21
refs/heads/master
2023-02-02T09:36:55.783640
2016-02-17T18:01:58
2016-02-17T18:01:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,972
cpp
sphere.cpp
// Ray Tracer: sphere.cpp // // Author: Wesley Hauwiller // // Description: A Sphere is a perfectly round Geometry defined only by a center // point and a radius // // Copyright (C) 2016 whauwiller.blogspot.com // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // A full copy of the GNU General Public License may be found at // <http://www.gnu.org/licenses/>. // #include "sphere.h" Sphere::Sphere(){ this->center_ = new Point3D(0,0,0); this->radius_ = 1.0; PhongShader* default_shader = new PhongShader(); this->shader_ = default_shader; setDiffuseColor(RgbColor(0,0,0)); setSpecularHighlight(RgbColor(0,0,0)); setPhongConstant(0); setReflectiveColor(RgbColor(0,0,0)); setRefractionIndex(0.0); } Sphere::Sphere(Point3D* center, double radius, Shader* shader){ this->center_ = center; this->radius_ = radius; this->shader_ = shader; } Sphere::~Sphere(){ delete this->center_; } /** * Computes the point intersected and the normal at this point when a ray is cast. * Point Hit and Normal Hit attributes are only modified if intersection is detected, otherwise * returns only false result * * To test intersection with a sphere, we locate the point along the ray closest * to the center of the sphere and compare it with the radius. * * @param ray Ray to test intersection * @param pointHit Point hit by the ray, if intersection is detected * @param normalHit Normal of the surface at the point that is hit, if intersection is detected * @return Boolean indicating whether intersection was detected or not */ bool Sphere::hasIntersection(Ray* ray, Point3D* point_hit, Vector3D* normal_hit){ //Geometric Solution //1. Generate a Vector going from the origin of the Ray to the center of the Sphere double vector_to_sphere_center_x = this->center_->getX() - ray->getOrigin()->getX(); double vector_to_sphere_center_y = this->center_->getY() - ray->getOrigin()->getY(); double vector_to_sphere_center_z = this->center_->getZ() - ray->getOrigin()->getZ(); double distance_to_sphere_center = sqrt(vector_to_sphere_center_x * vector_to_sphere_center_x + vector_to_sphere_center_y * vector_to_sphere_center_y + vector_to_sphere_center_z * vector_to_sphere_center_z); //2. Compute the Dot Product of this vector and the original Ray //Note: This also the distance from the ray origin to a point that forms a right angle with the sphere center pt double distance_to_test_point = vector_to_sphere_center_x * ray->getDirection()->getX() + vector_to_sphere_center_y * ray->getDirection()->getY() + vector_to_sphere_center_z * ray->getDirection()->getZ(); //3. Reject if the Sphere is not in the direction of the Ray (Dot Product is Negative) if(distance_to_test_point < 0){ return false; } //4. Compute the distance to the closest point from the sphere center that exists along the ray by using the Pythagorean theorem // along with the right triangle formed by the ray, the vector from the ray origin to the center, and the vector from the center to the closest pt on the ray double distance_from_sphere_center = sqrt(std::abs(distance_to_sphere_center * distance_to_sphere_center - distance_to_test_point * distance_to_test_point)); //5. If this distance is greater than the radius, reject if(distance_from_sphere_center > this->radius_){ return false; } //Compute the intersection pt and the normal //1. Find the amount of the ray penetrating the sphere up to the test point using the triangle formed by // the radius and the distance to the closest pt on the sphere double penetration_amount = sqrt(this->radius_ * this->radius_ - distance_from_sphere_center * distance_from_sphere_center); //2. Subtract this distance from the distance from the origin to the closest pt on the ray to determine // the distance from the origin to the intersection pt double distance_to_intersection = distance_to_test_point - penetration_amount; //3. Using parametric coordinates, find the point in 3D space where the sphere was intersected by the ray Point3D intersection_point = ray->findPoint(distance_to_intersection); //4. Return the intersection point and the normal at that point point_hit->setX(intersection_point.getX()); point_hit->setY(intersection_point.getY()); point_hit->setZ(intersection_point.getZ()); Vector3D normal = getNormalAt(&intersection_point); normal_hit->setX(normal.getX()); normal_hit->setY(normal.getY()); normal_hit->setZ(normal.getZ()); return true; } /** * Computes the normal at a given point on the sphere. The normal is * the vector between the center of the sphere and the given point * * @param intersection_point Point on the sphere to query * @return Normal at the query point */ Vector3D Sphere::getNormalAt(Point3D* intersection_point){ double normal_x = intersection_point->getX() - this->center_->getX(); double normal_y = intersection_point->getY() - this->center_->getY(); double normal_z = intersection_point->getZ() - this->center_->getZ(); double normalized_normal_x = normal_x / this->radius_; double normalized_normal_y = normal_y / this->radius_; double normalized_normal_z = normal_z / this->radius_; Vector3D normal (normalized_normal_x, normalized_normal_y, normalized_normal_z); return normal; } /** * Get the point where the center of the sphere is located * * @return Point at the center of the sphere */ Point3D* Sphere::getCenter(){ return this->center_; } /** * Set the point where the sphere will be centered * * @param center Point where the sphere will be centered */ void Sphere::setCenter(Point3D* center){ this->center_ = center; } /** * Get the radius of the sphere * * @return The radius of the sphere */ double Sphere::getRadius(){ return this->radius_; } /** * Set the radius of the sphere * * @param radius Radius to set to the sphere */ void Sphere::setRadius(double radius){ this->radius_ = radius; }
c27f6dc09f0896faf3dfa00ce8cbccf0b9e1c042
342a696893a19fa36902655b7228391cda7b6d8d
/src/Primitives.h
911b17711ce0293147a21646b53b089b9113e5ef
[]
no_license
latzio/awol
935d71b304b88f67e44e80e71b918f8c0a97b085
901fe17022a7cfb774b613ea01a9a200d94df914
refs/heads/master
2020-04-09T01:52:11.537907
2012-12-22T02:32:28
2012-12-22T02:32:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,819
h
Primitives.h
#ifndef AwolPrimitives_h #define AwolPrimitives_h #include "gameplay.h" namespace Awol { class IntSize; class IntPoint { public: IntPoint() :m_x(0) ,m_y(0) { } IntPoint(int x, int y) :m_x(x) ,m_y(y) { } explicit IntPoint(const gameplay::Vector2& vector) :m_x(vector.x) ,m_y(vector.y) { } int x() const { return m_x; } int y() const { return m_y; } int squaredLength() const { return m_x * m_x + m_y * m_y; } float length() const { return sqrt(static_cast<float>(squaredLength())); } void setX(int x) { m_x = x; } void setY(int y) { m_y = y; } const IntPoint operator+(const IntSize& size) const; const IntPoint operator-(const IntSize& size) const; operator gameplay::Vector2() const { return gameplay::Vector2(m_x, m_y); } private: int m_x; int m_y; }; class IntSize { public: IntSize() :m_dx(0) ,m_dy(0) { } IntSize(int dx, int dy) :m_dx(dx) ,m_dy(dy) { } explicit IntSize(const gameplay::Vector2& vector) :m_dx(vector.x) ,m_dy(vector.y) { } int dx() const { return m_dx; } int dy() const { return m_dy; } int area() const { return m_dx * m_dy; } void setDX(int dx) { m_dx = dx; } void setDY(int dy) { m_dy = dy; } const IntSize operator+(const IntSize& size) const; const IntSize operator-(const IntSize& size) const; operator gameplay::Vector2() const { return gameplay::Vector2(m_dx, m_dy); } private: int m_dx; int m_dy; }; inline const IntSize operator-(const IntPoint& lhs, const IntPoint& rhs) { return IntSize(lhs.x() - rhs.x(), lhs.y() - rhs.y()); } inline const IntPoint operator+(const IntSize& lhs, const IntPoint& rhs) { return IntPoint(lhs.dx() + rhs.x(), lhs.dy() + rhs.y()); } } #endif
391444303d647b63af4d39b3177001cdc2de8ff2
67072b31e58811732c53c7bbd87e2dd29b0d902c
/VideoCaptureFilterSample/VideoCaptureFilterSampleDlg.h
22651a04ebb9b7011cf72a13dc49a249592d1e98
[ "MIT" ]
permissive
tolga9009/gamecapture
ab0fb25f4c3d96382b7f197680a5c7b21b6d6670
665ccf78bf8fa9e5b1a9571609932fcc710e42df
refs/heads/master
2021-01-18T05:50:10.815477
2016-04-05T17:04:00
2016-04-05T17:04:00
58,023,066
3
1
null
2016-05-04T04:36:12
2016-05-04T04:36:12
null
UTF-8
C++
false
false
832
h
VideoCaptureFilterSampleDlg.h
// VideoCaptureFilterSampleDlg.h : header file // #pragma once interface IBaseFilter; // CVideoCaptureFilterSampleDlg dialog class CVideoCaptureFilterSampleDlg : public CDialog { // Construction public: CVideoCaptureFilterSampleDlg(CWnd* pParent = NULL); // standard constructor // Dialog Data enum { IDD = IDD_VIDEOCAPTUREFILTERSAMPLE_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); virtual void OnOK(); virtual void OnCancel(); DECLARE_MESSAGE_MAP() public: afx_msg void OnBnClickedProperties(); HRESULT QueryCaps(); HRESULT InitGraph(); HRESULT DestroyGraph(); HRESULT ShowProperties(); };
8806093b6853cab0513dfbd41e58bd69cd946e04
24bade477fb9e93b1f8b09925759f92e69571c64
/engine/runtime/rendering/generator/torus_knot_mesh.cpp
ae9b820acfaf98ccd7dec408e8bf029cc70b0c0b
[ "BSD-2-Clause" ]
permissive
pgruenbacher/EtherealEngine
7943f4c135fc64f13c7dd0b7d42501b0067c0485
b2fabf11563e68088c5a75c951a1bb63612cae7c
refs/heads/master
2020-04-15T13:09:10.424133
2019-03-21T21:36:38
2019-03-21T21:36:38
164,704,550
1
0
BSD-2-Clause
2019-01-08T17:57:48
2019-01-08T17:57:48
null
UTF-8
C++
false
false
218
cpp
torus_knot_mesh.cpp
#include "torus_knot_mesh.hpp" using namespace generator; torus_knot_mesh_t::torus_knot_mesh_t(int p, int q, int slices, int segments) : extrude_mesh_{{0.25, slices, 0.0, gml::radians(360.0)}, {p, q, segments}} { }
ab01e9a156bbdb9190f2e857836b5e3210f15082
08bb21010e46767858988fae3d9f1e6d1127b7a3
/Huffman.cpp
d8198d6d2ab42d24aff42e303a867bf62afe57ec
[]
no_license
9irbis/ds-algo-implementations
d6bcada4bd586ac22234fa3fc44a392cde9edbaa
e45d73c4905aa421967d7f65a683390c94d22812
refs/heads/master
2016-09-10T12:36:55.518359
2015-11-11T17:52:10
2015-11-11T17:52:10
39,515,880
1
0
null
null
null
null
UTF-8
C++
false
false
2,591
cpp
Huffman.cpp
#include <iostream> #include <vector> #include <queue> #include <map> #include <climits> #include <algorithm> #include <iterator> using namespace std; const int UNIQUE_SYMBOLS = 1 << CHAR_BIT; // size of the character set typedef vector<bool> HuffCode; typedef map<char, HuffCode> HuffCodeMap; class INode{ public: const int f; virtual ~INode(){} protected: INode(int f): f(f) {} }; class InternalNode : public INode{ public: INode *const left; INode *const right; InternalNode(INode* c0, INode* c1): INode(c0->f+c1->f), left(c0), right(c1){} ~InternalNode() { delete left; delete right; } }; class LeafNode : public INode{ public: const char c; LeafNode(int f, char c): INode(f), c(c) {} }; class NodeCmp{ public: bool operator() (const INode* lhs, const INode* rhs) const { return lhs->f > rhs->f; } }; INode* buildTree(const int (&frequencies)[UNIQUE_SYMBOLS]) { priority_queue<INode*, vector<INode*>, NodeCmp> Q; for(int i=0; i<UNIQUE_SYMBOLS; i++) { if (frequencies[i] != 0) Q.push(new LeafNode(frequencies[i], (char)i)); } while (Q.size() > 1) { INode* childL = Q.top(); Q.pop(); INode* childR = Q.top(); Q.pop(); INode* parent = new InternalNode(childL, childR); Q.push(parent); } return Q.top(); } void generateCodes(const INode* node, const HuffCode& prefix, HuffCodeMap& outCodes) { if (const LeafNode* lf = dynamic_cast<const LeafNode*>(node)) { outCodes[lf->c] = prefix; } else if (const InternalNode* in = dynamic_cast<const InternalNode*>(node)) { HuffCode leftPrefix = prefix; leftPrefix.push_back(false); generateCodes(in->left, leftPrefix, outCodes); HuffCode rightPrefix = prefix; rightPrefix.push_back(true); generateCodes(in->right, rightPrefix, outCodes); } } int main() { string text; cout << "Enter your line of text below:\n"; getline(cin, text); const char* ptr = text.c_str(); int frequencies[UNIQUE_SYMBOLS] = {0}; while (*ptr != '\0') ++frequencies[*ptr++]; INode* root = buildTree(frequencies); HuffCodeMap codes; generateCodes(root, HuffCode(), codes); delete root; for(HuffCodeMap::const_iterator it = codes.begin(); it != codes.end(); ++it) { cout << it->first << " "; copy(it->second.begin(), it->second.end(), ostream_iterator<bool>(cout)); cout << endl; } return 0; }
e8a77aa06b6652966cd654781e845bfc7695cdd3
17670d53e1291b9673788672b4cadeecaf082739
/src/SteppingAction.cc
ef5b1820cc712194ef658e6d1cb6ad33846b2976
[]
no_license
zaborowska/GeantSimulation
1c7242741ee2655e1229f610bc8efb8320735d0e
79714a8a284c182f6544a5fae0fcc9ef5d6b7daf
refs/heads/master
2021-09-22T19:25:12.911795
2021-01-13T15:34:10
2021-01-13T15:34:10
196,373,485
0
0
null
null
null
null
UTF-8
C++
false
false
822
cc
SteppingAction.cc
#include "SteppingAction.hh" #include "G4Step.hh" #include "G4RunManager.hh" #include "EventInformation.hh" #include "G4Event.hh" #include "G4UnitsTable.hh" SteppingAction::SteppingAction() : G4UserSteppingAction() {} SteppingAction::~SteppingAction() {} void SteppingAction::UserSteppingAction(const G4Step *step) { // get first interaction position for the primary particle if (step->GetTrack()->GetParentID() == 0) { auto info = static_cast<EventInformation*>(G4EventManager::GetEventManager()->GetUserInformation()); if (info->IfShowerStarted()) return; auto processType = step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessType(); if (processType != fTransportation && processType != fParallel) { info->SetShowerStart(step->GetPostStepPoint()->GetPosition()); } } }
24000a27faa2eba4cbfaf5459a17f0554ea2b4ac
efc4772a909c360a5c82a80d5bda0971415a0361
/core/lib_rtsp/liveMedia/MP3ADUdescriptor.cpp
6e74a0f57b65473470e2c4eaacecf88a8a13b5f3
[]
no_license
jasonblog/RTMPLive
7ce6c9f950450eedff21ebae7505a62c9cb9f403
92a018f50f7df19c255b106dc7f584b90f1fe116
refs/heads/master
2020-04-22T01:31:04.504948
2019-02-13T05:30:19
2019-02-13T05:30:19
170,016,488
0
1
null
null
null
null
UTF-8
C++
false
false
1,191
cpp
MP3ADUdescriptor.cpp
#include "MP3ADUdescriptor.hh" #define TWO_BYTE_DESCR_FLAG 0x40 unsigned ADUdescriptor::generateDescriptor(unsigned char *& toPtr, unsigned remainingFrameSize) { unsigned descriptorSize = ADUdescriptor::computeSize(remainingFrameSize); switch (descriptorSize) { case 1: { *toPtr++ = (unsigned char) remainingFrameSize; break; } case 2: { generateTwoByteDescriptor(toPtr, remainingFrameSize); break; } } return descriptorSize; } void ADUdescriptor::generateTwoByteDescriptor(unsigned char *& toPtr, unsigned remainingFrameSize) { *toPtr++ = (TWO_BYTE_DESCR_FLAG | (unsigned char) (remainingFrameSize >> 8)); *toPtr++ = (unsigned char) (remainingFrameSize & 0xFF); } unsigned ADUdescriptor::getRemainingFrameSize(unsigned char *& fromPtr) { unsigned char firstByte = *fromPtr++; if (firstByte & TWO_BYTE_DESCR_FLAG) { unsigned char secondByte = *fromPtr++; return ((firstByte & 0x3F) << 8) | secondByte; } else { return (firstByte & 0x3F); } }
b2481efbc6f679ae8acdbaf5249918b5e1bc8e0c
c761e4b7c58ff701b205b0165bf485cb3d0ec9c3
/ARPG/Source/ARPG/Actor/Controller/PlayerController/GamePlayerController/GamePlayerController.cpp
19bf200f21078692dffc62d3a00554582dd91408
[]
no_license
Jiseok-Yoon/ARPG
90d1b3ed55cb6798b5e30b366dad1b06f93311f1
32ae540659dfef3571d84df0ce71b9b91b1db4bb
refs/heads/main
2023-05-07T14:18:52.933673
2021-06-04T10:42:27
2021-06-04T10:42:27
373,807,370
0
0
null
null
null
null
UHC
C++
false
false
1,465
cpp
GamePlayerController.cpp
#include "GamePlayerController.h" #include "Single/GameInstance/RPGGameInst.h" #include "Single/PlayerManager/PlayerManager.h" #include "Widget/WidgetControllerWidget/WidgetControllerWidget.h" #include "Component/WndToggler/WndTogglerComponent.h" void AGamePlayerController::SetupInputComponent() { Super::SetupInputComponent(); InputComponent->BindAction(TEXT("OpenPlayerInventoryWnd"), EInputEvent::IE_Pressed, GetWndToggler(), &UWndTogglerComponent::ToggleWnd<UPlayerInventory>); InputComponent->BindAxis(TEXT("MouseX"), this, &AGamePlayerController::MouseXInput); InputComponent->BindAxis(TEXT("MouseY"), this, &AGamePlayerController::MouseYInput); } void AGamePlayerController::OnPossess(APawn* aPawn) { Super::OnPossess(aPawn); RegisterToggleEvent(); } void AGamePlayerController::RegisterToggleEvent() { #pragma region UPlayerInventory FToggleEvent playerInventoryWndToggleEvent; playerInventoryWndToggleEvent.BindLambda( [this]() { GetManager(UPlayerManager)->GetPlayerInventory()-> ToggleInventoryWnd(GetWidgetControllerWidget()); }); GetWndToggler()->RegisterToggleEvent<UPlayerInventory>(playerInventoryWndToggleEvent); #pragma endregion } void AGamePlayerController::MouseXInput(float axis) { // 컨트롤러에 axis 만큼 Yaw 회전을 시킵니다. AddYawInput(axis); } void AGamePlayerController::MouseYInput(float axis) { // 컨트롤러에 axis 만큼 Pitch 회전을 시킵니다. AddPitchInput(axis); }
e6b6f7ee3034c7d0d7a37d22e4c8d2fbdf9f4701
59362d07a4163c1d6fc519daaa1e4fe3a07b5983
/Aulas/aula08/Aula08-06.cpp
1d7ebe449e870276be69f30db866e34a695a12fd
[]
no_license
Connolyn/consultaPAP
469616c769f3a838e72b52fe814fdc1b59f44649
d687d3b0c5681c89bd9a59126a7bff2ad7e5de5e
refs/heads/master
2021-08-29T16:44:08.179121
2017-12-14T10:36:48
2017-12-14T10:36:48
108,792,895
0
0
null
null
null
null
UTF-8
C++
false
false
931
cpp
Aula08-06.cpp
//============================================================================ // Name : Aula08-06.cpp // Author : Prof. Alexandre Donizeti Alves //============================================================================ //**************************************************************************** // Lista // C++ STL - Guia de Consulta Rapida - pp. 19 e 20 // jlremove.cpp - elimina da lista chamadora os elementos iguais a "valor" //**************************************************************************** #include <iostream> #include <list> #include <string> using namespace std; int main() { list<string> l1; list<string>::iterator it; l1.push_back("alfa"); l1.push_back("beta"); l1.push_back("alfa"); // elimina os elementos iguais a "alfa" l1.remove("alfa"); for (it = l1.begin(); it != l1.end(); ++it) cout << *it << " "; cout << endl; return 0; }
edd17c01621ce61bd9d3af894c12c29beda13f25
f10759120587379d4e52153f781e62476cdc6cb4
/include/PicturePerfect/OpenCVOperators/NoiseV.h
ea7dbebd00705dd4e01d81da6e46096be15c3e72
[]
no_license
munepi0713/PicturePerfect
f79b18e333dc26c1bf695ff960748c37162f9df3
04c679296cd732f113e3881494cd449a42114ead
refs/heads/master
2021-01-17T09:04:28.103973
2016-05-24T16:56:01
2016-05-24T16:56:01
27,131,966
1
0
null
null
null
null
WINDOWS-1252
C++
false
false
17,549
h
NoiseV.h
#include <limits> #include <vector> #include <map> //#include <smmintrin.h> static __inline void Noise16(float* ret, int x, int y) { #if 0 // ’x‚¢ __m128i m_1, m_1376312589, m_7fffffff, m_15731, m_789221; m_1 = _mm_set1_epi32(1); m_1376312589 = _mm_set1_epi32(1376312589); m_7fffffff = _mm_set1_epi32(0x7fffffff); m_15731 = _mm_set1_epi32(15731); m_789221 = _mm_set1_epi32(789221); __m128 m_1f, m_1073741824f; m_1f = _mm_set1_ps(1.f); m_1073741824f = _mm_set1_ps(1073741824.f); /* __declspec(align(16)) int n[4]; n[0] = (x - 1) + (y - 1) * 57; n[1] = (x - 1) + (y ) * 57; n[2] = (x - 1) + (y + 1) * 57; n[3] = (x - 1) + (y + 2) * 57; */ __m128i m_a, m_n, m_t; //m_a = _mm_load_si128((__m128i*)&n); m_a.m128i_u32[0] = (x - 1) + (y - 1) * 57; m_a.m128i_u32[1] = (x - 1) + (y ) * 57; m_a.m128i_u32[2] = (x - 1) + (y + 1) * 57; m_a.m128i_u32[3] = (x - 1) + (y + 2) * 57; __m128 m_nf; for (int i = 0; i < 4; i++) { m_n = _mm_xor_si128(_mm_slli_epi32(m_a, 13), m_a); #if 1 m_t = _mm_mullo_epi16(m_n, m_n); m_t = _mm_mullo_epi16(m_t, m_15731); m_t = _mm_add_epi32(m_t, m_789221); m_n = _mm_mullo_epi16(m_t, m_n); #elif 0 m_t.m128i_u32[0] = m_n.m128i_u32[0] * m_n.m128i_u32[0] * 15731; m_t.m128i_u32[1] = m_n.m128i_u32[1] * m_n.m128i_u32[1] * 15731; m_t.m128i_u32[2] = m_n.m128i_u32[2] * m_n.m128i_u32[2] * 15731; m_t.m128i_u32[3] = m_n.m128i_u32[3] * m_n.m128i_u32[3] * 15731; m_t = _mm_add_epi32(m_t, m_789221); m_n.m128i_u32[0] = m_t.m128i_u32[0] * m_n.m128i_u32[0]; m_n.m128i_u32[1] = m_t.m128i_u32[1] * m_n.m128i_u32[1]; m_n.m128i_u32[2] = m_t.m128i_u32[2] * m_n.m128i_u32[2]; m_n.m128i_u32[3] = m_t.m128i_u32[3] * m_n.m128i_u32[3]; #else _mm_store_si128((__m128i*)&n, m_n); n[0] = n[0] * (n[0] * n[0] * 15731 + 789221); n[1] = n[1] * (n[1] * n[1] * 15731 + 789221); n[2] = n[2] * (n[2] * n[2] * 15731 + 789221); n[3] = n[3] * (n[3] * n[3] * 15731 + 789221); m_n = _mm_load_si128((__m128i*)&n); #endif m_n = _mm_add_epi32(m_n, m_1376312589); m_n = _mm_and_si128(m_n, m_7fffffff); m_nf = _mm_cvtepi32_ps(m_n); m_nf = _mm_div_ps(m_nf, m_1073741824f); m_nf = _mm_sub_ps(m_1f, m_nf); _mm_storeu_ps(ret, m_nf); ret += 4; m_a = _mm_add_epi32(m_a, m_1); } #elif 1 int a[4], n[4]; a[0] = (x - 1) + (y - 1) * 57; a[1] = (x - 1) + (y ) * 57; a[2] = (x - 1) + (y + 1) * 57; a[3] = (x - 1) + (y + 2) * 57; for (int i = 0; i < 4; i++) { n[0] = (a[0]<<13) ^ a[0]; n[1] = (a[1]<<13) ^ a[1]; n[2] = (a[2]<<13) ^ a[2]; n[3] = (a[3]<<13) ^ a[3]; ret[0] = (float)( 1.0 - ( (n[0] * (n[0] * n[0] * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); ret[1] = (float)( 1.0 - ( (n[1] * (n[1] * n[1] * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); ret[2] = (float)( 1.0 - ( (n[2] * (n[2] * n[2] * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); ret[3] = (float)( 1.0 - ( (n[3] * (n[3] * n[3] * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); a[0]++; a[1]++; a[2]++; a[3]++; ret += 4; } #else int o, p, q, r; o = (x - 1) + (y - 1) * 57; p = (x - 1) + (y ) * 57; q = (x - 1) + (y + 1) * 57; r = (x - 1) + (y + 2) * 57; for (int i = 0; i < 4; i++) { int n0, n1, n2, n3; n0 = (o<<13) ^ o; *ret++ = (float)( 1.0 - ( (n0 * (n0 * n0 * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n1 = (p<<13) ^ p; *ret++ = (float)( 1.0 - ( (n1 * (n1 * n1 * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n2 = (q<<13) ^ q; *ret++ = (float)( 1.0 - ( (n2 * (n2 * n2 * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n3 = (r<<13) ^ r; *ret++ = (float)( 1.0 - ( (n3 * (n3 * n3 * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); o++; p++; q++; r++; } #endif } class PerlinNoise { public : inline float Noise(int x, int y) { int n; n = x + y * 57; n = (n<<13) ^ n; return (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); } inline void Noise16(float* ret, int x, int y) { #if 1 int o, p, q, r; o = (x - 1) + (y - 1) * 57; p = (x - 1) + (y ) * 57; q = (x - 1) + (y + 1) * 57; r = (x - 1) + (y + 2) * 57; for (int i = 0; i < 4; i++) { int n0, n1, n2, n3; n0 = (o<<13) ^ o; *ret++ = (float)( 1.0 - ( (n0 * (n0 * n0 * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n1 = (p<<13) ^ p; *ret++ = (float)( 1.0 - ( (n1 * (n1 * n1 * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n2 = (q<<13) ^ q; *ret++ = (float)( 1.0 - ( (n2 * (n2 * n2 * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n3 = (r<<13) ^ r; *ret++ = (float)( 1.0 - ( (n3 * (n3 * n3 * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); o++; p++; q++; r++; } #elif 0 int n, o, p, q, r; o = (x - 1) + (y - 1) * 57; n = (o<<13) ^ o; ret[ 0] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); p = o + 57; n = (p<<13) ^ p; ret[ 1] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); q = p + 57; n = (q<<13) ^ q; ret[ 2] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); r = q + 57; n = (r<<13) ^ r; ret[ 3] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); o = o + 1; n = (o<<13) ^ o; ret[ 4] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); p = p + 1; n = (p<<13) ^ p; ret[ 5] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); q = q + 1; n = (q<<13) ^ q; ret[ 6] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); r = r + 1; n = (r<<13) ^ r; ret[ 7] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); o = o + 1; n = (o<<13) ^ o; ret[ 8] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); p = p + 1; n = (p<<13) ^ p; ret[ 9] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); q = q + 1; n = (q<<13) ^ q; ret[10] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); r = r + 1; n = (r<<13) ^ r; ret[11] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); o = o + 1; n = (o<<13) ^ o; ret[12] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); p = p + 1; n = (p<<13) ^ p; ret[13] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); q = q + 1; n = (q<<13) ^ q; ret[14] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); r = r + 1; n = (r<<13) ^ r; ret[15] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); #else int n; n = (x - 1) + (y - 1) * 57; n = (n<<13) ^ n; ret[ 0] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x - 1) + (y + 0) * 57; n = (n<<13) ^ n; ret[ 1] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x - 1) + (y + 1) * 57; n = (n<<13) ^ n; ret[ 2] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x - 1) + (y + 2) * 57; n = (n<<13) ^ n; ret[ 3] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 0) + (y - 1) * 57; n = (n<<13) ^ n; ret[ 4] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 0) + (y + 0) * 57; n = (n<<13) ^ n; ret[ 5] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 0) + (y + 1) * 57; n = (n<<13) ^ n; ret[ 6] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 0) + (y + 2) * 57; n = (n<<13) ^ n; ret[ 7] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 1) + (y - 1) * 57; n = (n<<13) ^ n; ret[ 8] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 1) + (y + 0) * 57; n = (n<<13) ^ n; ret[ 9] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 1) + (y + 1) * 57; n = (n<<13) ^ n; ret[10] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 1) + (y + 2) * 57; n = (n<<13) ^ n; ret[11] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 2) + (y - 1) * 57; n = (n<<13) ^ n; ret[12] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 2) + (y + 0) * 57; n = (n<<13) ^ n; ret[13] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 2) + (y + 1) * 57; n = (n<<13) ^ n; ret[14] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); n = (x + 2) + (y + 2) * 57; n = (n<<13) ^ n; ret[15] = (float)( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); #endif } inline float Interpolate(float a, float b, float x) { float ft, f; ft = x * 3.1415927f; f = (1 - cos(ft)) * .5f; return a*(1-f) + b*f; } inline float SmoothedNoise1(int x, int y) { float corners, sides, center; corners = ( Noise(x-1, y-1)+Noise(x+1, y-1)+Noise(x-1, y+1)+Noise(x+1, y+1) ) / 16; sides = ( Noise(x-1, y) +Noise(x+1, y) +Noise(x, y-1) +Noise(x, y+1) ) / 8; center = Noise(x, y) / 4; return corners + sides + center; } float InterpolatedNoise(float x, float y) { int integer_X = int(x); float fractional_X = x - integer_X; int integer_Y = int(y); float fractional_Y = y - integer_Y; float v1, v2, v3, v4; v1 = SmoothedNoise1(integer_X, integer_Y); v2 = SmoothedNoise1(integer_X + 1, integer_Y); v3 = SmoothedNoise1(integer_X, integer_Y + 1); v4 = SmoothedNoise1(integer_X + 1, integer_Y + 1); float i1, i2; i1 = Interpolate(v1 , v2 , fractional_X); i2 = Interpolate(v3 , v4 , fractional_X); return Interpolate(i1 , i2 , fractional_Y); } float generate2d(int x, int y, float wavelength, float persistence, float amplitude, float noisiness = 0.1) { float total = 0; float delta = 0; int i = 0; //printf("wavelength = %f\n", wavelength); //printf("persistence = %f\n", persistence); //printf("amplitude = %f\n", amplitude); for (;;) { float frequency = (1 << i) / wavelength; float a = amplitude * pow(persistence, i); if ( a < amplitude * noisiness ) break; delta = InterpolatedNoise(x * frequency, y * frequency) * a; total += delta; i++; if ( i == 8 ) break; //printf("amp=%f, %d, ", amplitude, i); } //printf("\n"); return total; } void generate2d_x(unsigned char* pixel, int sx, int ex, int y, float wavelength, float persistence, float amplitude, float noisiness = 0.1, float* temp = 0) { #if 0 std::vector<float> noise(ex); #elif 0 float* noise = (float*)malloc(sizeof(float) * ex); memset(noise, 0, sizeof(float) * ex); #else float* noise; if ( temp ) noise = temp; else noise = (float*)malloc(sizeof(float) * ex); memset(noise, 0, sizeof(float) * ex); #endif float a = amplitude; float threshold = amplitude * noisiness; for (int i = 0; i < 8 && a >= threshold; i++) { //if ( a < threshold ) break; float frequency = (1 << i) / wavelength; int integer_Y = int(y * frequency); float fractional_Y = (y * frequency) - integer_Y; float fY = (1.f - cos(fractional_Y * 3.1415927f)) * .5f; float* pn = noise; for (int x = sx; x < ex; x++) { int integer_X = int(x * frequency); float fractional_X = (x * frequency) - integer_X; float n[16]; Noise16(n, integer_X, integer_Y); float v1, v2, v3, v4; v1 = (n[0x0] + n[0x8] + n[0x2] + n[0xA]) / 16 + (n[0x1] + n[0x9] + n[0x4] + n[0x6]) / 8 + n[0x5] / 4; v2 = (n[0x4] + n[0xC] + n[0x6] + n[0xE]) / 16 + (n[0x5] + n[0xD] + n[0x8] + n[0xA]) / 8 + n[0x9] / 4; v3 = (n[0x1] + n[0x9] + n[0x3] + n[0xB]) / 16 + (n[0x2] + n[0xA] + n[0x5] + n[0x7]) / 8 + n[0x6] / 4; v4 = (n[0x5] + n[0xD] + n[0x7] + n[0xF]) / 16 + (n[0x6] + n[0xE] + n[0x9] + n[0xB]) / 8 + n[0xA] / 4; float i1, i2; float fX = (1.f - cos(fractional_X * 3.1415927f)) * .5f; i1 = v1 * (1.f - fX) + v2 * fX; i2 = v3 * (1.f - fX) + v4 * fX; float delta; delta = (i1 * (1.f - fY) + i2 * fY) * a; *pn++ += delta; } a *= persistence; } for (int x = sx; x < ex; x++) { int temp; temp = (int)(noise[x]); if ( temp > 255 ) temp = 255; if ( temp < 0 ) temp = 0; pixel[x] = (unsigned char)temp; } #if 0 free(noise); #else if ( !temp ) free(noise); #endif } void generate2d_xy(unsigned char* img, int stride, int width, int height, float wavelength, float persistence, float amplitude, float noisiness = 0.1) { std::vector<float> noise; unsigned char* pixel = img; for (int y = 0; y < height; y++) { noise.clear(); noise.assign(width, 0.0); for (int i = 0; i < 8; i++) { float frequency = (1 << i) / wavelength; float a = amplitude * pow(persistence, i); if ( a < amplitude * noisiness ) break; int integer_Y = int(y * frequency); float fractional_Y = (y * frequency) - integer_Y; float fY = (1 - cos(fractional_Y * 3.1415927f)) * .5f; for (int x = 0; x < width; x++) { int integer_X = int(x * frequency); float fractional_X = (x * frequency) - integer_X; #if 0 float n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, nA, nB, nC, nD, nE, nF; n0 = Noise(integer_X - 1, integer_Y - 1); n1 = Noise(integer_X - 1, integer_Y ); n2 = Noise(integer_X - 1, integer_Y + 1); n3 = Noise(integer_X - 1, integer_Y + 2); n4 = Noise(integer_X , integer_Y - 1); n5 = Noise(integer_X , integer_Y ); n6 = Noise(integer_X , integer_Y + 1); n7 = Noise(integer_X , integer_Y + 2); n8 = Noise(integer_X + 1, integer_Y - 1); n9 = Noise(integer_X + 1, integer_Y ); nA = Noise(integer_X + 1, integer_Y + 1); nB = Noise(integer_X + 1, integer_Y + 2); nC = Noise(integer_X + 2, integer_Y - 1); nD = Noise(integer_X + 2, integer_Y ); nE = Noise(integer_X + 2, integer_Y + 1); nF = Noise(integer_X + 2, integer_Y + 2); float v1, v2, v3, v4; v1 = (n0 + n8 + n2 + nA) / 16 + (n1 + n9 + n4 + n6) / 8 + n5 / 4; v2 = (n4 + nC + n6 + nE) / 16 + (n5 + nD + n8 + nA) / 8 + n9 / 4; v3 = (n1 + n9 + n3 + nB) / 16 + (n2 + nA + n5 + n7) / 8 + n6 / 4; v4 = (n5 + nD + n7 + nF) / 16 + (n6 + nE + n9 + nB) / 8 + nA / 4; #else float n[16]; Noise16(n, integer_X, integer_Y); float v1, v2, v3, v4; v1 = (n[0x0] + n[0x8] + n[0x2] + n[0xA]) / 16 + (n[0x1] + n[0x9] + n[0x4] + n[0x6]) / 8 + n[0x5] / 4; v2 = (n[0x4] + n[0xC] + n[0x6] + n[0xE]) / 16 + (n[0x5] + n[0xD] + n[0x8] + n[0xA]) / 8 + n[0x9] / 4; v3 = (n[0x1] + n[0x9] + n[0x3] + n[0xB]) / 16 + (n[0x2] + n[0xA] + n[0x5] + n[0x7]) / 8 + n[0x6] / 4; v4 = (n[0x5] + n[0xD] + n[0x7] + n[0xF]) / 16 + (n[0x6] + n[0xE] + n[0x9] + n[0xB]) / 8 + n[0xA] / 4; #endif float i1, i2; float fX = (1 - cos(fractional_X * 3.1415927f)) * .5f; i1 = v1 * (1 - fX) + v2 * fX; i2 = v3 * (1 - fX) + v4 * fX; float delta; delta = (i1 * (1 - fY) + i2 * fY) * a; noise[y * width + x] += delta; } } for (int x = 0; x < width; x++) { int temp; temp = (int)(noise[x]); if ( temp > 255 ) temp = 255; if ( temp < 0 ) temp = 0; pixel[x] = (unsigned char)temp; } // pixel += stride; } } }; namespace PicturePerfectOpenCVOperators { class NoiseV : public Operator { private : public : virtual ResultType process(const strings& tokens, PacketStore& packets) { assertNumberOfArgs(tokens, 3); // Packet& src = packets[tokens[2]]; Packet& dst = packets[tokens[1]]; // Image IplImage* dest = dst.image; //printf("PerlinNoise\n"); PerlinNoise noise; #if 0 noise.generate2d_xy((unsigned char*)dest->imageData, dest->widthStep, dest->width, dest->height, (float)(dest->width >> 4), (float)src.value, 256); #else float* temp = new float[dest->width]; for (int y = 0; y < dest->height; y++) { unsigned char* pixel = (unsigned char*)(dest->imageData + dest->widthStep * y); #if 0 noise.generate2d_x(pixel, 0, dest->width, y, (float)(dest->width >> 4), (float)packets[tokens[1]].value, 256); #elif 1 noise.generate2d_x(pixel, 0, dest->width, y, (float)(dest->width >> 4), (float)src.value, 256, 0.1f, temp); #else for (int x = 0; x < dest->width; x++) { int temp; temp = (int)(noise.generate2d(x, y, (float)(dest->width >> 4), (float)packets[tokens[1]].value, 256)); if ( temp > 255 ) temp = 255; if ( temp < 0 ) temp = 0; pixel[x] = (unsigned char)temp; //printf("pixel = %u\n", temp); } #endif } delete[] temp; #endif // Value dst.value = src.value; return RES_NEXT; } }; }
5236fd0eac867c89c1dd0cec99104d5f7ac82a5d
f66d08afc3a54a78f6fdb7c494bc2624d70c5d25
/Code/CLN/src/float/conv/cl_DF_to_FF.cc
dd3fc2853bb11d73fcd3a756b82b02ab68709280
[]
no_license
NBAlexis/GiNaCToolsVC
46310ae48cff80b104cc4231de0ed509116193d9
62a25e0b201436316ddd3d853c8c5e738d66f436
refs/heads/master
2021-04-26T23:56:43.627861
2018-03-09T19:15:53
2018-03-09T19:15:53
123,883,542
1
0
null
null
null
null
UTF-8
C++
false
false
1,813
cc
cl_DF_to_FF.cc
// cl_DF_to_FF(). // General includes. #include "cln_private.h" // Specification. #include "float/cl_F.h" // Implementation. #include "float/dfloat/cl_DF.h" #include "float/ffloat/cl_FF.h" namespace cln { const cl_FF cl_DF_to_FF (const cl_DF& x) { // x entpacken: var cl_signean sign; var sintL exp; #if (cl_word_size==64) var uint64 mant; DF_decode(x, { return cl_FF_0; }, sign=,exp=,mant=); // 52-23=29 Bits wegrunden: var const int shiftcount = DF_mant_len-FF_mant_len; if ( ((mant & bit(shiftcount-1)) ==0) // Bit 28 war 0 -> abrunden || ( ((mant & (bit(shiftcount-1)-1)) ==0) // war 1, Bits 27..0 >0 -> aufrunden // round-to-even && ((mant & bit(shiftcount)) ==0) ) ) // abrunden { mant = mant >> shiftcount; } else // aufrunden { mant = mant >> shiftcount; mant = mant+1; if (mant >= bit(FF_mant_len+1)) // Überlauf durchs Runden { mant = mant>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_FF(sign,exp,mant); #else var uint32 manthi; var uint32 mantlo; DF_decode2(x, { return cl_FF_0; }, sign=,exp=,manthi=,mantlo=); // 52-23=29 Bits wegrunden: var const int shiftcount = DF_mant_len-FF_mant_len; manthi = (manthi << (32-shiftcount)) | (mantlo >> shiftcount); if ( ((mantlo & bit(shiftcount-1)) ==0) // Bit 28 war 0 -> abrunden || ( ((mantlo & (bit(shiftcount-1)-1)) ==0) // war 1, Bits 27..0 >0 -> aufrunden // round-to-even && ((mantlo & bit(shiftcount)) ==0) ) ) // abrunden {} else // aufrunden { manthi = manthi+1; if (manthi >= bit(FF_mant_len+1)) // Überlauf durchs Runden { manthi = manthi>>1; exp = exp+1; } // Mantisse rechts schieben } return encode_FF(sign,exp,manthi); #endif } } // namespace cln
20d888f22c73bc4deaba3273cc6c4fe943349c8a
1f262eccfb92c87a3b8d1562e023cdeafe5260c1
/ScreenMain.h
cd74f677667fc997a6f6c5a674d916eae10b6faa
[]
no_license
FredericDesgreniers/COMP-345-DnD
5153d06dbf36985e653885d5610afdc065269e53
7348d541e4375b0115dd7c6a5c261b0d5e72c78e
refs/heads/master
2021-03-30T17:26:25.329541
2016-10-30T21:46:39
2016-10-30T21:46:39
72,433,600
0
0
null
null
null
null
UTF-8
C++
false
false
131
h
ScreenMain.h
#pragma once #include "Screen.h" class ScreenMain : public Screen { public: ScreenMain(Game* game); void render() override; };
e4130e463a40eddfe7b5b33ff77847634193f184
ed17d8b5ff69ee5485c0778bec5852fdca50f87f
/src/game/game.h
724812d932be6a1961817393a721ee2431931ce8
[]
no_license
IceAndSnow/touchdown
6202f41a91d2816a2307232d8d72be412bcf400e
63f134b1c12b85a4a590fb57134c6bb11cdf34b4
refs/heads/master
2021-07-17T10:03:13.384416
2020-08-11T20:48:56
2020-08-11T20:48:56
198,452,981
0
1
null
2020-08-11T20:48:57
2019-07-23T14:59:45
C++
UTF-8
C++
false
false
444
h
game.h
#ifndef TOUCHDOWN_GAME_H #define TOUCHDOWN_GAME_H #include "player.h" #include "board.h" #include "game_state.h" namespace game { class Game { GameState m_state; public: Game(Player* player1, Player* player2); void loadBoard(Board board); GameState performNextMove(); GameState getCurrentState(); void setActivePlayer(unsigned int player); }; } #endif //TOUCHDOWN_GAME_H
a612dd04f9987fd8ef7b20258294c37c0465a4d4
968d33e9e8c913bf9564fc48063880af0c8ce03f
/src/Node.h
eb6d1ef846ac244c9dbe1481c483a282c02d99d9
[]
no_license
DanielMualem/ex5
5e2167c9a1869360444ec94c6556bc55dcfaa1c1
156578f21297a7a114d2991613c6463df2cc5865
refs/heads/master
2021-01-11T21:17:39.016403
2017-01-12T15:23:13
2017-01-12T15:23:13
78,758,524
0
0
null
null
null
null
UTF-8
C++
false
false
907
h
Node.h
#ifndef EX1_1_NODEBASE_H #define EX1_1_NODEBASE_H #include <iostream> #include <boost/serialization/assume_abstract.hpp> #include <boost/serialization/base_object.hpp> #include <boost/serialization/export.hpp> using namespace std; /** * Node Class (Abstract). * The base of every node. */ class Node { friend class boost::serialization::access; template<class Archive> void serialize(Archive &ar, const unsigned int version){} public: Node(); virtual Node* getNode() = 0; virtual void setVisited(bool isVisited) = 0; virtual bool getIsVisited() const = 0; virtual Node* getDad() const = 0; virtual void setDad(Node* dad) = 0; virtual bool isEqual(Node* node) = 0; virtual string toString() const = 0; friend ostream& operator<<(ostream& os, const Node& obj); virtual ~Node(); }; //BOOST_SERIALIZATION_ASSUME_ABSTRACT(Node); #endif //EX1_1_NODEBASE_H
075a1186067641d51ecc3a2427a7abee56665076
182adfdfa907d3efc0395e293dcdbc46898d88eb
/Temp/il2cppOutput/il2cppOutput/AssemblyU2DCSharpU2Dfirstpass_RTM_Game_Example1461391879.h
d6b82f4ecc8735eefdc232916aafab024285cef8
[]
no_license
Launchable/1.1.3New
d1962418cd7fa184300c62ebfd377630a39bd785
625374fae90e8339cec0007d4d7202328bfa03d9
refs/heads/master
2021-01-19T07:40:29.930695
2017-09-15T17:20:45
2017-09-15T17:20:45
100,642,705
0
0
null
null
null
null
UTF-8
C++
false
false
9,330
h
AssemblyU2DCSharpU2Dfirstpass_RTM_Game_Example1461391879.h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "AssemblyU2DCSharpU2Dfirstpass_AndroidNativeExample3916638757.h" // UnityEngine.GameObject struct GameObject_t1756533147; // SA_Label struct SA_Label_t226960149; // DefaultPreviewButton struct DefaultPreviewButton_t12674677; // DefaultPreviewButton[] struct DefaultPreviewButtonU5BU5D_t3800739864; // SA_PartisipantUI[] struct SA_PartisipantUIU5BU5D_t1392135761; // SA_FriendUI[] struct SA_FriendUIU5BU5D_t2705386528; // UnityEngine.Texture struct Texture_t2243626319; // System.String struct String_t; #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // RTM_Game_Example struct RTM_Game_Example_t1461391879 : public AndroidNativeExampleBase_t3916638757 { public: // UnityEngine.GameObject RTM_Game_Example::avatar GameObject_t1756533147 * ___avatar_2; // UnityEngine.GameObject RTM_Game_Example::hi GameObject_t1756533147 * ___hi_3; // SA_Label RTM_Game_Example::playerLabel SA_Label_t226960149 * ___playerLabel_4; // SA_Label RTM_Game_Example::gameState SA_Label_t226960149 * ___gameState_5; // SA_Label RTM_Game_Example::parisipants SA_Label_t226960149 * ___parisipants_6; // DefaultPreviewButton RTM_Game_Example::connectButton DefaultPreviewButton_t12674677 * ___connectButton_7; // DefaultPreviewButton RTM_Game_Example::helloButton DefaultPreviewButton_t12674677 * ___helloButton_8; // DefaultPreviewButton RTM_Game_Example::leaveRoomButton DefaultPreviewButton_t12674677 * ___leaveRoomButton_9; // DefaultPreviewButton RTM_Game_Example::showRoomButton DefaultPreviewButton_t12674677 * ___showRoomButton_10; // DefaultPreviewButton[] RTM_Game_Example::ConnectionDependedntButtons DefaultPreviewButtonU5BU5D_t3800739864* ___ConnectionDependedntButtons_11; // SA_PartisipantUI[] RTM_Game_Example::patricipants SA_PartisipantUIU5BU5D_t1392135761* ___patricipants_12; // SA_FriendUI[] RTM_Game_Example::friends SA_FriendUIU5BU5D_t2705386528* ___friends_13; // UnityEngine.Texture RTM_Game_Example::defaulttexture Texture_t2243626319 * ___defaulttexture_14; // System.String RTM_Game_Example::inviteId String_t* ___inviteId_15; public: inline static int32_t get_offset_of_avatar_2() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___avatar_2)); } inline GameObject_t1756533147 * get_avatar_2() const { return ___avatar_2; } inline GameObject_t1756533147 ** get_address_of_avatar_2() { return &___avatar_2; } inline void set_avatar_2(GameObject_t1756533147 * value) { ___avatar_2 = value; Il2CppCodeGenWriteBarrier(&___avatar_2, value); } inline static int32_t get_offset_of_hi_3() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___hi_3)); } inline GameObject_t1756533147 * get_hi_3() const { return ___hi_3; } inline GameObject_t1756533147 ** get_address_of_hi_3() { return &___hi_3; } inline void set_hi_3(GameObject_t1756533147 * value) { ___hi_3 = value; Il2CppCodeGenWriteBarrier(&___hi_3, value); } inline static int32_t get_offset_of_playerLabel_4() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___playerLabel_4)); } inline SA_Label_t226960149 * get_playerLabel_4() const { return ___playerLabel_4; } inline SA_Label_t226960149 ** get_address_of_playerLabel_4() { return &___playerLabel_4; } inline void set_playerLabel_4(SA_Label_t226960149 * value) { ___playerLabel_4 = value; Il2CppCodeGenWriteBarrier(&___playerLabel_4, value); } inline static int32_t get_offset_of_gameState_5() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___gameState_5)); } inline SA_Label_t226960149 * get_gameState_5() const { return ___gameState_5; } inline SA_Label_t226960149 ** get_address_of_gameState_5() { return &___gameState_5; } inline void set_gameState_5(SA_Label_t226960149 * value) { ___gameState_5 = value; Il2CppCodeGenWriteBarrier(&___gameState_5, value); } inline static int32_t get_offset_of_parisipants_6() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___parisipants_6)); } inline SA_Label_t226960149 * get_parisipants_6() const { return ___parisipants_6; } inline SA_Label_t226960149 ** get_address_of_parisipants_6() { return &___parisipants_6; } inline void set_parisipants_6(SA_Label_t226960149 * value) { ___parisipants_6 = value; Il2CppCodeGenWriteBarrier(&___parisipants_6, value); } inline static int32_t get_offset_of_connectButton_7() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___connectButton_7)); } inline DefaultPreviewButton_t12674677 * get_connectButton_7() const { return ___connectButton_7; } inline DefaultPreviewButton_t12674677 ** get_address_of_connectButton_7() { return &___connectButton_7; } inline void set_connectButton_7(DefaultPreviewButton_t12674677 * value) { ___connectButton_7 = value; Il2CppCodeGenWriteBarrier(&___connectButton_7, value); } inline static int32_t get_offset_of_helloButton_8() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___helloButton_8)); } inline DefaultPreviewButton_t12674677 * get_helloButton_8() const { return ___helloButton_8; } inline DefaultPreviewButton_t12674677 ** get_address_of_helloButton_8() { return &___helloButton_8; } inline void set_helloButton_8(DefaultPreviewButton_t12674677 * value) { ___helloButton_8 = value; Il2CppCodeGenWriteBarrier(&___helloButton_8, value); } inline static int32_t get_offset_of_leaveRoomButton_9() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___leaveRoomButton_9)); } inline DefaultPreviewButton_t12674677 * get_leaveRoomButton_9() const { return ___leaveRoomButton_9; } inline DefaultPreviewButton_t12674677 ** get_address_of_leaveRoomButton_9() { return &___leaveRoomButton_9; } inline void set_leaveRoomButton_9(DefaultPreviewButton_t12674677 * value) { ___leaveRoomButton_9 = value; Il2CppCodeGenWriteBarrier(&___leaveRoomButton_9, value); } inline static int32_t get_offset_of_showRoomButton_10() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___showRoomButton_10)); } inline DefaultPreviewButton_t12674677 * get_showRoomButton_10() const { return ___showRoomButton_10; } inline DefaultPreviewButton_t12674677 ** get_address_of_showRoomButton_10() { return &___showRoomButton_10; } inline void set_showRoomButton_10(DefaultPreviewButton_t12674677 * value) { ___showRoomButton_10 = value; Il2CppCodeGenWriteBarrier(&___showRoomButton_10, value); } inline static int32_t get_offset_of_ConnectionDependedntButtons_11() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___ConnectionDependedntButtons_11)); } inline DefaultPreviewButtonU5BU5D_t3800739864* get_ConnectionDependedntButtons_11() const { return ___ConnectionDependedntButtons_11; } inline DefaultPreviewButtonU5BU5D_t3800739864** get_address_of_ConnectionDependedntButtons_11() { return &___ConnectionDependedntButtons_11; } inline void set_ConnectionDependedntButtons_11(DefaultPreviewButtonU5BU5D_t3800739864* value) { ___ConnectionDependedntButtons_11 = value; Il2CppCodeGenWriteBarrier(&___ConnectionDependedntButtons_11, value); } inline static int32_t get_offset_of_patricipants_12() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___patricipants_12)); } inline SA_PartisipantUIU5BU5D_t1392135761* get_patricipants_12() const { return ___patricipants_12; } inline SA_PartisipantUIU5BU5D_t1392135761** get_address_of_patricipants_12() { return &___patricipants_12; } inline void set_patricipants_12(SA_PartisipantUIU5BU5D_t1392135761* value) { ___patricipants_12 = value; Il2CppCodeGenWriteBarrier(&___patricipants_12, value); } inline static int32_t get_offset_of_friends_13() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___friends_13)); } inline SA_FriendUIU5BU5D_t2705386528* get_friends_13() const { return ___friends_13; } inline SA_FriendUIU5BU5D_t2705386528** get_address_of_friends_13() { return &___friends_13; } inline void set_friends_13(SA_FriendUIU5BU5D_t2705386528* value) { ___friends_13 = value; Il2CppCodeGenWriteBarrier(&___friends_13, value); } inline static int32_t get_offset_of_defaulttexture_14() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___defaulttexture_14)); } inline Texture_t2243626319 * get_defaulttexture_14() const { return ___defaulttexture_14; } inline Texture_t2243626319 ** get_address_of_defaulttexture_14() { return &___defaulttexture_14; } inline void set_defaulttexture_14(Texture_t2243626319 * value) { ___defaulttexture_14 = value; Il2CppCodeGenWriteBarrier(&___defaulttexture_14, value); } inline static int32_t get_offset_of_inviteId_15() { return static_cast<int32_t>(offsetof(RTM_Game_Example_t1461391879, ___inviteId_15)); } inline String_t* get_inviteId_15() const { return ___inviteId_15; } inline String_t** get_address_of_inviteId_15() { return &___inviteId_15; } inline void set_inviteId_15(String_t* value) { ___inviteId_15 = value; Il2CppCodeGenWriteBarrier(&___inviteId_15, value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif
794ea82c6633216f98d73fd8938cfea36767824a
399bbdd3194a888b6faa03386d330f1debd4af0d
/27.cpp
e2f2f89b4b85c1c25f52bf86820d5a6c2d98b8b3
[]
no_license
diljots99-old/OOPS-Sem
4380ed0a8c3be41b8d842e9e687e2165337c9428
78cfc75b50b4b8f51e440d2cf0e0a1d5a856d32f
refs/heads/master
2022-02-11T14:17:51.284336
2018-10-25T09:50:16
2018-10-25T09:50:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,045
cpp
27.cpp
/* *Write a program to find largest and smallest elements among the array along with sum and average of element */ #include "iostream" using namespace std; int main(int argc, char const *argv[]) { int j=0,SIZE,sum=0,avg,largest,smallest; cout<<"SUM, AVERAGE, LARGEST AND SMALLEST AMONG ARRAY ELEMENTS"; cout<<"\nEnter the Size of Array :"; cin>>SIZE; cout<<"\nEnter the Arrary Elements :"; int array[SIZE],copy[SIZE]; for(int i=0;i<SIZE;i++) { cin>>array[i]; copy[i]=array[i]; } largest=smallest=copy[0]; while(j < SIZE) { if(largest<copy[j]) { largest=copy[j]; } if(smallest>copy[j]) { smallest=copy[j]; } sum += copy[j]; j++; } avg=sum/SIZE; cout<<"Largest Element is "<<largest<<endl; cout<<"Smallest Element is "<<smallest<<endl; cout<<"Sum of Array Elements is "<<sum<<endl; cout<<"Average Of array elements is "<<avg<<endl; system("pause"); return 0; }
f0815d12f6b00630370eff57f0b01f54330539c2
3ea34c23f90326359c3c64281680a7ee237ff0f2
/Data/2392/E
92ff532b1a9314f31e0f57c1787f78a660a96d5f
[]
no_license
lcnbr/EM
c6b90c02ba08422809e94882917c87ae81b501a2
aec19cb6e07e6659786e92db0ccbe4f3d0b6c317
refs/heads/master
2023-04-28T20:25:40.955518
2020-02-16T23:14:07
2020-02-16T23:14:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
80,865
E
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source CFD | | \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "Data/2392"; object E; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField nonuniform List<vector> 4096 ( (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-147010.779957576,78023.7256902419,68987.0542673328) (-155481.270520271,74835.1845626714,149633.140224933) (-175017.49141864,68065.5136411136,256585.118002459) (-211968.336571405,57455.59570666,411097.858867211) (-278734.054577838,43129.89375188,646702.019693175) (-398654.91706742,26795.9941774455,1018560.94258314) (-615819.029426659,11977.6347766171,1622402.33723321) (-1008262.05863573,2890.51829536174,2627773.87757362) (-1663013.42809295,-54.0375403530257,4290841.34320689) (-2317112.3833654,-253.786396918808,6608207.51296924) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-155418.37620813,167660.303687024,65781.7982113459) (-163960.72843975,161624.691634548,142953.019579225) (-183832.689214501,148761.663324554,246089.559110282) (-221692.909077204,128312.078882597,396925.985011554) (-290340.39353741,100074.641637447,630321.630663386) (-413147.663165817,66657.7512458049,1003607.53676084) (-632707.155195097,35083.086275888,1613209.24045667) (-1023664.64076261,15087.358303185,2624677.04121137) (-1673285.24489459,7362.4055627342,4290545.84300292) (-2321902.09435974,3789.00291179128,6608405.14805388) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-174715.999671123,282684.143033272,59692.1603248742) (-183397.613011064,274558.685203306,130155.779767183) (-203922.769932928,257181.638038874,225658.574985796) (-243719.901980911,229013.435341958,368677.120507348) (-316788.691789046,188843.056559508,596697.397374321) (-447235.873606001,138809.146379267,971781.875846859) (-674361.428068204,88195.1558770778,1593031.23431389) (-1062006.92396514,53440.9395644207,2616684.57701777) (-1697974.88111792,35232.585769028,4286789.27792943) (-2333078.00399041,19120.5749269576,6604535.70990472) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-210840.040363816,441989.461702032,51534.721695058) (-219655.592467329,432907.524098574,112841.475267122) (-240981.026565203,413457.154145851,197546.985725341) (-283544.550364157,381553.179924214,328551.791507235) (-363878.782341749,334758.484379878,546515.14602862) (-508962.601359952,273337.379385646,920949.514382196) (-754112.229137946,205163.377547841,1558093.52184938) (-1136163.92935066,149490.566965302,2598207.82379909) (-1743213.67439165,106222.336315971,4270431.74764375) (-2352812.20076066,57158.2413127434,6585206.28201876) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-275629.320627149,675180.414297475,42438.368031702) (-284424.572712487,666331.87140797,93438.5934347903) (-306171.105250246,647466.321714403,165600.531116485) (-351011.090939972,616442.060035939,281722.741944732) (-438799.149119983,570346.909110597,484933.466333999) (-602005.392489534,507735.248508316,852540.989700838) (-875521.013511813,431014.381617803,1502210.99914269) (-1249059.60511372,346133.944422803,2554627.22679892) (-1808934.28020265,248798.451884931,4220985.39143269) (-2381307.88674092,131839.661148913,6527611.85833742) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-392559.219542598,1034178.54441251,33561.0894275681) (-400924.533060863,1026330.21254399,74487.2813524098) (-421965.100287656,1009580.10280266,134338.600551812) (-466355.604069675,981673.771038791,235462.493618631) (-555054.422639236,938776.444756591,422087.380611877) (-721339.91732595,875619.062814351,775543.48363181) (-995661.679225875,785177.425010578,1417042.11946492) (-1352249.0700264,658588.891594471,2456836.24231965) (-1880058.76089122,482199.698017857,4103493.75707802) (-2417138.15059186,257355.60717928,6395115.96163935) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-607262.982116234,1615786.76677955,25654.7597491853) (-614647.904265342,1609048.39213434,57584.4844241873) (-633526.653077656,1594466.21670829,106225.023596216) (-674089.461084068,1569548.65145458,192439.604264503) (-756473.966149505,1528960.85901195,358729.156158648) (-912681.385770519,1462195.61541539,684833.989328129) (-1170082.55131394,1349922.32986687,1290171.63578579) (-1494329.80081548,1163061.532466,2280028.79572975) (-1986081.26219147,870197.788002677,3878111.96793635) (-2475631.20267284,474091.951218459,6137006.82657013) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-999900.922591479,2596905.82420998,18781.8651610584) (-1005792.17235024,2590778.89211589,42843.5375297523) (-1021001.06463544,2577220.56227024,81090.2566032532) (-1053984.7091624,2552977.84523305,151645.771987168) (-1121687.00218884,2510491.71663562,291801.916552323) (-1251525.37427931,2433187.9754236,572334.930823405) (-1467049.87565355,2286267.3991393,1103039.7372045) (-1729551.42195882,2008847.4699725,1986805.22165684) (-2178660.4696953,1554181.73332472,3481481.74603011) (-2587549.58033342,880940.61642024,5662182.66116168) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1657282.22446323,4241647.76851954,12540.2801536264) (-1661308.28552775,4235469.5693823,29157.8884149899) (-1671647.76361145,4221349.57899214,56676.635304508) (-1693811.6898628,4194453.42835688,109012.742043457) (-1738535.51943868,4143627.78114764,214412.196970117) (-1822550.71003893,4044825.16473765,425325.717694995) (-1963643.12309141,3849859.28517625,825376.954749458) (-2173306.70924534,3475757.59170759,1531773.54225971) (-2533899.59468859,2812028.23932284,2807826.6309501) (-2782747.15746126,1690795.88689817,4780718.51793344) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2314466.58033703,6549764.40840747,6349.9404491351) (-2316488.86369834,6543320.68156505,14987.6919647189) (-2321640.77104612,6528283.22216114,29694.8198418673) (-2332524.22772804,6498536.27367882,58136.202248014) (-2354169.5024462,6440346.63905045,115586.846791445) (-2394622.68467844,6324701.61404453,230333.082162999) (-2465245.40405873,6094328.77877507,451108.992622918) (-2584239.99502409,5643306.74699298,867799.832361572) (-2782104.17553821,4775614.86109653,1686317.38612605) (-2801872.15421706,3089427.22057971,3089558.20666161) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (21730588.7423296,69539.846471988,60476.598139414) (21716407.3743069,66237.1175669671,129966.80264385) (21683923.8768161,59153.3091772233,219488.092130291) (21623175.2917512,47699.0836727539,344261.347033446) (21514819.9227488,31567.6767453359,526755.659859974) (21321972.561721,12333.7842462141,801410.363723729) (20968097.0327714,-4899.10033021309,1230009.36875434) (20268849.9637778,-12480.0275234463,1972993.34076281) (18691272.9370943,-10298.088259533,3636621.03073368) (14407058.8270106,-5046.15463226613,8925111.94188848) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (21716251.4689257,148277.377872719,57208.5903640332) (21702051.926853,142054.969372962,122994.050163906) (21669236.9241149,128570.359849666,208123.353060586) (21607277.1335043,106266.019799439,328202.341250912) (21495892.8110828,73679.6180752847,507473.162199332) (21297598.9294887,32614.3140095186,784062.006680073) (20938308.9235781,-6540.79315093128,1222303.58762622) (20241976.4015985,-23230.7637673468,1975029.24840751) (18674574.0384838,-17314.3198000521,3641802.163468) (14399755.7391575,-7398.72904090662,8930112.87125787) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (21683628.2361424,246568.381740624,50980.7272169727) (21669383.9394421,238277.514733667,109592.596301669) (21635898.2132863,220115.619994851,185842.31983587) (21571170.0139808,189228.706005821,295605.684566316) (21452002.9621717,141844.23613631,466265.379443037) (21237390.4974804,77163.1359211609,744706.153343532) (20857489.5168815,8498.49971773988,1205431.8824237) (20167801.0065366,-20691.8208648522,1980700.97591815) (18631454.0703419,-9987.77744600849,3651561.44900277) (14381891.7685182,-606.753615553482,8937415.66796745) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (21623456.6003766,377226.511279051,42661.1966196131) (21609238.8229091,368191.165340771,91469.0975346931) (21574920.4507784,348329.940051054,154969.267033405) (21505909.6299837,314128.697863141,248231.061726777) (21372483.5651629,259878.382496607,401450.53476045) (21121091.9686672,180336.90588254,675838.161670484) (20677978.1908918,83802.9362705427,1176059.27198648) (19999032.7259229,36657.333191705,1991129.42955486) (18544326.3403495,40545.9484833306,3660671.65578277) (14348445.8598322,28667.3242745019,8937755.48419857) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (21517385.3016946,558234.564549452,33593.2913063463) (21503483.524582,549850.170335315,71642.1559158368) (21469000.4626726,531693.576367842,120722.918574838) (21396395.0073005,501119.771537103,193941.713558842) (21246716.2323113,454140.10383068,321780.57769206) (20940207.2369359,388442.793328746,579078.027718964) (20355402.8988986,310897.301126762,1128675.71735095) (19686242.5793626,242969.76115942,1994677.07180554) (18407815.645888,177682.799424995,3648406.26167169) (14298718.5414577,96004.7517567027,8908658.37288945) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (21328620.3709722,819513.133157905,25157.807775245) (21315662.5975825,812622.944210735,53413.870155012) (21282827.2429398,798006.366389995,89924.7038039288) (21211556.2045448,773969.100395462,146779.533229717) (21060179.9814632,737444.159252084,255857.040604417) (20744964.2264265,684356.769890422,501254.887188793) (20152876.4807618,610790.488217038,1060439.50700942) (19513310.3496163,516533.36739337,1928932.44803128) (18291773.904062,376176.794011716,3566221.75538987) (14241783.927409,198869.840776945,8812050.55526723) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (20978452.780531,1223198.83836098,18214.4990482408) (20967189.3937978,1217932.33570513,38683.7763892799) (20938104.2202339,1207003.26810448,65671.9682618945) (20873417.0783507,1189677.03528986,110073.460831295) (20732311.4539121,1163804.44134299,202543.725577379) (20430984.1617305,1123411.47587909,427439.438986178) (19856886.7636445,1052974.62573475,965901.953408502) (19279726.2969759,927835.780158519,1788159.40975055) (18119856.3684358,677627.156805177,3388387.38322817) (14144580.6108855,362202.058020462,8612459.31932496) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (20278602.4800525,1939460.24689373,12851.1557219038) (20269723.9587839,1935233.43238634,27649.8948050641) (20246571.0509699,1926552.08035777,48144.9338449872) (20194356.5697264,1913109.54064611,83987.1164984165) (20078124.7432118,1893597.54402745,161998.235311745) (19822562.346947,1862109.76973102,356828.187132126) (19320208.1657579,1789640.28508758,840520.453266358) (18943765.0144025,1565057.85070795,1537597.91325401) (17772791.8748795,1198926.47495424,3072462.21742863) (13919443.7754583,685738.424034797,8249548.46252112) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (18696913.8657443,3584370.59445146,8509.52913336921) (18690943.0345263,3580263.1639481,18844.4444162341) (18675489.7795826,3571354.15432358,34520.7941548968) (18641373.9754787,3555731.75890094,64328.8774570826) (18568642.0179,3527932.0648948,130432.786149577) (18420669.6918279,3472662.86697117,284275.253941148) (18153978.4697368,3348195.62952559,615714.283573514) (17779182.1268883,3064776.149402,1171123.11564441) (16721083.6343852,2563781.93647565,2558900.39194773) (13234563.8910429,1671628.72889713,7563315.00547971) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (14409117.1262538,8864061.10535535,4341.74940369899) (14406161.7961789,8859699.26605019,9870.9543228663) (14398572.8902552,8849805.61006455,18821.8041791335) (14382194.8455425,8830932.48428529,36517.9724229145) (14348397.3296997,8794340.1219544,75159.0501160192) (14281909.9545167,8719151.71457493,159753.530215753) (14158794.5381223,8559407.5188995,332117.665559385) (13922975.4612238,8227398.51094128,669895.814670897) (13235097.3175781,7557600.20772246,1666492.0172063) (10761305.5521394,5891220.43534057,5891338.57130486) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-378333.619702303,55049.0485297775,46257.3466035478) (-393950.014690139,51705.1066037651,97293.6620982434) (-429227.948088658,44349.0324945885,158480.487610009) (-493474.461384135,31771.02584396,235743.24800287) (-603572.318055649,12696.9752207568,333822.546688065) (-787383.70462296,-11983.7549552191,447546.601088843) (-1088095.86522089,-34667.1550831374,530790.687265775) (-1563968.97478343,-39355.214822588,395348.873751041) (-2246215.33411936,-27015.8780662062,-647762.943867694) (-2753581.53184352,-12367.0159806862,-5482371.53593129) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-394725.404292054,115445.104780916,42964.8500680217) (-410098.392134929,109171.314379353,90032.9943817435) (-445056.908810725,95087.6617017225,145972.231201709) (-509417.048814884,70108.6587909227,216712.813675415) (-621256.037672105,29818.5440879886,309124.126664516) (-810111.063906254,-27537.5022086455,424771.900414339) (-1117878.59977068,-87313.0722785331,525989.374059913) (-1589139.5311199,-97400.2588849915,407534.383942203) (-2258829.88105053,-60477.5831448173,-633215.95834324) (-2758040.65267957,-25321.8640787993,-5470080.68530654) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-431499.151920155,186278.575297416,36677.9506476568) (-446365.774452187,178001.00749321,75982.0045295194) (-480711.491853348,159068.892554822,120994.511917448) (-545744.896302916,123984.166519533,176417.947574019) (-663455.509271878,62403.4565119552,251675.53969513) (-871866.746483504,-39060.646675638,364839.961227486) (-1217381.26714191,-170963.057238736,515744.763312562) (-1676282.80102634,-189439.888052911,444252.233144714) (-2297079.79633389,-97121.6360883838,-598185.814134393) (-2770289.08543624,-34079.555135761,-5444863.23602158) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-497412.498832073,271147.804973633,28383.9026339967) (-511486.886889771,262441.881038043,57052.7719894251) (-544872.819649401,242429.695368071,85869.2727054604) (-611286.429846777,204633.196359958,114800.335796962) (-742159.378191123,134142.389838354,150088.378925974) (-1007765.55193368,-500.783668762265,232770.069621426) (-1526228.67980297,-238701.414010249,497099.330189159) (-1961185.91850357,-276031.122089502,536293.241753757) (-2392802.33509954,-95882.9963568085,-535432.689427219) (-2796551.67447972,-21034.5403079075,-5411096.13684182) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-608281.858133488,369532.683086547,19666.3148166716) (-621198.060197909,362097.393826303,37076.4199097951) (-652722.298922798,345582.823742668,48030.0862319558) (-719153.908112243,316331.679224043,44264.5518821756) (-865514.840346165,267659.372262474,15362.6752169509) (-1240168.60174161,193227.365524017,-5605.60219685702) (-2464440.24906822,108381.070845207,459539.094015866) (-2924024.44836453,70076.0613378258,716082.971417088) (-2580307.33960568,61684.7063535236,-460977.712698063) (-2839528.88500707,39105.433791624,-5390486.22723127) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-791124.554338463,469469.968945727,12191.6725529913) (-802432.357859555,464247.469537301,20520.5853855064) (-830675.399436943,453367.933560971,18622.151045418) (-892461.577212766,435904.248889891,-4548.60376148367) (-1034742.31263738,409656.887175368,-59239.7914723363) (-1408386.46263055,370429.362582166,-90707.0663719335) (-2572764.20491942,314818.614128417,420880.10912748) (-2993546.48835414,282975.250086415,707221.791450771) (-2667164.52522658,204283.009273372,-484054.049079068) (-2882336.30979674,101702.624464219,-5430146.96944432) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1090076.78048055,523459.27501011,6924.28804860202) (-1099386.60611158,520567.130361753,9564.66023495673) (-1123132.64675691,515551.81938543,1001.67450263157) (-1176972.3231337,510634.385423118,-30955.0274447621) (-1307576.13852867,509631.66524268,-98658.1799698882) (-1673353.8975693,515034.962633358,-146541.687619756) (-2887513.30384454,516322.29453691,388738.732562331) (-3276140.69830552,591847.900295813,628117.110735805) (-2798773.74462898,330574.593667784,-587160.327492189) (-2953092.45062998,137123.79517708,-5532524.40358821) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1567306.54038548,357793.106729222,3959.22182024357) (-1574325.31120016,356473.091693906,4486.56357363924) (-1592438.21937829,355486.243703415,-4054.55729470467) (-1634605.55336043,360082.754645803,-32156.7703290366) (-1742654.25736958,384056.330835902,-93418.4022393149) (-2078141.84285529,460143.545444293,-145438.762146563) (-3403901.26288958,623345.065373262,464031.92876606) (-2774826.62033803,400376.671884311,366478.825019632) (-2903847.51319457,147179.49462097,-781102.65475791) (-3062754.59759147,880.29657287669,-5670276.75000241) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2251856.61966759,-703601.740064927,2549.36530739858) (-2256393.34674335,-704659.785486054,3402.6568583356) (-2267979.20215171,-705664.680658478,406.596056021063) (-2293873.51004983,-703553.998990901,-8325.13167725664) (-2353375.82384421,-692442.469108056,-17424.4568876086) (-2495589.62607037,-666280.358995358,17642.7985517323) (-2806335.35160048,-647162.697520379,240848.415884082) (-2908520.44670362,-791603.49703481,112915.19149653) (-3176342.05731276,-922310.246023343,-927785.34305971) (-3226709.5681743,-801666.175539344,-5671581.37862881) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2757950.24510346,-5545553.86043391,1403.52482777715) (-2760141.87166058,-5546890.67979139,2322.12007400007) (-2765694.50347817,-5549155.45955673,2464.3258071063) (-2777655.42272567,-5551625.86013655,2770.48832224778) (-2803203.49248505,-5554424.59125237,8737.46575278734) (-2856763.31031506,-5563173.48145705,36687.8861476059) (-2955724.12143156,-5599821.61296948,96249.4942520456) (-3065979.93229711,-5695964.79184298,-18049.7843175945) (-3227679.88705181,-5677792.81626146,-807405.976348123) (-3114893.08090828,-4870284.87580441,-4870204.60993391) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-447348.684722041,38431.9430582186,30583.1219615208) (-460577.212717456,35384.1082492264,61826.211739616) (-489778.348235981,28408.20323746,93968.4086494805) (-540730.863965395,15774.9286836255,125449.882547112) (-623034.69612675,-4966.1005393265,149878.361157541) (-749658.2129145,-34666.76597655,146819.635425634) (-931765.558581586,-64433.5710400852,54922.8998264165) (-1157599.2845277,-64540.7376257784,-286906.052803544) (-1338242.11880443,-39682.464263642,-1155196.8038548) (-1162952.64814188,-16855.9528275976,-2728969.73472883) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-462241.466127418,78408.9099124159,27539.0949811646) (-474773.615438342,72677.6051105012,54920.8214233026) (-502384.629903565,59251.8668943155,81404.8788592903) (-550656.901228604,33678.263997933,104741.395958699) (-629265.689827765,-12383.231592767,120168.179167801) (-752310.583665116,-89252.7955677633,116953.728517883) (-933282.626192111,-186769.232493992,54693.4163932248) (-1152257.68558906,-184516.482989082,-262212.683774312) (-1329440.11453634,-98770.2229573181,-1132514.69159482) (-1157524.71636362,-37641.4888247352,-2712245.09191369) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-495048.716975494,120195.885983518,21762.5889842416) (-506145.601499742,112696.415364944,41523.6057773497) (-530549.532008701,94770.2485363543,55843.2642906634) (-573295.770277313,58398.2077461103,58674.1945168871) (-644140.158433524,-16266.9071723318,43242.5192580941) (-762281.915737162,-174912.711006485,19317.6039504616) (-961868.381419865,-479780.550967389,56816.0367018208) (-1153024.27928981,-474314.452960016,-176644.515063789) (-1308103.35294175,-192859.519254943,-1071531.66215829) (-1144265.85027789,-60393.1990274483,-2674803.18711394) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-551728.984968186,160239.298260901,14273.0738587362) (-560796.480342738,152677.758278338,23601.3243983127) (-580468.990736108,134558.233305767,19409.5107156093) (-614216.941416558,96782.072679293,-16043.8426477944) (-669828.388441484,10827.5340398175,-115469.27360958) (-779676.521935784,-232832.364260231,-285638.650353729) (-1176912.40761053,-1176867.68869097,62132.2151774086) (-1239064.38402763,-1238826.24354162,104522.471283077) (-1258381.61495963,-283380.473147001,-939377.294964776) (-1117476.5953109,-64044.8724647435,-2614800.70069631) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-641505.267416969,186729.673419495,6733.03412488435) (-648189.886189931,180902.376099564,5500.24229568018) (-661940.475408508,167699.088292975,-18422.4362058159) (-681855.859442478,143110.240253143,-102048.652449428) (-696083.952247335,98518.1069383189,-359170.113446763) (-627471.034280384,25064.0913317805,-1229764.13650001) (-8.22274934067498e-05,-2.20756371773351e-05,5.36795675804692e-05) (821.128896260186,536.780438255958,1059588.00831826) (-1058499.8311142,-25149.3449393463,-720450.628380897) (-1069113.56749294,-3698.67830368936,-2551212.1400561) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-775867.342203998,170607.673315728,864.787969305915) (-780293.243588686,167392.822335546,-7764.77253754909) (-788609.246010005,161026.463296394,-43158.300967903) (-797239.922983467,151488.776033291,-146758.49097735) (-787155.441321805,136900.004816199,-432727.260170811) (-666563.264753112,105487.536146524,-1254973.90286299) (-7.51175424936284e-05,-2.83193786998593e-05,4.170390003706e-05) (620.758660807036,385.358426943546,1033334.50016099) (-1032193.24804299,72714.2239317229,-699500.345893664) (-1068442.12265706,30970.1519218672,-2548063.36325884) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-963459.588115357,46401.6384601761,-2411.15750963444) (-966009.936988788,45818.2717549404,-14213.2760518291) (-969932.485646681,46428.7264969477,-52815.7003626005) (-969940.333813669,53090.3812366947,-161449.294886032) (-942499.189243927,74614.072393597,-464240.311748172) (-781873.647535648,110314.845497492,-1360547.87113279) (-0.000205343374020958,7.60263050884363e-05,5.6517820763925e-05) (391.770641948812,1093164.15125526,1105269.58399919) (-1104580.67412006,225518.364863128,-741727.627441134) (-1111680.15735138,27486.7368633368,-2579656.5056612) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1191294.50134663,-326530.244500083,-3080.15607859989) (-1192520.69392409,-325409.752846826,-13656.7487529107) (-1193549.54509771,-319892.640589441,-46224.0559471166) (-1188586.37282936,-299082.775861043,-140070.079380458) (-1152826.38212723,-226595.409038403,-428688.473190814) (-968166.387318513,42725.7795506691,-1471074.86278076) (379.236081737878,1220909.75012727,1093026.25398871) (-1092598.48023615,266647.613977931,237314.651164142) (-1375464.85852902,-125347.317708643,-940202.320929634) (-1204684.05452261,-163082.371535998,-2607703.75559916) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1366756.79161517,-1209611.35613127,-2018.71642123218) (-1367245.08188208,-1208350.33804727,-8226.39608205692) (-1367261.77938916,-1203321.45783137,-25515.001602657) (-1363459.32280271,-1187291.2016474,-67720.7630634268) (-1345926.90830177,-1142277.05909059,-159488.028553682) (-1291785.33528724,-1027527.89048764,-293038.649298505) (-1220408.29523538,-796637.158960744,138581.203424411) (-1399122.59273869,-949160.611118052,-155008.425444542) (-1504653.32538753,-973744.110843852,-978300.364234555) (-1233176.9104607,-689895.108845048,-2445020.28463912) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1179065.92916398,-2787685.15890845,-810.513162279182) (-1179228.70818812,-2786826.58671993,-3247.42796208099) (-1179172.2041866,-2783565.00205546,-9526.18302955632) (-1177645.93724199,-2774073.34058661,-22753.5295740079) (-1172116.56616973,-2751349.83648724,-44767.6784926613) (-1160228.35440348,-2706595.91222528,-62234.6126666146) (-1156215.89031595,-2644308.47950519,-14071.5232377608) (-1219221.33182963,-2630169.23079769,-179821.504025573) (-1236255.0403384,-2450276.22135894,-694714.240223885) (-988612.845105805,-1755477.64593105,-1755411.93894036) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-487942.658785334,23329.5873249745,17264.3867383193) (-496876.206967284,21050.9901094892,32512.3908786576) (-515822.776441756,15719.4271082851,42837.3919761453) (-546657.147810249,5799.71407420808,42963.961746792) (-591951.717695291,-11190.3321208545,23071.3154361821) (-653918.303948225,-37278.6939864678,-35389.8995436267) (-730314.575656154,-65916.5711979527,-170924.311271107) (-801801.317822855,-59182.3030644436,-467539.974911504) (-794903.951258418,-30892.9749589675,-979985.167498554) (-565354.487901765,-11440.7398004993,-1566142.58793812) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-499256.144932825,45397.1400539598,14947.1260764189) (-507091.039171676,41112.8359560721,27202.7039631662) (-523335.151600848,30919.0692219254,32953.5835468078) (-548796.6562547,10915.6140471404,25977.4385999752) (-584152.195340534,-27303.0967469166,-3023.29126119856) (-629278.899781785,-99222.5744708718,-64111.0946601267) (-683661.589031483,-215327.593609785,-164321.109408926) (-751091.671050595,-185243.391493821,-439426.035518007) (-761641.987853103,-77434.4449476842,-960682.692212529) (-550371.550421507,-24418.4478051456,-1554858.15014997) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-523622.287926395,63359.7486520333,10610.9623528242) (-529308.198163642,57866.7241400312,17019.6708327702) (-540234.135409603,44668.2953085459,12955.0481470542) (-554505.869224429,17338.7874182087,-12258.0262768964) (-566696.358654337,-42050.7450004552,-74954.1778025443) (-563798.442921559,-192365.706936575,-180294.518152436) (-528260.673567311,-694857.802956692,-134372.016658082) (-580441.331693362,-560369.374062129,-331828.981686221) (-666319.608719587,-143175.385800786,-907871.7850553) (-512148.645027086,-33652.7923889417,-1530754.64572232) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-563936.075947091,70406.2837553351,5160.55587560383) (-566806.4310646,65195.8683465466,3841.36239094618) (-570520.057037877,52979.8845184135,-14419.16051715) (-568686.042764267,29058.8536607966,-71670.1254120308) (-542796.980816343,-15484.025607914,-225268.252429721) (-433864.801445845,-80627.7741252957,-682817.905730939) (-3.8347855550045e-05,-6.38572051417707e-06,1.79502222642211e-05) (300.345558969823,991.944198366349,85030.5475691834) (-434221.300334417,-83595.1504041748,-798710.002452641) (-436496.546005987,-15763.5294726546,-1497579.31467387) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-623480.228117227,52385.1055463498,-3.86109075314599) (-623474.702149836,48813.6406105951,-8336.81739490259) (-619966.9169474,41036.2973738655,-38366.7887114638) (-602676.928616064,27738.5112881746,-116225.377165258) (-544881.067654582,7493.62088504494,-290405.908250961) (-382355.728724175,-13969.7528507725,-602179.235081679) (4.38088895012568e-06,-3.04967433216631e-06,-9.62460279586057e-05) (-8.94126657596067e-05,-1.06094073953378e-05,3.44972901683965e-06) (952.199363107115,1065.35193315008,-731336.83577115) (-330810.675196934,-3073.5837661072,-1482329.67377367) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-702995.274258843,-16883.0788714426,-3603.88352736412) (-700720.532910241,-18220.936861107,-16142.0167341065) (-691738.001822243,-20211.6118864857,-51765.351661517) (-663562.629251152,-21153.4916369777,-136550.642468681) (-585915.929648313,-18378.3464819788,-311918.186775142) (-394406.655304509,-9803.09979567882,-588241.449278829) (-1.65193908862948e-06,-8.17047845627434e-06,-7.44557212048974e-05) (-6.64313039599596e-05,-2.18221170397024e-05,3.17853627994736e-06) (375.758635193787,298.567395939827,-736066.151297294) (-315437.376332957,-12283.5472099412,-1479860.93417758) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-794187.793192983,-181172.81468927,-4982.0591045446) (-790598.313313316,-180433.806243133,-18180.8133979807) (-778611.937582321,-176947.618077492,-52765.35527134) (-744669.222629927,-165394.2384227,-133795.719669356) (-655717.90873942,-135628.486535937,-303326.860119908) (-440624.058230257,-76016.459351949,-578363.089869038) (-1.15072961661777e-05,-0.000119728486439656,-8.83937163309305e-05) (-0.000115380973367357,2.8400887465618e-06,2.28731730293974e-06) (371.003946285695,-45445.9149562726,-749079.635763897) (-339330.85093821,-65561.6336111237,-1468150.85577587) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-866486.583920782,-501685.158069422,-4295.57404570318) (-862682.363739428,-499868.031887775,-14699.6785857319) (-850639.192174452,-493346.313130562,-41211.3364559136) (-817370.681224382,-473731.843486558,-104089.422997029) (-729237.619346883,-419557.463560495,-243749.20875281) (-504729.982355566,-280892.149464771,-502309.923602936) (-0.000140418051107538,7.68090883534034e-06,7.87442947909325e-06) (397.811871819947,-40035.7110171431,-45704.755395384) (-442356.640488936,-254660.112985895,-769598.77540585) (-445084.344883266,-191635.883729365,-1403124.23492697) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-844222.399309992,-1021698.73323137,-2520.81714322656) (-841226.077490631,-1020144.59244265,-8263.2609798028) (-832114.704031696,-1015062.62657902,-21694.0228888056) (-807503.384565203,-1001349.55450425,-50032.2501086236) (-741902.399205503,-968444.316247284,-105169.906518097) (-560235.122174286,-896053.933995584,-221558.335100234) (877.267186527153,-732618.668907047,-40164.2763023878) (-449268.793650945,-769442.245103277,-260611.541304006) (-607511.590088478,-705493.250786909,-706920.138802049) (-474424.685432999,-445397.95126887,-1211910.29629024) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-591242.181673007,-1608524.50461915,-997.976103188131) (-589654.470956257,-1607511.56567514,-3205.2401025698) (-585064.610088218,-1604369.59361193,-8005.86716805968) (-573416.764175329,-1596428.34196389,-17156.2527750833) (-545605.302954183,-1579316.12752261,-32795.704715296) (-484378.193956183,-1546528.00939802,-58171.7897601618) (-381572.23275482,-1488327.29401725,-77106.8222110954) (-457717.978106849,-1411160.20714484,-196892.213892314) (-477397.178554232,-1214143.66707177,-447099.659391627) (-347395.029388727,-766907.26465668,-766808.161720905) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-508095.152690814,11910.3735524089,8242.12035307779) (-512902.203698458,10747.017539087,13521.0995451665) (-522361.420209754,8128.09290696589,11931.6504061979) (-535817.969730894,3601.68273294215,-2509.21040610013) (-551970.335825313,-3388.24669537243,-39102.3455807073) (-568479.991584354,-12571.444260876,-111969.213683699) (-580642.729894412,-19163.3760345436,-242477.6834109) (-575265.32030664,-8412.59960766251,-460601.081319458) (-507513.432109332,2398.38361010216,-750389.984078624) (-318517.374339737,3551.23509375192,-1000778.33273444) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-515340.272051214,20942.9718478503,7051.52882295173) (-518995.917362106,18791.9755429299,10911.4490095404) (-525633.846028264,13930.4791713188,7407.75717260487) (-533386.401440128,5133.12399669553,-9533.93890572257) (-538889.066587265,-9866.93078383241,-48318.3835705278) (-537861.483383695,-33679.7734327512,-118627.470796745) (-529826.325333369,-59792.8801114741,-231833.230417921) (-526832.025704291,-14495.8089531037,-450009.666418783) (-477733.630272513,17931.2669881751,-749450.907377441) (-305540.098228747,13818.5477757472,-1004549.6722522) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-530483.039278946,22950.3448767287,4853.37832367773) (-531970.508281411,20281.3292755114,6026.33470886529) (-533165.695235269,14286.4561945497,-1398.08248869892) (-529281.407437062,3055.80817817573,-24545.2284575525) (-510733.805599565,-18236.9257387493,-72137.7865574068) (-462353.13062942,-62441.5060545597,-144821.36622774) (-379711.305952287,-166472.722540785,-186690.891413453) (-384206.8861654,20465.8415245823,-417886.987419099) (-401318.503024192,88938.4492871392,-753895.275413464) (-275435.899192916,42005.1995725333,-1018794.6730444) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-554033.536511844,10811.4964390279,2236.30900245047) (-552819.839171328,8468.39620723397,62.6501774578183) (-546999.501962219,3444.96479846124,-12616.4135021128) (-527425.125717405,-5025.49974441973,-45796.022626376) (-472882.987961229,-17644.2892796587,-116302.651940578) (-334568.514758064,-29145.5271693294,-248894.917513589) (-3.44818500952665e-05,-7.69471806522358e-06,-1.05115321847701e-06) (380.845624525647,950.137838984726,-349887.336052154) (-245488.443365845,351607.261775218,-801289.005508808) (-224334.850559325,89914.5934657282,-1061360.09484867) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-585512.168330783,-27083.9069857846,-72.6563616262612) (-581761.212446966,-28394.9096884088,-4922.84016885011) (-569653.091247426,-30710.7206768096,-21080.980393554) (-537284.39035585,-33131.6873201761,-58367.3310780133) (-459680.034829509,-33495.9279445396,-127716.725238207) (-293572.381741199,-25992.3421786777,-219653.257211837) (4.02113842787907e-06,-1.60665879068469e-06,-8.04264673142514e-06) (-7.8645947902378e-05,-2.74857637488551e-06,-1.53992155335762e-05) (372.995125338407,502.513210438295,-1063500.06014469) (-164900.626637422,12316.0342135377,-1151811.54945201) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-620769.020091577,-107932.002740742,-1378.15841230988) (-615300.77772791,-107970.378798076,-7222.44448497775) (-599172.903852321,-106955.515977619,-23542.7471540958) (-559337.038933212,-102157.178852819,-58742.8459393928) (-469904.744681736,-88099.0967128046,-120150.862137705) (-290992.233456488,-56004.3398124607,-193553.286351944) (-9.84090939815486e-07,-4.26318237141078e-06,-1.77894103756522e-11) (-5.56816713237835e-05,-2.24740907207569e-06,-1.12508177283971e-05) (189.211673814895,290.009217805792,-1052158.45464328) (-154464.73572229,-36162.4028951409,-1164652.65814525) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-647563.136065743,-253152.161616158,-1404.49825183319) (-641527.290214514,-252229.522053316,-6216.37809540114) (-624340.471163736,-248701.193760271,-18742.1667313333) (-583041.749996276,-237889.377313854,-44637.4409039508) (-491444.859112947,-209058.154439074,-87951.4328041565) (-307025.391130051,-140155.986667661,-137398.453049161) (-8.7223934028769e-06,-8.50988180812999e-06,-2.09909896626909e-11) (-9.83363052206878e-05,-3.95854434336251e-06,-1.53335538663723e-05) (430.734112017548,-488316.729101458,-1088991.75398395) (-164175.817325849,-171350.695955541,-1128958.49453594) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-640159.476257734,-478982.120135929,-497.149143275681) (-634734.21957663,-478020.807181875,-2654.00817751246) (-619638.915093914,-474479.554469298,-7875.92454902749) (-583754.008270245,-463597.39704567,-15784.577771349) (-503015.6798124,-432094.926303012,-18969.7454418921) (-330198.365733467,-336530.734324026,2873.38559237266) (-0.000124716647640768,-1.84564096583521e-05,-5.70129863107799e-06) (341.35753998423,-490049.021595154,-488721.893124134) (-226987.018815557,-419959.602439137,-772448.641459834) (-209808.35290125,-221003.290663902,-958072.038733481) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-555277.112803111,-768382.863027973,455.456385164566) (-551393.174389404,-768269.205069626,870.951171677657) (-540921.183719357,-767774.655444838,2972.53183487454) (-516710.250376835,-767111.638904658,15693.6395055075) (-462853.417177815,-772114.791007911,76664.5221827201) (-339470.887303815,-820302.523169408,339672.07615763) (208.857982109742,-1115332.16780766,-490430.874158167) (-232706.757996806,-778065.987806357,-418975.943601101) (-297102.980609774,-575475.428317218,-573868.727201718) (-213413.91717287,-318397.972553033,-737484.813572728) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-343051.209393635,-1017123.44214178,549.606834443049) (-341090.747548279,-1017665.37123612,1382.04959296461) (-335976.548990961,-1019137.92949405,3657.26254492406) (-324729.842925784,-1022879.619774,10738.3221647207) (-301815.175225531,-1033694.12675836,28527.5301865257) (-258587.779644116,-1062242.31940271,44676.9121077572) (-192036.012322566,-1106896.31474193,-153295.161390227) (-218923.572608276,-953555.923053983,-216599.631641173) (-215635.805770885,-736781.179977537,-317055.252764193) (-143981.78934662,-419511.793960833,-419354.671398502) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-516121.022439469,4650.05027247985,3375.8194761647) (-518137.623665167,4595.31803067707,4015.92141219439) (-521505.126861242,4774.07292249465,-1614.44485881043) (-524545.140419042,5961.19202506538,-18848.466195725) (-524615.992608013,9644.5977552127,-55847.4071682348) (-517983.343836882,18068.5468029814,-124412.601718687) (-499481.669990622,31736.7437031495,-237310.405325625) (-459743.389756992,40124.2367508568,-392956.572626125) (-371276.106798857,32271.8901034448,-561465.788040045) (-214255.783756685,16589.4553065116,-682316.833929604) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-519902.681921594,5868.57665922878,3343.88348363092) (-521124.394128335,5833.96995861203,4233.70832192639) (-522581.284346703,6386.10087981805,-430.881316959089) (-521880.546101353,9225.22938470148,-15200.7740153722) (-515274.679073312,18312.1964217309,-47482.7601958484) (-498420.811148676,41949.1806051329,-110804.066233021) (-470425.921019594,90549.9668827257,-229017.693726382) (-443038.756895606,128356.905130792,-401043.630915013) (-363612.484091848,94507.1582238187,-577400.045216055) (-211227.116919107,44017.7064193737,-699141.277638559) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-527301.15000334,-627.437354634942,3314.12473825576) (-527049.728635541,-567.605284974938,4794.92033596879) (-524827.052265336,446.217564605734,2396.16068124596) (-516441.379708099,4917.1421725371,-6135.77983555057) (-494334.312974606,19666.6471694532,-23889.7232082348) (-447473.119026218,65493.0656126793,-62313.6198189802) (-373644.835421048,213572.612349495,-191402.735816997) (-417325.2156425,405308.596308008,-435236.09751712) (-358722.047638392,244929.567367973,-628254.962047051) (-209333.584425717,93218.2023336755,-743557.772728563) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-537312.919692035,-20760.564325461,3412.51015101541) (-535269.440909399,-20546.054887388,5840.5614914958) (-528335.428512141,-19275.8895244773,6898.59513049835) (-509331.559767257,-14947.3906007478,8669.56195363824) (-462037.461186268,-4472.59490518824,21963.277253326) (-344678.710257842,11874.8426339429,85691.6957318402) (-2.22722536881485e-05,3.55535921911539e-06,-1.31199955778594e-05) (-483311.76067935,826.801462670072,-596094.855030251) (-413848.027004021,597602.619059099,-780408.323083197) (-223688.32492208,149429.232855054,-837265.879241813) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-547593.266174699,-62324.8370881389,3645.37060658692) (-543894.913064355,-61914.5687759132,7147.58511250536) (-532843.63936961,-60211.8269219489,11274.0706321614) (-505008.964210026,-55182.8947291412,19234.1486147323) (-439666.918255741,-43673.8486642578,38422.2858000297) (-293888.147419179,-23365.084431458,73977.9785434131) (7.18814632802023e-06,3.73467000443208e-07,8.14227229827808e-07) (-5.44020258024766e-05,1.87317123197415e-06,-2.46619257864744e-05) (-754884.902272674,369.250874756639,-1229054.56820203) (-280160.839263926,22798.3299907993,-987163.452711273) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-552553.970669495,-134623.974211169,4084.08770094679) (-547922.181906577,-134102.552282748,8893.47538645546) (-534784.966048674,-132028.899115453,16322.6097763111) (-503218.962365387,-125780.207175483,30801.8456548294) (-432109.440350668,-109547.628089866,58880.320749373) (-281047.104026315,-71970.7111893743,97540.8180771155) (7.7850292923142e-07,-3.07207074675769e-07,1.35030289100281e-12) (-3.91055712484781e-05,5.9642354322551e-06,-2.06671629252834e-05) (-715353.807026152,531.574932817358,-1207010.87221414) (-282467.831903514,-45845.3011127913,-1010364.14492934) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-541346.989957142,-245477.829405952,4637.70908619022) (-536757.062297222,-245213.000425258,10977.9293114071) (-524167.164036226,-243820.177084626,22595.9001530706) (-494877.004649117,-238453.241355958,47104.1889863869) (-429968.528144741,-220543.267093567,96623.4970218831) (-288814.294068879,-163304.523769065,169746.212540398) (-4.72728112173982e-06,-2.50541514098029e-06,-1.50965520700416e-12) (-5.38496370613267e-05,-8.93492859250219e-06,-2.95875056442592e-05) (-784670.815107416,-715797.701135435,-1253769.21205982) (-281943.442206227,-216960.847749805,-964886.040542428) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-496833.120930509,-393697.677045846,4893.49231267447) (-493148.199522546,-394322.322341023,12416.7941743571) (-483586.323989417,-395474.34679451,28018.3727797443) (-462925.75794458,-396322.264808038,65059.1459061587) (-420726.912108657,-391788.738645602,154015.849754447) (-326955.101610858,-345801.180822005,333269.242684776) (-7.3080098777197e-05,-3.76099410301292e-05,-1.28911020439807e-05) (-577832.22766153,-723211.722347489,-716290.432354535) (-413664.19691765,-490058.6901759,-755352.265211983) (-209239.557600546,-224565.538479377,-748316.369783113) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-397430.388876723,-555839.108579493,4294.70760725617) (-395098.631820801,-557668.888736782,11346.7314344154) (-389656.239990749,-562606.3217763,27213.7626875956) (-380463.076555708,-574980.539071218,69624.8631296427) (-374187.150517218,-610972.485141406,200142.342964853) (-425108.01235888,-739402.543098302,679380.830296207) (-880119.199016253,-1307604.1788757,-723465.320794163) (-431655.590419551,-764266.483367073,-483461.727351833) (-286451.925114512,-493977.363803706,-490194.109219301) (-155126.096384882,-248952.571594697,-524094.896891961) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-227534.68334531,-673826.472373413,2470.83774559757) (-226458.550087449,-676315.009798355,6484.76134634321) (-224086.832791313,-682914.550637502,14903.2740078957) (-220554.226169991,-697955.415397915,33702.5335788027) (-219101.883903345,-731767.495912645,71784.2530278498) (-233809.693927316,-803611.666383133,111215.290595885) (-293389.746198839,-914809.246218538,-180225.908185006) (-215496.549839706,-734579.117724071,-213340.296596579) (-156461.952271896,-521103.083283788,-245388.430615491) (-87487.2958791686,-275490.060920579,-275345.434757055) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-518279.668247461,827.872858869476,1330.77294912664) (-519023.152748269,1547.68715568319,668.614876543971) (-519744.842727277,3634.86710338634,-4726.53636081395) (-518721.665745136,8569.29517926914,-19119.30621399) (-513222.275799839,18934.276090632,-49447.2991127956) (-498923.384358026,37629.7571876994,-106137.015779355) (-468628.170397437,60847.392178822,-197837.90755136) (-409769.922387369,56934.2935949022,-304745.668515881) (-311404.513176669,40058.7239284733,-404675.98606655) (-170492.95959587,19717.8698071125,-468156.680034468) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-519660.089270311,-1498.01902623807,2083.29923382116) (-520198.343758468,-82.325429517392,2787.26144915955) (-520500.002765331,4127.39602092272,213.450950252747) (-518990.347474614,14646.7031375995,-8754.15563481692) (-513534.249546804,39257.0438820538,-30817.3529527444) (-501586.104391516,92981.6971389332,-83003.9996611377) (-478243.410979769,187523.835174126,-201862.952696267) (-420438.126172306,154294.762468295,-321824.052292952) (-319682.784773739,99557.8454224326,-425252.87310502) (-174684.290197984,46014.1766260502,-488092.00664508) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-521656.312227368,-10678.5993391516,3535.74253694201) (-521831.113451508,-8791.94738033693,7026.74930372901) (-521366.684919288,-3057.0490230438,10750.8270016518) (-518980.325777034,12052.2220900385,15884.25411815) (-514104.214136887,52031.73566579,22879.4634967008) (-511507.100677857,168459.939540762,11435.2027465091) (-526941.162016384,587537.677086999,-235282.31257102) (-461015.558916523,339569.218151054,-376866.424979753) (-346853.505346045,189973.54362783,-479150.665477497) (-186976.16330578,78978.6218905015,-534472.531861881) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-522447.842046782,-31013.4805965002,5469.80361209935) (-522198.839137742,-29177.8861799427,12785.1406400583) (-520717.698468787,-23782.9871985744,25893.3487722382) (-516709.118400943,-10608.9146447727,55932.044140727) (-511356.537274891,17962.6767352612,139320.179159876) (-530159.060727985,62839.6742750814,430420.794895697) (-781454.877133247,449.47062716486,-483544.237184611) (-584842.957556547,484393.813249024,-526837.63540539) (-416943.0825973,256720.032547102,-590489.068731382) (-214416.88938537,93034.8599015964,-613816.742279178) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-518816.166308005,-67143.2558220247,7352.67535883461) (-518108.822271662,-65831.8530790057,18220.5514651996) (-515467.43776376,-62062.7281668913,39124.090827662) (-507750.429054559,-53326.6360743524,84583.2771017711) (-485344.716058121,-36019.0452569643,184242.796896382) (-404396.612325736,-10410.171819289,368001.107897303) (-3.81914724689253e-05,1.58556437490144e-05,3.37227140084504e-05) (-773855.362179635,251.707973425503,-754877.550838439) (-538524.429764972,39994.1475576496,-754512.138356687) (-254943.226211585,20530.3733599065,-707225.264867336) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-505148.710791411,-123266.353728782,8717.83802867557) (-504294.999372336,-122787.219710456,22046.0221258845) (-501446.009818666,-121262.870419697,47907.2081486891) (-493305.870171714,-117296.694533941,101964.174414604) (-468893.447871253,-107255.752927167,209984.889605391) (-380495.831334169,-79605.0379547838,378628.483048738) (-3.03464770291374e-05,2.76970825467106e-05,2.33537860583225e-05) (-727968.805115397,276.924934381325,-715381.818733957) (-547771.22254116,-68722.791779063,-774247.46388223) (-262867.755104988,-45277.7512355462,-728039.416085305) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-473061.658273102,-200762.221362759,9210.53594993244) (-472463.646018059,-201434.289274989,23564.1892352985) (-470679.901988281,-203067.308936336,51881.3657039925) (-466033.60484036,-206305.903774826,112047.175136113) (-451825.724128326,-211142.442474093,237791.060666619) (-387828.243468299,-201326.713116362,458526.685227625) (-4.29069113869598e-05,4.04352784671871e-05,3.03575499526899e-05) (-802425.579897981,-577537.556623513,-784680.384373395) (-542259.912668705,-344709.217532177,-751104.861058994) (-251110.160333621,-144206.582178734,-683009.31198842) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-412072.281806142,-294048.64562749,8525.58514036152) (-411960.506669065,-296039.252862467,21942.8558743599) (-412081.565195704,-301288.583493526,48659.3716378288) (-414247.973686058,-313588.558937689,107264.24254217) (-427364.755414606,-345030.069572657,247789.712946691) (-496927.911707675,-443773.475636799,660209.285563956) (-898321.232106407,-879781.738867829,-577771.565409824) (-604099.412221594,-576881.182693014,-552160.754780254) (-396851.906000275,-362752.808094906,-550929.455134888) (-194897.657173029,-170404.051795997,-539073.885945151) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-312290.35055054,-385750.597910248,6561.91395657383) (-312521.29472854,-388827.889239913,16773.213241761) (-313735.000882657,-396846.475729465,36409.8663696118) (-318655.172968334,-414893.526440817,75906.9302853706) (-336772.684211611,-455740.108712062,149202.50311917) (-396034.712804066,-548000.297552683,224356.025480239) (-539796.079602072,-720751.320413231,-274997.512388533) (-397283.250282446,-547992.96541303,-338258.069805634) (-264739.139554731,-363900.15007772,-358823.513382595) (-134192.242354277,-181267.808381428,-368893.610827764) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-170784.317656689,-446020.214830585,3519.25123171619) (-171009.941384731,-449604.722297025,8847.47558611039) (-171930.269055522,-458583.918964727,18428.3550855783) (-175013.106806018,-477176.70216998,35170.4114507702) (-184204.460924513,-512524.693000529,57057.5727604069) (-206648.410362177,-569716.928996535,51612.9206391227) (-238874.315030462,-621321.683855948,-102332.147086547) (-192551.51557022,-518961.52812365,-154308.618645415) (-133736.005948929,-364535.989781677,-176398.725264426) (-69416.4207219224,-187929.603196574,-187807.805606529) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-518309.329312254,-600.69701968798,630.358084477791) (-518741.132371271,315.192488037767,33.1452194423131) (-518827.949462817,2822.50185582684,-3706.24990083548) (-516974.409188821,8256.5790628501,-13710.0855200059) (-510249.579784353,18610.0891995865,-35292.8707350808) (-493228.287240479,35003.298168021,-75991.2660206437) (-456736.046965449,51301.2377759417,-139184.627228576) (-388726.898461732,46368.5948895753,-206596.246043783) (-285940.831238646,31902.2930717432,-263962.221053557) (-152297.714312681,15631.1853225106,-297788.651659256) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-518302.087244339,-3550.53737831644,1591.83833265866) (-519063.868096651,-1762.30959382921,2534.86475270139) (-520061.253926305,3218.13342782675,1700.4843416774) (-520333.748482686,14668.8555650563,-3368.39115245435) (-518094.417877457,38761.3939765686,-18959.527598784) (-508990.25736751,83206.5812065708,-59758.6576613387) (-481522.839663609,139032.857556146,-144210.848757703) (-411006.659461213,113939.077062246,-221212.797641472) (-301175.422396503,72582.575720913,-280400.442667874) (-159747.724152216,33847.0521007555,-313552.875491889) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-517141.047002666,-11502.6244268087,3436.82182378924) (-518556.357720433,-9141.40526149376,7541.1617603785) (-521412.211060114,-2355.59649299433,13160.4178220253) (-526342.188616512,14429.77224786,20761.3639786955) (-534982.194220572,54933.066150837,25467.6718881058) (-548873.690084836,150047.485590809,-4006.64308915545) (-555807.627780118,333314.563846187,-169421.883615459) (-469702.297121472,216001.01208097,-262797.080429239) (-337767.626835649,120111.57313261,-319411.956351331) (-176561.744547907,51676.9211146304,-347656.244123073) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-512570.00060352,-27226.1170164242,5845.65114635483) (-514875.352096683,-24964.8179539422,14345.5767977393) (-520308.256335279,-18382.8393245737,29963.3774958067) (-532170.088911093,-1467.83555495489,61321.9558087784) (-559865.841037824,44194.3875595959,120569.938162953) (-627611.983399056,188888.24857876,179182.097846082) (-764239.706767133,782179.159060759,-286897.667734608) (-592439.788301399,295637.400565483,-358937.225474267) (-403036.273398765,135339.856062997,-388072.317603197) (-203867.383745837,52615.2973223169,-399560.199450416) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-500990.289008186,-53194.4321365855,8142.43782034096) (-504086.792032267,-51770.2892693786,20925.8788963851) (-511990.150115313,-47818.1767725134,46883.9286958819) (-530699.387816336,-38675.5444881138,107040.596390818) (-580035.70547591,-19343.5026975436,265269.476065747) (-736429.181072097,13772.8931219845,772417.400268888) (-1359105.92662293,468.547958889887,-773594.746361147) (-778730.853754669,46357.2773630341,-519439.131583657) (-482441.202631242,30824.6655688366,-471007.168223235) (-233513.487190487,12630.1457409286,-452451.755662952) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-477053.726513256,-90897.2787713947,9607.8623566542) (-480660.092940619,-90706.6639108113,24909.330566367) (-490103.211584055,-90282.513950374,56030.8695096147) (-512576.080488978,-89790.7820193744,126416.317358139) (-570292.12220297,-89954.9021865424,298426.39117885) (-740732.756380221,-86690.6351624096,759126.844509299) (-1331589.16648545,238.810213695148,-727789.302351874) (-800357.23996636,-73966.4444457681,-535077.145692097) (-499529.265332619,-63134.3881197868,-489360.049212024) (-240827.780981665,-33498.2235818237,-465271.654012594) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-434258.451526194,-139510.093120207,9809.60760190685) (-437987.964634908,-140721.549452419,25348.811760366) (-447852.689309146,-144275.732846319,56514.8179771759) (-471283.962791646,-154296.160336195,126270.55424529) (-530804.708815753,-186466.717785243,301761.354531415) (-708772.317517972,-310124.769623385,846139.563042073) (-1385325.42333912,-897560.955570786,-802062.351330622) (-775213.532193124,-378858.117691097,-524382.725790155) (-470696.396572646,-199157.277319804,-459923.352686197) (-224646.364100819,-87948.9535724232,-431936.418928394) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-366146.510380365,-194032.479185433,8596.61463944833) (-369515.472261466,-196385.045413458,21815.0761928856) (-378345.84320039,-202711.3945594,46515.0159106542) (-398420.398387582,-217769.273132281,94160.5534082656) (-443668.963596291,-254207.646047069,178205.689851775) (-545033.45494153,-342597.51243088,258783.975893115) (-732787.319758734,-520857.41029506,-283453.481730276) (-551737.370911287,-369793.921871325,-344879.718860358) (-361469.43000629,-230472.187956489,-348947.284217669) (-178021.604166266,-109626.317052717,-344145.973744128) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-268520.674179871,-244062.303349506,6260.14779340494) (-271064.186975233,-247124.31471693,15542.3093435686) (-277586.150502895,-254830.928535534,31512.9929399408) (-291684.055778917,-271039.540267715,57812.1428859557) (-320136.842860778,-302954.46688684,89923.1223748916) (-370911.180893473,-358388.646973873,80590.7250072911) (-428000.038030738,-419602.617368835,-132460.109490278) (-350765.81612606,-343048.444085838,-205723.021432146) (-239998.55043101,-232683.986279745,-228251.812232605) (-121108.672321421,-116367.97432657,-234593.724991608) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-143070.621586196,-275036.714197058,3260.71477705981) (-144404.711065065,-278396.423837182,7927.59357764435) (-147781.927324446,-286425.562024465,15373.8853355006) (-154785.018347138,-301910.066450983,26016.3230598873) (-167670.658948362,-328100.462247484,34628.5164443775) (-186921.944657768,-362891.47448134,19404.8782474315) (-200787.738118994,-382302.201294079,-55982.1147387922) (-169878.505825622,-326222.831958213,-95480.7366110145) (-119280.081304565,-230577.405715314,-112043.24181981) (-61143.509539221,-118384.202010633,-118299.925318448) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-518018.838726683,-594.34043619472,303.84985062216) (-518459.863478323,1.82977444771403,20.7511832318619) (-518537.602810933,1584.33074991903,-1853.92621857229) (-516688.016627194,4879.96662197516,-7020.2854021729) (-509678.738256459,10791.7745385915,-18382.9014686545) (-491290.611794054,19316.6233706585,-39637.2002857394) (-451651.287085422,26623.9626824608,-71345.9228482314) (-380264.279251771,24199.5370128623,-104008.079071057) (-276192.482056041,16763.822850815,-130520.251104471) (-145555.53648636,8271.95212586365,-145534.38105666) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-517364.482057393,-2473.44397003253,941.498346893399) (-518425.673771179,-1312.03924094306,1617.17303681395) (-520111.26377556,1813.50319048401,1438.0104455028) (-521574.552652801,8673.19433901609,-1114.41310142669) (-520519.689527282,21989.6678620762,-9887.03477508546) (-510698.016418084,43496.5516745631,-32359.204028416) (-478409.063471442,64959.152305214,-73808.1698433335) (-404575.69303244,55466.1788727999,-111505.778132042) (-293013.85588566,36186.5436541562,-139090.065446222) (-153863.046896013,17154.6106260975,-153857.401202656) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-514797.190865131,-6961.80198918379,2144.50188161628) (-517062.800308429,-5431.75883619672,4770.66406486808) (-521936.198565155,-1189.23444882991,8297.38920922443) (-530318.212046333,8733.29270218804,12213.314275877) (-542654.652688831,30249.9608419535,11625.4797642654) (-554386.380733395,71554.6090228589,-10919.8869354688) (-543590.36754193,125168.756513809,-83346.7513822534) (-460241.382677597,93562.9015530318,-130904.388506356) (-329328.43631076,55105.3388742585,-158262.374251351) (-171068.961147573,24517.790554317,-171118.337579904) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-507799.49153488,-15430.4249116415,3698.11385381773) (-511652.352262993,-13974.3532248845,9017.70840881483) (-520832.091511109,-9851.62936058184,18203.9384964) (-539190.452163062,217.735646847346,33739.8588037077) (-573071.40373283,24268.9039603492,52926.4783803161) (-626136.463282081,80345.6291058288,42659.9381803712) (-668990.054554782,187598.011088837,-115018.968607006) (-554055.133184134,109643.270089584,-169483.992260821) (-384631.677874017,56170.3072344168,-188953.556145734) (-195673.241888316,23100.5827141452,-195730.490163082) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-492692.078918062,-28905.867676019,5177.23267425504) (-497992.290475995,-28029.5755254615,13137.9534185596) (-511303.713977643,-25661.1919151267,28261.0798354385) (-539712.470987822,-20312.481914302,57804.3805680708) (-597624.885631425,-9333.15705823042,108995.621742163) (-706742.668214721,9761.67720254894,149893.060788067) (-856858.932885648,28261.2802747068,-193017.20213509) (-664000.425024809,24921.8781550455,-223026.238930392) (-441046.143754124,13844.7369326526,-222095.727505747) (-218923.859205818,5372.49778476214,-218957.270561025) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-464263.972375464,-47772.9779459188,6077.35613210642) (-470410.212752311,-47737.1717766726,15535.0721950112) (-486064.852489576,-47775.5753676878,33611.0965530888) (-519828.32440222,-48235.3312131296,68786.1897651559) (-588717.331869387,-50181.8296636951,128060.072037037) (-716871.477736319,-54401.3018443502,168361.772440032) (-885385.210262382,-53186.489683244,-196394.41382508) (-689122.480671452,-48569.1129713393,-234138.181993598) (-455045.856364323,-34148.1732128947,-230628.680816353) (-224412.223090398,-17258.9135677765,-224412.827355085) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-416995.627952999,-71136.1325206099,6100.33100149273) (-423143.334250034,-72001.8228232572,15520.3516632039) (-438735.222654261,-74528.3552016743,33155.6648423047) (-472028.17980571,-81169.7894854559,66834.3401286959) (-538944.31589212,-99044.0607449125,123836.178286279) (-662871.558420617,-146045.322427329,169579.439771896) (-832518.26405931,-244589.442830859,-191824.766360279) (-640777.086292934,-155046.227047321,-219784.098184491) (-421058.75170323,-89733.3541428353,-213836.56212397) (-207241.702697725,-41255.5159555329,-207244.621139309) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-346228.079792498,-96275.9274820929,5221.36437361647) (-351506.082227113,-97797.9075985092,13008.059114518) (-364577.969372607,-101804.966881416,26516.7969664787) (-391186.489684417,-110849.436488648,48962.5352665061) (-440198.807204452,-130396.479730845,76844.7978606067) (-517132.810532725,-168132.528990033,71031.3600145048) (-588267.746624287,-215714.916196059,-102362.739754742) (-485999.585545704,-168552.266302828,-154594.485864803) (-331468.879495619,-108842.201401245,-165486.189117069) (-166039.796927377,-52647.4677706185,-166076.04454087) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-250060.788559264,-118462.994257621,3727.18115491836) (-253859.647951008,-120327.617504991,9052.35203717797) (-262949.908263017,-124880.899403276,17492.0423191581) (-280506.11552003,-133961.900554537,29426.5661261589) (-310029.131058951,-150234.473843993,39156.8484374795) (-349290.545352864,-174092.869483085,23496.5533899227) (-372863.907518385,-192115.704273336,-55238.789045153) (-317662.703776853,-161922.144902073,-94972.0227951164) (-222690.904389258,-111775.163342541,-109346.706895573) (-113384.208692882,-56296.7316909777,-113421.906603755) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-131671.917961508,-131784.83781309,1923.139930781) (-133608.931293574,-133769.020267592,4568.76292189043) (-138164.884254728,-138369.269453103,8440.08990199828) (-146657.462187072,-146846.647099598,13197.2802869934) (-159960.269163334,-160147.292754759,15399.7094127311) (-175453.526552572,-175689.301799165,5527.72362361464) (-181016.49975619,-181263.032711445,-25096.1863010791) (-155910.353569301,-156092.367759148,-44894.115700325) (-110974.082409774,-111089.49145004,-53885.7864876162) (-57087.6971918041,-57134.7215406727,-57103.6089853379) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) ) ; boundaryField { fuel { type fixedValue; value uniform (0.1 0 0); } air { type fixedValue; value uniform (-0.1 0 0); } outlet { type zeroGradient; } frontAndBack { type empty; } } // ************************************************************************* //
f89274ba03dba7b1758b1a2fd54e6e729da479f1
b1cbac28f8e395c8a14bc329029f41fdec52f9cb
/src/Client/View/StraightTrackView.h
3f6fbeeedcb90c5bd3e33a9334cb58fbe10642b4
[]
no_license
sberoch/MicromachinesTaller
555c6884b11164c01ba4a6b912e31759e2d37fd4
1a21cb3ab262820d10928d50f514e7a74a3bae77
refs/heads/master
2020-08-08T21:59:57.737322
2019-11-26T22:28:36
2019-11-26T22:28:36
213,929,285
0
2
null
null
null
null
UTF-8
C++
false
false
373
h
StraightTrackView.h
#ifndef STRAIGHT_TRACK_VIEW_H #define STRAIGHT_TRACK_VIEW_H #include "ObjectView.h" class StraightTrackView : public ObjectView { private: int angle; public: StraightTrackView(const SdlTexture& tex, const int& angle); virtual void drawAt(int x, int y) override; virtual int getAngle() override; virtual ~StraightTrackView() {} }; #endif // STRAIGHT_TRACK_VIEW_H
c97a48088a8681f785ab00daba3f6f124b14ba20
9ad19567a82730a733f59f26f5e886aaa5d1e2e5
/vkdevice.h
eabf41ded7b6d170d9c03245558539e0354562d7
[ "MIT" ]
permissive
HorstBaerbel/vsvr
8c48474a20f334de571db025f14590b5d1b6db51
ec761b74a91b496561e4654ec23d6c6546eac7c1
refs/heads/master
2021-01-02T18:35:53.664801
2020-04-09T15:15:10
2020-04-09T15:15:10
239,745,870
0
0
null
null
null
null
UTF-8
C++
false
false
2,603
h
vkdevice.h
#pragma once #include "vkincludes.h" #include <vector> namespace vsvr { /// @brief Info about queue families and their indices. class QueueFamilyIndices { public: uint32_t graphicsFamily() const; void setGraphicsFamily(uint32_t index); uint32_t presentFamily() const; void setPresentFamily(uint32_t index); /// @brief Returns true if all families have been set. bool isComplete() const; private: bool m_graphicsFamilySet = false; uint32_t m_graphicsFamily = 0; bool m_presentFamilySet = false; uint32_t m_presentFamily = 0; }; /// @brief Find queue families available for physical device and surface. QueueFamilyIndices findQueueFamilies(vk::PhysicalDevice physicalDevice, vk::SurfaceKHR surface); /// @brief Find index of device memory. uint32_t findMemoryTypeIndex(vk::PhysicalDevice physicalDevice, uint32_t typeFilter, vk::MemoryPropertyFlags properties); /// @brief Pick the first physical device that supports Vulkan and has graphics capabilities. /// @throw Throws if there are no GPUs supporting Vulkan. vk::PhysicalDevice pickPhysicalDevice(vk::Instance instance, vk::SurfaceKHR surface); /// @brief A logical device that supports Vulkan. /// @throw Throws if there are no GPUs supporting Vulkan. vk::Device createLogicalDevice(vk::PhysicalDevice physicalDevice, vk::SurfaceKHR surface); /// @brief Dump information about the Vulkan device to stdout. void dumpDeviceInfo(vk::PhysicalDevice physicalDevice); /// @brief Swap chain information. struct SwapChain { vk::SwapchainKHR chain = nullptr; std::vector<vk::Image> images; std::vector<vk::ImageView> imageViews; vk::SurfaceFormatKHR surfaceFormat; vk::Extent2D extent = {0,0}; std::vector<vk::Framebuffer> framebuffers; }; /// @brief Create a swap chain for device. SwapChain createSwapChain(vk::PhysicalDevice physicalDevice, vk::Device logicalDevice, vk::SurfaceKHR surface, vk::Extent2D extent, vk::Format format = vk::Format::eB8G8R8A8Unorm, vk::ColorSpaceKHR colorSpace = vk::ColorSpaceKHR::eSrgbNonlinear); /// @brief Create frame buffers for a swap chain. SwapChain createSwapChainFramebuffers(vk::Device logicalDevice, vk::RenderPass renderPass, const SwapChain &swapChain); /// @brief Create command pool for queue family. vk::CommandPool createCommandPool(vk::Device logicalDevice, uint32_t familyIndex, vk::CommandPoolCreateFlags flags = vk::CommandPoolCreateFlags()); /// @brief Allocate command buffers in command pool. std::vector<vk::CommandBuffer> allocateCommandBuffers(vk::Device logicalDevice, vk::CommandPool commandPool, uint32_t count); }
d14033fdd2dcb700ecd2863ff0a20a77f99d0c79
eebdddae506037315968731a69d6c578dd26b60b
/src/epoller/epoll_waiter.cpp
464d3ba2191954898cfaf9e0772ad60261742519
[]
no_license
zhuyineng-cn/kernel4gameserver
6d5f0a6eee53aab4e00263e7c9335fa609fc4f47
5864103a9bf5f452ac03d06927e63537ccf721b9
refs/heads/master
2021-01-15T20:38:13.895464
2015-03-17T02:15:59
2015-03-17T02:15:59
32,366,176
1
0
null
2015-03-17T02:21:05
2015-03-17T02:21:03
C++
UTF-8
C++
false
false
1,591
cpp
epoll_waiter.cpp
#include "epoll_waiter.h" #include "epoller.h" void epoll_waiter::Run() { //public cthread epoll_event events[EPOLLER_EVENTS_COUNT]; m_status = THREAD_WORKING; while (true) { memset(&events, 0, sizeof(events)); errno = 0; int retCount = epoll_wait(m_pEpoller->GetEpollDesc(), events, EPOLLER_EVENTS_COUNT, 15); if (retCount == -1 && errno != EINTR) { ECHO("epoll_wait err! %s", strerror(errno)); TASSERT(false, strerror(errno)); m_status = THREAD_STOPED; return; } if (0 == retCount || retCount == -1) { if (m_status == THREAD_STOPPING) { m_status = THREAD_STOPED; return; } continue; } for (s32 i=0; i<retCount; i++) { epoller_data * p = (epoller_data *)events[i].data.ptr; p->flags = events[i].events; switch (p->opt) { case tcore::SO_ACCEPT: { m_pEpoller->AddIO(p); break; } case tcore::SO_CONNECT: { m_pEpoller->AddIO(p); break; } case tcore::SO_TCPIO: { m_pEpoller->AddEvent(p); break; } case tcore::SO_UDPIO: { m_pEpoller->AddEvent(p); break; } } } } }
d24060400dd9a5b467422c2ca9dfb18c10263e86
7211ed2fe123d827ea3572afdc2cf03fffa9aa39
/Fighter/my_item_bullet.h
481b21059f88c0d8871e6d923fc759ad12b5e1f9
[]
no_license
luckymrcai/fighter
02456b088c88f0f1b0661fd05069ec6bcfeda6f3
d09c17573d564310908de7d2294bb6920b789924
refs/heads/master
2022-10-07T01:53:59.979840
2020-06-04T08:45:54
2020-06-04T08:45:54
269,299,715
0
0
null
null
null
null
UTF-8
C++
false
false
331
h
my_item_bullet.h
#ifndef MY_ITEM_BULLET_H #define MY_ITEM_BULLET_H #include <QString> #include <QGraphicsScene> #include "my_item.h" class My_item_bullet : public My_item { public: My_item_bullet(const QString & filename,QGraphicsScene *scene); int strength; signals: public slots: }; #endif // MY_ITEM_BULLET_H
1b8c7af4e1efe37b4100d1f320761c939fe7f164
ec7d4d127fd9c68c88ca5c270114909cde75320f
/Series/s1.cpp
0013c91afa4b9f0407006d1728dd59f028371868
[]
no_license
abrar-hossain/Problem-Solving-Exercise
aa14aca032389c38b32ed1b04216f5ab40ca9c8f
65ada21998850b71be8c6ff9b7e57f7c2e96fee8
refs/heads/main
2023-07-15T01:43:56.141152
2021-08-10T14:32:13
2021-08-10T14:32:13
394,685,011
0
0
null
null
null
null
UTF-8
C++
false
false
483
cpp
s1.cpp
/*This program will print the sum of all natural numbers from 1 to N.*/ #include <bits/stdc++.h> using namespace std; int main() { int i; unsigned long N, sum; /*read value of N*/ printf("Enter a Positive number: "); scanf("%ld", &N); /*set sum by 0*/ sum = 0; /*calculate sum of the series*/ for (i = 1; i <= N; i++) { sum = sum + i; } /*print the sum*/ printf("Sum of the series is: %ld\n", sum); return 0; }
9607c7e7453331de3617665222deca098922830b
2fda25fc0c260d83f82b03a7f984b1427b0fb88a
/src/Voro3D.h
f8d6d5487695b3e970684d3e215eddfca44479d4
[]
no_license
kusatilmisgenclik/StereoPlanes
2cc1cf3a913eda21b4448c66c585c5e7b4006d86
aa17ee589713206b38244d29edf2f30949d640dc
refs/heads/master
2018-07-10T21:10:05.762849
2014-05-15T23:28:50
2014-05-15T23:28:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
748
h
Voro3D.h
// // Voro3D.h // StereoPlanes // // Created by Johan Bichel Lindegaard on 21/01/14. // // #pragma once #include "ofMain.h" #include "ContentScene.h" #include "VoroUtils.h" class Voro3D : public ContentScene { public: void setup(); void update(); void draw(int _surfaceId); void setGui(ofxUICanvas * gui, float width); void guiEvent(ofxUIEventArgs &e); void receiveOsc(ofxOscMessage * m, string rest); vector<ofPoint> cellCentroids; vector<float> cellRadius; vector<ofMesh> cellMeshes; ofLight light; ofLight dirLight; VoroCube * wallCube; VoroCube * floorCube; VoroCube * extraCube; ofImage logo; ofTrueTypeFont font; };
de10848b2643c58fd69667a4be390c714022a140
2fdf3d8d2e221b9bbf4683c502e1e8ba9f32212a
/MusicProcessingProgram/MusicProcessingProgram/save_as_txt.h
acc2295794904566cb44ce129481238f29cae158
[]
no_license
bartekfrac/Music-processing-program
20aa6937a05e242e4713ffeb73da3789754116e7
9ad9b58fdd1fac0dd7599fb8b94c57fc85cd4c31
refs/heads/master
2020-04-01T23:37:28.682630
2018-10-19T09:06:53
2018-10-19T09:06:53
151,293,404
0
0
null
2018-10-02T19:43:46
2018-10-02T17:15:33
null
UTF-8
C++
false
false
307
h
save_as_txt.h
#ifndef SAVE_AS_TXT_H #define SAVE_AS_TXT_H #include <Windows.h> #include <vector> bool getconchar(KEY_EVENT_RECORD& krec); void save_as_txt(); void save_to_file(const std::vector<char> keys, const std::string file_path); void read_from_file(const std::string file_name); void load_from_file(); #endif
7c88fe9c8ef03950497ba9e550922c895df8993d
dd656493066344e70123776c2cc31dd13f31c1d8
/MITK/Modules/Bundles/org.mitk.gui.qt.materialeditor/src/internal/mitkMaterialEditorPluginActivator.cpp
4b302006d9f4d5c139f3ed6b4d45ab75cabd3445
[]
no_license
david-guerrero/MITK
e9832b830cbcdd94030d2969aaed45da841ffc8c
e5fbc9993f7a7032fc936f29bc59ca296b4945ce
refs/heads/master
2020-04-24T19:08:37.405353
2011-11-13T22:25:21
2011-11-13T22:25:21
2,372,730
0
1
null
null
null
null
UTF-8
C++
false
false
485
cpp
mitkMaterialEditorPluginActivator.cpp
#include "mitkMaterialEditorPluginActivator.h" #include "QmitkMITKSurfaceMaterialEditorView.h" #include <QtPlugin> namespace mitk { void MaterialEditorPluginActivator::start(ctkPluginContext* context) { BERRY_REGISTER_EXTENSION_CLASS(QmitkMITKSurfaceMaterialEditorView, context) } void MaterialEditorPluginActivator::stop(ctkPluginContext* context) { Q_UNUSED(context) } } Q_EXPORT_PLUGIN2(org_mitk_gui_qt_materialeditor, mitk::MaterialEditorPluginActivator)
759ca6550ec499737939c346ad37107d3c7902f2
cd23ba924774fabe3be0fde925f9109e10762f1a
/WeekendRayTracer/Hitable.h
ab2ade75b2dce5e6b17164d8ba778cc8e4bb4bd4
[]
no_license
essbuh/weekend-raytracing-book-2
a4910e41b2820ec53258667448374a87afdbeeff
e27009ebf957d80df06094ca3a455de5be990707
refs/heads/master
2016-08-11T07:06:21.425829
2016-04-06T03:48:27
2016-04-06T03:48:27
55,571,748
0
0
null
null
null
null
UTF-8
C++
false
false
279
h
Hitable.h
#pragma once #include "Vector3.h" class Ray; class Material; struct HitRecord { float t; Vector3 point; Vector3 normal; const Material* material; }; class Hitable { public: virtual bool Hit( const Ray& ray, float tMin, float tMax, HitRecord& OutHitRecord ) const = 0; };
a6e2737ba5299a41c0ad19dcd4b5ec6263703894
6f6a88ba519d9569b8bf17a1dd87537c24f28098
/CalPatRec/src/DeltaFinderAlg.cc
a0eb44035e84579b0b64e7e3db10565425f5e308
[ "Apache-2.0" ]
permissive
Mu2e/Offline
728e3d9cd8144702aefbf35e98d2ddd65d113084
d4083c0223d31ca42e87288009aa127b56354855
refs/heads/main
2023-08-31T06:28:23.289967
2023-08-31T02:23:04
2023-08-31T02:23:04
202,804,692
12
73
Apache-2.0
2023-09-14T19:55:58
2019-08-16T22:03:57
C++
UTF-8
C++
false
false
61,678
cc
DeltaFinderAlg.cc
/////////////////////////////////////////////////////////////////////////////// // DeltaFinderAlg uses a face-based (instead of a panel-based) data organization /////////////////////////////////////////////////////////////////////////////// #include "Offline/CalPatRec/inc/DeltaFinderAlg.hh" namespace mu2e { using namespace DeltaFinderTypes; DeltaFinderAlg::DeltaFinderAlg(const fhicl::Table<DeltaFinderAlg::Config>& config, Data_t* Data) : _flagProtonHits (config().flagProtonHits() ), _mergePC (config().mergePC () ), _pickupProtonHits (config().pickupProtonHits() ), _timeBin (config().timeBin() ), _minHitTime (config().minHitTime() ), _maxDeltaEDep (config().maxDeltaEDep() ), _maxSeedEDep (config().maxSeedEDep() ), _minProtonSeedEDep (config().minProtonSeedEDep()), _minProtonHitEDep (config().minProtonHitEDep ()), _minNSeeds (config().minNSeeds() ), _minDeltaNHits (config().minDeltaNHits() ), _maxEleHitEnergy (config().maxEleHitEnergy() ), _minT (config().minimumTime() ), // nsec _maxT (config().maximumTime() ), // nsec _maxHitSeedDt (config().maxHitSeedDt() ), // nsec _maxChi2Seed (config().maxChi2Seed() ), // _scaleTwo (config().scaleTwo() ), _maxChi2Par (config().maxChi2Par() ), _maxChi2Perp (config().maxChi2Perp() ), // _maxChi2All (config().maxChi2All() ), _maxChi2SeedDelta (config().maxChi2SeedDelta() ), _rCore (config().rCore() ), _maxGap (config().maxGap() ), _sigmaR (config().sigmaR() ), _sigmaR2 (_sigmaR*_sigmaR ), _maxDriftTime (config().maxDriftTime() ), _maxSeedDt (config().maxSeedDt() ), _maxHitDt (config().maxHitDt() ), // _maxStrawDt (config().maxStrawDt() ), _maxDtDs (config().maxDtDs() ), _maxDtDc (config().maxDtDc() ), _debugLevel (config().debugLevel() ), _diagLevel (config().diagLevel() ), _printErrors (config().printErrors() ), _testOrder (config().testOrder() ), _testHitMask (config().testHitMask() ), _goodHitMask (config().goodHitMask() ), _bkgHitMask (config().bkgHitMask() ) { _data = Data; printf("DeltaFinderAlg created\n"); } //----------------------------------------------------------------------------- // make sure the two hits used to make a new seed are not a part of an already found seed //----------------------------------------------------------------------------- int DeltaFinderAlg::checkDuplicates(int Station, int Face1, const HitData_t* Hit1, int Face2, const HitData_t* Hit2) { int rc(0); int nseeds = _data->NSeeds(Station); for (int i=0; i<nseeds; i++) { DeltaSeed* seed = _data->deltaSeed(Station,i); if ((seed->HitData(Face1) == Hit1) and (seed->HitData(Face2) == Hit2)) { //----------------------------------------------------------------------------- // 'seed' contains both Hit1 and Hit2 in faces Face1 and Face2 correspondingly, done //----------------------------------------------------------------------------- rc = 1; break; } } return rc; } //----------------------------------------------------------------------------- // input 'Seed' has two hits , non parallel wires // try to add more close hits to it (one hit per face) //----------------------------------------------------------------------------- void DeltaFinderAlg::completeSeed(DeltaSeed* Seed) { //----------------------------------------------------------------------------- // loop over remaining faces, 'f2' - face in question // the time bins are 40 ns wide, only need to loop over hits in 3 of them //----------------------------------------------------------------------------- int first_tbin(0), last_tbin(_maxT/_timeBin), max_bin(_maxT/_timeBin); int station = Seed->Station(); float tseed = Seed->TMean(); int time_bin = (int) (tseed/_timeBin); if (time_bin > 0) first_tbin = time_bin-1; if (time_bin < max_bin) last_tbin = time_bin+1; float xseed = Seed->Xc (); float yseed = Seed->Yc (); float rho = sqrt(xseed*xseed+yseed*yseed); float seed_nx = xseed/rho; float seed_ny = yseed/rho; for (int face=0; face<kNFaces; face++) { if (Seed->fFaceProcessed[face] == 1) continue; //----------------------------------------------------------------------------- // face is different from the two faces defining initial stereo intersection //----------------------------------------------------------------------------- FaceZ_t* fz = &_data->fFaceData[station][face]; int ftbin = first_tbin; int ltbin = last_tbin; while ((ftbin<ltbin) and (fz->fFirst[ftbin] < 0)) ftbin++; while ((ltbin>ftbin) and (fz->fFirst[ltbin] < 0)) ltbin--; int first = fz->fFirst[ftbin]; if (first < 0) continue; int last = fz->fLast [ltbin]; HitData_t* closest_hit(nullptr); float best_chi2 (_maxChi2Seed); for (int ih=first; ih<=last; ih++) { //----------------------------------------------------------------------------- // don't try to re-use hits which already made it into a 3- and 4-hit seeds //----------------------------------------------------------------------------- HitData_t* hd = fz->hitData(ih); if (hd->Used() >= 3) continue; const ComboHit* ch = hd->fHit; int ip = ch->strawId().panel()/2; Pzz_t* pz = fz->Panel(ip); //----------------------------------------------------------------------------- // check seed-panel overlap in phi //----------------------------------------------------------------------------- float ns_dot_np = seed_nx*pz->nx+seed_ny*pz->ny; if (ns_dot_np < 0.5) continue; //----------------------------------------------------------------------------- // 2017-10-05 PM: consider all hits // hit time should be consistent with the already existing times - the difference // between any two measured hit times should not exceed _maxDriftTime // (_maxDriftTime represents the maximal drift time in the straw, should there be some tolerance?) // FIXME need some timing checks here ! //----------------------------------------------------------------------------- float corr_time = hd->fCorrTime; if (corr_time-Seed->T0Max() > _maxHitSeedDt) break; if (Seed->T0Min()-corr_time > _maxHitSeedDt) continue; float xc(xseed), yc(yseed), chi2_par(0), chi2_perp(0), chi2(0); //----------------------------------------------------------------------------- // try updating the seed candidate coordinates with the hit added // to see if that could speed the code up by improving the efficiency // of picking up the right hits // from now on, the default //----------------------------------------------------------------------------- double snx2 = Seed->fSnx2+hd->fNx2; double snxy = Seed->fSnxy+hd->fNxy; double sny2 = Seed->fSny2+hd->fNy2; double snxr = Seed->fSnxr+hd->fNxr; double snyr = Seed->fSnyr+hd->fNyr; double d = snx2*sny2-snxy*snxy; xc = (snyr*snx2-snxr*snxy)/d; yc = (snyr*snxy-snxr*sny2)/d; float dx = hd->fX-xc; float dy = hd->fY-yc; float dxy_dot_w = dx*pz->wx+dy*pz->wy; float dxy_dot_n = dx*pz->nx+dy*pz->ny; float drho = fmax(fabs(dxy_dot_n)-_rCore,0); chi2_par = (dxy_dot_w*dxy_dot_w)/(hd->fSigW2+_sigmaR2); chi2_perp = (drho*drho)/_sigmaR2; chi2 = chi2_par+chi2_perp; //----------------------------------------------------------------------------- // require that the chi^2 to the estimated trajectory center along the wire // is not worse than that for the inital two hits //----------------------------------------------------------------------------- if ((chi2_par < _maxChi2Par) and (chi2_perp < _maxChi2Perp)) { float seed_chi2_par(0), seed_chi2_perp(0); seedChi2(Seed,xc,yc,seed_chi2_par,seed_chi2_perp); chi2_par += seed_chi2_par; chi2_perp += seed_chi2_perp; chi2 = (chi2_par+chi2_perp)/(Seed->nHits()+1); if (chi2 < best_chi2) { // new best hit closest_hit = hd; best_chi2 = chi2; } } } if (closest_hit) { //----------------------------------------------------------------------------- // add hit //----------------------------------------------------------------------------- closest_hit->fChi2Min = best_chi2; Seed->AddHit(closest_hit); } } //----------------------------------------------------------------------------- // update seed time and X and Y coordinates, accurate knowledge of Z is not very relevant // also define the number of hits on a found seed //----------------------------------------------------------------------------- Seed->CalculateCogAndChi2(_rCore,_sigmaR2); for (int face=0; face<kNFaces; face++) { HitData_t* hd = Seed->HitData(face); if (hd) hd->fUsed = Seed->nHits(); } } //----------------------------------------------------------------------------- // find delta electron seeds in 'Station' with hits in faces 'f' and 'f+1' // do not consider proton hits with eDep > _minHtEnergy //----------------------------------------------------------------------------- void DeltaFinderAlg::findSeeds(int Station, int Face) { float sigma_dt_2(64); // 8 ns^2 FaceZ_t* fz1 = _data->faceData(Station,Face); int nh1 = fz1->fHitData.size(); //----------------------------------------------------------------------------- // modulo misalignments, panels in stations 2 and 3 are oriented exactly the same // way as in stations 0 and 1, etc //----------------------------------------------------------------------------- for (int h1=0; h1<nh1; ++h1) { //----------------------------------------------------------------------------- // hit has not been used yet to start a seed, however it could've been used as a second seed //----------------------------------------------------------------------------- HitData_t* hd1 = &fz1->fHitData[h1]; if (hd1->Used() >= 3) continue; float wx1 = hd1->fWx; float wy1 = hd1->fWy; float x1 = hd1->fX; float y1 = hd1->fY; const ComboHit* ch1 = hd1->fHit; int seed_found = 0; //----------------------------------------------------------------------------- // panels 0,2,4 are panels 0,1,2 in the first (#0) face of a plane // panels 1,3,5 are panels 0,1,2 in the second (#1) face //----------------------------------------------------------------------------- int ip1 = ch1->strawId().panel() / 2; Pzz_t* pz1 = fz1->Panel(ip1); //----------------------------------------------------------------------------- // figure out the first and the last timing bins to loop over // loop over 3 bins (out of > 20) - the rest cant contain hits of interest //----------------------------------------------------------------------------- float t1 = ch1->time(); int time_bin = (int) t1/_timeBin; int first_tbin(0), last_tbin(_maxT/_timeBin), max_bin(_maxT/_timeBin); if (time_bin > 0) first_tbin = time_bin-1; if (time_bin < max_bin) last_tbin = time_bin+1; //----------------------------------------------------------------------------- // loop over 'next' faces // timing bins may be empty... //----------------------------------------------------------------------------- for (int f2=Face+1; f2<kNFaces; f2++) { FaceZ_t* fz2 = &_data->fFaceData[Station][f2]; float zc = (fz1->z+fz2->z)/2; int ftbin = first_tbin; int ltbin = last_tbin; while ((ftbin<ltbin) and (fz2->fFirst[ftbin] < 0)) ftbin++; while ((ltbin>ftbin) and (fz2->fFirst[ltbin] < 0)) ltbin--; int first = fz2->fFirst[ftbin]; if (first < 0) continue; int last = fz2->fLast [ltbin]; for (int h2=first; h2<=last; h2++) { HitData_t* hd2 = &fz2->fHitData[h2]; if (hd2->Used() >= 3) continue; const ComboHit* ch2 = hd2->fHit; float t2 = ch2->time(); float dt = t2-t1; if (dt < -_maxDriftTime) continue; if (dt > _maxDriftTime) break; //----------------------------------------------------------------------------- // the following check relies on the TOT... not quite sure yet // however, it also makes sense to require that both pulses have a reasonable width, // so leave it in for the moment //----------------------------------------------------------------------------- float dtcorr = hd1->fCorrTime-hd2->fCorrTime; if (fabs(dtcorr) > _maxDriftTime) continue; //----------------------------------------------------------------------------- // 'ip2' - panel index within its face // check overlap in phi between the panels coresponding to the wires - 120 deg //----------------------------------------------------------------------------- int ip2 = ch2->strawId().panel() / 2; Pzz_t* pz2 = fz2->Panel(ip2); float n1n2 = pz1->nx*pz2->nx+pz1->ny*pz2->ny; if (n1n2 < -0.5) continue; //----------------------------------------------------------------------------- // hits are consistent in time, //----------------------------------------------------------------------------- float x2 = hd2->fX; float y2 = hd2->fY; double wx2 = hd2->fWx; double wy2 = hd2->fWy; double w1w2 = wx1*wx2+wy1*wy2; double q12 = 1-w1w2*w1w2; //----------------------------------------------------------------------------- // hits are ordered in time, so if ct2-ct > _maxDriftTime, can proceed with the next panel //----------------------------------------------------------------------------- // intersect the two straws, we need coordinates of the intersection point and // two distances from hits to the intersection point, 4 numbers in total //----------------------------------------------------------------------------- double r12n1 = (x1-x2)*wx1+(y1-y2)*wy1; double r12n2 = (x1-x2)*wx2+(y1-y2)*wy2; double wd1 = -(r12n2*w1w2-r12n1)/q12; float xc = x1-wx1*wd1; float yc = y1-wy1*wd1; double wd2 = -(r12n2-w1w2*r12n1)/q12; //----------------------------------------------------------------------------- // require both hits to be close enough to the intersection point //----------------------------------------------------------------------------- float chi2_hd1 = wd1*wd1/hd1->fSigW2; float chi2_hd2 = wd2*wd2/hd2->fSigW2; if (chi2_hd1 > _maxChi2Par) continue; if (chi2_hd2 > _maxChi2Par) continue; //----------------------------------------------------------------------------- // this may be used with some scale factor sf < 2 // the following line is a provision for future... //----------------------------------------------------------------------------- float chi2_time = (dtcorr*dtcorr)/sigma_dt_2; float chi2_tot = chi2_time+(chi2_hd1+chi2_hd2)/2; if (chi2_tot > _maxChi2Seed) continue; //----------------------------------------------------------------------------- // check whether there already is a seed containing both hits //----------------------------------------------------------------------------- int is_duplicate = checkDuplicates(Station,Face,hd1,f2,hd2); if (is_duplicate) continue; //----------------------------------------------------------------------------- // new seed : an intersection of two wires coresponsing to close in time combo hits //----------------------------------------------------------------------------- hd1->fChi2Min = chi2_hd1; hd2->fChi2Min = chi2_hd2; // DeltaSeed* seed = _data->NewDeltaSeed(Station,hd1,hd2,xc,yc,zc); DeltaSeed* seed = _data->newDeltaSeed(Station); seed->Init(hd1,hd2,xc,yc,zc); //----------------------------------------------------------------------------- // mark both hits as a part of a seed, so they would not be used individually // - see HitData_t::Used() //----------------------------------------------------------------------------- hd1->fSeed = seed; hd2->fSeed = seed; //----------------------------------------------------------------------------- // complete search for hits of this seed, mark it BAD (or 'not-LEE') if a proton // in principle, could place "high-charge" seeds into a separate list // that should improve the performance // if the seed EDep > _maxSeedEDep (5 keV), can't be a low energy electron (LEE) // if seed EDep > _minProtonSeedEDep (3 keV), could be a proton //----------------------------------------------------------------------------- completeSeed(seed); if (seed->Chi2TotN() > _maxChi2Seed) { //----------------------------------------------------------------------------- // discard found seed //----------------------------------------------------------------------------- seed->fGood = -3000-seed->fIndex; } else { //----------------------------------------------------------------------------- // lists of proton and compton seeds are not mutually exclusive - // some (3 keV < EDep < 5 keV) could be either //----------------------------------------------------------------------------- if (seed->EDep() > _maxSeedEDep) seed->fGood = -2000-seed->fIndex; else _data->AddComptonSeed(seed,Station); if (seed->EDep() > _minProtonSeedEDep) _data->AddProtonSeed (seed,Station); seed_found = seed->nHits(); } //----------------------------------------------------------------------------- // if found seed has hits in 3 or 4 faces, use next first hit //----------------------------------------------------------------------------- if (seed_found >= 3) break; } if (seed_found >= 3) break; } } } //----------------------------------------------------------------------------- // TODO: update the time as more hits are added //----------------------------------------------------------------------------- void DeltaFinderAlg::findSeeds() { for (int s=0; s<kNStations; ++s) { for (int face=0; face<kNFaces-1; face++) { //----------------------------------------------------------------------------- // find seeds starting from 'face' in a given station 's' //----------------------------------------------------------------------------- findSeeds(s,face); } pruneSeeds(s); } } //----------------------------------------------------------------------------- // the process moves upstream //----------------------------------------------------------------------------- void DeltaFinderAlg::linkDeltaSeeds() { for (int is=kNStations-1; is>=0; is--) { //----------------------------------------------------------------------------- // 1. loop over existing compton seeds and match them to existing delta candidates // number of deltas may increase as the execution moves from one station to another // ignore seeds in the proton list //----------------------------------------------------------------------------- int ndelta = _data->nDeltaCandidates(); int nseeds = _data->NComptonSeeds(is); for (int ids=0; ids<nseeds; ids++) { DeltaSeed* seed = _data->ComptonSeed(is,ids); if (! seed->Good() ) continue; if ( seed->Used() ) continue; //----------------------------------------------------------------------------- // first, loop over existing delta candidates and try to associate the seed // with one of them //----------------------------------------------------------------------------- DeltaCandidate* closest(nullptr); float chi2min (_maxChi2SeedDelta); // , chi2_par_min(-1), chi2_perp_min(-1); for (int idc=0; idc<ndelta; idc++) { // this loop creates new deltas // do not loop more than necessary DeltaCandidate* dc = _data->deltaCandidate(idc); //----------------------------------------------------------------------------- // skip candidates already merged with others //----------------------------------------------------------------------------- if (dc->Active() == 0 ) continue; if (dc->Seed(is) != nullptr) continue; int first = dc->FirstStation(); //----------------------------------------------------------------------------- // a delta candidate starting from a seed in a previous station may already have // a seed in this station found, skip such a candidate //----------------------------------------------------------------------------- if (first == is) continue; int gap = first-is; if (gap > _maxGap) continue; float t0 = dc->T0(is); float dt = t0-seed->TMean(); if (fabs(dt) > _maxSeedDt+_maxDtDs*gap) continue; //----------------------------------------------------------------------------- // the time is OK'ish - checks should be implemented more accurately (FIXME) // look at the coordinates //----------------------------------------------------------------------------- // float xc = dc->Xc(); // float yc = dc->Yc(); //----------------------------------------------------------------------------- // change compared to the above: recalculate Xc and Yc using the seed... //----------------------------------------------------------------------------- float snx2 = dc->fSnx2+seed->fSnx2; float snxy = dc->fSnxy+seed->fSnxy; float sny2 = dc->fSny2+seed->fSny2; float snxr = dc->fSnxr+seed->fSnxr; float snyr = dc->fSnyr+seed->fSnyr; float d = snx2*sny2-snxy*snxy; float xc = (snyr*snx2-snxr*snxy)/d; float yc = (snyr*snxy-snxr*sny2)/d; float chi2_par, chi2_perp; seedChi2(seed,xc,yc,chi2_par,chi2_perp); float chi2 = (chi2_par+chi2_perp)/seed->nHits(); if (chi2 < chi2min) { //----------------------------------------------------------------------------- // everything matches, new closest delta candidate //----------------------------------------------------------------------------- closest = dc; chi2min = chi2; } } //----------------------------------------------------------------------------- // if a DeltaSeed has been "attached" to a DeltaCandidate, this is it. //----------------------------------------------------------------------------- if (closest) { closest->AddSeed(seed); seed->SetDeltaIndex(closest->Index()); // for (int face=0; face<kNFaces; face++) { // HitData_t* hd = seed->HitData(face); // if (hd) hd->fDeltaIndex = closest->Index(); // } continue; } //----------------------------------------------------------------------------- // DeltaSeed has not been linked to any existing delta candidate, create // a new delta candidate and see if it is good enough //----------------------------------------------------------------------------- int nd = _data->nDeltaCandidates(); DeltaCandidate delta(nd,seed); //----------------------------------------------------------------------------- // first, try to extend it backwards, in a compact way, to pick missing // seeds or hits //----------------------------------------------------------------------------- for (int is2=is+1; is2<kNStations; is2++) { recoverStation(&delta,delta.fLastStation,is2,1,1); //----------------------------------------------------------------------------- // continue only if found something, allow one empty station //----------------------------------------------------------------------------- if (is2-delta.fLastStation >= 2) break; } //----------------------------------------------------------------------------- // next, try to extend it upstream, by one step, use of seeds is allowed // otherwise, if this seed was the only stereo seed of a delta, may never know // about that. First try to pick up a seed, then - a single hit //----------------------------------------------------------------------------- if (is > 0) { recoverStation(&delta,is,is-1,1,1); } //----------------------------------------------------------------------------- // store only delta candidates with hits in 2 stations or more - as the station // lever arm is about 8 cm, a normal track segment may look like a delta // so _minNSeeds=2 // 'addDeltaCandidate' uses a deep copy //----------------------------------------------------------------------------- if (delta.fNSeeds >= _minNSeeds) { _data->addDeltaCandidate(&delta); } else { //----------------------------------------------------------------------------- // mark all seeds as unassigned, this should be happening only in 1-seed case //----------------------------------------------------------------------------- for (int is=delta.fFirstStation; is<=delta.fLastStation; is++) { DeltaSeed* ds = delta.Seed(is); if (ds) ds->SetDeltaIndex(-1); } } } //----------------------------------------------------------------------------- // all seeds in a given station processed // loop over existing delta candidates which do not have seeds in a given station // and see if can pick up single hits // do not extrapolate forward by more than two (?) empty stations - leave it // as a constant for the moment // 'ndelta' doesn't count deltas starting in this station, but there is no need // to loop over them either //----------------------------------------------------------------------------- for (int idc=0; idc<ndelta; idc++) { DeltaCandidate* dc = _data->deltaCandidate(idc); int first = dc->FirstStation(); if (first == is ) continue; if (first-is > 3) continue; //----------------------------------------------------------------------------- // if a delta candidate has been created in this function, time limits // may not be defined. Make sure they are //----------------------------------------------------------------------------- recoverStation(dc,first,is,1,0); } } //----------------------------------------------------------------------------- // at this point we have a set of delta candidates, which might need to be merged //----------------------------------------------------------------------------- mergeDeltaCandidates(); } //----------------------------------------------------------------------------- // merge Delta Candidates : check for duplicates ! //----------------------------------------------------------------------------- int DeltaFinderAlg::mergeDeltaCandidates() { int rc(0); float max_d2(20*20); // mm^2, to be adjusted FIXME int ndelta = _data->nDeltaCandidates(); for (int i1=0; i1<ndelta-1; i1++) { DeltaCandidate* dc1 = _data->deltaCandidate(i1); if (dc1->Active() == 0) continue; float x1 = dc1->Xc(); float y1 = dc1->Xc(); for (int i2=i1+1; i2<ndelta; i2++) { DeltaCandidate* dc2 = _data->deltaCandidate(i2); if (dc2->Active() == 0) continue; float x2 = dc2->Xc(); float y2 = dc2->Yc(); float d2 = (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); if (d2 > max_d2) continue; //----------------------------------------------------------------------------- // too lazy to extrapolate the time to the same Z... ** FIXME //----------------------------------------------------------------------------- float t1 = dc1->T0(dc1->LastStation()); float t2 = dc2->T0(dc2->FirstStation()); //----------------------------------------------------------------------------- // time check could be done more intelligently - compare time at the same Z //----------------------------------------------------------------------------- if (fabs(t1-t2) > _maxDtDc) continue; int dds = dc2->FirstStation()-dc1->LastStation(); if (dds < 0) { if (_printErrors) { printf("ERROR in DeltaFinderAlg::%s:",__func__); printf("i1, i2, dc1->LastStation, dc2->FirstStation: %2i %2i %2i %2i \n", i1,i2,dc1->LastStation(),dc2->FirstStation()); } continue; } else if (dds > _maxGap) continue; //----------------------------------------------------------------------------- // merge two delta candidates, not too far from each other in Z, // leave dc1 active, mark dc2 as not active //----------------------------------------------------------------------------- dc1->MergeDeltaCandidate(dc2,_printErrors); dc2->SetIndex(-1000-dc1->Index()); } } return rc; } //------------------------------------------------------------------------------ // I'd love to use the hit flags, however that is confusing: // - hits with very large deltaT get placed to the middle of the wire and not flagged, // - however, some hits within the fiducial get flagged with the ::radsel flag... // use only "good" hits //----------------------------------------------------------------------------- int DeltaFinderAlg::orderHits() { ChannelID cx, co; //----------------------------------------------------------------------------- // vector of pointers to CH, ordered in time. Initial list is not touched //----------------------------------------------------------------------------- _data->_v.resize(_data->_nComboHits); for (int i=0; i<_data->_nComboHits; i++) { _data->_v[i] = &(*_data->chcol)[i]; } std::sort(_data->_v.begin(), _data->_v.end(), [](const ComboHit*& a, const ComboHit*& b) { return a->time() < b->time(); }); //----------------------------------------------------------------------------- // at this point hits in '_v' are already ordered in time //----------------------------------------------------------------------------- for (int ih=0; ih<_data->_nComboHits; ih++) { const ComboHit* ch = _data->_v[ih]; const StrawHitFlag* flag = &ch->flag(); if (_testHitMask && (! flag->hasAllProperties(_goodHitMask) || flag->hasAnyProperty(_bkgHitMask)) ) continue; // float corr_time = ch->correctedTime(); cx.Station = ch->strawId().station(); cx.Plane = ch->strawId().plane() % 2; cx.Face = -1; cx.Panel = ch->strawId().panel(); //----------------------------------------------------------------------------- // get Z-ordered location //----------------------------------------------------------------------------- Data_t::orderID(&cx, &co); int os = co.Station; int of = co.Face; int op = co.Panel; if (_printErrors) { if ((os < 0) || (os >= kNStations )) printf(" >>> ERROR: wrong station number: %i\n",os); if ((of < 0) || (of >= kNFaces )) printf(" >>> ERROR: wrong face number: %i\n",of); if ((op < 0) || (op >= kNPanelsPerFace)) printf(" >>> ERROR: wrong panel number: %i\n",op); } //----------------------------------------------------------------------------- // prototype face-based hit storage // hits are already time-ordered - that makes it easy to define fFirst // for each face, define multiple time bins and indices of the first and the last // hits in each bin //----------------------------------------------------------------------------- FaceZ_t* fz = &_data->fFaceData[os][of]; int loc = fz->fHitData.size(); fz->fHitData.push_back(HitData_t(ch,of)); int time_bin = int (ch->time()/_timeBin) ; if (fz->fFirst[time_bin] < 0) fz->fFirst[time_bin] = loc; fz->fLast[time_bin] = loc; } return 0; } //----------------------------------------------------------------------------- // some of found seeds could be duplicates or ghosts // in case two DeltaSeeds share the first seed hit, leave only the best one // the seeds we're loooping over have been reconstructed within the same station // also reject seeds with Chi2Tot > _maxChi2Tot=10 //----------------------------------------------------------------------------- void DeltaFinderAlg::pruneSeeds(int Station) { int nseeds = _data->NSeeds(Station); for (int i1=0; i1<nseeds-1; i1++) { DeltaSeed* ds1 = _data->deltaSeed(Station,i1); if (ds1->fGood < 0) continue; float chi2_ds1 = ds1->Chi2TotN()+ds1->Chi2Time(); if (chi2_ds1 > _maxChi2Seed) { ds1->fGood = -1000-i1; continue; } float tmean1 = ds1->TMean(); for (int i2=i1+1; i2<nseeds; i2++) { DeltaSeed* ds2 = _data->deltaSeed(Station,i2); if (ds2->fGood < 0) continue; float chi2_ds2 = ds1->Chi2TotN()+ds1->Chi2Time(); if (chi2_ds2 > _maxChi2Seed) { ds2->fGood = -1000-i2; continue; } float tmean2 = ds2->TMean(); if (fabs(tmean1-tmean2) > _maxSeedDt) continue; //----------------------------------------------------------------------------- // the two segments are close in time , both have acceptable chi2's // *FIXME* didn't check distance !!!!! // so far, allow duplicates during the search // the two DeltaSeeds share could have significantly overlapping hit content //----------------------------------------------------------------------------- int noverlap = 0; int nfaces_with_overlap = 0; for (int face=0; face<kNFaces; face++) { const HitData_t* hh1 = ds1->HitData(face); const HitData_t* hh2 = ds2->HitData(face); if (hh1 and (hh1 == hh2)) { noverlap += 1; nfaces_with_overlap += 1; } } if (nfaces_with_overlap > 1) { //----------------------------------------------------------------------------- // overlap significant, leave in only one DeltaSeed - which one? //----------------------------------------------------------------------------- if (ds1->fNHits > ds2->fNHits) { ds2->fGood = -1000-i1; } else if (ds2->fNHits > ds1->fNHits) { ds1->fGood = -1000-i2; break; } else { //----------------------------------------------------------------------------- //both seeds have the same number of hits - compare chi2's //----------------------------------------------------------------------------- if (ds1->Chi2TotN() < ds2->Chi2TotN()) { ds2->fGood = -1000-i1; } else { ds1->fGood = -1000-i2; break; } } } else if (nfaces_with_overlap > 0) { //----------------------------------------------------------------------------- // only one overlapping hit // special treatment of 2-hit seeds to reduce the number of ghosts //----------------------------------------------------------------------------- if (ds1->fNHits == 2) { if (ds2->fNHits > 2) { ds1->fGood = -1000-i2; break; } else { //----------------------------------------------------------------------------- // the second seed also has 2 faces with hits //----------------------------------------------------------------------------- if (ds1->Chi2TotN() < ds2->Chi2TotN()) ds2->fGood = -1000-i1; else { ds1->fGood = -1000-i2; break; } } } else { //----------------------------------------------------------------------------- // the first seed has N>2 hits //----------------------------------------------------------------------------- if (ds2->fNHits == 2) { //----------------------------------------------------------------------------- // the 2nd seed has only 2 hits and there is an overlap //----------------------------------------------------------------------------- ds2->fGood = -1000-i1; } else { //----------------------------------------------------------------------------- // the second seed also has N>2 faces with hits, but there is only one overlap // leave both seeds in //----------------------------------------------------------------------------- } } } } } } //------------------------------------------------------------------------------ // start from looking at the "holes" in the seed pattern // delta candidates in the list are already required to have at least 2 segments // extend them outwards by one station //----------------------------------------------------------------------------- int DeltaFinderAlg::recoverMissingHits() { int ndelta = _data->nDeltaCandidates(); for (int idelta=0; idelta<ndelta; idelta++) { DeltaCandidate* dc = _data->deltaCandidate(idelta); //----------------------------------------------------------------------------- // don't extend candidates made out of one segment - but there is no such // start from the first station to define limits //----------------------------------------------------------------------------- int s1 = dc->fFirstStation; int s2 = dc->fLastStation-1; int last(-1); //----------------------------------------------------------------------------- // first check inside "holes" //----------------------------------------------------------------------------- for (int i=s1; i<=s2; i++) { if (dc->Seed(i) != nullptr) { last = i; continue; } //----------------------------------------------------------------------------- // define expected T0 limits //----------------------------------------------------------------------------- recoverStation(dc,last,i,1,0); } last = dc->fFirstStation; for (int i=last-1; i>=0; i--) { //----------------------------------------------------------------------------- // skip empty stations //----------------------------------------------------------------------------- if (dc->fFirstStation -i > _maxGap) break; recoverStation(dc,dc->fFirstStation,i,1,0); } last = dc->fLastStation; for (int i=last+1; i<kNStations; i++) { //----------------------------------------------------------------------------- // skip empty stations //----------------------------------------------------------------------------- if (i-dc->fLastStation > _maxGap) break; recoverStation(dc,dc->fLastStation,i,1,0); } } return 0; } //----------------------------------------------------------------------------- // return 1 if a seed has been found , 0 otherwise //----------------------------------------------------------------------------- int DeltaFinderAlg::recoverSeed(DeltaCandidate* Delta, int LastStation, int Station) { // int rc(0); // predicted time range for this station float tdelta = Delta->T0(Station); float xc = Delta->Xc(); float yc = Delta->Yc(); float chi2min(_maxChi2SeedDelta) ; // , chi2_par_min(-1), chi2_perp_min(-1); DeltaSeed* closest_seed(nullptr); float dt = _maxSeedDt + _maxDtDs*fabs(Station-LastStation); int nseeds = _data->NComptonSeeds(Station); for (int i=0; i<nseeds; i++) { DeltaSeed* seed = _data->ComptonSeed(Station,i); if (seed->Good() == 0) continue; if (seed->Used() ) continue; //----------------------------------------------------------------------------- // one might need some safety here, but not the _maxDriftTime //----------------------------------------------------------------------------- if (fabs(tdelta-seed->TMean()) > dt) continue; float chi2_par, chi2_perp; seedChi2(seed,xc,yc,chi2_par,chi2_perp); float chi2 = (chi2_par+chi2_perp)/seed->nHits(); if (chi2 < chi2min) { // new best seed closest_seed = seed; chi2min = chi2; } } if (closest_seed) { //----------------------------------------------------------------------------- // the closest seed found, add it to the delta candidate and exit // the seed is marked as associated with the delta candidate in DeltaCandidate::AddSeed // however the hits still need to be marked //----------------------------------------------------------------------------- Delta->AddSeed(closest_seed); closest_seed->SetDeltaIndex(Delta->Index()); //----------------------------------------------------------------------------- // for the moment, keep this part commented out - uncommenting lowers the false // positive rate by another 20\% but also reduces the efficiency of compton hit // flagging by a couple of percent. // for now, leave it as is, however the impact of uncommenting on the overall // tracking performance it is worth investigating // track reco efficiency vs timing... //----------------------------------------------------------------------------- // for (int face=0; face<kNFaces; face++) { // HitData_t* hd = closest_seed->HitData(face); // if (hd) hd->fDeltaIndex = Delta->Index(); // } } return (closest_seed != nullptr); } //------------------------------------------------------------------------------ // try to recover hits of a 'Delta' candidate in a given 'Station' // 'Delta' doesn't have hits in this station, check all hits here // when predicting the time, use the same value of Z for both layers of a given face // return 1 if something has been found //----------------------------------------------------------------------------- int DeltaFinderAlg::recoverStation(DeltaCandidate* Delta, int LastStation, int Station, int UseUsedHits, int RecoverSeeds) { // predicted time range for this station float tdelta = Delta->T0(Station); // float xdelta = Delta->Xc(); // float ydelta = Delta->Yc(); float delta_nx = Delta->Nx(); float delta_ny = Delta->Ny(); int first_tbin(0), last_tbin(_maxT/_timeBin), max_bin(_maxT/_timeBin); int time_bin = (int) (tdelta/_timeBin); if (time_bin > 0) first_tbin = time_bin-1; if (time_bin < max_bin) last_tbin = time_bin+1; //----------------------------------------------------------------------------- // first, loop over the existing seeds - need for the forward step //----------------------------------------------------------------------------- if (RecoverSeeds) { int closest_seed_found = recoverSeed(Delta,LastStation,Station); if (closest_seed_found == 1) return 1; } //----------------------------------------------------------------------------- // no seeds found, look for single hits in the 'Station' //----------------------------------------------------------------------------- DeltaSeed* new_seed (nullptr); float max_hit_dt = _maxHitDt+_maxDtDs*fabs(Station-LastStation); for (int face=0; face<kNFaces; face++) { FaceZ_t* fz = &_data->fFaceData[Station][face]; int ftbin = first_tbin; int ltbin = last_tbin; while ((ftbin<ltbin) and (fz->fFirst[ftbin] < 0)) ftbin++; while ((ltbin>ftbin) and (fz->fFirst[ltbin] < 0)) ltbin--; int first = fz->fFirst[ftbin]; if (first < 0) continue; int last = fz->fLast [ltbin]; //----------------------------------------------------------------------------- // loop over hits in this face //----------------------------------------------------------------------------- for (int h=first; h<=last; h++) { HitData_t* hd = &fz->fHitData[h]; //----------------------------------------------------------------------------- // do not use hits already assigned to another DeltaCandidate //----------------------------------------------------------------------------- if (hd->DeltaIndex() > 0) continue; //----------------------------------------------------------------------------- // if the hit belongs to a seed with 3+ hits, it should've been picked up // together with the seed. Do not allow picking it up as a single hit // (hd->Used is the number of hits of the corresponding seed) //----------------------------------------------------------------------------- if (hd->Used() >= 3) continue; if ((UseUsedHits == 0) and hd->Used()) continue; //----------------------------------------------------------------------------- // don't skip hits already included into seeds - a two-hit stereo seed // could be random //----------------------------------------------------------------------------- float corr_time = hd->fCorrTime; //----------------------------------------------------------------------------- // can gain a little bit by checking the time, leave the check in // predicted time is the particle time, the drift time should be larger //----------------------------------------------------------------------------- if (corr_time < tdelta-max_hit_dt) continue; if (corr_time > tdelta+max_hit_dt) break; const ComboHit* ch = hd->fHit; int ip = ch->strawId().panel()/2; Pzz_t* pz = fz->Panel(ip); float n1n2 = pz->nx*delta_nx+pz->ny*delta_ny; //----------------------------------------------------------------------------- // figure out the panel : 0.5 corresponds to delta(phi) = +/- 60 deg //----------------------------------------------------------------------------- if (n1n2 < 0.5) continue; //----------------------------------------------------------------------------- // the hit is consistent with the Delta in phi and time, check more accurately // recalculate XC of the (delta+hit) //----------------------------------------------------------------------------- double snx2 = Delta->fSnx2+hd->fNx2; double snxy = Delta->fSnxy+hd->fNxy; double sny2 = Delta->fSny2+hd->fNy2; double snxr = Delta->fSnxr+hd->fNxr; double snyr = Delta->fSnyr+hd->fNyr; double d = snx2*sny2-snxy*snxy; float xc = (snyr*snx2-snxr*snxy)/d; float yc = (snyr*snxy-snxr*sny2)/d; float dx = hd->fX-xc; float dy = hd->fY-yc; float dxy_dot_w = dx*hd->fWx+dy*hd->fWy; // distance along the wire float dxy_dot_n = dx*hd->fWy-dy*hd->fWx; // distance perp to the wire float drho = fmax(fabs(dxy_dot_n)-_rCore,0); float chi2_par = (dxy_dot_w*dxy_dot_w)/(hd->fSigW2+_sigmaR2); float chi2_perp = (drho*drho)/_sigmaR2; float chi2_hit = chi2_par + chi2_perp; if (chi2_par >= _maxChi2Par ) continue; if (chi2_perp >= _maxChi2Perp) continue; //----------------------------------------------------------------------------- // after that, check the total chi2 and cut on chi2_par //----------------------------------------------------------------------------- float seed_chi2_par(0), seed_chi2_perp(0); deltaChi2(Delta,xc,yc,seed_chi2_par,seed_chi2_perp); chi2_par = (chi2_par + seed_chi2_par)/(Delta->nHits()+1); chi2_perp = (chi2_perp+seed_chi2_perp)/(Delta->nHits()+1); float dtcorr = corr_time-tdelta; float chi2_time = (dtcorr*dtcorr)/(10*10); if (chi2_par >= _maxChi2Par ) continue; if (chi2_perp >= _maxChi2Perp) continue; float chi2 = chi2_par+chi2_perp+chi2_time; if (chi2 >= _maxChi2Seed) continue; //----------------------------------------------------------------------------- // the hit may be added, check if it is already a part of a seed (or a delta?) // **FIXME** - later - what to do if used in a delta.. //----------------------------------------------------------------------------- if (hd->Used()) { //----------------------------------------------------------------------------- // hit is a part of a seed. // if the seed has 2 or less hits, don't check the chi2 - that could be a random overlap // if the seed has 3 or more hits, check the chi2 //----------------------------------------------------------------------------- int nh = hd->fSeed->nHits(); if ((nh >= 3) and (chi2_hit > hd->fChi2Min)) continue; } //----------------------------------------------------------------------------- // new hit needs to be added, create a special 1-hit seed for that // in most cases, expect this seed not to have the second hit, but it may // such a seed has its own CofM undefined // ** FIXME ..in principle, at this point may want to check if the hit was used... //----------------------------------------------------------------------------- if (new_seed == nullptr) { hd->fChi2Min = chi2; new_seed = _data->newDeltaSeed(Station); new_seed->Init(hd,nullptr,0,0,0); } else { if (face == new_seed->SFace(0)) { //----------------------------------------------------------------------------- // another close hit in the same panel, choose the best //----------------------------------------------------------------------------- if (chi2 >= new_seed->HitData(face)->fChi2Min) continue; //----------------------------------------------------------------------------- // new best hit in the same face //----------------------------------------------------------------------------- hd->fChi2Min = chi2; new_seed->ReplaceFirstHit(hd); } else { //----------------------------------------------------------------------------- // more than one hit added in the hit pickup mode. // One question here is whether a seed constructed out of those two hits has been found // and if it was, why it has not been added to the 'Delta' as a segment... **TODO** //----------------------------------------------------------------------------- if (_printErrors) { printf("ERROR in DeltaFinderAlg::recoverStation: "); printf("station=%2i - shouldn\'t be getting here, printout of new_seed and hd follows\n",Station); printf("chi2_par, chi2_perp, chi2: %8.2f %8.2f %8.2f\n",chi2_par, chi2_perp, chi2); printf("DELTA:\n"); _data->printDeltaCandidate(Delta,""); printf("SEED:\n"); _data->printDeltaSeed(new_seed,""); printf("HIT:\n"); _data->printHitData (hd ,""); } new_seed->AddHit(hd); } if (corr_time < new_seed->fMinHitTime) new_seed->fMinHitTime = corr_time; if (corr_time > new_seed->fMaxHitTime) new_seed->fMaxHitTime = corr_time; } } if (new_seed) new_seed->fFaceProcessed[face] = 1; } //----------------------------------------------------------------------------- // station is processed, see if anything has been found // some parameters of seeds found in a recovery mode are not defined because // there was no pre-seeding, for example //----------------------------------------------------------------------------- int rc(0); if (new_seed) { int face0 = new_seed->SFace(0); new_seed->HitData(face0)->fSeed = new_seed; Delta->AddSeed(new_seed); new_seed->SetDeltaIndex(Delta->Index()); // for (int face=0; face<kNFaces; face++) { // HitData_t* hd = new_seed->HitData(face); // if (hd) hd->fDeltaIndex = Delta->Index(); // } rc = 1; } // return 1 if hits were added return rc; } //----------------------------------------------------------------------------- void DeltaFinderAlg::run() { orderHits(); //----------------------------------------------------------------------------- // loop over all stations and find delta seeds - 2-3-4 combo hit stubs // a seed is always a stereo object //----------------------------------------------------------------------------- findSeeds(); //----------------------------------------------------------------------------- // link found seeds and create delta candidates // at this stage, extend seeds to pick up single its in neighbor stations // for single hits do not allo gaps //----------------------------------------------------------------------------- linkDeltaSeeds(); //----------------------------------------------------------------------------- // for existing delta candidates, pick up single gap-separated single hits // no new candidates is created at this step //----------------------------------------------------------------------------- recoverMissingHits(); //----------------------------------------------------------------------------- // after recovery of missing hits, it is possible that some of delta candidates // may need to be merged - try again //----------------------------------------------------------------------------- mergeDeltaCandidates(); //----------------------------------------------------------------------------- // mark deltas //----------------------------------------------------------------------------- int ndeltas = _data->nDeltaCandidates(); for (int i=0; i<ndeltas; i++) { DeltaCandidate* dc = _data->deltaCandidate(i); //----------------------------------------------------------------------------- // skip merged in delta candidates // also require a delta candidate to have at least 5 hits // do not consider proton stub candidates (those with <EDep> > 0.004) // mark all hits of good delta candidates as 'used' not to use them // in the proton candidate search //----------------------------------------------------------------------------- if (dc->Active() == 0) continue; if (dc->nHits () < _minDeltaNHits) dc->fMask |= DeltaCandidate::kNHitsBit; if (dc->EDep () > _maxDeltaEDep ) dc->fMask |= DeltaCandidate::kEDepBit; if (dc->fMask == 0) dc->markHitsAsUsed(); } //----------------------------------------------------------------------------- // mark segments (mostly, 2-hitters), all hits of which have been independently // included into deltas //----------------------------------------------------------------------------- for (int is=0; is<kNStations; is++) { int nseeds = _data->NSeeds(is); for (int i=0; i<nseeds; i++) { DeltaSeed* seed = _data->deltaSeed(is,i); if (seed->deltaIndex() >= 0) continue; //----------------------------------------------------------------------------- // 'seed' has not been associated with delta as a whole, look at its hits //----------------------------------------------------------------------------- int delta_id(-1); for (int face=0; face<kNFaces; face++) { HitData_t* hd = seed->HitData(face); if (hd == nullptr) continue; if (hd->DeltaIndex() < 0) break; if (delta_id < 0) { delta_id = hd->DeltaIndex(); } else if (delta_id != hd->DeltaIndex()) { delta_id = -1; break; } } if (delta_id >= 0) { //----------------------------------------------------------------------------- // a seed has not been included as a part of a delta, however all its hits // individually have been picked up be the same delta candidate //----------------------------------------------------------------------------- seed->fDeltaIndex = 10000+delta_id; } } } //----------------------------------------------------------------------------- // last step: find protons (time clusters of high-ionization hits //----------------------------------------------------------------------------- if (_flagProtonHits != 0) findProtons(); } //----------------------------------------------------------------------------- void DeltaFinderAlg::seedChi2(DeltaSeed* Seed, float Xc, float Yc, float& Chi2Par, float& Chi2Perp) { Chi2Par = 0; Chi2Perp = 0; for (int face=0; face<kNFaces; face++) { const HitData_t* hd = Seed->HitData(face); if (hd) { //----------------------------------------------------------------------------- // split chi^2 into parallel and perpendicular to the wire components //----------------------------------------------------------------------------- float chi2_par, chi2_perp; hitChi2(hd,Xc,Yc,chi2_par,chi2_perp); // float dx = hd->fX-Xc; // float dy = hd->fY-Yc; // float dxy_dot_w = dx*hd->fWx+dy*hd->fWy; // float dxy_dot_n = dx*hd->fWy-dy*hd->fWx; // float chi2_par = (dxy_dot_w*dxy_dot_w)/(_sigmaR2+hd->fSigW2); // float drr = fmax(fabs(dxy_dot_n)-_rCore,0); // float chi2_perp = (drr*drr)/_sigmaR2; Chi2Par += chi2_par; Chi2Perp += chi2_perp; } } } //----------------------------------------------------------------------------- void DeltaFinderAlg::deltaChi2(DeltaCandidate* Delta, float Xc, float Yc, float& Chi2Par, float& Chi2Perp) { Chi2Par = 0; Chi2Perp = 0; for (int is=Delta->fFirstStation; is<=Delta->fLastStation; is++) { DeltaSeed* seed = Delta->Seed(is); if (seed == nullptr) continue; for (int face=0; face<kNFaces; face++) { const HitData_t* hd = seed->HitData(face); if (hd) { //----------------------------------------------------------------------------- // split chi^2 into parallel and perpendicular to the wire components //----------------------------------------------------------------------------- float chi2_par, chi2_perp; hitChi2(hd,Xc,Yc,chi2_par,chi2_perp); // float dx = hd->fX-Xc; // float dy = hd->fY-Yc; // float dxy_dot_w = dx*hd->fWx+dy*hd->fWy; // float dxy_dot_n = dx*hd->fWy-dy*hd->fWx; // float chi2_par = (dxy_dot_w*dxy_dot_w)/(_sigmaR2+hd->fSigW2); // float drr = fmax(fabs(dxy_dot_n)-_rCore,0); // float chi2_perp = (drr*drr)/_sigmaR2; Chi2Par += chi2_par; Chi2Perp += chi2_perp; } } } } }
55723dbc9f3c7e147eebb069cbf75a2c01b6fee4
bb648527969ec9a569d0624ce2aa61bac6424800
/LinkedListTests.cpp
1135ce06a7f65e59942483a7f432957135cc4c0e
[ "Unlicense" ]
permissive
BenSokol/EECS448-Lab6
cb1d21dd049bb1e9197b0452bc082b4c8814ebf3
ca93d41e0dd05a4d8983457a25d4122c3c99b6f8
refs/heads/master
2021-09-23T02:01:23.086798
2017-11-07T18:32:01
2017-11-07T18:32:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,179
cpp
LinkedListTests.cpp
/* * @Filename: LinkedListTests.cpp * @Author: Ben Sokol <Ben> * @Email: bensokol@ku.edu * @Created: October 28th, 2017 [2:21pm] * @Modified: November 1st, 2017 [11:35am] * * Copyright (C) 2017 by Ben Sokol. All Rights Reserved. */ #include "LinkedListTests.hpp" LinkedListTests::LinkedListTests() { std::cout << "\n\033[36mWelcome to LinkedList Tester!\033[39;49;00m\n\n"; testSize = 10; initalizeTests(); } LinkedListTests::LinkedListTests(int value) { std::cout << "\n\033[36mWelcome to LinkedList Tester!\033[39;49;00m\n\n"; testSize = (value > 0 ? value : 10); initalizeTests(); } void LinkedListTests::initalizeTests() { std::string testSizeStr = std::to_string(testSize); std::string plural = (testSize > 1 ? "'s" : ""); std::cout << "\rInitalizing Tests"; tests["Test 01: isEmpty returns true when list is empty"] = &LinkedListTests::test01; tests["Test 02: isEmpty returns false when list is not empty"] = &LinkedListTests::test02; tests["Test 03: Size and vector return correct value after 1 addFront"] = &LinkedListTests::test03; tests["Test 04: Size and vector return correct value after 1 addBack"] = &LinkedListTests::test04; tests["Test 05: Size and vector return correct value after " + testSizeStr + " addFront" + plural] = &LinkedListTests::test05; tests["Test 06: Size and vector return correct value after " + testSizeStr + " addBack" + plural] = &LinkedListTests::test06; tests["Test 07: Size and vector return correct value after " + testSizeStr + " add" + plural + " and " + testSizeStr + " removeFront" + plural] = &LinkedListTests::test07; tests["Test 08: Size and vector return correct value after " + testSizeStr + " add" + plural + " and " + testSizeStr + " removeBack" + plural] = &LinkedListTests::test08; tests["Test 09: Size of populated list is decreased by 1 by removeFront"] = &LinkedListTests::test09; tests["Test 10: Size of populated list is decreased by 1 by removeBack"] = &LinkedListTests::test10; tests["Test 11: removeFront returns false on empty list"] = &LinkedListTests::test11; tests["Test 12: removeBack returns false on empty list"] = &LinkedListTests::test12; tests["Test 13: search returns true if value is in list"] = &LinkedListTests::test13; tests["Test 14: search returns false if value is not in the list"] = &LinkedListTests::test14; tests["Test 15: search returns true if value is in the list multiple times"] = &LinkedListTests::test15; tests["Test 16: Normal Usage Test"] = &LinkedListTests::test16; std::cout << "\r" << tests.size() << " Tests have been initalized"; } void LinkedListTests::printVector(std::vector<int> vec) { if (vec.size() > 15) { std::cout << "Please use a smaller test size (testSize <= 15) to view vectors."; return; } std::cout << "["; for (uint i = 0; i < vec.size(); i++) { std::cout << ((vec[i] < 0) ? "" : " ") << vec[i] << ((i < vec.size() - 1) ? ", " : ""); } std::cout << "]"; } std::vector<int> LinkedListTests::createVector() { std::vector<int> vec; srand(time(NULL)); for (uint i = 0; i < testSize; i++) { vec.push_back(rand()%(testSize * 10)); if (vec[i] % 2) { vec[i] *= -1; } } return vec; } void LinkedListTests::printResult(bool pass, std::string testName) { std::cout << "\n" << testName << (pass ? ": \033[32mPASSED\033[39;49;00m" : ": \033[31mFAILED\033[39;49;00m") << "\n"; std::cout.flush(); } bool LinkedListTests::testExpectedSize(bool passed, int linkedList, int expected) { if(linkedList != expected) { std::cout << "\n\t The size recieved: " << linkedList << "\n\t The size expected: " << expected; return false; } return passed; } bool LinkedListTests::testExpectedVectors(bool passed, std::vector<int> linkedList, std::vector<int> expected) { if(linkedList != expected) { if (expected.size() > 15 || linkedList.size() > 15) { std::cout << "\n\t The vector received from LinkedListOfInts is not the same as the expected vector."; std::cout << "\n\t Please use a smaller test size (testSize <= 15) to view the vectors."; return passed; } std::cout << "\n\t The vector recieved: "; printVector(linkedList); std::cout << "\n\t The vector expected: "; printVector(expected); return false; } return passed; } void LinkedListTests::printErrors() { std::cout << "\nThe following \033[31mERRORS\033[39;49;00m have been detected:\n"; std::ifstream ifs("ErrorList.txt", std::ifstream::in); if(ifs) { while(!ifs.eof()) { std::string temp = ""; getline(ifs,temp); std::cout << temp << "\n"; } } } void LinkedListTests::runTests() { std::cout << "\n\nRunning Tests:"; for (auto test : tests) { printResult((this->*(test.second))(), test.first); std::cout.flush(); } std::cout << "\nTesting Complete\n"; } // isEmpty returns true when list is empty bool LinkedListTests::test01() { bool passed = true; auto list = new LinkedListOfInts(); passed = list->isEmpty() && (list->size() == 0); delete list; return passed; } // isEmpty returns false when list is not empty bool LinkedListTests::test02() { bool passed = true; std::vector<int> vec(1, 1); auto list = new LinkedListOfInts(); list->addFront(1); passed = (list->size() == 1) && (vec == list->toVector() && !list->isEmpty()); delete list; return passed; } // Size and vector return correct value after 1 addFront bool LinkedListTests::test03() { bool passed = true; std::vector<int> vec(1, 1); auto list = new LinkedListOfInts(); list->addFront(1); passed = (list->size() == 1) && (vec == list->toVector()); delete list; return passed; } // Size and vector return correct value after 1 addBack bool LinkedListTests::test04() { bool passed = true; std::vector<int> vec(1, 1); auto list = new LinkedListOfInts(); list->addBack(1); passed = (list->size() == 1) && (vec == list->toVector()); delete list; return passed; } // Size and vector return correct value after (testSize) addFront(s) bool LinkedListTests::test05() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->addFront(vec[vec.size() - i]); } // Is the size correct? passed = testExpectedSize(passed, list->size(), (int)vec.size()); // Are the vectors the same? passed = testExpectedVectors(passed, list->toVector(), vec); delete list; return passed; } // Size and vector return correct value after (testSize) addBacks(s) bool LinkedListTests::test06() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->addBack(vec[i - 1]); } // Is the size correct? passed = testExpectedSize(passed, list->size(), (int)vec.size()); // Are the vectors the same? passed = testExpectedVectors(passed, list->toVector(), vec); delete list; return passed; } // Size and vector return correct value after (testSize) adds and removeFronts(s) bool LinkedListTests::test07() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->addFront(vec[vec.size() - i]); } std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Removing " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->removeFront(); } vec.clear(); // Is the size correct? passed = testExpectedSize(passed, list->size(), 0); // Are the vectors the same? passed = testExpectedVectors(passed, list->toVector(), vec); delete list; return passed; } // Size and vector return correct value after (testSize) adds and removeBack(s) bool LinkedListTests::test08() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->addFront(vec[vec.size() - i]); } std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Removing " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->removeBack(); } vec.clear(); // Is the size correct? passed = testExpectedSize(passed, list->size(), 0); // Are the vectors the same? passed = testExpectedVectors(passed, list->toVector(), vec); delete list; return passed; } // Size of populated list is decreased by 1 by removeFront bool LinkedListTests::test09() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->addFront(vec[vec.size() - i]); } std::cout << "\r\t Finished Adding " << vec.size() << " nodes, calling removeFront"; list->removeFront(); for (uint i = 0; i < (vec.size() - 1); i++) { vec[i] = vec[i + 1]; } vec.pop_back(); // Is the size correct? passed = testExpectedSize(passed, list->size(), vec.size()); // Are the vectors the same? passed = testExpectedVectors(passed, list->toVector(), vec); delete list; return passed; } // Size of populated list is decreased by 1 by removeBack bool LinkedListTests::test10() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->addFront(vec[vec.size() - i]); } std::cout << "\r\t Finished Adding " << vec.size() << " nodes, calling removeBack"; list->removeBack(); vec.pop_back(); // Is the size correct? passed = testExpectedSize(passed, list->size(), vec.size()); // Are the vectors the same? passed = testExpectedVectors(passed, list->toVector(), vec); delete list; return passed; } // removeFront returns false on empty list bool LinkedListTests::test11() { auto list = new LinkedListOfInts(); bool passed = !list->removeFront(); delete list; return passed; } // removeBack returns false on empty list bool LinkedListTests::test12() { auto list = new LinkedListOfInts(); bool passed = !list->removeFront(); delete list; return passed; } // search returns true if value is in list bool LinkedListTests::test13() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << vec.size() << " nodes"; std::cout.flush(); list->addFront(vec[vec.size() - i]); } std::cout << ((vec.size() > 0) ? "\n" : ""); for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Searching " << i << "/" << vec.size() << " nodes"; std::cout.flush(); passed = ((!list->search(vec[i - 1])) ? false : passed); } delete list; return passed; } // search returns false if value is not in the list bool LinkedListTests::test14() { auto list = new LinkedListOfInts(); bool passed = !list->search(1); delete list; return passed; } // search returns true if value is in the list multiple times bool LinkedListTests::test15() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; list->addBack(100); for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << (vec.size() + 2) << " nodes"; std::cout.flush(); list->addFront(vec[vec.size() - i]); } std::cout << "\r\t Adding " << (vec.size() + 2) << "/" << (vec.size() + 2) << " nodes"; vec.push_back(100); std::cout << "\r\t Adding " << (vec.size() + 1) << "/" << (vec.size() + 1) << " nodes"; vec.emplace(vec.begin(),100); list->addFront(100); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Searching " << i << "/" << vec.size() << " nodes"; std::cout.flush(); passed = ((!list->search(vec[i - 1])) ? false : passed); } delete list; return passed; } // Normal Usage Test bool LinkedListTests::test16() { bool passed = true; std::vector<int> vec = createVector(); auto list = new LinkedListOfInts(); std::cout << "\n"; for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Adding " << i << "/" << vec.size() << " nodes using addFront"; std::cout.flush(); list->addFront(vec[vec.size() - i]); } std::cout << "\n"; for (uint i = 1; i <= (5 > vec.size() ? vec.size() : 5); i++) { std::cout << "\r\t Removing " << i << "/" << (5 > vec.size() ? vec.size() : 5) << " nodes using removeBack"; std::cout.flush(); list->removeBack(); vec.pop_back(); } std::cout << "\n\t Adding 2 nodes using addFront then addBack"; list->addFront(100); vec.emplace(vec.begin(),100); list->addBack(100); vec.push_back(100); std::cout << "\n\t Removing 2 nodes using removeFront then removeBack"; list->removeFront(); for (uint i = 0; i < (vec.size() - 1); i++) { vec[i] = vec[i + 1]; } vec.pop_back(); list->removeBack(); vec.pop_back(); std::cout << ((vec.size() > 0) ? "\n" : ""); for (uint i = 1; i <= vec.size(); i++) { std::cout << "\r\t Searching " << i << "/" << vec.size() << " nodes"; std::cout.flush(); passed = ((!list->search(vec[i - 1])) ? false : passed); } // Is the size correct? passed = testExpectedSize(passed, list->size(), vec.size()); // Are the vectors the same? passed = testExpectedVectors(passed, list->toVector(), vec); delete list; return passed; }
13696da0d300b5c0a679cd527176bad63af75838
16e130599e881b7c1782ae822f3c52d88eac5892
/leetcode/sparseMatrixMultiplication/mySol2.cpp
5ee050f33d5ae1d5b199a62d098fe359055b17ab
[]
no_license
knightzf/review
9b40221a908d8197a3288ba3774651aa31aef338
8c716b13b5bfba7eafc218f29e4f240700ae3707
refs/heads/master
2023-04-27T04:43:36.840289
2023-04-22T22:15:26
2023-04-22T22:15:26
10,069,788
0
0
null
null
null
null
UTF-8
C++
false
false
1,040
cpp
mySol2.cpp
#include "header.h" class Solution { public: vector<vector<int>> multiply(vector<vector<int>>& A, vector<vector<int>>& B) { int m = A.size(), n = A[0].size(), k = B[0].size(); vector<vector<int>> res(m, vector<int>(k, 0)); unordered_map<int, vector<pair<int, int>>> va, vb; for(int i = 0; i < m; ++i) for(int j = 0; j < n; ++j) { if(A[i][j]) { va[i].emplace_back(make_pair(j, A[i][j])); } } for(int i = 0; i < n; ++i) for(int j = 0; j < k; ++j) { if(B[i][j]) { vb[i].emplace_back(make_pair(j, B[i][j])); } } for(const auto& v : va) { for(const auto& p : v.second) { for(const auto& q : vb[p.first]) { res[v.first][q.first] += p.second * q.second; } } } return res; } }; int main() { //Solution s; }
f10b173a56023fd213088824e3355a800b0d12ab
b00c54389a95d81a22e361fa9f8bdf5a2edc93e3
/external/pdfium/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp
bb4e0bba9fee2ff3c1a66a39b29eb0ef79444a93
[ "BSD-3-Clause" ]
permissive
mirek190/x86-android-5.0
9d1756fa7ff2f423887aa22694bd737eb634ef23
eb1029956682072bb7404192a80214189f0dc73b
refs/heads/master
2020-05-27T01:09:51.830208
2015-10-07T22:47:36
2015-10-07T22:47:36
41,942,802
15
20
null
2020-03-09T00:21:03
2015-09-05T00:11:19
null
UTF-8
C++
false
false
3,103
cpp
JBig2_ArithIntDecoder.cpp
// Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "JBig2_ArithIntDecoder.h" CJBig2_ArithIntDecoder::CJBig2_ArithIntDecoder() { IAx = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), 512); JBIG2_memset(IAx, 0, sizeof(JBig2ArithCtx) * 512); } CJBig2_ArithIntDecoder::~CJBig2_ArithIntDecoder() { m_pModule->JBig2_Free(IAx); } int CJBig2_ArithIntDecoder::decode(CJBig2_ArithDecoder *pArithDecoder, int *nResult) { int PREV, V; int S, D; int nNeedBits, nTemp, i; PREV = 1; S = pArithDecoder->DECODE(IAx + PREV); PREV = (PREV << 1) | S; D = pArithDecoder->DECODE(IAx + PREV); PREV = (PREV << 1) | D; if(D) { D = pArithDecoder->DECODE(IAx + PREV); PREV = (PREV << 1) | D; if(D) { D = pArithDecoder->DECODE(IAx + PREV); PREV = (PREV << 1) | D; if(D) { D = pArithDecoder->DECODE(IAx + PREV); PREV = (PREV << 1) | D; if(D) { D = pArithDecoder->DECODE(IAx + PREV); PREV = (PREV << 1) | D; if(D) { nNeedBits = 32; V = 4436; } else { nNeedBits = 12; V = 340; } } else { nNeedBits = 8; V = 84; } } else { nNeedBits = 6; V = 20; } } else { nNeedBits = 4; V = 4; } } else { nNeedBits = 2; V = 0; } nTemp = 0; for(i = 0; i < nNeedBits; i++) { D = pArithDecoder->DECODE(IAx + PREV); if(PREV < 256) { PREV = (PREV << 1) | D; } else { PREV = (((PREV << 1) | D) & 511) | 256; } nTemp = (nTemp << 1) | D; } V += nTemp; if(S == 1 && V > 0) { V = -V; } *nResult = V; if(S == 1 && V == 0) { return JBIG2_OOB; } return 0; } CJBig2_ArithIaidDecoder::CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA) { SBSYMCODELEN = SBSYMCODELENA; IAID = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), (1 << SBSYMCODELEN)); JBIG2_memset(IAID, 0, sizeof(JBig2ArithCtx) * (int)(1 << SBSYMCODELEN)); } CJBig2_ArithIaidDecoder::~CJBig2_ArithIaidDecoder() { m_pModule->JBig2_Free(IAID); } int CJBig2_ArithIaidDecoder::decode(CJBig2_ArithDecoder *pArithDecoder, int *nResult) { int PREV; int D; int i; PREV = 1; for(i = 0; i < SBSYMCODELEN; i++) { D = pArithDecoder->DECODE(IAID + PREV); PREV = (PREV << 1) | D; } PREV = PREV - (1 << SBSYMCODELEN); *nResult = PREV; return 0; }
7a5e12f8e969d48dbb43170c2ddb7b538aefc2bc
e56bf2c4b199e4a88e5894f71b191db3cccd62d1
/include/conf_crawler/dc/StaticLinkBaseService.h
5043338a94f92ab5fa407871bdc929e341af0f6f
[ "Apache-2.0" ]
permissive
seshucalypso/crawler_cpp
5155fa4f23913647618dff678f1856b33d9cf1ae
e0c8dba77233005b1ab13731d1cbcce274b70778
refs/heads/master
2021-06-14T20:24:50.112279
2017-04-06T07:45:13
2017-04-06T07:45:13
null
0
0
null
null
null
null
UTF-8
C++
false
true
27,641
h
StaticLinkBaseService.h
/** * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ #ifndef StaticLinkBaseService_H #define StaticLinkBaseService_H #include <thrift/TDispatchProcessor.h> #include "conf_crawler_types.h" class StaticLinkBaseServiceIf { public: virtual ~StaticLinkBaseServiceIf() {} virtual void load_db_task(const int32_t task_id, const bool is_add_task) = 0; virtual void load_mongodb_task(const int32_t task_id, const bool is_add_task) = 0; virtual void get_download_task(std::vector<DownloadTask> & _return) = 0; virtual void get_extract_task(std::vector<ExtractItem> & _return) = 0; virtual void get_one_extract_task(ExtractItem& _return) = 0; virtual void upload_download_task(const DownloadedBodyItem& downloaded_body_item) = 0; virtual void upload_extract_task(const ExtractItem& extract_item, const MatchedResultItem& matched_result_item) = 0; }; class StaticLinkBaseServiceIfFactory { public: typedef StaticLinkBaseServiceIf Handler; virtual ~StaticLinkBaseServiceIfFactory() {} virtual StaticLinkBaseServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; virtual void releaseHandler(StaticLinkBaseServiceIf* /* handler */) = 0; }; class StaticLinkBaseServiceIfSingletonFactory : virtual public StaticLinkBaseServiceIfFactory { public: StaticLinkBaseServiceIfSingletonFactory(const boost::shared_ptr<StaticLinkBaseServiceIf>& iface) : iface_(iface) {} virtual ~StaticLinkBaseServiceIfSingletonFactory() {} virtual StaticLinkBaseServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) { return iface_.get(); } virtual void releaseHandler(StaticLinkBaseServiceIf* /* handler */) {} protected: boost::shared_ptr<StaticLinkBaseServiceIf> iface_; }; class StaticLinkBaseServiceNull : virtual public StaticLinkBaseServiceIf { public: virtual ~StaticLinkBaseServiceNull() {} void load_db_task(const int32_t /* task_id */, const bool /* is_add_task */) { return; } void load_mongodb_task(const int32_t /* task_id */, const bool /* is_add_task */) { return; } void get_download_task(std::vector<DownloadTask> & /* _return */) { return; } void get_extract_task(std::vector<ExtractItem> & /* _return */) { return; } void get_one_extract_task(ExtractItem& /* _return */) { return; } void upload_download_task(const DownloadedBodyItem& /* downloaded_body_item */) { return; } void upload_extract_task(const ExtractItem& /* extract_item */, const MatchedResultItem& /* matched_result_item */) { return; } }; typedef struct _StaticLinkBaseService_load_db_task_args__isset { _StaticLinkBaseService_load_db_task_args__isset() : task_id(false), is_add_task(false) {} bool task_id; bool is_add_task; } _StaticLinkBaseService_load_db_task_args__isset; class StaticLinkBaseService_load_db_task_args { public: StaticLinkBaseService_load_db_task_args() : task_id(0), is_add_task(0) { } virtual ~StaticLinkBaseService_load_db_task_args() throw() {} int32_t task_id; bool is_add_task; _StaticLinkBaseService_load_db_task_args__isset __isset; void __set_task_id(const int32_t val) { task_id = val; } void __set_is_add_task(const bool val) { is_add_task = val; } bool operator == (const StaticLinkBaseService_load_db_task_args & rhs) const { if (!(task_id == rhs.task_id)) return false; if (!(is_add_task == rhs.is_add_task)) return false; return true; } bool operator != (const StaticLinkBaseService_load_db_task_args &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_load_db_task_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_load_db_task_pargs { public: virtual ~StaticLinkBaseService_load_db_task_pargs() throw() {} const int32_t* task_id; const bool* is_add_task; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_load_db_task_result { public: StaticLinkBaseService_load_db_task_result() { } virtual ~StaticLinkBaseService_load_db_task_result() throw() {} bool operator == (const StaticLinkBaseService_load_db_task_result & /* rhs */) const { return true; } bool operator != (const StaticLinkBaseService_load_db_task_result &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_load_db_task_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_load_db_task_presult { public: virtual ~StaticLinkBaseService_load_db_task_presult() throw() {} uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _StaticLinkBaseService_load_mongodb_task_args__isset { _StaticLinkBaseService_load_mongodb_task_args__isset() : task_id(false), is_add_task(false) {} bool task_id; bool is_add_task; } _StaticLinkBaseService_load_mongodb_task_args__isset; class StaticLinkBaseService_load_mongodb_task_args { public: StaticLinkBaseService_load_mongodb_task_args() : task_id(0), is_add_task(0) { } virtual ~StaticLinkBaseService_load_mongodb_task_args() throw() {} int32_t task_id; bool is_add_task; _StaticLinkBaseService_load_mongodb_task_args__isset __isset; void __set_task_id(const int32_t val) { task_id = val; } void __set_is_add_task(const bool val) { is_add_task = val; } bool operator == (const StaticLinkBaseService_load_mongodb_task_args & rhs) const { if (!(task_id == rhs.task_id)) return false; if (!(is_add_task == rhs.is_add_task)) return false; return true; } bool operator != (const StaticLinkBaseService_load_mongodb_task_args &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_load_mongodb_task_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_load_mongodb_task_pargs { public: virtual ~StaticLinkBaseService_load_mongodb_task_pargs() throw() {} const int32_t* task_id; const bool* is_add_task; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_load_mongodb_task_result { public: StaticLinkBaseService_load_mongodb_task_result() { } virtual ~StaticLinkBaseService_load_mongodb_task_result() throw() {} bool operator == (const StaticLinkBaseService_load_mongodb_task_result & /* rhs */) const { return true; } bool operator != (const StaticLinkBaseService_load_mongodb_task_result &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_load_mongodb_task_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_load_mongodb_task_presult { public: virtual ~StaticLinkBaseService_load_mongodb_task_presult() throw() {} uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; class StaticLinkBaseService_get_download_task_args { public: StaticLinkBaseService_get_download_task_args() { } virtual ~StaticLinkBaseService_get_download_task_args() throw() {} bool operator == (const StaticLinkBaseService_get_download_task_args & /* rhs */) const { return true; } bool operator != (const StaticLinkBaseService_get_download_task_args &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_get_download_task_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_get_download_task_pargs { public: virtual ~StaticLinkBaseService_get_download_task_pargs() throw() {} uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _StaticLinkBaseService_get_download_task_result__isset { _StaticLinkBaseService_get_download_task_result__isset() : success(false) {} bool success; } _StaticLinkBaseService_get_download_task_result__isset; class StaticLinkBaseService_get_download_task_result { public: StaticLinkBaseService_get_download_task_result() { } virtual ~StaticLinkBaseService_get_download_task_result() throw() {} std::vector<DownloadTask> success; _StaticLinkBaseService_get_download_task_result__isset __isset; void __set_success(const std::vector<DownloadTask> & val) { success = val; } bool operator == (const StaticLinkBaseService_get_download_task_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const StaticLinkBaseService_get_download_task_result &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_get_download_task_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _StaticLinkBaseService_get_download_task_presult__isset { _StaticLinkBaseService_get_download_task_presult__isset() : success(false) {} bool success; } _StaticLinkBaseService_get_download_task_presult__isset; class StaticLinkBaseService_get_download_task_presult { public: virtual ~StaticLinkBaseService_get_download_task_presult() throw() {} std::vector<DownloadTask> * success; _StaticLinkBaseService_get_download_task_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; class StaticLinkBaseService_get_extract_task_args { public: StaticLinkBaseService_get_extract_task_args() { } virtual ~StaticLinkBaseService_get_extract_task_args() throw() {} bool operator == (const StaticLinkBaseService_get_extract_task_args & /* rhs */) const { return true; } bool operator != (const StaticLinkBaseService_get_extract_task_args &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_get_extract_task_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_get_extract_task_pargs { public: virtual ~StaticLinkBaseService_get_extract_task_pargs() throw() {} uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _StaticLinkBaseService_get_extract_task_result__isset { _StaticLinkBaseService_get_extract_task_result__isset() : success(false) {} bool success; } _StaticLinkBaseService_get_extract_task_result__isset; class StaticLinkBaseService_get_extract_task_result { public: StaticLinkBaseService_get_extract_task_result() { } virtual ~StaticLinkBaseService_get_extract_task_result() throw() {} std::vector<ExtractItem> success; _StaticLinkBaseService_get_extract_task_result__isset __isset; void __set_success(const std::vector<ExtractItem> & val) { success = val; } bool operator == (const StaticLinkBaseService_get_extract_task_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const StaticLinkBaseService_get_extract_task_result &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_get_extract_task_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _StaticLinkBaseService_get_extract_task_presult__isset { _StaticLinkBaseService_get_extract_task_presult__isset() : success(false) {} bool success; } _StaticLinkBaseService_get_extract_task_presult__isset; class StaticLinkBaseService_get_extract_task_presult { public: virtual ~StaticLinkBaseService_get_extract_task_presult() throw() {} std::vector<ExtractItem> * success; _StaticLinkBaseService_get_extract_task_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; class StaticLinkBaseService_get_one_extract_task_args { public: StaticLinkBaseService_get_one_extract_task_args() { } virtual ~StaticLinkBaseService_get_one_extract_task_args() throw() {} bool operator == (const StaticLinkBaseService_get_one_extract_task_args & /* rhs */) const { return true; } bool operator != (const StaticLinkBaseService_get_one_extract_task_args &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_get_one_extract_task_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_get_one_extract_task_pargs { public: virtual ~StaticLinkBaseService_get_one_extract_task_pargs() throw() {} uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _StaticLinkBaseService_get_one_extract_task_result__isset { _StaticLinkBaseService_get_one_extract_task_result__isset() : success(false) {} bool success; } _StaticLinkBaseService_get_one_extract_task_result__isset; class StaticLinkBaseService_get_one_extract_task_result { public: StaticLinkBaseService_get_one_extract_task_result() { } virtual ~StaticLinkBaseService_get_one_extract_task_result() throw() {} ExtractItem success; _StaticLinkBaseService_get_one_extract_task_result__isset __isset; void __set_success(const ExtractItem& val) { success = val; } bool operator == (const StaticLinkBaseService_get_one_extract_task_result & rhs) const { if (!(success == rhs.success)) return false; return true; } bool operator != (const StaticLinkBaseService_get_one_extract_task_result &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_get_one_extract_task_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; typedef struct _StaticLinkBaseService_get_one_extract_task_presult__isset { _StaticLinkBaseService_get_one_extract_task_presult__isset() : success(false) {} bool success; } _StaticLinkBaseService_get_one_extract_task_presult__isset; class StaticLinkBaseService_get_one_extract_task_presult { public: virtual ~StaticLinkBaseService_get_one_extract_task_presult() throw() {} ExtractItem* success; _StaticLinkBaseService_get_one_extract_task_presult__isset __isset; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _StaticLinkBaseService_upload_download_task_args__isset { _StaticLinkBaseService_upload_download_task_args__isset() : downloaded_body_item(false) {} bool downloaded_body_item; } _StaticLinkBaseService_upload_download_task_args__isset; class StaticLinkBaseService_upload_download_task_args { public: StaticLinkBaseService_upload_download_task_args() { } virtual ~StaticLinkBaseService_upload_download_task_args() throw() {} DownloadedBodyItem downloaded_body_item; _StaticLinkBaseService_upload_download_task_args__isset __isset; void __set_downloaded_body_item(const DownloadedBodyItem& val) { downloaded_body_item = val; } bool operator == (const StaticLinkBaseService_upload_download_task_args & rhs) const { if (!(downloaded_body_item == rhs.downloaded_body_item)) return false; return true; } bool operator != (const StaticLinkBaseService_upload_download_task_args &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_upload_download_task_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_upload_download_task_pargs { public: virtual ~StaticLinkBaseService_upload_download_task_pargs() throw() {} const DownloadedBodyItem* downloaded_body_item; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_upload_download_task_result { public: StaticLinkBaseService_upload_download_task_result() { } virtual ~StaticLinkBaseService_upload_download_task_result() throw() {} bool operator == (const StaticLinkBaseService_upload_download_task_result & /* rhs */) const { return true; } bool operator != (const StaticLinkBaseService_upload_download_task_result &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_upload_download_task_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_upload_download_task_presult { public: virtual ~StaticLinkBaseService_upload_download_task_presult() throw() {} uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; typedef struct _StaticLinkBaseService_upload_extract_task_args__isset { _StaticLinkBaseService_upload_extract_task_args__isset() : extract_item(false), matched_result_item(false) {} bool extract_item; bool matched_result_item; } _StaticLinkBaseService_upload_extract_task_args__isset; class StaticLinkBaseService_upload_extract_task_args { public: StaticLinkBaseService_upload_extract_task_args() { } virtual ~StaticLinkBaseService_upload_extract_task_args() throw() {} ExtractItem extract_item; MatchedResultItem matched_result_item; _StaticLinkBaseService_upload_extract_task_args__isset __isset; void __set_extract_item(const ExtractItem& val) { extract_item = val; } void __set_matched_result_item(const MatchedResultItem& val) { matched_result_item = val; } bool operator == (const StaticLinkBaseService_upload_extract_task_args & rhs) const { if (!(extract_item == rhs.extract_item)) return false; if (!(matched_result_item == rhs.matched_result_item)) return false; return true; } bool operator != (const StaticLinkBaseService_upload_extract_task_args &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_upload_extract_task_args & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_upload_extract_task_pargs { public: virtual ~StaticLinkBaseService_upload_extract_task_pargs() throw() {} const ExtractItem* extract_item; const MatchedResultItem* matched_result_item; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_upload_extract_task_result { public: StaticLinkBaseService_upload_extract_task_result() { } virtual ~StaticLinkBaseService_upload_extract_task_result() throw() {} bool operator == (const StaticLinkBaseService_upload_extract_task_result & /* rhs */) const { return true; } bool operator != (const StaticLinkBaseService_upload_extract_task_result &rhs) const { return !(*this == rhs); } bool operator < (const StaticLinkBaseService_upload_extract_task_result & ) const; uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; }; class StaticLinkBaseService_upload_extract_task_presult { public: virtual ~StaticLinkBaseService_upload_extract_task_presult() throw() {} uint32_t read(::apache::thrift::protocol::TProtocol* iprot); }; class StaticLinkBaseServiceClient : virtual public StaticLinkBaseServiceIf { public: StaticLinkBaseServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : piprot_(prot), poprot_(prot) { iprot_ = prot.get(); oprot_ = prot.get(); } StaticLinkBaseServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) : piprot_(iprot), poprot_(oprot) { iprot_ = iprot.get(); oprot_ = oprot.get(); } boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void load_db_task(const int32_t task_id, const bool is_add_task); void send_load_db_task(const int32_t task_id, const bool is_add_task); void recv_load_db_task(); void load_mongodb_task(const int32_t task_id, const bool is_add_task); void send_load_mongodb_task(const int32_t task_id, const bool is_add_task); void recv_load_mongodb_task(); void get_download_task(std::vector<DownloadTask> & _return); void send_get_download_task(); void recv_get_download_task(std::vector<DownloadTask> & _return); void get_extract_task(std::vector<ExtractItem> & _return); void send_get_extract_task(); void recv_get_extract_task(std::vector<ExtractItem> & _return); void get_one_extract_task(ExtractItem& _return); void send_get_one_extract_task(); void recv_get_one_extract_task(ExtractItem& _return); void upload_download_task(const DownloadedBodyItem& downloaded_body_item); void send_upload_download_task(const DownloadedBodyItem& downloaded_body_item); void recv_upload_download_task(); void upload_extract_task(const ExtractItem& extract_item, const MatchedResultItem& matched_result_item); void send_upload_extract_task(const ExtractItem& extract_item, const MatchedResultItem& matched_result_item); void recv_upload_extract_task(); protected: boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class StaticLinkBaseServiceProcessor : public ::apache::thrift::TDispatchProcessor { protected: boost::shared_ptr<StaticLinkBaseServiceIf> iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (StaticLinkBaseServiceProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); typedef std::map<std::string, ProcessFunction> ProcessMap; ProcessMap processMap_; void process_load_db_task(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_load_mongodb_task(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_download_task(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_extract_task(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_get_one_extract_task(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_upload_download_task(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_upload_extract_task(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: StaticLinkBaseServiceProcessor(boost::shared_ptr<StaticLinkBaseServiceIf> iface) : iface_(iface) { processMap_["load_db_task"] = &StaticLinkBaseServiceProcessor::process_load_db_task; processMap_["load_mongodb_task"] = &StaticLinkBaseServiceProcessor::process_load_mongodb_task; processMap_["get_download_task"] = &StaticLinkBaseServiceProcessor::process_get_download_task; processMap_["get_extract_task"] = &StaticLinkBaseServiceProcessor::process_get_extract_task; processMap_["get_one_extract_task"] = &StaticLinkBaseServiceProcessor::process_get_one_extract_task; processMap_["upload_download_task"] = &StaticLinkBaseServiceProcessor::process_upload_download_task; processMap_["upload_extract_task"] = &StaticLinkBaseServiceProcessor::process_upload_extract_task; } virtual ~StaticLinkBaseServiceProcessor() {} }; class StaticLinkBaseServiceProcessorFactory : public ::apache::thrift::TProcessorFactory { public: StaticLinkBaseServiceProcessorFactory(const ::boost::shared_ptr< StaticLinkBaseServiceIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: ::boost::shared_ptr< StaticLinkBaseServiceIfFactory > handlerFactory_; }; class StaticLinkBaseServiceMultiface : virtual public StaticLinkBaseServiceIf { public: StaticLinkBaseServiceMultiface(std::vector<boost::shared_ptr<StaticLinkBaseServiceIf> >& ifaces) : ifaces_(ifaces) { } virtual ~StaticLinkBaseServiceMultiface() {} protected: std::vector<boost::shared_ptr<StaticLinkBaseServiceIf> > ifaces_; StaticLinkBaseServiceMultiface() {} void add(boost::shared_ptr<StaticLinkBaseServiceIf> iface) { ifaces_.push_back(iface); } public: void load_db_task(const int32_t task_id, const bool is_add_task) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->load_db_task(task_id, is_add_task); } ifaces_[i]->load_db_task(task_id, is_add_task); } void load_mongodb_task(const int32_t task_id, const bool is_add_task) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->load_mongodb_task(task_id, is_add_task); } ifaces_[i]->load_mongodb_task(task_id, is_add_task); } void get_download_task(std::vector<DownloadTask> & _return) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->get_download_task(_return); } ifaces_[i]->get_download_task(_return); return; } void get_extract_task(std::vector<ExtractItem> & _return) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->get_extract_task(_return); } ifaces_[i]->get_extract_task(_return); return; } void get_one_extract_task(ExtractItem& _return) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->get_one_extract_task(_return); } ifaces_[i]->get_one_extract_task(_return); return; } void upload_download_task(const DownloadedBodyItem& downloaded_body_item) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->upload_download_task(downloaded_body_item); } ifaces_[i]->upload_download_task(downloaded_body_item); } void upload_extract_task(const ExtractItem& extract_item, const MatchedResultItem& matched_result_item) { size_t sz = ifaces_.size(); size_t i = 0; for (; i < (sz - 1); ++i) { ifaces_[i]->upload_extract_task(extract_item, matched_result_item); } ifaces_[i]->upload_extract_task(extract_item, matched_result_item); } }; #endif
17ed11ae4cca55efb50baa16b8e1e71316187e4d
351895edf082d0de3e27e0a4da40e9b4548b12b7
/problemas.cpp
afffee9fb494e1588d1f31bb9e67c552f76519ec
[]
no_license
FerneyMP/Lab_2
317d11fdcb11df47d0a8632db6e4a091761e70ce
759ea4729e563aacb5c70059048d6ed4efc664f4
refs/heads/main
2023-04-16T15:25:54.571816
2021-04-29T22:37:41
2021-04-29T22:37:41
357,295,081
0
0
null
null
null
null
UTF-8
C++
false
false
19,614
cpp
problemas.cpp
#include "problemas.h" #include <cstdlib> #include <time.h> /* Problema 1: https://www.tinkercad.com/things/cRtYhcumIO8 */ void problema2() { //ASCCI - Mayúsculas (65 , 90) // VARIABLES PRINCIPALES int aleatorio, Cont_igual=0; char AZ[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; char arreglo[200]={}; char mayuscula = 'A', acumulador; // INVOCACIÓN DE FUNCION SRAND srand(time(NULL)); // EJECUCION DEL PROGRAMA for(int j=0;j<200;j++){ // j es el contador que itera en cada posicion y la aumenta aleatorio = rand()%26; // Genera numero aleatorio entre 0 a 25 dado que las mayusculas estan entre 65 a 90 acumulador = aleatorio + mayuscula; // Suma el numero aleatorio con el valor numérico de la mayúscula arreglo[j] = acumulador; // En la posición j del arreglo, ubica el valor aleatorio generado con anterioridad cout << arreglo[j]; } cout << endl; // for(int x=0;x<26;x++){ // FOR que recorre el arreglo de las mayúsculas 'A' -- 'Z' cout<<AZ[x]<<": "; //En este Cont_igual=0; // Necesaria para reiniciar el contador iguales for(int z=0;z<200;z++){ // FOR que recorre el arreglo de los 200 numeros aleatorios if(AZ[x]==arreglo[z]){// CONDICIÓN que evalúa si hay mayúsculas iguales Cont_igual++; // contador que aumenta cada vez que encuentra un valor igual } } cout<<Cont_igual<<endl; } } bool problema3(char *c1, char *c2) //las cadenas de caracteres terminan cuando se encuentra el caracter de fin de cadena { int contador1=0, contador2=0; for (int i=0; *(c1+i)!='\0';i++) contador1++; //longitud de la 1era cadena for (int j=0; *(c2+j)!='\0';j++) contador2++; //longitud de la 2da cadena if (contador1==contador2){ //igual longitud for (int i=0; *(c1+i)!='\0';i++){ for (int j=0; *(c2+j)!='\0';j++){ if (*(c1+i)==*(c2+j)){ //caracteres iguales //cout<<"La cadena es igual"<<endl; return true; } else { // cout<<"La cadena NO es la igual"<<endl; return false; } } } } else{ // cout<<"Diferentes longitudes"<<endl; return false; } } long long problema4(char *c) { long long int *resultado= new long long int[10]; long long int *acumulador; //Ciclo que convierte la cadena de caractere(números) en enteros for (int i=0;c[i]!='\0';i++){ if(c[i]>=48 && c[i]<=57){ resultado[i] = c[i]-'0'; // Hasta aquí genero el arreglo con numeros enteros } else{ break; } } for (int aux=0; c[aux]!='\0' ;aux++){ // Con este for recorro la cadena ya en entero y la cout << *(resultado+aux); } cout << endl; //Ahora llevo el arreglo de enteros a una variable que contenga el resultado en entero acumulador = resultado; //cout << &acumulador; delete[] resultado; return *acumulador; } void problema5(int num, char *c) { int a, A=0; //longitud if (num<0){ // agregar al str la posicion del menos si el numero es negativo c[0]='-'; num*=-1; //convertirlo a positivo A++; } a =num; if (a==0) c[0]='0'; while (a>0) { a/=10; //division entera para saber cuantos digitos tiene A++; //crear tamano del str } for (A--;num>0;num/=10,A--){ //ultima posicion c[A]=num%10+'0'; //reconstruir el numero, solo una posicion } cout<<c<<endl; } char *problema6(char *c) { char *cadena2 = new char[1]; for (int i=0;c[i]!='\0';i++){ // For que recorre if(c[i]>=97 && c[i]<=122){ cadena2[i]=c[i]-32; } else if(c[i] <= 65 || c[i] <= 90){ cadena2[i]=*(c+i); } else{ cadena2[i]=c[i]; } } cout << "Original: " << c << endl; cout << "En mayuscula: " << cadena2 << endl; delete[] cadena2; return cadena2; } void problema7(char *c) //Escriba un programa que reciba una cadena de caracteres y elimine los caracteres repetidos. { cout<<"Original: "<<c<<endl; int contador1=0, contador2=0, contador3=0; //inicializar variables char caracter; for (int i=0; *(c+i)!='\0';i++){ contador1++; //se calcula la longitus de la cadena } char *auxiliar=new char [contador1]; //asignar memoria para "auxiliar" de igual tamano que la cadena ingresada for (int j=0; *(c+j)!='\0';j++) { caracter=*(c+j); //almacenar el valor de la cadena en el momento en la variable caracter for (int k=0; *(auxiliar+k)!='\0';k++) { if (caracter== *(auxiliar+k))contador2++; //se compara el caracter con lo almacenado en el arreglo "auxiliar" } if (contador2==0){ auxiliar[contador3]=caracter; //se agrega el elemento si no esta repetido auxiliar[contador3+1]='\0'; contador3++; } else contador2=0; //se reinicia el contador si el elemento esta repetido } cout<<"Sin repetidos: "<< auxiliar<<endl; delete[]auxiliar;// se libera memoria } void problema8(char *c1, char *c2) { // c1 contiene la cadena // c2 cadena vacía a la que se van a llevar los números // c3 cadena que va contener las letras // numeros (48 -- 57) // minúsculas (97 -- 122) char *c3 = new char[1]; int contador1 = 0; int contador2 = 0; for (int i=0; c1[i]!='\0'; i++){ if(c1[i]>=48 && c1[i]<=57){ c2[contador1]= c1[i]; contador1++; } else{ c3[contador2]= c1[i]; contador2++; } } cout << "Original: " << c1 << endl; cout << "Texto: " << c3 << endl; cout << "Numero: " << c2 << endl; delete[] c3; } long long problema10(char *c) { bool F=true; const int M = 1000; const int D = 500; const int C = 100; const int L = 50; const int X = 10; const int V = 5; const int I = 1; int romanos[7]={M,D,C,L,X,V,I}; int arabigos[30]={}; int resultado=0; while(F == true){ //int tamanio = sizeof (c)/sizeof (char); for (int recorre=0; c[recorre]!= '\0'; recorre++){ // ---> For para memoria dinámica switch (c[recorre]) { case 'M': arabigos[recorre] = romanos[0]; break; case 'D': arabigos[recorre] = romanos[1]; break; case 'C': arabigos[recorre] = romanos[2]; break; case 'L': arabigos[recorre] = romanos[3]; break; case 'X': arabigos[recorre] = romanos[4]; break; case 'V': arabigos[recorre] = romanos[5]; break; case 'I': arabigos[recorre] = romanos[6]; break; default: cout << "El valor ingresado no es un numero Romano..." << endl; F = false; break; } } if (F== true){ // Rule number 1: Si un carácter esta seguido por uno de igual o menor valor, su valor se suma al total. for (int x=0;x<30;x++){ // --> For que recorre la cantidad del arreglo arábigos if (arabigos[x]>=arabigos[x+1]){ // x ---> posición determinada, (x+1) ---> siguiente posición. resultado += arabigos[x]; } // Rule number 2: Si un carácter esta seguido por uno de mayor valor, su valor se resta del total. else{ resultado-= arabigos[x]; } } cout << "El numero ingresado fue: " << c << endl; cout << "Que corresponde a: " << resultado << endl; F = false; } } return resultado; } void problema11(char c, char *c2) { static char cine[16][42]; int fila,columna; static bool f=false; if (!f){ for (int f=0;f<16;f++){ for (int c=0;c<42;c++){ if (f==0) cine[f][c]=' '; else{ if (c==0) cine[f][c]=char(f+64); else if (c%2==0) cine[f][c]='-'; else cine[f][c]=' '; } if (c==41)cine[f][c]='\0'; } } f=true; } fila=int (c2[0]-64); columna =2*(int(c2[1])-48); if (c=='I') cine[fila][columna]='+'; else if (c=='C') cine[fila][columna]='-'; for(int i=0; i<16;i++) cout<< cine[i]<<endl<<endl; } bool problema12(int **mat, int elementos) { bool verdadero = false; int sumarFilas[elementos], sumarColumnas[elementos]; int sF=0, sC=0, sD=0; // For para imprimir la matríz for(int filas=0; filas<elementos; filas++){ for(int columnas=0; columnas<elementos; columnas++){ //cout << "[" << mat[filas][columnas] << "]"; cout << "[" << mat[filas][columnas] << "]"; } cout << endl; } //Sumar las filas for(int filas=0; filas<elementos; filas++){ for(int columnas=0; columnas<elementos; columnas++){ sF+=mat[filas][columnas]; } sumarFilas[filas]=sF; sF = 0; } //Sumar las columnas for(int columnas=0; columnas<elementos; columnas++){ for(int filas=0; filas<elementos; filas++){ sC+=mat[filas][columnas]; } sumarColumnas[columnas] = sC; sC = 0; } //Sumar la diagonal principal for(int diagonal1=0, diagonal2=0; diagonal2 <elementos; diagonal1++, diagonal2++){ sD+=mat[diagonal1][diagonal2]; } //Con este For puedo realizar la comparación de las sumas, las columnas y la diagonal for (int i=0; i<elementos; i++){ if( (sumarFilas[i] == sumarColumnas[i]) && (sD == sumarColumnas[i]) ){ verdadero = true; } else{ verdadero = false;} } if (verdadero == true){ cout << "Es un cuadrado magico ..." << endl; } else{ cout << "No es un cuadrado magico ..." << endl;} return verdadero; } int problema13(int *mat) //función que reciba un puntero a la matriz de enteros como argumento y que retorne el número de estrellas. //Ignore las posibles estrellas que puedan existir en los bordes de la matriz. { int imagen [6][8], estrellas=0 ; float desigualdad; for(int f=0, i=0; f<6;f++){ for (int c=0;c<8;c++, i++){ imagen[f][c]=*(mat+i); } } for(int f=1, i=0; f<5;f++){ for (int c=1;c<7;c++, i++){ desigualdad=(imagen[f][c]+ imagen[f][c-1]+imagen[f][c+1]+imagen[f-1][c]+imagen[f+1][c])/5.0; if (desigualdad>6) estrellas++; } } return estrellas; } void problema14() { //Matriz 5x5 const int ordenMatriz = 5; int Matriz[ordenMatriz][ordenMatriz]; int Matriz90[ordenMatriz][ordenMatriz]; int Matriz180[ordenMatriz][ordenMatriz]; int Matriz270[ordenMatriz][ordenMatriz]; int contador1 =1; //For para almacenar elementos en la matriz for(int filas=0; filas<ordenMatriz; filas++){ for (int columnas=0; columnas<ordenMatriz; columnas++){ Matriz[filas][columnas] = contador1; contador1++; } } // ***************************** Matriz Original****************************************** cout << "Matriz Original ..." << endl; for(int filas=0; filas<ordenMatriz; filas++){ cout << " | "; for (int columnas=0; columnas<ordenMatriz; columnas++){ if(filas<=0 || filas <=1){ if (filas==1 && columnas==4){ cout << " " << Matriz[filas][columnas] << " |"; //contador++; } else{ cout << " " << Matriz[filas][columnas] << " |"; //contador++; } } else{ cout << " "<< Matriz[filas][columnas] << " |"; //contador++; } } cout << endl; } // ***************************** Matriz Rotada 90°****************************************** for(int filas=0; filas<ordenMatriz; filas++){ for(int columnas=0; columnas<ordenMatriz; columnas++){ if(filas<=0 && columnas<5){ Matriz90[columnas][filas] = Matriz[4][columnas]; } else if(filas<=1 && columnas<5){ Matriz90[columnas][filas] = Matriz[3][columnas]; } else if(filas<=2 && columnas<5){ Matriz90[columnas][filas] = Matriz[2][columnas]; } else if(filas<=3 && columnas<5){ Matriz90[columnas][filas] = Matriz[1][columnas]; } else Matriz90[columnas][filas] = Matriz[0][columnas]; } } cout << endl; cout << "Matriz Rotada 90° ..."<< endl; for(int filas=0; filas<ordenMatriz; filas++){ cout << " | "; for (int columnas=0; columnas<ordenMatriz; columnas++){ if(filas<=0 || filas <=1){ if (columnas==1 && filas==4){ cout << " " << Matriz90[filas][columnas] << " |"; } else{ cout << " " << Matriz90[filas][columnas] << " |"; } } else{ cout << " "<< Matriz90[filas][columnas] << " |"; } } cout << endl; } // ***************************** Matriz Rotada 180°****************************************** for(int filas=0; filas<ordenMatriz; filas++){ for(int columnas=0; columnas<ordenMatriz; columnas++){ if(filas<=0 && columnas<5){ Matriz180[columnas][filas] = Matriz90[4][columnas]; } else if(filas<=1 && columnas<5){ Matriz180[columnas][filas] = Matriz90[3][columnas]; } else if(filas<=2 && columnas<5){ Matriz180[columnas][filas] = Matriz90[2][columnas]; } else if(filas<=3 && columnas<5){ Matriz180[columnas][filas] = Matriz90[1][columnas]; } else Matriz180[columnas][filas] = Matriz90[0][columnas]; } } cout << endl; cout << "Matriz Rotada 180° ..."<< endl; for(int filas=0; filas<ordenMatriz; filas++){ cout << " | "; for (int columnas=0; columnas<ordenMatriz; columnas++){ if(filas<=0 || filas <=1){ if (columnas==2 && filas==4){ cout << " " << Matriz180[filas][columnas] << " |"; } else{ cout << " " << Matriz180[filas][columnas] << " |"; } } else{ cout << " "<< Matriz180[filas][columnas] << " |"; } } cout << endl; } // ***************************** Matriz Rotada 270°****************************************** for(int filas=0; filas<ordenMatriz; filas++){ for(int columnas=0; columnas<ordenMatriz; columnas++){ if(filas<=0 && columnas<5){ Matriz270[columnas][filas] = Matriz180[4][columnas]; } else if(filas<=1 && columnas<5){ Matriz270[columnas][filas] = Matriz180[3][columnas]; } else if(filas<=2 && columnas<5){ Matriz270[columnas][filas] = Matriz180[2][columnas]; } else if(filas<=3 && columnas<5){ Matriz270[columnas][filas] = Matriz180[1][columnas]; } else Matriz270[columnas][filas] = Matriz180[0][columnas]; } } cout << endl; cout << "Matriz Rotada 270° ..."<< endl; for(int filas=0; filas<ordenMatriz; filas++){ cout << " | "; for (int columnas=0; columnas<ordenMatriz; columnas++){ if(filas<=0 || filas <=1){ if (columnas==1 && filas==4){ cout << " " << Matriz270[filas][columnas] << " |"; } else{ cout << " " << Matriz270[filas][columnas] << " |"; } } else{ cout << " "<< Matriz270[filas][columnas] << " |"; } } cout << endl; } } int problema16(int n) { int caminos; caminos= recursiva(0,0,n+1,0); return caminos; } int problema17(int num) { bool check=false; int sumDiv=0; int inicio=2; while(inicio<=num){ check = numAmigable(inicio); if(check==true){ sumDiv+=inicio; } inicio++; } return sumDiv; } void problema18(char *p, int n) { char *m; if(n>=1 && n<=factorial(10)){ m = permutaciones(n-1,10); for(int i=0; m[i]!='\0';i++) p[i]=m[i]; p[10]='\0'; } else cout << "EL numero de permutacion no es valido" << endl; } /*---------------------------------------------------------------------- #include <iostream> using namespace std; void fun_a(int *px, int *py); void fun_b(int a[], int tam); int main() { int array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; fun_b(array, 10); } void fun_a(int *px, int *py){ int tmp = *px; *px = *py; *py = tmp; } void fun_b(int a[], int tam){ int f, l; int *b = a; for (f = 0, l = tam -1; f < l; f++, l--) { fun_a(&b[f], &b[l]); } } ejercicio 1. Con ayuda del debugger, examine la representación en memoria del arreglo array y responda las siguientes preguntas. Cuál es su dirección en memoria? 0x61fdf0 ¿Cuántos bytes se dedican para almacenar cada elemento de array? 4 Cuál es la dirección y el contenido en memoria del elemento array[3] ? la dirección es 0x61fdfc y el contenido en memoria es 3 Describa el efecto que tiene la función fun_b, sobre el arreglo array. Se encarga de invertir el arreglo, como resultado: 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 // Ejercicio 2 // & ---> Dirección de una variable. void fun_c(double *a, int n, double *promedio, double *suma){ //Paso de parámetros por referencia int i; *suma = 0.0; for (i = 0; i < n; i++) *suma += *(a + i); *promedio = *suma / n; } Caso de prueba: Si se ejecuta en el main, declarar la función así: ---> void fun_c(double *a, int n, double *promedio, double *suma); double arreglo[3]={7,8,9}; double a = 0, b = 0; double *promedio = &a; double *suma = &b; fun_c(arreglo, 3, promedio, suma); cout << "El promedio es: " << *promedio << endl; Resultado = 8. ejercicio 3. unsigned short b[4][2] = {{77, 50}, {5, 2}, {28, 39}, {99, 3}}; cout <<b<<endl; //0x61fe10 cout <<b+2<<endl; //0x61fe18 cout <<*(b+2)<<endl; //0x61fe18 cout <<*(b+2)+1<<endl; //0x61fe1a cout <<*(*(b+2)+1)<<endl; //39 cout <<b[3][1]<<endl;//3 cout <<*b++<<endl; //tira error, no se puede incrementar // ********************************************************************************************************************** Ejercicio 4: https://www.tinkercad.com/things/4JmmTwLCNxZ Links del tinkercad: ejercicio 5. Escribir mensajes en un Liquid-Crystal Display (LCD) ---> https://www.tinkercad.com/things/0HEuBSoZkQY */
fc1b50a167e398e83d2d8d3d7f9129c9799bfefa
3e51841d4d42ad57b1c8ab5883d9bffdaf2074db
/138-Copy-List-with-Random-Pointer/solution.cpp
79ef7457f30ab20b8070328f575d1a46e02cc941
[]
no_license
xh286/leetcode
f726524c05d93253293ea327c257f08cfd63faf6
dde81ea3112d1355ebc07f7f8afe00a3448f943a
refs/heads/master
2021-01-21T14:24:56.665689
2016-07-22T01:57:50
2016-07-22T01:57:50
58,489,012
0
0
null
null
null
null
UTF-8
C++
false
false
1,271
cpp
solution.cpp
/** * Definition for singly-linked list with a random pointer. * struct RandomListNode { * int label; * RandomListNode *next, *random; * RandomListNode(int x) : label(x), next(NULL), random(NULL) {} * }; */ class Solution { public: RandomListNode *copyRandomList(RandomListNode *head) { if(!head) return NULL; unordered_map<RandomListNode*, int> a2j; RandomListNode* p; int k; a2j[(RandomListNode*) nullptr] = 0; for(p = head, k = 0; p != NULL; p = p->next) { a2j[p] = ++k; } int len = k; vector<int> i2j(len+1,0); for(p = head, k = 0; p!= NULL; p= p->next) { i2j[++k] = a2j[p->random]; } vector<RandomListNode*> j2a(len+1,(RandomListNode*) nullptr); RandomListNode* new_head = new RandomListNode(head->label); RandomListNode* p2 = new_head; j2a[1] = new_head; for(p = head->next, k = 1; p!= NULL; p= p->next) { p2->next = new RandomListNode(p->label); p2 = p2->next; j2a[++k] = p2; } for(p=new_head, k=0; p != NULL; p=p->next) { p->random = j2a[i2j[++k]]; } return new_head; } };
4106ec229ca9d848895312ede53acc74d61c03ee
9cb3f8b4e697012ce43674e20281bfdd425f19d8
/droparea.cpp
715e865a6a39c958362f20459d3ab9f2f1db0831
[]
no_license
AndersonPeng/TCPSocket
93205efc24fa3f2adfb9ac2e15ff5ea4546263f8
6861b4673d3958d263cb4877650e9025392be64b
refs/heads/master
2021-01-18T15:39:15.673117
2017-05-23T11:14:53
2017-05-23T11:14:53
86,667,053
2
1
null
null
null
null
UTF-8
C++
false
false
2,396
cpp
droparea.cpp
#include "droparea.h" #include <QDragEnterEvent> #include <QDragMoveEvent> #include <QDragLeaveEvent> #include <QDropEvent> /*=============================== Constructor ===============================*/ DropArea::DropArea(QWidget *parent) : QLabel(parent) { setMinimumSize(200, 50); setFrameStyle(QFrame::Sunken|QFrame::StyledPanel); setAlignment(Qt::AlignCenter); setAcceptDrops(true); setAutoFillBackground(true); clear(); } /*=============================== Destructor ===============================*/ DropArea::~DropArea() { } /*=============================== EVENT: on drag enter ===============================*/ void DropArea::dragEnterEvent(QDragEnterEvent *event) { setText(tr("<drop content>")); setBackgroundRole(QPalette::Highlight); //Set the drop action to the one proposed event->acceptProposedAction(); //Emit changed() signal emit changed(event->mimeData()); } /*=============================== EVENT: on drag move ===============================*/ void DropArea::dragMoveEvent(QDragMoveEvent *event) { event->acceptProposedAction(); } /*=============================== EVENT: on drop ===============================*/ void DropArea::dropEvent(QDropEvent *event) { const QMimeData *mimeData = event->mimeData(); if(mimeData->hasImage()) setPixmap(qvariant_cast<QPixmap>(mimeData->imageData())); else if(mimeData->hasHtml()){ setText(mimeData->html()); setTextFormat(Qt::RichText); } else if(mimeData->hasText()){ setText(mimeData->text()); setTextFormat(Qt::PlainText); } else if(mimeData->hasUrls()){ QList<QUrl> urlList = mimeData->urls(); QString text; for(int i = 0; i < urlList.size() && i < 32; ++i) text += urlList.at(i).path() + QLatin1Char('\n'); setText(text); } else setText(tr("Cannot display data")); setBackgroundRole(QPalette::Dark); event->acceptProposedAction(); } /*=============================== EVENT: on drop ===============================*/ void DropArea::dragLeaveEvent(QDragLeaveEvent *event) { clear(); event->accept(); } /*=============================== SLOT: clear the area ===============================*/ void DropArea::clear() { setText(tr("<drop content>")); setBackgroundRole(QPalette::Dark); emit changed(); }
ab81751abffdb113118a2d803baab26720724cbb
e2c3ad5709359f13f9d93378fadbc0f0116d595f
/GTT/ExplosiveImC.h
cc8dd7bab47f59d745721f4f5927b87c82b63bee
[]
no_license
dagil02/TaxiRevengeDLC
b2bb7ea69bf146ec5f4251ed80ab02acd43e2e9a
b785dd652c435b7495e9aaed2b4a3d1bc4900af7
refs/heads/master
2020-06-02T01:01:49.305137
2019-07-01T17:06:11
2019-07-01T17:06:11
190,985,412
0
0
null
null
null
null
UTF-8
C++
false
false
239
h
ExplosiveImC.h
#pragma once #include "ImpactComponent.h" class ExplosiveImC : public ImpactComponent { public: ExplosiveImC(Proyectile* o, int radius=200); virtual void Impact(b2Contact* contact); virtual ~ExplosiveImC(); private: int radius_; };
0a7df09e8a1394a5e58e8267c4be5b10bffec226
914a4c7179367dbd6d9c97b2b5c02d6d6d4505f7
/grader/week06_2/w06-b03-catmario.cpp
0a1304ac9c3b7f83b33f8d3c6a0d78a4fbcf65e0
[]
no_license
WattanaixKU/204214-problemsolving-lab
53b592aa6de526b60d64b3ef485a3ff5ee004341
3918ee0c69262b7654e8e51ff7fb8e66e2f639a7
refs/heads/master
2020-04-16T14:23:22.898348
2019-05-29T08:21:06
2019-05-29T08:21:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
411
cpp
w06-b03-catmario.cpp
#include <iostream> using namespace std; int main() { int n,m,x,y,all=0; cin >> n >> m; int a[n]; for(int i=0;i<n;i++) a[i] = 501; for(int i=0;i<m;i++) { cin >> x >> y; x--; a[x] = min(a[x],y); } for(int i=0;i<n;i++) all += a[i]; cout << all << endl; for(int i=0;i<n;i++) cout << i+1 << " " << a[i] << endl; return 0; }
cd985ae258f791122e5b9c6224ad2e01f4a0e555
1935926ec53604c936e53019c24bdd16e1ef1bbc
/vjudge/hdu_5138.cpp
708bc4508c0e22decfd4e16d78d410df8fd95dfc
[]
no_license
PrimisR/Training
345ec0b342ea2b515e1786c93d5a87602d6c3044
b4834cc29b13e604e7a95f231ac48f49987bebc7
refs/heads/master
2022-12-30T02:46:47.621210
2020-10-20T03:00:52
2020-10-20T03:00:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
340
cpp
hdu_5138.cpp
#include<cstdio> int main() { //int a[5]={1,2,4,7,15}; int a[5]; a[0]=1;a[1]=2;a[2]=4;a[3]=7;a[4]=15; int num,i; while(scanf("%d",&num)!=EOF) { for(i=4;i>=0;i--) { // printf("%d\n",a[i]); if(num-a[i]>0) { printf("%d",num-a[i]); printf("%c",i==0?'\n':' '); } } } return 0; }
42cf6aeb746af726757e8e84e5a1299a3e29c10c
9f3b79bf8ce7d5c9e617a81640156829d697fd99
/Paramedic.hpp
4590a305584c80aac83afe43027750f5a2c8bd4c
[ "MIT" ]
permissive
elad11310/Assignment_4_C_plus_plus
315d6bb10f4970dad1ce91c7c7f175a65c67155a
bb929ff64900ef6f9d7e6f8746944875322fd81e
refs/heads/master
2022-09-22T13:21:32.912071
2020-06-05T09:56:21
2020-06-05T09:56:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
430
hpp
Paramedic.hpp
// // Created by elad on 24/05/2020. // #ifndef MATALA4_WARGAME_PARAMEDIC_H #define MATALA4_WARGAME_PARAMEDIC_H #endif //MATALA4_WARGAME_PARAMEDIC_H #include "Soldier.hpp" class Paramedic : public Soldier { public: Paramedic(int player) : Soldier(100, "Paramedic", player){} virtual void move(std::vector<std::vector<Soldier *>> &board, std::pair<int, int> _currentPos) override; virtual ~Paramedic(); };
295f6767938e9b37a688e18e26f6d578288a7b53
7b5a30718e95ae75b2a8b0bf8bb0a8e34cb9804a
/Koala/EntWithdrawDlg.cpp
8576e94aae95b51849925246795a55b9af83c874
[]
no_license
koalajack/koalachainclient
b5cfd2df28b1c1e6927161515f0047bb793e9667
712dc57d63c160412b26074bdd05f0b7b2b40724
refs/heads/master
2021-01-02T09:44:51.972008
2017-08-04T00:43:27
2017-08-04T00:43:27
99,200,011
0
0
null
null
null
null
GB18030
C++
false
false
7,219
cpp
EntWithdrawDlg.cpp
// EntWithdrawDlg.cpp : 实现文件 // #include "stdafx.h" #include "Koala.h" #include "EntWithdrawDlg.h" #include "afxdialogex.h" #include "CompanyInfoDlg.h" #include "KoalaDlg.h" // CEntWithdrawDlg 对话框 IMPLEMENT_DYNAMIC(CEntWithdrawDlg, CDialogEx) CEntWithdrawDlg::CEntWithdrawDlg(CWnd* pParent /*=NULL*/) : CDialogEx(CEntWithdrawDlg::IDD, pParent) , m_strWithdrawAddr(_T("")) , m_fMoney(0.0f) { } CEntWithdrawDlg::~CEntWithdrawDlg() { } void CEntWithdrawDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Text(pDX, IDC_EDT_WITHDRAW_ADDR, m_strWithdrawAddr); DDX_Text(pDX, IDC_EDT_MONEY, m_fMoney); } BEGIN_MESSAGE_MAP(CEntWithdrawDlg, CDialogEx) ON_BN_CLICKED(IDOK, &CEntWithdrawDlg::OnBnClickedOk) END_MESSAGE_MAP() // CEntWithdrawDlg 消息处理程序 #pragma pack(1) typedef struct { unsigned char type; //!<交易类型 char address[35]; //!<备注说明 字符串以\0结束,长度不足后补0 ULONGLONG moneyM; }COMPANY_WITHDRAW; #pragma pack() void CEntWithdrawDlg::OnBnClickedOk() { // TODO: 在此添加控件通知处理程序代码 UpdateData(TRUE); DOUBLE dValue = 0; CCompanyInfoDlg* pCompanyInfoDlg = ((CKoalaDlg*)AfxGetMainWnd())->m_pCompanyInfoDlg; if(!pCompanyInfoDlg) { return; } if(m_strWithdrawAddr.IsEmpty()) { if(theApp.m_bChinese) ::MessageBox(m_hWnd, _T("提现地址不能为空"), _T("提示"), MB_OK); else ::MessageBoxEx(m_hWnd, _T("The address can not be empty"), _T("tip"), MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return; } if(m_fMoney == 0) { if(theApp.m_bChinese) ::MessageBox(m_hWnd, _T("提现金额不能为0"), _T("提示"), MB_OK); else ::MessageBoxEx(m_hWnd, _T("The amount of cash can not be 0"), _T("tip"), MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return; } if(m_strScriptId.length() == 0) { return; } string strEntAddr; if(!pCompanyInfoDlg->FindEntAddByScriptId(m_strScriptId, strEntAddr)) { if(theApp.m_bChinese) ::MessageBox(m_hWnd, _T("没有相应的企业地址"), _T("提示"), MB_OK); else ::MessageBoxEx(m_hWnd, _T("There is no corresponding business address"), _T("tip"), MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return; } LIST_APP_DATA* app_data = NULL; BOOL ret = pCompanyInfoDlg->FindAppDataByScriptId(m_strScriptId, &app_data); if(ret) { if((app_data->fWithdrawByToday >= app_data->fQuotaByDay) && (app_data->fBalance > 0)) { if(app_data->nHeight > 0) { int nMinutes = 1440 - theApp.m_nBlockTipHight % 1440; int nHours = nMinutes / 60 + (nMinutes % 60 > 0 ? 1 : 0); char szInfo[256] = {0}; sprintf(szInfo, theApp.m_bChinese ? "当天的币已经全部提现,请等待大约%d小时后,再提取!" : "The day of the currency has been raised, please wait about %d hours later, and then extract", nHours); if(theApp.m_bChinese) ::MessageBox(m_hWnd, szInfo,theApp.m_bChinese ? _T("提示") : _T("tip"), MB_OK); else ::MessageBoxEx(m_hWnd, szInfo,theApp.m_bChinese ? _T("提示") : _T("tip"), MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); CDialogEx::OnOK(); return; } } } dValue = app_data->fQuotaByDay - app_data->fWithdrawByToday; if(dValue < 0) { dValue = 0; } if(m_fMoney > dValue) { CString strQuotaByDay; strQuotaByDay.Format(theApp.m_bChinese ? _T("当日可提现余额为%0.2lf") : _T("The current balance can be raised to %0.2lf"), dValue); if(theApp.m_bChinese) ::MessageBox(m_hWnd, strQuotaByDay , theApp.m_bChinese ? _T("提示") : _T("tip") ,MB_OK ); else ::MessageBoxEx(m_hWnd, strQuotaByDay , theApp.m_bChinese ? _T("提示") : _T("tip") ,MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return; } if(m_fMoney > app_data->fBalance) { if(theApp.m_bChinese) ::MessageBox(m_hWnd, _T("用户企业账户余额不够") , _T("提示") ,MB_OK ); else ::MessageBoxEx(m_hWnd, _T("The user's business account balance is not enough") , _T("tip") ,MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return; } if (!theApp.m_bIsSyncBlock ) { if(theApp.m_bChinese) ::MessageBox(m_hWnd, _T("同步未完成,不能发送交易") , _T("提示") ,MB_OK ); else ::MessageBoxEx(m_hWnd, _T("Synchronization is not completed and can not be sent") , _T("tip") ,MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); return; } if (theApp.IsLockWallet()) { return ; } /* COMPANY_WITHDRAW company_withdraw; memset(&company_withdraw, 0, sizeof(COMPANY_WITHDRAW)); company_withdraw.type = 0x03; char* pAddress = "dydzZu5EZj45aCiLCb94tZiU12RwaCx98z"; memcpy(company_withdraw.address, pAddress, 34); company_withdraw.moneyM = 100000000; string addr = "dtQE7px7YhQQpAvAGyRGX2R7vPdgjvapEH"; string strContract = CSoyPayHelp::getInstance()->GetHexData((const char*)&company_withdraw,sizeof(COMPANY_WITHDRAW)); string strCommand = CSoyPayHelp::getInstance()->CreateContractTx("5-1", addr,strContract, 0,100000000,0); */ COMPANY_WITHDRAW company_withdraw; memset(&company_withdraw, 0, sizeof(COMPANY_WITHDRAW)); company_withdraw.type = 0x03; memcpy(company_withdraw.address, m_strWithdrawAddr.GetBuffer(0), 34); company_withdraw.moneyM = REAL_MONEY(m_fMoney); string strContract = CSoyPayHelp::getInstance()->GetHexData((const char*)&company_withdraw,sizeof(COMPANY_WITHDRAW)); string strCommand = CSoyPayHelp::getInstance()->CreateContractTx(m_strScriptId, strEntAddr,strContract, 0,theApp.m_BussCfg.WithdrawFee,0); string strShowData = _T(""); CSoyPayHelp::getInstance()->SendContacrRpc(strCommand,strShowData); TRACE(strShowData.c_str()); int pos = strShowData.find("hash"); if ( pos >=0 ) { //提现金额xxxx至账户xxxxxx请求已提交,请等待1~2分钟后,查看提币账户余额。 char szInfo[512] = {0}; string addr; pCompanyInfoDlg->FindEntAddByScriptId(m_strScriptId, addr); sprintf(szInfo, theApp.m_bChinese ? "提现金额%0.2f至账户%s,请求已提交,请等待1~2分钟后,查看提币账户余额。" : "Withdrawal Amount %0.2f to account %s, request has been submitted, please wait 1 to 2 minutes later, check the currency account balance.", m_fMoney, m_strWithdrawAddr.GetBuffer(0)); if(theApp.m_bChinese) ::MessageBox(m_hWnd, szInfo, _T("提示"), MB_OK); else ::MessageBoxEx(m_hWnd, szInfo, _T("提示"), MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); } else { if(theApp.m_bChinese) ::MessageBox(m_hWnd, _T("提现失败"), _T("提示"), MB_OK); else ::MessageBoxEx(m_hWnd, _T("Failure to withdraw"), _T("tip"), MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); } CDialogEx::OnOK(); } BOOL CEntWithdrawDlg::OnInitDialog() { CDialogEx::OnInitDialog(); if(!theApp.m_bChinese) { GetDlgItem(IDC_STATIC22)->SetWindowText("Account address:"); GetDlgItem(IDC_STATIC23)->SetWindowText("Amount:"); GetDlgItem(IDOK)->SetWindowText("OK"); GetDlgItem(IDCANCEL)->SetWindowText("Cancel"); SetWindowText("Withdraw"); } // TODO: 在此添加额外的初始化 return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
8525d588f212597c598e395fd7b5ec5b7c9cf08e
61108e74688b8d404d825120fe0c89fab51d155e
/Grader.h
fd769e8a43be53107dd6691e94651d96a627a067
[]
no_license
FarukIb/word-unscrambler
2fc80f826944e6f93852cdc659ed31e7f9da6b79
744c7cf9574d82127df1abf2689d2b1c4473588d
refs/heads/main
2023-03-18T11:52:46.550865
2021-03-20T17:46:31
2021-03-20T17:46:31
349,795,081
0
0
null
null
null
null
UTF-8
C++
false
false
465
h
Grader.h
#ifndef GRADER_H #define GRADER_H #include <map> #include <string> #include <vector> using namespace std; #pragma once class Grader { public: Grader(); void toggleArch(); void toggleBow(); vector<pair<string, int> > sortWords(vector<string> words); private: //int cmp(pair<string, int> a, pair<string, int> b); int getGrade(string a); std::map<char, double> grades; vector<pair<string, int> > wordNum; bool arch, bow; }; #endif
890e09f14c968ae17306e31d4189919bce29423e
4ed9f56cae0b9b768f6ece683269b6c58e145964
/parse/jsd_set.hpp
d1adfc8e3ebaa67c1faeaf5ac4f857af04d1e3c5
[ "MIT" ]
permissive
alex2425/SimpleJSON
3b64c09c7d5303a69125e83f7d2de74e0f443d53
878a6341baed91c29630447f6bd480391f563045
refs/heads/master
2022-11-17T10:15:52.735288
2020-07-08T21:47:33
2020-07-08T21:47:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
728
hpp
jsd_set.hpp
#pragma once #include "jsd_core.hpp" #include "jsd_container.hpp" #include <set> namespace JSON { template <typename T> void parse(std::set<T>& value, std::string const& name, PropertyTree const& object, ParsingOptions const& options = {}) { try { SJSON_GET_CHILD(name, pt, std::set<T>{}); for (auto const& i : pt) { T temp; parse(temp, "", i.second, options); value.insert(std::move(temp)); } } catch (boost::property_tree::ptree_bad_data& exc) { SJSON_DEFAULT_PROPERTY_ERROR_HANDLER(std::set<T>{}, std::set<T>{}); } catch (boost::property_tree::ptree_bad_path& exc) { SJSON_DEFAULT_PATH_ERROR_HANDLER(std::set<T>{}, std::set<T>{}); } } }
3e2ab90d74f0d9ae4117c433bcb96eb236212bcb
da1d23701d638bfbbae6c46f26ca7741a1e6688b
/Chapter02/Heart.cpp
370bedb3d13786b6124c9ed4949d0e0a44d45ca1
[]
no_license
jcjuliocss/ship-game
11c0107efebee2da74710e1f2addde0251ef8212
1e16d658ba70ebc361a28065040799655e0616fc
refs/heads/main
2023-04-08T20:40:40.275696
2021-04-26T00:13:16
2021-04-26T00:13:16
356,615,168
0
1
null
2021-04-25T20:59:01
2021-04-10T15:02:23
C++
UTF-8
C++
false
false
818
cpp
Heart.cpp
// ---------------------------------------------------------------- // From Game Programming in C++ by Sanjay Madhav // Copyright (C) 2017 Sanjay Madhav. All rights reserved. // // Released under the BSD License // See LICENSE in root directory for full details. // ---------------------------------------------------------------- #include "Heart.h" #include "AnimSpriteComponent.h" #include "Game.h" Heart::Heart(Game* game, float posX) :Actor(game) { SetPosition(Vector2(posX, 25.0f)); SetScale(1.5f); AnimSpriteComponent* asc = new AnimSpriteComponent(this); std::vector<SDL_Texture*> anims = { game->GetTexture("Assets/Heart.png"), }; //set the textures to the Ship vector of animated sprites asc->SetAnimTextures(anims); game->AddHeart(this); } Heart::~Heart() { GetGame()->RemoveHeart(this); }
4e2e5d0e109e02afffeb2fc4bb5f5f219603f8e7
6830dfdc24d5467e0f5b46fc544249da64a4ac66
/DSAA_homework/Lab8/date_the_princess.cpp
5079d6aa06f2027a345465cc377825e1bb16aad1
[]
no_license
night-gale/C-projects
6829be088f17f3bbace351ac6636a73871f1d3e3
19903613e9d22e6d2ee6bb0b9bbb358f3d8ccf51
refs/heads/master
2021-08-17T11:41:38.916882
2020-08-16T06:44:49
2020-08-16T06:44:49
214,568,575
0
0
null
null
null
null
UTF-8
C++
false
false
1,561
cpp
date_the_princess.cpp
#include <stdio.h> #include <vector> #include <math.h> enum COLOR{ WHITE=1, YELLOW=2, RED=3 }; class Node{ public: std::vector<Node*> aj; COLOR color; int distance; Node(COLOR color) { this->color = color; distance = __INT32_MAX__; } }; Node* nodes[1000001]; int n, m, u, v, w, cnt, ft, ed; Node* queue[1000001], *curr, *next; int main(void) { scanf("%d %d", &n, &m); cnt = n; ft = 0, ed = 0; for(int i = 1; i <= n; i++) { nodes[i] = new Node(WHITE); } //construct adjacent list for(int i = 0; i < m; i++) { scanf("%d %d %d", &u, &v, &w); if(w == 1) { nodes[u]->aj.push_back(nodes[v]); }else { //split two nodes with road bewteen them 2 into three nodes nodes[++cnt] = new Node(WHITE); nodes[u]->aj.push_back(nodes[cnt]); nodes[cnt]->aj.push_back(nodes[v]); } } queue[ed++] = nodes[1]; nodes[1]->distance = 0; nodes[1]->color = YELLOW; while(ed != ft) { curr = queue[ft++]; if(curr->color == RED) continue; curr->color = RED; for(int j = 0; j < curr->aj.size(); j++) { next = curr->aj[j]; if(next->color == WHITE) { queue[ed++] = next; next->color = YELLOW; next->distance = curr->distance + 1; } } } if(nodes[n]->color != RED) { printf("%d\n", -1); }else { printf("%d\n", nodes[n]->distance); } }
0ed996e3436051196b6e78ba830c7a05ebe174a5
584291f63c7d6cfaf15e46126c41c32b37803ea1
/2021.1 - Mestrado/01_Introdução_IA/atividade03/src/state.cpp
c535cc9b10c542fa5b7355a8f96cbaaf68252086
[]
no_license
mattsousaa/IA_Praticas
6b3a2c408da2bc17ee83af97e268d6f2cfe8ba03
05379dce1ad74da1885e032936c958424acc71a9
refs/heads/master
2021-07-19T08:28:22.947594
2021-07-03T21:39:06
2021-07-03T21:39:06
148,945,318
1
0
null
null
null
null
UTF-8
C++
false
false
184
cpp
state.cpp
#include "state.h" State::State(){} State::State(int _state){ state = _state; } int State::getState(){ return state; } void State::setState(int value){ state = value; }
0d8d881ccaabc2dd79a3747de5feffaca0b06f7b
5929cf83939009a948a90992e9cab716ebfd58a8
/SQLiteRecover/stdafx.h
d853832f3be0baccf77357a70858b86c1a6ff1b7
[]
no_license
dfrc-korea/SQLiteRecover
2fa978a687c107b7f4c5778d320491d01fc28820
5a441a68c888e5f9d05fe7a25db5aa2b33e0dca9
refs/heads/master
2020-05-01T13:23:53.722854
2019-04-03T05:55:53
2019-04-03T05:55:53
177,490,434
22
7
null
null
null
null
UHC
C++
false
false
1,223
h
stdafx.h
// stdafx.h : 자주 사용하지만 자주 변경되지는 않는 // 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이 // 들어 있는 포함 파일입니다. // #pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 일부 CString 생성자는 명시적으로 선언됩니다. #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS // 대화 상자에서 MFC 컨트롤에 대한 지원을 제거합니다. #ifndef VC_EXTRALEAN #define VC_EXTRALEAN // 거의 사용되지 않는 내용은 Windows 헤더에서 제외합니다. #endif #include <afx.h> #include <afxwin.h> // MFC 핵심 및 표준 구성 요소입니다. #include <afxext.h> // MFC 확장입니다. #ifndef _AFX_NO_OLE_SUPPORT #include <afxdtctl.h> // Internet Explorer 4 공용 컨트롤에 대한 MFC 지원입니다. #endif #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // Windows 공용 컨트롤에 대한 MFC 지원입니다. #endif // _AFX_NO_AFXCMN_SUPPORT #include <iostream> // TODO: 프로그램에 필요한 추가 헤더는 여기에서 참조합니다.
8ab16851564d7e0594834931b61492ba7d4ab53f
eeeddcc643dabb8ea6826ecaf2da4fee4b4d8a53
/cnet/socket/AddrInfo.h
682ed5ff8721f2d1d147779ac6c489291d1d6417
[]
no_license
JonathanCline/CCapNet
7115a980b8f2f7699c7c1e45dff8aef858d65b92
1466502b5351185c67112fdffab97403fef76c4e
refs/heads/main
2023-06-26T05:54:34.820612
2021-07-25T19:41:59
2021-07-25T19:41:59
382,805,810
0
0
null
null
null
null
UTF-8
C++
false
false
5,123
h
AddrInfo.h
#pragma once #include <cnet/platform/Platform.h> #include <jclib/ranges.h> #include <jclib/iterator.h> #include <compare> namespace ccap::net { struct AddrInfo { public: using value_type = ::addrinfo; using pointer = value_type*; pointer get() const noexcept { return this->data_; }; pointer operator->() const noexcept { return this->get(); }; value_type& operator*() noexcept { return *this->get(); }; const value_type& operator*() const noexcept { return *this->get(); }; bool good() const noexcept { return this->get() != nullptr; }; explicit operator bool() const noexcept { return this->good(); }; void release() { this->data_ = nullptr; }; void reset() { if (this->good()) { ::freeaddrinfo(this->get()); this->release(); }; }; pointer [[nodiscard("owning pointer")]] extract() noexcept { auto _out = this->get(); this->release(); return _out; }; friend inline auto operator<=>(const AddrInfo& lhs, pointer rhs) noexcept { return lhs.get() <=> rhs; }; friend inline auto operator<=>(pointer lhs, const AddrInfo& rhs) noexcept { return lhs <=> rhs.get(); }; auto operator<=>(const AddrInfo& rhs) const noexcept { return *this <=> rhs.get(); }; AddrInfo(pointer _data) noexcept : data_{ _data } {}; AddrInfo() noexcept : AddrInfo{ nullptr } {}; AddrInfo(const AddrInfo&) = delete; AddrInfo& operator=(const AddrInfo&) = delete; AddrInfo(AddrInfo&& other) noexcept : data_{ other.extract() } {}; AddrInfo& operator=(AddrInfo&& other) noexcept { JCLIB_ASSERT((*this <=> other) != 0); this->reset(); this->data_ = other.extract(); return *this; }; ~AddrInfo() { this->reset(); }; private: ::addrinfo* data_; }; struct AddrList { public: using value_type = ::addrinfo; using pointer = value_type*; using reference = value_type&; using const_pointer = const value_type*; using const_reference = const value_type&; reference front() noexcept { return *this->data_; }; const_reference front() const noexcept { return *this->data_; }; pointer data() { return &this->front(); }; const_pointer data() const { return &this->front(); }; private: template <typename T> requires std::same_as<jc::remove_const_t<T>, ::addrinfo> struct base_iterator { public: using value_type = T; using pointer = value_type*; using reference = value_type&; using iterator_category = std::forward_iterator_tag; constexpr pointer get() const noexcept { return this->at_; }; constexpr pointer operator->() const noexcept { return this->get(); }; constexpr reference operator*() const noexcept { JCLIB_ASSERT(this->at_ != nullptr); return *this->get(); }; constexpr base_iterator& operator++() noexcept { auto& _ptr = this->at_; JCLIB_ASSERT(_ptr != nullptr); _ptr = _ptr->ai_next; return *this; }; constexpr base_iterator operator++(int) noexcept { auto _out{ *this }; ++(*this); return _out; }; template <typename _T> constexpr bool operator==(const base_iterator<_T>& other) const noexcept { return this->get() == other.get(); }; template <typename _T> constexpr bool operator!=(const base_iterator<_T>& other) const noexcept { return !(*this == other); }; constexpr base_iterator() = default; constexpr base_iterator(pointer _at) noexcept : at_{ _at } {}; private: pointer at_; }; public: using iterator = base_iterator<value_type>; struct const_iterator : public base_iterator<const value_type> { using base_iterator<const value_type>::base_iterator; using base_iterator<const value_type>::operator==; using base_iterator<const value_type>::operator!=; constexpr const_iterator(iterator _it) noexcept : base_iterator<const value_type>{ _it.get() } {}; }; iterator begin() { return iterator{ this->data() }; }; const_iterator begin() const { return const_iterator{ this->data() }; }; const_iterator cbegin() const { return const_iterator{ this->begin() }; }; iterator end() { return iterator{ nullptr }; }; const_iterator end() const { return const_iterator{ nullptr }; }; const_iterator cend() const { return const_iterator{ nullptr }; }; bool empty() const noexcept { return !(bool)this->data_; }; AddrList(AddrInfo _data) : data_{ std::move(_data) } {}; private: AddrInfo data_; }; inline AddrList getaddrinfo(const char* _name, const char* _service, ::addrinfo& _hints) { addrinfo* _out{}; const auto _result = ::getaddrinfo(_name, _service, &_hints, &_out); if (_result != 0) { return AddrInfo{}; }; return AddrInfo{ _out }; }; inline AddrList getaddrinfo(const char* _name, const char* _service) { addrinfo* _out{}; const auto _result = ::getaddrinfo(_name, _service, nullptr, &_out); if (_result != 0) { return AddrInfo{}; }; return AddrInfo{ _out }; }; };
9f11309bfa63b14932b686969a8b7f9c4ac51a2d
d7d0e4c868466dc4f10a860cc6175bfaaa1c5814
/RangeQuery/Forest_Queries.cpp
280493c486609677c5daf172a44413b039d88851
[]
no_license
Aman-droid/CSES_Solutions
798eb5dc64cdb0c8fe1886b4888ce3d8902d7a9d
121c555746e5b709bde6c73b4ed4fe79064e04ee
refs/heads/master
2023-05-24T13:34:43.057092
2021-06-14T19:57:38
2021-06-14T19:57:38
371,799,018
0
0
null
null
null
null
UTF-8
C++
false
false
1,466
cpp
Forest_Queries.cpp
#include <bits/stdc++.h> #define ll long long #define int long long #define endl '\n' #define rep(i, a, b) for (int i = a; i <= b; i++) #define pll pair<ll, ll> #define pii pair<int, int> #define vpll vector<pll> #define SZ(x) ((int)x.size()) #define FIO \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL) #define watch(x) cout << (#x) << " is " << (x) << "\n" #define watch2(x, y) cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << "\n" #define pb push_back #define pf push_front #define ff first #define ss second #define mod 1000000007 #define INF (ll)(1e18) #define all(c) (c).begin(), (c).end() using namespace std; const int mxn = 2e3; void solve(){ int n, q;cin >> n >> q; char c; vector<vector<int>>dp(n+1,vector<int>(n+1,0)); vector<vector<int>>mat(n+1,vector<int>(n+1,0)); rep(i,1,n){ rep(j,1,n){ cin>>c; if(c=='*')mat[i][j]=1; } } for (int i = 1; i <= n; i++){ for (int j = 1; j <= n; j++){ dp[i][j] = mat[i][j] + dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1]; } } int ans=0; int r1,c1,r2,c2; rep(i,1,q){ cin>>r1>>c1>>r2>>c2; ans= dp[r2][c2] - dp[r1-1][c2] - dp[r2][c1-1] + dp[r1-1][c1-1]; cout<<ans<<endl; } } signed main() { FIO; int T = 1;//cin >> T; while (T--) { solve(); } return 0; }
e33b756f8f292cddaeba727150e926b260d230ee
e07e25bc29baf02b56f7397f7a174cbc2cfc5b6d
/src/cpp/graph-capture-regions-board/graph.cpp
308a22aeaff3224047d876acc6923848e0877c71
[]
no_license
ANARCYPHER/coding-interview-solutions
a12848be333457725a45fe723551723776ef1d8f
68452ab2bf7de438c3e4986dcd44502b1c0b69f6
refs/heads/master
2023-02-08T09:58:00.174509
2019-08-29T19:16:39
2019-08-29T19:16:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,910
cpp
graph.cpp
/** * Given a 2D board containing 'X' and 'O', capture all regions surrounded by * 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded * region. * * Note: * 1. The board can have different x and y dimensions. * * Example: * * X X X X * X O O X * X X O X * X O X X * * After running your function, the board should be: * * X X X X * X X X X * X X X X * X O X X * * Time complexity: O(N^2), where N is the number of places in the board. * Space complexity: O(N). * * Explanation: use BFS or DFS to find connected components of O's. When * performing the BFS keep all the vertices you visited because you may need * to switch them back to its original value when the connected component you * traversed is not completely surrounded by X's. A connected component will * not be completely surrounded when one of its O's is in one of the borders of * the board (i = 0, j = 0, i = N - 1, j = N - 1). Also notice that if you * switch a not valid connected component back to O's in the BFS function you * will end up investigating the same component more than once. For example, * O O X * X X X * X X X * If you don't mark in some way that the vertex (0, 1) was already visited you * will cal BFS for it again. For that you can use a intermediary symbol or a * "visited" variable. I used an intermediary symbol 'F' to save some extra * memory, so in the end of my algorithm I need to switch back the F's to O's. */ #include <iostream> #include <queue> using namespace std; void bfs(vector<vector<char>> &a, int i, int j) { int n = a.size(), m = a[0].size(); bool valid = true; vector<pair<int, int>> visited; queue<pair<int, int>> q; q.push({i, j}); a[i][j] = 'X'; while (!q.empty()) { pair<int, int> curr = q.front(); q.pop(); int r = curr.first, c = curr.second; if (r == 0 || r == n - 1 || c == 0 || c == m - 1) valid = false; if (r - 1 >= 0 && a[r - 1][c] == 'O') { q.push({r - 1, c}); a[r - 1][c] = 'X'; } if (c - 1 >= 0 && a[r][c - 1] == 'O') { q.push({r, c - 1}); a[r][c - 1] = 'X'; } if (r + 1 < n && a[r + 1][c] == 'O') { q.push({r + 1, c}); a[r + 1][c] = 'X'; } if (c + 1 < m && a[r][c + 1] == 'O') { q.push({r, c + 1}); a[r][c + 1] = 'X'; } visited.push_back({r, c}); } if (!valid) { for (pair<int, int> p : visited) a[p.first][p.second] = 'F'; } } void solve(vector<vector<char>> &a) { if (a.size() == 0 || a[0].size() == 0) return; int n = a.size(), m = a[0].size(); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (a[i][j] == 'X' || a[i][j] == 'F') continue; bfs(a, i, j); } } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (a[i][j] == 'F') a[i][j] = 'O'; } } } int main() { // vector<vector<char>> board = { // "XXXX", // "XOXX", // "XXOX", // "XXXX" // }; // vector<vector<char>> board = { // "OXXX", // "XOXX", // "XXOX", // "XXXX" // }; // vector<vector<char>> board = { // { 'X', 'X', 'X', 'X' }, // { 'X', 'O', 'O', 'X' }, // { 'X', 'X', 'O', 'X' }, // { 'X', 'O', 'X', 'X' } // }; // vector<vector<char>> board = { // { 'X', 'O', 'O', 'O', 'X', 'O', 'X', 'X', 'X', 'X' }, // { 'X', 'O', 'X', 'O', 'X', 'O', 'O', 'X', 'X', 'X' }, // { 'X', 'X', 'X', 'O', 'O', 'O', 'X', 'O', 'X', 'O' }, // { 'O', 'X', 'X', 'X', 'O', 'X', 'O', 'X', 'O', 'X' } // }; vector<vector<char>> board = { { 'O', 'X', 'X' }, { 'O', 'O', 'X' }, { 'X', 'X', 'O' }, { 'X', 'O', 'X' }, { 'O', 'O', 'X' }, { 'O', 'X', 'X' } }; solve(board); for (int i = 0; i < board.size(); i++) { for (int j = 0; j < board[i].size(); j++) { cout << board[i][j] << " "; } cout << endl; } cout << endl; return 0; }
61f101acf889fc985df8286f262eeffe25062943
c2741d134d4d085c856a36813ff7402b4fdaae3c
/AssetLoader/Collider.hpp
cefb7dca984c81cc15f1ab02b10929aba8a58f89
[]
no_license
mi7flat5/Asset_Loader
fa0d18d00dc0a51f046e94ff823824b612691844
0e18a631ea155cfc5b9de733a2a2ad7db4ae891c
refs/heads/master
2021-06-11T12:55:16.586624
2016-11-23T11:01:24
2016-11-23T11:01:24
59,860,026
0
0
null
null
null
null
UTF-8
C++
false
false
1,139
hpp
Collider.hpp
#ifndef COLLIDER_HPP #define COLLIDER_HPP #include<vector> #include<string> #include"glm-0.9.2.7\glm\glm.hpp" #include"glm-0.9.2.7\glm\gtc\matrix_transform.hpp" #include"glm-0.9.2.7\glm\gtc\type_ptr.hpp" #include"Shaders.hpp" class Collider { std::vector<glm::vec3> Verts, RenderVerts; std::vector<GLuint> Indices; glm::mat4 ColliderModel; GLuint VAO, VBO,EBO, ProjectionMatrixID, ViewMatrixID, ModelMatrixID, DebugPoint1, DebugPoint2; GLuint tVao, tVbo; Shaders * ModelShader; Shaders * DebuglineShader; GLuint SphereRadius; public: int PointsInCollider(); void SetModelMatrix(glm::mat4); Collider(const std::string& ); Collider(); virtual ~Collider(); void Draw() ; glm::mat4 GetColliderMatrix()const; glm::vec3 GetFurthestPoint(const glm::vec3 & DirectionVector); bool SphereRayCollider(glm::vec4 RayStart, glm::vec4 RayDirection); bool SphereRayCollider(glm::vec3 RayStart, glm::vec3 RayDirection); glm::vec3 GetPosition() const; bool SphereSphereCollider(Collider * TargetCollider); GLuint GetRadius()const; glm::mat4 GetColliderModelMatrix()const; }; #endif // !COLLIDER_HPP
d92351e3b29f75125d9bc9f84f12491e1f01351a
d7970b166a26418cf3868d9d23c6ee17195482fa
/include/AdlDeviceFactorySingleton.h
e2971bc48097c8b0d9d8b11b4975c4c045b65fe7
[]
no_license
srgblnch/AdlinkIODS
2698569d7b6ae3635a5a50ef8773cf3a3980972f
c233d8102a2a1e2c7b5326e1038d070c00f1148f
refs/heads/master
2021-07-12T15:44:30.727545
2014-11-06T10:12:14
2014-11-06T10:12:14
43,964,398
0
0
null
null
null
null
UTF-8
C++
false
false
4,149
h
AdlDeviceFactorySingleton.h
#ifndef __ADLINK_DEVICE_MANAGER__H___DSFJ9feudjfejr32SDd___ #define __ADLINK_DEVICE_MANAGER__H___DSFJ9feudjfejr32SDd___ #include <d2kdask.h> #include <dask.h> #include <omnithread.h> #include <map> #include <set> #include <vector> #include <string> /// /// Implements a singleton factory of adlink devices. /// D2K_Register_Card fails if called more than once for the same board /// without releasing previously. So what if we want to tango devices /// to get acces to the same physical device? In this case, a tango device /// accessing analog ports an another on digital ones? Both can't /// tegister the card! That's why we have this factory. It's the one that /// registers or deregisters cards, depending on how many tango devices /// are using them. /// /// Alse defined here funciton get_board_params() defines the properties /// of a device according to the board class. /// class CommonDeviceInterface; class DevicePartInterface; namespace AdlDeviceFactorySingleton_ { enum ADFMode { ModeAnalogInput = 0, ModeAnalogOutput, ModeDigital, ModeCounter, ADFMODE_TOTAL }; struct AdlBoardParams { char typeName[32]; /// Device type, as defined in adlink API functions Register_Card or D2K_Register_Card /// depending on adl_params->isD2K I16 type; //adl_params->type /// Does the device use D2K-DASK API or PCI-DASK bool isD2K; // adl_params->isD2K /// For each operation mode how many available slots /// does this kind of board have? For example, it usually /// will have 0 or 1 analog input slots and D2K use to have /// 2 counters. unsigned modeSlots[ADFMODE_TOTAL]; /// Number of analog channels the device has __attribute__((__deprecated__)) unsigned totalChannels; ///@todo DEPRECATED EXTERMINAR! unsigned aiChannels; unsigned aoChannels; /// Internal timebase U32 timeBase; //adl_params->timeBase U32 minInputScanIntrv; U32 maxInputScanIntrv; /// @todo Some boards have FIFO shared between AI or AO, some have /// different sizes for each... handle this!! long onBoardBufferSz; //adl_params->onBoardBufferSz /// @todo what about available voltage ranges? /// @todo what about total digital channels? short ai_nBits; // IGNORED, now AnalogInput uses PS/D2K-DASK own methods // to translate from bits to volts short ao_nBits; }; } class AdlDeviceFactorySingleton { public: typedef AdlDeviceFactorySingleton_::AdlBoardParams AdlBoardParams; typedef AdlDeviceFactorySingleton_::ADFMode ADFMode; private: AdlDeviceFactorySingleton(); typedef std::pair<const AdlBoardParams *, U16> CardTypeNumPair; typedef std::multiset<ADFMode> OpenCardModesSet; typedef std::pair<I16, OpenCardModesSet> OpenCardMode; typedef std::map<CardTypeNumPair, OpenCardMode> CardMap; typedef std::map<CardTypeNumPair, CommonDeviceInterface*> CommonMap; static CardMap s_cardMap; static CommonMap s_commonMap; static omni_mutex s_mutex; static bool _check_single(const AdlBoardParams* params, U16 cardNum); static I16 __get_common(CommonDeviceInterface** dev, const AdlBoardParams* params, U16 cardNum, ADFMode mode); static bool __release_common(CommonDeviceInterface** _dev, ADFMode mode); static DevicePartInterface* create_input_device_psdask(CommonDeviceInterface* commonDevice); static DevicePartInterface* create_input_device_d2k(CommonDeviceInterface* commonDevice); static DevicePartInterface* create_output_device_psdask(CommonDeviceInterface* commonDevice); static DevicePartInterface* create_output_device_d2k(CommonDeviceInterface* commonDevice); static DevicePartInterface* create_digital_device(CommonDeviceInterface* commonDevice); static DevicePartInterface* create_counter_device(CommonDeviceInterface* commonDevice); public: static const AdlBoardParams* get_board_params(const std::string & boardType); static void get_supported_boards(std::vector<std::string> &boards); static I16 get(DevicePartInterface** dev, const std::string & boardType, U16 cardNum, ADFMode mode); static bool release(DevicePartInterface** dev, ADFMode mode); }; #endif //__ADLINK_DEVICE_MANAGER__H___DSFJ9feudjfejr32SDd___
e51b5662b57aaf12b643f442e820d3c5bd4a9833
67182c2817ce8636fa98e92f9c7bd016e45da085
/test/component/storage.cpp
dbc3386240532381badbf9b19f95cf888b7202f4
[ "MIT" ]
permissive
PkXwmpgN/des
c345f364aeccc1ab63f152008751c626faefb017
a5f78c86b84c845d7223817d23b9087ffa83a643
refs/heads/master
2020-09-09T21:13:21.813312
2017-07-27T09:07:34
2017-07-27T09:07:34
94,446,265
0
0
null
null
null
null
UTF-8
C++
false
false
2,364
cpp
storage.cpp
#include <iostream> #include <cassert> #include <des/data/config.h> #include <des/component/component.h> #include <des/component/buffer.h> #include <des/component/storage.h> struct data1 { float x; }; struct data2 { int y; }; constexpr auto component1 = des::component::component<data1>; constexpr auto component2 = des::component::component<data2>; // struct-of-array namespace test_soa { constexpr auto buffer1 = des::component::make_buffer(component1); constexpr auto buffer2 = des::component::make_buffer(component2); constexpr auto storage = des::component::make_storage(buffer1, buffer2); } // array-of-struct namespace test_aos { constexpr auto buffer = des::component::make_buffer(component1, component2); constexpr auto storage = des::component::make_storage(buffer); } namespace fixed { constexpr auto config = des::data::make_config() .fixed_entity(des::meta::sz_v<2>); } namespace dynamic { constexpr auto config = des::data::make_config() .dynamic_entity(des::meta::sz_v<2>); } template<typename _Storage> void start_test(const _Storage & storage) { test(storage.make(fixed::config)); test(storage.make(dynamic::config)); } template<typename _Storage> void test(_Storage && storage) { auto index1 = storage.add(component1); auto index2 = storage.add(component1); auto index3 = storage.add(component2); assert(storage.size(component1) == 2); assert(storage.size(component2) == 1); storage.get(component1, index1).x = 0; storage.get(component1, index2).x = 1; storage.get(component2, index3).y = 1; assert(storage.get(component1, index1).x == 0); assert(storage.get(component1, index2).x == 1); assert(storage.get(component2, index3).y == 1); storage.meta(component1, index1).owner(1); storage.meta(component1, index2).owner(2); assert(storage.meta(component1, index1).owner() == 1); assert(storage.meta(component1, index2).owner() == 2); assert(storage.meta(component2, index3).owner() == 0); assert(storage.remove(component1, index1)); assert(storage.size(component1) == 1); assert(storage.get(component1, index1).x == 1); assert(!storage.remove(component1, index1)); assert(!storage.size(component1)); } int main() { start_test(test_aos::storage); start_test(test_soa::storage); }
31ae6054e4e5ce5e3dc83ee22c5b9269f4062231
08b8cf38e1936e8cec27f84af0d3727321cec9c4
/data/crawl/git/old_hunk_2870.cpp
3a7357ca8f30b17f1adff4e9a964bb8ee186a9b1
[]
no_license
ccdxc/logSurvey
eaf28e9c2d6307140b17986d5c05106d1fd8e943
6b80226e1667c1e0760ab39160893ee19b0e9fb1
refs/heads/master
2022-01-07T21:31:55.446839
2018-04-21T14:12:43
2018-04-21T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
334
cpp
old_hunk_2870.cpp
} ref_transaction_free(transaction); unlink(git_path("CHERRY_PICK_HEAD")); unlink(git_path("REVERT_HEAD")); unlink(git_path("MERGE_HEAD")); unlink(git_path("MERGE_MSG")); unlink(git_path("MERGE_MODE")); unlink(git_path("SQUASH_MSG")); if (commit_index_files()) die (_("Repository has been updated, but unable to write\n"
b9d25de71b3de77175c82ec1ca1d580992b0b126
d8d64c4dc1d1e4b5e6a72b575efe1b740823342e
/_includes/source_code/code/26-PDP/sumpair/sumpair_official.cpp
f2c2b3b1ca6745e682489060242d45e78210f56d
[]
no_license
pdp-archive/pdp-archive.github.io
6c6eb2a08fe8d20c8fb393e3437e89e2c0e9d231
9f8002334de7817a998a65a070f899b40f50e294
refs/heads/master
2023-06-08T19:07:22.444091
2023-05-31T12:45:43
2023-05-31T12:45:43
169,656,266
26
19
null
2023-05-31T12:45:45
2019-02-07T23:00:27
C++
UTF-8
C++
false
false
664
cpp
sumpair_official.cpp
#include <stdio.h> #include <algorithm> using namespace std; const int MAXN = 1000002; int a[MAXN]; int main() { freopen("sumpair.in", "r", stdin); freopen("sumpair.out", "w", stdout); int n, q; scanf("%d %d", &n, &q); for(int i=0; i<n; ++i) scanf("%d", a+i); sort(a, a+n); while(q--) { int val; scanf("%d", &val); int ok = 0; int lo = 0, hi = n-1; while(lo < hi) { if(a[lo] + a[hi] > val) hi--; else if(a[lo] + a[hi] < val) lo++; else { ok = 1; break; } } if(ok) printf("true\n"); else printf("false\n"); } return 0; }
640b8d13b58574246bf9d5312c56e267aecefbac
8c0e508d2e9f03be0a02e48168f5455c51f242e7
/Compettitive programming/ALL OI/LMIO/2019/bulves.cpp
7b2d681103e4c578fc84f6272b954db1770a688f
[]
no_license
ithsarasak/Programming
4109ca7123cb4646b7352f5efea6d1c82bd08049
722ef1a9d99310dabb4f46321127bdf86b9e9ac0
refs/heads/master
2022-10-28T05:29:55.009295
2020-06-13T07:42:23
2020-06-13T07:42:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
640
cpp
bulves.cpp
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 10; int n; long long c[N], ans; priority_queue<long long> q; int main() { scanf("%d",&n); for( int i = 1 ; i <= n ; i++ ) { long long a, b; scanf("%lld %lld",&a,&b); c[i] = c[i-1] + a - b; } for( int i = 1 ; i <= n ; i++ ) { if( c[i] > c[n] ) ans += c[i] - c[n], c[i] = c[n]; if( c[i] < 0 ) ans -= c[i], c[i] = 0; q.emplace( c[i] ); if( q.top() != c[i] ) { ans += q.top() - c[i]; q.pop(); q.emplace( c[i] ); } } printf("%lld",ans); return 0; }