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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
748c59add0274a66e3736a8fa16431084b1b4a4f
|
b14138c0e1b13dcd02fe86f2a36513de5a39be48
|
/ab5067_balancewindow.cpp
|
d25b82441ccaa39ae4c4ff19910a908166795dab
|
[] |
no_license
|
arshbansall/Banking
|
690876936a0b45be801890d06e0664db51cd136f
|
b00d756111d6e1fe63d56d94f9d032e45dc6052b
|
refs/heads/master
| 2022-07-13T17:26:22.778898
| 2020-05-08T21:44:19
| 2020-05-08T21:44:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 677
|
cpp
|
ab5067_balancewindow.cpp
|
/*
Arsh Bansal
3 May 2020
Revision History
*/
#include "ab5067_balancewindow.h"
#include "ui_balancewindow.h"
BalanceWindow::BalanceWindow(QWidget *parent, Customer* customerIn) :
QDialog(parent),
ui(new Ui::BalanceWindow)
{
ui->setupUi(this);
customer = customerIn;
double checkingBalance = bank->displayBalance(true, customer);
QString checkingString = QString::number(checkingBalance);
ui->chekcingLabel->setText(checkingString);
ui->savingsLabel->setText(QString::number(bank->displayBalance(false, customer)));
}
BalanceWindow::~BalanceWindow()
{
delete ui;
}
void BalanceWindow::on_exitButton_clicked()
{
this->close();
}
|
30261119c4f0dc8c4c57338685e0b7bbdde5480f
|
71e9598ca83775932b81e1a93cc2b9e2793d9329
|
/Classroom.h
|
f38967958974750c774f6e8a44b3534ede2cca91
|
[] |
no_license
|
ilias000/Early_morning_reporting_students_to_school
|
f5bf62c8f2065d6bd76378e41150ae3e726b3c12
|
da0f44897caead3f091a3a801e8b31aca2daa780
|
refs/heads/master
| 2023-03-09T00:41:50.702238
| 2021-02-18T10:43:27
| 2021-02-18T10:43:27
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 603
|
h
|
Classroom.h
|
#ifndef CLASSROOM_H
#define CLASSROOM_H
#include "Student.h"
#include "Teacher.h"
#include <iostream>
using namespace std;
class Classroom
{
int CclassMax, numberOfStudents;
Student **student;
Teacher *teacher;
public:
Classroom(const int); // constructor
~Classroom(); // destructor
bool canEnterClassroom(); // returns true if some student can enter the classroom
void enter(Student *); // enters a student to the classroom
void place(Teacher *); // place the teacher in the classroom
void print(const int); // prints the classroom
};
#endif
|
bec9c5f72090e164cce5c5b38a647da2c42066c4
|
20c5a9cc71d0592b28261e6865ae2c8c36617f25
|
/src/OldPathway.cpp
|
389cb0efad92b8bb3fb60ba20d846cde17d691d4
|
[
"MIT"
] |
permissive
|
meshula/OpenSteer
|
178dd10200e480a01ed517bfaa24f08db126a0dc
|
710432341807f5597b62fa168f194f9ef2640c8e
|
refs/heads/master
| 2023-04-15T21:59:39.327778
| 2022-03-10T07:47:41
| 2022-03-10T07:47:41
| 16,267,264
| 281
| 53
|
NOASSERTION
| 2023-03-31T06:44:18
| 2014-01-27T02:28:11
|
C++
|
UTF-8
|
C++
| false
| false
| 9,254
|
cpp
|
OldPathway.cpp
|
// ----------------------------------------------------------------------------
//
//
// OpenSteer -- Steering Behaviors for Autonomous Characters
//
// Copyright (c) 2002-2005, Sony Computer Entertainment America
// Original author: Craig Reynolds <craig_reynolds@playstation.sony.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
//
// ----------------------------------------------------------------------------
//
//
// Pathway and PolylinePathway, for path following.
//
// 06-08-05 bk: Deprecated
// 10-04-04 bk: put everything into the OpenSteer namespace
// 06-03-02 cwr: created
//
//
// ----------------------------------------------------------------------------
#include "OpenSteer/OldPathway.h"
// ----------------------------------------------------------------------------
// construct a PolylinePathway given the number of points (vertices),
// an array of points, and a path radius.
OpenSteer::Old::PolylinePathway::PolylinePathway (const int _pointCount,
const Vec3 _points[],
const float _radius,
const bool _cyclic)
{
initialize (_pointCount, _points, _radius, _cyclic);
}
// ----------------------------------------------------------------------------
// utility for constructors
void
OpenSteer::Old::PolylinePathway::initialize (const int _pointCount,
const Vec3 _points[],
const float _radius,
const bool _cyclic)
{
// set data members, allocate arrays
radius = _radius;
cyclic = _cyclic;
pointCount = _pointCount;
if (cyclic) pointCount++;
lengths = new float [pointCount];
points = new Vec3 [pointCount];
normals = new Vec3 [pointCount];
// loop over all points
for (int i = 0; i < pointCount; i++)
{
// copy in point locations, closing cycle when appropriate
const bool closeCycle = cyclic && (i == pointCount-1);
const int j = closeCycle ? 0 : i;
points[i] = _points[j];
}
setupLengths();
}
// ----------------------------------------------------------------------------
// utility for constructors
void
OpenSteer::Old::PolylinePathway::setupLengths ()
{
totalPathLength = 0;
// loop over all points
for (int i = 0; i < pointCount; i++)
{
// for the end of each segment
if (i > 0)
{
// compute the segment length
normals[i] = points[i] - points[i-1];
lengths[i] = normals[i].length ();
// find the normalized vector parallel to the segment
normals[i] *= 1 / lengths[i];
// keep running total of segment lengths
totalPathLength += lengths[i];
}
}
}
// ----------------------------------------------------------------------------
// move existing points safely
void
OpenSteer::Old::PolylinePathway::movePoints (const int _firstPoint,
const int _numPoints,
const Vec3 _points[])
{
// loop over all points
for (int i = _firstPoint; i < _firstPoint + _numPoints; i++)
{
int j = i - _firstPoint;
// copy in point locations, closing cycle when appropriate
points[i] = _points[j];
//if the first point is set, make sure we close the loop!
if (cyclic && i == 0)
{
points[pointCount-1] = _points[j];
}
}
setupLengths();
}
// ----------------------------------------------------------------------------
// Given an arbitrary point ("A"), returns the nearest point ("P") on
// this path. Also returns, via output arguments, the path tangent at
// P and a measure of how far A is outside the Pathway's "tube". Note
// that a negative distance indicates A is inside the Pathway.
OpenSteer::Vec3
OpenSteer::Old::PolylinePathway::mapPointToPath (const Vec3& point,
Vec3& tangent,
float& outside)
{
float d;
float minDistance = FLT_MAX;
Vec3 onPath;
// loop over all segments, find the one nearest to the given point
for (int i = 1; i < pointCount; i++)
{
segmentLength = lengths[i];
segmentNormal = normals[i];
d = pointToSegmentDistance (point, points[i-1], points[i]);
if (d < minDistance)
{
minDistance = d;
onPath = chosen;
tangent = segmentNormal;
}
}
// measure how far original point is outside the Pathway's "tube"
outside = Vec3::distance (onPath, point) - radius;
// return point on path
return onPath;
}
// ----------------------------------------------------------------------------
// given an arbitrary point, convert it to a distance along the path
float
OpenSteer::Old::PolylinePathway::mapPointToPathDistance (const Vec3& point)
{
float d;
float minDistance = FLT_MAX;
float segmentLengthTotal = 0;
float pathDistance = 0;
for (int i = 1; i < pointCount; i++)
{
segmentLength = lengths[i];
segmentNormal = normals[i];
d = pointToSegmentDistance (point, points[i-1], points[i]);
if (d < minDistance)
{
minDistance = d;
pathDistance = segmentLengthTotal + segmentProjection;
}
segmentLengthTotal += segmentLength;
}
// return distance along path of onPath point
return pathDistance;
}
// ----------------------------------------------------------------------------
// given a distance along the path, convert it to a point on the path
OpenSteer::Vec3
OpenSteer::Old::PolylinePathway::mapPathDistanceToPoint (float pathDistance)
{
// clip or wrap given path distance according to cyclic flag
float remaining = pathDistance;
if (cyclic)
{
remaining = (float) fmod (pathDistance, totalPathLength);
}
else
{
if (pathDistance < 0) return points[0];
if (pathDistance >= totalPathLength) return points [pointCount-1];
}
// step through segments, subtracting off segment lengths until
// locating the segment that contains the original pathDistance.
// Interpolate along that segment to find 3d point value to return.
Vec3 result;
for (int i = 1; i < pointCount; i++)
{
segmentLength = lengths[i];
if (segmentLength < remaining)
{
remaining -= segmentLength;
}
else
{
float ratio = remaining / segmentLength;
result = interpolate (ratio, points[i-1], points[i]);
break;
}
}
return result;
}
// ----------------------------------------------------------------------------
// computes distance from a point to a line segment
//
// (I considered moving this to the vector library, but its too
// tangled up with the internal state of the PolylinePathway instance)
float
OpenSteer::Old::PolylinePathway::pointToSegmentDistance (const Vec3& point,
const Vec3& ep0,
const Vec3& ep1)
{
// convert the test point to be "local" to ep0
local = point - ep0;
// find the projection of "local" onto "segmentNormal"
segmentProjection = segmentNormal.dot (local);
// handle boundary cases: when projection is not on segment, the
// nearest point is one of the endpoints of the segment
if (segmentProjection < 0)
{
chosen = ep0;
segmentProjection = 0;
return Vec3::distance (point, ep0);
}
if (segmentProjection > segmentLength)
{
chosen = ep1;
segmentProjection = segmentLength;
return Vec3::distance (point, ep1);
}
// otherwise nearest point is projection point on segment
chosen = segmentNormal * segmentProjection;
chosen += ep0;
return Vec3::distance (point, chosen);
}
// ----------------------------------------------------------------------------
|
25628699a18c377d2fbea29a4a003920aa3209fd
|
9c0fc36cc1f0d513c83ac1a1aeb121dc160278c9
|
/rtmp_flv/FlvTag.h
|
a66577e1375817b90bb720f3de8d497f928a7d93
|
[] |
no_license
|
wangfuli217/MyTinyTests
|
93f9539018b7904f737ee8c0ced7133113817e0a
|
c09023a176039ead83b44469d1cff4b00e689776
|
refs/heads/master
| 2022-04-05T04:22:00.271313
| 2020-02-22T08:49:39
| 2020-02-22T08:49:39
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 932
|
h
|
FlvTag.h
|
#ifndef FLV_TAG_H_
#define FLV_TAG_H_
#include "FlvCommon.h"
#include "FlvTagHeader.h"
class FlvTagData{};
enum FlvTagType{
kFlyTagTypeAudio = 8,
kFlyTagTypeVideo = 9,
kFlyTagTypeScriptData = 18,
};
class FlvTag : public FlvBase{
public:
explicit FlvTag(char* buff, int len);
~FlvTag();
public:
void Dump();
const static int kMinTagLength {11}; //until StreamID
public:
static uint32_t FetchPreviousTagSize(char * buff, int len);
const static int kPreviousTagSizeTypeLength {4};
FlvTagType GetTagType();
char * GetDataPointer();
int GetTagDataLength();
private:
uint8_t reserved_ : 2;
uint8_t filter_ : 1;
uint8_t tag_type_ : 5;
uint32_t data_size_;
uint32_t timestamp_;
uint32_t stream_id_;
FlvTagHeader * tag_header_ {nullptr};
FlvTagData * tag_data_ {nullptr};
char * data_pointer_{ nullptr };
int data_length_{ 0 };
};
#endif
|
6d30f4323c2479a067c8bb4ed0a44e7526b8fe1d
|
2d27054c1ee0202302f40094b9c21cf43a455318
|
/appendix/tools/Make/aCode/test/MOCK_glut.cpp
|
e8755205404181b031c0c83e31f62679f25007d0
|
[] |
no_license
|
rblack42/cosc2325.sp19
|
909bafb65c5a3094b8fed076baad70dd00f462f9
|
1cd5b2c0f60041ec6d55bbfc7d315e0c74013fca
|
refs/heads/master
| 2020-04-16T04:59:53.244728
| 2019-01-30T13:40:17
| 2019-01-30T13:40:17
| 165,289,261
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 556
|
cpp
|
MOCK_glut.cpp
|
#include <iostream>
using namespace std;
int state_x, state_y, state_w, state_h;
void init(void) {
cout << "running mock init function" << endl;
}
void getState(void) {
state_x = 50;
state_y = 50;
state_w = 640;
state_h = 480;
}
int getScreenX(void) { //!<return current screen X
return state_x;
}
int getScreenY(void) { //!<return current screen Y
return state_y;
}
int getScreenW(void) { //!<return current screen W
return state_w;
}
int getScreenH(void) { //!<return current screen H
return state_h;
}
|
0b9247c13e34eaa739873891ec18e3f9719de165
|
a6cd82aee15bfa7667a0cbe90bb4f8970c640a8e
|
/ch07/AssocGen.h
|
225491c7895f79136c3ada035bca7616833e1148
|
[] |
no_license
|
wangkendy/TiCpp
|
0d07e9c5aebe3d76e4b2f4bc5c0368f8c999a7bb
|
9466cdfd0aaa91a636dcacc957b06a83fe532d36
|
refs/heads/master
| 2016-09-05T17:50:53.772495
| 2013-03-14T07:33:34
| 2013-03-14T07:33:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 411
|
h
|
AssocGen.h
|
//: C07:AssocGen.h
// The fill_n and generate_n equivalents
// for associative containers.
#ifndef __ASSOCGEN_H__
#define __ASSOCGEN_H__
template<class Assoc, class Count, class T>
void assocFill_n(Assoc& a, Count n, const T& val) {
while (n-- > 0)
a.insert(val);
}
template<class Assoc, class Count, class Gen>
void assocGen_n(Assoc& a, Count n, Gen g) {
while (n-- > 0)
a.insert(g());
}
#endif
///:~
|
de3a09af008e2915bb6446e1f4958fe5ae360fbe
|
f01260fb2fd187295c91dcba48c6283497c2b38b
|
/server/sources/Server/ConvInfo.cpp
|
edf24e37c274f71258d7b8bc1ba8bdde12d2394a
|
[] |
no_license
|
loic-lopez/cpp_babel
|
7b92414d7643543eb72a2adfc2067d423762085b
|
e95a44e318f5605447e232004b39dc23fb2033ad
|
refs/heads/master
| 2020-04-24T13:02:38.117974
| 2019-02-22T02:24:05
| 2019-02-22T02:24:05
| 171,974,745
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,302
|
cpp
|
ConvInfo.cpp
|
// ██████╗ █████╗ ██████╗ ███████╗██╗ ██████╗ ██╗ ██╗███████╗██████╗
// ██╔══██╗██╔══██╗██╔══██╗ ██╔════╝██║ ██╔═══██╗██║ ██║██╔════╝██╔══██╗
// ██████╔╝███████║██████╔╝ █████╗ ██║ ██║ ██║██║ ██║█████╗ ██║ ██║
// ██╔══██╗██╔══██║██╔══██╗ ██╔══╝ ██║ ██║ ██║██║ ██║██╔══╝ ██║ ██║
// ██████╔╝██║ ██║██████╔╝ ███████╗███████╗ ╚██████╔╝╚██████╔╝███████╗██████╔╝
// ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═════╝
// ConvInfo.cpp created 28/09/2017
|
19b38d29ce439e94cecf68ac7b5f87a3cdbee57b
|
9bdc01fddc660053e23eaf89302f9b8e5daaefdf
|
/src/elements/roadmap.cpp
|
ce2e795a53f9c67f9f3d61a8ca0101a5a122bb1e
|
[] |
no_license
|
hello-starry/MotionExplorer
|
51d4ca1a1325567968ac2119de7c96b0345e5b10
|
01472004a1bc1272ce32a433fe6bde81eb962775
|
refs/heads/master
| 2023-08-14T21:20:22.073477
| 2021-09-07T17:51:20
| 2021-09-07T17:51:20
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 9,561
|
cpp
|
roadmap.cpp
|
#include "roadmap.h"
#include "gui/common.h"
#include "common.h"
#include "planner/cspace/cspace_multiagent.h"
#include <ompl/multilevel/datastructures/PlannerDataVertexAnnotated.h>
#include "planner/cspace/validitychecker/validity_checker_ompl.h"
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/foreach.hpp>
#define foreach BOOST_FOREACH
using namespace GLDraw;
using Graph = ob::PlannerData::Graph;
namespace om = ompl::multilevel;
double sizeVertex{6};
double widthEdge{1};
double widthPath{25};
Roadmap::Roadmap(const ob::PlannerDataPtr pd, std::vector<CSpaceOMPL*> cspace_levels):
pd_(pd), cspace_levels_(cspace_levels)
{
}
uint Roadmap::numEdges()
{
if(pd_ == nullptr) return 0;
return pd_->numEdges();
}
uint Roadmap::numVertices()
{
if(pd_ == nullptr) return 0;
return pd_->numVertices();
}
Vector3 Roadmap::VectorFromVertex(const ob::PlannerDataVertex *v, int ridx)
{
const om::PlannerDataVertexAnnotated *va = dynamic_cast<const om::PlannerDataVertexAnnotated*>(v);
Vector3 q;
CSpaceOMPL *cspace = cspace_levels_.at(current_level_);
if(va!=nullptr)
{
int vLevel = va->getLevel();
q = cspace_levels_.at(vLevel)->getXYZ(va->getBaseState(), ridx);
}else{
q = cspace->getXYZ(v->getState(), ridx);
}
if(draw_planar) q[2] = 0.0;
return q;
}
void Roadmap::DrawGLRoadmapVertices(GUIState &state, int ridx)
{
for(uint vidx = 0; vidx < pd_->numVertices(); vidx++)
{
glPointSize(sizeVertex);
setColor(cVertex);
ob::PlannerDataVertex *vd = &pd_->getVertex(vidx);
const om::PlannerDataVertexAnnotated *va = dynamic_cast<const om::PlannerDataVertexAnnotated*>(vd);
if(va != nullptr)
{
if((int)va->getLevel() != current_level_) continue;
if(va->getComponent() > 1 && !state("draw_planner_rejected_samples"))
{
std::cout << "REJECTED" << std::endl;
continue;
}
if(va->getComponent() == 1)
{
setColor(cVertexComponentGoal);
}else if(va->getComponent() > 1)
{
setColor(cVertexComponentOut);
}
}
glPushMatrix();
Vector3 q = VectorFromVertex(vd, ridx);
if(pd_->isStartVertex(vidx))
{
glPointSize(2*sizeVertex);
setColor(cVertexStart);
}else{
if(pd_->isGoalVertex(vidx))
{
glPointSize(2*sizeVertex);
setColor(cVertexGoal);
}
}
drawPoint(q);
glPopMatrix();
}
}
void Roadmap::DrawGLEdgeStateToState(CSpaceOMPL *space, const ob::State *s, const ob::State *t, int ridx)
{
Vector3 a = space->getXYZ(s, ridx);
Vector3 b = space->getXYZ(t, ridx);
if(draw_planar) a[2] = b[2] = 0.0;
drawLineSegment(a, b);
}
void Roadmap::DrawGLEdge(CSpaceOMPL *space, const ob::State *s, const ob::State *t, int ridx)
{
ob::StateSpacePtr stateSpace = space->SpaceInformationPtr()->getStateSpace();
// DrawGLEdgeStateToState(space, s, t, ridx);
int nd = stateSpace->validSegmentCount(s, t);
if(nd <= 1)
{
DrawGLEdgeStateToState(space, s, t, ridx);
}else
{
stateSpace->copyState(stateTmpOld, s);
for (int j = 1; j <= nd; j++)
{
stateSpace->interpolate(s, t, (double)j / (double)nd, stateTmpCur);
DrawGLEdgeStateToState(space, stateTmpOld, stateTmpCur, ridx);
stateSpace->copyState(stateTmpOld, stateTmpCur);
}
}
}
void Roadmap::DrawGLRoadmapEdges(GUIState &state, int ridx)
{
if(pd_->numVertices() <= 0) return;
glPushMatrix();
glLineWidth(widthEdge);
CSpaceOMPL *cspace = cspace_levels_.at(current_level_);
ob::StateSpacePtr stateSpace = cspace->SpaceInformationPtr()->getStateSpace();
stateTmpCur = stateSpace->allocState();
stateTmpOld = stateSpace->allocState();
for(uint vidx = 0; vidx < pd_->numVertices(); vidx++)
{
setColor(cEdge);
ob::PlannerDataVertex *v = &pd_->getVertex(vidx);
const om::PlannerDataVertexAnnotated *va = dynamic_cast<const om::PlannerDataVertexAnnotated*>(v);
if(va != nullptr)
{
if((int)va->getLevel() != current_level_) continue;
if(va->getComponent() > 1 && !state("draw_planner_rejected_samples"))
{
continue;
}
if(va->getComponent() != 0)
{
setColor(cVertexComponentGoal);
}
}
const ob::State *vState;
if(va!=nullptr)
{
vState = va->getBaseState();
}else{
vState = v->getState();
}
std::vector<uint> edgeList;
pd_->getEdges(vidx, edgeList);
for(uint j = 0; j < edgeList.size(); j++){
ob::PlannerDataVertex *w = &pd_->getVertex(edgeList.at(j));
const om::PlannerDataVertexAnnotated *wa = dynamic_cast<const om::PlannerDataVertexAnnotated*>(w);
const ob::State *wState;
if(wa!=nullptr)
{
wState = wa->getBaseState();
}else{
wState = w->getState();
}
DrawGLEdge(cspace, vState, wState, ridx);
}
}
stateSpace->freeState(stateTmpCur);
stateSpace->freeState(stateTmpOld);
glPopMatrix();
}
void Roadmap::DrawGLPlannerData(GUIState &state)
{
glEnable(GL_BLEND);
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
CSpaceOMPL* cspace = cspace_levels_.at(current_level_);
if(cspace->isMultiAgent())
{
CSpaceOMPLMultiAgent *cma = static_cast<CSpaceOMPLMultiAgent*>(cspace);
std::vector<int> idxs = cma->GetRobotIdxs();
foreach(int i, idxs)
{
if(state("draw_roadmap_vertices")) DrawGLRoadmapVertices(state, i);
if(state("draw_roadmap_edges")) DrawGLRoadmapEdges(state, i);
}
}else{
if(state("draw_roadmap_vertices")) DrawGLRoadmapVertices(state);
if(state("draw_roadmap_edges")) DrawGLRoadmapEdges(state);
}
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glDisable(GL_BLEND);
}
void Roadmap::DrawGL(GUIState& state, int level)
{
current_level_ = level;
if(pd_!=nullptr) DrawGLPlannerData(state);
}
bool Roadmap::Save(const char* fn)
{
if(numVertices() <= 0 && numEdges() <= 0) return false;
TiXmlDocument doc;
TiXmlElement *node = CreateRootNodeInDocument(doc);
bool s = Save(node);
doc.LinkEndChild(node);
doc.SaveFile(fn);
return s;
}
bool Roadmap::Save(TiXmlElement *node)
{
node->SetValue("roadmap");
AddSubNode(*node, "num_vertices", numVertices());
AddSubNode(*node, "num_edges", numEdges());
{
AddComment(*node, "vertices");
ob::SpaceInformationPtr si = cspace_levels_.back()->SpaceInformationPtr();
ob::StateSpacePtr space = si->getStateSpace();
for(uint vidx = 0; vidx < pd_->numVertices(); vidx++){
om::PlannerDataVertexAnnotated *v =
dynamic_cast<om::PlannerDataVertexAnnotated*>(&pd_->getVertex(vidx));
if(v != nullptr)
{
if((int)v->getLevel() != current_level_) continue;
}
ob::PlannerDataVertex *vd = &pd_->getVertex(vidx);
std::vector<double> state_serialized;
space->copyToReals(state_serialized, vd->getState());
TiXmlElement *subnode = ReturnSubNodeVector(*node, "state", state_serialized);
if(v==nullptr){
subnode->SetAttribute("feasible", "yes");
}
auto checker = dynamic_cast<OMPLValidityChecker*>(si->getStateValidityChecker().get());
if(checker!=nullptr)
{
double d = checker->constrainedness(vd->getState());
subnode->SetDoubleAttribute("cost", (double)d);
auto dx = checker->costGradient(vd->getState());
std::stringstream dxs;
dxs << dx;
subnode->SetAttribute("gradient", dxs.str());
}
node->InsertEndChild(*subnode);
}
}
{
AddComment(*node, "edges");
ob::SpaceInformationPtr si = cspace_levels_.back()->SpaceInformationPtr();
ob::StateSpacePtr space = si->getStateSpace();
ob::State* stateTmp = space->allocState();
for(uint vidx = 0; vidx < pd_->numVertices(); vidx++)
{
om::PlannerDataVertexAnnotated *va =
dynamic_cast<om::PlannerDataVertexAnnotated*>(&pd_->getVertex(vidx));
if(va != nullptr)
{
if((int)va->getLevel() != current_level_) continue;
}
std::vector<unsigned int> edgeList;
pd_->getEdges(vidx, edgeList);
ob::PlannerDataVertex *v = &pd_->getVertex(vidx);
for(uint k = 0; k < edgeList.size(); k++)
{
ob::PlannerDataVertex *vk = &pd_->getVertex(edgeList.at(k));
TiXmlElement* node_edge = new TiXmlElement("edge");
std::vector<double> state_serialized;
const ob::State *s = v->getState();
const ob::State *t = vk->getState();
const int nd = space->validSegmentCount(s, t);
if(nd <= 1)
{
// DrawGLEdgeStateToState(space, s, t, ridx);
space->copyToReals(state_serialized, s);
TiXmlElement *s1 = ReturnSubNodeVector(*node, "state", state_serialized);
node_edge->InsertEndChild(*s1);
space->copyToReals(state_serialized, t);
TiXmlElement *s2 = ReturnSubNodeVector(*node, "state", state_serialized);
node_edge->InsertEndChild(*s2);
}else
{
for (int j = 0; j <= nd; j++)
{
space->interpolate(s, t, (double)j / (double)nd, stateTmp);
space->copyToReals(state_serialized, stateTmp);
TiXmlElement *snode = ReturnSubNodeVector(*node, "state", state_serialized);
node_edge->InsertEndChild(*snode);
}
}
node->InsertEndChild(*node_edge);
}
}
space->freeState(stateTmp);
}
return true;
}
|
f854ec5edceda4b554933e322dfd926660eb53e0
|
f80d19d58816c14cf51b6457d017ccb1b01918ea
|
/src/world/chunk.cpp
|
757464f3924f9b3d8f6669d27dbd2995801a6eb7
|
[] |
no_license
|
piochelepiotr/minecraftClone
|
378a277d88d35ab36f1ef517598800b99355e6c5
|
c4389f5f4f7a8164658e7943050119a0508dcd00
|
refs/heads/master
| 2021-05-11T02:53:44.298323
| 2018-11-03T02:24:20
| 2018-11-03T02:24:20
| 117,897,006
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,689
|
cpp
|
chunk.cpp
|
#include "chunk.h"
#include <iostream>
#include "toolbox/perlinnoise.h"
using namespace std;
const int Chunk::m_numberRowsTextures = 2;
const int Chunk::WORLD_HEIGHT = 5;
Chunk::Chunk(int startX, int startY, int startZ, ModelTexture *texture, Loader *loader) : Entity()
{
m_position = glm::vec3(startX, startY, startZ);
m_loader = loader;
for(int x = 0; x < CHUNK_SIZE; x++)
{
for(int z = 0; z < CHUNK_SIZE; z++)
{
int height = (int) (PerlinNoise::noise((float) (x+startX) / BIOME_SIZE, (float) (z+startZ) / BIOME_SIZE)*WORLD_HEIGHT*CHUNK_SIZE);
height -= startY;
for(int y = 0; y < std::min(height, CHUNK_SIZE); y++)
{
m_blocks[x][y][z] = Block::DIRT;
}
/*if(height > 0)
{
m_blocks[x][height-1][z] = Block::GRASS;
}*/
for(int y = std::max(0,height); y < CHUNK_SIZE; y++)
{
m_blocks[x][y][z] = Block::AIR;
}
}
}
buildFaces(loader);
m_model = new TexturedModel(m_rawModel, texture);
}
Chunk::~Chunk()
{
delete m_model;
delete m_rawModel;
}
void Chunk::buildFaces(Loader *loader)
{
vector<glm::vec3> vertices;
vector<glm::vec2> textures;
vector<glm::vec3> normals;
vector<int> indexes;
for(int x = 0; x < CHUNK_SIZE; x++)
{
for(int y = 0; y < CHUNK_SIZE; y++)
{
for(int z = 0; z < CHUNK_SIZE; z++)
{
Block::ID b = m_blocks[x][y][z];
Block::ID a = Block::AIR;
//add face if not block isn't air and the block next to it is air
/*faces are :
* up ( + y)
* bottom (-y)
* right (+x)
* left (-x)
* front (+z)
* back (-z)
* 0 point is : bottom, left, back
*/
//up
if(!(b == a || (y + 1 < CHUNK_SIZE && m_blocks[x][y+1][z] != a)))
{
//std::cout << "up" << std::endl;
glm::vec3 n(0,1,0);
glm::vec3 p1(x , y+1, z );
glm::vec3 p2(x+1, y+1, z );
glm::vec3 p3(x+1, y+1, z+1);
glm::vec3 p4(x , y+1, z+1);
addFace(vertices, textures, normals, indexes, p1, p2, p3, p4, n, b);
}
//bottom
if(!(b == a || (y - 1 > 0 && m_blocks[x][y-1][z] != a)))
{
//std::cout << "bottom" << std::endl;
glm::vec3 n(0,-1,0);
glm::vec3 p1(x , y, (z ));
glm::vec3 p2(x+1, y, (z ));
glm::vec3 p3(x+1, y, (z+1));
glm::vec3 p4(x , y, (z+1));
addFace(vertices, textures, normals, indexes, p1, p2, p3, p4, n, b);
}
//right
if(!(b == a || (x + 1 < CHUNK_SIZE && m_blocks[x+1][y][z] != a)))
{
//std::cout << "right" << std::endl;
glm::vec3 n(1,0,0);
glm::vec3 p1((x+1), (y+1), (z+1));
glm::vec3 p2((x+1), (y+1), (z ));
glm::vec3 p3((x+1), (y ), (z ));
glm::vec3 p4((x+1), (y ), (z+1));
addFace(vertices, textures, normals, indexes, p1, p2, p3, p4, n, b);
}
//left
if(!(b == a || (x - 1 > 0 && m_blocks[x-1][y][z] != a)))
{
//std::cout << "left" << std::endl;
glm::vec3 n(-1,0,0);
glm::vec3 p1((x), (y+1), (z ));
glm::vec3 p2((x), (y+1), (z+1));
glm::vec3 p3((x), (y ), (z+1));
glm::vec3 p4((x), (y ), (z ));
addFace(vertices, textures, normals, indexes, p1, p2, p3, p4, n, b);
}
//front
if(!(b == a || (z + 1 < CHUNK_SIZE && m_blocks[x][y][z+1] != a)))
{
//std::cout << "front" << std::endl;
glm::vec3 n(0,0,1);
glm::vec3 p1((x ), (y+1), (z+1));
glm::vec3 p2((x+1), (y+1), (z+1));
glm::vec3 p3((x+1), (y ), (z+1));
glm::vec3 p4((x ), (y ), (z+1));
addFace(vertices, textures, normals, indexes, p1, p2, p3, p4, n, b);
}
//back
if(!(b == a || (z - 1 > 0 && m_blocks[x][y][z-1] != a)))
{
//std::cout << "back" << std::endl;
glm::vec3 n(0,0,-1);
glm::vec3 p1((x+1), (y+1), (z));
glm::vec3 p2((x ), (y+1), (z));
glm::vec3 p3((x ), (y ), (z));
glm::vec3 p4((x+1), (y ), (z));
addFace(vertices, textures, normals, indexes, p1, p2, p3, p4, n, b);
}
}
}
}
buildRawModel(loader, vertices, textures, normals, indexes);
}
void Chunk::addFace(std::vector<glm::vec3> &vertices, std::vector<glm::vec2> &textures,
std::vector<glm::vec3> &normals, std::vector<int> &indexes,
const glm::vec3 &p1, const glm::vec3 &p2, const glm::vec3 &p3,
const glm::vec3 &p4, const glm::vec3 &n,
Block::ID b)
{
if(b == Block::GRASS)
{
if(n == glm::vec3(0,-1,0))
{
b = Block::DIRT;
}
else if(n != glm::vec3(0,1,0))
{
b = Block::GRASS_SIDE;
}
}
int textureX = (int) b % m_numberRowsTextures;
int textureY = (int) b / m_numberRowsTextures;
float offsetTextureX = (float) textureX / (float) m_numberRowsTextures;
float offsetTextureY = (float) textureY / (float) m_numberRowsTextures;
glm::vec2 offsetTexture(offsetTextureX, offsetTextureY);
glm::vec2 t1(0,0);
glm::vec2 t2(1,0);
glm::vec2 t3(1,1);
glm::vec2 t4(0,1);
t1 = t1/((float) m_numberRowsTextures) + offsetTexture;
t2 = t2/((float) m_numberRowsTextures) + offsetTexture;
t3 = t3/((float) m_numberRowsTextures) + offsetTexture;
t4 = t4/((float) m_numberRowsTextures) + offsetTexture;
vertices.push_back(p1);
vertices.push_back(p2);
vertices.push_back(p3);
vertices.push_back(p4);
normals.push_back(n);
normals.push_back(n);
normals.push_back(n);
normals.push_back(n);
textures.push_back(t1);
textures.push_back(t2);
textures.push_back(t3);
textures.push_back(t4);
int start_index = 0;
if(indexes.size() > 0)
{
start_index = indexes.back() + 1;
}
indexes.push_back(start_index);
indexes.push_back(start_index + 1);
indexes.push_back(start_index + 2);
indexes.push_back(start_index);
indexes.push_back(start_index + 2);
indexes.push_back(start_index + 3);
}
void Chunk::buildRawModel(Loader *loader, std::vector<glm::vec3> &vertices, std::vector<glm::vec2> &textures,
std::vector<glm::vec3> &normals, std::vector<int> &indexes)
{
int size = vertices.size();
int ind_size = indexes.size();
float *verticesArray = new float[size*3];
float *texturesArray = new float[size*2];
float *normalsArray = new float[size*3];
int *indexesArray = new int[ind_size];
for(int i = 0; i < size; i++)
{
verticesArray[3*i] = vertices[i].x;
verticesArray[3*i+1] = vertices[i].y;
verticesArray[3*i+2] = vertices[i].z;
texturesArray[2*i] = textures[i].x;
texturesArray[2*i+1] = textures[i].y;
normalsArray[3*i] = normals[i].x;
normalsArray[3*i+1] = normals[i].y;
normalsArray[3*i+2] = normals[i].z;
}
for(int i = 0; i < ind_size; i++)
{
indexesArray[i] = indexes[i];
}
m_rawModel = loader->loadToVao(verticesArray, size*3, texturesArray, size*2 ,indexesArray, ind_size, normalsArray, size*3);
}
float Chunk::height(float x, float z) const
{
int X = (int) x;
int Z = (int) z;
for(int y = CHUNK_SIZE; y > 0; y--)
{
if(m_blocks[X][y-1][Z] != Block::AIR)
{
return y;
}
}
return 0;
}
void Chunk::setBlock(int x, int y, int z, Block::ID b)
{
std::cout << "SETTING BLOCK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
m_blocks[x][y][z] = b;
delete m_rawModel;
buildFaces(m_loader);
m_model->setModel(m_rawModel);
}
|
c3324a802738ed4ad86a6526c672a3e3bdbbc918
|
269011a0a9d9acb6c4faf36ef4e5c9ddbcbec6f8
|
/test/tmvaEvaluator.cc
|
257195891c5358728745625183095fee558fa228
|
[
"MIT"
] |
permissive
|
RemKamal/ROOTDataHelpers
|
77858a65d40834a8f0e8c38bfb400c53c1291596
|
e3cfe3fd284412c1a97db8fbe323210fe2aa301b
|
refs/heads/master
| 2021-01-21T23:29:24.649372
| 2015-08-24T12:06:56
| 2015-08-24T12:07:15
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,782
|
cc
|
tmvaEvaluator.cc
|
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <TFile.h>
#include <TTree.h>
#include <TMVA/Factory.h>
#include <TMVA/Reader.h>
#include <interface/AutoTree.hh>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
int exit_with_message(const char* message, int code) {
cerr << message << endl;
return code;
}
int main(int argc, char** argv) {
if (argc != 2) {
return exit_with_message("./mva config.ini", 0);
}
boost::property_tree::ptree pt;
boost::property_tree::ini_parser::read_ini(argv[1], pt);
const string tree_fn = pt.get<string>("Input.data_filename");
const string tree_name = pt.get<string>("Input.tree_name");
const string mvas = pt.get<string>("Input.mvas");
TFile infile(tree_fn.c_str());
if (infile.IsZombie()) {
return exit_with_message("Could not open file", 1);
}
TTree* tree = (TTree*)infile.Get(tree_name.c_str());
if (tree == 0) {
return exit_with_message("Could not open tree", 1);
}
AutoTree atree(tree);
cout << atree.getTreeStructure().toString();
atree.getEntry(0);
vector<string> mva_vec = split(mvas, ',');
map<string, TMVA::Reader*> readers;
TreeStructure outStructure;
for (auto& mva_name : mva_vec) {
auto& mva_sec = pt.get_child(mva_name);
const string weight_fn = mva_sec.get<string>("weight_filename");
const string vars_tree = mva_sec.get<string>("tree_variables");
const string vars_mva = mva_sec.get<string>("mva_variables");
const vector<string> vars_tree_vec = split(vars_tree, ',');
const vector<string> vars_mva_vec = split(vars_mva, ',');
const string specs_tree = mva_sec.get<string>("tree_spectators");
const string specs_mva = mva_sec.get<string>("mva_spectators");
const vector<string> specs_tree_vec = split(specs_tree, ',');
const vector<string> specs_mva_vec = split(specs_mva, ',');
if (specs_tree_vec.size() != specs_mva_vec.size()) {
return exit_with_message("mismatch in tree-mva spectators", 1);
}
readers[mva_name] = new TMVA::Reader("!V:Silent");
for (unsigned int i=0; i<vars_tree_vec.size(); i++) {
float* p = atree.getAddress<float>(vars_tree_vec[i]);
if (p == 0) {
return exit_with_message((string("could not find branch ")+vars_tree_vec[i]).c_str(), 1);
}
readers[mva_name]->AddVariable(
vars_mva_vec[i].c_str(),
p
);
outStructure.branches[mva_name] = BranchType(BranchType::Type::FLOAT);
}
for (unsigned int i=0; i<specs_tree_vec.size(); i++) {
float* p = atree.getAddress<float>(specs_tree_vec[i]);
if (p == 0) {
return exit_with_message((string("could not find branch ")+vars_tree_vec[i]).c_str(), 1);
}
readers[mva_name]->AddSpectator(
specs_mva_vec[i].c_str(),
p
);
}
readers[mva_name]->BookMVA(mva_name.c_str(), weight_fn.c_str());
}
TFile outfile(pt.get<string>("Output.filename").c_str(), "RECREATE");
AutoTree outtree(outStructure, pt.get<string>("Output.tree_name"));
for(unsigned int iev=0; iev < atree.tree->GetEntries(); iev++) {
atree.getEntry(iev);
for (auto& mva_name : mva_vec) {
float mva = readers[mva_name]->EvaluateMVA(mva_name.c_str());
outtree.floats_map[mva_name]->val = mva;
}
outtree.tree->Fill();
}
infile.Close();
outfile.Write();
outfile.Close();
return 0;
}
|
e186f0fa42992d1c96f308b945df75b0ebad4482
|
3ea34c23f90326359c3c64281680a7ee237ff0f2
|
/Data/3536/H
|
599b0e5345fb6532c40c8bcf4261b89cf8a98202
|
[] |
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
| 92,217
|
H
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source Cstd::filesystem::create_directory();FD |
| \\ / 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/3536";
object H;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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)
(-7.26421697010216e-13,7.54512792003405e-12,-6.18624845610795e-12)
(-8.59151534958766e-13,1.69009999031671e-11,-5.78425150058259e-12)
(-2.86151735065385e-13,2.84880424543185e-11,-5.15061631927046e-12)
(-2.45203559006738e-13,4.47999007781754e-11,-4.31077491686781e-12)
(7.60490012616215e-13,7.02040844943092e-11,-3.63485533418351e-12)
(1.56330230293587e-12,1.08223766649373e-10,-2.55484707069424e-12)
(1.31891130534187e-12,1.70281929325361e-10,-1.34763394920959e-12)
(8.98268751865109e-13,2.74198507194824e-10,-2.63899597399303e-13)
(1.06469332736096e-12,4.47026301489875e-10,-5.86161240434232e-14)
(2.10787400845014e-12,6.87647295825922e-10,-1.47243708765253e-13)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-7.54831349557788e-13,7.02838681983733e-12,-1.36722635952859e-11)
(-1.53651316443065e-12,1.60296181649352e-11,-1.31537648154974e-11)
(-5.60180972290736e-13,2.73498776170118e-11,-1.21972197611509e-11)
(1.63134281859308e-13,4.35580096155925e-11,-1.06850519472902e-11)
(1.83565979414244e-13,6.86702201689791e-11,-8.74079404438194e-12)
(5.498424960132e-13,1.06910945068175e-10,-6.37094559398208e-12)
(7.36408677881985e-14,1.6965538968713e-10,-4.03595277610813e-12)
(-5.15669179765485e-13,2.74528437399777e-10,-2.34278441182722e-12)
(1.40485405800166e-14,4.47417152345631e-10,-1.58937920598721e-12)
(1.26771210447849e-12,6.88138236063389e-10,-1.05727807953613e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-5.55557049819201e-13,6.64220830025332e-12,-2.46583054351602e-11)
(-2.23716309803006e-12,1.47660260719751e-11,-2.4042800967983e-11)
(-1.41589146130552e-12,2.52183019487292e-11,-2.30569704084518e-11)
(3.94959455896386e-13,4.07377033612347e-11,-2.10148530560325e-11)
(5.88634345609981e-13,6.50553376708671e-11,-1.75730186913589e-11)
(-3.64728768324213e-13,1.03413475000981e-10,-1.37130138138187e-11)
(-1.91837449749014e-12,1.67273158174804e-10,-9.9107549173004e-12)
(-3.63221513357404e-12,2.73843583406652e-10,-7.19519468895452e-12)
(-3.72550166872743e-12,4.47507760771764e-10,-5.37080832189865e-12)
(-3.19133732550019e-12,6.8847151797701e-10,-3.1657627494348e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-6.75776539527006e-13,6.18826182885476e-12,-4.18894329138573e-11)
(-2.60772091404657e-12,1.29883826459967e-11,-4.05919087394102e-11)
(-2.75223359387952e-12,2.20191961593618e-11,-3.91021105065708e-11)
(-1.25684834324802e-12,3.62278814454743e-11,-3.6833259979102e-11)
(-8.2577074418024e-13,5.94854808275345e-11,-3.33129359098885e-11)
(-1.93484579599592e-12,9.74908444401003e-11,-2.90432438406198e-11)
(-4.35867102782791e-12,1.62730807894372e-10,-2.39905255668705e-11)
(-7.12894249874673e-12,2.71516250599725e-10,-1.8817112348748e-11)
(-8.09559226201205e-12,4.45726546230899e-10,-1.35520736281566e-11)
(-9.10842097460138e-12,6.86449915803972e-10,-7.26566361409101e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-4.17591651699469e-13,4.99581664854406e-12,-6.61356108986462e-11)
(-2.4289611101353e-12,1.029189443098e-11,-6.51532592051106e-11)
(-3.64412269164828e-12,1.78679526277285e-11,-6.39538861854321e-11)
(-3.66105437229555e-12,3.06519276490895e-11,-6.19140531439754e-11)
(-4.70509836197366e-12,5.26665313162114e-11,-5.86552582499738e-11)
(-5.94278351131928e-12,8.97301558012927e-11,-5.43142794082057e-11)
(-9.42125511564318e-12,1.55823798117418e-10,-4.89044057088363e-11)
(-1.24019187868948e-11,2.66408045450285e-10,-3.97979040095484e-11)
(-1.32779480895546e-11,4.40445137788519e-10,-2.82024296355978e-11)
(-1.46510061646296e-11,6.80449877401947e-10,-1.45909004293502e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(4.24047040710211e-13,3.85134279007066e-12,-1.02917635948878e-10)
(-7.08676107087576e-13,7.47165211966255e-12,-1.02470722682634e-10)
(-1.92953616529004e-12,1.33021551539732e-11,-1.01547196080923e-10)
(-3.55996579360969e-12,2.43895769736202e-11,-9.98275312903948e-11)
(-5.89726591143878e-12,4.46614962274918e-11,-9.67263215456929e-11)
(-9.11820302714794e-12,8.11494740336417e-11,-9.18821183089952e-11)
(-1.44139976217942e-11,1.47806909726208e-10,-8.45759908539167e-11)
(-1.77149945171839e-11,2.56725212429144e-10,-7.11876387037078e-11)
(-1.85725399332663e-11,4.28602857351551e-10,-5.14551780930165e-11)
(-1.94439939176224e-11,6.67009586830723e-10,-2.69722785601284e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(3.0940895812765e-13,2.91533968999839e-12,-1.63818351708213e-10)
(-2.69262362269533e-13,5.22435440464097e-12,-1.63405370171095e-10)
(-6.59796685811125e-13,9.73598983007764e-12,-1.62793164492544e-10)
(-3.29774385142036e-12,1.88822452837251e-11,-1.61472163318728e-10)
(-7.41351693531775e-12,3.65939743422203e-11,-1.58508722156326e-10)
(-1.28129761744166e-11,7.10417087297768e-11,-1.53157919846874e-10)
(-1.85544415355303e-11,1.34969481000888e-10,-1.42385283018991e-10)
(-2.18807512061202e-11,2.38862769626693e-10,-1.23361679456236e-10)
(-2.36300617932772e-11,4.05789310068362e-10,-9.20685059678846e-11)
(-2.45411409295571e-11,6.41226626764417e-10,-4.98838112281838e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(5.71127942421986e-13,1.98673631027981e-12,-2.67374505676995e-10)
(3.32438718730015e-13,3.44642901188132e-12,-2.66430460639659e-10)
(9.0972307765173e-14,7.208630365417e-12,-2.6581390963477e-10)
(-2.95564105942923e-12,1.47085268805986e-11,-2.64236612568594e-10)
(-7.84995007179204e-12,2.97682658186153e-11,-2.60473957949076e-10)
(-1.39409228577729e-11,6.01501430239071e-11,-2.53692436756745e-10)
(-2.03458440872225e-11,1.15681598947429e-10,-2.38820723691032e-10)
(-2.51448042373717e-11,2.08486447764164e-10,-2.10306982645996e-10)
(-2.83971050742797e-11,3.64569881329234e-10,-1.6262557924934e-10)
(-3.07977242690617e-11,5.92204554923965e-10,-9.19765435542234e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.95107276335708e-12,1.32011985454809e-12,-4.39419880201081e-10)
(2.44539395866017e-12,2.57952342677216e-12,-4.37886966260829e-10)
(2.23093076227431e-12,5.24424297409627e-12,-4.36511211451233e-10)
(-1.40304726977413e-12,1.06985591585564e-11,-4.34093378636692e-10)
(-7.01306280699113e-12,2.24126176279357e-11,-4.28834383636313e-10)
(-1.41664320186577e-11,4.50098775404069e-11,-4.18998006336493e-10)
(-2.196223713052e-11,8.67765223397921e-11,-3.99227022035531e-10)
(-2.92267700425159e-11,1.60767576669928e-10,-3.61139732924096e-10)
(-3.42228035539378e-11,2.94115939964964e-10,-2.92596130825066e-10)
(-3.8183930537159e-11,5.00370852314255e-10,-1.75988304762106e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.83177561367303e-12,4.67215309156255e-13,-6.79384376186441e-10)
(2.67126252518937e-12,1.41810460653422e-12,-6.78204225473462e-10)
(2.83468645782811e-12,2.8553212321524e-12,-6.76491427281217e-10)
(-1.24300782991516e-12,5.77790126870879e-12,-6.7340947641766e-10)
(-7.15524171124438e-12,1.23352571254836e-11,-6.67308131586664e-10)
(-1.51988365219179e-11,2.45184678669063e-11,-6.55241636314783e-10)
(-2.37500488079339e-11,4.7677865766341e-11,-6.31958971953669e-10)
(-3.24752214820507e-11,9.11181651937334e-11,-5.86081770985588e-10)
(-3.81088075412893e-11,1.76728464159464e-10,-4.9689767417298e-10)
(-4.23271103446881e-11,3.23422273870317e-10,-3.21721426526295e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-6.11677552340666e-13,1.40139162672408e-11,-1.1396984205305e-11)
(-6.21404978040475e-13,3.06659343052048e-11,-1.10217432514955e-11)
(1.21716998393041e-14,5.18670358683745e-11,-1.0116040570187e-11)
(3.20768020876952e-13,8.1471326925732e-11,-8.5962573485096e-12)
(1.21434607441145e-12,1.25735653189012e-10,-6.60042150893499e-12)
(1.66891076269251e-12,1.92423512105059e-10,-3.87901959151744e-12)
(8.61716591855694e-13,2.99170075102315e-10,-1.44102758892006e-12)
(3.63055073453584e-13,4.79498882152822e-10,-4.26814390057906e-14)
(7.62470055907086e-13,8.24276070632086e-10,-2.70509833880768e-14)
(1.46969006188927e-12,1.61474502838645e-09,-2.24270581737032e-13)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-8.87151609763164e-13,1.32599658932857e-11,-2.59026401949041e-11)
(-1.22946612580453e-12,2.93251655239819e-11,-2.52380686405142e-11)
(5.92268821131698e-14,4.97974014148843e-11,-2.3555531957325e-11)
(1.03918263332127e-12,7.85453192273106e-11,-2.05436698969799e-11)
(1.42860002712066e-12,1.22361780070197e-10,-1.62087404174047e-11)
(1.71231974531838e-12,1.89729693473708e-10,-1.05064330115321e-11)
(7.62704015704847e-13,2.97840307425128e-10,-4.78681682592291e-12)
(-5.84220392086996e-13,4.80023513420679e-10,-1.75157870084297e-12)
(-6.08661011571773e-13,8.2560032295109e-10,-1.11649734424408e-12)
(-1.22847888730648e-13,1.61634166612319e-09,-9.83882135991016e-13)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-7.17115045595982e-13,1.22009083691188e-11,-4.73402335186802e-11)
(-1.44535023157801e-12,2.71451938091065e-11,-4.62162059302992e-11)
(-2.58903024333183e-13,4.60073641475395e-11,-4.37613072207258e-11)
(1.46294700697658e-12,7.30383202397769e-11,-3.91713054886383e-11)
(2.29848631136656e-12,1.15041476948749e-10,-3.17949998654962e-11)
(1.75564289603751e-12,1.82623421358591e-10,-2.27605027692336e-11)
(-9.15844453219108e-14,2.93926748114906e-10,-1.3481102470876e-11)
(-3.12926869391204e-12,4.79830862844383e-10,-8.69818620383685e-12)
(-4.1493327004317e-12,8.27044569605094e-10,-6.49091371039376e-12)
(-4.33549790206803e-12,1.61796705536499e-09,-3.85825450032953e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-7.80855533663403e-13,1.06755765338161e-11,-7.79289259488821e-11)
(-1.40103093187272e-12,2.35032270174683e-11,-7.6096252892026e-11)
(-8.69840589720886e-13,3.98079579590699e-11,-7.2990663623173e-11)
(7.98781383925426e-13,6.41591697544726e-11,-6.75079717414564e-11)
(1.72348669787227e-12,1.03358636180582e-10,-5.91362194531435e-11)
(7.73124569068138e-13,1.70039275923084e-10,-4.88242440487161e-11)
(-2.62507446903318e-12,2.8587924422465e-10,-3.69737562406031e-11)
(-7.28577606982708e-12,4.77907778739906e-10,-2.84855796331172e-11)
(-9.10059383316786e-12,8.26342213522042e-10,-2.07500871564783e-11)
(-1.03740461857108e-11,1.6168668965258e-09,-1.11419327140033e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-2.55469486762651e-13,8.1795670321317e-12,-1.20132519351796e-10)
(-8.08091818497812e-13,1.829464220928e-11,-1.18529780240271e-10)
(-1.11815825935161e-12,3.13963633594765e-11,-1.1587965881466e-10)
(-6.57498590835153e-13,5.24740823291197e-11,-1.11107736470921e-10)
(-1.04104211500766e-12,8.78450432923925e-11,-1.04061498887324e-10)
(-2.77197544308575e-12,1.50718205662915e-10,-9.62308366567097e-11)
(-1.05108684236519e-11,2.68965054725638e-10,-8.94538522469889e-11)
(-1.43145601395466e-11,4.71277561031737e-10,-7.00343269182094e-11)
(-1.50471968590946e-11,8.19785573470252e-10,-4.90296217764749e-11)
(-1.5801616023255e-11,1.6086883881016e-09,-2.5357662092533e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(9.13136874539867e-13,6.02640823852034e-12,-1.84498201017104e-10)
(6.15095006219305e-13,1.33870360838889e-11,-1.83164197990721e-10)
(-8.30356319287281e-14,2.29995329958254e-11,-1.80708829152549e-10)
(-1.15384384840985e-12,4.05403473533767e-11,-1.77276937676418e-10)
(-2.67394726285784e-12,7.17892168152549e-11,-1.72046875174018e-10)
(-6.31656517838824e-12,1.32516675155686e-10,-1.64901722419477e-10)
(-1.49649210466979e-11,2.56708695021794e-10,-1.5501398694133e-10)
(-1.9585012325468e-11,4.56588954099569e-10,-1.28784670911875e-10)
(-2.02418921831196e-11,8.00558803885523e-10,-9.21460626595367e-11)
(-2.06333124108274e-11,1.58627673369988e-09,-4.81183399269955e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(8.25030800727017e-13,4.2648494220895e-12,-2.87750673288073e-10)
(8.9645735194053e-13,9.49889947988931e-12,-2.8693973701345e-10)
(5.4656160503616e-13,1.66242968452643e-11,-2.8506536530294e-10)
(-2.08746661070233e-12,3.04782068042235e-11,-2.82598233141194e-10)
(-5.93861072113388e-12,5.64718303597321e-11,-2.79010073716321e-10)
(-1.26940472964238e-11,1.11557200941483e-10,-2.72590744272122e-10)
(-1.8290163044818e-11,2.34389501676535e-10,-2.53107057828769e-10)
(-2.27976028320638e-11,4.25062364108583e-10,-2.21471054091791e-10)
(-2.45953277938115e-11,7.60123138609536e-10,-1.63478752616637e-10)
(-2.54028803166504e-11,1.54054444573475e-09,-8.79107120137777e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.93699360818535e-13,3.0395321381665e-12,-4.66593820635081e-10)
(5.82793298951545e-13,6.69704199493657e-12,-4.65390629009774e-10)
(4.78062632912735e-13,1.24354748958936e-11,-4.63313059505357e-10)
(-2.70832795690926e-12,2.40419162301533e-11,-4.6042389529575e-10)
(-7.27582307346268e-12,4.74249736427561e-11,-4.55974124382052e-10)
(-1.36723704399415e-11,9.86265590737724e-11,-4.47550904240697e-10)
(-1.99545085245492e-11,2.03141701901349e-10,-4.24622736013341e-10)
(-2.51073365399657e-11,3.6903317442589e-10,-3.73237374755903e-10)
(-2.85921994050627e-11,6.8624652054134e-10,-2.87429656735666e-10)
(-3.09405652142275e-11,1.45394853773308e-09,-1.63303803553804e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.27106336849726e-12,2.06642505906199e-12,-8.10531681220216e-10)
(2.23105796930252e-12,4.6255772331664e-12,-8.08662458806154e-10)
(2.20201968968246e-12,8.81376691157827e-12,-8.05509745537227e-10)
(-1.74138438029845e-12,1.79246180259517e-11,-8.01170522778112e-10)
(-6.77207960434823e-12,3.67095430097916e-11,-7.93905839529733e-10)
(-1.34460066461365e-11,7.56670544956846e-11,-7.79628669694714e-10)
(-2.09508696685048e-11,1.5127075859744e-10,-7.47201443073481e-10)
(-2.81209606653539e-11,2.83186583851248e-10,-6.79638968122767e-10)
(-3.34431538114413e-11,5.62011079776503e-10,-5.58948534579637e-10)
(-3.72236568554983e-11,1.2899675678348e-09,-3.49579341008802e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.11884020985099e-12,1.0187974669877e-12,-1.60077184494699e-09)
(2.37656893947814e-12,2.40406909473055e-12,-1.59862612690904e-09)
(2.60805682642025e-12,4.59912793689092e-12,-1.5947378619012e-09)
(-1.5664513922027e-12,9.84115006131573e-12,-1.58930406844722e-09)
(-6.88647985765021e-12,2.05121965826065e-11,-1.57997042238919e-09)
(-1.39630330161381e-11,4.162505152763e-11,-1.56143943728488e-09)
(-2.19493840096994e-11,8.24855424190894e-11,-1.52209600617103e-09)
(-3.05411531008948e-11,1.61048927624386e-10,-1.44155159664683e-09)
(-3.65565910285136e-11,3.51029360620352e-10,-1.28285016028758e-09)
(-4.06262630005538e-11,9.38037365957931e-10,-9.34486352065377e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-2.3296813242578e-13,1.90491751822431e-11,-1.68797438374623e-11)
(-1.8633887804646e-13,4.0576030008351e-11,-1.65950056238356e-11)
(5.62022932482163e-13,6.78846283261364e-11,-1.53599596250014e-11)
(1.25093987917317e-12,1.0559698002647e-10,-1.29717809597591e-11)
(1.86681727558241e-12,1.59480731320628e-10,-8.7750852857713e-12)
(1.92473739214983e-12,2.38261992154571e-10,-3.80220852022089e-12)
(7.93138118401227e-13,3.53700693461472e-10,5.54641105097514e-13)
(-1.77206650409927e-13,5.19233137934481e-10,2.15478577430526e-12)
(-3.64562664355225e-13,7.55246536302319e-10,1.42120648583492e-12)
(-3.51218257266983e-13,1.04286365287126e-09,5.22013228936328e-13)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-4.92665639709124e-13,1.82272523861097e-11,-3.62623599225967e-11)
(-7.32031094497493e-13,3.85967254480789e-11,-3.54685365606827e-11)
(8.37402087831803e-13,6.46054908468656e-11,-3.30985325265024e-11)
(2.21125214165695e-12,1.00685417135492e-10,-2.83025081229433e-11)
(3.04659574328045e-12,1.54315096337593e-10,-2.04033086945749e-11)
(3.09897567430855e-12,2.34418562569804e-10,-9.51924963740857e-12)
(1.64102520026721e-12,3.52598589582458e-10,1.70209072529657e-12)
(-1.02665117174349e-12,5.20772692795653e-10,4.81880312626239e-12)
(-2.18552287317164e-12,7.57513309542378e-10,2.91675550088564e-12)
(-2.73211926638158e-12,1.04509427136848e-09,9.26964515918219e-13)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-3.15810800372118e-13,1.66029484247733e-11,-6.36760817632616e-11)
(-2.58282148515711e-13,3.50425105699906e-11,-6.20878969776674e-11)
(1.35050143265376e-12,5.83796896416562e-11,-5.83287814278775e-11)
(2.96579186876122e-12,9.14886660870503e-11,-5.10606457157131e-11)
(4.94682998290468e-12,1.42374146556313e-10,-3.88052386647304e-11)
(5.06038803311043e-12,2.23308867643142e-10,-2.02204985316764e-11)
(3.17300317804846e-12,3.50151183809058e-10,1.75388713142043e-12)
(-3.41345708277892e-12,5.24810605844846e-10,4.62482478251456e-12)
(-6.07963582664788e-12,7.6245577597753e-10,8.56348555963043e-13)
(-7.09359356374029e-12,1.0489611235587e-09,-8.07305020616675e-13)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.17519089529405e-13,1.41283789132098e-11,-1.02623785475336e-10)
(7.01964608507144e-13,2.98545053664317e-11,-1.00519818566177e-10)
(2.05906212772344e-12,4.9257333487725e-11,-9.5815506756815e-11)
(4.11211651959486e-12,7.7449274074661e-11,-8.68823736651684e-11)
(6.92510418176282e-12,1.22160511177943e-10,-7.19635781883527e-11)
(8.2437070222104e-12,2.00299850885484e-10,-4.8097567551453e-11)
(5.80093842278807e-12,3.43734991489239e-10,-1.41718361582592e-11)
(-8.39105083887124e-12,5.32726219635276e-10,-1.2726630899062e-11)
(-1.21521082226867e-11,7.68956504567857e-10,-1.3997524859232e-11)
(-1.333747047704e-11,1.0522822699694e-09,-9.11797988591594e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.94950194910649e-13,1.0788652659125e-11,-1.5595462983908e-10)
(1.44939288201324e-12,2.32068450874228e-11,-1.53768333616756e-10)
(2.50674975917837e-12,3.77433499508156e-11,-1.49170010287425e-10)
(4.22999880125607e-12,5.94558328584764e-11,-1.4095637423721e-10)
(7.18412213341235e-12,9.36741392111445e-11,-1.28548786125069e-10)
(8.65257065366004e-12,1.55553338919146e-10,-1.14700307887437e-10)
(-1.76740340502562e-11,2.97008438574676e-10,-1.26504902607077e-10)
(-2.06306583493389e-11,5.3934208906432e-10,-8.11934329173198e-11)
(-1.94923869564689e-11,7.70337414067217e-10,-5.49012260223331e-11)
(-1.87476237143455e-11,1.04732650093421e-09,-2.87763082673639e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.34069266475052e-12,7.49546799082506e-12,-2.30789592088297e-10)
(2.04786277189153e-12,1.66311814162162e-11,-2.28620510257267e-10)
(2.86030904283205e-12,2.63270190856116e-11,-2.2459088962851e-10)
(3.67823419849673e-12,4.15745172054403e-11,-2.19138053237432e-10)
(5.49828643788077e-12,6.68306859488251e-11,-2.11577419228231e-10)
(4.75517355759632e-12,1.23442641119698e-10,-2.02470065624208e-10)
(-1.88750437299029e-11,3.01422907619123e-10,-2.09186971645517e-10)
(-2.46970305879294e-11,5.30251773867762e-10,-1.62744214542802e-10)
(-2.38339496387282e-11,7.51239979356429e-10,-1.12319080840328e-10)
(-2.30193643734453e-11,1.02215773558635e-09,-5.76307927302097e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.23941181203496e-12,4.86446775613157e-12,-3.3988407831074e-10)
(1.82394312391007e-12,1.13555879105741e-11,-3.38446674053859e-10)
(2.26825139317507e-12,1.77865683405257e-11,-3.35309333844914e-10)
(7.60664538427662e-13,2.70506311258399e-11,-3.32736462172465e-10)
(-3.31108344803955e-12,4.11987817697396e-11,-3.33248184327487e-10)
(-1.92470918718139e-11,7.70120916491336e-11,-3.38167765221502e-10)
(-1.86783670068061e-11,2.77069819717545e-10,-3.01505902012356e-10)
(-2.47607146257807e-11,4.93579925180395e-10,-2.84550825241651e-10)
(-2.62867503274894e-11,7.01960876244821e-10,-1.97143497746229e-10)
(-2.67176843292648e-11,9.66867178483769e-10,-1.01219030536605e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(6.36148158164206e-14,3.22259590779129e-12,-5.01165337877106e-10)
(5.76688556437219e-13,7.60781585672717e-12,-4.99858942150125e-10)
(1.21060640719085e-12,1.29112457925521e-11,-4.96885640623264e-10)
(-1.04080066609991e-12,2.16993653434636e-11,-4.94775806712991e-10)
(-4.98361258182241e-12,4.07769555841259e-11,-4.95284281903242e-10)
(-1.36410340896629e-11,9.4815081772734e-11,-4.97641600248621e-10)
(-1.94689264781661e-11,2.51264315566259e-10,-4.86243721717734e-10)
(-2.50684639863347e-11,4.08514691573536e-10,-4.13890067711958e-10)
(-2.84826118220683e-11,6.07219470439678e-10,-3.01957721668724e-10)
(-3.02633988687705e-11,8.65886761901978e-10,-1.62965433125862e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(4.49468545613045e-13,2.17772326569286e-12,-7.34258089606637e-10)
(1.29985283827671e-12,4.78109085100847e-12,-7.32574293850132e-10)
(2.07743590655303e-12,9.21863020845893e-12,-7.28949400915942e-10)
(-9.22599664572423e-13,1.76924975598196e-11,-7.25141608220831e-10)
(-4.85190301139738e-12,3.63488984995864e-11,-7.20396250462084e-10)
(-1.18312302995184e-11,8.15505413568819e-11,-7.0982195842715e-10)
(-1.97281284402028e-11,1.7721957645105e-10,-6.78551548605947e-10)
(-2.66737379835631e-11,2.96180808009987e-10,-5.96840368480425e-10)
(-3.18306282249102e-11,4.6718052432613e-10,-4.62796147588173e-10)
(-3.48727959876586e-11,7.01261477152238e-10,-2.66162533825253e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-8.08036221732871e-15,1.44140093389316e-12,-1.02114634138407e-09)
(8.92373026448583e-13,2.42607189337978e-12,-1.0187180375094e-09)
(1.77339130933498e-12,4.94796995377054e-12,-1.01463090449976e-09)
(-1.05894738879614e-12,1.03864410018952e-11,-1.00922187334011e-09)
(-4.90526837902559e-12,2.15141486974141e-11,-9.99958002019901e-10)
(-1.16814126031109e-11,4.60402444512744e-11,-9.81069200747477e-10)
(-2.0008251114103e-11,9.27320768492087e-11,-9.38138093955989e-10)
(-2.81936618369878e-11,1.59854775061425e-10,-8.48701257446412e-10)
(-3.38910386302524e-11,2.6789415823618e-10,-6.92239462301283e-10)
(-3.70752491071023e-11,4.31908597594406e-10,-4.27917480168492e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(3.04216450101354e-13,2.22333281105086e-11,-2.16151276328587e-11)
(5.57919683381627e-13,4.71887803848788e-11,-2.10359952146069e-11)
(1.4529817465058e-12,7.69571548462135e-11,-1.91368049987935e-11)
(1.96580709615396e-12,1.17644894770067e-10,-1.57457438642874e-11)
(2.05957549312004e-12,1.73704782963897e-10,-9.66541408067803e-12)
(1.4113173515938e-12,2.51901631593789e-10,-1.93693175308551e-12)
(2.95097328176917e-13,3.56521040669119e-10,5.19103818062393e-12)
(-9.83182223092149e-13,4.85004869619169e-10,6.68473735414135e-12)
(-1.73214264750668e-12,6.30450808080385e-10,4.55807060054709e-12)
(-2.05982352589863e-12,7.54366394176466e-10,2.25912787056368e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(3.37814959716273e-13,2.14375034787869e-11,-4.57860870337463e-11)
(4.52179749454662e-13,4.43997347517307e-11,-4.41450509425995e-11)
(2.26717888944786e-12,7.25941002689386e-11,-4.07041520882843e-11)
(3.50880376177151e-12,1.11290173660425e-10,-3.37089391627674e-11)
(4.10348646738419e-12,1.66510879432485e-10,-2.13913557549728e-11)
(2.98733023827224e-12,2.46166126694594e-10,-2.88162521287341e-12)
(9.71718572642253e-13,3.56962338037267e-10,1.80835310074471e-11)
(-3.16251659545442e-12,4.89290709546714e-10,1.89805736650148e-11)
(-5.13819832328748e-12,6.3453973274107e-10,1.14414469557547e-11)
(-5.67200694077939e-12,7.57598033702726e-10,4.89102399138121e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(5.70573925583525e-13,1.93127644929371e-11,-7.673953728438e-11)
(1.17060750525678e-12,3.94650662277743e-11,-7.40227326504443e-11)
(3.20472187438476e-12,6.41391969141101e-11,-6.85292694922399e-11)
(4.74977683021817e-12,9.85408307406678e-11,-5.79773482961792e-11)
(6.57572522821971e-12,1.490170442922e-10,-3.87449254960757e-11)
(6.0950191275662e-12,2.28938015867344e-10,-3.47029833864671e-12)
(6.71825784685065e-12,3.6262722212277e-10,5.22192329892372e-11)
(-7.56059464678087e-12,5.02878030135929e-10,4.03495196436049e-11)
(-1.09167108405087e-11,6.45195108674561e-10,1.82275725610954e-11)
(-1.12220449944555e-11,7.64901748965908e-10,5.74146625280745e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.11824025545199e-12,1.642291638504e-11,-1.18105762267254e-10)
(2.64531307814272e-12,3.31082406002367e-11,-1.15191376513526e-10)
(4.6399125729952e-12,5.2449234329157e-11,-1.08605528102413e-10)
(7.18676225894548e-12,7.90069715854658e-11,-9.57204308440993e-11)
(1.15454655116595e-11,1.16919491230412e-10,-7.10855499239207e-11)
(1.90644875953002e-11,1.85076092040136e-10,-1.69069132529456e-11)
(5.10822860782802e-11,3.96119125603066e-10,1.40552154232169e-10)
(-1.37360263079075e-11,5.41211360028785e-10,5.76376949402197e-11)
(-1.84125626951733e-11,6.65653549389937e-10,1.23150092268634e-11)
(-1.74996813279557e-11,7.75317463477396e-10,-8.09812628905857e-13)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.40183864088726e-12,1.29313704474214e-11,-1.73460295715605e-10)
(3.4267332238779e-12,2.5764297380031e-11,-1.70720120525095e-10)
(5.70944457416426e-12,3.87246301035263e-11,-1.63993424366497e-10)
(9.70372634218764e-12,5.48706647923722e-11,-1.51527063370915e-10)
(2.0179097158105e-11,7.01204108217661e-11,-1.28962441870982e-10)
(5.25678631727827e-11,6.66384314278356e-11,-8.52939819939864e-11)
(-6.73999727845572e-11,7.56574355094876e-10,-5.11700347347222e-17)
(-3.78325500478405e-11,6.3529586604793e-10,-5.74049994919834e-11)
(-2.65198700006456e-11,6.91588529810797e-10,-4.13873353978264e-11)
(-2.23551666335233e-11,7.79936597169976e-10,-2.37383425802172e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.80261106841966e-12,9.22942121500925e-12,-2.46066103888279e-10)
(3.29383564876338e-12,1.82715517151304e-11,-2.4373290652039e-10)
(5.94792339685943e-12,2.52233991345241e-11,-2.38307218527277e-10)
(1.06414862688483e-11,3.12029154431498e-11,-2.29568868154716e-10)
(2.20228370129137e-11,2.89709987506211e-11,-2.14420234241135e-10)
(5.79026290495239e-11,6.73772845202069e-12,-1.76774132294178e-10)
(-4.09647129311377e-11,7.46579462715938e-10,-6.5135477076529e-16)
(-3.84503156029508e-11,6.40904254212751e-10,-1.61758198542148e-10)
(-2.92431346372075e-11,6.80305747449331e-10,-1.10210790165349e-10)
(-2.53596000014167e-11,7.58943950065092e-10,-5.63872582825507e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.44387940357635e-12,6.11980383472288e-12,-3.41959226496639e-10)
(2.43437496878404e-12,1.18919291499611e-11,-3.40494516650584e-10)
(4.57070226871116e-12,1.45427680998378e-11,-3.36917723869942e-10)
(6.62365247582814e-12,1.07694398084757e-11,-3.3443784668741e-10)
(2.03032363147016e-12,-2.08667231085764e-11,-3.44232609869014e-10)
(-7.37119452045122e-11,-1.85780325537776e-10,-4.22603722453792e-10)
(-9.82793962595421e-12,8.67372299583077e-10,-9.20376792475081e-10)
(-2.71028085145768e-11,6.20908995616645e-10,-4.11424260719118e-10)
(-2.74698117320454e-11,6.31098092600266e-10,-2.19633660976361e-10)
(-2.69562982837382e-11,7.02593718177156e-10,-1.02574281241336e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.97908269012804e-13,3.99760182383135e-12,-4.63022136040127e-10)
(4.30112035284331e-13,7.26833473595656e-12,-4.62225612640795e-10)
(2.79338808101107e-12,9.01305553948778e-12,-4.59701111448522e-10)
(3.47454230755836e-12,8.19296060983637e-12,-4.59190215329707e-10)
(1.80176284824358e-12,3.92869170188693e-12,-4.68852455235354e-10)
(-1.17743722046619e-11,2.0496335451437e-11,-5.08143533997367e-10)
(-1.77778413686765e-11,3.4859172554606e-10,-6.0238338391715e-10)
(-2.46669264662707e-11,4.35391741306723e-10,-4.41765826846811e-10)
(-2.74359542509245e-11,5.12783847848747e-10,-2.8888705498085e-10)
(-2.8603547245169e-11,5.9765677961471e-10,-1.46225969805694e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-4.9800487934156e-13,2.4837094263344e-12,-6.03434239464949e-10)
(2.99788617423405e-14,3.87165784989451e-12,-6.02471491416943e-10)
(2.54030346627892e-12,6.28301336171911e-12,-5.99941169863647e-10)
(1.63809913451509e-12,1.02418813392321e-11,-5.97678700065788e-10)
(-5.91445244250339e-13,2.09342299052e-11,-5.97831212126884e-10)
(-7.59134321508258e-12,6.09494034338658e-11,-6.01230113041337e-10)
(-1.69518089639887e-11,1.91249541662025e-10,-5.94333286383622e-10)
(-2.43919259270976e-11,2.81797082212714e-10,-4.98201731277786e-10)
(-2.91778758979595e-11,3.67327804051611e-10,-3.61857892527874e-10)
(-3.16824502551026e-11,4.48362501606784e-10,-1.94906150980275e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-9.94983302995296e-13,1.61601978642748e-12,-7.2564235663008e-10)
(-7.68688089818363e-13,1.76671168074702e-12,-7.239576027553e-10)
(1.31233010346694e-12,3.62746591764498e-12,-7.21223085845728e-10)
(6.36222928688741e-14,7.46080448073054e-12,-7.16990876209728e-10)
(-2.27992095400988e-12,1.63311660065757e-11,-7.10046487096786e-10)
(-8.572274943316e-12,4.00408396084666e-11,-6.96692614546391e-10)
(-1.67130107745786e-11,9.116429529124e-11,-6.62154492718865e-10)
(-2.48006819205525e-11,1.42059916950741e-10,-5.75167253848615e-10)
(-3.03188625269959e-11,1.96476619976984e-10,-4.37380199997271e-10)
(-3.30841316811153e-11,2.49662553806467e-10,-2.45391650162429e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(5.20908663589149e-13,2.41339960600668e-11,-2.51895626532409e-11)
(1.44777510073084e-12,5.05127222120316e-11,-2.44670793806219e-11)
(2.42497518928725e-12,8.14581716353374e-11,-2.1980144253386e-11)
(2.24019842218784e-12,1.22249971649555e-10,-1.75398697024981e-11)
(1.52499669692697e-12,1.75343397290855e-10,-1.00677710882577e-11)
(1.88523170884013e-14,2.45951317762371e-10,1.56533905718697e-13)
(-1.63989921346571e-12,3.34040627134361e-10,1.04246447052354e-11)
(-3.14235539706725e-12,4.31136003248098e-10,1.19846825114367e-11)
(-3.5221245781507e-12,5.22705491459428e-10,8.22324902851686e-12)
(-3.03233518122624e-12,5.84765890589904e-10,4.15119780211279e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(8.21517854462268e-13,2.32874612691444e-11,-5.23141216178229e-11)
(1.94594941905976e-12,4.76216532160727e-11,-5.03491952553619e-11)
(3.7268693187941e-12,7.67376364420322e-11,-4.6012326390691e-11)
(3.94056327369398e-12,1.14708750725641e-10,-3.71457921208529e-11)
(3.0875910656122e-12,1.65537271848886e-10,-2.15531147878356e-11)
(-7.49715154768553e-13,2.36686437660998e-10,3.37073351662864e-12)
(-5.5902081704209e-12,3.34125535354419e-10,3.63744662288696e-11)
(-9.21071047549824e-12,4.36263304053939e-10,3.568509550907e-11)
(-9.2431512923651e-12,5.27655045014635e-10,2.10311663163757e-11)
(-8.08469821266737e-12,5.89009850248302e-10,9.08865415752532e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(7.4361739951547e-13,2.1120495071552e-11,-8.53071383555767e-11)
(2.03396997462843e-12,4.23705291918487e-11,-8.17083937394886e-11)
(4.34276326327279e-12,6.72621953719554e-11,-7.49221199886366e-11)
(5.05121318529359e-12,9.89274229431433e-11,-6.20236468075773e-11)
(3.39865113251765e-12,1.41477200849479e-10,-3.83825901623914e-11)
(-5.73258837301967e-12,2.06049465533328e-10,8.1009893352014e-12)
(-1.49039322877702e-11,3.40311426634901e-10,1.1654374836195e-10)
(-2.3771977457151e-11,4.54293738031276e-10,9.13506723066136e-11)
(-1.88890452475934e-11,5.4111566079054e-10,4.03082360064304e-11)
(-1.58962932530376e-11,5.98410338818891e-10,1.35846259436438e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.6954004393252e-12,1.77579284448981e-11,-1.25954169565453e-10)
(3.40340788726734e-12,3.5057843822534e-11,-1.21837433053409e-10)
(5.47941954031256e-12,5.40430164064532e-11,-1.13834840938437e-10)
(6.6881881318708e-12,7.54740581932158e-11,-9.87906413365408e-11)
(4.16590924930389e-12,9.69418979760877e-11,-7.27358922254671e-11)
(-1.99569192775783e-11,1.01610999162718e-10,-3.20801192992964e-11)
(-2.26458484121583e-10,3.85310809780526e-10,1.95006625654074e-16)
(-6.24978466135911e-11,5.12555371968285e-10,2.22161085208679e-10)
(-3.1222721260382e-11,5.70194170365881e-10,5.5258261410695e-11)
(-2.29286276495353e-11,6.12718327429408e-10,1.13080923399941e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.36361268280085e-12,1.42008928121952e-11,-1.77570357106727e-10)
(4.19278273015484e-12,2.71145143577929e-11,-1.73678311482581e-10)
(6.7443145476079e-12,3.92263518319781e-11,-1.65266954523141e-10)
(1.08068541914346e-11,5.07045863716471e-11,-1.49553090128958e-10)
(1.76600493522763e-11,5.81324732687557e-11,-1.21487285597658e-10)
(2.7174635324729e-11,5.60670620273901e-11,-7.32030756528309e-11)
(-1.3208367250849e-16,8.06371586842116e-16,-3.27316028655841e-17)
(-5.94586023069165e-11,6.87695223859204e-10,6.65167215219601e-17)
(-3.28860804567787e-11,6.15113180658964e-10,-1.31203527055659e-11)
(-2.51008621088078e-11,6.23790714095546e-10,-1.32106694583411e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.57903108083336e-12,1.05966972566646e-11,-2.42271737611602e-10)
(4.24777022080198e-12,1.90087006513261e-11,-2.38955177675533e-10)
(7.89020405898679e-12,2.42591555136147e-11,-2.31630274671463e-10)
(1.59263279899383e-11,2.53918024772031e-11,-2.18239471282795e-10)
(3.4214456925144e-11,1.76224954367157e-11,-1.91951127916092e-10)
(7.36472021000262e-11,-1.00401191173653e-12,-1.33974221284816e-10)
(-2.61089983287819e-18,6.10386380501369e-16,-5.98531537875664e-17)
(-7.00024653836926e-11,6.67195169041833e-10,-2.97408407500349e-16)
(-3.38590116708705e-11,6.05896150578694e-10,-7.29231116071961e-11)
(-2.53966263961799e-11,6.06624723089447e-10,-4.55290671993768e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.10137156843897e-12,7.26170874721536e-12,-3.1944318440782e-10)
(3.4811766021163e-12,1.1880034807065e-11,-3.17252699630683e-10)
(7.62053764655991e-12,1.20505166528292e-11,-3.1214447920198e-10)
(1.89948948560666e-11,3.29791471347642e-12,-3.04391143250296e-10)
(5.56060214056962e-11,-2.6798147320317e-11,-2.91333598124566e-10)
(2.17784463827501e-10,-9.53474439430045e-11,-2.49726696812512e-10)
(1.02655149954574e-16,8.39908160486589e-16,-1.0374281764019e-15)
(-3.33761539473863e-11,7.04176782465252e-10,-4.36603704120552e-10)
(-2.62149467154943e-11,5.66256116234133e-10,-2.1036986678954e-10)
(-2.45936409626132e-11,5.54979519315097e-10,-9.39258064027019e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(5.19460729115288e-13,4.62464051634662e-12,-4.06242513543586e-10)
(1.30228772912781e-12,6.67771747302684e-12,-4.05062131292621e-10)
(5.012534139938e-12,5.19951208679748e-12,-4.02224199879134e-10)
(1.10878614838589e-11,-5.74975231863721e-12,-4.00762660486427e-10)
(2.40873034068964e-11,-4.66403871840853e-11,-4.09017720546106e-10)
(4.20124097327445e-11,-2.00477466721674e-10,-4.57696130298239e-10)
(-2.10532145548879e-11,4.36603571364508e-10,-6.95898035601249e-10)
(-2.39510392383333e-11,4.39745626495598e-10,-4.37183714562479e-10)
(-2.46409956289879e-11,4.37169379332275e-10,-2.61932932720947e-10)
(-2.55352390428649e-11,4.54425637764733e-10,-1.26247321932637e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-5.930632873865e-13,2.70900833094818e-12,-4.91555409088168e-10)
(-3.95396522506203e-13,3.40094089385744e-12,-4.90634245799324e-10)
(2.93338111259208e-12,3.86041518731934e-12,-4.88626007254526e-10)
(4.57168805405227e-12,2.12806263668797e-12,-4.8687492475937e-10)
(7.41051956885647e-12,-1.47822157494197e-12,-4.89573653790015e-10)
(6.42039395262588e-12,1.25778261767197e-11,-5.02772182306679e-10)
(-1.29981176990521e-11,1.89410363831466e-10,-5.25124714283945e-10)
(-2.0998599415033e-11,2.56868305481727e-10,-4.19533401895408e-10)
(-2.52784333709354e-11,2.94900572565979e-10,-2.88549814931131e-10)
(-2.78886534350447e-11,3.23015390374993e-10,-1.48490633799547e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.06371739134821e-12,1.53334254218941e-12,-5.51707398210969e-10)
(-1.73649331864303e-12,1.59252937539444e-12,-5.50483889425122e-10)
(7.07586385111918e-13,2.81272611397687e-12,-5.48705743560677e-10)
(5.80037660656885e-13,4.41932110178141e-12,-5.45183092363389e-10)
(6.97372502169546e-13,8.73550874996135e-12,-5.4071238746293e-10)
(-3.06955716237613e-12,2.73058969012185e-11,-5.33293317046998e-10)
(-1.25359543535878e-11,8.27325655923652e-11,-5.09342762723141e-10)
(-2.05278188211497e-11,1.21833908067822e-10,-4.29198094417295e-10)
(-2.58307923848447e-11,1.49981636855552e-10,-3.11034765497047e-10)
(-2.8813228037092e-11,1.69750319641591e-10,-1.65364440928923e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(6.44960181893249e-13,2.54544295934965e-11,-2.809981415777e-11)
(1.85190896944588e-12,5.23228114908124e-11,-2.72542551099591e-11)
(2.70523583170315e-12,8.27221600555219e-11,-2.43132139082527e-11)
(2.30932073186711e-12,1.20707295165675e-10,-1.92594094630377e-11)
(1.10681714491351e-12,1.69593790517378e-10,-1.13748073480252e-11)
(-9.84378381071468e-13,2.30762857959473e-10,-4.52828572915552e-13)
(-3.28484523963395e-12,3.02463856302259e-10,1.07796654840139e-11)
(-4.50822272010786e-12,3.76720814988546e-10,1.28650065579354e-11)
(-4.39962690695302e-12,4.38124811244586e-10,9.10301768249975e-12)
(-3.12509703756195e-12,4.74552578512796e-10,4.4859867943439e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.02355768961623e-12,2.47704781285922e-11,-5.58334863689203e-11)
(2.86020457857976e-12,4.97456691825264e-11,-5.38182065486084e-11)
(4.33577611904365e-12,7.82054405404237e-11,-4.85616374340893e-11)
(4.12921372317399e-12,1.13146919548369e-10,-3.88232845297341e-11)
(2.22381376054241e-12,1.58809156733573e-10,-2.28604658016565e-11)
(-3.1164757393377e-12,2.19300250872573e-10,2.55597222060335e-12)
(-1.10867287311525e-11,2.99651070688555e-10,3.63245320127791e-11)
(-1.2587215260068e-11,3.79321346118571e-10,3.72283677603155e-11)
(-1.07612549095048e-11,4.41963121810724e-10,2.25454726727904e-11)
(-8.39653262578113e-12,4.7851989926931e-10,9.69898835512561e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(5.07439410098753e-13,2.29149867903216e-11,-8.93413559539087e-11)
(2.56038159310808e-12,4.48817911706215e-11,-8.55372129456742e-11)
(4.66346904770637e-12,6.91329316844934e-11,-7.7496309433472e-11)
(4.86352129002542e-12,9.75962636314699e-11,-6.3655335966467e-11)
(1.4503745082979e-12,1.33723583894798e-10,-3.98901060412353e-11)
(-9.73688102919323e-12,1.85016201215466e-10,5.69694524077067e-12)
(-3.47102393780397e-11,2.97240922881009e-10,1.10093191741928e-10)
(-3.09911750940637e-11,3.91451321752574e-10,9.28429037069059e-11)
(-2.12439447601842e-11,4.52670420770313e-10,4.31006430415438e-11)
(-1.6619655920084e-11,4.86586590290122e-10,1.51521880510487e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.13569956002632e-12,1.947468174484e-11,-1.28445587458103e-10)
(3.34414523701825e-12,3.75905596778333e-11,-1.2376493516854e-10)
(5.25188451293968e-12,5.63047546918561e-11,-1.1452446595422e-10)
(5.40291084235859e-12,7.48042237591006e-11,-9.86293127013396e-11)
(2.31956103049654e-12,8.95216934384251e-11,-7.29996792490259e-11)
(-6.49329644818602e-12,8.11757289631871e-11,-3.5871563869425e-11)
(-6.33093709146954e-11,3.13842340674695e-10,1.10367901018788e-16)
(-7.07348747065408e-11,4.34875920351768e-10,2.15837212761753e-10)
(-3.2191562482709e-11,4.7578385816638e-10,5.93325151163298e-11)
(-2.26929219756575e-11,4.97946990382671e-10,1.4137931479675e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.07576261417807e-12,1.56507718823708e-11,-1.7405730674287e-10)
(3.88723947719624e-12,2.96093645142896e-11,-1.69484645496925e-10)
(5.99764647179081e-12,4.17858010557802e-11,-1.5992143841111e-10)
(8.05383355457977e-12,5.13752605994107e-11,-1.42930447336997e-10)
(9.88581723944327e-12,5.62493630961506e-11,-1.14083687186138e-10)
(1.10426663426356e-11,5.36040694493798e-11,-6.75501139516644e-11)
(-3.53467905552866e-17,4.07095260520328e-16,-3.07128198798025e-17)
(-2.58381282672581e-11,5.75470234626016e-10,7.67751733005183e-17)
(-2.35787336237139e-11,5.11480006592878e-10,-6.63097235474044e-12)
(-2.1145540561068e-11,5.05721811873427e-10,-8.84536092312911e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.59745965422177e-12,1.17770305326066e-11,-2.29203121670501e-10)
(4.05153306097053e-12,2.10246104583231e-11,-2.24864646557957e-10)
(6.7080395311563e-12,2.65495546920071e-11,-2.15761448093531e-10)
(1.1731872386888e-11,2.72124399305621e-11,-1.99926060782249e-10)
(2.06581930508949e-11,2.0175288554844e-11,-1.70572197319692e-10)
(3.40164726996732e-11,6.00869669891204e-12,-1.1226401676795e-10)
(5.42257389468635e-18,2.40889200407888e-16,-5.08880606817714e-17)
(-3.406126460832e-11,5.47835766970175e-10,-2.19995784808106e-16)
(-2.16130217341296e-11,4.99839124927217e-10,-5.94608078019331e-11)
(-1.92804898211758e-11,4.88618619703572e-10,-3.75660133664704e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.54795502210807e-12,8.03127279461899e-12,-2.89909858665765e-10)
(3.57527350750431e-12,1.31141270952024e-11,-2.86561464072425e-10)
(6.71820626092534e-12,1.32943028556799e-11,-2.79353502787215e-10)
(1.49850167624345e-11,5.09046306418911e-12,-2.68299257446265e-10)
(3.38413599574156e-11,-1.99711342155582e-11,-2.47664514575005e-10)
(7.31888272217737e-11,-6.80641029389956e-11,-1.9336032925416e-10)
(3.7891178959493e-17,3.87607626696294e-16,-5.20911337026961e-16)
(4.82116469123642e-12,5.77998999679415e-10,-3.67096567826185e-10)
(-1.35722702004453e-11,4.64686017641847e-10,-1.78287155133777e-10)
(-1.79655658149135e-11,4.4306275513237e-10,-7.92326667238539e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.25471066356821e-12,5.01981630466112e-12,-3.51837272895352e-10)
(1.74113289479865e-12,7.08561958901923e-12,-3.49277795115225e-10)
(4.89009164665285e-12,4.99996117584076e-12,-3.4472463785196e-10)
(1.14651065882488e-11,-7.38529926278533e-12,-3.41069810517716e-10)
(2.76035475498806e-11,-5.1335479525723e-11,-3.44413601175537e-10)
(6.7159022137452e-11,-2.03492070926231e-10,-3.81067668918198e-10)
(-3.25743280606372e-11,3.67096451236877e-10,-5.87421939992168e-10)
(-1.63245000660414e-11,3.69035610325499e-10,-3.68248381280072e-10)
(-1.80577996509404e-11,3.55540695986463e-10,-2.18372642399712e-10)
(-2.03723135858422e-11,3.5635976914425e-10,-1.03876277333432e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-3.38560787450612e-13,2.8692312861545e-12,-4.06436417922982e-10)
(-5.95223548795231e-13,3.45456853993163e-12,-4.04161367239001e-10)
(2.22998769068678e-12,3.43299717697557e-12,-4.01266345081724e-10)
(4.97915861960963e-12,1.16241816224723e-13,-3.98525976565412e-10)
(1.03953177606151e-11,-7.7840901570057e-12,-3.99843706009986e-10)
(1.40448552053534e-11,-1.76491112729797e-12,-4.10458173241618e-10)
(-1.19116318484597e-11,1.58795795939882e-10,-4.30517860188777e-10)
(-1.69477889653904e-11,2.13715230205549e-10,-3.39796176112741e-10)
(-2.04186787921209e-11,2.34982144692758e-10,-2.29066660363757e-10)
(-2.3114216501104e-11,2.46654301253833e-10,-1.15533154006728e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-7.53883635005379e-13,1.37048131769518e-12,-4.40264825410156e-10)
(-1.9221098076948e-12,1.47457420521337e-12,-4.37808942353517e-10)
(-2.33869819802846e-15,2.58051331796207e-12,-4.35508087448189e-10)
(5.2865386197923e-13,3.48789825375184e-12,-4.31363075775557e-10)
(2.01381083619912e-12,5.38912543576022e-12,-4.26990175012794e-10)
(2.85785414983831e-13,1.95406160085061e-11,-4.20774838032253e-10)
(-9.9480570670688e-12,6.87992131356295e-11,-4.0084944399184e-10)
(-1.68572396735749e-11,9.99198514789165e-11,-3.32662843490665e-10)
(-2.15194800974185e-11,1.17158288472341e-10,-2.35181051244155e-10)
(-2.44273493244527e-11,1.2619914163816e-10,-1.21603686122422e-10)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(4.83352599082204e-13,2.64529036849459e-11,-2.86173474541357e-11)
(1.48801007597717e-12,5.39332658199188e-11,-2.74241373952413e-11)
(2.16815090160052e-12,8.38118700117055e-11,-2.43872213517134e-11)
(1.98509423414415e-12,1.18527772974457e-10,-1.97134464210363e-11)
(9.69472153601963e-13,1.61340977349466e-10,-1.30010142946646e-11)
(-7.54265351110639e-13,2.12985184965516e-10,-3.6433287429632e-12)
(-2.55740069984675e-12,2.70930109700194e-10,6.17955065112966e-12)
(-3.3467649747354e-12,3.28388514728177e-10,9.08644798141987e-12)
(-3.62090658492536e-12,3.72873040535369e-10,7.0229910908655e-12)
(-2.60643099970616e-12,3.98011734846498e-10,3.54604833506827e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(8.6376920759367e-13,2.56460959093176e-11,-5.62498372219232e-11)
(2.46751347592339e-12,5.14091956952202e-11,-5.43536658156403e-11)
(3.66993207064798e-12,7.95359851580721e-11,-4.92408693508888e-11)
(3.71705091199579e-12,1.11722949551289e-10,-4.01772290098993e-11)
(1.89294857702699e-12,1.51524664333648e-10,-2.60383077040132e-11)
(-2.60098587442264e-12,2.01905642702418e-10,-4.79928602728816e-12)
(-9.58041667114406e-12,2.6541834391937e-10,2.19145360938457e-11)
(-1.00342958065502e-11,3.27787621503247e-10,2.53746358136951e-11)
(-8.62206955134894e-12,3.74653311666035e-10,1.61797359831798e-11)
(-6.76423529159632e-12,4.00412910716389e-10,7.2325835393397e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.43601447349454e-13,2.39902015607105e-11,-8.90532198124761e-11)
(1.81070957369275e-12,4.67982334953816e-11,-8.58792303847397e-11)
(3.65067257333952e-12,7.09852454974726e-11,-7.84624950709251e-11)
(3.89033123713129e-12,9.76373908499784e-11,-6.54068108281408e-11)
(6.5213682723799e-14,1.29316173481929e-10,-4.42288201469709e-11)
(-1.02926552781094e-11,1.71134717033967e-10,-8.19569352530289e-12)
(-3.40613691367121e-11,2.52190805660132e-10,6.54774409196891e-11)
(-2.46735130278762e-11,3.29761546803215e-10,5.98809450107757e-11)
(-1.6408927165691e-11,3.79576756673087e-10,2.89057365688377e-11)
(-1.2827867961626e-11,4.04855250571635e-10,1.05666333678896e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.78957132926277e-13,2.09587564929321e-11,-1.26681591038847e-10)
(2.08487118627373e-12,3.98617946088301e-11,-1.22367836886343e-10)
(3.87568489607558e-12,5.87624075756675e-11,-1.1334429105126e-10)
(3.20224054978417e-12,7.71117660549453e-11,-9.78163078935559e-11)
(-1.53622400685731e-12,9.16543321329267e-11,-7.50375242207093e-11)
(-1.47933111717169e-11,8.63463561747531e-11,-4.7550284578382e-11)
(3.46954602708854e-11,2.16658772271154e-10,-4.82185455690605e-11)
(-5.48244913353853e-11,3.39693081200712e-10,1.30146418103574e-10)
(-2.26931272725595e-11,3.88779452090592e-10,3.47516924664094e-11)
(-1.63298119867573e-11,4.09591635682827e-10,7.58542284645381e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.37684271796635e-12,1.69605118633283e-11,-1.67632342453807e-10)
(2.9087864473739e-12,3.18217677401962e-11,-1.63096639778913e-10)
(4.24290176146464e-12,4.47186355492723e-11,-1.5349625751949e-10)
(3.36989407256289e-12,5.56325322490729e-11,-1.36904436793518e-10)
(-5.73681453715652e-13,6.26209247515493e-11,-1.11428232747661e-10)
(-8.91204414571622e-12,6.77882778853072e-11,-7.19970264435265e-11)
(2.33712763768324e-17,4.13046640325079e-16,-1.12599633225484e-16)
(8.42738851850292e-12,3.75826165575693e-10,-3.23607769762314e-11)
(-9.72346338966811e-12,3.99317341159973e-10,-1.83036678167962e-11)
(-1.2887709314166e-11,4.08605968306459e-10,-1.17846139648854e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.00474227967538e-12,1.27663632191996e-11,-2.13702570540486e-10)
(2.858817959651e-12,2.32919761306045e-11,-2.08953763633936e-10)
(4.12790405617794e-12,3.03389113295108e-11,-1.99571788941639e-10)
(4.49998579074978e-12,3.42008982519675e-11,-1.84387064280093e-10)
(2.49643526953392e-12,3.18590356678072e-11,-1.58598186470639e-10)
(-4.17469354233032e-12,2.33782220883374e-11,-1.09628825061854e-10)
(2.78118717326143e-17,2.77240050622541e-16,-1.50370274189405e-16)
(-4.76390951141329e-12,3.59042585012485e-10,-5.77884110991528e-11)
(-8.35470888422501e-12,3.84209292635952e-10,-6.20780163173336e-11)
(-1.12906386165514e-11,3.89379417181225e-10,-3.44070895477274e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(2.21101691873423e-12,8.65729998659254e-12,-2.6188135888558e-10)
(2.3958197284584e-12,1.53327861526251e-11,-2.57906456055651e-10)
(3.95830259984316e-12,1.78545983793243e-11,-2.50072106716256e-10)
(6.82603621811802e-12,1.48041031676869e-11,-2.38580131247399e-10)
(1.09015199467459e-11,2.8279353847277e-13,-2.18229781419874e-10)
(1.52569868661828e-11,-2.99487304806922e-11,-1.70127159841971e-10)
(2.11767727300536e-17,3.46552328085758e-16,-4.75840174911437e-16)
(2.49751413527305e-11,3.45715971185242e-10,-2.37270235647437e-10)
(-3.48143695499707e-12,3.48637757940916e-10,-1.36368656597876e-10)
(-1.04952465507324e-11,3.48747370793343e-10,-6.36680596064851e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(8.45817901927155e-13,5.43074836223442e-12,-3.06849796346326e-10)
(8.19026680610231e-13,8.82465182656282e-12,-3.03684153452288e-10)
(2.80222831129551e-12,8.95386985090807e-12,-2.9813643484044e-10)
(7.30735616706091e-12,2.55262179256234e-12,-2.92529249259157e-10)
(2.0706225923818e-11,-2.26782288943394e-11,-2.88072791236216e-10)
(7.17861334124749e-11,-1.10179081545398e-10,-2.92338170807637e-10)
(-4.34472314756968e-11,2.29899161622287e-10,-3.38309927907972e-10)
(-1.08798588264439e-11,2.63543076588163e-10,-2.61391510119745e-10)
(-1.19956134235282e-11,2.74624391297392e-10,-1.67741852165644e-10)
(-1.45431230289234e-11,2.80161214099897e-10,-8.18120188656872e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.11486150297553e-12,3.27068865870083e-12,-3.42804246319101e-10)
(-1.51025137140427e-12,4.66502746420488e-12,-3.40513607263703e-10)
(3.42103033428515e-13,5.66619747686246e-12,-3.36916059036073e-10)
(2.92523162664394e-12,4.72510870461617e-12,-3.32549096301739e-10)
(7.83656939949183e-12,2.24860309657651e-12,-3.28938170021949e-10)
(1.27990150167001e-11,1.13836533717532e-11,-3.26308233516234e-10)
(-1.26367331203146e-11,1.19265969052596e-10,-3.19580052439792e-10)
(-1.38819259877555e-11,1.65147072005546e-10,-2.59637557073723e-10)
(-1.61283289287585e-11,1.84515775140292e-10,-1.77688380934477e-10)
(-1.81922108921007e-11,1.93268057581978e-10,-9.00579780173334e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.83928537394968e-12,1.65892552213621e-12,-3.63314153001845e-10)
(-2.74839050780855e-12,2.04582601726397e-12,-3.61099979572338e-10)
(-1.56683705286776e-12,3.23294253750332e-12,-3.58024209153925e-10)
(-3.56348647032467e-13,4.58971402338174e-12,-3.52752543069293e-10)
(1.18759929141816e-12,7.31587947969381e-12,-3.46280949425272e-10)
(-9.89926169233771e-14,1.921940489465e-11,-3.3608610093512e-10)
(-9.33544443261369e-12,5.52434995659594e-11,-3.12996181028808e-10)
(-1.44191804411645e-11,7.95881460615542e-11,-2.58234038073078e-10)
(-1.79385567468251e-11,9.2372761386561e-11,-1.8142157449364e-10)
(-1.98318938087195e-11,9.82489535624086e-11,-9.35010328160401e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(9.69503159017149e-14,2.5828598050062e-11,-2.78658021884346e-11)
(9.75164157095397e-13,5.29857296476126e-11,-2.68731758150591e-11)
(1.77026082459062e-12,8.23729880924987e-11,-2.40238068939024e-11)
(2.07748553092581e-12,1.15393866387207e-10,-1.9646068119177e-11)
(1.42809961770574e-12,1.54234895961419e-10,-1.37656941673904e-11)
(5.02397517907164e-13,1.98716392782158e-10,-6.32648665871502e-12)
(4.74677506543123e-14,2.46243295828933e-10,7.1395841666896e-13)
(-6.82414859166073e-13,2.92046456894152e-10,3.64800379988084e-12)
(-1.92423495983614e-12,3.28204982977181e-10,3.25997506914891e-12)
(-1.46155853450741e-12,3.48085903588151e-10,1.58354695836731e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(6.23492149910063e-13,2.51035667140414e-11,-5.53392104562178e-11)
(1.96567921100625e-12,5.08836091896257e-11,-5.3827978984667e-11)
(3.15703139026916e-12,7.8841566570078e-11,-4.90134132915342e-11)
(3.66368830740392e-12,1.09998796714473e-10,-4.06479667496215e-11)
(2.86241775202896e-12,1.46967162436985e-10,-2.86296063995224e-11)
(1.45611767288278e-12,1.91110160850609e-10,-1.28809992633436e-11)
(1.87021868229582e-13,2.42079442308391e-10,3.83700369573838e-12)
(-2.8133212759622e-12,2.90852061350789e-10,9.07564350841475e-12)
(-4.59836211449853e-12,3.28048745305156e-10,6.65746321195495e-12)
(-3.97399160753324e-12,3.47882993728251e-10,3.05397379368922e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.05708738299911e-15,2.36632257331594e-11,-8.72434871967485e-11)
(1.3304131464411e-12,4.70043729521877e-11,-8.4782260874393e-11)
(2.81782625237235e-12,7.17620911326278e-11,-7.80926416589187e-11)
(3.23796535102298e-12,9.8654329879049e-11,-6.60652447788404e-11)
(1.69392841002158e-12,1.3096403232426e-10,-4.81904796812533e-11)
(8.22571136082689e-13,1.73081255151019e-10,-2.27002871514467e-11)
(7.06716016120692e-12,2.34715479254626e-10,1.27068901899703e-11)
(-3.62983898345433e-12,2.90003092041469e-10,1.73126126729823e-11)
(-7.27251938230724e-12,3.2822410030618e-10,9.45857779501054e-12)
(-6.99761970498332e-12,3.47920247787702e-10,3.51244017368383e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-3.65523899804881e-14,2.1090999000646e-11,-1.23857565013479e-10)
(1.1013522197949e-12,4.09653235186033e-11,-1.19936514491895e-10)
(2.39147376478274e-12,6.09478543449516e-11,-1.11426825479356e-10)
(1.90269068276648e-12,8.15257522661558e-11,-9.68746525427881e-11)
(9.94373222963366e-15,1.04649849303303e-10,-7.66109641602831e-11)
(4.43302810840729e-12,1.3567597707183e-10,-4.62586633593528e-11)
(7.29888558228454e-11,2.31392430147834e-10,2.60969810697453e-11)
(4.43714992678793e-12,2.93099179513594e-10,1.65243062214339e-11)
(-6.06474672200585e-12,3.29267920874109e-10,1.69562062583257e-12)
(-7.75872176393364e-12,3.46933331055599e-10,-2.07486859438742e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.03528868719621e-12,1.71705128758104e-11,-1.61010180377389e-10)
(1.83819579753688e-12,3.31056362036812e-11,-1.56629015905036e-10)
(2.03080525525162e-12,4.75994140897386e-11,-1.4791014562755e-10)
(-6.74675976198589e-13,6.15266316519949e-11,-1.3384657744138e-10)
(-9.24299867410277e-12,7.27363816646993e-11,-1.15908128351978e-10)
(-3.64989021926401e-11,6.37839145425108e-11,-9.74761247397775e-11)
(3.23608235544638e-11,2.96253411320697e-10,-1.03590720518693e-10)
(1.11538599222365e-11,3.06889615419702e-10,-5.26064140924811e-11)
(-1.13446871761253e-12,3.28061900144745e-10,-3.23982915309122e-11)
(-5.44577215380587e-12,3.4006273653664e-10,-1.69351371615538e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.36499860568074e-12,1.30388843706976e-11,-2.00218268648735e-10)
(1.43603324537057e-12,2.50644678388873e-11,-1.95810803257765e-10)
(1.42749234481855e-12,3.47845734450471e-11,-1.8761233538577e-10)
(-1.89209693443044e-12,4.34381579201733e-11,-1.75519261343789e-10)
(-1.48966840099e-11,4.86543119187854e-11,-1.6019930316637e-10)
(-6.04764156648579e-11,3.99492436223922e-11,-1.46117769147764e-10)
(5.77882192284731e-11,2.66661418561689e-10,-1.57167928652033e-10)
(1.28523095339749e-11,2.91182057986753e-10,-1.02421765022191e-10)
(-4.54100958675108e-13,3.10309154859042e-10,-6.75640272788541e-11)
(-5.06568177639352e-12,3.18977034308065e-10,-3.37834999521743e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.46266571318101e-12,9.08375651249559e-12,-2.3927731848883e-10)
(1.06960471504004e-12,1.77571688823837e-11,-2.3581385541172e-10)
(1.36705565947876e-12,2.40878470872432e-11,-2.28948487467315e-10)
(-1.27283223432087e-12,2.81555963379356e-11,-2.19401887632573e-10)
(-1.42400791983108e-11,2.67541227565644e-11,-2.08801494412385e-10)
(-7.46393460709147e-11,4.63044593026936e-12,-2.08553457114463e-10)
(7.37096591413461e-12,2.59272401025202e-10,-2.90717944696807e-10)
(6.24645690025385e-12,2.63404079581193e-10,-1.79888767615063e-10)
(-2.16866730294191e-12,2.75263529766979e-10,-1.09966441895178e-10)
(-5.57714946384365e-12,2.81581739192745e-10,-5.27797427059391e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.5976528854824e-13,6.19510531343186e-12,-2.73409682077192e-10)
(-5.69067568976225e-13,1.16065639123077e-11,-2.70676048492824e-10)
(4.82715104116883e-13,1.56790952114367e-11,-2.65323565200597e-10)
(6.7841123205642e-13,1.8342798032743e-11,-2.58625008557236e-10)
(4.47735043179281e-14,1.97174812743954e-11,-2.51667045915981e-10)
(-3.80484440440039e-12,3.02840123684508e-11,-2.48609803586084e-10)
(-9.73245669420136e-12,1.56690435596924e-10,-2.54400692422255e-10)
(-6.133512197923e-12,1.98958238430745e-10,-1.98522725143546e-10)
(-7.81683056635474e-12,2.17554693546632e-10,-1.32148140369359e-10)
(-9.46198537665083e-12,2.26087906025018e-10,-6.5779265830852e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.79373742176315e-12,4.27162225415228e-12,-2.98794828824545e-10)
(-2.48859815212086e-12,7.22067577786558e-12,-2.96498431642467e-10)
(-1.59160476153475e-12,1.04288214821683e-11,-2.92443312549676e-10)
(-5.50299971905469e-13,1.37849876901114e-11,-2.86313193688854e-10)
(1.39356510647878e-13,1.98385996103953e-11,-2.78625953300243e-10)
(-1.76491758262359e-12,3.86871079657158e-11,-2.68525896046859e-10)
(-8.55675899970306e-12,9.58761255680245e-11,-2.50764993327831e-10)
(-1.02721761830105e-11,1.30477287487788e-10,-2.04015453690944e-10)
(-1.16157180921723e-11,1.4830649524197e-10,-1.41398070374464e-10)
(-1.32310848898544e-11,1.5692882538095e-10,-7.21587854903244e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-2.39453328131946e-12,2.458032165639e-12,-3.11906319801092e-10)
(-3.77833490895824e-12,3.66808201518726e-12,-3.09619211981001e-10)
(-3.60556059999731e-12,5.38874086646776e-12,-3.06039403792661e-10)
(-2.23822826767067e-12,7.85756661358771e-12,-2.9983243828814e-10)
(-1.69136971904132e-12,1.24164986709065e-11,-2.90670837491412e-10)
(-3.96950762858893e-12,2.36766054101091e-11,-2.76498439483268e-10)
(-8.85408782238479e-12,4.66805628598029e-11,-2.5136862608582e-10)
(-1.16434979590541e-11,6.45735135643679e-11,-2.05988985808965e-10)
(-1.34863370378768e-11,7.48775987073958e-11,-1.44821578936239e-10)
(-1.50839730623668e-11,8.00323904915527e-11,-7.47285078356884e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.7064472144176e-13,2.54392991796859e-11,-2.6791852692843e-11)
(2.27915693934827e-13,5.13552775032523e-11,-2.61447156325355e-11)
(9.23943572272299e-13,7.96435177835783e-11,-2.40215862282393e-11)
(1.59218125189935e-12,1.10848678330359e-10,-2.01441951585182e-11)
(1.25662563343328e-12,1.47219841404441e-10,-1.50862022138037e-11)
(1.06818437413028e-12,1.87288920184622e-10,-9.24868245359125e-12)
(1.277275887936e-12,2.28204241209248e-10,-3.90971362981057e-12)
(9.00009414889234e-13,2.67281826066776e-10,-9.85817072193022e-13)
(-9.15691770461461e-14,2.99058343952064e-10,-1.64827345133798e-13)
(3.24898283790849e-13,3.16499429333551e-10,-2.61644371855796e-13)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(5.52601659232183e-13,2.48290387814039e-11,-5.51742482611094e-11)
(1.03034975531009e-12,4.9780102095395e-11,-5.363758157976e-11)
(1.87106028583625e-12,7.67749985331438e-11,-4.95125085171457e-11)
(2.98979479271015e-12,1.06912330292576e-10,-4.24149852239246e-11)
(3.11694072858351e-12,1.42228550451653e-10,-3.25506097827719e-11)
(2.76702041336473e-12,1.82240195508843e-10,-2.07185898233675e-11)
(2.31234510938455e-12,2.25354351065295e-10,-9.61612348827984e-12)
(4.53828329809695e-13,2.66223282700241e-10,-3.75935836007718e-12)
(-1.1702276972558e-12,2.98176054286882e-10,-1.99083516583427e-12)
(-9.57271873247119e-13,3.15153670835121e-10,-1.22492299133189e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.12057497530594e-13,2.35189225701703e-11,-8.69451912758798e-11)
(6.7984336454326e-13,4.66580041581674e-11,-8.41599867523329e-11)
(1.60466615998519e-12,7.12075567524854e-11,-7.78785689628081e-11)
(2.49177786631892e-12,9.86500072902855e-11,-6.75876631306041e-11)
(2.51791890118114e-12,1.31738923074297e-10,-5.31472891889231e-11)
(2.82067187391348e-12,1.72074222467952e-10,-3.5618225029219e-11)
(5.78448678492377e-12,2.20257164124276e-10,-1.7023948723897e-11)
(1.12810842241244e-12,2.64078350418342e-10,-8.12253531593552e-12)
(-2.3702023289561e-12,2.95950120066525e-10,-5.32017712011553e-12)
(-2.49826279919183e-12,3.12591022534638e-10,-3.11871186087547e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-3.71167867580528e-14,2.06774606080959e-11,-1.22528237798177e-10)
(4.51350522197841e-13,4.09756347160617e-11,-1.18469801234864e-10)
(1.1877410834537e-12,6.20984157123872e-11,-1.10644648301073e-10)
(1.63812291441598e-12,8.54417058622279e-11,-9.80223010381923e-11)
(1.57111056988606e-12,1.14953397143719e-10,-8.15472920759589e-11)
(3.96944620863376e-12,1.54388311177342e-10,-6.14192361607602e-11)
(1.77005494982595e-11,2.14576135461011e-10,-3.58931359388436e-11)
(5.47539961627115e-12,2.61447757841948e-10,-2.41014596376318e-11)
(-1.08823677247661e-12,2.91900069028054e-10,-1.7099693038485e-11)
(-2.96299583935449e-12,3.07471823184249e-10,-9.21565758459497e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(7.85752719915232e-13,1.67580240304211e-11,-1.5728556072615e-10)
(1.16049388486227e-12,3.36972848003025e-11,-1.53024758651732e-10)
(7.82077713789582e-13,5.04372798411839e-11,-1.45031338547135e-10)
(-5.24651333821617e-13,6.96105999876577e-11,-1.33065089618599e-10)
(-3.59293254034936e-12,9.4806442540766e-11,-1.18426512592979e-10)
(-6.54963549357722e-12,1.30413518357769e-10,-1.02588449036241e-10)
(1.09685098872283e-11,2.15307988625024e-10,-8.80304723328206e-11)
(6.65329479364828e-12,2.57458352269571e-10,-6.26493201820093e-11)
(1.15512219888409e-12,2.83167559914553e-10,-4.11512675605683e-11)
(-1.29520708679574e-12,2.96352919382946e-10,-2.09141713637879e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(9.12661072937842e-13,1.31686390769244e-11,-1.92234421001717e-10)
(5.44864329889382e-13,2.66525876115752e-11,-1.88132260011854e-10)
(3.11446606342473e-14,3.93143048957505e-11,-1.80999112252207e-10)
(-1.92949352960946e-12,5.46412494000741e-11,-1.71021671214485e-10)
(-7.0780288662689e-12,7.60502123122528e-11,-1.58619171353578e-10)
(-1.41074584684612e-11,1.09817404098064e-10,-1.4558143519726e-10)
(1.04310731350751e-11,1.97309329811631e-10,-1.34111852744962e-10)
(5.77255019604858e-12,2.39902431205207e-10,-1.01201890266567e-10)
(8.10996806721203e-13,2.63273316048562e-10,-6.7467191306891e-11)
(-1.45388661320368e-12,2.74175965521596e-10,-3.38156111282986e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(8.87853835119197e-13,9.91626485849652e-12,-2.24500383196979e-10)
(3.54841740705888e-13,2.02271303880668e-11,-2.2135242064946e-10)
(2.29207700519454e-13,2.97658651090871e-11,-2.15556981994592e-10)
(-2.06042714930354e-12,4.13711881400992e-11,-2.07578408616774e-10)
(-7.45147501404488e-12,5.83113307029269e-11,-1.97905310411135e-10)
(-1.81284249267335e-11,8.73237233750801e-11,-1.89070501672284e-10)
(-8.76245739229611e-13,1.72711482106439e-10,-1.85963017613164e-10)
(7.69972330913453e-13,2.09909175777187e-10,-1.41080634244073e-10)
(-1.64653027181227e-12,2.29680214333089e-10,-9.31518580508934e-11)
(-2.86305900206216e-12,2.38869776852895e-10,-4.61740313900606e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-9.69915813621727e-13,7.53469004649291e-12,-2.50213207961487e-10)
(-1.53566272678615e-12,1.48081799542689e-11,-2.48122968173634e-10)
(-9.65567809935584e-13,2.18492596538824e-11,-2.4343747989592e-10)
(-1.72174106657835e-12,3.07027806619406e-11,-2.36609686558235e-10)
(-3.13358716160482e-12,4.47898424402679e-11,-2.2792485046019e-10)
(-6.41705116539781e-12,7.0737557929623e-11,-2.16711849562432e-10)
(-4.79611394409174e-12,1.27920510706657e-10,-2.00871707692056e-10)
(-4.02714602915462e-12,1.62887466317108e-10,-1.60307675508385e-10)
(-4.93750680021087e-12,1.81756320179084e-10,-1.09552725507259e-10)
(-6.08217056342978e-12,1.90989196962313e-10,-5.52798852044446e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-2.27654451533488e-12,5.45408371855705e-12,-2.68017223107299e-10)
(-2.99112348220858e-12,9.80284324720165e-12,-2.66261172755354e-10)
(-2.68164300665124e-12,1.48451472349812e-11,-2.62444700269581e-10)
(-2.31011928400176e-12,2.15750216337857e-11,-2.55870943238255e-10)
(-2.5385998032751e-12,3.23716042142547e-11,-2.4630453170916e-10)
(-4.51531774605988e-12,5.15437186316181e-11,-2.31738679218551e-10)
(-6.11073592832331e-12,8.48598558528496e-11,-2.08898561905349e-10)
(-6.98578557606779e-12,1.10161133585382e-10,-1.69288708849489e-10)
(-7.42610644171645e-12,1.24934463538577e-10,-1.17995068793829e-10)
(-8.49343549078645e-12,1.32751643100799e-10,-6.02969551898182e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-2.22360893577145e-12,3.04756287576978e-12,-2.77202494875759e-10)
(-3.6900610821118e-12,5.06145519883727e-12,-2.75021428344076e-10)
(-4.42378523804996e-12,7.58992835515345e-12,-2.7118405256022e-10)
(-3.5422624508091e-12,1.14218165274042e-11,-2.6477394375645e-10)
(-3.44726905627865e-12,1.72461666893887e-11,-2.54314386630543e-10)
(-5.42271561592884e-12,2.70922976466089e-11,-2.37908599835971e-10)
(-7.55316523944397e-12,4.24019010490351e-11,-2.12459254966748e-10)
(-8.23739126741174e-12,5.53892332001905e-11,-1.73109939794248e-10)
(-8.70180943104354e-12,6.33361772024173e-11,-1.21700314461614e-10)
(-9.78009040651642e-12,6.79334748342539e-11,-6.27750259936984e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-2.07521383459106e-13,2.49473133269702e-11,-2.59195603552425e-11)
(-3.20038302507151e-13,5.05603760207491e-11,-2.54165913641949e-11)
(-8.49282470161797e-14,7.90890717963748e-11,-2.41819595191067e-11)
(4.70536344991781e-13,1.08668235944381e-10,-2.10286063734349e-11)
(4.10396825980262e-13,1.43226984747043e-10,-1.6677818500625e-11)
(7.77940226140981e-13,1.81346994710757e-10,-1.19105056526389e-11)
(1.20326947426322e-12,2.18753227442489e-10,-7.04685298517884e-12)
(1.13756305437795e-12,2.54121612843438e-10,-3.91404860114514e-12)
(8.87537514860871e-13,2.82784253406182e-10,-2.22630873501708e-12)
(1.40901241036141e-12,2.98775711296191e-10,-1.41476760599332e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(3.26051189105999e-13,2.42368229524611e-11,-5.43646636743388e-11)
(2.73746299433351e-14,4.90057058731225e-11,-5.30020225923063e-11)
(3.40978773305183e-13,7.58507904036812e-11,-5.00497770645114e-11)
(1.38774235379786e-12,1.04787984416569e-10,-4.42269829295241e-11)
(1.77454814656186e-12,1.38870068725057e-10,-3.57286501805216e-11)
(1.83052711913485e-12,1.7726128226946e-10,-2.57686377747239e-11)
(1.55276692218629e-12,2.16823692532689e-10,-1.65409894988562e-11)
(8.30237417457794e-13,2.53571436031712e-10,-1.04886953309e-11)
(2.89794348589233e-13,2.82860249792015e-10,-6.89337143159778e-12)
(3.80453435908718e-13,2.98769956100554e-10,-3.68021735540601e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.68314936084722e-13,2.32002330595381e-11,-8.58874136052193e-11)
(8.07950171284041e-14,4.60808349752866e-11,-8.30030825174049e-11)
(4.22901367860324e-13,7.03689750419964e-11,-7.7551614983524e-11)
(1.25970535267743e-12,9.76773940213573e-11,-6.90226661606756e-11)
(1.77438067207142e-12,1.30684604465829e-10,-5.69024530796192e-11)
(1.91230685917957e-12,1.69864161112709e-10,-4.27619880143941e-11)
(2.56410204025913e-12,2.12324165286915e-10,-2.9129513695192e-11)
(9.56342802951624e-13,2.50806349549882e-10,-1.94415447483265e-11)
(-5.21616549755975e-13,2.79936890064414e-10,-1.304567360319e-11)
(-4.9777530967096e-13,2.95470192181059e-10,-6.94408366033949e-12)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.76116772382438e-13,2.04842169077838e-11,-1.18935376849976e-10)
(-9.54524958712178e-14,4.07101624585908e-11,-1.15571032860676e-10)
(2.26529691817892e-13,6.22629275869829e-11,-1.09062794797826e-10)
(9.94219826751482e-13,8.68168862929768e-11,-9.8585186057218e-11)
(1.59000925763749e-12,1.18318520072669e-10,-8.47666645669364e-11)
(2.4181388063094e-12,1.58143993652675e-10,-6.86269619129523e-11)
(5.17702003312124e-12,2.05200298380328e-10,-5.13410824163078e-11)
(2.4630385894564e-12,2.45366821207687e-10,-3.70906959738619e-11)
(-2.39763112839439e-13,2.73313683571813e-10,-2.4925034284437e-11)
(-1.05974962262762e-12,2.88028333211045e-10,-1.28421512484855e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.14335599027624e-13,1.69437561460977e-11,-1.53351977412387e-10)
(2.11770969012034e-13,3.41064718998694e-11,-1.49810152430397e-10)
(-6.11962693521191e-14,5.20118485381636e-11,-1.42972305223187e-10)
(-1.9387777186014e-13,7.39925846294823e-11,-1.32639660104066e-10)
(-6.7476586854551e-13,1.03768826676339e-10,-1.19539073339824e-10)
(-5.11497937341345e-13,1.43276252962319e-10,-1.04411101192248e-10)
(3.58601654985903e-12,1.96126931970989e-10,-8.72454712202782e-11)
(2.71116323654785e-12,2.35664198107758e-10,-6.62132915668719e-11)
(8.12269868118937e-13,2.60991037423008e-10,-4.47292452221831e-11)
(-3.24245892490684e-14,2.74126432339924e-10,-2.28433051674178e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(6.28743014922752e-14,1.35162667631149e-11,-1.87216499407764e-10)
(-1.62826206228773e-13,2.74803956616804e-11,-1.83831458758231e-10)
(-3.97856590439246e-13,4.16180071496604e-11,-1.77730404819383e-10)
(-1.06193213053466e-12,6.0698120093422e-11,-1.68970364727766e-10)
(-2.37688341330997e-12,8.79660886601941e-11,-1.57253217735657e-10)
(-3.08336019778119e-12,1.25599125053023e-10,-1.42868144587639e-10)
(2.11895836192752e-12,1.78680768867458e-10,-1.2494748742642e-10)
(2.03110666438782e-12,2.16891314999587e-10,-9.75694660604946e-11)
(7.52518343569926e-13,2.39917367236386e-10,-6.65512649033363e-11)
(3.66909271502326e-14,2.51250702583255e-10,-3.38516997934585e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(1.21466099585974e-13,1.01941004150866e-11,-2.15866446642557e-10)
(-2.1646480344569e-14,2.12165155166088e-11,-2.13480065862283e-10)
(1.67239777949751e-13,3.24601104675839e-11,-2.08714845830568e-10)
(-1.06511787682844e-12,4.79190409707737e-11,-2.01545328424343e-10)
(-2.76479549024702e-12,7.1204132098909e-11,-1.91514707630608e-10)
(-4.64974354032874e-12,1.04595107694012e-10,-1.77829692589299e-10)
(-9.67657708649475e-13,1.53421705863448e-10,-1.59208305375736e-10)
(-1.37094402179665e-13,1.87904220506808e-10,-1.25680160912884e-10)
(-7.00462778638426e-13,2.07970320470083e-10,-8.56092415106953e-11)
(-1.15651050153878e-12,2.17435693716953e-10,-4.30847323336241e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-9.79549273511409e-13,7.92918573440416e-12,-2.37647468277336e-10)
(-1.21581429745577e-12,1.64296490045525e-11,-2.36639443370878e-10)
(-7.89248728731008e-13,2.54578328393216e-11,-2.32612006936705e-10)
(-1.27881813645466e-12,3.68233023002053e-11,-2.25600411713253e-10)
(-1.92834983332888e-12,5.47543215673709e-11,-2.15831354141345e-10)
(-3.06335373781696e-12,8.13239769400494e-11,-2.01183689243543e-10)
(-2.29949127393522e-12,1.18925903691989e-10,-1.79219893537912e-10)
(-2.05576329855234e-12,1.47696206702434e-10,-1.43455245661729e-10)
(-2.38849046250075e-12,1.64745348514395e-10,-9.89811807732861e-11)
(-3.12450190638578e-12,1.73194450881792e-10,-5.01045922881422e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.6260740244798e-12,5.94161155444781e-12,-2.51276090182776e-10)
(-2.06620791962151e-12,1.11863982728878e-11,-2.50418468989833e-10)
(-2.00018115814377e-12,1.76569888871645e-11,-2.47210059491604e-10)
(-1.72332570673213e-12,2.5775426591845e-11,-2.40689092515937e-10)
(-1.97901476899833e-12,3.81783068362484e-11,-2.30195149620981e-10)
(-2.90401407424476e-12,5.62968274965995e-11,-2.13953811158622e-10)
(-3.26263418037604e-12,8.08617645418494e-11,-1.89661285195816e-10)
(-3.50752524653668e-12,1.01166378515443e-10,-1.53064275795302e-10)
(-3.52593370956158e-12,1.13480269566745e-10,-1.06862352706365e-10)
(-3.97222241405785e-12,1.19965356687267e-10,-5.4584006452108e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(-1.35711259168599e-12,3.45791633702914e-12,-2.58961465544899e-10)
(-2.46598166713229e-12,5.91178085503545e-12,-2.56860661799555e-10)
(-3.24396568666388e-12,9.13584075335325e-12,-2.53414862611652e-10)
(-2.58000304931289e-12,1.35581579901614e-11,-2.47522987544962e-10)
(-2.60688916145147e-12,1.99579536048773e-11,-2.36544832604114e-10)
(-3.77976283855498e-12,2.91002874595701e-11,-2.19193768160688e-10)
(-4.50057936290342e-12,4.10021209609395e-11,-1.93873243539673e-10)
(-4.25778339985735e-12,5.14569301799727e-11,-1.57371701941637e-10)
(-4.29092069654219e-12,5.76759896029281e-11,-1.10172555161522e-10)
(-4.62164156596236e-12,6.14091278210982e-11,-5.67874862551359e-11)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(0,0,0)
(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;
}
}
// ************************************************************************* //
|
|
17125c0c756408efe78de143ddc7f1606d3454b6
|
f230d1d5398189bf2e36f6f3436a291b170df1af
|
/hpp/lighting.h
|
481657202814705180ca76fd24720ed385af8ab9
|
[] |
no_license
|
Madoww/Hide_From_The_Dark
|
3f96c922a4a164123a9faadb733964b6d43bd2b9
|
e8c9358b11abcd9c0a717b67fe38116c88c03aaf
|
refs/heads/master
| 2020-09-13T11:38:29.725072
| 2019-11-19T18:46:40
| 2019-11-19T18:46:40
| 222,764,477
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,539
|
h
|
lighting.h
|
#ifndef LIGHTING_H
#define LIGHTING_H
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <iostream>
#include <fstream>
class lighting
{
public:
bool fire = false;
float scale = 0;
lighting(std::vector<sf::Sprite>&treeshadows) :
m_layer()
{
burnt.loadFromFile("Sources/Textures/burnt.png");
m_layer.create(1600, 900);
m_flashlightTexture.create(100, 100);
// We want to have semi-transparent edges.
generateSpot();
m_flashlight.setTexture(m_flashlightTexture.getTexture(), true);
m_flashlight.setPosition(150.f, 150.f);
m_flashlight.setOrigin(50.f, 50.f);
m_torch.setTexture(m_flashlightTexture.getTexture(),true);
m_torch.setPosition(150.f,150.f);
m_torch.setOrigin(50.f,50.f);
m_torch.setScale(4,4);
m_torch.setPosition(800,450);
m_sprite.setTexture(m_layer.getTexture());
m_sprite.setOrigin(m_sprite.getGlobalBounds().width/2,m_sprite.getGlobalBounds().height/2);
for(int i = 0; i<m_fire.size(); i++)
m_fire[i] = m_torch;
upfiretex.loadFromFile("Sources/Textures/topfire.png");
upfire.setTexture(upfiretex);
part.setSize(sf::Vector2f(3,3));
buffer.loadFromFile("Sources/Sounds/fire.ogg");
sound.setBuffer(buffer);
sound.stop();
r1.setPosition(0,0);
r1.setSize(sf::Vector2f(1,1));
r2.setSize(sf::Vector2f(1,1));
r2.setPosition(40,0);
file.open("Sources/Saves/time.txt", std::ios::in);
if(file.good()==true)
{
while(std::getline(file,line))
{
switch(linenr)
{
case 0: darkness_level = atoi(line.c_str());
break;
case 1: rotation = atoi(line.c_str());
break;
case 2: alpha = atoi(line.c_str());
break;
case 3: scale_load = atoi(line.c_str());
break;
}
linenr++;
}
loadup = true;
std::cout<<"SCALE: "<<scale_load<<std::endl;
}
}
sf::FloatRect getGlobalBounds(int i){return m_fire[i].getGlobalBounds();}
std::fstream file;
int linenr = 0;
std::string line;
int rotation;
int alpha = 0;
float scale_load = 0;
bool loadup = false;
sf::SoundBuffer buffer;
sf::Sound sound;
std::vector<sf::Sound>sounds;
sf::Vector2f direction;
float magnitude;
void drawFire(sf::RenderTarget& window, const float& windspeed);
void save(float rotation, float alpha, float scale);
void load(std::vector<sf::Sprite>&treeshadows, std::vector<sf::Sprite>&stoneshadows, std::vector<sf::Sprite>&ironshadows);
void generateSpot()
{
m_flashlightTexture.clear();
// Draw 6 circles with increasing transparency
for(unsigned int i = 0; i < 6; ++i)
{
sf::CircleShape temp(50.f-(i*2.f));
temp.setOrigin(sf::Vector2f(50.f-(i*2.f), 50.f-(i*4.f)));
temp.setFillColor(sf::Color(100, 250, 250, 61-(i*6)));
temp.setPosition(sf::Vector2f(50.f, 50.f));
m_flashlightTexture.draw(temp, sf::BlendNone);
}
m_flashlightTexture.display();
}
void runlight(sf::RenderWindow &window, float &dark, float &oilAm, sf::RectangleShape &prect, int slotID, int &durability, std::vector<sf::Sprite> &fires, sf::Vector2f& unitvector
,sf::Sprite& player, bool& ismoving, float& windspeed, bool& nighttime);
float darkness_level = 0;//100
float torchoff = 0;
bool flashon = false;
bool torchon = false;
bool infire = false;
std::vector<sf::Sprite> m_fire;
std::vector<float>firefuel;
std::vector<bool>upscale;
std::vector<bool>onfire;
std::vector<sf::Sprite>fsprites;
sf::Sprite upfire;
sf::Texture upfiretex;
//bool upscale = true;
float fscale;
sf::Sprite m_torch;
private:
sf::RenderTexture m_flashlightTexture;
sf::RenderTexture m_layer;
sf::Sprite m_flashlight;
sf::Texture burnt;
sf::Sprite m_sprite;
sf::CircleShape circle;
sf::RectangleShape part;
std::vector<sf::Vector2f>units;
std::vector<sf::RectangleShape>particles;
std::vector<sf::RectangleShape>fireparticles;
sf::RectangleShape r1;
sf::RectangleShape r2;
sf::Time time;
sf::Clock clock;
};
#endif // LIGHTING_H
|
16c4548a48724c82ce7a35f4433ecba6c027c26a
|
3f3095dbf94522e37fe897381d9c76ceb67c8e4f
|
/Current/OBJ_2nd_Find_Fossil.hpp
|
a999ae44be2d24eeb3f0c3f864cc8730ef34bcac
|
[] |
no_license
|
DRG-Modding/Header-Dumps
|
763c7195b9fb24a108d7d933193838d736f9f494
|
84932dc1491811e9872b1de4f92759616f9fa565
|
refs/heads/main
| 2023-06-25T11:11:10.298500
| 2023-06-20T13:52:18
| 2023-06-20T13:52:18
| 399,652,576
| 8
| 7
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 158
|
hpp
|
OBJ_2nd_Find_Fossil.hpp
|
#ifndef UE4SS_SDK_OBJ_2nd_Find_Fossil_HPP
#define UE4SS_SDK_OBJ_2nd_Find_Fossil_HPP
class UOBJ_2nd_Find_Fossil_C : public UOBJ_FindItems_Base_C
{
};
#endif
|
9b8685d4bd9c2539a6d5c857f63904b62f8579d0
|
0954958443d9f01c60258f5689249440316174dc
|
/Knighto/src/Player.cpp
|
196bee87f5b9267fc7c1c534ead5ea588c1a117d
|
[] |
no_license
|
Etherion33/Knighto---2D-Platformer
|
f3d9767c71501a71702bcae7fd877ee5fcd4ab31
|
57bec58e233a916600527ddaade0e19f68e3063e
|
refs/heads/master
| 2021-09-06T23:57:14.919598
| 2018-02-13T19:05:54
| 2018-02-13T19:05:54
| 109,484,175
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,211
|
cpp
|
Player.cpp
|
#include "../include/Player.h"
#include <iostream>
Player::Player(Entity_Manager* entmgr,const sf::Texture& spritesheet)
: Character(entmgr,spritesheet)
{
this->m_enType = EntityType::Player;
this->m_Name = "Knighto";
this->m_health = 100;
this->m_maxVelocity = { 100.f,150.f };
this->m_Speed = { 512.f,50.f };
this->currentAnimation = m_Animations["idle_right"];
//this->m_attackAABBoffset = { -5 ,0 };
//this->m_attackAABB = { m_attackAABBoffset.x, m_attackAABBoffset.y, 10, 13 };
this->m_enState = EntityState::Idle;
this->setSize(10, 13);
this->score = 0;
this->m_AnimatedSprite = AnimatedSprite(sf::seconds(0.2), true, false);
//m_PlayerSprite.setPosition(m_PlayerPos);
//this->m_AnimatedSprite.setPosition(m_Pos);
}
//void Player::draw(sf::RenderWindow& window, float dt)
//{
// //window.draw(this->m_AnimatedSprite);
// return;
//}
//
void Player::update(float dt)
{
if (!m_isEquipped)
{
this->m_attackAABBoffset = { -5 ,0 };
this->m_attackAABB = { m_attackAABBoffset.x, m_attackAABBoffset.y, 10, 13 };
}
else
{
this->m_attackAABBoffset = { -5 ,0 };
this->m_attackAABB = { m_attackAABBoffset.x, m_attackAABBoffset.y, 15, 13 };
}
Character::update(dt);
}
void Player::OnEntityCollision(EntityBase * l_collider, bool l_attack)
{
if (m_enState == EntityState::Dying) { return; }
if (l_attack) {
if (m_enState != EntityState::Attacking) { return; }
//if (!m_spriteSheet.GetCurrentAnim()->IsInAction()) { return; }
if (l_collider->getType() != EntityType::Enemy &&
l_collider->getType() != EntityType::Player)
{
return;
}
Character* opponent = (Character*)l_collider;
if (!this->m_isEquipped)
{
opponent->getHurt(5);
}
else {
opponent->getHurt(20);
}
if (m_Pos.x > opponent->getPosition().x) {
opponent->addVelocity(-32, 0);
}
else {
opponent->addVelocity(32, 0);
}
}
else {
// Other behavior.
}
}
Player::~Player()
{
}
void Player::handleInput(std::string input)
{
if (input == "MoveLeft") {
Character::move(DIRECTION::LEFT);
}
else if (input == "MoveRight") {
Character::move(DIRECTION::RIGHT);
}
else if (input == "Jump") {
Character::jump();
}
else if (input == "Attack") {
Character::attack();
}
}
|
69e44d6dc58f0c7b640a1757476739fa310f3f1f
|
86dbc997ec774dcdfb2600a0a6973514faebc572
|
/src/ProjectSettings.h
|
cc482e0157f85ca7471a1dfb9cc0948d8c63d9ed
|
[] |
no_license
|
w23/stameska
|
a19eb65487fc525112eb77cdd074bfdbd9092bfc
|
1d6c2db1e9117d5051541eae401ebceece2e93e2
|
refs/heads/master
| 2023-05-31T09:49:18.184744
| 2022-05-02T06:30:19
| 2022-05-02T06:30:19
| 167,215,751
| 6
| 2
| null | 2022-05-01T23:25:09
| 2019-01-23T16:33:02
|
C
|
UTF-8
|
C++
| false
| false
| 557
|
h
|
ProjectSettings.h
|
#pragma once
#include "Export.h"
#include "Expected.h"
#include <string>
struct ProjectSettings {
struct {
std::string config_filename;
} video;
struct Audio {
int samplerate = 0;
int channels = 0;
int samples = 0;
int samples_per_row = 0;
int pattern_length = 16;
float *data = nullptr;
} audio;
struct Automation {
enum class Type { None, Basic, Rocket, Gui } type = Type::None;
std::string filename;
} automation;
ExportSettings exports;
static Expected<ProjectSettings, std::string> readFromFile(const char *filename);
};
|
e880f3a70372f660523c0b2f659f73e56252fe1b
|
1df0f2dd40099cdc146dc82ee353e7ea4e563af2
|
/shared/h5/HAsset.h
|
27818f3363d599c55300dff5a4eeab8e3b3a61ef
|
[] |
no_license
|
chuckbruno/aphid
|
1d0b2637414a03feee91b4c8909dd5d421d229d4
|
f07c216f3fda0798ee3f96cd9decb35719098b01
|
refs/heads/master
| 2021-01-01T18:10:17.713198
| 2017-07-25T02:37:15
| 2017-07-25T02:37:15
| 98,267,729
| 0
| 1
| null | 2017-07-25T05:30:27
| 2017-07-25T05:30:27
| null |
UTF-8
|
C++
| false
| false
| 1,366
|
h
|
HAsset.h
|
/*
* HAsset.h
* julia
*
* Created by jian zhang on 4/1/16.
* Copyright 2016 __MyCompanyName__. All rights reserved.
*
*/
#include <HBase.h>
#include <Boundary.h>
namespace aphid {
template<typename T>
class HAsset : public HBase, public Boundary {
int m_active;
public:
HAsset(const std::string & name);
virtual ~HAsset();
virtual char save();
virtual char load();
void setActive(const int & x);
const int & isActive() const;
protected:
private:
};
template<typename T>
HAsset<T>::HAsset(const std::string & name) :
HBase(name),
m_active(1)
{}
template<typename T>
HAsset<T>::~HAsset()
{}
template<typename T>
void HAsset<T>::setActive(const int & x)
{ m_active = x; }
template<typename T>
const int & HAsset<T>::isActive() const
{ return m_active; }
template<typename T>
char HAsset<T>::save()
{
if(!hasNamedAttr(".bbx") )
addFloatAttr(".bbx", 6);
writeFloatAttr(".bbx", (float *)&getBBox() );
if(!hasNamedAttr(".elemtyp") )
addIntAttr(".elemtyp", 1);
int et = T::ShapeTypeId;
writeIntAttr(".elemtyp", (int *)&et );
if(!hasNamedAttr(".act") )
addIntAttr(".act", 1);
writeIntAttr(".act", (int *)&m_active );
return 1;
}
template<typename T>
char HAsset<T>::load()
{
BoundingBox b;
readFloatAttr(".bbx", (float *)&b );
setBBox(b);
readFloatAttr(".act", (float *)&m_active );
return 1;
}
}
|
4f69b6a18ed69c514ef1583c90ca8bd6b4cb56e5
|
54ad700aee625c4073cf993a0f468f9954b390f3
|
/unittest/UMEUnitTestSimd1024b.cpp
|
12fd80256b7fef54bc8d3c75cc24d2d542d009d9
|
[
"MIT"
] |
permissive
|
sparks-code/umesimd
|
ed2b05d54b4b7dc7d8489733be79cc2f7a0cfa92
|
6f72452743151b76ecb9ddf4dd696d263b45cb74
|
refs/heads/master
| 2023-03-16T05:48:13.475265
| 2018-01-19T08:24:44
| 2018-01-19T08:24:44
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,418
|
cpp
|
UMEUnitTestSimd1024b.cpp
|
// The MIT License (MIT)
//
// Copyright (c) 2015-2017 CERN
//
// Author: Przemyslaw Karpinski
//
// 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.
//
//
// This piece of code was developed as part of ICE-DIP project at CERN.
// "ICE-DIP is a European Industrial Doctorate project funded by the European Community's
// 7th Framework programme Marie Curie Actions under grant PITN-GA-2012-316596".
//
#include "UMEUnitTestSimd1024b.h"
using namespace UME::SIMD;
int test_UME_SIMD1024b(bool supressMessages)
{
int simd128_8_res = test_UME_SIMD128_8(supressMessages);
int simd64_16_res = test_UME_SIMD64_16(supressMessages);
int simd32_32_res = test_UME_SIMD32_32(supressMessages);
int simd16_64_res = test_UME_SIMD16_64(supressMessages);
return simd128_8_res + simd64_16_res + simd32_32_res + simd16_64_res;
}
int test_UME_SIMD128_8(bool supressMessages)
{
int fail_u = test_UME_SIMD128_8u(supressMessages);
int fail_i = test_UME_SIMD128_8i(supressMessages);
return fail_u + fail_i;
}
int test_UME_SIMD64_16(bool supressMessages)
{
int fail_u = test_UME_SIMD64_16u(supressMessages);
int fail_i = test_UME_SIMD64_16i(supressMessages);
return fail_u + fail_i;
}
int test_UME_SIMD32_32(bool supressMessages)
{
int fail_u = test_UME_SIMD32_32u(supressMessages);
int fail_i = test_UME_SIMD32_32i(supressMessages);
int fail_f = test_UME_SIMD32_32f(supressMessages);
return fail_u + fail_i + fail_f;
}
int test_UME_SIMD16_64(bool supressMessages)
{
int fail_u = test_UME_SIMD16_64u(supressMessages);
int fail_i = test_UME_SIMD16_64i(supressMessages);
int fail_f = test_UME_SIMD16_64f(supressMessages);
return fail_u + fail_i + fail_f;
}
// ****************************************************************************
// * Test functions for specific vector types
// ****************************************************************************
int test_UME_SIMD128_8u(bool supressMessages) {
char header[] = "UME::SIMD::SIMD128_8u test";
INIT_TEST(header, supressMessages);
{
SIMD128_8u vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
{
SIMD128_8u vec0(
127, 126, 125, 124, 123, 122, 121, 120,
119, 118, 117, 116, 115, 114, 113, 112,
111, 110, 109, 108, 107, 106, 105, 104,
103, 102, 101, 100, 99, 98, 97, 96,
95, 94, 93, 92, 91, 90, 89, 88,
87, 86, 85, 84, 83, 82, 81, 80,
79, 78, 77, 76, 75, 74, 73, 72,
71, 70, 69, 68, 67, 66, 65, 64,
63, 62, 61, 60, 59, 58, 57, 56,
55, 54, 53, 52, 51, 50, 49, 48,
47, 46, 45, 44, 43, 42, 41, 40,
39, 38, 37, 36, 35, 34, 33, 32,
31, 30, 29, 28, 27, 26, 25, 24,
23, 22, 21, 20, 19, 18, 17, 16,
15, 14, 13, 12, 11, 10, 9, 8,
7, 6, 5, 4, 3, 2, 1, 0);
uint8_t raw[128];
vec0.store(raw);
bool cond = true;
for(int i = 0; i < 128; i++) {
if(raw[i] != (127 - i)) {
cond = false;
std::cout << "Fail at: " << i << " raw: " << raw[i] << " vec0[i]: " << vec0[i] << "\n";
break;
}
}
CHECK_CONDITION(cond, "FULL-CONSTR");
}
genericUintTest<
SIMD128_8u, uint8_t,
SIMD128_8i, int8_t,
SIMDMask128,
SIMDSwizzle128,
128,
DataSet_1_8u>();
return g_failCount;
}
int test_UME_SIMD128_8i(bool supressMessages) {
char header[] = "UME::SIMD::SIMD128_8i test";
INIT_TEST(header, supressMessages);
{
SIMD128_8i vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
{
SIMD128_8i vec0(
127, 126, 125, 124, 123, 122, 121, 120,
119, 118, 117, 116, 115, 114, 113, 112,
111, 110, 109, 108, 107, 106, 105, 104,
103, 102, 101, 100, 99, 98, 97, 96,
95, 94, 93, 92, 91, 90, 89, 88,
87, 86, 85, 84, 83, 82, 81, 80,
79, 78, 77, 76, 75, 74, 73, 72,
71, 70, 69, 68, 67, 66, 65, 64,
63, 62, 61, 60, 59, 58, 57, 56,
55, 54, 53, 52, 51, 50, 49, 48,
47, 46, 45, 44, 43, 42, 41, 40,
39, 38, 37, 36, 35, 34, 33, 32,
31, 30, 29, 28, 27, 26, 25, 24,
23, 22, 21, 20, 19, 18, 17, 16,
15, 14, 13, 12, 11, 10, 9, 8,
7, 6, 5, 4, 3, 2, 1, 0);
int8_t raw[128];
vec0.store(raw);
bool cond = true;
for(int i = 0; i < 128; i++) {
if(raw[i] != (127 - i)) {
cond = false;
break;
}
}
CHECK_CONDITION(cond, "FULL-CONSTR");
}
genericIntTest<
SIMD128_8i, int8_t,
SIMD128_8u, uint8_t,
SIMDMask128,
SIMDSwizzle128,
128,
DataSet_1_8i>();
return g_failCount;
}
int test_UME_SIMD64_16u(bool supressMessages) {
char header[] = "UME::SIMD::SIMD64_16u test";
INIT_TEST(header, supressMessages);
{
SIMD64_16u vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
{
SIMD64_16u vec0(
63, 62, 61, 60, 59, 58, 57, 56,
55, 54, 53, 52, 51, 50, 49, 48,
47, 46, 45, 44, 43, 42, 41, 40,
39, 38, 37, 36, 35, 34, 33, 32,
31, 30, 29, 28, 27, 26, 25, 24,
23, 22, 21, 20, 19, 18, 17, 16,
15, 14, 13, 12, 11, 10, 9, 8,
7, 6, 5, 4, 3, 2, 1, 0);
uint16_t raw[64];
vec0.store(raw);
bool cond = true;
for(int i = 0; i < 64; i++) {
if(raw[i] != (63 - i)) {
cond = false;
break;
}
}
CHECK_CONDITION(cond, "FULL-CONSTR");
}
genericUintTest<
SIMD64_16u, uint16_t,
SIMD64_16i, int16_t,
SIMDMask64,
SIMDSwizzle64,
64,
DataSet_1_16u>();
genericDEGRADETest<
SIMD64_16u, uint16_t,
SIMD64_8u, uint8_t,
64,
DataSet_1_16u>();
return g_failCount;
}
int test_UME_SIMD64_16i(bool supressMessages) {
char header[] = "UME::SIMD::SIMD64_16i test";
INIT_TEST(header, supressMessages);
{
SIMD64_16i vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
{
SIMD64_16i vec0(
63, 62, 61, 60, 59, 58, 57, 56,
55, 54, 53, 52, 51, 50, 49, 48,
47, 46, 45, 44, 43, 42, 41, 40,
39, 38, 37, 36, 35, 34, 33, 32,
31, 30, 29, 28, 27, 26, 25, 24,
23, 22, 21, 20, 19, 18, 17, 16,
15, 14, 13, 12, 11, 10, 9, 8,
7, 6, 5, 4, 3, 2, 1, 0);
int16_t raw[64];
vec0.store(raw);
bool cond = true;
for(int i = 0; i < 64; i++) {
if(raw[i] != (63 - i)) {
cond = false;
break;
}
}
CHECK_CONDITION(cond, "FULL-CONSTR");
}
genericIntTest<
SIMD64_16i, int16_t,
SIMD64_16u, uint16_t,
SIMDMask64,
SIMDSwizzle64,
64,
DataSet_1_16i>();
genericDEGRADETest<
SIMD64_16i, int16_t,
SIMD64_8i, int8_t,
64,
DataSet_1_16i>();
return g_failCount;
}
int test_UME_SIMD32_32u(bool supressMessages) {
char header[] = "UME::SIMD::SIMD32_32u test";
INIT_TEST(header, supressMessages);
genericUintTest<
SIMD32_32u, uint32_t,
SIMD32_32i, int32_t,
SIMD32_32f, float,
SIMDMask32,
SIMDSwizzle32,
32,
DataSet_1_32u>();
genericDEGRADETest<
SIMD32_32u, uint32_t,
SIMD32_16u, uint16_t,
32,
DataSet_1_32u>();
{
SIMD32_32u vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
return g_failCount;
}
int test_UME_SIMD32_32i(bool supressMessages) {
char header[] = "UME::SIMD::SIMD32_32i test";
INIT_TEST(header, supressMessages);
genericIntTest<
SIMD32_32i, int32_t,
SIMD32_32u, uint32_t,
SIMD32_32f, float,
SIMDMask32,
SIMDSwizzle32,
32,
DataSet_1_32i>();
genericDEGRADETest<
SIMD32_32i, int32_t,
SIMD32_16i, int16_t,
32,
DataSet_1_32i>();
{
SIMD32_32i vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
return g_failCount;
}
int test_UME_SIMD32_32f(bool supressMessages) {
char header[] = "UME::SIMD::SIMD32_32f test";
INIT_TEST(header, supressMessages);
{
SIMD32_32f vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
genericFloatTest<
SIMD32_32f, float,
SIMD32_32u, uint32_t,
SIMD32_32i, int32_t,
SIMDMask32,
SIMDSwizzle32,
32,
DataSet_1_32f>();
return g_failCount;
}
int test_UME_SIMD16_64u(bool supressMessages) {
char header[] = "UME::SIMD::SIMD16_64u test";
INIT_TEST(header, supressMessages);
{
SIMD16_64u vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
genericUintTest<
SIMD16_64u, uint64_t,
SIMD16_64i, int64_t,
SIMD16_64f, double,
SIMDMask16,
SIMDSwizzle16,
16,
DataSet_1_64u>();
genericDEGRADETest<
SIMD16_64u, uint64_t,
SIMD16_32u, uint32_t,
16,
DataSet_1_64u>();
return g_failCount;
}
int test_UME_SIMD16_64i(bool supressMessages) {
char header[] = "UME::SIMD::SIMD16_64i test";
INIT_TEST(header, supressMessages);
{
SIMD16_64i vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
genericIntTest<
SIMD16_64i, int64_t,
SIMD16_64u, uint64_t,
SIMDMask16,
SIMDSwizzle16,
16,
DataSet_1_64i>();
genericDEGRADETest<
SIMD16_64i, int64_t,
SIMD16_32i, int32_t,
16,
DataSet_1_64i>();
return g_failCount;
}
int test_UME_SIMD16_64f(bool supressMessages) {
char header[] = "UME::SIMD::SIMD16_64f test";
INIT_TEST(header, supressMessages);
{
SIMD16_64f vec0;
CHECK_CONDITION(true, "ZERO-CONSTR");
}
genericFloatTest<
SIMD16_64f, double,
SIMD16_64u, uint64_t,
SIMD16_64i, int64_t,
SIMDMask16,
SIMDSwizzle16,
16,
DataSet_1_64f>();
genericDEGRADETest<
SIMD16_64f, double,
SIMD16_32f, float,
16,
DataSet_1_64i>();
return g_failCount;
}
|
d52e79e1eb255e25cc36a380e856a189af69c9fb
|
2417cfa64db3dcdc20e7434a4c7916f70dffe6d7
|
/mpi_purposive_sampling/mpi_FCM.cpp
|
aba1ae3a8f735ae38feef1f96a2710dcc8be079a
|
[] |
no_license
|
lipe12/websevice
|
985c58736abc18d55095d1a0c7123128a24f4d92
|
a06f602c43ce73f573b7f1d2469d9370fa144f02
|
refs/heads/master
| 2021-01-19T06:13:54.286914
| 2020-02-06T03:22:27
| 2020-02-06T03:22:27
| 61,343,122
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 16,705
|
cpp
|
mpi_FCM.cpp
|
/*算法描述:
FCM聚类算法采用的是给定类的个数K,将N个元素(对象)分配到K个类中去使得类内对象之间的相似性最大,而类之间的相似性最小 */
#include "mpi_FCM.h"
#define INF_T 0.01
mpi_FCM::mpi_FCM(int number,int maxIteration,float error)
{
this->number = number;
this->maxIteration=maxIteration;
//this->tolerance=0.65; //2.5m
//this->tolerance=0.45; //1m
this->tolerance=error; //0.5m
this->Fuzzyness=2.0;
this->format = "GTiff";
this->pTransform = new double[6];
pMyarray = NULL;
pClass = NULL;
GDALAllRegister();
}
mpi_FCM::~mpi_FCM()
{
}
int mpi_FCM::FCM_Processing(char* inputfile,char* outputfile,float error)
{
MPI_Comm_size(MPI_COMM_WORLD, &numProcs); //进程数
MPI_Comm_rank(MPI_COMM_WORLD, &rank); //当前进程编号
int i=0;
int j=0;
char strDest[2000];
strcpy(strDest,inputfile);
strParsing(strDest); //字符串解析
imageNum=allPathfiles.size(); //影像数目
readInfo(allPathfiles[0]);
double startTime=MPI_Wtime();
for(i=0;i<imageNum;i++)
{
readDataFile(allPathfiles[i]);
vecAllData.push_back(pMyarray);
}
MPI_Barrier(MPI_COMM_WORLD);
double endTime=MPI_Wtime();
double IOReadTime=endTime-startTime;
//cout<<"IO Read Time: "<<IOReadTime<<endl;
center =new double[number * imageNum]; //聚类中心 number * imageNum
int* centerIndex =new int [number]; //聚类中心索引 number * 1
int* centerIndexTmp =new int [number]; //聚类中心索引 K * 1
vector<int> tempIndex;
for(i=0;i<subRow * column;i++)
{
if(vecAllData[0][i]!=noData && fabs(vecAllData[0][i]+9999)>INF_T)
tempIndex.push_back(i);
}
CreateRandom(number,tempIndex.size(),centerIndexTmp);
for(i=0;i<number;i++)
{
centerIndex[i]=tempIndex[centerIndexTmp[i]];
}
//2.5m迭代40次(单节点)
if(rank==0)
{
for(i=0;i<number;i++)
{
for(j=0;j<imageNum;j++)
{
center[i*imageNum+j]=vecAllData[j][centerIndex[i]];
}
}
tempIndex.clear();
}
int curIteration=1; //当前迭代次数
sumNumerator=new double [number*imageNum]; //各进程中汇总各进程中分子求和
sumDenominator=new double[number]; //各进程中汇总各进程中分母求和(隶属度求和)
toalNumerator=new double [number*imageNum]; //主进程中汇总各进程中分子求和
toalDenominator=new double[number]; //主进程中汇总各进程中分母求和(隶属度求和)
degree=new double *[number];
for(i=0;i<number;i++)
{
degree[i]=new double[block];
}
double subObjectValue;
double subObjectValueNew;
MPI_Barrier(MPI_COMM_WORLD);
MPI_Bcast(center, number*imageNum, MPI_DOUBLE, 0, MPI_COMM_WORLD); //主进程广播K个聚类中心
InitDegree(); //初始化隶属度
subObjectValueNew=fnObjectiveFunction();
MPI_Allreduce(&subObjectValueNew,&objectValueNew,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
//objectValueNew=sqrt(objectValueNew);
double df=0.0;
MPI_Barrier(MPI_COMM_WORLD);
do
{
objectValue=objectValueNew;
fnClusterCentroid(); //计算聚类中心
MPI_Barrier(MPI_COMM_WORLD);
MPI_Allreduce(sumNumerator,toalNumerator,number*imageNum,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
MPI_Allreduce(sumDenominator,toalDenominator,number,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
for(i=0;i<number;i++)
{
for(j=0;j<imageNum;j++)
{
center[i*imageNum+j]=toalNumerator[i*imageNum+j]/toalDenominator[i];
}
}
fnDegreeMembership(); //计算隶属度
subObjectValueNew=fnObjectiveFunction();
MPI_Allreduce(&subObjectValueNew,&objectValueNew,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
//objectValueNew=sqrt(objectValueNew);
df=fabs(objectValueNew-objectValue);
MPI_Barrier(MPI_COMM_WORLD);
if(df<tolerance)
break;
curIteration++;
}while(curIteration<=maxIteration);
MPI_Barrier(MPI_COMM_WORLD);
double allPartitionCoef=0.0;
double allEntropy=0.0;
MPI_Allreduce(&partitionCoef,&allPartitionCoef,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
MPI_Allreduce(&entropy,&allEntropy,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
startTime=MPI_Wtime();
char* token = strtok(outputfile,".");
for(i=0;i<number+1;i++)
{
char *pathfiles=new char[100];
if(i==0)
{
sprintf(pathfiles,"%s.tif",token,i);
}
else
{
sprintf(pathfiles,"%sDegree_%d.tif",token,i);
}
outPathfiles.push_back(pathfiles);
}
if(rank==0)
{
char *centerpath=new char[100];
sprintf(centerpath,"%s.txt",token,i);
FILE *fp=fopen(centerpath,"w");
fprintf(fp,"NumberOfIteration:%d\n",curIteration-1);
fprintf(fp,"MaxError:%f\n",df);
fprintf(fp,"PartitionCoefficient:%f\n",allPartitionCoef);
fprintf(fp,"Entropy:%f\n",allEntropy);
fprintf(fp,"PayOff:%f\n",objectValueNew);
for(i=0;i<number;i++)
{
fprintf(fp,"class%d: ",i);
for(j=0;j<imageNum;j++)
{
fprintf(fp,"%6.3f\t",center[i*imageNum+j]);
}
fprintf(fp,"\n");
}
fclose(fp);
//cout<<"Iteration times is "<<curIteration<<endl;
for(i=0;i<number+1;i++)
{
// cout<<outPathfiles[i]<<endl;
createFile(outPathfiles[i],i);
}
}
MPI_Barrier(MPI_COMM_WORLD);
int loopCode = 1;
MPI_Status status;
if (rank != 0)
MPI_Recv(&loopCode, 1, MPI_INT, rank-1, 0, MPI_COMM_WORLD, &status);
//cout << "[DEBUG]\t" << rank << endl;
for(i = 0; i < number+1; i++)
writeDataFile(outPathfiles[i], i);
if (rank != numProcs-1)
MPI_Send(&loopCode, 1, MPI_INT, rank+1, 0, MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
endTime=MPI_Wtime();
double IOWriteTime=endTime-startTime;
//cout<<"IO Write Time: "<<IOWriteTime<<endl;
delete []center;
delete []centerIndex;
delete []centerIndexTmp;
delete []sumNumerator;
delete []sumDenominator;
delete []toalNumerator;
delete []toalDenominator;
//delete []degree;
delete []this->pTransform;
for(i=0;i<number;i++)
{
delete []degree[i];
}
delete []degree;
for(i=0;i<imageNum;i++)
{
free(vecAllData[i]);
}
vecAllData.clear();
return 0;
}
void mpi_FCM::strParsing(char* inputfile) //字符串解析
{
char* token = strtok(inputfile,",");
char *pathfile;
while(NULL != token)
{
pathfile=token;
allPathfiles.push_back(pathfile);
token=strtok(NULL,",");
}
}
void mpi_FCM::readInfo(const char* filename) //解析信息
{
GDALDataset* poDatasetsrc = (GDALDataset *) GDALOpen( filename, GA_ReadOnly );
if( poDatasetsrc == NULL )
{
cout<<"[ERROR] data file is not open correct"<<endl;
exit(1);
}
poDatasetsrc->GetGeoTransform(pTransform);
projection = poDatasetsrc->GetProjectionRef();
GDALRasterBand* poBandsrc = poDatasetsrc->GetRasterBand( 1 );
noData = poBandsrc->GetNoDataValue();
row = poBandsrc->GetYSize();
column = poBandsrc->GetXSize();
interval = (row + numProcs - 1)/numProcs;
double *pMyarrayTmp;
if ((row-(numProcs-1)*interval) <= 0)
interval -= 1;
if ( rank == (numProcs - 1) )
{
subRow = row - (numProcs - 1)*interval;
block = subRow*column;
pMyarrayTmp = new double[block];
// pMyarrayTmp = (double*)CPLMalloc(sizeof(double)*block);
}
else
{
subRow = interval;
block = subRow*column;
pMyarrayTmp = new double[block];
//pMyarrayTmp = (double*)CPLMalloc(sizeof(double)*block);
}
if (pMyarrayTmp == NULL)
{
cout<<"[ERROR] the allocation of memory is error!"<<endl;
MPI_Finalize();
return;
}
poBandsrc->RasterIO(GF_Read, 0, rank*interval, column, subRow, pMyarrayTmp, column, subRow, GDT_Float64, 0, 0);
if (poDatasetsrc != NULL)
{
GDALClose((GDALDatasetH)poDatasetsrc);
poDatasetsrc = NULL;
}
int i=0;
int j=0;
int *bRowData=new int[subRow];
int *rowData=new int[row];
int subPixelNum=0;
for(i=0;i<subRow;i++)
{
bRowData[i]=0;
for(j=0;j<column;j++)
{
if(pMyarrayTmp[i*column+j]!=noData && fabs(pMyarrayTmp[i*column+j]+9999)>INF_T)
{
bRowData[i]++;
subPixelNum++;
}
}
}
MPI_Barrier(MPI_COMM_WORLD);
MPI_Allreduce(&subPixelNum,&samplingPixelNum,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
int *blockNum=new int[numProcs];
MPI_Gather(&subRow,1,MPI_INT,blockNum,1,MPI_INT,0,MPI_COMM_WORLD);
int *displs=new int[numProcs];
displs[0]=0;
for(i=1;i<numProcs;i++)
displs[i]=displs[i-1]+blockNum[i-1];
MPI_Gatherv(bRowData,subRow,MPI_INT,rowData,blockNum,displs,MPI_INT,0,MPI_COMM_WORLD);
MPI_Bcast(rowData, row, MPI_INT, 0, MPI_COMM_WORLD);
for(i=1;i<row;i++)
{
rowData[i]=rowData[i-1]+rowData[i];
}
subData=new int[numProcs];
int *NumTmp=new int[numProcs];
for(i=0;i<numProcs-1;i++)
{
NumTmp[i]=(rowData[row-1]+numProcs - 1)/numProcs *(i+1);
}
NumTmp[numProcs-1]=rowData[row-1];
j=0;
for(i=0;i<row-1;i++)
{
if(rowData[i]<NumTmp[j]&&rowData[i+1]>=NumTmp[j])
{
subData[j]=i+1;
j++;
}
}
subData[numProcs-1]=row-1;
MPI_Barrier(MPI_COMM_WORLD);
int *subTmp=new int[numProcs];
subTmp[0]=subData[0]+1;
for(i=1;i<numProcs;i++)
{
subTmp[i]=subData[i]-subData[i-1];
}
subRow=subTmp[rank];
for(i=numProcs-1;i>0;i--)
{
subData[i]=subData[i-1]+1;
}
subData[0]=0;
delete []subTmp;
delete []blockNum;
delete []displs;
delete []pMyarrayTmp;
//free(pMyarrayTmp);
}
void mpi_FCM::readDataFile(const char* filename)
{
GDALDataset* poDatasetsrc = (GDALDataset *) GDALOpen( filename, GA_ReadOnly );
if( poDatasetsrc == NULL /*检查是否正常打开文件*/)
{
cout<<"[ERROR] data file is not open correct"<<endl;
exit(1);
}
poDatasetsrc->GetGeoTransform(pTransform);
projection = poDatasetsrc->GetProjectionRef();
GDALRasterBand* poBandsrc = poDatasetsrc->GetRasterBand( 1 );
noData = poBandsrc->GetNoDataValue();
/*
row = poBandsrc->GetYSize();
column = poBandsrc->GetXSize();
interval = (row + numProcs - 1)/numProcs;
if ( rank == (numProcs - 1) )
{
subRow = row - (numProcs - 1)*interval;
block = subRow*column;
pMyarray = (double*)CPLMalloc(sizeof(double)*block);
pClass = (int*)CPLMalloc(sizeof(int)*block);
}
else
{
subRow = interval;
block = subRow*column;
pMyarray = (double*)CPLMalloc(sizeof(double)*block);
pClass = (int*)CPLMalloc(sizeof(int)*block);
}
*/
block = subRow*column;
pMyarray = (double*)CPLMalloc(sizeof(double)*block);
pClass = (int*)CPLMalloc(sizeof(int)*block);
if (pMyarray == NULL)
{
cout<<"[ERROR] the allocation of memory is error!"<<endl;
MPI_Finalize();
return;
}
if (pClass == NULL)
{
cout<<"[ERROR] the allocation of memory is error!"<<endl;
MPI_Finalize();
return;
}
poBandsrc->RasterIO(GF_Read, 0, subData[rank], column, subRow, pMyarray, column, subRow, GDT_Float64, 0, 0);
if (poDatasetsrc != NULL)
{
GDALClose((GDALDatasetH)poDatasetsrc);
poDatasetsrc = NULL;
}
}
void mpi_FCM::createFile(const char *destfilename,int tag)
{
GDALDriver* poDriver = NULL;
poDriver = GetGDALDriverManager()->GetDriverByName(format.c_str());
if (poDriver == NULL)
{
cout<<"[ERROR] poDriver is NULL."<<endl;
exit(1);
}
char **papszMetadata = poDriver->GetMetadata();
GDALDataset* poDataset = NULL;
if(tag==0)
poDataset = poDriver->Create(destfilename, column, row, 1, GDT_Int32, NULL);
else
poDataset = poDriver->Create(destfilename, column, row, 1, GDT_Float64, NULL);
poDataset->SetGeoTransform( pTransform );
poDataset->SetProjection(projection.c_str());
if (poDataset == NULL)
{
cout<<"[ERROR] poDatasetdest is NULL"<<endl;
exit(1);
}
if (poDataset != NULL)
{
poDataset->FlushCache();
GDALClose((GDALDatasetH)poDataset);
poDataset = NULL;
}
}
void mpi_FCM::writeDataFile(const char* filename,int tag) //tag=0,输出结果,tag=1或其他,输出模糊隶属度
{
GDALDataset* poDataset = NULL;
poDataset = (GDALDataset *) GDALOpen( filename, GA_Update );
if( poDataset == NULL /*检查是否正常打开文件*/)
{
cout<<"[ERROR] data file is not open correct"<<endl;
exit(1);
}
GDALRasterBand* poBanddest = poDataset->GetRasterBand(1);
if (poBanddest == NULL)
{
cout<<"[ERROR] poBanddest is NULL"<<endl;
exit(1);
}
if(rank == 0)
{
poBanddest->SetNoDataValue(this->noData);
}
if(tag==0)
{
poBanddest->RasterIO(GF_Write, 0, subData[rank], column, subRow, pClass, column, subRow, GDT_Int32, 0, 0);
}
else
{
poBanddest->RasterIO(GF_Write, 0, subData[rank], column, subRow, degree[tag-1], column, subRow, GDT_Float64, 0, 0);
}
poDataset->FlushCache();
if (poDataset != NULL)
{
GDALClose((GDALDatasetH)poDataset);
poDataset = NULL;
}
}
void mpi_FCM::CreateRandom(int k,int n,int *centerIndex) //产生可以随输出控制的 k与n (可舍弃)
{
int i=0,j=0;
srand((unsigned int)time(NULL));
for(i=0;i<k;i++)
{
int a=rand()%n;
for(j=0;j<i;j++)
{
if(centerIndex[j]==a)
break;
}
if(j>=i)
{
centerIndex[i]=a;
}
else
{
i--;
}
}
}
//初始化隶属度
void mpi_FCM::InitDegree()
{
double diff;
int i=0;
int j=0;
for (j = 0; j < number; j++)
{
for (i = 0;i < block;i++)
{
if(vecAllData[0][i]==noData || fabs(vecAllData[0][i]+9999)<=INF_T)
{
degree[j][i]=noData;
pClass[i]=noData;
}
else
{
diff = fnDistance(i,j);
//degree[j][i] = (diff == 0.0) ? Eps:diff;
degree[j][i] = (diff == 0.0) ? 1.0:1.0/diff;
}
}
}
fnClusterMembershipValues();
}
//使每一个样本与各个聚类中心的隶属度之和为1
void mpi_FCM::fnClusterMembershipValues()
{
int i=0;
int j=0;
for (i = 0; i < block; i++)
{
if(vecAllData[0][i]!=noData && fabs(vecAllData[0][i]+9999)>INF_T)
{
double max = 0.0;
double min = pow((float)10,(float)6);
double sum = 0.0;
double newmax = 0.0;
pClass[i]=0;
for (j = 0; j < number; j++)
{
max = degree[j][i] > max ? degree[j][i]:max;
min = degree[j][i] < min ? degree[j][i]:min;
}
//使样本与聚类中心的隶属度在 0 和 1之间
for (j = 0; j < number; j++)
{
if(max==min)
{
degree[j][i]=1.0/number;
}
else
{
degree[j][i] = (degree[j][i] - min) / (max - min);
}
sum += degree[j][i];
}
//使每一个样本与各个聚类中心的隶属度之和为1
for (j = 0; j < number; j++)
{
if(sum!=0.0)
degree[j][i] = degree[j][i] / sum;
/*if (double.IsNaN(degree[i][j]))
{
degree[i][j] = 0.0;
}*/
if(degree[j][i]>newmax)
{
newmax=degree[j][i];
pClass[i]=j;
}
// newmax = degree[i][j] > newmax ? degree[i][j] : newmax;
}
}
}
}
//计算距离
double mpi_FCM::fnDistance(int i, int j) //第i个点与第j个中心的距离
{
int img=0;
double distance=0.0;
for(img=0;img<imageNum;img++)
{
distance+=(vecAllData[img][i]-center[j*imageNum+img])*(vecAllData[img][i]-center[j*imageNum+img]);
}
return sqrt(distance);
}
//计算隶属度
void mpi_FCM::fnDegreeMembership()
{
int i=0;
int j=0;
int k=0;
for (j = 0; j < number; j++)
{
for (i = 0; i < block;i++)
{
if(vecAllData[0][i]!=noData && fabs(vecAllData[0][i]+9999)>INF_T)
{
double temp = 0.0;
temp = fnDistance(i,j);
if(temp == 0.0)
{
temp = Eps;
}
double sumDistance = 0.0; //每一个样本到各个聚类中心的距离之和
for (k = 0; k < number;k++ )
{
if(fnDistance(i,k)==0)
sumDistance += pow(temp / Eps,2/(Fuzzyness-1));
else
sumDistance += pow(temp / fnDistance(i,k),2/(Fuzzyness-1));
}
degree[j][i] = 1.0 / sumDistance;
}
}
}
fnClusterMembershipValues();
}
//计算聚类中心
void mpi_FCM::fnClusterCentroid()
{
int i=0;
int j=0;
int img=0;
for (j=0;j<number;j++)
{
double m = 0.0;
for(img=0;img<imageNum;img++)
{
sumNumerator[j*imageNum+img]=0.0; //分子求和
}
sumDenominator[j] = 0.0; //分母求和
for (i=0;i<block;i++)
{
if(vecAllData[0][i]!=noData && fabs(vecAllData[0][i]+9999)>INF_T)
{
double df = pow(degree[j][i],Fuzzyness);
for(img=0;img<imageNum;img++)
{
sumNumerator[j*imageNum+img]+=df*vecAllData[img][i];
}
sumDenominator[j] += df;
}
}
}
}
//计算目标函数
double mpi_FCM::fnObjectiveFunction()
{
double Jk = 0.0;
int i=0;
int j=0;
int img=0;
for (i = 0; i < block; i++)
{
if(vecAllData[0][i]!=noData && fabs(vecAllData[0][i]+9999)>INF_T)
{
for (j = 0; j < number; j++)
{
Jk += pow(degree[j][i], Fuzzyness) * fnDistance(i,j)*fnDistance(i,j);
}
}
}
//计算 熵和划分系数
partitionCoef = 0.0;
entropy = 0.0;
for (i = 0; i < block; i++)
{
if(vecAllData[0][i]!=noData && fabs(vecAllData[0][i]+9999)>INF_T)
{
for (j = 0; j < number; j++)
{
partitionCoef += degree[j][i]*degree[j][i]/samplingPixelNum;
if(degree[j][i]>0)
{
entropy += -1.0*degree[j][i]*log(degree[j][i])/samplingPixelNum;
}
}
}
}
return Jk;
}
|
cfc74c2b03ac9f8b9983046f8739a327411ca70c
|
b5d788437be09c1ab7bb34ae84070ed0bce35d31
|
/src/latex/tikz/TikzElementConfiguration.cpp
|
bf9d690711a4d279023f5a256b914bd755b1d47f
|
[
"LicenseRef-scancode-generic-exception",
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
wlike/sfcpp
|
94ee38258edc826aed702a3c793e22be66d9b84a
|
b929419b13c35fff199c6c65e87ecffae9963cfc
|
refs/heads/master
| 2021-07-14T07:34:37.097587
| 2017-10-18T08:29:27
| 2017-10-18T08:29:27
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,468
|
cpp
|
TikzElementConfiguration.cpp
|
/* Copyright 2017 The sfcpp Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include <latex/tikz/TikzElementConfiguration.hpp>
#include <strings/strings.hpp>
using namespace sfcpp::strings;
namespace sfcpp {
namespace latex {
namespace tikz {
TikzElementConfiguration TikzElementConfiguration::labelConfiguration(double fontsizeCm,
bool scaleFont) {
TikzElementConfiguration config;
config.drawBorder = false;
config.drawColor = img::Color::TransparentWhite;
config.fillColor = img::Color::TransparentWhite;
config.scaleFont = scaleFont;
config.fontsizeCm = fontsizeCm;
config.baselineSkipCm = fontsizeCm * 1.2;
return config;
}
TikzElementConfiguration TikzElementConfiguration::arrowConfiguration(img::Color drawColor,
img::Color fillColor) {
TikzElementConfiguration config(drawColor, fillColor);
config.forwardArrow = true;
return config;
}
std::string TikzElementConfiguration::colorCode(img::Color c) {
return "{rgb,1.0:red," + toStringFixedPrecision(c.getR(), 5) + ";green," +
toStringFixedPrecision(c.getG(), 5) + ";blue," + toStringFixedPrecision(c.getB(), 5) + "}";
}
std::string TikzElementConfiguration::getArrowCode() const {
std::string code = backwardArrow ? "<-" : "-";
if (forwardArrow) {
code += ">";
}
if (arrowType == TikzArrowType::To) {
return code + ", >=to";
} else if (arrowType == TikzArrowType::Stealth) {
return code + ", >=stealth";
} else {
return code + ", >=latex";
}
}
std::string TikzElementConfiguration::getBorderCode() const {
return drawBorder ? "draw" : "draw = none";
}
std::string TikzElementConfiguration::getColorCode() const {
std::string result = "draw = " + colorCode(drawColor) + ", draw opacity = " +
toStringFixedPrecision(drawColor.getA(), 5);
if (fillColor.getA() >= 0.0001) {
result += ", fill = " + colorCode(fillColor) + ", fill opacity = " +
toStringFixedPrecision(fillColor.getA(), 5);
}
return result;
}
// TODO: evtl. Pfeil-Stil anpassen
std::string TikzElementConfiguration::getThicknessCode() const {
return "line width = " + toString(thicknessCm) + "cm";
}
std::string TikzElementConfiguration::getLineTypeCode() const {
if (lineType == TikzLineType::Solid) {
return "solid";
} else if (lineType == TikzLineType::Dashdotted) {
return "dashdotted";
} else if (lineType == TikzLineType::Dashed) {
return "dashed";
} else if (lineType == TikzLineType::DenselyDotted) {
return "densely dotted";
} else if (lineType == TikzLineType::Dotted) {
return "dotted";
} else if (lineType == TikzLineType::LooselyDotted) {
return "loosely dotted";
} else if (lineType == TikzLineType::Double) {
return "double";
}
return "";
}
std::string sfcpp::latex::tikz::TikzElementConfiguration::getLineCapCode() const {
if (lineCap == TikzLineCap::Round) {
return "line cap = round";
} else if (lineCap == TikzLineCap::Butt) {
return "line cap = butt";
} else if (lineCap == TikzLineCap::Rect) {
return "line cap = rect";
}
return "";
}
std::string TikzElementConfiguration::getFontCode(double fontScalingFactor) const {
double factor = scaleFont ? fontScalingFactor : 1.0;
return "font = \\fontsize{" + toStringFixedPrecision(factor * fontsizeCm, 5) + "cm}{" +
toString(factor * baselineSkipCm) + "cm}\\selectfont";
}
std::string TikzElementConfiguration::getCode(double fontScalingFactor) const {
return getArrowCode() + ", " + getBorderCode() + ", " + getColorCode() + ", " +
getThicknessCode() + ", " + getLineTypeCode() + ", " + getLineCapCode() + ", " +
getFontCode(fontScalingFactor);
}
} /* namespace tikz */
} /* namespace latex */
} /* namespace utils */
|
d66c591b66a46ef1709c22a520abcb1d7cf54e21
|
4dbfd2b70fa7ea4e4af4b19bbe2ecaa620d70738
|
/Externals/MayaDataModel/include/MayaDMBulge.h
|
a9307e4267bfdf5796b5b4fef0d7931c9ff55cec
|
[
"MIT"
] |
permissive
|
RemiArnaud/OpenCOLLADA
|
e347f5ff7cbe886490ba10c7828e5b6038060021
|
cdcd7e7131c640842c99b5066c7320d2ac4899a0
|
refs/heads/master
| 2023-08-21T09:58:01.559798
| 2023-08-06T08:38:52
| 2023-08-06T08:38:52
| 6,890,659
| 15
| 2
| null | 2023-08-06T08:38:53
| 2012-11-27T20:48:34
|
C++
|
UTF-8
|
C++
| false
| false
| 1,287
|
h
|
MayaDMBulge.h
|
/*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of MayaDataModel.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __MayaDM_BULGE_H__
#define __MayaDM_BULGE_H__
#include "MayaDMTypes.h"
#include "MayaDMConnectables.h"
#include "MayaDMTexture2d.h"
namespace MayaDM
{
class Bulge : public Texture2d
{
public:
public:
Bulge():Texture2d(){}
Bulge(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
:Texture2d(file, name, parent, "bulge", shared, create){}
virtual ~Bulge(){}
void setUWidth(float uw)
{
if(uw == 0.1) return;
fprintf(mFile,"\tsetAttr \".uw\" %f;\n", uw);
}
void setVWidth(float vw)
{
if(vw == 0.1) return;
fprintf(mFile,"\tsetAttr \".vw\" %f;\n", vw);
}
void getUWidth()const
{
fprintf(mFile,"\"%s.uw\"",mName.c_str());
}
void getVWidth()const
{
fprintf(mFile,"\"%s.vw\"",mName.c_str());
}
protected:
Bulge(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
:Texture2d(file, name, parent, nodeType, shared, create) {}
};
}//namespace MayaDM
#endif//__MayaDM_BULGE_H__
|
f32fabece7c49f2b7fd43e53e806c1442557c9ae
|
68a6f31644fd40c3d95e751062b8feb214dd2c9f
|
/include/tasks/queues/types/Transaction.h
|
2f9ba6e78a4a0a16e40235e0ddd7b4c0877b7a55
|
[] |
no_license
|
skelstar/Esk8.Board.Controller
|
3d58a8fff43411d84279b5b69a4ff664cfd3f0ac
|
97620500550ca1f31b44d42463abd2a3dfe6bbc5
|
refs/heads/master
| 2021-08-09T20:19:23.033826
| 2021-06-28T03:56:58
| 2021-06-28T03:56:58
| 215,162,864
| 0
| 0
| null | 2021-06-28T03:56:58
| 2019-10-14T23:24:09
|
C
|
UTF-8
|
C++
| false
| false
| 2,339
|
h
|
Transaction.h
|
#pragma once
#include <VescData.h>
#include <QueueBase.h>
#include <elapsedMillis.h>
#include <shared-utils.h>
class Transaction : public QueueBase
{
public:
enum SourceType
{
CONTROLLER,
BOARD_RESPONSE,
};
static const char *getSourceType(SourceType type)
{
switch (type)
{
case CONTROLLER:
return "CONTROLLER";
case BOARD_RESPONSE:
return "BOARD_RESPONSE";
}
return getOutOfRange("getSourceType");
}
float version = 0.0,
batteryVolts = 0.0;
ReasonType reason;
unsigned long
packet_id,
replyId;
bool moving = false;
SourceType source;
unsigned long sentTime = 0, roundTrip = 0;
public:
Transaction() : QueueBase()
{
event_id = 0;
packet_id = 0;
name = "Transaction";
}
void registerPacket(ControllerData packet)
{
packet_id = packet.id;
source = SourceType::CONTROLLER;
sentTime = packet.txTime;
}
void registerPacket(ControllerConfig config_packet)
{
packet_id = config_packet.id;
}
void reconcile(VescData packet)
{
if (packet.id == packet_id)
{
// this is the response to current packet
replyId = packet.id;
version = packet.version;
source = SourceType::BOARD_RESPONSE;
roundTrip = millis() - packet.txTime;
// sendResult = TransactionSendResult::UPDATE;
}
batteryVolts = packet.batteryVoltage;
moving = packet.moving;
reason = packet.reason;
_rxTime = millis();
}
bool connected(unsigned long timeout)
{
return millis() - _rxTime < timeout;
}
void print(const char *preamble = nullptr)
{
if (preamble != nullptr)
Serial.printf("%s: ", preamble);
Serial.printf("event_id: %lu ", this->event_id);
Serial.printf("packet_id: %lu: ", this->packet_id);
Serial.printf("battery: %.1fv: ", this->batteryVolts);
Serial.printf("moving: %d: ", this->moving);
Serial.println();
}
static void print(Transaction item, const char *preamble = nullptr)
{
if (preamble != nullptr)
Serial.printf("%s: ", preamble);
Serial.printf("event_id: %lu ", item.event_id);
Serial.printf("packet_id: %lu: ", item.packet_id);
Serial.printf("moving: %d: ", item.moving);
Serial.println();
}
private:
elapsedMillis _since_responded;
unsigned long _rxTime = 0;
};
|
cf1c641128079375db897a78c32f0622a6215b77
|
da5401ee4c48180f03779d89493855df30078a6c
|
/Leetcode/others/59.螺旋矩阵Ⅱ.cpp
|
74e4febab6dbb1aa517568b476cfe3a82f65cfe6
|
[] |
no_license
|
whime/dataStructure-algorithm
|
ca0e00dd6bd13a4d58e47c242d6cef40a98c5f5c
|
ae672475171012b3587c9048f174518c2b5d7bf8
|
refs/heads/master
| 2021-09-21T21:26:25.800137
| 2021-08-29T02:03:56
| 2021-08-29T02:03:56
| 175,344,988
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 901
|
cpp
|
59.螺旋矩阵Ⅱ.cpp
|
/**
给定一个正整数 n,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。
*/
class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<int> row(n,0);
vector<vector<int>> res(n,row);
if(n==0) return res;
// int count=pow(n,2);
int num=1;
int left=0,right=n-1,up=0,down=n-1;
int i;
//逐个填充
while(true)
{
for(i=left;i<=right;i++){res[up][i]=num;num++;}
if(++up>down) break;
for(i=up;i<=down;i++){res[i][right]=num;num++;}
if(--right<left) break;
for(i=right;i>=left;i--){res[down][i]=num;num++;}
if(--down<up) break;
for(i=down;i>=up;i--){res[i][left]=num;num++;}
if(++left>right) break;
}
return res;
}
};
|
471668bf2a8401139938d4230e4ea71ed6aff5f4
|
c88512967628dffb32ba28912480c9fb5344d143
|
/Exercise_4.3/VanillaMain_Exr_4_3.cpp
|
b107709f7448e8ce52ef381d7d88f47d7cc19f9a
|
[] |
no_license
|
cycbill/Cpp_Design_Patterns_and_Derivatives_Pricing
|
fd31a6cb645588de51eb4516316331526451401c
|
c44df0e5791b7eb3ea53a3cb7fb3fc7f380d6953
|
refs/heads/master
| 2020-07-13T07:42:11.233552
| 2019-10-03T01:48:48
| 2019-10-03T01:48:48
| 205,035,734
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,538
|
cpp
|
VanillaMain_Exr_4_3.cpp
|
/*
requires PayOff3.cpp,
Random1.cpp,
SimpleMC6.cpp
Vanilla3.cpp
Parameters.cpp
*/
#include "../_headers/SimpleMC6.h"
#include "../_headers/Vanilla3.h"
#include "../_headers/Parameters.h"
#include "../_headers/Arrays.h"
#include "PiecewiseConstant.h"
#include <iostream>
int main()
{
double Expiry;
double Strike;
double Spot;
double r;
unsigned long NumberOfPaths;
Expiry = 1.0;
Strike = 1.32;
Spot = 1.30;
r = 0.04;
NumberOfPaths = 10000;
unsigned long size = 10;
MJArray Mat(size);
MJArray Vol(size);
Mat = 1.0;
for (unsigned long i = 0; i < size; i++)
{
Mat[i] = 0.1 * static_cast<double>(i);
Vol[i] = 0.1 + 0.000002 * static_cast<double>(i);
}
PiecewiseConstant VolParam(Mat, Vol);
ParametersConstant rParam(r);
PayOffCall thePayOff(Strike);
VanillaOption theOption(thePayOff, Expiry);
double result = SimpleMonteCarlo4(theOption,
Spot, VolParam, rParam, NumberOfPaths);
std::cout << "the call price is " << result << std::endl;
VanillaOption secondOption(theOption); //secondOption clones from theOption.
result = SimpleMonteCarlo4(secondOption,
Spot, VolParam, rParam, NumberOfPaths);
std::cout << "the call price is " << result << std::endl;
PayOffPut otherPayOff(Strike);
VanillaOption thirdOption(otherPayOff, Expiry);
theOption = thirdOption; // theOption clones from thirdOption.
result = SimpleMonteCarlo4(theOption,
Spot, VolParam, rParam, NumberOfPaths);
std::cout << "the put price is " << result << std::endl;
double tmp;
std::cin >> tmp;
return 0;
}
|
5f41fb80331fa501cc42c4be41a55149f89a8474
|
042983c6b28fd12d37652bc90390b0e59ee71c4d
|
/source/images/filters/classifiers/GraphVertexPythonSVMClassifier.tpp
|
e5d1c90d435b34f16dc1475295d7f9371485c755
|
[] |
no_license
|
cigarfish/latticeCollagen
|
26718aae8cb5a9c6ade428d1e6fd47abe3b71348
|
74ac165a2e63f8f0aa7501ce8c6568ac8a407d9e
|
refs/heads/master
| 2020-03-21T23:07:33.057342
| 2018-10-11T16:03:01
| 2018-10-11T16:03:01
| 139,167,691
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 11,582
|
tpp
|
GraphVertexPythonSVMClassifier.tpp
|
///////////////////////////////////////////////////////////////////////////////////////
// //
// File Name: GraphVertexPythonSVMClassifier.tpp //
// //
// Author: Adrian Friebel <adrian.friebel@uni-leipzig.de> //
// Created: 2015-03-23 //
// //
// This file is part of the CellSys7 code. //
// //
// (C) The Drasdo Group, IZBI, Universitaet Leipzig, and INRIA, Paris-Rocquencourt. //
// //
///////////////////////////////////////////////////////////////////////////////////////
#include "GraphVertexPythonSVMClassifier.h"
#include <vtkDataSetAttributes.h>
#include <vtkDoubleArray.h>
#include <vtkFloatArray.h>
#include <vtkIntArray.h>
#include <vtkOutEdgeIterator.h>
#include <vtkUnsignedLongArray.h>
#include <vtkVertexListIterator.h>
template< unsigned int VImageDimension > GraphVertexPythonSVMClassifier< VImageDimension >::GraphVertexPythonSVMClassifier()
: GraphVertexBaseClassifier< VImageDimension >()
{
// TODO Auto-generated constructor stub
}
template< unsigned int VImageDimension > GraphVertexPythonSVMClassifier< VImageDimension >::~GraphVertexPythonSVMClassifier()
{
//#ifdef CS_BUILD_PYTHON
// Py_XDECREF(mpTrainDBHandlerInstance);
// Py_XDECREF(mpSVMHandlingInstance);
// Py_Finalize();
//#endif
}
template< unsigned int VImageDimension > void GraphVertexPythonSVMClassifier< VImageDimension >::Init()
{
std::cout << "GraphVertexPythonSVMClassifier::Init here" << std::endl;
GraphVertexBaseClassifier<VImageDimension>::Init();
std::cout << "GraphVertexBaseClassifier::Init finished" << std::endl;
SetupClassifier();
}
template< unsigned int VImageDimension > void GraphVertexPythonSVMClassifier< VImageDimension >::SetupClassifier()
{
std::cout << "GraphVertexPythonSVMClassifier::SetupClassifier started" << std::endl;
#ifdef CS_BUILD_PYTHON
PyObject *pName, *pSysPath, *pPath, *pModule, *pDict, *pArglist, *pTrainDBHandlerClass, *pSVMHandlingClass, *pValue1, *pValue2, *pAttributeName1, *pAttributeName2, *pList;
pSysPath = PySys_GetObject("path");
if(pSysPath == NULL)
std::cout << "pSysPath still NULL" << std::endl;
pPath = PyString_FromString(".");
if(PyList_Append(pSysPath, pPath) < 0)
std::cout << "PYList_Append < 0" << std::endl;
pPath = PyString_FromString("./source/images/filters/classifiers/pythonScripts");
if(PyList_Append(pSysPath, pPath) < 0)
std::cout << "PYList_Append < 0" << std::endl;
pName = PyString_FromString("testReadDataSetupSVMScript"); //name of file
pModule = PyImport_Import(pName);
if(pModule==NULL)
std::cout << "pModule still NULL" << std::endl;
pDict = PyModule_GetDict(pModule);
pTrainDBHandlerClass = PyDict_GetItemString(pDict, "TrainingDataHandling");
pArglist = Py_BuildValue("(s)", this->mTrainingDatabaseFilename.c_str());
if(PyCallable_Check(pTrainDBHandlerClass))
mpTrainDBHandlerInstance = PyObject_CallObject(pTrainDBHandlerClass, pArglist);
else
std::cout << "TrainingDataHandling can not be called" << std::endl;
unsigned int sizeFeatureVector = this->mNumActiveUnaryFeatures;
PyObject* list = PyList_New(sizeFeatureVector);
int count=0;
for(int j=0; j<LabelMapGraphType::NumberUnaryFeatures; ++j) {
if(this->mLabelMapGraph->GetUnaryFeatureState(static_cast<UnaryFeatureType>(j)) == LabelMapGraphType::IsActive) {
std::string f = LabelMapGraphType::UnaryFeatureName[j];
PyList_SetItem( list, count, PyString_FromString(f.c_str()) );
count++;
}
}
PyObject_CallMethod(mpTrainDBHandlerInstance, "loadUnaryTrainingFeatures", "(O)", list);
PyObject_CallMethod(mpTrainDBHandlerInstance, "printSummary", "(s)", "py.script: before preprocessing: ");
PyObject_CallMethod(mpTrainDBHandlerInstance, "preprocessData", NULL);
PyObject_CallMethod(mpTrainDBHandlerInstance, "printSummary", "(s)", "py.script: after preprocessing: ");
pList = PyObject_CallMethod(mpTrainDBHandlerInstance, "getNamesOfTargetClasses", NULL);
std::map<vtkIdType, float> probabilities;
for(unsigned int i=0; i<PyList_Size(pList); i++)
this->mClassProbabilites.insert( std::pair<std::string, std::map<vtkIdType, float> >("ClassProbability_" + std::string(PyString_AsString(PyList_GetItem(pList, i))), probabilities) );
pAttributeName1 = PyString_FromString("trainingData");
pValue1 = PyObject_GetAttr(mpTrainDBHandlerInstance, pAttributeName1);
pAttributeName2 = PyString_FromString("scaler");
pValue2 = PyObject_GetAttr(mpTrainDBHandlerInstance, pAttributeName2);
pArglist = Py_BuildValue("(OO)", pValue1, pValue2);
pSVMHandlingClass = PyDict_GetItemString(pDict, "SVMHandling");
if(PyCallable_Check(pSVMHandlingClass))
mpSVMHandlingInstance = PyObject_CallObject(pSVMHandlingClass, pArglist);
else
std::cout << "SVMHandling can not be called" << std::endl;
PyObject_CallMethod(mpSVMHandlingInstance, "fitSVMToData", NULL);
#endif
std::cout << "GraphVertexPythonSVMClassifier::SetupClassifier finished" << std::endl;
}
template< unsigned int VImageDimension > std::set<vtkIdType> GraphVertexPythonSVMClassifier< VImageDimension >::EvaluateAllLabelObjects()
{
vtkSmartPointer<vtkUnsignedLongArray> pedigreeIdArray = vtkUnsignedLongArray::SafeDownCast(this->mGraph->GetVertexData()->GetPedigreeIds());
std::cout << "pedigreeIdArray->GetSize() = " << pedigreeIdArray->GetSize() << std::endl;
this->mLabelObjectsOfTargetClass.clear();
#ifdef CS_BUILD_PYTHON
PyObject *pList, *pValue;
unsigned int sizeFeatureVector = this->mNumActiveUnaryFeatureComponents;
std::cout << "GraphVertexPythonSVMClassifier::EvaluateAllLabelObjects here" << std::endl;
vtkSmartPointer<vtkVertexListIterator> it = vtkSmartPointer<vtkVertexListIterator>::New();
this->mGraph->GetVertices(it);
while (it->HasNext()) {
vtkIdType v = it->Next();
PyObject* list = PyList_New(sizeFeatureVector);
int count=0;
for(int j=0; j<LabelMapGraphType::NumberUnaryFeatures; ++j) {
if(this->mLabelMapGraph->GetUnaryFeatureState(static_cast<UnaryFeatureType>(j)) == LabelMapGraphType::IsActive) {
for(int k=0; k<LabelMapGraphType::UnaryFeatureComponents[j]; k++) {
std::stringstream featureName;
featureName << LabelMapGraphType::UnaryFeatureName[j];
if(LabelMapGraphType::UnaryFeatureComponents[j] > 1)
featureName << k;
PyList_SetItem( list, count, Py_BuildValue("f", vtkFloatArray::SafeDownCast(this->mGraph->GetVertexData()->GetArray(featureName.str().c_str()))->GetValue(v) ));
count++;
}
}
}
pList = PyObject_CallMethod(mpSVMHandlingInstance, "predictProbaFromMeasurement", "(O)", list);
std::map<std::string, std::map<vtkIdType, float> >::iterator it = this->mClassProbabilites.begin();
for(unsigned int i=0; i<PyList_Size(pList); i++) {
if(it!=this->mClassProbabilites.end()) {
float prob = PyFloat_AsDouble(PyList_GetItem(pList, i));
it->second.insert( std::pair<vtkIdType, float>(v, prob) );
++it;
}
}
pValue = PyObject_CallMethod(mpSVMHandlingInstance, "predictFromMeasurement", "(O)", list);
ClassType predClass = (ClassType)PyInt_AsLong(pValue);
if(predClass == this->mTargetClass)
this->mLabelObjectsOfTargetClass.insert(pedigreeIdArray->GetValue(v));
}
std::cout << "GraphVertexPythonSVMClassifier::EvaluateAllLabelObjects finished" << std::endl;
#endif
return this->mLabelObjectsOfTargetClass;
}
template< unsigned int VImageDimension > std::set<vtkIdType> GraphVertexPythonSVMClassifier< VImageDimension >::EvaluateModifiedLabelObjects(std::set<vtkIdType> &modifiedInLastIteration)
{
// vtkSmartPointer<vtkUnsignedLongArray> pedigreeIdArray = vtkUnsignedLongArray::SafeDownCast(this->mGraph->GetVertexData()->GetPedigreeIds());
// std::cout << "pedigreeIdArray->GetSize() = " << pedigreeIdArray->GetSize() << std::endl;
//
// std::set<vtkIdType> edgesAlreadyVisited;
// this->mLabelObjectsOfTargetClass.clear();
//
//#ifdef CS_BUILD_PYTHON
// PyObject *pList, *pValue;
//
// unsigned int sizeFeatureVector = this->mNumActiveUnaryFeatureComponents;
//
// std::cout << "GraphVertexPythonSVMClassifier::EvaluateModifiedLabelObjects here" << std::endl;
//
// for(std::set<vtkIdType>::iterator it=modifiedInLastIteration.begin(); it!=modifiedInLastIteration.end(); ++it) {
// vtkIdType source = this->mGraph->FindVertex(*it);
//
// if(source != -1) {
// vtkSmartPointer<vtkOutEdgeIterator> outIt = vtkSmartPointer<vtkOutEdgeIterator>::New();
// this->mGraph->GetOutEdges(source, outIt);
//
// while (outIt->HasNext()) {
// vtkOutEdgeType e = outIt->Next();
//
// if(edgesAlreadyVisited.count(e.Id)==0) {
// vtkIdType target = e.Target;
//
// PyObject* list = PyList_New(sizeFeatureVector);
//
// int count=0;
// for(int j=0; j<LabelMapGraphType::NumberUnaryFeatures; ++j) {
// if(this->mLabelMapGraph->GetUnaryFeatureState(static_cast<UnaryFeatureType>(j)) == LabelMapGraphType::IsActive) {
// for(unsigned int k=0; k<LabelMapGraphType::UnaryFeatureComponents[j]; k++) {
// std::stringstream featureName;
// featureName << LabelMapGraphType::UnaryFeatureName[j];
// if(LabelMapGraphType::UnaryFeatureComponents[j] > 1)
// featureName << k;
//
// PyList_SetItem( list, count, Py_BuildValue("f", vtkFloatArray::SafeDownCast(this->mGraph->GetVertexData()->GetArray(featureName.str().c_str()))->GetValue(source) ));
// PyList_SetItem( list, count+1, Py_BuildValue("f", vtkFloatArray::SafeDownCast(this->mGraph->GetVertexData()->GetArray(featureName.str().c_str()))->GetValue(target) ));
// count+=2;
// }
// }
// }
//
// pValue = PyObject_CallMethod(mpSVMHandlingInstance, "predictFromMeasurement", "(O)", list);
// ClassType predClass = (ClassType)PyInt_AsLong(pValue);
//
// if(predClass == this->mTargetClass)
// this->mLabelObjectsOfTargetClass.push_back(std::pair<vtkIdType,vtkIdType>(pedigreeIdArray->GetValue(source), pedigreeIdArray->GetValue(target)));
//
// edgesAlreadyVisited.insert(e.Id);
// }
// }
// }
// }
//#endif
//
// return this->mLabelObjectsOfTargetClass;
}
|
bbc068ba3a658a632a4c52f4ec0f2dc6abf1935f
|
b9a6e74c99728874dc9ba7bbb705ad76d01394ea
|
/Castlevania/Weapons.cpp
|
e8014d5fe49bd3347deaaa637de0f2aeaacebeb6
|
[] |
no_license
|
tudautroccuto741/Castlevania
|
ce416f28d9fbf4179afbf4d71e3b473cd9de566f
|
28417f18151ff6cca8376d5784dcdbb968657172
|
refs/heads/master
| 2021-04-10T15:06:07.032534
| 2020-08-07T12:59:22
| 2020-08-07T12:59:22
| 248,913,413
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,767
|
cpp
|
Weapons.cpp
|
#include "Weapons.h"
#include "debug.h"
#include "Simon.h"
#include "Knife.h"
#include "Boomerang.h"
#include "Aquafina.h"
#include "Axe.h"
CWeapons * CWeapons::__instance = NULL;
// Add the corresponding weapon with the weapon name
void CWeapons::Add(int weaponName, LPGAMEOBJECT weapon)
{
weapons[weaponName].push_back(weapon);
}
void CWeapons::ChoiceWeapon(int weaponName)
{
switch (weaponName)
{
case (int)Weapon::KNIFE:
UseKnife();
break;
case (int)Weapon::BOOMERANG:
UseBoomerang();
break;
case (int)Weapon::AQUAFINA:
UseAquafina();
break;
case (int)Weapon::AXE:
UseAxe();
break;
case (int)Weapon::WATCH:
UseWatch();
break;
case (int)Weapon::BONE:
UseBone();
break;
default:
break;
}
}
// Get weapon and return the weapon object
LPGAMEOBJECT CWeapons::GetWeapon(int weapon)
{
if (weapons[weapon].empty())
DebugOut(L"\n[ERROR] No weapons");
else
{
for (auto i = weapons[weapon].begin(); i != weapons[weapon].end(); ++i)
{
if ((*i)->GetVisible() == false)
{
return (*i);
break;
}
}
}
}
void CWeapons::UseKnife()
{
LPGAMEOBJECT knife = GetWeapon((int)Weapon::KNIFE);
if(knife == NULL)
{
return;
}
knife->SetVisible(true);
knife->nx = CSimon::GetInstance()->GetDirection();
CSimon::GetInstance()->GetPosition(xS, yS);
float xK = xS;
float yK = yS + DISTANCE_OF_KNIFE_AND_SIMON;
knife->SetPosition(xK, yK);
CSimon::GetInstance()->SetHeart(1);
}
void CWeapons::UseBoomerang()
{
LPGAMEOBJECT boom = GetWeapon((int)Weapon::BOOMERANG);
if (boom == NULL) return;
boom->SetVisible(true);
boom->nx = CSimon::GetInstance()->GetDirection();
CSimon::GetInstance()->GetPosition(xS, yS);
float xB = xS;
float yB = yS + DISTANCE_OF_BOOMERANG_AND_SIMON;
boom->SetPosition(xB, yB);
CSimon::GetInstance()->SetHeart(1);
}
void CWeapons::UseAquafina()
{
LPGAMEOBJECT aquafina = GetWeapon((int)Weapon::AQUAFINA);
if (aquafina == NULL) return;
aquafina->nx = CSimon::GetInstance()->GetDirection();
aquafina->SetVisible(true);
CSimon::GetInstance()->GetPosition(xS, yS);
aquafina->SetPosition(xS, yS);
CSimon::GetInstance()->SetHeart(1);
}
void CWeapons::UseAxe()
{
LPGAMEOBJECT axe = GetWeapon((int)Weapon::AXE);
if (axe == NULL) return;
axe->nx = CSimon::GetInstance()->GetDirection();
axe->SetVisible(true);
CSimon::GetInstance()->GetPosition(xS, yS);
float xK = xS;
float yK = yS;
axe->SetPosition(xK, yK);
CSimon::GetInstance()->SetHeart(1);
}
void CWeapons::UseWatch()
{
CSimon::GetInstance()->SetFreezing(true);
}
void CWeapons::UseBone()
{
LPGAMEOBJECT bone = GetWeapon((int)Weapon::BONE);
if (bone == NULL) return;
bone->SetVisible(true);
}
CWeapons * CWeapons::GetInstance()
{
if (__instance == NULL)
__instance = new CWeapons();
return __instance;
}
|
af933676a741f9d9dbc578f36036a15573ed45aa
|
84ea17552c2fd77bc85af22f755ae04326486bb5
|
/Ablaze-Core/src/Graphics/Resources/Models/Rectangle.cpp
|
bdb286f23fbf982cc36fb834d714c2d77027de97
|
[] |
no_license
|
Totomosic/Ablaze
|
98159c0897b85b236cf18fc8362501c3873e49f4
|
e2313602d80d8622c810d3d0d55074cda037d287
|
refs/heads/master
| 2020-06-25T20:58:29.377957
| 2017-08-18T07:42:20
| 2017-08-18T07:42:20
| 96,988,561
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,130
|
cpp
|
Rectangle.cpp
|
#include "Rectangle.h"
namespace Ablaze
{
Rectangle::Rectangle(const String& name, const maths::vec2& size, const Color& color) : Model(name, new VBO(4 * sizeof(Vertex), BufferLayout::Vertex()), new IndexBuffer(6 * sizeof(GLuint)), maths::vec3(size.x, size.y, 0))
{
Create(color);
}
void Rectangle::Create(const Color& color)
{
indexBuffer->Bind();
indexBuffer->Upload(new GLuint[6]{ 0, 1, 2, 0, 2, 3 }, 6 * sizeof(GLuint));
auto ptr = (Vertex*)vbo->MapBuffer(Access::Write);
maths::vec3 n(0, 0, 1);
maths::vec3 s = size / 2.0f;
float x = s.x;
float y = s.y;
ptr->position = maths::vec3(-x, y, 0);
ptr->normal = n;
ptr->texCoord = maths::vec2(0, 0);
ptr->color = color;
ptr++;
ptr->position = maths::vec3(-x, -y, 0);
ptr->normal = n;
ptr->texCoord = maths::vec2(0, 1);
ptr->color = color;
ptr++;
ptr->position = maths::vec3(x, -y, 0);
ptr->normal = n;
ptr->texCoord = maths::vec2(1, 1);
ptr->color = color;
ptr++;
ptr->position = maths::vec3(x, y, 0);
ptr->normal = n;
ptr->texCoord = maths::vec2(1, 0);
ptr->color = color;
auto val = vbo->UnmapBuffer();
}
}
|
c695d6a8d529eebac8b32a22ca600d28927e872d
|
6a913e248eee9921fd6f344bd31f5a936981acf3
|
/elderstatusdelegate.h
|
f0d1d39e84ede85a80aa1dae2775f1593bbfee52
|
[] |
no_license
|
nhosproject/OSProject
|
96e2efff02a2d74e5b449922dc8a23f58646fe7d
|
0bc5ef82eb197c942c0a5409342d8de815e80c6c
|
refs/heads/master
| 2021-01-01T19:06:39.690654
| 2014-07-09T00:19:44
| 2014-07-09T00:19:44
| 21,601,310
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 326
|
h
|
elderstatusdelegate.h
|
#ifndef ELDERSTATUSDELEGATE_H
#define ELDERSTATUSDELEGATE_H
#include<QItemDelegate>
class ElderStatusDelegate:public QItemDelegate
{
public:
ElderStatusDelegate(QObject *parent = 0);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
#endif // ELDERSTATUSDELEGATE_H
|
eff09d44d017db95a01f94e4295ec2c444f8c525
|
aa9bd498c11e91fc6278af31a40d5aa2ad352fe1
|
/client/src/MiniCMD.cpp
|
7696affbb96b0067c74338dfc0ae98896b22e274
|
[] |
no_license
|
timxx/minicmd
|
225b253042b6cf756fbed98deb14d1d045a359f1
|
fc0cae3f13a3d028bd6e8eeacb6f0aceefad8d36
|
refs/heads/master
| 2020-05-17T18:47:20.750184
| 2012-03-22T07:15:53
| 2012-03-22T07:15:53
| 32,268,019
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 56,850
|
cpp
|
MiniCMD.cpp
|
/*
============================================================================
Name : MiniCMD.cpp
Author : Just Fancy
Project Home : http://code.google.com/p/minicmd/
============================================================================
MiniCMD, mini commander for Symbian OS phone
Copyright (C) 2011 Just Fancy
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
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
============================================================================
*/
#include <e32math.h>
#include <APGCLI.H>
#include <APACMDLN.H>
#include <W32STD.H>
#include <aknglobalmsgquery.h>
#include <aknglobalnote.h>
#include <BAFINDF.H>
#include <BADESCA.H>
#include <SWInstApi.h>
#include "MiniCMD.h"
#include "Constant.h"
#include "MiniLog.h"
#include "ServerSession.h"
#include "Config.h"
//=================================================================================
RFs iFs;
CMiniLog *miniLog = NULL;
RServerSession iServer;
TBool iLogAll = EFalse; // whether log all conditions
TInt iLastErr = KErrNone;
TBool iStop = EFalse; // stop minicmd
Config iConfig;
//=================================================================================
#define _LOG_(what) \
if(miniLog) \
miniLog->Log(what)
#define _LOG_FMT_(fmt, what)\
if(miniLog) \
miniLog->Log(fmt, what)
//=================================================================================
LOCAL_C void MainL()
{
CArrayFixFlat<TCommand> *iCmdSet = new(ELeave) CArrayFixFlat<TCommand>(10);
if (!iCmdSet)
{
// CleanupStack::PopAndDestroy();
return ;
}
CleanupStack::PushL(iCmdSet);
_LOG_(_L("[Starting MiniCMD]"));
TInt ret = iServer.Connect();
if (ret != KErrNone && miniLog != NULL)
miniLog->Log(_L("[Start Server Failed] [%d]"), ret);
if (!IsCmdDisabled())
{
TInt ret = KErrNotFound;
TInt count = iConfig.GetDriveLetters().Length();
if (iConfig.GetCMDFile().Length() == 0)
count = 0;
for (TInt i=0; i<count; i++)
{
TFileName cmdFile;
if (iConfig.GetCmdFileX('C').Length() > 0
&& iConfig.GetDriveLetters()[i]
== iConfig.GetCmdFileX('C')[0])
{
if (IsPathFileExists(iConfig.GetCmdFileX('C')))
{
ret = LoadCmdFileL(iConfig.GetCmdFileX('C'), iCmdSet);
break;
}
}
else if (iConfig.GetCmdFileX('D').Length() > 0
&& iConfig.GetDriveLetters()[i]
== iConfig.GetCmdFileX('D')[0])
{
if (IsPathFileExists(iConfig.GetCmdFileX('D')))
{
ret = LoadCmdFileL(iConfig.GetCmdFileX('D'), iCmdSet);
break;
}
}
if (iConfig.GetCmdFileX('E').Length() > 0
&& iConfig.GetDriveLetters()[i]
== iConfig.GetCmdFileX('E')[0])
{
if (IsPathFileExists(iConfig.GetCmdFileX('E')))
{
ret = LoadCmdFileL(iConfig.GetCmdFileX('E'), iCmdSet);
break;
}
}
if (iConfig.GetCmdFileX('Y').Length() > 0
&& iConfig.GetDriveLetters()[i]
== iConfig.GetCmdFileX('Y')[0])
{
if (IsPathFileExists(iConfig.GetCmdFileX('Y')))
{
ret = LoadCmdFileL(iConfig.GetCmdFileX('Y'), iCmdSet);
break;
}
}
if (iConfig.GetCmdFileX('Z').Length() > 0
&& iConfig.GetDriveLetters()[i]
== iConfig.GetCmdFileX('Z')[0])
{
if (IsPathFileExists(iConfig.GetCmdFileX('Z')))
{
ret = LoadCmdFileL(iConfig.GetCmdFileX('Z'), iCmdSet);
break;
}
}
cmdFile.Append(iConfig.GetDriveLetters()[i]);
cmdFile.Append(':');
if (iConfig.GetCMDFile()[0] != '\\')
cmdFile.Append('\\');
cmdFile.Append(iConfig.GetCMDFile());
if (IsPathFileExists(cmdFile))
{
ret = LoadCmdFileL(cmdFile, iCmdSet);
break;
}
}
if (ret == KErrNotFound)
{
_LOG_(_L("[Not Found CMD file]"));
}
else if (iCmdSet->Count() == 0)
{
_LOG_(_L("[No Valid CMD set]"));
}
else
{
Run(*iCmdSet);
}
}
else
_LOG_(_L("[MiniCMD disabled]"));
_LOG_(_L("[Exiting MiniCMD normally]\r\n"));
CleanupStack::PopAndDestroy(iCmdSet);
iServer.Close();
}
//=================================================================================
LOCAL_C void DoStartL()
{
CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
CleanupStack::PushL(scheduler);
CActiveScheduler::Install(scheduler);
MainL();
CleanupStack::PopAndDestroy(scheduler);
}
//=================================================================================
GLDEF_C TInt E32Main()
{
__UHEAP_MARK;
CTrapCleanup* cleanup = CTrapCleanup::New();
User::LeaveIfError(iFs.Connect());
TInt iErr = KErrNone;
TBool loadOK = EFalse;
TFileName iniFile;
iniFile.Copy(_L("D:\\System\\Apps\\MiniCMD\\"));
iniFile.Append(RProcess().Name());
iErr = iniFile.Locate('.');
// 应该 不会没有.的情况吧
if (iErr != KErrNotFound)
{
iniFile.Replace(iErr, iniFile.Length() - iErr, _L(".ini"));
}
// 先D、E后C再Z
if (!IsPathFileExists(iniFile))
{
iniFile[0] = 'E';
if (!IsPathFileExists(iniFile))
iniFile[0] = 'C';
if (!IsPathFileExists(iniFile))
iniFile[0] = 'Z';
}
TRAP(iErr, loadOK = iConfig.LoadL(iFs, iniFile));
if (iErr == KErrNone && loadOK)
{
if (iConfig.GetLogLevel() != 0 && iConfig.GetLogFile().Length() != 0)
{
TRAP(iErr, miniLog = CMiniLog::NewL(iFs, iConfig.GetLogFile()));
if (iErr != KErrNone || !IsPathFileExists(iConfig.GetLogFile()))
{
if (miniLog)
delete miniLog;
miniLog = NULL;
}
else if(iConfig.GetLogLevel() == 2)
iLogAll = ETrue;
}
}
TRAP(iErr, DoStartL());
if (miniLog)
{
if (iErr != KErrNone)
miniLog->Log(_L("[Main::TRAP] [%d]\r\n"), iErr);
delete miniLog;
}
iFs.Close();
delete cleanup;
__UHEAP_MARKEND;
return KErrNone;
}
//=================================================================================
TInt LoadCmdFileL(const TDesC &aFileName, CArrayFixFlat<TCommand> *aCmdSet)
{
RFile file;
TInt errCode = KErrNone;
errCode = file.Open(iFs, aFileName, EFileShareReadersOnly | EFileRead);
if (miniLog)
{
HBufC *logBuf = HBufC::NewLC(260);
TPtr bufPtr = logBuf->Des();
bufPtr.Append(_L("[Load "));
bufPtr.Append(aFileName);
bufPtr.Append(KLogFmt);
miniLog->Log(bufPtr, errCode);
CleanupStack::PopAndDestroy(logBuf);
}
if (errCode != KErrNone)
return errCode;
CleanupClosePushL(file);
TFileText fileText;
fileText.Set(file);
//one line should not exceed 512 bytes
HBufC* heapBuf = HBufC::NewLC(512);
TPtr lineBuf = heapBuf->Des();
while (true)
{
if ((errCode = fileText.Read(lineBuf)) == KErrEof)
break;
ParseLineL(lineBuf, aCmdSet);
}
CleanupStack::PopAndDestroy(heapBuf);
CleanupStack::PopAndDestroy(&file);
if (KErrEof == errCode)
errCode = KErrNone;
return errCode;
}
//=================================================================================
void ParseLineL(TDes &aLine, CArrayFixFlat<TCommand> *aCmdSet)
{
TBuf<24> cmd;
if (!GetCMD(aLine, cmd))
return ;
cmd.Trim();
cmd.LowerCase(); //case insensitive
aLine.Delete(0, cmd.Length());
aLine.TrimLeft();
Parameter iParam;
TFileName iSrc, iDest;
ParseCMD(aLine, iSrc, &iDest, &iParam);
iSrc.Trim();
iDest.Trim();
if (cmd == KCmdAtt)
{
if (iParam.NeedToSetAtt() && iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EAtt, &iParam, &iSrc));
}
else if(cmd == KCmdCp || cmd == KCmdCopy)
{
if (iDest.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ECp, &iParam, &iSrc, &iDest));
}
else if(cmd == KCmdMv)
{
if (iDest.Length() > 0 && iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EMv, &iParam, &iSrc, &iDest));
}
else if(cmd == KCmdMd || cmd == KCmdMkDir)
{
if (iSrc.Length() > 0 && iSrc[iSrc.Length() - 1] != '\\')
iSrc.Append('\\');
aCmdSet->AppendL(TCommand(TCommand::EMd, NULL, &iSrc));
}
else if(cmd == KCmdRn || cmd == KCmdRename)
{
if (iSrc.Length() > 0 && iDest.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ERn, NULL, &iSrc, &iDest));
}
else if(cmd == KCmdRm || cmd == KCmdRmDir)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ERm, &iParam, &iSrc));
}
else if (cmd == KCmdDel)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EDel, &iParam, &iSrc));
}
else if (cmd == KCmdRun)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ERun, &iParam, &iSrc));
}
else if(cmd == KCmdKill)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EKill, NULL, &iSrc));
}
else if(cmd == KCmdSleep)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ESleep, NULL, &iSrc));
}
else if(cmd == KCmdAbort)
{
aCmdSet->AppendL(TCommand(TCommand::EAbort, NULL, NULL));
}
else if(cmd == KCmdAbes)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EAbes, &iParam, &iSrc));
}
else if(cmd == KCmdAbnes)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EAbnes, &iParam, &iSrc));
}
else if(cmd == KCmdSkes)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ESkes, &iParam, &iSrc));
}
else if(cmd == KCmdSknes)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ESknes, &iParam, &iSrc));
}
else if(cmd == KCmdBkes)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EBkes, &iParam, &iSrc));
}
else if(cmd == KCmdBknes)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EBknes, &iParam, &iSrc));
}
else if(cmd == KCmdRses)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ERses, &iParam, &iSrc));
}
else if(cmd == KCmdRsnes)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ERsnes, &iParam, &iSrc));
}
else if (cmd == KCmdCmd)
{
// LoadCmdFileL(iSrc);
// Jul. 19, 2011
// Change to dynamic load
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ECmd, NULL, &iSrc));
}
else if(cmd == KCmdIf)
{
aCmdSet->AppendL(TCommand(TCommand::EIf, &iParam, &iSrc, &iDest));
}
else if(cmd == KCmdIfn)
{
aCmdSet->AppendL(TCommand(TCommand::EIfn, &iParam, &iSrc, &iDest));
}
else if(cmd == KCmdElse)
{
aCmdSet->AppendL(TCommand(TCommand::EElse, NULL, NULL));
}
else if(cmd == KCmdElseIf)
{
aCmdSet->AppendL(TCommand(TCommand::EElseIf, &iParam, &iSrc, &iDest));
}
else if(cmd == KCmdElseIfn)
{
aCmdSet->AppendL(TCommand(TCommand::EElseIfn, &iParam, &iSrc, &iDest));
}
else if(cmd == KCmdEndIf)
{
aCmdSet->AppendL(TCommand(TCommand::EEndIf, NULL, NULL));
}
else if(cmd == KCmdKey)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EKey, &iParam, &iSrc, iDest.Length() > 0 ? &iDest : NULL));
}
else if(cmd == KCmdSendKey)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ESendKey, &iParam, &iSrc, iDest.Length() > 0 ? &iDest : NULL));
}
else if(cmd == KCmdFile)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EFile, &iParam, &iSrc));
}
else if(cmd == KCmdNote)
{
if (iSrc.Length() > 0)
{
if (iParam.c == rm_it)
aCmdSet->AppendL(TCommand(TCommand::ENote, &iParam, &iSrc, &iDest));
else
aCmdSet->AppendL(TCommand(TCommand::ENote, NULL, &iSrc));
}
}
else if(cmd == KCmdLog)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::ELog, NULL, &iSrc));
}
else if(cmd == KCmdStop)
{
aCmdSet->AppendL(TCommand(TCommand::EStop, NULL, NULL));
}
else if (cmd == KCmdFind)
{
if (iSrc.Length() > 0 && iDest.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EFind, &iParam, &iSrc, &iDest));
}
else if (cmd == KCmdInstall)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EInstall, &iParam, &iSrc));
}
else if(cmd == KCmdUninstall)
{
if (iSrc.Length() > 0)
aCmdSet->AppendL(TCommand(TCommand::EUninstall, NULL, &iSrc));
}
else if(cmd == KCmdLogPs)
{
aCmdSet->AppendL(TCommand(TCommand::ELogPs, NULL, &iSrc));
}
}
//=================================================================================
TInt FindPath(TDes &aLine, TDes &aPath)
{
aLine.TrimLeft();
if (aLine.Length() == 0)
return 0;
if(aLine[0] == '"') //以引号开始的
{
int i=0;
while(++i<aLine.Length() && aLine[i] != '"')
{
// \" ==> "
// Added - Jul. 19, 2011
// Removed - Jul. 27, 2011
/*if (aLine[i] == '\\' && i+1 < aLine.Length() &&
aLine[i + 1] == '"')
{
i++;
aPath.Append(aLine[i]);
}
else*/
{
aPath.Append(aLine[i]);
}
}
return i;
}
else
{
int i=-1;
while(++i<aLine.Length() && aLine[i] != ' ') //以空格结束
{
/*if (aLine[i] == '\\' && i+1 < aLine.Length() &&
aLine[i + 1] == '"')
{
i++;
aPath.Append(aLine[i]);
}
else*/
{
aPath.Append(aLine[i]);
}
}
return i;
}
}
//=================================================================================
TInt GetParams(TDes &aLine, Parameter &aParam)
{
aLine.TrimLeft();
if (aLine.Length() < 2)
return 0;
int i = -1;
AttStatus status = not_set;
TBool bSlash = EFalse; //is '/'
while(++i < aLine.Length())
{
if (aLine[i] == ' ') //skip the space
continue;
if ((aLine[i] == '-' || aLine[i] == '+' || aLine[i] == '/') && i != aLine.Length() - 1)
{
if (i + 2 < aLine.Length())
if (aLine[i+2] != ' ') //参数后必须有空格
return i;
bSlash = EFalse;
if (aLine[i] == '+')
status = add_to;
else if (aLine[i] == '-')
status = rm_it;
else
bSlash = ETrue;
if (++i >= aLine.Length())
break;
//case insensitive
if (aLine[i] == 's' || aLine[i] == 'S')
{
if (bSlash)
aParam.is = ETrue;
else
aParam.s = status;
}
else if (aLine[i] == 'h' || aLine[i] == 'H')
aParam.h = status;
else if (aLine[i] == 'r' || aLine[i] == 'R')
aParam.r = status;
else if(aLine[i] == 'o' || aLine[i] == 'O')
aParam.ow = ETrue; // /o or -o is OK
else if(aLine[i] == 'c' || aLine[i] == 'C')
aParam.c = status;
else if(aLine[i] == 'a' || aLine[i] == 'A')
aParam.a = status;
else if(aLine[i] == 'e' || aLine[i] == 'E')
aParam.e = status;
else if(aLine[i] == 'w' || aLine[i] == 'W')
aParam.w = status;
else if(aLine[i] == 't' || aLine[i] == 'T')
aParam.t = status;
}
else //规定参数紧跟命令后
return i;
}
return 0;
}
//=================================================================================
TBool IsDir(const TDesC &aPath)
{
TParse iParse;
iFs.Parse(aPath, iParse);
if (iParse.IsWild()) //有通配符的当文件处理
return EFalse;
if (aPath[aPath.Length() - 1] == '\\')
return ETrue;
TEntry entry;
if (iFs.Entry(aPath, entry) != KErrNone)
return entry.IsDir();
return EFalse;
}
//=================================================================================
TBool GetCMD(TDes &aLine, TDes &cmd)
{
aLine.Trim();
//empty line
if (aLine.Length() == 0)
return EFalse;
//comment line
if (aLine[0] == ';' || aLine[0] == '#' || aLine[0] == '[')
return EFalse;
TInt posSpace = aLine.Locate(' ');
if (posSpace == KErrNotFound && aLine.Length() <= 24) //
{
cmd.Copy(aLine);
return ETrue;
}
//invalid command
if (posSpace == KErrNotFound ||
posSpace > 24 || posSpace == 0 ||
posSpace == aLine.Length() - 1
)
return EFalse;
cmd.Copy(aLine.Mid(0, posSpace));
return ETrue;
}
//=================================================================================
void ParseCMD(TDes &aCMD, TDes &aSrc, TDes *aDest/* = NULL*/, Parameter *aParam/* = NULL*/)
{
//parse first
if (aParam != NULL)
{
TInt len = GetParams(aCMD, *aParam);
if (len > 0)
{
aCMD.Delete(0, len);
aCMD.TrimLeft();
}
}
//then source path
TInt iLen = FindPath(aCMD, aSrc);
if (iLen == 0)
return ;
if (aDest != NULL)
{
// if (aSrc.Length() < 0)
// return ;
//Important to +2 when the first path enclosed by quote
if (aCMD[0] == '"')
aCMD.Delete(0, /*aSrc.Length()*/iLen + 2);
else
aCMD.Delete(0, /*aSrc.Length()*/iLen);
aCMD.TrimLeft();
FindPath(aCMD, *aDest);
}
}
//=================================================================================
TBool IsCmdDisabled()
{
/* TFindFile findFile(iFs);
//Search in drive from Y to A, and the last is Z
if (KErrNone == findFile.FindByDir(KDisableFile, _L("\\")))
return ETrue;
return EFalse;
*/
return !iConfig.IsMiniCMDEnabled();
}
//=================================================================================
TInt DoCommand(const TCommand &aCmd)
{
switch(aCmd.GetCommand())
{
case TCommand::ERun:
return DoRunApp(aCmd.GetSrc(), aCmd.GetParam().c == rm_it, aCmd.GetParam().w == rm_it);
case TCommand::EKill:
return DoKillApp(aCmd.GetSrc());
case TCommand::ESleep:
Sleep(DecStr2Int32(aCmd.GetSrc()));
return KErrNone;
case TCommand::ENone:
return KErrNotSupported;
case TCommand::EKey:
DoPressKey(aCmd);
return KErrNone;
case TCommand::ESendKey:
return DoSendKey(aCmd);
case TCommand::EFile:
return DoFile(aCmd);
case TCommand::ENote:
if (aCmd.GetParam().c == rm_it)
return Note(aCmd.GetSrc(), aCmd.GetDst());
else
return Note(aCmd.GetSrc());
case TCommand::ELog:
_LOG_(aCmd.GetSrc());
return KErrNone;
case TCommand::ECmd:
{
// to make log cmd first
LogToFile(0, aCmd);
TRAPD(iErr, DoLoadAndRunCmdL(aCmd.GetSrc()));
return iErr;
}
case TCommand::EFind:
DoFind(aCmd);
return KErrNone;
case TCommand::EInstall:
return DoInstall(aCmd.GetParam().e == rm_it ? 'E' : 'C', aCmd.GetSrc());
case TCommand::EUninstall:
return DoUninstall(HexStr2Int32(aCmd.GetSrc()));
case TCommand::ELogPs:
return DoLogPs(aCmd.GetSrc());
default: //the rest turn to the server (possible need tcb)
return DobyServer(aCmd);
}
}
//=================================================================================
TBool IsPathFileExists(const TDesC &aPath)
{
TEntry entry;
if (iFs.Entry(aPath, entry)!= KErrNone)
return EFalse;
return ETrue;
}
//=================================================================================
void Run(const CArrayFixFlat<TCommand> &aCmdSet)
{
for(TInt i=0; i<aCmdSet.Count(); i++)
{
if (iStop)
break;
// 这个'&'害死人了
const TCommand &cmd = aCmdSet[i];
TCommand::TCommandSet cs = cmd.GetCommand();
if (cmd.AbortIfExists() || cmd.AbortIfNotExists()) //abort_if_(not_)exists
{
TBool fExists = IsCondition(cmd);
if (cmd.AbortIfExists() && fExists)
break;
if (cmd.AbortIfNotExists() && !fExists)
break;
}
else if (cmd.SkipIfExists() || cmd.SkipIfNotExists()) //skip_if_(not_)exists
{
TBool fExists = IsCondition(cmd);
if ((cmd.SkipIfExists() && fExists) || (cmd.SkipIfNotExists() && !fExists))
{
i++;
// if the next cmd is if(n)
// then should skip this part
if (i < aCmdSet.Count() && (
aCmdSet[i].GetCommand() == TCommand::EIf ||
aCmdSet[i].GetCommand() == TCommand::EIfn))
{
for(; i<aCmdSet.Count(); i++)
{
if (aCmdSet[i].GetCommand() == TCommand::EEndIf)
break;
}
}
}
continue;
}
else if(cmd.BackIfExists() || cmd.BackIfNotExists()) //back_if_(not_)exists
{
TBool fExists = IsCondition(cmd);
if ((cmd.BackIfExists() && fExists) || (cmd.BackIfNotExists() && !fExists))
{
if (i > 0) //should not be the first cmd,
{
//i -= 2; // bug fixed Feb. 3, 2012
i --;
if (aCmdSet[i].GetCommand() == TCommand::EEndIf)
{
for(; i >= 0; i--)
{
if (aCmdSet[i].GetCommand() == TCommand::EIf ||
aCmdSet[i].GetCommand() == TCommand::EIfn)
{
//i--;
break;
}
}
}
i--;
}
}
continue;
}
else if (cmd.RestartIfExists() || cmd.RestartIfNotExists()) //restart_if_(not_)exists
{
TBool fExists = IsCondition(cmd);
if ((cmd.RestartIfExists() && fExists) || (cmd.RestartIfNotExists() && !fExists))
{
if (i > 0)
i = -1;
}
continue;
}
else if(cs == TCommand::EIf || cs == TCommand::EIfn)
{
DoIF(aCmdSet, i, 0);
continue;
}
else if(cs == TCommand::EAbort)
{
_LOG_(_L("[Abort]"));
break;
}
else if (cs == TCommand::EStop)
{
_LOG_(_L("[Stop]"));
iStop = ETrue;
break;
}
iLastErr = DoCommand(cmd);
// do not log cmd here
if (miniLog && cmd.GetCommand() != TCommand::ECmd)
LogToFile(iLastErr, cmd);
}
}
//=================================================================================
void SkipCmd(const CArrayFixFlat<TCommand> &aCmdSet, TInt &i)
{
for(++i; i<aCmdSet.Count(); i++)
{
TCommand iCmd = aCmdSet.operator [](i);
if (iCmd.GetCommand() == TCommand::EElse ||
iCmd.GetCommand() == TCommand::EElseIf ||
iCmd.GetCommand() == TCommand::EElseIfn ||
iCmd.GetCommand() == TCommand::EEndIf)
{
i--; //back to current found cmd
break;
}
}
}
//=================================================================================
TInt RunApp(const TDesC &aName)
{
RApaLsSession apaLsSession;
TInt ret = apaLsSession.Connect();
if (ret != KErrNone)
return ret;
CleanupClosePushL(apaLsSession);
if(ret == KErrNone)
{
CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
cmdLine->SetExecutableNameL(aName);
cmdLine->SetCommandL(EApaCommandRun);
ret = apaLsSession.StartApp(*cmdLine);
CleanupStack::PopAndDestroy(cmdLine);
}
CleanupStack::PopAndDestroy(&apaLsSession);
return ret;
}
//=================================================================================
TInt RunApp(TInt aUid)
{
RApaLsSession apaLsSession;
TInt ret = apaLsSession.Connect();
if (ret != KErrNone)
return ret;
CleanupClosePushL(apaLsSession);
TApaAppInfo appInfo;
TUid uid;
uid.iUid = aUid;
ret = apaLsSession.GetAppInfo(appInfo, uid);
if(ret == KErrNone)
{
CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
cmdLine->SetExecutableNameL(appInfo.iFullName);
cmdLine->SetCommandL(EApaCommandRun);
ret = apaLsSession.StartApp(*cmdLine);
CleanupStack::PopAndDestroy(cmdLine);
}
CleanupStack::PopAndDestroy(&apaLsSession);
return ret;
}
//=================================================================================
TInt DoRunApp(const TDesC &aStr, TBool aIsConsole/* = EFalse*/, TBool aWaitForFinish/* = EFalse */)
{
if (aIsConsole)
return RunConsole(aStr, aWaitForFinish);
if (IsHexString(aStr))
return RunApp(HexStr2Int32(aStr));
return RunApp(aStr);
}
//=================================================================================
TInt RunConsole(const TDesC &aName, TBool aWaitForFinish)
{
RProcess process;
TInt ret = process.Create(aName, KNullDesC);
if (ret == KErrNone)
{
if (aWaitForFinish)
{
TRequestStatus istat;
process.Logon(istat);
process.Resume();
User::WaitForRequest(istat);
}
else
{
process.Resume();
}
process.Close();
}
return ret;
}
//=================================================================================
TInt KillApp(TInt aUid)
{
TInt ret = KErrNone;
TFullName pName;
TFindProcess finder(_L("*"));
TUid tUid = {aUid};
while((ret = finder.Next(pName)) == KErrNone)
{
if (pName == KNullDesC)
break;
RProcess process;
ret = process.Open(pName);
if (ret != KErrNone)
return ret;
if (tUid == process.Type()[2])
{
process.Kill(0);
process.Close();
break;
}
process.Close();
}
return ret;
}
//=================================================================================
TInt KillApp(const TDesC &aName)
{
TInt ret = KErrNone;
TFullName pName;
pName.Copy(aName);
pName.Append('*');
TFindProcess finder(pName);
while((ret = finder.Next(pName)) == KErrNone)
{
if (pName == KNullDesC)
break;
RProcess process;
ret = process.Open(pName);
if (ret != KErrNone)
return ret;
process.Kill(0);
process.Close();
break;
}
return ret;
}
//=================================================================================
TInt DoKillApp(const TDesC &aStr)
{
if (IsHexString(aStr))
return KillApp(HexStr2Int32(aStr));
return KillApp(aStr);
}
//=================================================================================
void Sleep(TInt aMs)
{
User::After(aMs * 1000);
}
//=================================================================================
TInt GetHex(char hex)
{
if (hex >= '0' && hex <= '9')
return hex - '0';
if (hex >= 'a' && hex <= 'f')
return hex - 'a' + 10;
if (hex >= 'A' && hex <= 'F')
return hex - 'A' + 10;
return 0;
}
//=================================================================================
TInt32 HexStr2Int32(const TDesC & aHexStr)
{
TInt len = aHexStr.Length();
//防止溢出
if(len > 10) return 0;
TInt32 res = 0;
TInt32 tmp = 0;
const TUint16 * hexString = aHexStr.Ptr();
TInt i = 0;
if (aHexStr.Length() > 1 && aHexStr[0] == '0' &&
(aHexStr[1] == 'x' || aHexStr[1] == 'X'))
i = 2;
for (; i < len; i++)
{
tmp = GetHex(hexString[i]);
tmp <<= ((len-i-1)<<2);
res |= tmp;
}
return res;
}
//=================================================================================
TInt32 DecStr2Int32(const TDesC &aDecStr)
{
TInt len = aDecStr.Length();
TInt i = 0;
TReal res = 0;
for (TInt j=len-1; j>=0; j--)
{
TReal pow = 0;
Math::Pow10(pow, i++);
res = (aDecStr[j] - '0') * pow + res;
}
return (TInt32)res;
}
//=================================================================================
TInt DobyServer(const TCommand &aCmd)
{
TRequestCommand iReqstCmd(aCmd);
iServer.RequestCommand(iReqstCmd);
return iReqstCmd.iRet;
}
//=================================================================================
void PressKey(TInt aKey, TInt aTime/* = 50000*/)
{
TRawEvent lEventDown;
lEventDown.Set(TRawEvent::EKeyDown, aKey);
UserSvr::AddEvent(lEventDown);
User::After(aTime);
TRawEvent lEventUp;
lEventUp.Set(TRawEvent::EKeyUp, aKey);
UserSvr::AddEvent(lEventUp);
}
//=================================================================================
void PressKey(const TDesC &aKey, TInt aTime/* = 50000*/)
{
TInt len = aKey.Length();
for(TInt i=0; i<len; i++)
PressKey(aKey[i], aTime);
}
//=================================================================================
void DoPressKey(const TCommand &aCmd)
{
if (aCmd.GetSrc().Length() == 0) //no key defined
return ;
TInt time = 50000; //default is 50ms
if (aCmd.GetDst().Length() > 0)
{
time = DecStr2Int32(aCmd.GetDst());
if (time < 10)
time = 10;
time *= 1000;
}
if (aCmd.GetParam().c == rm_it) //use key code instead ascii
PressKey(DecStr2Int32(aCmd.GetSrc()), time);
else if (aCmd.GetParam().c == not_set)
PressKey(aCmd.GetSrc(), time);
}
//=================================================================================
void SendKey(TApaTask &app, TInt aKey)
{
TKeyEvent key = {0};
key.iCode = aKey;
key.iScanCode = aKey;
app.SendKey(key);
}
//=================================================================================
TInt SendKey(TInt aUid, const TDesC &aKey)
{
RWsSession wsSession;
TInt ret = wsSession.Connect();
if (ret != KErrNone)
return ret;
TApaTaskList tlist(wsSession);
TUid uid;
uid.iUid = aUid;
TApaTask app(tlist.FindApp(uid));
if (!app.Exists())
{
wsSession.Close();
return KErrNotFound;
}
TInt len = aKey.Length();
for(TInt i=0; i<len; i++)
SendKey(app, aKey[i]);
wsSession.Close();
return KErrNone;
}
//=================================================================================
TInt SendKey(TInt aUid, TInt aKey)
{
RWsSession wsSession;
TInt ret = wsSession.Connect();
if (ret != KErrNone)
return ret;
TApaTaskList tlist(wsSession);
TUid uid;
uid.iUid = aUid;
TApaTask app(tlist.FindApp(uid));
if (!app.Exists())
{
wsSession.Close();
return KErrNotFound;
}
SendKey(app, aKey);
wsSession.Close();
return KErrNone;
}
//=================================================================================
TInt SendKey(const TDesC &aAppName, const TDesC &aKey)
{
RWsSession wsSession;
TInt ret = wsSession.Connect();
if (ret != KErrNone)
return ret;
TApaTaskList tlist(wsSession);
TApaTask app(tlist.FindApp(aAppName));
if (!app.Exists())
{
wsSession.Close();
return KErrNotFound;
}
TInt len = aKey.Length();
for(TInt i=0; i<len; i++)
SendKey(app, aKey[i]);
wsSession.Close();
return KErrNone;
}
//=================================================================================
TInt SendKey(const TDesC &aAppName, TInt aKey)
{
RWsSession wsSession;
TInt ret = wsSession.Connect();
if (ret != KErrNone)
return ret;
TApaTaskList tlist(wsSession);
TApaTask app(tlist.FindApp(aAppName));
if (!app.Exists())
{
wsSession.Close();
return KErrNotFound;
}
SendKey(app, aKey);
wsSession.Close();
return KErrNone;
}
//=================================================================================
TInt DoSendKey(const TCommand &aCmd)
{
if (aCmd.GetSrc().Length() == 0 || aCmd.GetDst().Length() == 0)
return KErrGeneral;
if (IsHexString(aCmd.GetDst())) //UID
{
TBuf<16> iUid;
iUid.Copy(aCmd.GetDst());
iUid.Delete(0, 2);
if (aCmd.GetParam().c == rm_it) //use key code instead ascii
return SendKey(HexStr2Int32(iUid), DecStr2Int32(aCmd.GetSrc()));
else if (aCmd.GetParam().c == not_set)
return SendKey(HexStr2Int32(iUid), aCmd.GetSrc());
}
if (aCmd.GetParam().c == rm_it)
return SendKey(aCmd.GetDst(), DecStr2Int32(aCmd.GetSrc()));
else if (aCmd.GetParam().c == not_set)
return SendKey(aCmd.GetDst(), aCmd.GetSrc());
return KErrNone;
}
//=================================================================================
TInt OpenFile(const TDesC &aFileName)
{
RApaLsSession apaLsSession;
TInt ret = apaLsSession.Connect();
if (ret != KErrNone)
return ret;
CleanupClosePushL(apaLsSession);
TThreadId iThreadId;
ret = apaLsSession.StartDocument(aFileName, iThreadId);
CleanupStack::PopAndDestroy(&apaLsSession);
return ret;
}
//=================================================================================
TInt DoFile(const TCommand &aCmd)
{
if (aCmd.GetSrc().Length() == 0)
return KErrGeneral;
if (aCmd.GetParam().c == rm_it)
return DobyServer(aCmd); //due to when create file in sys\ need tcb cap
else if(aCmd.GetParam().c == not_set)
return OpenFile(aCmd.GetSrc());
return KErrGeneral;
}
//=================================================================================
TInt Note(const TDesC &aInfo, const TDesC &aTitle)
{
CAknGlobalMsgQuery * pDlg = CAknGlobalMsgQuery::NewL();
CleanupStack::PushL(pDlg);
TRequestStatus iStatus;
pDlg->ShowMsgQueryL(iStatus, aInfo, R_AVKON_SOFTKEYS_OK_CANCEL, aTitle,
KNullDesC, 0, -1, CAknQueryDialog::EConfirmationTone);
User::WaitForRequest(iStatus);
CleanupStack::PopAndDestroy(pDlg);
return iStatus.Int() == EAknSoftkeyOk ? 0 : -1;
}
//=================================================================================
TInt Note(const TDesC &aInfo)
{
CAknGlobalNote *note = CAknGlobalNote::NewLC();
TRequestStatus iStatus;
note->ShowNoteL(EAknGlobalInformationNote, aInfo);
CleanupStack::PopAndDestroy(note);
return KErrNone;
}
//=================================================================================
/*
TBool GetLogFileL(TFileName &aFile)
{
TFileName cmdFile;
if (IsPathFileExists(KDefCMDFileD))
cmdFile.Copy(KDefCMDFileD);
else if (IsPathFileExists(KDefCMDFileE))
cmdFile.Copy(KDefCMDFileE);
else if (IsPathFileExists(KDefCMDFileC))
cmdFile.Copy(KDefCMDFileC);
else if (IsPathFileExists(KDefCMDFileZ))
cmdFile.Copy(KDefCMDFileZ);
if (cmdFile.Length() == 0)
return EFalse;
RFile file;
if (file.Open(iFs, cmdFile, EFileShareReadersOnly | EFileRead) != KErrNone)
return EFalse;
TFileText fileText;
fileText.Set(file);
HBufC *buffer = HBufC::NewLC(512);
TPtr ptr = buffer->Des();
if (fileText.Read(ptr) == KErrNone)
{
ptr.Trim();
if (ptr.Length() > 6 && ptr[0] == '[' && ptr[ptr.Length()-1] == ']')
{
ptr.Copy(ptr.Mid(1, ptr.Length() - 2));
ptr.Trim();
ptr.LowerCase();
TInt posEqual = ptr.Locate('=');
if (KErrNotFound != posEqual)
{
cmdFile.Copy(ptr.Mid(0, posEqual));
cmdFile.Trim();
if (cmdFile == _L("log"))
{
aFile.Copy(ptr.Mid(posEqual + 1));
aFile.Trim();
file.Close();
CleanupStack::PopAndDestroy(buffer);
return aFile.Length() > 0;
}
else if(cmdFile == _L("log-all"))
{
iLogAll = ETrue;
aFile.Copy(ptr.Mid(posEqual + 1));
aFile.Trim();
file.Close();
CleanupStack::PopAndDestroy(buffer);
return aFile.Length() > 0;
}
}
}
}
file.Close();
CleanupStack::PopAndDestroy(buffer);
return EFalse;
}
*/
//=================================================================================
void LogToFile(TInt aErrCode, const TCommand &aCmd)
{
if (!iLogAll && aErrCode == KErrNone)
return ;
HBufC *logBuf = HBufC::NewLC(512);
TPtr des = logBuf->Des();
des.Append('[');
switch(aCmd.GetCommand())
{
case TCommand::EAtt: des.Append(KCmdAtt); break;
case TCommand::ECp: des.Append(KCmdCp); break;
case TCommand::EMv: des.Append(KCmdMv); break;
case TCommand::EMd: des.Append(KCmdMd); break;
case TCommand::ERm: des.Append(KCmdRm); break;
case TCommand::ERn: des.Append(KCmdRn); break;
case TCommand::EDel: des.Append(KCmdDel); break;
case TCommand::ERun: des.Append(KCmdRun); break;
case TCommand::EKill: des.Append(KCmdKill); break;
case TCommand::ESleep: des.Append(KCmdSleep); break;
case TCommand::EKey: des.Append(KCmdKey); break;
case TCommand::ESendKey: des.Append(KCmdSendKey); break;
case TCommand::EFile: des.Append(KCmdFile); break;
case TCommand::ENote: des.Append(KCmdNote); break;
case TCommand::ELog: des.Append(KCmdLog); break;
case TCommand::ECmd: des.Append(KCmdCmd); break;
case TCommand::EFind: des.Append(KCmdFind); break;
case TCommand::EInstall: des.Append(KCmdInstall); break;
case TCommand::EUninstall: des.Append(KCmdUninstall); break;
case TCommand::ELogPs: des.Append(KCmdLogPs); break;
default: des.Append(_L("Not defined"));
}
if (aCmd.GetSrc().Length() > 0)
{
des.Append(' ');
des.Append('"');
des.Append(aCmd.GetSrc());
des.Append('"');
}
if (aCmd.GetDst().Length() > 0)
{
des.Append(' ');
des.Append('"');
des.Append(aCmd.GetDst());
des.Append('"');
}
des.Append(KLogFmt);
miniLog->Log(des, aErrCode);
CleanupStack::PopAndDestroy(logBuf);
}
//=================================================================================
TBool IsAppRunning(const TDesC &aAppName)
{
TFullName pName;
pName.Copy(aAppName);
pName.Append('*');
TFindProcess finder(pName);
while(finder.Next(pName) == KErrNone)
{
if (pName == KNullDesC)
break;
return ETrue;
}
return EFalse;
}
//=================================================================================
TBool IsAppRunning(TInt aUid)
{
/* cause no use during startup time
RWsSession wsSession;
wsSession.Connect();
TApaTaskList taskList(wsSession);
TUid iUid = {aUid};
TApaTask apaTask = taskList.FindApp(iUid);
wsSession.Close();
return apaTask.Exists();
*/
TFullName pName;
TFindProcess finder(_L("*"));
TUid tUid = {aUid};
while(finder.Next(pName) == KErrNone)
{
if (pName == KNullDesC)
return EFalse;
RProcess process;
if (process.Open(pName) != KErrNone)
return EFalse;
if (tUid == process.Type()[2])
{
process.Close();
return ETrue;
}
process.Close();
}
return EFalse;
}
//=================================================================================
TBool TestAppRunning(const TDesC &aApp)
{
if (IsHexString(aApp))
return IsAppRunning(HexStr2Int32(aApp));
return IsAppRunning(aApp);
}
//=================================================================================
TBool IsHexString(const TDesC &aStr)
{
return (aStr.Length() > 2 && aStr[0] == '0'
&& (aStr[1] == 'x' || aStr[1] == 'X'));
}
//=================================================================================
TBool IsCondition(const TCommand &aCmd)
{
TBool fExists = EFalse;
if (aCmd.GetParam().a == rm_it)
fExists = TestAppRunning(aCmd.GetSrc());
else if(aCmd.GetParam().e == rm_it)
return iLastErr != KErrNone;
else if(aCmd.GetParam().s == rm_it)
return FileSize(aCmd.GetSrc()) == FileSize(aCmd.GetDst());
else if(aCmd.GetParam().t == rm_it)
return CmpCurrentTime(aCmd.GetSrc());
else
fExists = IsPathFileExists(aCmd.GetSrc());
return fExists;
}
//=================================================================================
void DoLoadAndRunCmdL(const TDesC &aFileName)
{
CArrayFixFlat<TCommand> *iCmdSet = new(ELeave) CArrayFixFlat<TCommand>(5);
CleanupStack::PushL(iCmdSet);
if (LoadCmdFileL(aFileName, iCmdSet) == KErrNone)
{
Run(*iCmdSet);
}
CleanupStack::PopAndDestroy(iCmdSet);
}
///////////////////////////////////////////////////////////////////////////////////////////////
TInt FileSize(const TDesC &aFileName)
{
TEntry entry;
TInt err = iFs.Entry(aFileName, entry);
if (err == KErrNone)
return entry.iSize;
return err;
}
///////////////////////////////////////////////////////////////////////////////////////////////
void DoFind(const TCommand &aCmd)
{
TBool isLog = (aCmd.GetDst() == _L("log"));
TBool iRecursive = aCmd.GetParam().is;
// nothing to do with log operation
if (isLog && NULL == miniLog)
return ;
CDesCArray *dirs = new (ELeave)CDesCArrayFlat(3);
if (NULL == dirs)
return ;
CleanupStack::PushL(dirs);
HBufC *iBuf = HBufC::NewLC(128);
if (NULL == iBuf)
{
CleanupStack::PopAndDestroy(dirs);
return ;
}
TPtr targetPtr = iBuf->Des();
TInt i = 0;
while(i < aCmd.GetSrc().Length())
{
if (aCmd.GetSrc()[i] == ';')
{
dirs->AppendL(targetPtr);
targetPtr.Delete(0, targetPtr.Length());
}
else if(aCmd.GetSrc()[i] == '|') //
{
if (targetPtr.Length() > 0)
dirs->AppendL(targetPtr);
i++; // skip '|'
targetPtr.Delete(0, targetPtr.Length());
while(i < aCmd.GetSrc().Length())
targetPtr.Append(aCmd.GetSrc()[i++]);
}
else
{
targetPtr.Append(aCmd.GetSrc()[i]);
}
i++;
}
for(i=0; i<dirs->Count(); i++)
{
if (isLog)
FindFile(dirs->operator[](i), targetPtr, iRecursive, LogFile);
else
FindFile(dirs->operator[](i), targetPtr, iRecursive, DelFile);
}
CleanupStack::PopAndDestroy(iBuf);
CleanupStack::PopAndDestroy(dirs);
}
///////////////////////////////////////////////////////////////////////////////////////////////
void FindFile(const TDesC &aDir, const TDesC &aFile, TBool aRecursive, void (*OpFunc)(const TDesC&))
{
if (NULL == OpFunc)
return ;
CDirScan* ds = CDirScan::NewLC(iFs);
if (NULL == ds)
return ;
ds->SetScanDataL(aDir, KEntryAttDir, ESortByName);
while (ETrue)
{
CDir* dir = NULL;
TRAPD(error, ds->NextL(dir));
if (KErrNone != error || NULL == dir)
break;
FindFileReal(ds->FullPath(), aFile, OpFunc);
delete dir;
if (!aRecursive)
break;
}
CleanupStack::PopAndDestroy(ds);
}
///////////////////////////////////////////////////////////////////////////////////////////////
void FindFileReal(const TDesC &aDir, const TDesC &aFile, void (*OpFunc)(const TDesC&))
{
TFindFile findFile(iFs);
CDir *dir = NULL;
/*TInt err = */findFile.FindWildByDir(aFile, aDir, dir);
if (NULL == dir)
return ;
for (TInt i = 0; i < dir->Count(); i++)
{
TEntry entry = (*dir)[i];
TBuf<256> filePath;
filePath.Append(aDir);
filePath.Append(entry.iName);
OpFunc(filePath);
}
delete dir;
}
///////////////////////////////////////////////////////////////////////////////////////////////
void LogFile(const TDesC &aFile)
{
_LOG_(aFile);
}
///////////////////////////////////////////////////////////////////////////////////////////////
void DelFile(const TDesC &aFile)
{
TCommand iCmd(TCommand::ERm, NULL, &aFile);
DobyServer(iCmd);
}
///////////////////////////////////////////////////////////////////////////////////////////////
TInt DoInstall(TChar aDrive, const TDesC &aPath)
{
SwiUI::RSWInstSilentLauncher iLauncher;
SwiUI::TInstallOptions iOptions;
SwiUI::TInstallOptionsPckg iOptionsPckg;
User::LeaveIfError(iLauncher.Connect());
iOptions.iUpgrade = SwiUI::EPolicyAllowed;
iOptions.iOCSP = SwiUI::EPolicyNotAllowed;
iOptions.iDrive = aDrive;
iOptions.iUntrusted = SwiUI::EPolicyAllowed;
iOptions.iCapabilities = SwiUI::EPolicyAllowed;
iOptions.iOverwrite = SwiUI::EPolicyAllowed;
iOptions.iDownload = SwiUI::EPolicyAllowed;
iOptionsPckg = iOptions;
/* TEntry entry;*/
TInt ret = KErrNone;
/* if (iFs.Entry(aPath, entry) != KErrNone && entry.IsDir())
{
TFindFile findFile(iFs);
CDir *dir = NULL;
findFile.FindWildByDir(_L("*.sis*"), aPath, dir);
if (NULL == dir)
{
iLauncher.Close();
return KErrNotFound;
}
for (TInt i = 0; i < dir->Count(); i++)
{
TEntry entry = (*dir)[i];
TBuf<256> filePath;
filePath.Append(aPath);
filePath.Append(entry.iName);
ret = iLauncher.SilentInstall(filePath, iOptionsPckg);
}
delete dir;
}
else*/
{
ret = iLauncher.SilentInstall(aPath, iOptionsPckg);
}
iLauncher.Close();
return ret;
}
///////////////////////////////////////////////////////////////////////////////////////////////
TInt DoUninstall(TInt aUid)
{
TUid iUid = { aUid };
SwiUI::RSWInstSilentLauncher iLauncher;
User::LeaveIfError(iLauncher.Connect());
SwiUI::TUninstallOptions options;
options.iBreakDependency = SwiUI::EPolicyAllowed;
options.iKillApp = SwiUI::EPolicyAllowed;
SwiUI::TUninstallOptionsPckg optPckg(options);
TInt ret = iLauncher.SilentUninstall(iUid, optPckg, SwiUI::KSisxMimeType());
iLauncher.Close();
return ret;
}
///////////////////////////////////////////////////////////////////////////////////////////////
TBool CmpCurrentTime(const TDesC &aTimeStr)
{
TTime curTime;
curTime.HomeTime();
TDateTime dt = curTime.DateTime();
TInt32 time = dt.Hour() * 60 * 60 + dt.Minute() * 60 + dt.Second();
return time == TimeStr2Int32(aTimeStr);
}
///////////////////////////////////////////////////////////////////////////////////////////////
TInt32 TimeStr2Int32(const TDesC &aTimeStr)
{
TInt32 time = 0;
TInt i = 0;
TBuf<10> temp;
// hour
while (i < aTimeStr.Length() && aTimeStr[i] != ':') {
temp.Append(aTimeStr[i++]);
}
temp.Trim();
time += DecStr2Int32(temp) * 60 * 60;
temp.Copy(_L(""));
i++;
// minute
while (i < aTimeStr.Length() && aTimeStr[i] != ':') {
temp.Append(aTimeStr[i++]);
}
temp.Trim();
time += DecStr2Int32(temp) * 60;
temp.Copy(_L(""));
i++;
// sec
while (i < aTimeStr.Length() && aTimeStr[i] != ' ') {
temp.Append(aTimeStr[i++]);
}
temp.Trim();
time += DecStr2Int32(temp);
return time;
}
///////////////////////////////////////////////////////////////////////////////////////////////
TInt DoLogPs(const TDesC &aLogFile)
{
CMiniLog *iLog = NULL;
if (aLogFile.Length() == 0) // Use default log file
{
iLog = miniLog;
}
else
{
TRAPD(iErr, iLog = CMiniLog::NewL(iFs, aLogFile));
if (iErr != KErrNone || !IsPathFileExists(aLogFile))
{
if (iLog != NULL)
delete iLog;
return iErr;
}
}
if (iLog == NULL)
return KErrNotFound;
TFullName pName;
pName.Copy(_L("*"));
TFindProcess finder(pName);
iLog->Log(_L("[Begin LogPs]"));
while(finder.Next(pName) == KErrNone)
{
if (pName == KNullDesC)
break;
iLog->Log(pName);
}
iLog->Log(_L("[End LogPs]\n"));
if (aLogFile.Length() > 0)
delete iLog;
return KErrNone;
}
///////////////////////////////////////////////////////////////////////////////////////////////
void DoIF(const CArrayFixFlat<TCommand> &aCmdSet, TInt &i, TInt aLevel)
{
TBool lastCondition = EFalse;
TBool fromTop = ETrue;
TInt curLevel = aLevel;
for(; i<aCmdSet.Length(); i++)
{
const TCommand &cmd = aCmdSet[i];
TCommand::TCommandSet cs = cmd.GetCommand();
if (cs == TCommand::EIf || cs == TCommand::EIfn)
{
if (fromTop)
{
fromTop = EFalse;
TBool fExists = IsCondition(cmd);
if ((cs == TCommand::EIf && fExists) || (cs == TCommand::EIfn && !fExists))
{
lastCondition = ETrue;
continue;
}
SkipIfBlock(aCmdSet, i, aLevel);
lastCondition = EFalse;
SkipCmd(aCmdSet, i);
}
else
{
curLevel++;
//_LOG_FMT_(_L("DoIF(%d)->>>"), aLevel);
DoIF(aCmdSet, i, curLevel);
if (i<aCmdSet.Length() && aCmdSet[i].GetCommand() == TCommand::EEndIf)
curLevel--;
//_LOG_FMT_(_L("<<<-DoIF(%d)"), aLevel);
}
continue;
}
else if (cs == TCommand::EElseIf || cs == TCommand::EElseIfn )
{
if (!lastCondition)
{
TBool fExists = IsCondition(cmd);
if ((cs == TCommand::EElseIf && fExists) ||
(cs == TCommand::EElseIfn && !fExists))
{
lastCondition = ETrue;
continue;
}
else
lastCondition = EFalse;
}
SkipIfBlock(aCmdSet, i, aLevel);
SkipCmd(aCmdSet, i);
continue;
}
else if (cs == TCommand::EElse)
{
if (!lastCondition)
{
continue;
}
SkipIfBlock(aCmdSet, i, aLevel);
SkipCmd(aCmdSet, i);
continue;
}
else if (cs == TCommand::EEndIf)
{
// _LOG_FMT_(_L("ENDIF (%d)"), i);
if (curLevel == aLevel)
return ;
curLevel--;
continue;
}
iLastErr = DoCommand(cmd);
if (miniLog && cmd.GetCommand() != TCommand::ECmd)
LogToFile(iLastErr, cmd);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
void SkipIfBlock(const CArrayFixFlat<TCommand> &aCmdSet, TInt &i, TInt aLevel)
{
TInt curLevel = aLevel;
for( ++i; i<aCmdSet.Count(); i++)
{
TCommand::TCommandSet cs = aCmdSet[i].GetCommand();
if (cs == TCommand::EElseIf || cs == TCommand::EElseIfn ||
cs == TCommand::EElse)
{
if (curLevel == aLevel)
{
--i;
break;
}
}
else if (cs == TCommand::EIf || cs == TCommand::EIfn)
{
curLevel++;
}
else if (cs == TCommand::EEndIf)
{
if (curLevel == aLevel)
{
--i;
break;
}
curLevel--;
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
//END OF FILE
///////////////////////////////////////////////////////////////////////////////////////////////
|
d9ce9bdafe276de7be03792a4e27008752a2b214
|
4178f7bf3a27d71aea1f9861287f567e18278675
|
/Olympick_HaNam/buoi_4.Function.array/bt1.cpp
|
a7e99434b46d323ae12884e5c5c9eaab858f38e5
|
[] |
no_license
|
Minglee2018/Olympick-K12
|
a0fc89c1c94252227251364584fc6365f2e2b097
|
1e027a08a7b6385af51635773dc8b1c8e9e2b7f8
|
refs/heads/master
| 2020-03-29T20:34:07.603638
| 2019-01-10T19:52:55
| 2019-01-10T19:52:55
| 150,318,176
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 236
|
cpp
|
bt1.cpp
|
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{ cin>>n;
int dem1=1;
int dem2=2;
for(int i=3;i<=n;i++)
{
if(i%2!=0)
dem1+=i;
else
dem2+=i;
}
cout<<dem1<<" "<<dem2;
}
|
c9b5e5395efc876ee0f2c2b8e264863bf1fd4452
|
288324d90ab9e4d247a9cc8b7d21b82c8f1724fc
|
/UserSide/client.h
|
15213340124dc0499b69c43d60790c11ab04d069
|
[] |
no_license
|
natalieberg/AquariumProject
|
6b87734aaca6e4f2660b8db53c51c150be925181
|
c5f86e95bc5e242ccacbf57f0088c3c5c93689c8
|
refs/heads/master
| 2021-08-28T04:51:02.047462
| 2017-12-11T08:04:57
| 2017-12-11T08:04:57
| 107,388,778
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 394
|
h
|
client.h
|
#ifndef CLIENT_H
#define CLIENT_H
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <mutex>
#include <queue>
#include <string>
#include "definitions.h"
extern "C"
{
int connectUDP();
void listenUDP(struct TemperatureStruct *temperatureStruct, struct PHStruct *phStruct,
struct LeakStruct *leakStruct);
}
#endif
|
82985808ff1e24c23126c3e5b29b8726290b1873
|
136b2710349523800dc553e7fe315277e3beb602
|
/Projects/Engine/src/Engine/Core/ECS/System.h
|
5c956f0066c20633c54b28929c3962743e39a758
|
[] |
no_license
|
jonathan2222/VulkanEngine
|
f5f16daaed2f37f0c78447314c68318da61dd61c
|
2c3650682ad6c014bc9d560681f33daf251435d1
|
refs/heads/master
| 2023-08-28T02:44:01.624870
| 2021-10-05T14:17:06
| 2021-10-05T14:17:06
| 235,889,779
| 0
| 0
| null | null | null | null |
WINDOWS-1252
|
C++
| false
| false
| 389
|
h
|
System.h
|
#pragma once
namespace ym
{
class System
{
// Can filter which entities will be processed by:
// * All — the archetype must contain all of the component types in the All category.
// * Any — the archetype must contain at least one of the component types in the Any category.
// * None — the archetype must not contain any of the component types in the None category.
};
}
|
35054028a0cd1d5ea64dbab173d989f2c4149794
|
070688f1f1e0b29f767061d5901f763743631048
|
/src/Handler.cpp
|
1d756e703003339ca7e290997cdb672bc9b0b080
|
[] |
no_license
|
Aykelith/SFML2-QuadTree
|
f074414149f9e8aa6cc14cec82b24da955f9f478
|
084ce2d75b5f2b35a86f8bc4fa8db177af9694af
|
refs/heads/master
| 2021-01-02T08:21:04.960257
| 2014-04-04T18:30:37
| 2014-04-04T18:30:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,601
|
cpp
|
Handler.cpp
|
#include "Handler.hpp"
Handler::Handler():
m_qt(sf::FloatRect(0,0,800,600))
{
m_window.create(sf::VideoMode(800,600), "QuadTree");
run();
}
void Handler::run()
{
while(m_window.isOpen())
{
sf::Event event;
while (m_window.pollEvent(event))
{
if(event.type == sf::Event::Closed || (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape))
m_window.close();
if (event.type == sf::Event::MouseButtonPressed)
{
sf::Vector2f mousePos(sf::Mouse::getPosition(m_window).x, sf::Mouse::getPosition(m_window).y);
if (event.mouseButton.button == sf::Mouse::Left)
{
sf::RectangleShape box(sf::Vector2f(m_objectSize,m_objectSize));
box.setFillColor(sf::Color::Red);
box.setOutlineThickness(1);
box.setOutlineColor(sf::Color::Black);
box.setPosition(getNoCollisionPosition(mousePos));
m_objects.push_back(box);
m_qt.insert(m_objects[m_objects.size()-1]);
}
else
{
for (std::size_t i=0; i<m_objects.size(); ++i)
{
sf::FloatRect object = m_objects[i].getGlobalBounds();
if (object.contains(mousePos))
{
m_objects.erase(m_objects.begin()+i);
}
}
}
}
}
m_window.clear(sf::Color::White);
m_qt.draw(m_window);
for (std::size_t i=0; i<m_objects.size(); ++i)
{
m_window.draw(m_objects[i]);
}
m_window.display();
}
}
sf::Vector2f Handler::getNoCollisionPosition(sf::Vector2f pos)
{
std::vector<sf::RectangleShape*> objects = m_qt.getObjects(pos);
sf::FloatRect object(pos.x, pos.y, m_objectSize, m_objectSize);
sf::Vector2f finalPos(pos);
for (std::size_t i=0; i<objects.size(); ++i)
{
if (objects[i]->getGlobalBounds().intersects(object))
{
sf::FloatRect halfRect(objects[i]->getGlobalBounds());
halfRect.width /= 2;
if (halfRect.intersects(object))
{
object.left = objects[i]->getGlobalBounds().left - objects[i]->getGlobalBounds().width;
}
else
{
object.left = objects[i]->getGlobalBounds().left + objects[i]->getGlobalBounds().width;
}
finalPos = getNoCollisionPosition(sf::Vector2f(object.left, object.top));
}
}
return finalPos;
}
|
16b35e472d9771b5eae503d399d54430746ee708
|
e7aa683f6d0331ffbf61d51d98b6d271be92eaee
|
/University 3rd Year OpenSceneGraph Assignemnt/OSG_Assignement/OSG_Utils/NodePrinter.h
|
da5502f9dea6ca279d98f705f70e2a5ae231c997
|
[] |
no_license
|
maxhap/University-OpenGL2.0-OSG
|
60e8fd9e6b79ef500acc1181f89a87280fb59bf5
|
e7a1a6c1fbb3716411ce197f18dfd3bcc25c7aeb
|
refs/heads/master
| 2016-09-10T14:27:41.775455
| 2014-09-12T08:42:36
| 2014-09-12T08:42:36
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,337
|
h
|
NodePrinter.h
|
#ifndef _NODEPRINTER_
#define _NODEPRINTER_
#include "stdafx.h"
#include "NodeFinder.h"
using namespace std;
template<class T> class __declspec(dllexport) NodePrinter : public NodeFinder<T>
{
public:
NodePrinter( osg::NodeVisitor::TraversalMode mode ) : NodeFinder<T>( mode )
{
pLastNode = NULL;
_uiLevel = 0;
_ofStream.open( "..\\data\\printout.txt" );
}
virtual ~NodePrinter()
{
_ofStream.close();
}
/*----------------------------------------------------------------------------------
Author: MaxAshton
function: determinLevel
description: 1. print out node name with - indicating level
----------------------------------------------------------------------------------*/
virtual void apply( osg::Node &node )
{
for( unsigned int i = 0; i < _uiLevel; i++ )
{
cout << "-";
_ofStream << "-";
}
cout << node.getName() << "\n";
_ofStream << node.getName() << "\n";
determinLevel( node );
pLastNode = &node;
NodeFinder<T>::apply( node );
}
private:
osg::Node* pLastNode;
unsigned int _uiLevel;
ofstream _ofStream;
/*----------------------------------------------------------------------------------
Author: MaxAshton
function: determinLevel
description: 1. if last node is a parent of current then increase level
2. if last node is a child of current node then decrease level
----------------------------------------------------------------------------------*/
void determinLevel( osg::Node &node )
{
if( pLastNode == NULL ) return;
//if( node.getName().compare( "" ) != 0 || pLastNode->getName().compare( "" ) == 0) return;
osg::Node::ParentList nlParents = node.getParents();
osg::Node::ParentList::iterator i = find( nlParents.begin(), nlParents.end(), pLastNode );
if( i != nlParents.end() )
{
_uiLevel++;
return;
}
osg::Group* pCurrentNodeAsGroup = dynamic_cast<osg::Group*>( &node );
if( pCurrentNodeAsGroup )
{
for( unsigned int i = 0; i < pCurrentNodeAsGroup->getNumChildren(); i++ )
{
osg::Node* pNode = pCurrentNodeAsGroup->getChild( i );
if( pNode )
{
if( pCurrentNodeAsGroup == &node )
{
//if 0 root node being checked against itself
if( _uiLevel > 0 )
{
_uiLevel--;
}
return;
}
}
}
}
}
};
#endif
|
223cb911c4c47d2f5cf6004366ffeba0679747c8
|
a4b6e8c4c5ffffd3c211d7eb8f7338b7a912b23e
|
/WiiRotationsTest/Main.cpp
|
49f89aedfa1bddac1ecb7fcfec0b7fe3e7e08385
|
[] |
no_license
|
daragao/wiiarmctrl
|
10accbba76319730c76b6d89b19c9c0af05015b2
|
866cebe943c9fe763db2cd9b0bf2fc9c96d82ea5
|
refs/heads/master
| 2016-09-06T06:05:25.008381
| 2015-03-20T09:50:14
| 2015-03-20T09:50:14
| 32,530,925
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,888
|
cpp
|
Main.cpp
|
/*#include <stdio.h>
#include "glWindow.h"
//MAIN
int main(int argc, char *argv[]) {
//--------
printf("\n\n--------- OpenGL :D ---------\n\n");
//glWindow *glWin = new glWindow(argc, argv);
return 0;
}
*/
#include <iostream>
#include <cstdlib>
#include <GL/glut.h>
using namespace std;
// function prototypes
void disp(void);
void keyb(unsigned char key, int x, int y);
void drawVector(double point[3], double color[3]);
// window identifier
static int win;
int main(int argc, char **argv){
//////////
// INIT //
//////////
// initialize glut
glutInit(&argc, argv);
// specify the display mode to be RGB and single buffering
// we use single buffering since this will be non animated
glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE);
// define the size
glutInitWindowSize(500,500);
// the position where the window will appear
glutInitWindowPosition(100,100);
// if we would want fullscreen:
// glutFullScreen();
// create the window, set the title and keep the
// window identifier.
win = glutCreateWindow("Yet another teapot");
//////////////
// CALLBACK //
//////////////
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-30.0, 30.0, -30.0, 30.0, -30.0, 30.0);
glRotatef(30.0, 1.0, 0.0, 0.0);
glMatrixMode(GL_MODELVIEW);
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glutDisplayFunc(disp);
glutKeyboardFunc(keyb);
////////////
// OPENGL //
////////////
// define the color we use to clearscreen
glClearColor(0.0,0.0,0.0,0.0);
// enter the main loop
glutMainLoop();
return 0;
}
void disp(void){
// do a clearscreen
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity(); // Reset current matrix (Modelview)
// draw something
//glutWireTeapot(0.5);
// glutSolidTeapot(0.5);
// glutWireSphere(0.5,10,100);
// glutSolidSphere(0.5,100,100);
// glutWireTorus(0.3,0.5,100,100);
// glutSolidTorus(0.3,0.5,100,100);
// glutWireIcosahedron();
// glutSolidIcosahedron();
// glutWireDodecahedron();
// glutSolidDodecahedron();
// glutWireCone(0.5,0.5,100,100);
// glutSolidCone(0.5,0.5,100,100);
// glutWireCube(0.5);
// glutSolidCube(0.5);
double point[3] = {0,1,0};
double color[3] = {0,0,1};
drawVector(point,color);
}
void keyb(unsigned char key, int x, int y){
cout << "Pressed key " << key << " on coordinates (" << x << "," << y << ")";
cout << endl;
if(key == 'q'){
cout << "Got q,so quitting " << endl;
glutDestroyWindow(win);
exit(0);
}
}
void drawVector(double point[3], double color[3]){
glColor3f(color[0],color[1],color[2]);
glLineWidth (1.0);
glBegin (GL_LINES);
glVertex3d (0,0,0);
glVertex3d( point[0],point[1],point[2]);
glEnd();
}
|
ea64ccf259d872cb5b10539e52ceb5c89afa1968
|
6db54cff6d29bbaa597c5c80e0632dac0eb39a26
|
/source/Ashes/Buffer/StagingBuffer.cpp
|
fc36ff8d724264b58f0fa275c7a7e4434e5d392e
|
[
"MIT"
] |
permissive
|
Chaanks/Ashes
|
62fdcb6aaf558b6b80f18c9961c94f05251362df
|
e3d2b42b7b3e9aced385e203bbe6badddb2166ec
|
refs/heads/master
| 2020-05-19T07:10:07.618947
| 2019-05-04T10:57:11
| 2019-05-04T10:57:11
| 184,881,467
| 0
| 0
| null | 2019-05-04T10:33:32
| 2019-05-04T10:33:32
| null |
UTF-8
|
C++
| false
| false
| 21,154
|
cpp
|
StagingBuffer.cpp
|
/*
This file belongs to Ashes.
See LICENSE file in root folder.
*/
#include "Ashes/Buffer/StagingBuffer.hpp"
#include "Ashes/Buffer/Buffer.hpp"
#include "Ashes/Command/CommandBuffer.hpp"
#include "Ashes/Core/Device.hpp"
#include "Ashes/Core/Exception.hpp"
#include "Ashes/Image/Image.hpp"
#include "Ashes/Image/ImageView.hpp"
#include "Ashes/Image/ImageSubresourceLayers.hpp"
#include "Ashes/Image/ImageSubresource.hpp"
#include "Ashes/Image/SubresourceLayout.hpp"
#include "Ashes/Sync/BufferMemoryBarrier.hpp"
#include "Ashes/Sync/ImageMemoryBarrier.hpp"
namespace ashes
{
namespace
{
uint32_t deduceMemoryType( uint32_t typeBits
, ashes::MemoryPropertyFlags requirements
, ashes::PhysicalDeviceMemoryProperties const & memoryProperties )
{
uint32_t result = 0xFFFFFFFFu;
bool found{ false };
// Recherche parmi les types de m�moire la premi�re ayant les propri�t�s voulues.
uint32_t i{ 0 };
while ( i < memoryProperties.memoryTypes.size() && !found )
{
if ( ( typeBits & 1 ) == 1 )
{
// Le type de m�moire est disponible, a-t-il les propri�t�s demand�es?
if ( ( memoryProperties.memoryTypes[i].propertyFlags & requirements ) == requirements )
{
result = i;
found = true;
}
}
typeBits >>= 1;
++i;
}
if ( !found )
{
throw ashes::Exception{ ashes::Result::eErrorRenderer, "Could not deduce memory type" };
}
return result;
}
template< typename T, typename U >
T getAligned( T value, U align )
{
return T( ( value + align - 1 ) & ~( align - 1 ) );
};
template< typename T >
T getSubresourceValue( T value, uint32_t mipLevel )
{
return T( value >> mipLevel );
};
ashes::MemoryAllocateInfo getAllocateInfo( Device const & device
, BufferBase const & buffer )
{
auto requirements = buffer.getMemoryRequirements();
auto deduced = deduceMemoryType( requirements.memoryTypeBits
, ashes::MemoryPropertyFlag::eHostVisible
, device.getMemoryProperties() );
return { requirements.size, deduced };
}
ashes::Extent3D getTexelBlockExtent( ashes::Format format )
{
ashes::Extent3D texelBlockExtent{ 1u, 1u, 1u };
if ( ashes::isCompressedFormat( format ) )
{
auto extent = ashes::getMinimalExtent2D( format );
texelBlockExtent.width = extent.width;
texelBlockExtent.height = extent.height;
}
else
{
texelBlockExtent.width = 1u;
}
return texelBlockExtent;
}
uint32_t getTexelBlockByteSize( Extent3D const & texelBlockExtent
, Format format )
{
uint32_t texelBlockSize;
if ( !isDepthStencilFormat( format ) )
{
texelBlockSize = getSize( texelBlockExtent, format );
}
else
{
texelBlockSize = texelBlockExtent.width;
}
return texelBlockSize;
}
ashes::BufferImageCopy makeValidCopyInfo( Device const & device
, Image const & image
, Extent2D const & size
, Offset3D offset
, ImageSubresourceLayers const & subresourceLayers )
{
auto format = image.getFormat();
auto type = image.getType();
auto texelBlockExtent = getTexelBlockExtent( format );
uint32_t texelBlockSize = getTexelBlockByteSize( texelBlockExtent, format );
ImageSubresource subresource
{
subresourceLayers.aspectMask,
subresourceLayers.mipLevel,
subresourceLayers.baseArrayLayer,
};
SubresourceLayout layout;
if ( image.getTiling() == ashes::ImageTiling::eLinear )
{
device.getImageSubresourceLayout( image
, subresource
, layout );
}
else
{
auto mipWidth = getSubresourceValue( image.getDimensions().width, subresource.mipLevel );
auto mipHeight = getSubresourceValue( image.getDimensions().height, subresource.mipLevel );
layout.rowPitch = texelBlockSize * mipWidth / ( texelBlockExtent.width * texelBlockExtent.height * texelBlockExtent.depth );
layout.arrayPitch = layout.rowPitch * mipHeight * texelBlockExtent.height / ( texelBlockExtent.width * texelBlockExtent.depth );
layout.depthPitch = layout.arrayPitch;
layout.offset = subresource.arrayLayer * layout.arrayPitch * texelBlockSize;
layout.size = layout.arrayPitch * image.getDimensions().depth;
}
ImageSubresourceLayers layers
{
subresourceLayers.aspectMask,
subresourceLayers.mipLevel,
subresourceLayers.baseArrayLayer,
subresourceLayers.layerCount
};
layers.baseArrayLayer = type == ashes::ImageType::e3D
? 0
: layers.baseArrayLayer;
layers.layerCount = type == ashes::ImageType::e3D
? 1u
: layers.layerCount;
ashes::Extent3D imageExtent
{
size.width,
size.height,
1u,
};
imageExtent.width = getAligned( imageExtent.width, texelBlockExtent.width );
imageExtent.height = getAligned( imageExtent.height, texelBlockExtent.height );
imageExtent.depth = getAligned( imageExtent.depth, texelBlockExtent.depth );
imageExtent.height = type == ashes::ImageType::e1D
? 1u
: imageExtent.height;
imageExtent.depth = ( type == ashes::ImageType::e1D || type == ashes::ImageType::e2D )
? 1u
: imageExtent.depth;
ashes::Extent3D subresourceExtent
{
getSubresourceValue( image.getDimensions().width, subresourceLayers.mipLevel ),
getSubresourceValue( image.getDimensions().height, subresourceLayers.mipLevel ),
image.getDimensions().depth,
};
subresourceExtent.width = getAligned( subresourceExtent.width, texelBlockExtent.width );
subresourceExtent.height = getAligned( subresourceExtent.height, texelBlockExtent.height );
subresourceExtent.depth = getAligned( subresourceExtent.depth, texelBlockExtent.depth );
subresourceExtent.height = type == ashes::ImageType::e1D
? 1u
: subresourceExtent.height;
subresourceExtent.depth = ( type == ashes::ImageType::e1D || type == ashes::ImageType::e2D )
? 1u
: subresourceExtent.depth;
ashes::Offset3D imageOffset
{
std::min( int32_t( subresourceExtent.width - imageExtent.width ), std::max( 0, offset.x ) ),
std::min( int32_t( subresourceExtent.height - imageExtent.height ), std::max( 0, offset.y ) ),
std::min( int32_t( subresourceExtent.depth - imageExtent.depth ), std::max( 0, offset.z ) ),
};
offset.y = type == ashes::ImageType::e1D
? 0
: offset.y;
offset.z = ( type == ashes::ImageType::e1D || type == ashes::ImageType::e2D )
? 0
: offset.z;
auto bufferOffset = 0u;
auto bufferRowLength = imageExtent.width;
auto bufferImageHeight = imageExtent.height;
return ashes::BufferImageCopy
{
bufferOffset,
bufferRowLength,
bufferImageHeight,
layers,
imageOffset,
imageExtent,
0u,
};
}
ashes::BufferImageCopyArray makeValidCopyInfos( Device const & device
, ImageView const & view
, ImageSubresourceLayers subresourceLayers
, Extent2D const & size
, Offset3D const & offset )
{
ashes::BufferImageCopyArray copyInfos;
copyInfos.push_back( makeValidCopyInfo( device
, view.getImage()
, size
, offset
, subresourceLayers ) );
return copyInfos;
}
uint32_t getLevelSize( Extent2D extent
, uint32_t level
, Extent3D texelBlockExtent
, uint32_t texelBlockSize )
{
extent.width >>= level;
extent.height >>= level;
return ( texelBlockSize
* extent.width
* extent.height ) / ( texelBlockExtent.width * texelBlockExtent.height );
}
uint32_t getLevelSize( Extent2D const & extent
, Format format
, uint32_t level )
{
auto texelBlockExtent = getTexelBlockExtent( format );
return getLevelSize( extent
, level
, texelBlockExtent
, getTexelBlockByteSize( texelBlockExtent, format ) );
}
uint32_t getAllLevelsSize( Extent2D const & extent
, ashes::Format format
, uint32_t baseMipLevel
, uint32_t levelCount )
{
auto texelBlockExtent = getTexelBlockExtent( format );
auto texelBlockSize = getTexelBlockByteSize( texelBlockExtent, format );
uint32_t result = 0u;
for ( uint32_t level = baseMipLevel; level < baseMipLevel + levelCount; ++level )
{
result += getLevelSize( extent
, level
, texelBlockExtent
, texelBlockSize );
}
return result;
}
}
StagingBuffer::StagingBuffer( Device const & device
, BufferTargets target
, uint32_t size )
: m_device{ device }
, m_buffer{ device.createBuffer( size
, target | BufferTarget::eTransferSrc | BufferTarget::eTransferDst ) }
, m_storage{ device.allocateMemory( getAllocateInfo( device, *m_buffer ) ) }
{
m_buffer->bindMemory( m_storage );
}
void StagingBuffer::uploadTextureData( Queue const & queue
, CommandPool const & commandPool
, ImageSubresourceLayers const & subresourceLayers
, Format format
, Offset3D const & offset
, Extent2D const & extent
, uint8_t const * const data
, ImageView const & view
, PipelineStageFlags dstStageFlags )const
{
auto commandBuffer = commandPool.createCommandBuffer( true );
commandBuffer->begin( CommandBufferUsageFlag::eOneTimeSubmit );
uploadTextureData( *commandBuffer
, subresourceLayers
, format
, offset
, extent
, data
, view );
commandBuffer->end();
auto fence = m_device.createFence();
queue.submit( *commandBuffer
, fence.get() );
fence->wait( FenceTimeout );
}
void StagingBuffer::uploadTextureData( Queue const & queue
, CommandPool const & commandPool
, Format format
, uint8_t const * const data
, ImageView const & view
, PipelineStageFlags dstStageFlags )const
{
auto commandBuffer = commandPool.createCommandBuffer( true );
commandBuffer->begin( CommandBufferUsageFlag::eOneTimeSubmit );
uploadTextureData( *commandBuffer
, format
, data
, view );
commandBuffer->end();
auto fence = m_device.createFence();
queue.submit( *commandBuffer
, fence.get() );
fence->wait( FenceTimeout );
}
void StagingBuffer::uploadTextureData( CommandBuffer const & commandBuffer
, ImageSubresourceLayers const & subresourceLayers
, Format format
, Offset3D const & offset
, Extent2D const & extent
, uint8_t const * const data
, ImageView const & view
, PipelineStageFlags dstStageFlags )const
{
auto range = view.getSubResourceRange();
auto layerSize = getAllLevelsSize( extent
, format
, range.baseMipLevel
, range.levelCount );
doCopyToStagingBuffer( data
, layerSize );
doCopyFromStagingBuffer( commandBuffer
, extent
, offset
, view
, dstStageFlags
, subresourceLayers );
}
void StagingBuffer::uploadTextureData( CommandBuffer const & commandBuffer
, Format format
, uint8_t const * const data
, ImageView const & view
, PipelineStageFlags dstStageFlags )const
{
auto extent = Extent3D{ view.getImage().getDimensions() };
auto mipLevel = view.getSubResourceRange().baseMipLevel;
extent.width = std::max( 1u, extent.width >> mipLevel );
extent.height = std::max( 1u, extent.height >> mipLevel );
uploadTextureData( commandBuffer
, {
getAspectMask( view.getFormat() ),
mipLevel,
view.getSubResourceRange().baseArrayLayer,
view.getSubResourceRange().layerCount
}
, format
, Offset3D{}
, { extent.width, extent.height }
, data
, view
, dstStageFlags );
}
void StagingBuffer::downloadTextureData( Queue const & queue
, CommandPool const & commandPool
, ImageSubresourceLayers const & subresourceLayers
, Format format
, Offset3D const & offset
, Extent2D const & extent
, uint8_t * data
, ImageView const & view
, PipelineStageFlags dstStageFlags )const
{
auto commandBuffer = commandPool.createCommandBuffer( true );
auto mipLevel = view.getSubResourceRange().baseMipLevel;
commandBuffer->begin( CommandBufferUsageFlag::eOneTimeSubmit );
commandBuffer->memoryBarrier( ashes::PipelineStageFlag::eTopOfPipe
, ashes::PipelineStageFlag::eTransfer
, view.makeTransferSource( ashes::ImageLayout::eUndefined
, 0u ) );
doCopyToStagingBuffer( *commandBuffer
, extent
, offset
, view
, dstStageFlags
, {
getAspectMask( view.getFormat() ),
mipLevel,
view.getSubResourceRange().baseArrayLayer,
view.getSubResourceRange().layerCount
} );
commandBuffer->memoryBarrier( ashes::PipelineStageFlag::eTransfer
, ashes::PipelineStageFlag::eFragmentShader
, view.makeShaderInputResource( ashes::ImageLayout::eTransferSrcOptimal
, ashes::AccessFlag::eTransferRead ) );
commandBuffer->end();
auto fence = m_device.createFence();
queue.submit( *commandBuffer
, fence.get() );
fence->wait( ashes::FenceTimeout );
auto range = view.getSubResourceRange();
doCopyFromStagingBuffer( data
, getAllLevelsSize( extent
, format
, range.baseMipLevel
, range.levelCount ) );
}
void StagingBuffer::downloadTextureData( Queue const & queue
, CommandPool const & commandPool
, Format format
, uint8_t * data
, ImageView const & view
, PipelineStageFlags dstStageFlags )const
{
auto extent = view.getImage().getDimensions();
auto mipLevel = view.getSubResourceRange().baseMipLevel;
extent.width = std::max( 1u, extent.width >> mipLevel );
extent.height = std::max( 1u, extent.height >> mipLevel );
downloadTextureData( queue
, commandPool
, {
getAspectMask( view.getFormat() ),
mipLevel,
view.getSubResourceRange().baseArrayLayer,
view.getSubResourceRange().layerCount
}
, format
, Offset3D{}
, { extent.width, extent.height }
, data
, view
, dstStageFlags );
}
void StagingBuffer::doCopyFromStagingBuffer( uint8_t * data
, uint32_t size )const
{
assert( size <= getBuffer().getSize() );
auto mappedSize = getAlignedSize( size
, uint32_t( m_device.getProperties().limits.nonCoherentAtomSize ) );
mappedSize = mappedSize > getBuffer().getSize()
? ~( 0ull )
: mappedSize;
auto buffer = static_cast< BufferBase const & >( getBuffer() ).lock( 0u
, mappedSize
, MemoryMapFlag::eRead );
if ( !buffer )
{
throw Exception{ Result::eErrorMemoryMapFailed, "Staging buffer storage memory mapping failed." };
}
std::memcpy( data
, buffer
, size );
getBuffer().flush( 0u, mappedSize );
getBuffer().unlock();
m_device.waitIdle();
}
void StagingBuffer::doCopyFromStagingBuffer( CommandBuffer const & commandBuffer
, uint32_t size
, uint32_t offset
, BufferBase const & buffer )const
{
assert( size <= getBuffer().getSize() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, getBuffer().makeTransferSource() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, buffer.makeTransferDestination() );
commandBuffer.copyBuffer( getBuffer()
, buffer
, size
, offset );
}
void StagingBuffer::doCopyFromStagingBuffer( CommandBuffer const & commandBuffer
, uint32_t size
, uint32_t offset
, VertexBufferBase const & buffer )const
{
assert( size <= getBuffer().getSize() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, getBuffer().makeTransferSource() );
auto srcStageFlags = buffer.getBuffer().getCompatibleStageFlags();
commandBuffer.memoryBarrier( srcStageFlags
, PipelineStageFlag::eTransfer
, buffer.getBuffer().makeTransferDestination() );
commandBuffer.copyBuffer( getBuffer()
, buffer.getBuffer()
, size
, offset );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, ashes::PipelineStageFlag::eVertexInput
, buffer.getBuffer().makeVertexShaderInputResource() );
}
void StagingBuffer::doCopyFromStagingBuffer( CommandBuffer const & commandBuffer
, uint32_t size
, uint32_t offset
, UniformBufferBase const & buffer
, PipelineStageFlags dstStageFlags )const
{
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, getBuffer().makeTransferSource() );
auto srcStageFlags = buffer.getBuffer().getCompatibleStageFlags();
commandBuffer.memoryBarrier( srcStageFlags
, PipelineStageFlag::eTransfer
, buffer.getBuffer().makeTransferDestination() );
commandBuffer.copyBuffer( getBuffer()
, buffer.getBuffer()
, size
, offset );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, dstStageFlags
, buffer.getBuffer().makeUniformBufferInput() );
}
void StagingBuffer::doCopyFromStagingBuffer( CommandBuffer const & commandBuffer
, Extent2D const & size
, Offset3D const & offset
, ImageView const & view
, PipelineStageFlags dstStageFlags
, ImageSubresourceLayers const & subresourceLayers )const
{
auto realSize = getAllLevelsSize( size
, view.getFormat()
, view.getSubResourceRange().baseMipLevel
, view.getSubResourceRange().levelCount );
assert( realSize <= getBuffer().getSize() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, getBuffer().makeTransferSource() );
commandBuffer.memoryBarrier( PipelineStageFlag::eBottomOfPipe
, PipelineStageFlag::eTransfer
, view.makeTransferDestination( ashes::ImageLayout::eUndefined, 0u ) );
commandBuffer.copyToImage( makeValidCopyInfos( m_device, view, subresourceLayers, size, offset )
, getBuffer()
, view.getImage() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, dstStageFlags
, view.makeShaderInputResource( ashes::ImageLayout::eTransferDstOptimal
, ashes::AccessFlag::eTransferWrite ) );
}
void StagingBuffer::doCopyToStagingBuffer( uint8_t const * data
, uint32_t size )const
{
assert( size <= getBuffer().getSize() );
auto mappedSize = getAlignedSize( size
, uint32_t( m_device.getProperties().limits.nonCoherentAtomSize ) );
mappedSize = mappedSize > getBuffer().getSize()
? ~( 0ull )
: mappedSize;
auto buffer = static_cast< BufferBase const & >( getBuffer() ).lock( 0u
, mappedSize
, MemoryMapFlag::eWrite | MemoryMapFlag::eInvalidateRange );
if ( !buffer )
{
throw Exception{ Result::eErrorMemoryMapFailed, "Staging buffer storage memory mapping" };
}
std::memcpy( buffer
, data
, size );
getBuffer().flush( 0u, mappedSize );
getBuffer().unlock();
m_device.waitIdle();
}
void StagingBuffer::doCopyToStagingBuffer( CommandBuffer const & commandBuffer
, uint32_t size
, uint32_t offset
, BufferBase const & buffer )const
{
assert( size <= getBuffer().getSize() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, buffer.makeTransferSource() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, getBuffer().makeTransferDestination() );
commandBuffer.copyBuffer( buffer
, getBuffer()
, size
, offset );
}
void StagingBuffer::doCopyToStagingBuffer( CommandBuffer const & commandBuffer
, uint32_t size
, uint32_t offset
, VertexBufferBase const & buffer )const
{
assert( size <= getBuffer().getSize() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, buffer.getBuffer().makeTransferSource() );
auto srcStageFlags = buffer.getBuffer().getCompatibleStageFlags();
commandBuffer.memoryBarrier( srcStageFlags
, PipelineStageFlag::eTransfer
, getBuffer().makeTransferDestination() );
commandBuffer.copyBuffer( buffer.getBuffer()
, getBuffer()
, size
, offset );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, ashes::PipelineStageFlag::eVertexInput
, buffer.getBuffer().makeVertexShaderInputResource() );
}
void StagingBuffer::doCopyToStagingBuffer( CommandBuffer const & commandBuffer
, uint32_t size
, uint32_t offset
, UniformBufferBase const & buffer
, PipelineStageFlags dstStageFlags )const
{
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, PipelineStageFlag::eTransfer
, buffer.getBuffer().makeTransferSource() );
auto srcStageFlags = buffer.getBuffer().getCompatibleStageFlags();
commandBuffer.memoryBarrier( srcStageFlags
, PipelineStageFlag::eTransfer
, getBuffer().makeTransferDestination() );
commandBuffer.copyBuffer( buffer.getBuffer()
, getBuffer()
, size
, offset );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, dstStageFlags
, buffer.getBuffer().makeUniformBufferInput() );
}
void StagingBuffer::doCopyToStagingBuffer( CommandBuffer const & commandBuffer
, Extent2D const & size
, Offset3D const & offset
, ImageView const & view
, PipelineStageFlags dstStageFlags
, ImageSubresourceLayers const & subresourceLayers )const
{
commandBuffer.memoryBarrier( PipelineStageFlag::eBottomOfPipe
, PipelineStageFlag::eTransfer
, view.makeTransferSource( ashes::ImageLayout::eUndefined, 0u ) );
commandBuffer.memoryBarrier( PipelineStageFlag::eBottomOfPipe
, PipelineStageFlag::eTransfer
, getBuffer().makeTransferDestination() );
commandBuffer.copyToBuffer( makeValidCopyInfos( m_device, view, subresourceLayers, size, offset )
, view.getImage()
, getBuffer() );
commandBuffer.memoryBarrier( PipelineStageFlag::eTransfer
, dstStageFlags
, view.makeShaderInputResource( ashes::ImageLayout::eTransferDstOptimal
, ashes::AccessFlag::eTransferWrite ) );
}
}
|
62fc8a559abfbbb1e027c00791e42bb3abe9eb76
|
8480798c94a29a3c12716bc898bc9da91d8fd76a
|
/Week_11/Screen_saver.hpp
|
25adfaa803f5293b0fe8a74728cca741765b2723
|
[] |
no_license
|
Azurifle/fantasyworld
|
d623e908d66f69b75573f59d6026482315be4e35
|
358a48c20e1bd4e01446f09122627cd28a5981f1
|
refs/heads/master
| 2020-03-15T16:09:39.131840
| 2018-07-15T18:49:32
| 2018-07-15T18:49:32
| 132,229,464
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 898
|
hpp
|
Screen_saver.hpp
|
#ifndef G6037599_SCREEN_SAVER_HPP
#define G6037599_SCREEN_SAVER_HPP
#pragma once
#include "Delta_time.hpp"
namespace G6037599
{
class Star;
class Screen_saver final
{
public:
static void run();
private:
static Screen_saver m_instance_;
static GLFWwindow* glfw_window();
static void key_callback(GLFWwindow* t_window, int t_key, int t_scan_code, int t_action, int t_mods);
static void render_background();
Delta_time m_delta_time_;
std::vector<Star> m_stars_{};
Screen_saver();
~Screen_saver() = default;
Screen_saver(const Screen_saver& t_to_copy) = default;
Screen_saver(Screen_saver&& t_to_move) noexcept = default;
Screen_saver& operator = (const Screen_saver& t_to_copy) = default;
Screen_saver& operator = (Screen_saver&& t_to_move) noexcept = default;
void update();
};
}//G6037599
#endif //G6037599_SCREEN_SAVER_HPP
|
35eab362ef40e200cf038f6d5e01aa1dd2527a69
|
c04f7b920d7e889af9844be494af1cb0b1daaad9
|
/library/include/darcel/reactors/builtin_translator.hpp
|
dbc96f1acd05b82c2a1aca40d9f199533ce0d516
|
[
"MIT"
] |
permissive
|
lineCode/darcel
|
0ce492489ea2b916fbbd0c2adbc9012327066325
|
a9c32989ad9c1571edaa41c7c3a86b276b782c0d
|
refs/heads/master
| 2021-10-11T12:57:32.827574
| 2019-01-25T21:42:34
| 2019-01-25T21:42:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 13,589
|
hpp
|
builtin_translator.hpp
|
#ifndef DARCEL_BUILTIN_TRANSLATOR_HPP
#define DARCEL_BUILTIN_TRANSLATOR_HPP
#include <iostream>
#include "darcel/reactors/chain_reactor.hpp"
#include "darcel/reactors/count_reactor.hpp"
#include "darcel/reactors/enum_to_string_reactor.hpp"
#include "darcel/reactors/first_reactor.hpp"
#include "darcel/reactors/fold_reactor.hpp"
#include "darcel/reactors/last_reactor.hpp"
#include "darcel/reactors/ostream_reactor.hpp"
#include "darcel/reactors/reactor_translator.hpp"
#include "darcel/reactors/tally_reactor.hpp"
#include "darcel/semantics/scope.hpp"
namespace darcel {
//! Adds definitions for the builtin add functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_add(ReactorTranslator& translator, const Scope& s) {
auto f = s.find<Function>("add");
if(f != nullptr) {
for(auto& overload : s.get_definitions(*f)) {
auto signature = std::static_pointer_cast<FunctionDataType>(
overload->get_type());
if(signature->get_parameters().size() == 2) {
if(*signature->get_parameters()[0].m_type == IntegerDataType() &&
*signature->get_parameters()[1].m_type == IntegerDataType()) {
translator.add(overload, make_add_reactor_builder<int, int>());
} else if(
*signature->get_parameters()[0].m_type == FloatDataType() &&
*signature->get_parameters()[1].m_type == FloatDataType()) {
translator.add(overload,
make_add_reactor_builder<double, double>());
} else if(
*signature->get_parameters()[0].m_type == TextDataType() &&
*signature->get_parameters()[1].m_type == TextDataType()) {
translator.add(overload,
make_add_reactor_builder<std::string, std::string>());
}
}
}
}
}
//! Adds definitions for the builtin chain functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_chain(ReactorTranslator& translator, const Scope& s) {
struct Builder {
std::unique_ptr<ReactorBuilder> operator ()(
const std::shared_ptr<FunctionDataType>& t) const {
if(*t->get_parameters()[0].m_type == BoolDataType()) {
return make_chain_reactor_builder<bool>();
} else if(*t->get_parameters()[0].m_type == FloatDataType()) {
return make_chain_reactor_builder<double>();
} else if(*t->get_parameters()[0].m_type == IntegerDataType()) {
return make_chain_reactor_builder<int>();
} else if(*t->get_parameters()[0].m_type == TextDataType()) {
return make_chain_reactor_builder<std::string>();
} else if(auto e = std::dynamic_pointer_cast<EnumDataType>(
t->get_parameters()[0].m_type)) {
return make_chain_reactor_builder<int>();
}
// TODO: Chain generic values
return nullptr;
}
};
auto f = s.find<Function>("chain");
if(f != nullptr) {
translator.add(s.get_definitions(*f).front(), Builder());
}
}
//! Adds definitions for the builtin count function.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_count(ReactorTranslator& translator, const Scope& s) {
auto f = s.find<Function>("count");
translator.add(s.get_definitions(*f).front(), make_count_builder());
}
//! Adds definitions for the builtin divide functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_divide(ReactorTranslator& translator,
const Scope& s) {
auto f = s.find<Function>("divide");
if(f != nullptr) {
for(auto& overload : s.get_definitions(*f)) {
auto signature = std::static_pointer_cast<FunctionDataType>(
overload->get_type());
if(signature->get_parameters().size() == 2) {
if(*signature->get_parameters()[0].m_type == IntegerDataType() &&
*signature->get_parameters()[1].m_type == IntegerDataType()) {
translator.add(overload, make_divide_reactor_builder<int, int>());
} else if(
*signature->get_parameters()[0].m_type == FloatDataType() &&
*signature->get_parameters()[1].m_type == FloatDataType()) {
translator.add(overload,
make_divide_reactor_builder<double, double>());
}
}
}
}
}
//! Adds definitions for the builtin first functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_first(ReactorTranslator& translator, const Scope& s) {
struct Builder {
std::unique_ptr<ReactorBuilder> operator ()(
const std::shared_ptr<FunctionDataType>& t) const {
if(*t->get_parameters()[0].m_type == BoolDataType()) {
return make_first_reactor_builder<bool>();
} else if(*t->get_parameters()[0].m_type == FloatDataType()) {
return make_first_reactor_builder<float>();
} else if(*t->get_parameters()[0].m_type == IntegerDataType()) {
return make_first_reactor_builder<int>();
} else if(*t->get_parameters()[0].m_type == TextDataType()) {
return make_first_reactor_builder<std::string>();
} else if(auto e = std::dynamic_pointer_cast<EnumDataType>(
t->get_parameters()[0].m_type)) {
return make_first_reactor_builder<int>();
}
// TODO: Handle generic values.
return nullptr;
}
};
auto f = s.find<Function>("first");
if(f != nullptr) {
translator.add(s.get_definitions(*f).front(), Builder());
}
}
//! Adds definitions for the builtin fold functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_fold(ReactorTranslator& translator, const Scope& s) {
struct Builder {
std::unique_ptr<ReactorBuilder> operator ()(
const std::shared_ptr<FunctionDataType>& t) const {
if(*t->get_parameters()[1].m_type == BoolDataType()) {
return make_fold_reactor_builder<bool>();
} else if(*t->get_parameters()[1].m_type == FloatDataType()) {
return make_fold_reactor_builder<double>();
} else if(*t->get_parameters()[1].m_type == IntegerDataType()) {
return make_fold_reactor_builder<int>();
} else if(*t->get_parameters()[1].m_type == TextDataType()) {
return make_fold_reactor_builder<std::string>();
} else if(auto e = std::dynamic_pointer_cast<EnumDataType>(
t->get_parameters()[0].m_type)) {
return make_fold_reactor_builder<int>();
}
// TODO: Fold generic values
return nullptr;
}
};
auto f = s.find<Function>("fold");
if(f != nullptr) {
translator.add(s.get_definitions(*f).front(), Builder());
}
}
//! Adds definitions for the builtin last functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_last(ReactorTranslator& translator, const Scope& s) {
struct Builder {
std::unique_ptr<ReactorBuilder> operator ()(
const std::shared_ptr<FunctionDataType>& t) const {
if(*t->get_parameters()[0].m_type == BoolDataType()) {
return make_last_reactor_builder<bool>();
} else if(*t->get_parameters()[0].m_type == FloatDataType()) {
return make_last_reactor_builder<float>();
} else if(*t->get_parameters()[0].m_type == IntegerDataType()) {
return make_last_reactor_builder<int>();
} else if(*t->get_parameters()[0].m_type == TextDataType()) {
return make_last_reactor_builder<std::string>();
} else if(auto e = std::dynamic_pointer_cast<EnumDataType>(
t->get_parameters()[0].m_type)) {
return make_last_reactor_builder<int>();
}
// TODO: Handle generic values.
return nullptr;
}
};
auto f = s.find<Function>("last");
if(f != nullptr) {
translator.add(s.get_definitions(*f).front(), Builder());
}
}
//! Adds definitions for the builtin multiply functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_multiply(ReactorTranslator& translator,
const Scope& s) {
auto f = s.find<Function>("multiply");
if(f != nullptr) {
for(auto& overload : s.get_definitions(*f)) {
auto signature = std::static_pointer_cast<FunctionDataType>(
overload->get_type());
if(signature->get_parameters().size() == 2) {
if(*signature->get_parameters()[0].m_type == IntegerDataType() &&
*signature->get_parameters()[1].m_type == IntegerDataType()) {
translator.add(overload, make_multiply_reactor_builder<int, int>());
} else if(
*signature->get_parameters()[0].m_type == FloatDataType() &&
*signature->get_parameters()[1].m_type == FloatDataType()) {
translator.add(overload,
make_multiply_reactor_builder<double, double>());
}
}
}
}
}
//! Adds definitions for the builtin print functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_print(ReactorTranslator& translator, const Scope& s) {
struct Builder {
std::unique_ptr<ReactorBuilder> operator ()(
const std::shared_ptr<FunctionDataType>& t) const {
if(*t->get_parameters()[0].m_type == BoolDataType()) {
return make_ostream_reactor_builder<bool>(std::cout);
} else if(*t->get_parameters()[0].m_type == FloatDataType()) {
return make_ostream_reactor_builder<double>(std::cout);
} else if(*t->get_parameters()[0].m_type == IntegerDataType()) {
return make_ostream_reactor_builder<int>(std::cout);
} else if(*t->get_parameters()[0].m_type == TextDataType()) {
return make_ostream_reactor_builder<std::string>(std::cout);
} else if(auto e = std::dynamic_pointer_cast<EnumDataType>(
t->get_parameters()[0].m_type)) {
return std::make_unique<FunctionReactorBuilder>(
[=] (auto& parameters, auto& t) {
return make_ostream_reactor(std::cout,
std::static_pointer_cast<Reactor<std::string>>(
make_enum_to_string_reactor(e,
std::static_pointer_cast<Reactor<int>>(
parameters.front()->build(t)))));
});
}
// TODO: Print generic values
return nullptr;
}
};
auto f = s.find<Function>("print");
if(f != nullptr) {
translator.add(s.get_definitions(*f).front(), Builder());
}
}
//! Adds definitions for the builtin subtract functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_subtract(ReactorTranslator& translator,
const Scope& s) {
auto f = s.find<Function>("subtract");
if(f != nullptr) {
for(auto& overload : s.get_definitions(*f)) {
auto signature = std::static_pointer_cast<FunctionDataType>(
overload->get_type());
if(signature->get_parameters().size() == 2) {
if(*signature->get_parameters()[0].m_type == IntegerDataType() &&
*signature->get_parameters()[1].m_type == IntegerDataType()) {
translator.add(overload, make_subtract_reactor_builder<int, int>());
} else if(
*signature->get_parameters()[0].m_type == FloatDataType() &&
*signature->get_parameters()[1].m_type == FloatDataType()) {
translator.add(overload,
make_subtract_reactor_builder<double, double>());
}
}
}
}
}
//! Adds definitions for the builtin tally functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the function in.
*/
inline void translate_tally(ReactorTranslator& translator, const Scope& s) {
struct Builder {
std::unique_ptr<ReactorBuilder> operator ()(
const std::shared_ptr<FunctionDataType>& t) const {
return make_tally_reactor_builder();
}
};
auto f = s.find<Function>("tally");
if(f != nullptr) {
translator.add(s.get_definitions(*f).front(), Builder());
}
}
//! Adds definitions for all the builtin functions.
/*!
\param translator The translator to add the definitions to.
\param s The scope to find the functions in.
*/
inline void translate_builtins(ReactorTranslator& translator,
const Scope& s) {
translate_add(translator, s);
translate_chain(translator, s);
translate_count(translator, s);
translate_divide(translator, s);
translate_first(translator, s);
translate_fold(translator, s);
translate_last(translator, s);
translate_multiply(translator, s);
translate_print(translator, s);
translate_subtract(translator, s);
translate_tally(translator, s);
}
}
#endif
|
77fc0de108344afe3e0934b48fa0e64112a69075
|
229f25ccda6d721f31c6d4de27a7bb85dcc0f929
|
/solutions/codeforce/Codeforces Round #685 (Div. 2)/D. Circle Game/solution.cpp
|
9c519d4804ecf59a9e89bfc716489ba4c2604689
|
[] |
no_license
|
camil0palacios/Competitive-programming
|
e743378a8791a66c90ffaae29b4fd4cfb58fff59
|
4211fa61e516cb986b3404d87409ad1a49f78132
|
refs/heads/master
| 2022-11-01T20:35:21.541132
| 2022-10-27T03:13:42
| 2022-10-27T03:13:42
| 155,419,333
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 967
|
cpp
|
solution.cpp
|
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define fori(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define fore(i,a,b) for(int i = a; i <= b; i++)
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int t;
cin >> t;
while(t--) {
ll d, k;
cin >> d >> k;
ll x = 0, y = 0;
bool cur = 0, ok = 1;
while(ok) {
ok = 0;
if((x + k)*(x + k) + y*y <= d*d && cur) x += k, ok = 1;
if(x*x + (y + k)*(y + k) <= d*d && !cur) y += k, ok = 1;
if(ok) cur ^= 1;
}
if(cur) cout << "Ashish" << endl;
else cout << "Utkarsh" << endl;
}
return 0;
}
|
4418787b246b69da4eb26e6474ec39f1bd121511
|
e97df22359edd6a59d24469663ee22529fe0abad
|
/11074.cpp
|
e97016cf9c93d2753535a3a9220b470f15751f19
|
[] |
no_license
|
rofi93/UVA
|
826d8c07a5410638b8843b66176bc1c6a389c129
|
08f418b11410f142590322451904f260d606e3f7
|
refs/heads/master
| 2020-12-10T13:07:50.131831
| 2018-09-23T18:53:38
| 2018-09-23T18:53:38
| 64,331,702
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,671
|
cpp
|
11074.cpp
|
/* -------------------------------- */
/* Name: MD. Khairul Basar */
/* Institute: HSTU */
/* Dept: CSE */
/* Email: khairul.basar93@gmail.com */
/* -------------------------------- */
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<vector>
#include<sstream>
#include<utility>
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
/* all header files included */
#define LL long long
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int>
#define nl printf("\n")
/* defining macros */
using namespace std;
int main()
{
int s,t,n,i,j,k,star,l,tc=1;
while(cin>>s>>t>>n)
{
if(s==0 && t==0 && n==0)
break;
printf("Case %d:\n",tc++);
star=(s*n)+(t*(n+1));
for(k=1; k<=n; k++)
{
for(i=1; i<=t; i++)
{
for(j=1; j<=star; j++)
printf("*");
nl;
}
for(i=1; i<=s; i++)
{
for(l=1; l<=n; l++)
{
for(j=1; j<=t; j++)
printf("*");
for(j=1; j<=s; j++)
printf(".");
}
for(j=1; j<=t; j++)
printf("*");
nl;
}
}
for(i=1; i<=t; i++)
{
for(j=1; j<=star; j++)
printf("*");
nl;
}
nl;
}
return 0;
}
|
57af6be217da7af9f4ab4c47e578f9d87a9d721d
|
8b3be4eb51afe179d7278671e5f49b282c71ce09
|
/ProyectoFinal/OperadorLogaritmo.h
|
fbb282af63ddcd56dc3d0e7ddb1a47a196fe7b61
|
[] |
no_license
|
fugar09/PFinal
|
b1a119c871d3b57a0566b0f62758626548d2ec55
|
cd6e79664a77f071990c0a0d5e2ba263accf3538
|
refs/heads/master
| 2016-09-06T17:47:12.711549
| 2015-07-14T00:47:48
| 2015-07-14T00:47:48
| 38,515,274
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 227
|
h
|
OperadorLogaritmo.h
|
#pragma once
#include "OperadorUnario.h"
class OperadorLogaritmo :
public OperadorUnario
{
public:
OperadorLogaritmo();
Operando * operar(DoublyLinkedList<Operando*> l);
char getSymbol();
virtual ~OperadorLogaritmo();
};
|
6743bc21952f6cc995e45fb480780fb55d7215d7
|
21c65874d72e31a9c4120aaf166695ffabdce018
|
/Phong Illumination/src/model.h
|
a1bf1a0e80be72c7aae4f4bac0a59726ca5cf80b
|
[] |
no_license
|
rockyvon/opengl
|
240c8844f480d0be4166fd89769ac67a523ed94b
|
700e305774a705b8832da156cf6a39a91aeb36fb
|
refs/heads/master
| 2020-04-09T02:30:11.313207
| 2018-12-20T13:04:31
| 2018-12-20T13:04:31
| 159,943,345
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 898
|
h
|
model.h
|
#pragma once
#include "opengl.h"
#include "mesh.h"
#include "config.h"
#include <map>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
using namespace Assimp;
class ModelLoader
{
public:
ModelLoader();
~ModelLoader();
virtual void loadScene(string path) = 0;
void draw(ShaderManager* shader);
protected:
GLboolean hasNormal = true;
vector<Mesh> meshes;
private:
};
class AssimpModel :public ModelLoader {
public:
virtual void loadScene(string path);
private:
GLuint * textureIds;
string modelPath;
map<string, GLuint*> textureMap;
string getBasePath(string path);
void processAllTextures(const aiScene* scene, bool gamma = false);
Material processMaterial(aiMaterial* aimaterial);
void processNode(const aiNode* node, const aiScene* scene);
void arrayToVec4(vec4 &v, float *array);
void aiColor4ToVec4(vec4 &v, aiColor4D &aicolor);
};
|
1fe88f30153a3628e6e6083d636930b3b5b62777
|
46258ffa27f761a69d29e4cd33fa01f609f87e12
|
/C++/MemoryManagementSimulator/src/simulation/simulation.cpp
|
934fe00903ee6a2f4885133ac69b5f9e6190273b
|
[] |
no_license
|
dkern27/CollegeProgramming
|
eb5ffb9bfbf0a7a158eb63659cc47a3e22513542
|
83916177c17229c607eae53fd79fa2523c657009
|
refs/heads/master
| 2021-01-22T11:24:46.943672
| 2017-06-28T21:47:19
| 2017-06-28T21:47:19
| 91,986,722
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,682
|
cpp
|
simulation.cpp
|
/**
* This file contains implementations for the methods defined in the Simulation
* class.
*
* You'll probably spend a lot of your time here.
*/
#include "simulation/simulation.h"
#include "process/process.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
using namespace std;
void Simulation::run(FlagOptions flags) {
Process::MAX_FRAMES = flags.max_frames;
strategy = flags.strategy;
verbose = flags.verbose;
readFile(flags.filename);
for(VirtualAddress va : virtualAddresses)
{
perform_memory_access(va);
this->time++;
}
standardOutput();
}
void Simulation::perform_memory_access(const VirtualAddress& va) {
Process* p = processes.at(va.process_id);
p->memory_accesses++;
int index = -1;
bool inMemory = true;
if((index = alreadyLoaded(va)) == -1)
{
inMemory = false;
index = handle_page_fault(p, va.page);
}
PhysicalAddress pa(index, va.offset);
p->page_table.rows[va.page].last_accessed_at = time;
if(verbose)
verboseOutput(va, inMemory, pa, p->get_rss());
}
int Simulation::handle_page_fault(Process* process, size_t page) {
if(process->is_valid_page(page))
{
process->page_faults++;
int index = frames.size();
bool full = false;
if (process->get_rss() >= Process::MAX_FRAMES)
{
full = true;
int i = 0;
if(strategy == ReplacementStrategy::FIFO)
i = process->page_table.get_oldest_page();
else if (strategy == ReplacementStrategy::LRU)
i = process->page_table.get_least_recently_used_page();
if(i < 0) {
cerr << "Segmentation Fault. Exiting..." << endl;
exit(1);
}
index = process->page_table.rows[i].frame;
process->page_table.rows[i].present = false;
}
Frame f;
f.set_page(process, page);
if(index >= frames.size())
{
frames.push_back(f);
}
else
frames[index] = f;
process->page_table.rows[page].present = true;
process->page_table.rows[page].frame = index;
process->page_table.rows[page].loaded_at = time;
return index;
}
else
{
cerr << "Invalid page. Exiting..." << endl;
exit(1);
}
}
void Simulation::readFile(string fileName)
{
ifstream file(fileName, ifstream::in);
int numProcesses;
file >> numProcesses;
for (int i = 0; i < numProcesses; i++)
{
int pid;
string processImageFile;
file >> pid >> processImageFile;
ifstream stream(processImageFile, ifstream::in);
Process* p = Process::read_from_input(stream);
processes.emplace(pid, p);
}
int pid;
while (file >> pid)
{
string virtualAddress;
file >> virtualAddress;
VirtualAddress va = VirtualAddress::from_string(pid, virtualAddress);
virtualAddresses.push_back(va);
}
}
void Simulation::standardOutput()
{
int memAcc = 0;
int pageFaults = 0;
int freeFrames = NUM_FRAMES;
cout << endl;
for (map<int, Process*>::iterator it = processes.begin(); it != processes.end(); it++)
{
string output = "Process " + to_string(it->first);
output += " ACCESSES: " + to_string(it->second->memory_accesses);
output += " FAULTS: " + to_string(it->second->page_faults);
stringstream stream;
stream << fixed << setprecision(2) << it->second->get_fault_percent();
output += " FAULT RATE: " + stream.str();
output += " RSS: " + to_string(it->second->get_rss());
cout << output << endl;
memAcc += it->second->memory_accesses;
pageFaults += it->second->page_faults;
freeFrames -= it->second->get_rss();
}
cout << endl;
cout << "Total memory accesses: " << to_string(memAcc) << endl;
cout << "Total page faults: " << to_string(pageFaults) << endl;
cout << "Free frames remaining: " << freeFrames << endl;
}
void Simulation::verboseOutput(VirtualAddress va, bool inMemory, PhysicalAddress pa, int rss)
{
cout << va << endl;
if(inMemory)
cout << "\tIN MEMORY" << endl;
else
cout << "\tPAGE FAULT" << endl;
cout << "\t" << pa << endl;
cout << "\tRSS: " << rss << endl;
}
int Simulation::alreadyLoaded(VirtualAddress va)
{
Process* p = processes.at(va.process_id);
int i = 0;
for (Frame f : frames)
{
if(f.process == p && f.page_number == va.page)
return i;
i++;
}
return -1;
}
|
4d223ea4230e6e0f51c99e63a7e305f05a2615a3
|
c90a56e7d7752b041fc5eb38257c5573cef346c6
|
/src-linux/Draft.cpp
|
54d12ecfe9bfc7b61aa15d68f5dc3f3141585cd9
|
[] |
no_license
|
random-builder/design_cadquery_ocp
|
a4c572a72699bad52ca5f43f30bb7c15d89072ff
|
2af799a9f1b2d81fd39e519b2f73e12b34a14c0a
|
refs/heads/master
| 2021-05-21T23:10:23.833461
| 2020-03-29T15:34:46
| 2020-03-29T15:34:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 21,990
|
cpp
|
Draft.cpp
|
// std lib related includes
#include <tuple>
// pybind 11 related includes
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace py = pybind11;
// Standard Handle
#include <Standard_Handle.hxx>
// includes to resolve forward declarations
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Standard_NoMoreObject.hxx>
#include <TopoDS_Edge.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <TopoDS_Face.hxx>
#include <gp_Dir.hxx>
#include <Draft_Modification.hxx>
#include <Draft_FaceInfo.hxx>
#include <Draft_EdgeInfo.hxx>
#include <Draft_VertexInfo.hxx>
#include <StdFail_NotDone.hxx>
#include <gp_Pln.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
// module includes
#include <Draft.hxx>
#include <Draft_EdgeInfo.hxx>
#include <Draft_ErrorStatus.hxx>
#include <Draft_FaceInfo.hxx>
#include <Draft_IndexedDataMapOfEdgeEdgeInfo.hxx>
#include <Draft_IndexedDataMapOfFaceFaceInfo.hxx>
#include <Draft_IndexedDataMapOfVertexVertexInfo.hxx>
#include <Draft_Modification.hxx>
#include <Draft_VertexInfo.hxx>
// template related includes
// ./opencascade/Draft_IndexedDataMapOfVertexVertexInfo.hxx
#include "NCollection_tmpl.hxx"
// ./opencascade/Draft_IndexedDataMapOfEdgeEdgeInfo.hxx
#include "NCollection_tmpl.hxx"
// ./opencascade/Draft_IndexedDataMapOfFaceFaceInfo.hxx
#include "NCollection_tmpl.hxx"
// user-defined pre
#include "OCP_specific.inc"
// user-defined inclusion per module
// Module definiiton
void register_Draft(py::module &main_module) {
py::module m = static_cast<py::module>(main_module.attr("Draft"));
//Python trampoline classes
// classes
// default constructor
register_default_constructor<Draft , shared_ptr<Draft>>(m,"Draft");
static_cast<py::class_<Draft , shared_ptr<Draft> >>(m.attr("Draft"))
// constructors
// custom constructors
// methods
// methods using call by reference i.s.o. return
// static methods
.def_static("Angle_s",
(Standard_Real (*)( const TopoDS_Face & , const gp_Dir & ) ) static_cast<Standard_Real (*)( const TopoDS_Face & , const gp_Dir & ) >(&Draft::Angle),
R"#(Returns the draft angle of the face <F> using the direction <Direction>. The method is valid for : - Plane faces, - Cylindrical or conical faces, when the direction of the axis of the surface is colinear with the direction. Otherwise, the exception DomainError is raised.)#" , py::arg("F"), py::arg("Direction"))
// static methods using call by reference i.s.o. return
// operators
// additional methods and static methods
;
static_cast<py::class_<Draft_EdgeInfo , shared_ptr<Draft_EdgeInfo> >>(m.attr("Draft_EdgeInfo"))
// constructors
.def(py::init< >() )
.def(py::init< const Standard_Boolean >() , py::arg("HasNewGeometry") )
// custom constructors
// methods
.def("Add",
(void (Draft_EdgeInfo::*)( const TopoDS_Face & ) ) static_cast<void (Draft_EdgeInfo::*)( const TopoDS_Face & ) >(&Draft_EdgeInfo::Add),
R"#(None)#" , py::arg("F"))
.def("RootFace",
(void (Draft_EdgeInfo::*)( const TopoDS_Face & ) ) static_cast<void (Draft_EdgeInfo::*)( const TopoDS_Face & ) >(&Draft_EdgeInfo::RootFace),
R"#(None)#" , py::arg("F"))
.def("Tangent",
(void (Draft_EdgeInfo::*)( const gp_Pnt & ) ) static_cast<void (Draft_EdgeInfo::*)( const gp_Pnt & ) >(&Draft_EdgeInfo::Tangent),
R"#(None)#" , py::arg("P"))
.def("IsTangent",
(Standard_Boolean (Draft_EdgeInfo::*)( gp_Pnt & ) const) static_cast<Standard_Boolean (Draft_EdgeInfo::*)( gp_Pnt & ) const>(&Draft_EdgeInfo::IsTangent),
R"#(None)#" , py::arg("P"))
.def("NewGeometry",
(Standard_Boolean (Draft_EdgeInfo::*)() const) static_cast<Standard_Boolean (Draft_EdgeInfo::*)() const>(&Draft_EdgeInfo::NewGeometry),
R"#(None)#" )
.def("SetNewGeometry",
(void (Draft_EdgeInfo::*)( const Standard_Boolean ) ) static_cast<void (Draft_EdgeInfo::*)( const Standard_Boolean ) >(&Draft_EdgeInfo::SetNewGeometry),
R"#(None)#" , py::arg("NewGeom"))
.def("Geometry",
(const opencascade::handle<Geom_Curve> & (Draft_EdgeInfo::*)() const) static_cast<const opencascade::handle<Geom_Curve> & (Draft_EdgeInfo::*)() const>(&Draft_EdgeInfo::Geometry),
R"#(None)#" )
.def("FirstFace",
(const TopoDS_Face & (Draft_EdgeInfo::*)() const) static_cast<const TopoDS_Face & (Draft_EdgeInfo::*)() const>(&Draft_EdgeInfo::FirstFace),
R"#(None)#" )
.def("SecondFace",
(const TopoDS_Face & (Draft_EdgeInfo::*)() const) static_cast<const TopoDS_Face & (Draft_EdgeInfo::*)() const>(&Draft_EdgeInfo::SecondFace),
R"#(None)#" )
.def("FirstPC",
(const opencascade::handle<Geom2d_Curve> & (Draft_EdgeInfo::*)() const) static_cast<const opencascade::handle<Geom2d_Curve> & (Draft_EdgeInfo::*)() const>(&Draft_EdgeInfo::FirstPC),
R"#(None)#" )
.def("SecondPC",
(const opencascade::handle<Geom2d_Curve> & (Draft_EdgeInfo::*)() const) static_cast<const opencascade::handle<Geom2d_Curve> & (Draft_EdgeInfo::*)() const>(&Draft_EdgeInfo::SecondPC),
R"#(None)#" )
.def("ChangeGeometry",
(opencascade::handle<Geom_Curve> & (Draft_EdgeInfo::*)() ) static_cast<opencascade::handle<Geom_Curve> & (Draft_EdgeInfo::*)() >(&Draft_EdgeInfo::ChangeGeometry),
R"#(None)#" )
.def("ChangeFirstPC",
(opencascade::handle<Geom2d_Curve> & (Draft_EdgeInfo::*)() ) static_cast<opencascade::handle<Geom2d_Curve> & (Draft_EdgeInfo::*)() >(&Draft_EdgeInfo::ChangeFirstPC),
R"#(None)#" )
.def("ChangeSecondPC",
(opencascade::handle<Geom2d_Curve> & (Draft_EdgeInfo::*)() ) static_cast<opencascade::handle<Geom2d_Curve> & (Draft_EdgeInfo::*)() >(&Draft_EdgeInfo::ChangeSecondPC),
R"#(None)#" )
.def("RootFace",
(const TopoDS_Face & (Draft_EdgeInfo::*)() const) static_cast<const TopoDS_Face & (Draft_EdgeInfo::*)() const>(&Draft_EdgeInfo::RootFace),
R"#(None)#" )
.def("Tolerance",
(void (Draft_EdgeInfo::*)( const Standard_Real ) ) static_cast<void (Draft_EdgeInfo::*)( const Standard_Real ) >(&Draft_EdgeInfo::Tolerance),
R"#(None)#" , py::arg("tol"))
.def("Tolerance",
(Standard_Real (Draft_EdgeInfo::*)() const) static_cast<Standard_Real (Draft_EdgeInfo::*)() const>(&Draft_EdgeInfo::Tolerance),
R"#(None)#" )
// methods using call by reference i.s.o. return
// static methods
// static methods using call by reference i.s.o. return
// operators
// additional methods and static methods
;
static_cast<py::class_<Draft_FaceInfo , shared_ptr<Draft_FaceInfo> >>(m.attr("Draft_FaceInfo"))
// constructors
.def(py::init< >() )
.def(py::init< const opencascade::handle<Geom_Surface> &,const Standard_Boolean >() , py::arg("S"), py::arg("HasNewGeometry") )
// custom constructors
// methods
.def("RootFace",
(void (Draft_FaceInfo::*)( const TopoDS_Face & ) ) static_cast<void (Draft_FaceInfo::*)( const TopoDS_Face & ) >(&Draft_FaceInfo::RootFace),
R"#(None)#" , py::arg("F"))
.def("NewGeometry",
(Standard_Boolean (Draft_FaceInfo::*)() const) static_cast<Standard_Boolean (Draft_FaceInfo::*)() const>(&Draft_FaceInfo::NewGeometry),
R"#(None)#" )
.def("Add",
(void (Draft_FaceInfo::*)( const TopoDS_Face & ) ) static_cast<void (Draft_FaceInfo::*)( const TopoDS_Face & ) >(&Draft_FaceInfo::Add),
R"#(None)#" , py::arg("F"))
.def("FirstFace",
(const TopoDS_Face & (Draft_FaceInfo::*)() const) static_cast<const TopoDS_Face & (Draft_FaceInfo::*)() const>(&Draft_FaceInfo::FirstFace),
R"#(None)#" )
.def("SecondFace",
(const TopoDS_Face & (Draft_FaceInfo::*)() const) static_cast<const TopoDS_Face & (Draft_FaceInfo::*)() const>(&Draft_FaceInfo::SecondFace),
R"#(None)#" )
.def("Geometry",
(const opencascade::handle<Geom_Surface> & (Draft_FaceInfo::*)() const) static_cast<const opencascade::handle<Geom_Surface> & (Draft_FaceInfo::*)() const>(&Draft_FaceInfo::Geometry),
R"#(None)#" )
.def("ChangeGeometry",
(opencascade::handle<Geom_Surface> & (Draft_FaceInfo::*)() ) static_cast<opencascade::handle<Geom_Surface> & (Draft_FaceInfo::*)() >(&Draft_FaceInfo::ChangeGeometry),
R"#(None)#" )
.def("RootFace",
(const TopoDS_Face & (Draft_FaceInfo::*)() const) static_cast<const TopoDS_Face & (Draft_FaceInfo::*)() const>(&Draft_FaceInfo::RootFace),
R"#(None)#" )
.def("ChangeCurve",
(opencascade::handle<Geom_Curve> & (Draft_FaceInfo::*)() ) static_cast<opencascade::handle<Geom_Curve> & (Draft_FaceInfo::*)() >(&Draft_FaceInfo::ChangeCurve),
R"#(None)#" )
.def("Curve",
(const opencascade::handle<Geom_Curve> & (Draft_FaceInfo::*)() const) static_cast<const opencascade::handle<Geom_Curve> & (Draft_FaceInfo::*)() const>(&Draft_FaceInfo::Curve),
R"#(None)#" )
// methods using call by reference i.s.o. return
// static methods
// static methods using call by reference i.s.o. return
// operators
// additional methods and static methods
;
static_cast<py::class_<Draft_Modification ,opencascade::handle<Draft_Modification> , BRepTools_Modification>>(m.attr("Draft_Modification"))
// constructors
.def(py::init< const TopoDS_Shape & >() , py::arg("S") )
// custom constructors
// methods
.def("Clear",
(void (Draft_Modification::*)() ) static_cast<void (Draft_Modification::*)() >(&Draft_Modification::Clear),
R"#(Resets on the same shape.)#" )
.def("Init",
(void (Draft_Modification::*)( const TopoDS_Shape & ) ) static_cast<void (Draft_Modification::*)( const TopoDS_Shape & ) >(&Draft_Modification::Init),
R"#(Changes the basis shape and resets.)#" , py::arg("S"))
.def("Add",
(Standard_Boolean (Draft_Modification::*)( const TopoDS_Face & , const gp_Dir & , const Standard_Real , const gp_Pln & , const Standard_Boolean ) ) static_cast<Standard_Boolean (Draft_Modification::*)( const TopoDS_Face & , const gp_Dir & , const Standard_Real , const gp_Pln & , const Standard_Boolean ) >(&Draft_Modification::Add),
R"#(Adds the face F and propagates the draft modification to its neighbour faces if they are tangent. If an error occurs, will return False and ProblematicShape will return the "bad" face.)#" , py::arg("F"), py::arg("Direction"), py::arg("Angle"), py::arg("NeutralPlane"), py::arg("Flag")=static_cast<const Standard_Boolean>(Standard_True))
.def("Remove",
(void (Draft_Modification::*)( const TopoDS_Face & ) ) static_cast<void (Draft_Modification::*)( const TopoDS_Face & ) >(&Draft_Modification::Remove),
R"#(Removes the face F and the neighbour faces if they are tangent. It will be necessary to call this method if the method Add returns Standard_False, to unset ProblematicFace.)#" , py::arg("F"))
.def("Perform",
(void (Draft_Modification::*)() ) static_cast<void (Draft_Modification::*)() >(&Draft_Modification::Perform),
R"#(Performs the draft angle modification and sets the value returned by the method IsDone. If an error occurs, IsDone will return Standard_False, and an error status will be given by the method Error, and the shape on which the problem appeared will be given by ProblematicShape)#" )
.def("IsDone",
(Standard_Boolean (Draft_Modification::*)() const) static_cast<Standard_Boolean (Draft_Modification::*)() const>(&Draft_Modification::IsDone),
R"#(Returns True if Perform has been succesfully called. Otherwise more information can be obtained using the methods Error() and ProblematicShape().)#" )
.def("Error",
(Draft_ErrorStatus (Draft_Modification::*)() const) static_cast<Draft_ErrorStatus (Draft_Modification::*)() const>(&Draft_Modification::Error),
R"#(None)#" )
.def("ProblematicShape",
(const TopoDS_Shape & (Draft_Modification::*)() const) static_cast<const TopoDS_Shape & (Draft_Modification::*)() const>(&Draft_Modification::ProblematicShape),
R"#(Returns the shape (Face, Edge or Vertex) on which an error occured.)#" )
.def("ConnectedFaces",
(const TopTools_ListOfShape & (Draft_Modification::*)( const TopoDS_Face & ) ) static_cast<const TopTools_ListOfShape & (Draft_Modification::*)( const TopoDS_Face & ) >(&Draft_Modification::ConnectedFaces),
R"#(Returns all the faces which have been added together with the face <F>.)#" , py::arg("F"))
.def("ModifiedFaces",
(const TopTools_ListOfShape & (Draft_Modification::*)() ) static_cast<const TopTools_ListOfShape & (Draft_Modification::*)() >(&Draft_Modification::ModifiedFaces),
R"#(Returns all the faces on which a modification has been given.)#" )
.def("NewSurface",
(Standard_Boolean (Draft_Modification::*)( const TopoDS_Face & , opencascade::handle<Geom_Surface> & , TopLoc_Location & , Standard_Real & , Standard_Boolean & , Standard_Boolean & ) ) static_cast<Standard_Boolean (Draft_Modification::*)( const TopoDS_Face & , opencascade::handle<Geom_Surface> & , TopLoc_Location & , Standard_Real & , Standard_Boolean & , Standard_Boolean & ) >(&Draft_Modification::NewSurface),
R"#(Returns Standard_True if the face <F> has been modified. In this case, <S> is the new geometric support of the face, <L> the new location,<Tol> the new tolerance.<RevWires> has to be set to Standard_True when the modification reverses the normal of the surface.(the wires have to be reversed). <RevFace> has to be set to Standard_True if the orientation of the modified face changes in the shells which contain it. Here it will be set to Standard_False.)#" , py::arg("F"), py::arg("S"), py::arg("L"), py::arg("Tol"), py::arg("RevWires"), py::arg("RevFace"))
.def("NewCurve",
(Standard_Boolean (Draft_Modification::*)( const TopoDS_Edge & , opencascade::handle<Geom_Curve> & , TopLoc_Location & , Standard_Real & ) ) static_cast<Standard_Boolean (Draft_Modification::*)( const TopoDS_Edge & , opencascade::handle<Geom_Curve> & , TopLoc_Location & , Standard_Real & ) >(&Draft_Modification::NewCurve),
R"#(Returns Standard_True if the edge <E> has been modified. In this case, <C> is the new geometric support of the edge, <L> the new location, <Tol> the new tolerance. Otherwise, returns Standard_False, and <C>, <L>, <Tol> are not significant.)#" , py::arg("E"), py::arg("C"), py::arg("L"), py::arg("Tol"))
.def("NewPoint",
(Standard_Boolean (Draft_Modification::*)( const TopoDS_Vertex & , gp_Pnt & , Standard_Real & ) ) static_cast<Standard_Boolean (Draft_Modification::*)( const TopoDS_Vertex & , gp_Pnt & , Standard_Real & ) >(&Draft_Modification::NewPoint),
R"#(Returns Standard_True if the vertex <V> has been modified. In this case, <P> is the new geometric support of the vertex, <Tol> the new tolerance. Otherwise, returns Standard_False, and <P>, <Tol> are not significant.)#" , py::arg("V"), py::arg("P"), py::arg("Tol"))
.def("NewCurve2d",
(Standard_Boolean (Draft_Modification::*)( const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Edge & , const TopoDS_Face & , opencascade::handle<Geom2d_Curve> & , Standard_Real & ) ) static_cast<Standard_Boolean (Draft_Modification::*)( const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Edge & , const TopoDS_Face & , opencascade::handle<Geom2d_Curve> & , Standard_Real & ) >(&Draft_Modification::NewCurve2d),
R"#(Returns Standard_True if the edge <E> has a new curve on surface on the face <F>.In this case, <C> is the new geometric support of the edge, <L> the new location, <Tol> the new tolerance.)#" , py::arg("E"), py::arg("F"), py::arg("NewE"), py::arg("NewF"), py::arg("C"), py::arg("Tol"))
.def("NewParameter",
(Standard_Boolean (Draft_Modification::*)( const TopoDS_Vertex & , const TopoDS_Edge & , Standard_Real & , Standard_Real & ) ) static_cast<Standard_Boolean (Draft_Modification::*)( const TopoDS_Vertex & , const TopoDS_Edge & , Standard_Real & , Standard_Real & ) >(&Draft_Modification::NewParameter),
R"#(Returns Standard_True if the Vertex <V> has a new parameter on the edge <E>. In this case, <P> is the parameter, <Tol> the new tolerance. Otherwise, returns Standard_False, and <P>, <Tol> are not significant.)#" , py::arg("V"), py::arg("E"), py::arg("P"), py::arg("Tol"))
.def("Continuity",
(GeomAbs_Shape (Draft_Modification::*)( const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Face & , const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Face & ) ) static_cast<GeomAbs_Shape (Draft_Modification::*)( const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Face & , const TopoDS_Edge & , const TopoDS_Face & , const TopoDS_Face & ) >(&Draft_Modification::Continuity),
R"#(Returns the continuity of <NewE> between <NewF1> and <NewF2>.)#" , py::arg("E"), py::arg("F1"), py::arg("F2"), py::arg("NewE"), py::arg("NewF1"), py::arg("NewF2"))
.def("DynamicType",
(const opencascade::handle<Standard_Type> & (Draft_Modification::*)() const) static_cast<const opencascade::handle<Standard_Type> & (Draft_Modification::*)() const>(&Draft_Modification::DynamicType),
R"#(None)#" )
// methods using call by reference i.s.o. return
// static methods
.def_static("get_type_name_s",
(const char * (*)() ) static_cast<const char * (*)() >(&Draft_Modification::get_type_name),
R"#(None)#" )
.def_static("get_type_descriptor_s",
(const opencascade::handle<Standard_Type> & (*)() ) static_cast<const opencascade::handle<Standard_Type> & (*)() >(&Draft_Modification::get_type_descriptor),
R"#(None)#" )
// static methods using call by reference i.s.o. return
// operators
// additional methods and static methods
;
static_cast<py::class_<Draft_VertexInfo , shared_ptr<Draft_VertexInfo> >>(m.attr("Draft_VertexInfo"))
// constructors
.def(py::init< >() )
// custom constructors
// methods
.def("Add",
(void (Draft_VertexInfo::*)( const TopoDS_Edge & ) ) static_cast<void (Draft_VertexInfo::*)( const TopoDS_Edge & ) >(&Draft_VertexInfo::Add),
R"#(None)#" , py::arg("E"))
.def("Geometry",
(const gp_Pnt & (Draft_VertexInfo::*)() const) static_cast<const gp_Pnt & (Draft_VertexInfo::*)() const>(&Draft_VertexInfo::Geometry),
R"#(None)#" )
.def("Parameter",
(Standard_Real (Draft_VertexInfo::*)( const TopoDS_Edge & ) ) static_cast<Standard_Real (Draft_VertexInfo::*)( const TopoDS_Edge & ) >(&Draft_VertexInfo::Parameter),
R"#(None)#" , py::arg("E"))
.def("InitEdgeIterator",
(void (Draft_VertexInfo::*)() ) static_cast<void (Draft_VertexInfo::*)() >(&Draft_VertexInfo::InitEdgeIterator),
R"#(None)#" )
.def("Edge",
(const TopoDS_Edge & (Draft_VertexInfo::*)() const) static_cast<const TopoDS_Edge & (Draft_VertexInfo::*)() const>(&Draft_VertexInfo::Edge),
R"#(None)#" )
.def("NextEdge",
(void (Draft_VertexInfo::*)() ) static_cast<void (Draft_VertexInfo::*)() >(&Draft_VertexInfo::NextEdge),
R"#(None)#" )
.def("MoreEdge",
(Standard_Boolean (Draft_VertexInfo::*)() const) static_cast<Standard_Boolean (Draft_VertexInfo::*)() const>(&Draft_VertexInfo::MoreEdge),
R"#(None)#" )
.def("ChangeGeometry",
(gp_Pnt & (Draft_VertexInfo::*)() ) static_cast<gp_Pnt & (Draft_VertexInfo::*)() >(&Draft_VertexInfo::ChangeGeometry),
R"#(None)#" )
.def("ChangeParameter",
(Standard_Real & (Draft_VertexInfo::*)( const TopoDS_Edge & ) ) static_cast<Standard_Real & (Draft_VertexInfo::*)( const TopoDS_Edge & ) >(&Draft_VertexInfo::ChangeParameter),
R"#(None)#" , py::arg("E"))
// methods using call by reference i.s.o. return
// static methods
// static methods using call by reference i.s.o. return
// operators
// additional methods and static methods
;
// functions
// ./opencascade/Draft_FaceInfo.hxx
// ./opencascade/Draft_IndexedDataMapOfVertexVertexInfo.hxx
// ./opencascade/Draft_VertexInfo.hxx
// ./opencascade/Draft_EdgeInfo.hxx
// ./opencascade/Draft_IndexedDataMapOfEdgeEdgeInfo.hxx
// ./opencascade/Draft.hxx
// ./opencascade/Draft_Modification.hxx
// ./opencascade/Draft_IndexedDataMapOfFaceFaceInfo.hxx
// ./opencascade/Draft_ErrorStatus.hxx
// Additional functions
// operators
// register typdefs
register_template_NCollection_IndexedDataMap<TopoDS_Vertex, Draft_VertexInfo, TopTools_ShapeMapHasher>(m,"Draft_IndexedDataMapOfVertexVertexInfo");
register_template_NCollection_IndexedDataMap<TopoDS_Edge, Draft_EdgeInfo, TopTools_ShapeMapHasher>(m,"Draft_IndexedDataMapOfEdgeEdgeInfo");
register_template_NCollection_IndexedDataMap<TopoDS_Face, Draft_FaceInfo, TopTools_ShapeMapHasher>(m,"Draft_IndexedDataMapOfFaceFaceInfo");
// exceptions
// user-defined post-inclusion per module in the body
};
// user-defined post-inclusion per module
// user-defined post
|
f57119608e16e0ffab4737a92996a060c6f7cdfc
|
7aaa96c2a3b4847db65c5cb7959c41f8705c6db1
|
/RGBtoGray/cam06.cpp
|
0b7dbaae2ffd2618e8c3c955bf461c8c28a36f83
|
[] |
no_license
|
YeonWon123/2019_Image_Processing
|
9b16f50ba681d8b4f1bd088222512cb12c8d9a1a
|
cef1e69f4e16a7f3d6f45c156dce6322ae232fb3
|
refs/heads/master
| 2020-04-22T00:15:10.677469
| 2019-05-20T16:47:59
| 2019-05-20T16:47:59
| 169,972,612
| 4
| 1
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 1,586
|
cpp
|
cam06.cpp
|
// cam06.cpp : Definiert das Klassenverhalten f? die Anwendung.
//
#include "stdafx.h"
#include "cam06.h"
#include "cam06Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// Ccam06App
BEGIN_MESSAGE_MAP(Ccam06App, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// Ccam06App-Erstellung
Ccam06App::Ccam06App()
{
// TODO: Hier Code zur Konstruktion einf?en
// Alle wichtigen Initialisierungen in InitInstance positionieren
}
// Das einzige Ccam06App-Objekt
Ccam06App theApp;
// Ccam06App-Initialisierung
BOOL Ccam06App::InitInstance()
{
CWinApp::InitInstance();
// Standardinitialisierung
// Wenn Sie diese Features nicht verwenden und die Größe
// der ausf?rbaren Datei verringern m?hten, entfernen Sie
// die nicht erforderlichen Initialisierungsroutinen.
// Ändern Sie den Registrierungsschl?sel, unter dem Ihre Einstellungen gespeichert sind.
// TODO: Ändern Sie diese Zeichenfolge entsprechend,
// z.B. zum Namen Ihrer Firma oder Organisation.
SetRegistryKey(_T("Vom lokalen Anwendungs-Assistenten generierte Anwendungen"));
Ccam06Dlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: F?en Sie hier Code ein, um das Schlie?n des
// Dialogfelds ?er "OK" zu steuern
}
else if (nResponse == IDCANCEL)
{
// TODO: F?en Sie hier Code ein, um das Schlie?n des
// Dialogfelds ?er "Abbrechen" zu steuern
}
// Da das Dialogfeld geschlossen wurde, FALSE zur?kliefern, sodass wir die
// Anwendung verlassen, anstatt das Nachrichtensystem der Anwendung zu starten.
return FALSE;
}
|
f2804a0e4f72e902c0e6fa748ca4f6ed38feffb4
|
dc61e8c951f9e91930c2edff8a53c32d7a99bb94
|
/src/core/io/serialization/versionconverter.cpp
|
e218e1ae51264dad5b9a29a862c357e3e1c987ee
|
[
"BSD-2-Clause"
] |
permissive
|
johti626/inviwo
|
d4b2766742522d3c8d57c894a60e345ec35beafc
|
c429a15b972715157b99f3686b05d581d3e89e92
|
refs/heads/master
| 2021-01-17T08:14:10.118104
| 2016-05-25T14:38:33
| 2016-05-25T14:46:31
| 31,444,269
| 2
| 0
| null | 2015-02-27T23:45:02
| 2015-02-27T23:45:01
| null |
UTF-8
|
C++
| false
| false
| 10,372
|
cpp
|
versionconverter.cpp
|
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2014-2015 Inviwo Foundation
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/
#include <inviwo/core/io/serialization/versionconverter.h>
#include <inviwo/core/util/stringconversion.h>
#include <inviwo/core/ports/inport.h>
#include <inviwo/core/ports/outport.h>
namespace inviwo {
VersionConverter::VersionConverter() {}
NodeVersionConverter::NodeVersionConverter(std::function<bool(TxElement*)> fun)
: VersionConverter(), fun_(fun) {}
bool NodeVersionConverter::convert(TxElement* root) { return fun_(root); }
TraversingVersionConverter::TraversingVersionConverter(std::function<bool(TxElement*)> fun)
: VersionConverter(), fun_(fun) {}
bool TraversingVersionConverter::convert(TxElement* root) { return traverseNodes(root); }
bool TraversingVersionConverter::traverseNodes(TxElement* node) {
bool res = true;
res = res && fun_(node);
ticpp::Iterator<ticpp::Element> child;
for (child = child.begin(node); child != child.end(); child++) {
res = res && traverseNodes(child.Get());
}
return res;
}
bool util::xmlCopyMatchingSubPropsIntoComposite(TxElement* node, const CompositeProperty& prop) {
TxElement propitem("Property");
propitem.SetAttribute("type", prop.getClassIdentifier());
propitem.SetAttribute("identifier", prop.getIdentifier());
propitem.SetAttribute("displayName", prop.getDisplayName());
propitem.SetAttribute("key", prop.getIdentifier());
TxElement list("Properties");
std::vector<Property*> props = prop.getProperties();
bool res = false;
// temp list
std::vector<TxElement*> toBeDeleted;
for (auto& p : props) {
bool match = false;
ticpp::Iterator<ticpp::Element> child;
for (child = child.begin(node); child != child.end(); child++) {
std::string name;
child->GetValue(&name);
std::string type = child->GetAttributeOrDefault("type", "");
std::string id = child->GetAttributeOrDefault("identifier", "");
if (p->getIdentifier() == id &&
(p->getClassIdentifier() == type ||
p->getClassIdentifier() == splitString(type, '.').back())) {
LogInfoCustom("VersionConverter", " Match for sub property: " +
joinString(p->getPath(), ".") +
" found in type: "
<< type << " id: " << id);
list.InsertEndChild(*(child->Clone()));
toBeDeleted.push_back(child.Get());
match = true;
}
}
res = res || match;
}
for (auto& elem : toBeDeleted) {
node->RemoveChild(elem);
}
propitem.InsertEndChild(list);
node->InsertEndChild(propitem);
return res;
}
bool util::xmlHasProp(TxElement* node, const Property& prop) {
bool result = false;
ticpp::Iterator<ticpp::Element> child;
for (child = child.begin(node); child != child.end(); child++) {
if (prop.getClassIdentifier() == child->GetAttributeOrDefault("type", "")
&& prop.getIdentifier() == child->GetAttributeOrDefault("identifier", "")) {
result = true;
}
}
return result;
}
std::vector<TxElement*> util::xmlGetMatchingElements(TxElement* node, std::string key) {
std::vector<TxElement*> res;
ticpp::Iterator<ticpp::Element> child;
for (child = child.begin(node); child != child.end(); child++) {
std::string childkey;
child->GetValue(&childkey);
if(childkey == key){
res.push_back(child.Get());
}
}
return res;
}
bool util::xmlFindMatchingSubPropertiesForComposites(
TxElement* processornode, const std::vector<const CompositeProperty*>& props) {
std::vector<TxElement*> pelm = util::xmlGetMatchingElements(processornode, "Properties");
bool res = false;
for (auto& prop : props) {
if (!util::xmlHasProp(pelm[0], *prop)) {
bool foundMatchingComposite = util::xmlCopyMatchingCompositeProperty(pelm[0], *prop);
bool foundSubProp = false;
if (!foundMatchingComposite) {
foundSubProp = util::xmlCopyMatchingSubPropsIntoComposite(pelm[0], *prop);
}
res = res || foundSubProp || foundMatchingComposite;
}
}
return res;
}
TxElement* util::xmlGetElement(TxElement* node, std::string path) {
std::vector<std::string> parts = splitString(path, '/');
if (parts.size() > 0) {
std::vector<std::string> components = splitString(parts[0], '&');
std::string name = components[0];
ticpp::Iterator<ticpp::Element> child;
for (child = child.begin(node); child != child.end(); child++) {
bool match = true;
std::string childname;
child->GetValue(&childname);
if (childname == name) {
for (size_t i = 1; i < components.size(); ++i) {
std::vector<std::string> pair = splitString(components[i], '=');
match = match && child->GetAttributeOrDefault(pair[0], "") == pair[1];
}
} else {
match = false;
}
if (match) {
if (parts.size() > 1) {
return xmlGetElement(child.Get(),
joinString(parts.begin() + 1, parts.end(), "/"));
} else {
return child.Get();
}
break;
}
}
}
return nullptr;
}
bool util::xmlCopyMatchingCompositeProperty(TxElement* node, const CompositeProperty& prop) {
ticpp::Iterator<ticpp::Element> child;
for (child = child.begin(node); child != child.end(); child++) {
std::string name;
child->GetValue(&name);
std::string type = child->GetAttributeOrDefault("type", "");
std::string id = child->GetAttributeOrDefault("identifier", "");
if ((type == "CompositeProperty" || type == "org.inviwo.CompositeProperty") && prop.getIdentifier() == id) {
LogInfoCustom("VersionConverter", " Found Composite with same identifier");
TxElement* newChild = node->InsertEndChild(*(child.Get()))->ToElement();
newChild->SetAttribute("type", prop.getClassIdentifier());
return true;
}
}
return false;
}
void util::renamePort(Deserializer& d, std::initializer_list<std::pair<const Port*, std::string>> rules) {
NodeVersionConverter vc([&rules](TxElement* node) {
bool didChanges = false;
for (auto rule : rules) {
TxElement* elem = nullptr;
if (auto p = dynamic_cast<const Outport*>(rule.first)) {
elem = util::xmlGetElement(node, "OutPorts/OutPort&type=" + p->getClassIdentifier() +
"&identifier=" + rule.second);
} else if (auto p = dynamic_cast<const Inport*>(rule.first)) {
elem = util::xmlGetElement(node, "InPorts/InPort&type=" + p->getClassIdentifier() +
"&identifier=" + rule.second);
}
if (elem) {
elem->SetAttribute("identifier", rule.first->getIdentifier());
didChanges = true;
}
}
return didChanges;
});
d.convertVersion(&vc);
}
void util::renameProperty(Deserializer& d, std::initializer_list<std::pair<const Property*, std::string>> rules) {
NodeVersionConverter vc([&rules](TxElement* node) {
bool didChanges = false;
for (auto rule : rules) {
TxElement* p = util::xmlGetElement(node, "Properties/Property&type=" +
rule.first->getClassIdentifier() +
"&identifier=" + rule.second);
if (p) {
p->SetAttribute("identifier", rule.first->getIdentifier());
didChanges = true;
}
}
return didChanges;
});
d.convertVersion(&vc);
}
void util::changePropertyType(
Deserializer& d, std::initializer_list<std::pair<const Property*, std::string>> rules) {
NodeVersionConverter vc([&rules](TxElement* node) {
bool didChanges = false;
for (auto rule : rules) {
TxElement* p = util::xmlGetElement(
node, "Properties/Property&type=" + rule.first->getClassIdentifier() +
"&identifier=" + rule.first->getIdentifier());
if (p) {
p->SetAttribute("type", rule.second);
didChanges = true;
}
}
return didChanges;
});
d.convertVersion(&vc);
}
} // namespace
|
aa2db3e54c2926f0218e1814d272fd9a49dd686d
|
198d0202dacedb1e6c2a644def38fdab182b7235
|
/DP/A2OJ/AIBOHP.cpp
|
c9b0f294db2c0d9ef4c67cdd75cd7aef23121a51
|
[] |
no_license
|
Leerw/ProgrammingPractice4ZJU
|
12233746ed20c97e6d16c2fbf7d7d04d80e09178
|
ab81f0b4feb4e7ddb6a9a83b82c03cd4ec33c3de
|
refs/heads/master
| 2021-04-03T06:19:39.043870
| 2018-09-07T14:40:29
| 2018-09-07T14:40:29
| 125,162,723
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 686
|
cpp
|
AIBOHP.cpp
|
#include <bits/stdc++.h>
using namespace std;
int dp[6010][6110];
char s[6110];
int rec(int i, int j) {
if (i > j) {
return INT_MAX;
}
if (i == j) {
return 0;
}
if (i == j - 1) {
return s[i] == s[j] ? 0 : 1;
}
if (dp[i][j] != -1) {
return dp[i][j];
}
if (s[i] == s[j]) {
return dp[i][j] = rec(i + 1, j - 1);
} else {
return dp[i][j] = min(rec(i + 1, j), rec(i, j - 1)) + 1;
}
}
int main() {
int t;
scanf("%d", &t);
while (t--) {
memset(dp, -1, sizeof dp);
scanf("%s", s);
int len = strlen(s);
printf("%d\n", rec(0, len - 1));
}
return 0;
}
|
6a4b73441a26403bbe0b9b0fb4964cfbc574ba90
|
97e996b3270344dc419bb38e38da847b5dbd59b8
|
/game.cpp
|
0887143e8280c5b4bfba043331eeaccce90aeff8
|
[] |
no_license
|
crimsonlander/tic-tac-toe
|
78b94ceef30857b2df22c8ed07eab11d6ce51487
|
07c13ab25184af53e7a92a76d495d977f36019cf
|
refs/heads/master
| 2021-01-01T19:17:00.364609
| 2015-07-09T22:08:14
| 2015-07-09T22:08:14
| 38,846,128
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,323
|
cpp
|
game.cpp
|
#include "game.h"
#include <string>
#include <stdexcept>
#include <cmath>
void game::make_turn(pos p) {
if (_a[p.first][p.second] != ' ')
throw std::runtime_error("Incorrect move!");
else if (_current_player == 1) {
_a[p.first][p.second] = 'X';
_current_player = 2;
}
else {
_a[p.first][p.second] = 'O';
_current_player = 1;
}
_turns.push_back(p);
}
int game::ended() {
int s1 = 0, s2 = 0, s3 = 0, s4 = 0;
for (int i = 0; i < 3; ++i) {
s3 += _a[i][i] == 'X'? 1 : _a[i][i] == 'O'? -1 : 0;
s4 += _a[i][2-i] == 'X'? 1 : _a[i][2-i] == 'O'? -1 : 0;
s1 = 0, s2 = 0;
for (int j = 0; j < 3; ++j) {
s1 += _a[i][j] == 'X'? 1 : _a[i][j] == 'O'? -1 : 0;
s2 += _a[j][i] == 'X'? 1 : _a[j][i] == 'O'? -1 : 0;
}
if (std::abs(s1) == 3 || std::abs(s2) == 3)
break;
}
if (s1 == 3 || s2 == 3 || s3 == 3 || s4 == 3)
return 1;
if (s1 == -3 || s2 == -3 || s3 == -3 || s4 == -3)
return 2;
return 0;
}
std::ostream& operator<<(std::ostream& os, const game &g) {
os << "-------\n";
for (int i = 0; i < 3; ++i) {
os << '|' << g._a[i][0] << '|' << g._a[i][1] << '|' << g._a[i][2] << "|\n";
os << "-------\n";
}
return os;
}
|
809b54041ea899cd04a36e31cd3843bff0f7eb85
|
8b4f7e8e746b8592a2289337a2013d7cf7d04c44
|
/Life.cpp
|
676a5b9f1105b42c261422f117db6234cdee185d
|
[] |
no_license
|
seansu4you87/osclaser
|
8f0aac69dc9d803f097df34a9938fbabe25fde14
|
dcd3bcb898db4957209c9c04115b2375aea7ab35
|
refs/heads/master
| 2021-01-01T16:55:14.318564
| 2010-02-18T03:52:17
| 2010-02-18T03:52:17
| 32,344,063
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,633
|
cpp
|
Life.cpp
|
// Life.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Color.h"
#include "Ld2000.h"
#include "OSCLaserController.h"
#include <iostream>
#include <cmath>
#include <cstring>
#include <pthread.h>
//OSC stuff
#include "OscReceivedElements.h"
#include "OscPacketListener.h"
#include "UdpSocket.h"
#define PORT 7000
#define NUM_X_POINTS 20
#define NUM_Y_POINTS 10
using namespace std;
class LifeController : public OSCLaserController
{
bool newData;
float currentSizeValue;
float currentHueValue;
float currentBrightnessValue;
private:
void setPoints()
{
double percentMin = 0.2;
double percentMax = 0.95;
double currentPercent = percentMin + currentSizeValue*(percentMax - percentMin);
double totalLength = (xMax - xMin)*currentPercent;
double startX = 0.0 - totalLength/2.0;
double step = totalLength / numPoints;
for(int i = 0; i < numPoints; i++)
{
LaserPoints[i].XCoord = (LONG)(startX + i*step);
LaserPoints[i].YCoord = 0;
LaserPoints[i].ZCoord = 0;
LaserPoints[i].FCoord = 0;
float brightMin = 25;
float brightMax = 255;
int Brightness = (int)(brightMin + currentBrightnessValue*(brightMax-brightMin));
float redPercent = 1.0;
float greenPercent = 1.0;
float bluePercent = 1.0;
float hue = (float)(currentHueValue*360.0);
advanceHueToRGB(hue, &redPercent, &greenPercent, &bluePercent);
// Indicate brightness of the laser
LaserPoints[i].RGBValue = RGB((int)(Brightness*redPercent), (int)(Brightness*greenPercent), (int)(Brightness*bluePercent));
// Special flag which tells the laser this is a corner point and also the last point
if(i == numPoints - 1)
{
LaserPoints[i].Status = 4096;//corner point
}else{
LaserPoints[i].Status = 0;//not a corner point
}
}
}
public:
void initLife()
{
newData = true;
currentSizeValue = 0;
currentHueValue = 0;
currentBrightnessValue = 0;
}
protected:
virtual void ProcessMessage(const osc::ReceivedMessage& m, const IpEndpointName& remoteEndpoint)
{
collection.processNewMessage(m);
}
};
int main(int argc, char* argv[])
{
LifeController control;
control.initLife();
if(!control.initLD())
{
return 1;
}
control.startListeningOnPort(PORT, &control);
while(true)
{
control.step();
control.setPointsFromCollection();
control.writeFrame();
control.displayFrame();
//Sleep(10);
}
control.killLD();
return 0;
}
|
4547988c22899803de296f6f78b9c30ecb7141a0
|
410310a17cf20792cd6055e0566f66a87eaeeda0
|
/ContainsDuplicate3.cc
|
6bba60835dc325f4a1ecb20ec9a070b035056d66
|
[] |
no_license
|
foreverhy/leetcode
|
cf63d9ef574b9d4bb9c42742a2ad04f5a6f2ec5e
|
3ef49ea27095f8ca6583417f2e021e93ac3e1f76
|
refs/heads/master
| 2016-09-10T09:50:12.221471
| 2015-11-29T07:26:58
| 2015-11-29T07:26:58
| 29,521,544
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 920
|
cc
|
ContainsDuplicate3.cc
|
#include "leet.h"
#include <algorithm>
#include <cstring>
#include <set>
class Solution{
public:
typedef long long i64;
bool containsNearbyAlmostDuplicate(vector<int> &nums, int k, int t) {
std::set<i64> set;
int size = nums.size();
for (int i = 0; i < size; ++i) {
if (i > k) {
set.erase(nums[i - k - 1]);
}
i64 left = static_cast<i64>(nums[i]) - t;
i64 right = static_cast<i64>(nums[i]) + t;
auto iter = set.lower_bound(left);
if (iter != set.end() && *iter <= right) {
return true;
}
set.insert(nums[i]);
}
return false;
}
};
int main(){
Solution slu;
vector<int> a {1, 2};
a = {0, 2147483647};
a = {0,10,22,15,0,5,22,12,1,5};
cout << slu.containsNearbyAlmostDuplicate(a, 3, 3) << endl;
return 0;
}
|
db066420b2590298ee9663a49bd35ffeede8f432
|
8e0b50f4046f8002fd03c2746af359c6227d044d
|
/src/TerminatingProcessLearningTriggeringKernel.cc
|
8377199e9f053029a30b2217d5a89b5ec4291611
|
[
"BSD-3-Clause"
] |
permissive
|
akhvorov/MultiVariatePointProcess
|
83a6e36c9d5acb0516adce1274113f3777afb7b8
|
5c8d3a85acf6ca703e4922abf85ca72fa5997fca
|
refs/heads/master
| 2020-04-15T23:56:39.195710
| 2019-06-07T05:43:14
| 2019-06-07T05:43:14
| 165,118,205
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,364
|
cc
|
TerminatingProcessLearningTriggeringKernel.cc
|
/**
* \file TerminatingProcessLearningTriggeringKernel.cc
* \brief The class implementation of TerminatingProcessLearningTriggeringKernel.
*/
#include <vector>
#include <cmath>
#include <functional>
#include <iostream>
#include "../include/TerminatingProcessLearningTriggeringKernel.h"
#include "../include/Utility.h"
#include "../include/GNUPlotWrapper.h"
void TerminatingProcessLearningTriggeringKernel::Initialize(const std::vector<Sequence>& data)
{
InitializeDimension(data);
num_sequences_ = data.size();
for(unsigned i = 0; i < num_dims_; ++ i)
{
std::vector<Eigen::MatrixXd> MatrixK(num_sequences_, Eigen::MatrixXd::Zero(num_dims_, num_rbfs_));
std::vector<Eigen::MatrixXd> MatrixG(num_sequences_, Eigen::MatrixXd::Zero(num_dims_, num_rbfs_));
for(unsigned c = 0; c < num_sequences_; ++ c)
{
const std::vector<Event>& seq = data[c].GetEvents();
if(all_timestamp_per_dimension_[c][i].size() > 0) // if infected
{
const double& i_time = all_timestamp_per_dimension_[c][i][0];
for(std::vector<Event>::const_iterator i_event = seq.begin(); i_event != seq.end(); ++ i_event)
{
const int& j = i_event->DimentionID;
const double& j_time = i_event->time;
if(j_time < i_time)
{
double deltaT_ji = i_time - j_time;
MatrixK[c].row(j) = ((- 0.5) * (((deltaT_ji - tau_.transpose().array()) / sigma_.transpose().array()).square())).exp();
MatrixG[c].row(j) = (sqrt2PIsigma_.array() * (((tau_.array() - deltaT_ji) / sqrt2sigma_.array()).unaryExpr(std::ptr_fun<double, double>(erfc)) - erfctau_sigma_.array())).transpose();
}else
{
break;
}
}
}else // if survival
{
for(std::vector<Event>::const_iterator i_event = seq.begin(); i_event != seq.end(); ++ i_event)
{
const int& j = i_event->DimentionID;
const double& j_time = i_event->time;
double deltaT_ji = data[c].GetTimeWindow() - j_time;
MatrixG[c].row(j) = (sqrt2PIsigma_.array() * (((tau_.array() - deltaT_ji) / sqrt2sigma_.array()).unaryExpr(std::ptr_fun<double, double>(erfc)) - erfctau_sigma_.array())).transpose();
}
}
}
arrayK.push_back(MatrixK);
arrayG.push_back(MatrixG);
}
}
void TerminatingProcessLearningTriggeringKernel::InitializeWithGraph(const std::vector<Sequence>& data)
{
InitializeDimension(data);
num_sequences_ = data.size();
for(unsigned i = 0; i < num_dims_; ++ i)
{
std::vector<Eigen::MatrixXd> MatrixK(num_sequences_, Eigen::MatrixXd::Zero(num_dims_, num_rbfs_));
std::vector<Eigen::MatrixXd> MatrixG(num_sequences_, Eigen::MatrixXd::Zero(num_dims_, num_rbfs_));
for(unsigned c = 0; c < num_sequences_; ++ c)
{
if(all_timestamp_per_dimension_[c][i].size() > 0) // if infected
{
const double& i_time = all_timestamp_per_dimension_[c][i][0];
for(std::set<unsigned>::const_iterator i_parent = graph_->nodes[i].parents.begin(); i_parent != graph_->nodes[i].parents.end(); ++ i_parent)
{
if((all_timestamp_per_dimension_[c][*i_parent].size() > 0) && (all_timestamp_per_dimension_[c][*i_parent][0] < i_time))
{
const int& j = *i_parent;
const double& j_time = all_timestamp_per_dimension_[c][j][0];
double deltaT_ji = i_time - j_time;
MatrixK[c].row(j) = ((- 0.5) * (((deltaT_ji - tau_.transpose().array()) / sigma_.transpose().array()).square())).exp();
MatrixG[c].row(j) = (sqrt2PIsigma_.array() * (((tau_.array() - deltaT_ji) / sqrt2sigma_.array()).unaryExpr(std::ptr_fun<double, double>(erfc)) - erfctau_sigma_.array())).transpose();
}
}
}else // if survival
{
for(std::set<unsigned>::const_iterator i_parent = graph_->nodes[i].parents.begin(); i_parent != graph_->nodes[i].parents.end(); ++ i_parent)
{
if(all_timestamp_per_dimension_[c][*i_parent].size() > 0)
{
const int& j = *i_parent;
const double& j_time = all_timestamp_per_dimension_[c][j][0];
double deltaT_ji = data[c].GetTimeWindow() - j_time;
MatrixG[c].row(j) = (sqrt2PIsigma_.array() * (((tau_.array() - deltaT_ji) / sqrt2sigma_.array()).unaryExpr(std::ptr_fun<double, double>(erfc)) - erfctau_sigma_.array())).transpose();
}
}
}
}
arrayK.push_back(MatrixK);
arrayG.push_back(MatrixG);
}
}
void TerminatingProcessLearningTriggeringKernel::PostProcessing()
{
double epsilon = 5e-2;
std::vector<Eigen::Map<Eigen::MatrixXd> > MatrixAlpha;
for(unsigned i = 0; i < num_dims_; ++ i)
{
MatrixAlpha.push_back(Eigen::Map<Eigen::MatrixXd>(parameters_.segment(i * num_rbfs_ * num_dims_, num_rbfs_ * num_dims_).data(), num_rbfs_, num_dims_));
}
Eigen::MatrixXd Alpha = Eigen::MatrixXd::Zero(num_dims_, num_dims_);
for(unsigned i = 0; i < num_dims_; ++ i)
{
MatrixAlpha[i].col(i) = Eigen::VectorXd::Zero(num_rbfs_);
Eigen::VectorXd parents = Eigen::VectorXd::Zero(num_dims_);
for(unsigned c = 0; c < num_sequences_; ++ c)
{
parents = parents.array() + arrayK[i][c].array().abs().rowwise().sum();
}
for(unsigned j = 0; j < num_dims_; ++ j)
{
if(parents(j) == 0)
{
MatrixAlpha[i].col(j) = Eigen::VectorXd::Zero(num_rbfs_);
}
}
for(unsigned j = 0; j < num_dims_; ++ j)
{
Alpha(j,i) = MatrixAlpha[i].col(j).norm();
}
// std::cout << MatrixAlpha[i] << std::endl << std::endl;
}
// std::cout << Alpha << std::endl;
Eigen::VectorXd colsum = Alpha.colwise().sum();
colsum = (colsum.array() > 0).select(colsum, 1);
Alpha = Alpha.array().rowwise() / colsum.transpose().array();
Alpha = (Alpha.array() < epsilon).select(0, Alpha);
Alpha = (Alpha.array() >= epsilon).select(1, Alpha);
std::cout << std::endl << "Recovered Structure" << std::endl << Alpha.cast<unsigned>() << std::endl << std::endl;
for(unsigned i = 0; i < num_dims_; ++ i)
{
for(unsigned j = 0; j < num_dims_; ++ j)
{
if(Alpha.cast<unsigned>()(i,j) == 0)
{
MatrixAlpha[j].col(i) = Eigen::VectorXd::Zero(num_rbfs_);
}
}
}
}
// MLE esitmation of the parameters
void TerminatingProcessLearningTriggeringKernel::fit(const std::vector<Sequence>& data, const OPTION& options)
{
if(graph_ == NULL)
{
TerminatingProcessLearningTriggeringKernel::Initialize(data);
}else
{
TerminatingProcessLearningTriggeringKernel::InitializeWithGraph(data);
}
options_ = options;
Optimizer opt(this);
switch (options_.excitation_regularizer)
{
case GROUP :
opt.ProximalGroupLasso(1e-1, options_.coefficients[LAMBDA], 1000, num_rbfs_);
break;
default :
opt.PLBFGS(0, 1e10);
break;
}
if(graph_ == NULL)
{
TerminatingProcessLearningTriggeringKernel::PostProcessing();
}
return;
}
void TerminatingProcessLearningTriggeringKernel::GetNegLoglikelihood(double& objvalue, Eigen::VectorXd& gradient)
{
gradient = Eigen::VectorXd::Zero(num_rbfs_ * num_dims_ * num_dims_);
std::vector<Eigen::Map<Eigen::MatrixXd> > MatrixAlpha;
for(unsigned i = 0; i < num_dims_; ++ i)
{
MatrixAlpha.push_back(Eigen::Map<Eigen::MatrixXd>(parameters_.segment(i * num_rbfs_ * num_dims_, num_rbfs_ * num_dims_).data(), num_rbfs_, num_dims_));
}
std::vector<Eigen::Map<Eigen::MatrixXd> > GradMatrixAlpha;
for(unsigned i = 0; i < num_dims_; ++ i)
{
GradMatrixAlpha.push_back(Eigen::Map<Eigen::MatrixXd>(gradient.segment(i * num_rbfs_ * num_dims_, num_rbfs_ * num_dims_).data(), num_rbfs_, num_dims_));
}
objvalue = 0;
for(unsigned i = 0; i < num_dims_; ++ i)
{
if((MatrixAlpha[i].colwise().sum().array() != 0).any()) // at least has one valid parent
{
double local_obj = 0;
for(unsigned c = 0; c < num_sequences_; ++ c)
{
double intensity_c = (arrayK[i][c] * MatrixAlpha[i]).trace() + 1e-4; // to make optimization stable since we do not have a base intensity
double intensity_integral_c = (arrayG[i][c] * MatrixAlpha[i]).trace();
if(all_timestamp_per_dimension_[c][i].size() > 0) // if infected
{
Eigen::VectorXd source_identifier = arrayK[i][c].array().abs().rowwise().sum();
if((source_identifier.array() != 0).any()) // not a source node
{
GradMatrixAlpha[i] = GradMatrixAlpha[i].array() + arrayK[i][c].transpose().array() / intensity_c - arrayG[i][c].transpose().array();
local_obj += (log(intensity_c) - intensity_integral_c);
}
}else // survival
{
GradMatrixAlpha[i] = GradMatrixAlpha[i].array() - arrayG[i][c].transpose().array();
local_obj -= intensity_integral_c;
}
}
objvalue += local_obj;
}
}
gradient = -gradient.array() / num_sequences_;
objvalue = -objvalue / num_sequences_;
}
// This virtual function requires process-specific implementation. It calculates the negative loglikelihood of the given data. This function must be called after the Initialize method to return the negative loglikelihood of the data with respect to the current parameters.
// The returned negative loglikelihood is stored in the variable objvalue;
// The returned gradient vector wrt the current parameters is stored in the variable Gradient;
void TerminatingProcessLearningTriggeringKernel::NegLoglikelihood(double& objvalue, Eigen::VectorXd& gradient)
{
if(all_timestamp_per_dimension_.size() == 0)
{
std::cout << "Process is uninitialzed with any data." << std::endl;
return;
}
GetNegLoglikelihood(objvalue, gradient);
switch (options_.excitation_regularizer)
{
case L22 :
gradient = gradient.array() + options_.coefficients[LAMBDA] * parameters_.array();
objvalue = objvalue + 0.5 * options_.coefficients[LAMBDA] * parameters_.squaredNorm();
return;
case NONE :
return;
default :
return;
}
}
// Return the stochastic gradient on the random sample k.
void TerminatingProcessLearningTriggeringKernel::Gradient(const unsigned &k, Eigen::VectorXd& gradient)
{
return;
}
// This virtual function requires process-specific implementation. It returns the intensity value on each dimension in the variable intensity_dim for the given sequence stored in data and the given time t;
// This function returns the summation of the individual intensity function on all dimensions.
double TerminatingProcessLearningTriggeringKernel::Intensity(const double& t, const Sequence& data, Eigen::VectorXd& intensity_dim)
{
return 0;
}
// This virtual function requires process-specific implementation. It returns the upper bound of the intensity function on each dimension at time t given the history data in the variable intensity_upper_dim;
// This function returns the summation of the individual intensity upper bound on all dimensions.
double TerminatingProcessLearningTriggeringKernel::IntensityUpperBound(const double& t, const double& L, const Sequence& data, Eigen::VectorXd& intensity_upper_dim)
{
return 0;
}
// This virtual function requires process-specific implementation. It returns the upper bound of the intensity function on each dimension at time t given the history data in the variable intensity_upper_dim;
// This function returns the integral of the intensity from a to b
double TerminatingProcessLearningTriggeringKernel::IntensityIntegral(const double& lower, const double& upper, const Sequence& data)
{
return 0;
}
// This function predicts the next event by simulation;
double TerminatingProcessLearningTriggeringKernel::PredictNextEventTime(const Sequence& data, const unsigned& num_simulations)
{
return 0;
}
void TerminatingProcessLearningTriggeringKernel::PlotTriggeringKernel(const unsigned& dim_m, const unsigned& dim_n, const double& T, const double& delta)
{
unsigned num_points = T / delta;
Eigen::VectorXd x = Eigen::VectorXd::LinSpaced(num_points, 0, T);
Eigen::VectorXd y = Eigen::VectorXd::Zero(num_points);
std::vector<Eigen::Map<Eigen::MatrixXd> > MatrixAlpha;
for(unsigned i = 0; i < num_dims_; ++ i)
{
MatrixAlpha.push_back(Eigen::Map<Eigen::MatrixXd>(parameters_.segment(i * num_rbfs_ * num_dims_, num_rbfs_ * num_dims_).data(), num_rbfs_, num_dims_));
}
for(unsigned i = 0; i < num_points; ++ i)
{
y(i) = ((-((x(i) - tau_.array()) / sqrt2sigma_.array()).square()).exp()).matrix().transpose() * MatrixAlpha[dim_n].col(dim_m);
}
std::vector<double> gp_x(num_points,0);
std::vector<double> gp_y(num_points,0);
for(unsigned i = 0; i < num_points; ++ i)
{
gp_x[i] = x(i);
gp_y[i] = y(i);
}
Plot plot("wxt size 640, 400","time", "intensity");
plot.PlotScatterLine(gp_x, gp_y, "TriggeringKernel");
}
|
7a5546b32bc1c3f6578887a645289c42bcf5d900
|
bcf138c82fcba9acc7d7ce4d3a92618b06ebe7c7
|
/rdr2/0x804425C4BBD00883.cpp
|
283fae2cc4d75839f37168524ece92266aa65444
|
[] |
no_license
|
DeepWolf413/additional-native-data
|
aded47e042f0feb30057e753910e0884c44121a0
|
e015b2500b52065252ffbe3c53865fe3cdd3e06c
|
refs/heads/main
| 2023-07-10T00:19:54.416083
| 2021-08-12T16:00:12
| 2021-08-12T16:00:12
| 395,340,507
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 584
|
cpp
|
0x804425C4BBD00883.cpp
|
// camera_photomode.ysc @ L4003
bool func_110()
{
int iVar0;
if (func_151())
{
iVar0 = TASK::_0x804425C4BBD00883(Global_35);
if (func_152(iVar0) == 2041469314 || func_152(iVar0) == -77448735)
{
return false;
}
else
{
if (func_152(iVar0) == 0)
{
if (SCRIPTS::_GET_NUMBER_OF_REFERENCES_OF_SCRIPT_WITH_NAME_HASH(joaat("COFFEE_DRINKING")) > 0 || SCRIPTS::_GET_NUMBER_OF_REFERENCES_OF_SCRIPT_WITH_NAME_HASH(joaat("STEW_EATING")) > 0)
{
return false;
}
}
return true;
}
}
return false;
}
|
64efb0c16e7d94889ab49bad8415cafe93e53cdb
|
b207b13659b33b7d6b7b721fc7db811465e6d932
|
/old2/types/get_time.cpp
|
e99df193663518ae3cf9adc4ec9bfb36ee0ba8ad
|
[] |
no_license
|
BackupTheBerlios/reshaked-svn
|
c99570088cb79a2b1900115a3d1f5a9c095f59d5
|
d9a6b614b3d8aa486d8b5bf05e46fe564476dae4
|
refs/heads/master
| 2020-06-02T18:17:32.828688
| 2008-08-20T17:28:16
| 2008-08-20T17:28:16
| 40,818,420
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 710
|
cpp
|
get_time.cpp
|
//
// C++ Implementation: get_time
//
// Description:
//
//
// Author: Juan Linietsky <reduzio@gmail.com>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "get_time.h"
namespace ReShaked {
GetTime *GetTime::singleton=0;
unsigned int GetTime::get_time_msec() {
if (!singleton)
return 0;
unsigned int sec,usec;
singleton->get_time(sec,usec);
sec*=1000;
usec/=1000;
return sec+usec;
}
Sint64 GetTime::get_time_usec() {
if (!singleton)
return 0;
unsigned int sec,usec;
singleton->get_time(sec,usec);
Sint64 time=sec;
time*=1000000;
time+=(Sint64)usec;
return time;
}
GetTime::GetTime() {
singleton=this;
}
GetTime::~GetTime() {}
}
|
73029f4373148a22b4fb5e33b82549b005f069b5
|
31ac07ecd9225639bee0d08d00f037bd511e9552
|
/TestDrawPic/RenderController/StatesController.h
|
689aa69d076fd4a34cb542614d1c3cecc8100d3e
|
[] |
no_license
|
litao1009/SimpleRoom
|
4520e0034e4f90b81b922657b27f201842e68e8e
|
287de738c10b86ff8f61b15e3b8afdfedbcb2211
|
refs/heads/master
| 2021-01-20T19:56:39.507899
| 2016-07-29T08:01:57
| 2016-07-29T08:01:57
| 64,462,604
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,953
|
h
|
StatesController.h
|
#ifndef StatesController_h__
#define StatesController_h__
#pragma once
#include "irrEngine/IRenderController.h"
#include "irrEngine/MetaRenderController.h"
#include <map>
template<typename State>
class StatesController : public IRenderController
{
public:
typedef typename std::shared_ptr<StatesController<State>> SPtr;
public://IRenderController
StatesController(const SRenderContextWPtr& rc):IRenderController(rc) {}
virtual void Init()
{
}
virtual bool OnGUIEvent(const irr::SEvent& evt)
{
return StateControllers_[CurrentState_]->OnGUIEvent(evt);
}
virtual bool OnPreEvent(const irr::SEvent& evt)
{
return StateControllers_[CurrentState_]->OnPreEvent(evt);
}
virtual bool OnPostEvent(const irr::SEvent& evt)
{
return StateControllers_[CurrentState_]->OnPostEvent(evt);
}
virtual void OnResize()
{
StateControllers_[CurrentState_]->OnResize();
}
virtual bool PreRender3D()
{
return StateControllers_[CurrentState_]->PreRender3D();
}
virtual void PostRender3D()
{
StateControllers_[CurrentState_]->PostRender3D();
}
virtual bool PreRender2D()
{
return StateControllers_[CurrentState_]->PreRender2D();
}
virtual void PostRender2D()
{
StateControllers_[CurrentState_]->PostRender2D();
}
public:
void AddController(const State& state, const IRenderControllerSPtr& controller)
{
_AddState(state);
StateControllers_[state]->PushController(controller);
}
State GetCurrentState() const { return CurrentState_; }
void SetCurrentState(const State& state)
{
_AddState(state);
CurrentState_ = state;
}
private:
void _AddState(const State& state)
{
if ( !StateControllers_[state] )
{
StateControllers_[state] = std::make_shared<MetaRenderController>();
StateControllers_[state]->SetRenderContextWPtr(GetRenderContextSPtr());
}
}
State CurrentState_;
std::map<State,MetaRenderControllerSPtr> StateControllers_;
};
#endif // StatesController_h__
|
458d4113abe1f419bc3121bb633323f5ff7f4b22
|
cdf9e136afd7460ddac7acd73aa95b3188e83807
|
/block.cpp
|
3684edff64d3a04ad2ae7680fce5d7103ee596c7
|
[
"MIT"
] |
permissive
|
peakstack/Simple-Blockchain
|
e2edc050090950f404fbe251af74a4edc2b934ad
|
36f5707a402548c2c69241f903da13a4f48c5b65
|
refs/heads/master
| 2020-04-17T15:57:26.850080
| 2020-01-10T16:30:58
| 2020-01-10T16:30:58
| 166,720,774
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 996
|
cpp
|
block.cpp
|
#include "block.h"
void block::mine(uint_fast64_t difficulty)
{
char *hash_string_c = new char[difficulty + 1];
uint_fast64_t rounds = 0;
while(rounds < difficulty)
{
hash_string_c[rounds] = '0';
++rounds;
}
hash_string_c[difficulty] = '\0';
std::string hash_string(hash_string_c);
delete[] hash_string_c;
do
{
++m_nonce;
m_hash = calculate_hash();
}
while (m_hash.substr(0, difficulty) != hash_string);
std::cout << "block mined: " << m_hash.c_str() << std::endl;
}
std::string block::calculate_hash()
{
std::stringstream string_stream;
string_stream << m_index;
string_stream << m_previous_block->m_hash;
string_stream << m_timestamp;
string_stream << m_nonce;
Keccak keccak;
return keccak(string_stream.str());
}
block::block(uint_fast64_t index) : m_index(index)
{
m_nonce = 0;
m_timestamp = time(nullptr);
}
void block::update() {
m_hash = calculate_hash();
}
|
4b7a8829e4d9a0bf98460577a14f3d086bee2125
|
b2ba24e10cb6f2ad85651ee0a967cce97c3b0cd1
|
/Lista 1/EX2.cpp
|
cd9bbc1eabbbae37c5850ee09b661e593f263200
|
[] |
no_license
|
Ropaca/ED_UFBA
|
e963dad08d857fc8f3892a3f4840be1ad065dbe1
|
257f0b731bac08045e9ad32d1f9b26570b4ddc85
|
refs/heads/master
| 2020-05-18T06:08:46.784375
| 2014-09-30T19:36:34
| 2014-09-30T19:36:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 356
|
cpp
|
EX2.cpp
|
#include <stdio.h>
#include <stdlib.h>
int maior (int a, int b)
{
if(a<b)
printf ("O maior valor = %d, O segundo maior valor = %d", b, a);
else
printf ("O maior valor = %d, O segundo maior valor = %d", a, b);
}
int main()
{
int A, B;
printf("Digite um valor\n");
scanf("%d",&A);
printf("Digite outro valor\n");
scanf("%d",&B);
maior (A, B);
}
|
9e2c846807bc8238bd0d7228a20d5892b97bcbfc
|
84737883b1a0dc218331027d31e9c67584e7da2e
|
/SmallbankBenchmark/SmallbankSiteConfiguration.h
|
1523b1242dc2b02808bd3c30984bd9fd2bf0837d
|
[
"Apache-2.0"
] |
permissive
|
Cavalia/Cavalia
|
b12940211bd539123dca21837afda84f7f9eb986
|
d6a48ad5b4e28301ca02512ce7b70de98af003f5
|
refs/heads/master
| 2021-01-18T12:12:16.338787
| 2018-09-27T03:48:18
| 2018-09-27T03:48:18
| 46,721,730
| 121
| 33
| null | 2016-03-19T05:10:36
| 2015-11-23T13:24:40
|
C++
|
UTF-8
|
C++
| false
| false
| 807
|
h
|
SmallbankSiteConfiguration.h
|
#pragma once
#ifndef __CAVALIA_TPCC_BENCHMARK_SMALLBANK_SITE_CONFIGURATION_H__
#define __CAVALIA_TPCC_BENCHMARK_SMALLBANK_SITE_CONFIGURATION_H__
#include <Benchmark/BenchmarkSiteConfiguration.h>
#include "SmallbankMeta.h"
namespace Cavalia {
namespace Benchmark {
namespace Smallbank {
class SmallbankSiteConfiguration : public BenchmarkSiteConfiguration {
public:
SmallbankSiteConfiguration(const size_t &core_count, const size_t node_count) : BenchmarkSiteConfiguration(core_count, node_count) {}
~SmallbankSiteConfiguration() {}
virtual size_t GetTableCount() const {
return kTableCount;
}
private:
SmallbankSiteConfiguration(const SmallbankSiteConfiguration&);
SmallbankSiteConfiguration& operator=(const SmallbankSiteConfiguration&);
};
}
}
}
#endif
|
7302bf71b5d0f71b3692b34f51846ad9a1f7dabe
|
c3d4f43717d0c098a9bb99f1c60d0688f5057e1d
|
/baekjoon/acm.cpp
|
c59a130202a5c1906ddc483ceb3e858774ad417d
|
[] |
no_license
|
moneymaniacteam/algorithm
|
96701ab7e140ec26c7363fccd1929c8e948319ff
|
516175e33bc1d42d556fa43bf1fce0725eaa12c4
|
refs/heads/main
| 2023-05-05T12:28:20.234649
| 2021-05-25T16:56:30
| 2021-05-25T16:56:30
| 362,050,705
| 0
| 0
| null | 2021-04-27T09:13:19
| 2021-04-27T09:13:18
| null |
UTF-8
|
C++
| false
| false
| 801
|
cpp
|
acm.cpp
|
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int ary[101];
int line[101];
pair<int, int> set[101];
int setcnt = 0;
int cnt = 0;
int j = 0;
int main() {
int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++) {
scanf("%d", ary + i);
}
for (int i = 0; i < n; i++) {
set[j].first = ary[i];
set[j].second = ary[i];
setcnt++;
while (1) {
if (ary[i + 1] > ary[i]) {
set[j].second = ary[i];
i++;
}
else {
j++;
break;
}
}
}
for(int i = 0; i < setcnt; i++) {
bool check = false;
for(int m = 0; m < k; m++) {
if(line[m] < set[i].first) {
line[m] = set[i].second;
check = true;
break;
}
}
if(!check) {
cout <<"NO";
return 0;
}
}
cout << "YES";
return 0;
}
|
91b954d808babcd4404dd5fc23e62778dfa9f129
|
697d8dcb9b39ef858cad57d7eced694590821ded
|
/AashrayBhaiyaKanjoosHain.cpp
|
a8c529c5f45ffb482e45290690084d6efba4620a
|
[] |
no_license
|
KevinMathewT/Competitive-Programming
|
e1dcdffd087f8a1d5ca29ae6189ca7fddbdc7754
|
e7805fe870ad9051d53cafcba4ce109488bc212d
|
refs/heads/master
| 2022-02-14T09:37:31.637330
| 2020-09-26T16:15:26
| 2020-09-26T16:15:26
| 147,362,660
| 4
| 4
| null | 2022-02-07T11:13:38
| 2018-09-04T14:52:29
|
C++
|
UTF-8
|
C++
| false
| false
| 2,738
|
cpp
|
AashrayBhaiyaKanjoosHain.cpp
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Author - Kevin Mathew
// Birla Institute of Technology, Mesra
ll n, q, max_depth, depth[100010], hash[100010], revHash[100010], parent[18][100010], vis[100010];
char c[100010];
vector<ll> tree[100010];
const ll p = 31, m = 1e9 + 9;
void findParents(ll x, ll d, ll h, ll revH, ll p_pow){
max_depth = max(max_depth, d);
hash[x] = (h + (((c[x] - 'a' + 1) * p_pow) % m)) % m;
revHash[x] = (((revH * p) % m) + (c[x] - 'a' + 1)) % m;
depth[x] = d;
vis[x] = 1;
for(ll i=0;i<tree[x].size();i++)
if(vis[tree[x][i]] != 1){
parent[0][tree[x][i]] = x;
findParents(tree[x][i], d + 1, hash[x], revHash[x], (p_pow * p) % m);
}
}
void findGrandParents(){
for(ll i=1;i<=17;i++)
for(ll j=1;j<=n;j++)
if(parent[i-1][j] != -1)
parent[i][j] = parent[i-1][parent[i-1][j]];
}
ll power(ll x, ll y){
if(y == 1) return x % m;
if(y == 0) return 1;
if(y % 2 == 0)
return modExpo((x * x) % m, y / 2);
else
return (x * modExpo((x * x) % m, y / 2)) % m;
}
ll LCA(ll u, ll v){
if(u == v) return u;
ll diff = depth[u] - depth[v];
if(diff < 0){
swap(u, v);
diff = -diff;
}
for(ll i=0;i<17;i++)
if((1<<i) & diff)
u = parent[i][u];
if(u == v)
return u;
for(ll i=17;i>=0;i--)
if(parent[i][u] != parent[i][v]){
u = parent[i][u];
v = parent[i][v];
}
return parent[0][u];
}
ll raise(ll v, ll h){
for(ll i=0;i<18;i++)
if((1<<i) & h)
v = parent[i][v];
return v;
}
ll query(ll u, ll v){
ll lca = LCA(u, v);
ll path = (depth[u] - depth[lca]) + (depth[v] - depth[lca]) + 1;
ll left = (depth[u] - depth[lca]);
ll right = (depth[v] - depth[lca]);
ll l = 0, r = path / 2, mid;
while(l < r){
mid = (l + r) / 2;
ll h1 = 0, h2 = 0;
ll f = u, s = v;
if(mid <= left){
f = raise(f, mid);
h1 = (((hash[u] - hash[f] + m) % m) * (power(power(p, depth[f]-1)), m-2)) % m;
}
if(mid == left+1){
if(lca == 1)
h1 = hash[u];
else
h1 = (((hash[u] - hash[parent[0][lca]] + m) % m) * (power(power(p, depth[parent[0][lca]]-2)), m-2)) % m;
}
if(mid > left+1){
if(lca == 1)
h1 = hash[u];
else
h1 = (((hash[u] - hash[parent[0][lca]] + m) % m) * (power(power(p, depth[parent[0][lca]]-2)), m-2)) % m;
ll temp = mid;
temp -= left;
}
}
}
void te(){
max_depth = 0;
cin >> n;
for(ll i=0;i<n-1;i++){
ll u, v;
cin >> u >> v;
tree[u].push_back(v);
tree[v].push_back(u);
}
for(ll i=0;i<100010;i++)
for(ll j=0;j<18;i++)
parent[j][i] = -1;
}
int main()
{
freopen("input.txt", "r", stdin); //Comment
freopen("output.txt", "w", stdout); //this out.
ios::sync_with_stdio(false); //Not
cin.tie(NULL); //this.
cout.tie(0); //or this.
te();
return 0;
}
|
4b6048c2a9285160ccf3b8ad8c28d3852cab34df
|
f0d9fff45f20f35408935195459c726b7be6a62a
|
/Game.cpp
|
f6174baf00913538eb6c54767683bed321d3ea81
|
[] |
no_license
|
TMalicki/PathFinder-algorithms
|
5c67ee94bd5666d383ef80bf7fcfdcaa85ef0ff5
|
447ed02f0a6ccc65fe6c3ffdd931d6497de93528
|
refs/heads/master
| 2021-01-08T08:24:05.445484
| 2020-03-27T17:26:56
| 2020-03-27T17:26:56
| 241,970,186
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,343
|
cpp
|
Game.cpp
|
#include "Game.h"
Game::Game(sf::Vector2i amountOfTiles, sf::Vector2f sizeOfTiles)
{
window = new sf::RenderWindow(sf::VideoMode(amountOfTiles.x * sizeOfTiles.x, amountOfTiles.y * sizeOfTiles.y), "PathFinder");
map = new Map(amountOfTiles, sizeOfTiles);
editor = new Editor(map);
dt = 0.0;
double delayAlgorithm = 0.0;
double timeAlgorithmCalculation = 0.0;
timeShow = false;
algorithmNumber = 0;
}
void Game::run()
{
while (window->isOpen())
{
dt = clock.restart().asSeconds();
if (editor->isEditorRunning())
{
chosenTile = editor->run(window, event, map, holdMouseButton);
}
else
{
if (algorithm == nullptr)
{
chooseAlgorithm(algorithmNumber);
delayAlgorithm = 0.0;
timeAlgorithmCalculation = 0.0;
}
else
{
if (algorithm->isAlgorithmRunning() == true)
{
delayAlgorithm += dt;
timeAlgorithmCalculation += dt;
if (delayAlgorithm > 0.02)
{
algorithm->run();
delayAlgorithm = 0.0;
}
}
else
{
algorithm->getPath();
if (timeShow == false)
{
cout << "Time: " << timeAlgorithmCalculation << endl;
delayAlgorithm = 0.0;
timeAlgorithmCalculation = 0.0;
timeShow = true;
}
}
}
}
draw();
update();
}
}
void Game::reload()
{
editor->setEditorRunning(true);
algorithm->setAlgorithmRunning(false);
delayAlgorithm = 0.0;
timeAlgorithmCalculation = 0.0;
timeShow = false;
delete algorithm;
algorithm = nullptr;
}
void Game::chooseAlgorithm(int algorithmNumber)
{
switch (algorithmNumber)
{
case 0:
{
if (algorithm != nullptr)
{
delete algorithm;
algorithm = nullptr;
}
cout << "\nBFS\n";
algorithm = new BFS(*map);
}
break;
case 1:
{
if (algorithm != nullptr)
{
delete algorithm;
algorithm = nullptr;
}
cout << "\nGreedy\n";
algorithm = new Greedy(*map);
}
break;
case 2:
{
if (algorithm != nullptr)
{
delete algorithm;
algorithm = nullptr;
}
cout << "\nA*\n";
algorithm = new A_Star(*map);
}
}
}
void Game::update()
{
holdButton();
while (window->pollEvent(event))
{
if (event.type == sf::Event::Closed)
window->close();
if (event.type == sf::Event::KeyPressed)
{
if (event.key.code == sf::Keyboard::Escape) window->close();
if (event.key.code == sf::Keyboard::E)
{
reload();
}
if (event.key.code == sf::Keyboard::Enter)
{
editor->setEditorRunning(false);
}
}
if (event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == sf::Mouse::Left)
{
isKeyPressed = true;
}
if (event.type == sf::Event::MouseButtonReleased)
{
isKeyPressed = false;
if (event.mouseButton.button == sf::Mouse::Left && editor->isEditorRunning() == true)
{
if (map->getFinishTileExistance() == false) map->setFinishTile(chosenTile);
else if (map->getStartTileExistance() == false) map->setStartTile(chosenTile);
else map->setObstacleTiles(chosenTile);
}
if (event.mouseButton.button == sf::Mouse::Right && editor->isEditorRunning() == true)
{
map->deleteTile(chosenTile);
}
}
if (event.type == sf::Event::MouseWheelMoved)
{
int mouseDelta = event.mouseWheel.delta;
if (mouseDelta > 0)
{
algorithmNumber += 1;
}
else if(mouseDelta < 0)
{
algorithmNumber -= 1;
}
if (algorithmNumber > 2)
{
algorithmNumber = 0;
}
else if (algorithmNumber < 0)
{
algorithmNumber = 2;
}
if (algorithmNumber == 0) cout << "\nBFS\n";
else if (algorithmNumber == 1) cout << "\nGreedy\n";
else if (algorithmNumber == 2) cout << "\nA*\n";
}
}
}
void Game::draw()
{
window->clear(sf::Color::White);
/// draw
for (int i = 0; i < map->getBoard().size(); i++)
{
window->draw(map->getBoard()[i]->getTile());
if (editor->isEditorRunning() == false)
{
window->draw(map->getBoard()[i]->getPosX());
window->draw(map->getBoard()[i]->getPosY());
}
}
window->display();
}
void Game::holdButton()
{
if (isKeyPressed)
{
holdMouseButton += dt;
cout << holdMouseButton << endl;
}
else holdMouseButton = 0.0;
}
|
466f4d8aa13387756a7090caad9c539fd3a07008
|
5c9b213e914ab609b2ba91b78eb239125cb1c9dd
|
/controller.cpp
|
d8eb72f402ebbb5d1efac2da5c524eaa04aa55f5
|
[] |
no_license
|
zbahr/evolving-ms-pacman
|
66f66768b2ffbb46a9b9320e47d73126eea735e9
|
9ce0114aee150690127cfdf8bd0682279e5ac42c
|
refs/heads/master
| 2023-08-27T11:18:19.538382
| 2021-11-07T21:08:43
| 2021-11-07T21:08:43
| 425,613,204
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,523
|
cpp
|
controller.cpp
|
// controller.cpp
// CS 5401 - Assignment 2c - Competitive Coevolutionary Search
//
// Created by Zachary Bahr on 10/31/18
// Copyright © 2018 Zachary Bahr. All rights reserved.
#include "controller.h"
// Add a vertex to the state eval tree
Vertex Controller::addVertex(Node n) {
n.id = currentNodeId;
currentNodeId++;
return add_vertex(n, stateEvalTree);
}
// Add an edge between vertices in the state eval tree
void Controller::addEdge(const Vertex& source, const Vertex& destination) {
add_edge(source, destination, stateEvalTree);
return;
}
// Links the sub-tree that has been crossed over
void Controller::setNewSubTree(const Vertex& source, const Vertex& adjDestination) {
AdjacencyIterator ai, aend;
for (tie(ai, aend) = adjacent_vertices(adjDestination, stateEvalTree); ai != aend; ai++) {
if (ai != aend) {
addEdge(source, *ai);
}
}
return;
}
// Prunes the tree starting from the pruneRoot vertex
void Controller::prune(const Vertex& pruneRoot) {
AdjacencyIterator ai, aend;
for (tie(ai, aend) = adjacent_vertices(pruneRoot, stateEvalTree); ai != aend; ai++) {
if (ai != aend) {
remove_edge(pruneRoot, *ai, stateEvalTree);
break;
}
}
std::queue<Vertex> verticesToRemove;
std::vector<Node> nodesToRemove;
verticesToRemove.push(pruneRoot);
nodesToRemove.push_back(stateEvalTree[pruneRoot]);
// Remove the edges first
do {
if (stateEvalTree[verticesToRemove.front()].isFunction) {
InEdgeIterator ei, eend;
for (tie(ei, eend) = in_edges(verticesToRemove.front(), stateEvalTree); ei != eend; ei++) {
if (ei != eend) {
verticesToRemove.push(source(*ei, stateEvalTree));
nodesToRemove.push_back(stateEvalTree[source(*ei, stateEvalTree)]);
remove_edge(*ei, stateEvalTree);
}
break;
}
for (tie(ei, eend) = in_edges(verticesToRemove.front(), stateEvalTree); ei != eend; ei++) {
if (ei != eend) {
verticesToRemove.push(source(*ei, stateEvalTree));
nodesToRemove.push_back(stateEvalTree[source(*ei, stateEvalTree)]);
remove_edge(*ei, stateEvalTree);
}
break;
}
}
verticesToRemove.pop();
}
while (!verticesToRemove.empty());
// Remove vertices (nodes) next
for (auto it = nodesToRemove.begin(); it != nodesToRemove.end(); it++) {
VertexIterator vi, vend;
for (boost::tie(vi, vend) = boost::vertices(stateEvalTree); vi != vend; vi++) {
if (stateEvalTree[*vi].id == it->id) {
remove_vertex(*vi, stateEvalTree);
break;
}
}
}
return;
}
// After the mating has finished, update states
void Controller::updateState() {
finalGameScore = 0;
std::queue<Vertex> newEvalNodes;
std::vector<Vertex> newTermVertices;
std::vector<Vertex> newFuncVertices;
std::vector<Vertex> newVertices;
VertexIterator vi, vend;
for (tie(vi, vend) = boost::vertices(stateEvalTree); vi != vend; vi++) {
if (stateEvalTree[*vi].isFunction) { newFuncVertices.push_back(*vi); }
else if (!stateEvalTree[*vi].isFunction) {
newEvalNodes.push(*vi);
newTermVertices.push_back(*vi);
}
newVertices.push_back(*vi);
}
evalNodes = newEvalNodes;
termVertices = newTermVertices;
funcVertices = newFuncVertices;
vertices = newVertices;
return;
}
// Gets a random terminal node (crossover point)
Vertex Controller::getRandomTermVertex() const {
auto it = termVertices.begin();
std::advance(it, rand() % evalNodes.size());
return *it;
}
// Gets a random function node (crossover point)
Vertex Controller::getRandomFuncVertex() const {
auto it = funcVertices.begin();
std::advance(it, rand() % funcVertices.size());
return *it;
}
// Gets a random node (crossover point)
Vertex Controller::getRandomVertex() const {
auto it = vertices.begin();
std::advance(it, rand() % vertices.size());
return *it;
}
// Gets the id of the root of the tree
int Controller::getRoot() const {
VertexIterator vi, vend;
for (tie(vi, vend) = boost::vertices(stateEvalTree); vi != vend; vi++) {
OutEdgeIterator ei, eend;
tie(ei, eend) = boost::out_edges(*vi, stateEvalTree);
if (ei == eend) { return stateEvalTree[*vi].id; }
}
return -1;
}
// Puts the neighboring vertices of v into the queue
void Controller::getNeighbors(const Vertex& v, std::queue<Vertex>& verticesToAdd) const {
InEdgeIterator ei, eend;
for (tie(ei, eend) = in_edges(v, stateEvalTree); ei != eend; ei++) {
verticesToAdd.push(source(*ei, stateEvalTree));
}
return;
}
// Return the in degree of the vertex v
int Controller::inDegree(const Vertex& v) const {
return in_degree(v, stateEvalTree);
}
// Determines whether v is a function or terminal vertex
bool Controller::isFunction(const Vertex& v) const
{
if (stateEvalTree[v].isFunction) { return true; }
return false;
}
// Debugging function
void Controller::print() const {
/*boost::write_graphviz(std::cout, stateEvalTree, boost::make_label_writer(boost::get(&Node::debugText, stateEvalTree)));
std::cout << finalGameScore << std::endl << std::endl;*/
return;
}
|
4fc994a0540ba86003c355f12752e1820cc62f8b
|
c08a26d662bd1df1b2beaa36a36d0e9fecc1ebac
|
/uifw/AvKon/aknhlist/src/aknsinglecolumnstylesubtitlerow.cpp
|
38844f15c7448095a66ca00f121b9fd561531542
|
[] |
no_license
|
SymbianSource/oss.FCL.sf.mw.classicui
|
9c2e2c31023256126bb2e502e49225d5c58017fe
|
dcea899751dfa099dcca7a5508cf32eab64afa7a
|
refs/heads/master
| 2021-01-11T02:38:59.198728
| 2010-10-08T14:24:02
| 2010-10-08T14:24:02
| 70,943,916
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 10,123
|
cpp
|
aknsinglecolumnstylesubtitlerow.cpp
|
/*
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: Implementation for CAknSingleColumnStyleSubtitleRow class.
*
*/
#include <AknUtils.h>
#include <aknlayoutscalable_avkon.cdl.h>
#include "akntree.h"
#include "aknsinglecolumnstylesubtitlerow.h"
#include "akntreelistinternalconstants.h"
using AknTreeListIconID::KDefault;
using AknTreeListIconID::KNone;
// ======== MEMBER FUNCTIONS ========
// ---------------------------------------------------------------------------
// Two-phased constructor.
// ---------------------------------------------------------------------------
//
CAknSingleColumnStyleSubtitleRow* CAknSingleColumnStyleSubtitleRow::NewLC(
const TDesC& aText, TUint32 aFlags )
{
CAknSingleColumnStyleSubtitleRow* self =
new ( ELeave ) CAknSingleColumnStyleSubtitleRow( aFlags );
CleanupStack::PushL( self );
self->ConstructL( aText );
return self;
}
// ---------------------------------------------------------------------------
// Destructor.
// ---------------------------------------------------------------------------
//
CAknSingleColumnStyleSubtitleRow::~CAknSingleColumnStyleSubtitleRow()
{
delete iText;
}
// ---------------------------------------------------------------------------
// Returns the text set for the subtitle row.
// ---------------------------------------------------------------------------
//
const TDesC& CAknSingleColumnStyleSubtitleRow::Text() const
{
return iText ? *iText : KNullDesC();
}
// ---------------------------------------------------------------------------
// Allocates new heap based descriptor for the text, and if the allocation
// succeeds, deletes the old descriptor and replaces it with the new.
// ---------------------------------------------------------------------------
//
void CAknSingleColumnStyleSubtitleRow::SetTextL( const TDesC& aText,
TBool aDrawNow )
{
HBufC* tmp = aText.AllocL();
delete iText;
iText = tmp;
if ( aDrawNow )
{
__ASSERT_DEBUG( Root(), User::Invariant() );
Root()->ItemModified( this );
}
}
// ---------------------------------------------------------------------------
// Returns the icon ID set for the specified subtitle row icon type.
// ---------------------------------------------------------------------------
//
TInt CAknSingleColumnStyleSubtitleRow::Icon( TIconType aType ) const
{
TInt iconId = KDefault;
switch ( aType )
{
case EExpandedIcon:
iconId = iExpandedIcon;
break;
case ECollapsedIcon:
iconId = iCollapsedIcon;
break;
case EOptIcon:
iconId = iOptIcon;
break;
case EHighlightedExpandedIcon:
iconId = iHighlightedExpandedIcon;
break;
case EHighlightedCollapsedIcon:
iconId = iHighlightedCollapsedIcon;
break;
case EHighlightedOptIcon:
iconId = iHighlightedOptIcon;
break;
default:
break;
}
return iconId;
}
// ---------------------------------------------------------------------------
// Sets the icon ID for specified subtitle row icon type.
// ---------------------------------------------------------------------------
//
void CAknSingleColumnStyleSubtitleRow::SetIcon( TIconType aType,
TInt aIconId, TBool aDrawNow )
{
switch( aType )
{
case EExpandedIcon:
iExpandedIcon = aIconId;
break;
case ECollapsedIcon:
iCollapsedIcon = aIconId;
break;
case EOptIcon:
iOptIcon = aIconId;
break;
case EHighlightedExpandedIcon:
iHighlightedExpandedIcon = aIconId;
break;
case EHighlightedCollapsedIcon:
iHighlightedCollapsedIcon = aIconId;
break;
case EHighlightedOptIcon:
iHighlightedOptIcon = aIconId;
break;
default:
__ASSERT_DEBUG( EFalse, User::Invariant() );
break;
}
if ( aDrawNow )
{
__ASSERT_DEBUG( Root(), User::Invariant() );
Root()->ItemModified( this );
}
}
// ---------------------------------------------------------------------------
// Icon ID.
// ---------------------------------------------------------------------------
//
TInt CAknSingleColumnStyleSubtitleRow::IconId( TBool aFocused ) const
{
TInt iconId = KNone;
if ( IsExpanded() )
{
iconId = CAknTree::EOpenFolderIndication;
if ( aFocused && iHighlightedExpandedIcon != KDefault )
{
iconId = iHighlightedExpandedIcon;
}
else if ( iExpandedIcon != KDefault )
{
iconId = iExpandedIcon;
}
}
else
{
iconId = CAknTree::EClosedFolderIndication;
if ( aFocused && iHighlightedCollapsedIcon != KDefault )
{
iconId = iHighlightedCollapsedIcon;
}
else if ( iCollapsedIcon != KDefault )
{
iconId = iCollapsedIcon;
}
}
return iconId;
}
// ---------------------------------------------------------------------------
// Optional icon ID.
// ---------------------------------------------------------------------------
//
TInt CAknSingleColumnStyleSubtitleRow::OptionalIconId( TBool aFocused ) const
{
// Default ID for optional icon.
TInt iconId = KNone;
// Determines ID for the optional icon based on focusing, item marking,
// and set optional icon IDs.
if ( IsMarked() )
{
iconId = aFocused ? AknTreeListIconID::KHighlightedMarkedIndication :
AknTreeListIconID::KMarkedIndication;
}
else if ( aFocused && iHighlightedOptIcon != KDefault )
{
iconId = iHighlightedOptIcon;
}
else if ( iOptIcon != KDefault )
{
iconId = iOptIcon;
}
return iconId;
}
// ---------------------------------------------------------------------------
// From class CAknTreeItem.
// Returns the type of concrete item class.
// ---------------------------------------------------------------------------
//
TInt CAknSingleColumnStyleSubtitleRow::Type() const
{
return AknTreeList::KSingleColumnStyleSubtitleRow;
}
// ---------------------------------------------------------------------------
// From class CAknTreeItem.
// Draws the subtitle row to the appointed graphics context.
// ---------------------------------------------------------------------------
//
void CAknSingleColumnStyleSubtitleRow::Draw( CWindowGc& aGc,
const TRect& aItemRect, const TRect& /*aRect*/, TBool aFocused ) const
{
CAknTree* root = Root();
__ASSERT_DEBUG( root, User::Invariant() );
// Icon.
TInt iconVariety = IsMarked() ? 3 : 2;
TRect iconRect = RectFromLayout( aItemRect, AknLayoutScalable_Avkon::
list_single_2heading_msg_pane_g1( iconVariety ) );
TInt iconId = IconId( aFocused );
if ( iconId != AknTreeListIconID::KNone )
{
root->DrawIcon( iconId, iconRect.Size(), aGc, iconRect.iTl,
iconRect.Size() );
}
// Non-empty folder indication icon.
if ( !IsEmpty() )
{
TInt indicatorId = IsExpanded() ?
CAknTree::ECollapseFunctionIndication :
CAknTree::EExpandFunctionIndication;
root->DrawIcon( indicatorId, iconRect.Size(), aGc, iconRect.iTl,
iconRect.Size() );
}
// Optional icon ID.
TInt optIconId = OptionalIconId( aFocused );
// Text.
TAknLayoutText layoutText;
TInt textVariety = ( optIconId == KNone ) ? 2 : 3;
layoutText.LayoutText( aItemRect, AknLayoutScalable_Avkon::
list_single_2heading_msg_pane_t1( textVariety ).LayoutLine() );
root->DrawText( aGc, aItemRect, AknLayoutScalable_Avkon::
list_single_2heading_msg_pane_t1( textVariety ), *iText, NULL,
this, aFocused, ETrue );
// Optional indication icon.
TInt optIconVariety = 1; // Sorting group. Marked.
TRect optIconRect = RectFromLayout( aItemRect, AknLayoutScalable_Avkon::
list_single_2heading_msg_pane_g2( optIconVariety ) );
if ( optIconId != KNone )
{
root->DrawIcon( optIconId, optIconRect.Size(), aGc,
optIconRect.iTl, optIconRect.Size() );
}
}
// ---------------------------------------------------------------------------
// From class CAknTreeItem.
// Handles pointer events.
// ---------------------------------------------------------------------------
//
void CAknSingleColumnStyleSubtitleRow::HandlePointerEventL(
const TPointerEvent& /*aPointerEvent*/, const TRect& /*aItemRect*/ )
{
}
// ---------------------------------------------------------------------------
// C++ constructor.
// ---------------------------------------------------------------------------
//
CAknSingleColumnStyleSubtitleRow::CAknSingleColumnStyleSubtitleRow(
TUint32 aFlags )
: CAknTreeNode( aFlags ),
iExpandedIcon( KDefault ),
iCollapsedIcon( KDefault ),
iOptIcon( KDefault ),
iHighlightedExpandedIcon( KDefault ),
iHighlightedCollapsedIcon( KDefault ),
iHighlightedOptIcon( KDefault )
{
}
// ---------------------------------------------------------------------------
// Second phase constructor.
// ---------------------------------------------------------------------------
//
void CAknSingleColumnStyleSubtitleRow::ConstructL( const TDesC& aText )
{
iText = aText.AllocL();
}
|
bb01b10c00a70e292a2505ae500167a7ef90c320
|
bfd335f14da27f1919756135fae05f479ce09278
|
/substr.cpp
|
15b498346ff6b5fdc7952854bcf5fdd5f1698a60
|
[] |
no_license
|
boothvic/algorithm
|
0b0bff1484c8c41b87532238adcc55eb86ce8f7a
|
9162bb6186cff08636e950b2ef0c216f884a84d7
|
refs/heads/master
| 2021-09-15T23:04:41.951042
| 2018-06-12T11:09:46
| 2018-06-12T11:09:46
| 103,229,059
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,447
|
cpp
|
substr.cpp
|
/*
* Author: L.F.N File Name: substr.cpp
* Created Time: 2018年06月10日 星期日 00时55分53秒
* Github: https://github.com/boothvic
*
* Code description
*
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
pair<int, string> fun(const string& str)
{
vector<string> substrs;
int maxcount = 1, count = 1;
string substr;
int i, len = str.size();
for (i = 0; i < len; i++)
{
substrs.push_back(str.substr(i, len-1));
}
for (i = 0; i < len; i++)
{
for (int j = i + 1; j < len; j++)
{
count = 1;
if (substrs[i].substr(0, j-i) == substrs[j].substr(0, j-i))
{
++count;
for (int k = j + (j-i); k < len; k += j-i)
{
if (substrs[i].substr(0, j-i) == substrs[k].substr(0, j-i))
++count;
else
break;
}
if (count > maxcount)
{
maxcount = count;
substr = substrs[i].substr(0, j-i);
}
}
}
}
return make_pair(maxcount, substr);
}
int main(int argc, char **argv)
{
string str;
pair<int, string> rs;
while (cin >> str && str != "quit")
{
rs = fun(str);
cout << rs.second << ":" << rs.first << endl;
}
return 0;
}
|
6987af379b70a22254f1397c05373b436c0bad14
|
24fa02274a4112e255bc6aa71013055fb66fa92d
|
/global.h
|
8d45c3f4e133ec21ee1a6052bf9f88eaf50fcdc4
|
[] |
no_license
|
bubi-luka/BubiLink
|
7a129d981a39366d1afd9d35ae4feb08764e8e44
|
e6c9ee227c75a3c0e5340d202b9511ed1728eee1
|
refs/heads/master
| 2020-06-02T05:55:56.391486
| 2013-05-06T20:58:08
| 2013-05-06T20:58:08
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 704
|
h
|
global.h
|
#ifndef VARNOST_H
#define VARNOST_H
#include <QApplication>
#define vApp ((global *) qApp)
class global : public QApplication
{
Q_OBJECT
public:
explicit global(int &argc, char *argv[]);
~global();
// Getters
QString id_user() const;
QString id_profile() const;
QString id_campaign() const;;
// Setters
void set_id_user(const QString &id_user);
void set_id_profile(const QString &id_profile);
void set_id_campaign(const QString &id_campaign);
signals:
void id_user_changed();
void id_profile_changed();
void id_campaign_changed();
private:
QString m_id_user;
QString m_id_profile;
QString m_id_campaign;
};
#endif // GLOBAL_H
|
65b90ed93f9a73af3ec82d32ecb478e09e812d20
|
340bba5a46fe9a3214f0175a4b339e94a3792fef
|
/src/server.cpp
|
47c6e672ab0cd7cd26e88e463e4ca73e25578333
|
[] |
no_license
|
ghadd/edu-DirMonitor
|
4e4a06653db5383e3c98a7297c5fcaa56a685ad9
|
a6ee1a3b4942b0471a09b8a4480e2652c4020816
|
refs/heads/develop
| 2023-02-14T20:41:03.181334
| 2021-01-12T21:21:11
| 2021-01-12T21:21:11
| 323,963,324
| 0
| 0
| null | 2021-01-12T21:19:07
| 2020-12-23T17:29:13
|
C++
|
UTF-8
|
C++
| false
| false
| 6,264
|
cpp
|
server.cpp
|
#include "server.h"
// set base setting of server(create socket, bind him and listen)
void Server::setupThis() {
// Create a socket (IPv4, TCP)
listenfd_ = socket(AF_INET, SOCK_STREAM, 0);
if (listenfd_ == -1) {
throw std::runtime_error("Failed to create socket. errno: ");
}
// Listen to port on any address
servAddr_.sin_family = AF_INET; // set IPv4
servAddr_.sin_addr.s_addr = INADDR_ANY;
servAddr_.sin_port = htons(port_); // htons is necessary to convert a number
// bind socket to specific address
if (bind(listenfd_, (sockaddr *)&servAddr_, sizeof(sockaddr)) < 0) {
throw std::runtime_error("Failed to bind to port {}. errno: {}");
}
if (listen(listenfd_, maxConnections) < 0) {
throw std::runtime_error("Failed to listen on socket. errno: {}");
}
}
// wrapper for handleClient to use in thread
void *Server::handleClientWrapper(void *args) {
auto data = *static_cast<QPair<Server *, client_t *> *>(args);
data.first->handleClient(data.second);
return nullptr;
}
// handle errors and send response about the, to the client
std::string Server::handleError(std::string error) {
json responseError = {{"status", false}, {"reason", error}};
return responseError.dump();
}
// get files info from specific directory to send them to client
std::string Server::generateResponse(QString buff) {
std::string response;
// get list, where first argument is path ; second is extentions of files
QStringList pathAndFormats = buff.split(QRegExp("\n"));
// get path to directory
QString path = pathAndFormats[0].trimmed();
/* TOLOG
std::cout << "\nPath: " << path.toStdString() << std::endl;
*/
QStringList formats = QStringList();
// check if client enter formats
if (pathAndFormats.size() > 1) {
QString formatsString = pathAndFormats[1];
formats = formatsString.split(QRegExp(" | "));
if (formats.at(0).isEmpty()) {
formats = QStringList();
}
}
/* TOLOG
std::cout << "\nFormats: ";
for(auto &format : formats)
std::cout << format.trimmed().toStdString() << ", " << std::endl;
*/
// get info about files of formats(second argument) from path or
// directory(first argument)
DirMonitor monitor(path, formats);
// check if path and formats of files are valid
try {
monitor.validatePath();
} catch (const PathError &e) {
response = handleError(
"You didn't enter valid path, change it please."); // responseError.dump();
return response;
}
// if NO ERROR -> get files info from specific directory to send them to
// client
auto responseData = monitor.applyMonitor();
if (responseData.first.size() == 0) {
response = handleError("No files mathing given extensions found.");
return response;
}
auto responseJson = DirMonitor::jsonify(responseData);
responseJson["status"] = true;
response = responseJson.dump();
return response;
}
// handle client request
void Server::handleClient(client_t *client) {
/* TOLOG
std::cout << "Connected: ";
getClientAddress(client->address);
*/
char *buffer = new char[BUFFER_SZ];
while (client) {
bzero(buffer, BUFFER_SZ);
// read path to directory and extentions of files that are in this directory
read(client->sockfd, buffer, BUFFER_SZ);
// /* TOLOG
std::cout << "\nThe message was: " << buffer << std::endl;
// */
QString buff(buffer);
// if message from client starts with word '__close__' - close connection
if (buff.startsWith("__close__")) {
close(client->sockfd);
return;
} else if (buff.startsWith("__test__")) {
std::string response = ((json){{"status", true}}.dump());
sendMessage(client->sockfd, response);
} else {
// get files info from specific directory to send them to client
auto response = generateResponse(buff);
// send response
sendMessage(client->sockfd, response);
}
}
delete[] buffer;
delete client;
// decrease number of client that are served by server
pthread_mutex_lock(&mutex);
clientCount--;
pthread_mutex_unlock(&mutex);
}
// get IP of client
void Server::getClientAddress(struct sockaddr_in &addr) {
printf("%d.%d.%d.%d", addr.sin_addr.s_addr & 0xff,
(addr.sin_addr.s_addr >> 8) & 0xff,
(addr.sin_addr.s_addr >> 16) & 0xff,
(addr.sin_addr.s_addr >> 24) & 0xff);
}
// run server
void Server::sendMessage(int connfd, std::string response)
{
uint32_t len = htonl(response.size());
std::cout << "Sending message of length: " << response.size() << std::endl;
send(connfd, &len, sizeof(len), 0);
send(connfd, response.c_str(), response.length(), 0);
}
int Server::run() {
/* TODO:
* 1. Implement the whole transaction functionality
* 2. Implement logging
*/
// client socket
int connfd;
// client socket addr
sockaddr_in clientAddr{};
socklen_t clientAddrLen = sizeof(clientAddr);
printf("=== SERVER STARTED WORKING ===\n");
while ((connfd = accept(listenfd_, (struct sockaddr *)&clientAddr,
&clientAddrLen)) > 0) {
if ((clientCount + 1) == maxConnections) {
printf("Max clients reached. Rejected: ");
getClientAddress(clientAddr);
printf(":%d\n", clientAddr.sin_port);
std::string response = handleError("Server is overloaded, please, try again later");
sendMessage(connfd, response);
close(connfd);
continue;
}
else {
std::string response = ((json){{"status", true}}).dump();
sendMessage(connfd, response);
}
// increase number of clients that are served by server
clientCount++;
// client settings
client_t *cli = new client_t;
cli->address = clientAddr; // set address if client
cli->sockfd = connfd; // set socket number of client
// descriptor of thread
pthread_t threadHandle;
auto data = qMakePair(this, cli);
// handle each client
pthread_create(&threadHandle, NULL, &handleClientWrapper,
static_cast<void *>(&data));
handlesThread.push_back(&threadHandle);
}
close(listenfd_);
return 0;
}
Server::~Server() {
for (int i = 0; i < handlesThread.size(); i++)
delete handlesThread[i];
close(listenfd_);
};
|
9ba7648708699f1e7658d33af89049a4aec35ba4
|
5111a59dee2e1b4fc32c7354a31991b1469004f7
|
/CoordinateSys/CoordinatePaper.h
|
ce9f3bcaa6f462e64508fcc40cf6ad1f09139007
|
[] |
no_license
|
wangyaoyang/GeometryForFun
|
863008c29cbd4270c1d3abeab3880d94f0ee258d
|
fa9d2444ec433e2528386766ecc89cf52e53f7e2
|
refs/heads/master
| 2023-05-04T04:00:08.763444
| 2021-05-18T04:42:09
| 2021-05-18T04:42:09
| 368,401,289
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 3,939
|
h
|
CoordinatePaper.h
|
#pragma once
#include "Calculat.h"
#define SYMMETRY_ONE 0
#define SYMMETRY_X_2 1
#define SYMMETRY_Y_2 2
#define SYMMETRY_Z_2 3
#define VALIDATE_NON 0 //check box = empty
#define VALIDATE_ONE 2 //check box = gray
#define VALIDATE_TWO 1 //check box = selected
class CCoordinateMapping
{
private:
double m_PI;
double m_PIE;
double m_angleH;
double m_angleV;
public:
void m_SetAngle(double H,double V);
CPoint m_GetWindowPoint(double scale,double X,double Y,double Z);
public:
CCoordinateMapping(void);
~CCoordinateMapping(void);
};
class CCoordinateAxis
{
private:
CCoordinateMapping m_mappingTool;
double m_fAngleH; //X轴沿Z轴旋转的角度
double m_fAngleV; //X轴沿Y轴旋转的角度
double m_fScale; //缩放比例,数学单位1对应的屏幕像素个数
CPoint m_oWindowOrigin;
CRect m_oWindowBound;
CDC* m_pCDC;
public:
void m_SetScale(double scale) { m_fScale = scale; }
void m_SetAngleV(double angle);
void m_SetAngleH(double angle);
double m_GetScale() { return m_fScale; }
double m_GetAngleV();
double m_GetAngleH();
void m_SetWindowOrigin(CPoint point) { m_oWindowOrigin = point; }
CPoint m_GetWindowOrigin() { return m_oWindowOrigin; }
void m_SetWindowBound(CRect rect) { m_oWindowBound = rect; }
CRect m_GetWindowBound() { return m_oWindowBound; }
public:
CCoordinateAxis(void);
~CCoordinateAxis(void);
void m_DrawCoordinate(CDC* pCDC);
CPoint m_GetWindowPoint(double X,double Y,double Z);
};
class CCurvePoints : public CObject
{
private:
UINT m_nSymmetry;
UINT m_nSpace;
UINT m_nValid;
double* m_fX;
double* m_fY;
double* m_fZ;
public:
CCurvePoints(UINT nSpace,UINT symmetry);
~CCurvePoints(void);
bool m_Append(double x,double y,double z);
bool m_GetAt(UINT nPoint,double& x,double& y,double& z);
UINT m_GetCount() { return m_nValid; }
UINT m_GetSymmetry() { return m_nSymmetry; }
};
class CTracePoints : public CObject
{
private:
UINT m_nSpace;
UINT m_nValid;
CPoint* m_oPoint;
private:
bool m_Append(CPoint point);
public:
CTracePoints(CCurvePoints& curve,CCoordinateAxis&axis);
~CTracePoints(void);
bool m_GetAt(UINT nPoint,CPoint& point);
UINT m_GetCount() { return m_nValid; }
POINT* m_GetPoints() { return m_oPoint; }
};
class CCurve
{
private:
CCoordinateAxis m_axis;
CString m_szExpress;
CString m_szFormulaX;
CString m_szFormulaY;
CString m_szFormulaZ;
CObList m_oCurvesYx; //Y0X平面上的所有区线
CObList m_oCurvesXz; //X0Z平面上的所有区线
CObList m_oCurvesZy; //ZOY平面上的所有区线
CObList m_oTraceYx; //窗口Y0X平面上的所有区线
CObList m_oTraceXz; //窗口X0Z平面上的所有区线
CObList m_oTraceZy; //窗口ZOY平面上的所有区线
UINT m_bSymmetryX;
UINT m_bSymmetryY;
UINT m_bSymmetryZ;
private:
double m_fBegin;
double m_fEnd;
double m_fStep;
private:
void m_ClearCurve();
void m_ClearTrace();
void m_CalualateX(double y);
void m_CalualateY(double z);
void m_CalualateZ(double x);
public:
CCurve(void);
~CCurve(void);
CCoordinateAxis& m_GetCoordinate() { return m_axis; }
void m_SetExpress(CString szExpress);
void m_GetExpress(CString& szExpress);
void m_SetFormula(CString szFormulaX,CString szFormulaY,CString szFormulaZ);
void m_GetFormula(CString& szFormulaX,CString& szFormulaY,CString& szFormulaZ);
void m_SetSymmetry(UINT bSymmetryX,UINT bSymmetryY,UINT bSymmetryZ);
void m_GetSymmetry(UINT& bSymmetryX,UINT& bSymmetryY,UINT& bSymmetryZ);
void m_SetResolution(UINT nResolution);
void m_SetViewRange(double fBegin,double fEnd,UINT nResolution=0);
void m_GetViewRange(double& fBegin,double& fEnd,UINT& nResolution);
void m_Calualate(CString szFormulaX,UINT bSymmetryX,
CString szFormulaY,UINT bSymmetryY,
CString szFormulaZ,UINT bSymmetryZ,
bool b3D);
void m_PreDraw();
void m_Draw(CDC* pCDC);
};
//#define PI 3.14159265358979323846f
//#define PI acos(0.0f)
|
c586ef566595c3fc2bb34f3cabb6a67fa1436b39
|
fea6372e4ca628ce07813e68d5bf3c48c6353750
|
/CoolGE/core/src/render/Camera.cpp
|
b251e4956d11081606e85547be4e40d7062f18c1
|
[] |
no_license
|
teddyMeng/CoolGE
|
c1f780f3875263d874b5124cdd54bb5802b4b50a
|
97ce01cb381c720401e5542f5bdc9092e8b366a0
|
refs/heads/master
| 2020-12-30T14:34:12.924219
| 2017-06-09T09:16:01
| 2017-06-09T09:16:01
| 91,067,554
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,001
|
cpp
|
Camera.cpp
|
#include "Camera.hpp"
#include "Math.hpp"
namespace CoolGE
{
Camera::Camera()
{
this->ViewParams(Vec3f(0, 0, 0), Vec3f(0, 0, 1));
this->ProjParams(PI / 4, 1, 1, 1000);
}
void Camera::ViewParams(Vec3f const & eye_pos, Vec3f const & look_at)
{
look_at_ = look_at;
pos_ = eye_pos;
view_mat_ = MathLib::lookatLH(eye_pos, look_at, Vec3f(0, 1, 0));
}
void Camera::ProjParams(float fov, float aspect, float near, float far)
{
type_ = PRT_PERSPECTIVE;
fov_ = fov;
proj_mat_ = MathLib::perspectiveLH(fov, aspect, near, far);
}
void Camera::ProjOrthoParams(float w, float h, float near, float far)
{
type_ = PRT_ORTHOGRAPHIC;
proj_mat_ = MathLib::orthoLH(near, far, -w / 2, w / 2, -h / 2, h / 2);
}
void Camera::ProjOrthoParams(float near, float far, float left, float right, float bottom, float top)
{
type_ = PRT_ORTHOGRAPHIC;
proj_mat_ = MathLib::orthoLH(near, far, left, right, bottom, top);
}
ProjectionType Camera::GetProjectionType()
{
return type_;
}
}
|
c21ef13e4c437c7dfc40431dad415840f4926b73
|
ba7b39eec4ffd608936ab796facb16f9d0240aef
|
/src/Part/Kit.cpp
|
e892ecbf38fe68fcc2956ceeeaf6e4dc16cae00d
|
[] |
no_license
|
DomMarcone/OptimalDrone
|
7460183d923495f3850ba7935096938cbdd824a2
|
81f0d18e99f67b109dc5b03dc3126edbead18d55
|
refs/heads/master
| 2020-08-22T13:09:04.399728
| 2019-10-30T14:04:01
| 2019-10-30T14:04:01
| 216,401,644
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,390
|
cpp
|
Kit.cpp
|
//Kit.cpp
#include <Part/PartInterface.hpp>
#include <Part/Kit.hpp>
#include <Part/PartTypes.h>
#include <Part/FlightController.hpp>
#include <Part/ElectronicSpeedController.hpp>
#include <Part/Battery.hpp>
#include <Part/Frame.hpp>
#include <Part/Motor.hpp>
#include <Part/PowerDistributionBoard.hpp>
#include <Part/Propeller.hpp>
#include <string>
using namespace std;
Kit::Kit(){
setType(0);
}
Kit::Kit(string name, float mass, float cost){
setName(name);
setMass(mass);
setCost(cost);
setType(0);
}
Kit::Kit(FlightController* fc){
setType(0);
setFlightController(fc);
}
Kit::Kit(ElectronicSpeedController* esc){
setType(0);
setElectronicSpeedController(esc);
}
Kit::Kit(Battery* b){
setType(0);
setBattery(b);
}
Kit::Kit(Frame* f){
setType(0);
setFrame(f);
}
Kit::Kit(Motor* m){
setType(0);
setMotor(m);
}
Kit::Kit(PowerDistributionBoard* pdb){
setType(0);
setPowerDistributionBoard(pdb);
}
Kit::Kit(Propeller* p){
setType(0);
setPropeller(p);
}
FlightController* Kit::getFlightController(){ return this->fc; }
void Kit::setFlightController(FlightController *fc){
if(!fc)return; //sanity check
this->fc = fc;
setType( getType() | fc->getType());
}
ElectronicSpeedController* Kit::getElectronicSpeedController(){ return this->esc; }
void Kit::setElectronicSpeedController(ElectronicSpeedController *esc){
if(!esc)return;
this->esc = esc;
setType( getType() | esc->getType());
}
Battery* Kit::getBattery(){ return this->battery; }
void Kit::setBattery(Battery *battery){
if(!battery)return;
this->battery = battery;
setType( getType() | battery->getType());
}
Frame* Kit::getFrame(){ return this->frame; }
void Kit::setFrame(Frame *frame){
if(!frame)return;
this->frame = frame;
setType( getType() | frame->getType());
}
Motor* Kit::getMotor(){ return this->motor; }
void Kit::setMotor(Motor *motor){
if(!motor)return;
this->motor = motor;
setType( getType() | motor->getType());
}
PowerDistributionBoard* Kit::getPowerDistributionBoard(){ return this->pdb; }
void Kit::setPowerDistributionBoard(PowerDistributionBoard *pdb){
if(!pdb)return;
this->pdb = pdb;
setType( getType() | pdb->getType());
}
Propeller* Kit::getPropeller(){ return this->propeller; }
void Kit::setPropeller(Propeller *propeller){
if(!propeller)return;
this->propeller = propeller;
setType( getType() | propeller->getType());
}
|
bf50bee086a84a17b0917c1ef28033b5883536da
|
370881312084d8d2ce0f9c8dce147b81a3a9a923
|
/Game_Code/Code/CryEngine/CryAction/Network/PlaneBreak.cpp
|
3b0e18592ac2fb2ec13b5ada2005e7b466d5736d
|
[] |
no_license
|
ShadowShell/QuestDrake
|
3030c396cd691be96819eec0f0f376eb8c64ac89
|
9be472a977882df97612efb9c18404a5d43e76f5
|
refs/heads/master
| 2016-09-05T20:23:14.165400
| 2015-03-06T14:17:22
| 2015-03-06T14:17:22
| 31,463,818
| 3
| 2
| null | 2015-02-28T18:26:22
| 2015-02-28T13:45:52
|
C++
|
UTF-8
|
C++
| false
| false
| 8,905
|
cpp
|
PlaneBreak.cpp
|
/*************************************************************************
Crytek Source File.
Copyright (C), Crytek Studios, 2007.
-------------------------------------------------------------------------
$Id$
$DateTime$
Description: network breakability: Plane breaks
-------------------------------------------------------------------------
History:
- 22/01/2007 10:34 : Created by Craig Tiller
*************************************************************************/
#include "StdAfx.h"
#if !NET_USE_SIMPLE_BREAKAGE
#include "PlaneBreak.h"
#include "BreakReplicator.h"
#include "NetworkCVars.h"
#include "SerializeBits.h"
#include "SerializeDirHelper.h"
void LogPlaneBreak( const char * from, const SBreakEvent& evt )
{
/*
if (!pEnt)
return;
if (CNetworkCVars::Get().BreakageLog)
{
CryLog("[brk] DeformPhysicalEntity on %s @ (%.8f,%.8f,%.8f); n=(%.8f,%.8f,%.8f); energy=%.8f", from, p.x, p.y, p.z, n.x, n.y, n.z, energy);
CObjectSelector sel(pEnt);
CryLog("[brk] selector is %s", sel.GetDescription().c_str());
switch (pEnt->GetiForeignData())
{
case PHYS_FOREIGN_ID_STATIC:
if (IRenderNode * pRN = (IRenderNode*)pEnt->GetForeignData(PHYS_FOREIGN_ID_STATIC))
{
CryLog("[brk] name is %s", pRN->GetName());
CryLog("[brk] entity class name is %s", pRN->GetEntityClassName());
CryLog("[brk] debug string is %s", pRN->GetDebugString().c_str());
}
break;
case PHYS_FOREIGN_ID_ENTITY:
if (IEntity * pEntity = (IEntity*)pEnt->GetForeignData(PHYS_FOREIGN_ID_ENTITY))
{
CryLog("[brk] name is %s", pEntity->GetName());
Matrix34 m = pEntity->GetWorldTM();
CryLog("[brk] world tm:");
for (int i=0; i<3; i++)
{
Vec4 row = m.GetRow4(i);
CryLog("[brk] %+12.8f %+12.8f %+12.8f %+12.8f", row[0], row[1], row[2], row[3]);
}
}
break;
}
}
*/
}
static int s_debugId = 1;
#pragma warning(push)
#pragma warning(disable : 6262) // 32k of stack space of CBitArray
void SPlaneBreakParams::SerializeWith( TSerialize ser )
{
CBitArray array(&ser);
bool isEnt = breakEvent.itype == PHYS_FOREIGN_ID_ENTITY;
array.Serialize(breakId, 0, 6); // Must match with MAX_BREAK_STREAMS!
array.Serialize(isEnt);
breakEvent.itype = isEnt? PHYS_FOREIGN_ID_ENTITY : PHYS_FOREIGN_ID_STATIC;
if (isEnt)
{
array.SerializeEntity(breakEvent.idEnt);
array.Serialize(breakEvent.pos, 0.f, 1e4f, 20);
array.Serialize(breakEvent.rot);
}
else
{
array.Serialize(breakEvent.hash, 0, 0xffffffff);
}
array.Serialize(breakEvent.pt, 0.f, 1e4f, 22);
breakEvent.partid[1] = (breakEvent.partid[1]/PARTID_CGA) << 8 | (breakEvent.partid[1] % PARTID_CGA);
SerializeDirHelper(array, breakEvent.n, 8, 8);
array.Serialize(breakEvent.idmat[0], -1, 254);
array.Serialize(breakEvent.idmat[1], -1, 254);
array.Serialize(breakEvent.partid[1], 0, 0xffff);
array.Serialize(breakEvent.mass[0], 1.f, 1000.f, 8);
SerializeDirVector(array, breakEvent.vloc[0], 20.f, 8, 8, 8);
breakEvent.partid[1] = (breakEvent.partid[1]&0xff) + (breakEvent.partid[1] >> 8)*PARTID_CGA;
// Looks like we dont need these
breakEvent.partid[0] = 0;
breakEvent.scale.Set(1.f,1.f,1.f);
breakEvent.radius = 0.f;
breakEvent.vloc[1].zero(); // Just assume the hitee is at zero velocity
breakEvent.energy = 0.f;
breakEvent.penetration = 0.f;
breakEvent.mass[1] = 0.f;
breakEvent.seed = 0;
if (ser.IsWriting()) array.WriteToSerializer();
}
#pragma warning(pop)
void SPlaneBreak::GetAffectedRegion(AABB& rgn)
{
rgn.min = breakEvents[0].pt - Vec3(20,20,20);
rgn.max = breakEvents[0].pt + Vec3(20,20,20);
}
void SPlaneBreak::AddSendables( INetSendableSink * pSink, int32 brkId )
{
if (breakEvents[0].itype == PHYS_FOREIGN_ID_ENTITY)
pSink->NextRequiresEntityEnabled( breakEvents[0].idEnt );
for (int i=0; i<breakEvents.size(); ++i)
CBreakReplicator::SendPlaneBreakWith( SPlaneBreakParams(brkId, breakEvents[i]), pSink );
AddProceduralSendables(brkId, pSink);
}
CPlaneBreak::CPlaneBreak( const SBreakEvent& be ) : IProceduralBreakType(ePBTF_ChainBreaking, 'd'), m_pPhysEnt(0)
{
m_absorbIdx = 1;
m_bes.push_back(be);
m_bes.back().iState = eBES_Generated;
m_bes.back().time = gEnv->pTimer->GetFrameStartTime().GetSeconds();
}
bool CPlaneBreak::AttemptAbsorb( const IProceduralBreakTypePtr& pBT )
{
if (pBT->type == type)
{
CPlaneBreak * pBrk = (CPlaneBreak*)(IProceduralBreakType*)pBT;
if ((m_bes[0].hash && m_bes[0].hash == pBrk->m_bes[0].hash) ||
GetObjectSelector(1) == pBrk->GetObjectSelector(1))
{
m_bes.push_back(pBrk->m_bes[0]);
m_bes.back().iState = eBES_Generated;
m_bes.back().time = gEnv->pTimer->GetFrameStartTime().GetSeconds();
return true;
}
}
return false;
}
void CPlaneBreak::AbsorbStep()
{
if (m_absorbIdx >= m_bes.size())
{
GameWarning("CPlaneBreak::AbsorbStep: too many absorbs for structure (or there was an earlier message and we invalidated m_absorbIdx)");
return;
}
if (!m_pPhysEnt)
{
GameWarning("CPlaneBreak::AbsorbStep: attempt to deform a null entity");
m_absorbIdx = m_bes.size();
return;
}
CRY_ASSERT(m_absorbIdx < m_bes.size());
if (m_absorbIdx >= m_bes.size())
return;
PreparePlaybackForEvent(m_absorbIdx);
if (!m_pPhysEnt)
{
GameWarning("CPlaneBreak::AbsorbStep: attempt to deform a null entity after preparing index %d", m_absorbIdx);
m_absorbIdx = m_bes.size();
return;
}
LogPlaneBreak( "CLIENT", m_bes[m_absorbIdx] );
CActionGame::PerformPlaneBreak( GeneratePhysicsEvent(m_bes[m_absorbIdx]), &m_bes[m_absorbIdx] );
// if (!gEnv->pPhysicalWorld->DeformPhysicalEntity(m_pPhysEnt, m_bes[m_absorbIdx].pt, -m_bes[m_absorbIdx].n, m_bes[m_absorbIdx].energy))
// GameWarning("[brk] DeformPhysicalEntity failed");
++m_absorbIdx;
}
int CPlaneBreak::GetVirtualId( IPhysicalEntity * pEnt )
{
int iForeignData = pEnt->GetiForeignData();
void * pForeignData = pEnt->GetForeignData(iForeignData);
if (iForeignData == PHYS_FOREIGN_ID_ENTITY && m_bes[0].itype == PHYS_FOREIGN_ID_ENTITY)
{
IEntity * pForeignEnt = (IEntity*) pForeignData;
if (pForeignEnt->GetId() == m_bes[0].idEnt)
return 1;
}
else if (iForeignData == PHYS_FOREIGN_ID_STATIC)
{
IRenderNode *rn = (IRenderNode *) pForeignData;
if (IsOurStatObj(rn))
return 1;
}
return 0;
}
CObjectSelector CPlaneBreak::GetObjectSelector(int idx)
{
if (idx == 1)
{
if (m_bes[0].itype == PHYS_FOREIGN_ID_ENTITY)
return CObjectSelector(m_bes[0].idEnt);
else if (m_bes[0].itype == PHYS_FOREIGN_ID_STATIC)
return CObjectSelector(m_bes[0].pt, m_bes[0].hash);
}
return CObjectSelector();
}
_smart_ptr<SProceduralBreak> CPlaneBreak::CompleteSend()
{
SPlaneBreak * pPayload = new SPlaneBreak;
pPayload->breakEvents = m_bes;
return pPayload;
}
void CPlaneBreak::PreparePlayback()
{
PreparePlaybackForEvent(0);
}
void CPlaneBreak::PreparePlaybackForEvent( int event )
{
m_pPhysEnt = 0;
if (m_bes[event].itype == PHYS_FOREIGN_ID_ENTITY)
{
IEntity * pEnt = gEnv->pEntitySystem->GetEntity(m_bes[event].idEnt);
if (!pEnt)
{
GameWarning("Unable to find entity to perform Plane break on");
return;
}
Vec3 scale = pEnt->GetScale();
pEnt->SetPosRotScale(m_bes[event].pos, m_bes[event].rot, scale);
m_pPhysEnt = pEnt->GetPhysics();
}
else if (m_bes[event].itype == PHYS_FOREIGN_ID_STATIC)
{
const SBreakEvent& be = m_bes[event];
m_pPhysEnt = CObjectSelector::FindPhysicalEntity(be.pt, be.hash, 0.03f);
if (!m_pPhysEnt)
GameWarning("Unable to find static object to perform Plane break on");
}
}
void CPlaneBreak::BeginPlayback( bool hasJointBreaks )
{
if (hasJointBreaks && CNetworkCVars::Get().BreakageLog)
GameWarning("[brk] Plane break has joint breaks attached");
if (m_pPhysEnt)
{
LOGBREAK("PlaneBreak::BeginPlayback");
CActionGame::PerformPlaneBreak( GeneratePhysicsEvent(m_bes[0]), &m_bes[0] );
}
else
GameWarning("[brk] No physical entity to deform");
}
bool CPlaneBreak::GotExplosiveObjectState( const SExplosiveObjectState * pState )
{
return false;
}
bool CPlaneBreak::AllowComplete( const SProceduralBreakRecordingState& state )
{
LOGBREAK("CPlaneBreak AllowComplete %d", state.numEmptySteps>3);
return state.numEmptySteps > 3;
}
const EventPhysCollision& CPlaneBreak::GeneratePhysicsEvent( const SBreakEvent& bev )
{
static EventPhysCollision epc;
epc.pEntity[0] = 0;
epc.iForeignData[0] = -1;
epc.pEntity[1] = 0;
epc.iForeignData[1] = -1;
epc.pt=bev.pt; epc.n=bev.n;
epc.vloc[0]=bev.vloc[0]; epc.vloc[1]=bev.vloc[1];
epc.mass[0]=bev.mass[0]; epc.mass[1]=bev.mass[1];
epc.idmat[0]=bev.idmat[0]; epc.idmat[1]=bev.idmat[1];
epc.partid[0]=bev.partid[0]; epc.partid[1]=bev.partid[1];
epc.penetration = bev.penetration;
epc.radius = bev.radius;
if (m_pPhysEnt)
{
epc.pEntity[1] = m_pPhysEnt;
epc.iForeignData[1] = m_pPhysEnt->GetiForeignData();
epc.pForeignData[1] = m_pPhysEnt->GetForeignData(epc.iForeignData[1]);
}
return epc;
}
#endif // !NET_USE_SIMPLE_BREAKAGE
|
46c924356c1f352726e0cc96b15dd7a47b7995aa
|
4b3cbd9e773970d93957da1ef431b6864f5a1432
|
/src/CinderBox2D/Dynamics/Contacts/cb2Contact.cpp
|
fd0088ecb9d11d76380b9d254a1b7d47289e347a
|
[] |
no_license
|
ashmeltin/CinderBox2D
|
5b932c5e999aed69d66c438e0c8784faa3460008
|
5a607621a3a1f6206405dd52bff8f87728fc9ed5
|
refs/heads/master
| 2021-05-27T17:58:27.402859
| 2013-12-07T02:10:27
| 2013-12-07T02:10:27
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,579
|
cpp
|
cb2Contact.cpp
|
/*
* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include <CinderBox2D/Dynamics/Contacts/cb2Contact.h>
#include <CinderBox2D/Dynamics/Contacts/cb2CircleContact.h>
#include <CinderBox2D/Dynamics/Contacts/cb2PolygonAndCircleContact.h>
#include <CinderBox2D/Dynamics/Contacts/cb2PolygonContact.h>
#include <CinderBox2D/Dynamics/Contacts/cb2EdgeAndCircleContact.h>
#include <CinderBox2D/Dynamics/Contacts/cb2EdgeAndPolygonContact.h>
#include <CinderBox2D/Dynamics/Contacts/cb2ChainAndCircleContact.h>
#include <CinderBox2D/Dynamics/Contacts/cb2ChainAndPolygonContact.h>
#include <CinderBox2D/Dynamics/Contacts/cb2ContactSolver.h>
#include <CinderBox2D/Collision/cb2Collision.h>
#include <CinderBox2D/Collision/cb2TimeOfImpact.h>
#include <CinderBox2D/Collision/Shapes/cb2Shape.h>
#include <CinderBox2D/Common/cb2BlockAllocator.h>
#include <CinderBox2D/Dynamics/cb2Body.h>
#include <CinderBox2D/Dynamics/cb2Fixture.h>
#include <CinderBox2D/Dynamics/cb2World.h>
cb2ContactRegister cb2Contact::s_registers[cb2Shape::e_typeCount][cb2Shape::e_typeCount];
bool cb2Contact::s_initialized = false;
void cb2Contact::InitializeRegisters()
{
AddType(cb2CircleContact::Create, cb2CircleContact::Destroy, cb2Shape::e_circle, cb2Shape::e_circle);
AddType(cb2PolygonAndCircleContact::Create, cb2PolygonAndCircleContact::Destroy, cb2Shape::e_polygon, cb2Shape::e_circle);
AddType(cb2PolygonContact::Create, cb2PolygonContact::Destroy, cb2Shape::e_polygon, cb2Shape::e_polygon);
AddType(cb2EdgeAndCircleContact::Create, cb2EdgeAndCircleContact::Destroy, cb2Shape::e_edge, cb2Shape::e_circle);
AddType(cb2EdgeAndPolygonContact::Create, cb2EdgeAndPolygonContact::Destroy, cb2Shape::e_edge, cb2Shape::e_polygon);
AddType(cb2ChainAndCircleContact::Create, cb2ChainAndCircleContact::Destroy, cb2Shape::e_chain, cb2Shape::e_circle);
AddType(cb2ChainAndPolygonContact::Create, cb2ChainAndPolygonContact::Destroy, cb2Shape::e_chain, cb2Shape::e_polygon);
}
void cb2Contact::AddType(cb2ContactCreateFcn* createFcn, cb2ContactDestroyFcn* destoryFcn,
cb2Shape::Type type1, cb2Shape::Type type2)
{
cb2Assert(0 <= type1 && type1 < cb2Shape::e_typeCount);
cb2Assert(0 <= type2 && type2 < cb2Shape::e_typeCount);
s_registers[type1][type2].createFcn = createFcn;
s_registers[type1][type2].destroyFcn = destoryFcn;
s_registers[type1][type2].primary = true;
if (type1 != type2)
{
s_registers[type2][type1].createFcn = createFcn;
s_registers[type2][type1].destroyFcn = destoryFcn;
s_registers[type2][type1].primary = false;
}
}
cb2Contact* cb2Contact::Create(cb2Fixture* fixtureA, int indexA, cb2Fixture* fixtureB, int indexB, cb2BlockAllocator* allocator)
{
if (s_initialized == false)
{
InitializeRegisters();
s_initialized = true;
}
cb2Shape::Type type1 = fixtureA->GetType();
cb2Shape::Type type2 = fixtureB->GetType();
cb2Assert(0 <= type1 && type1 < cb2Shape::e_typeCount);
cb2Assert(0 <= type2 && type2 < cb2Shape::e_typeCount);
cb2ContactCreateFcn* createFcn = s_registers[type1][type2].createFcn;
if (createFcn)
{
if (s_registers[type1][type2].primary)
{
return createFcn(fixtureA, indexA, fixtureB, indexB, allocator);
}
else
{
return createFcn(fixtureB, indexB, fixtureA, indexA, allocator);
}
}
else
{
return NULL;
}
}
void cb2Contact::Destroy(cb2Contact* contact, cb2BlockAllocator* allocator)
{
cb2Assert(s_initialized == true);
cb2Fixture* fixtureA = contact->m_fixtureA;
cb2Fixture* fixtureB = contact->m_fixtureB;
if (contact->m_manifold.pointCount > 0 &&
fixtureA->IsSensor() == false &&
fixtureB->IsSensor() == false)
{
fixtureA->GetBody()->SetAwake(true);
fixtureB->GetBody()->SetAwake(true);
}
cb2Shape::Type typeA = fixtureA->GetType();
cb2Shape::Type typeB = fixtureB->GetType();
cb2Assert(0 <= typeA && typeB < cb2Shape::e_typeCount);
cb2Assert(0 <= typeA && typeB < cb2Shape::e_typeCount);
cb2ContactDestroyFcn* destroyFcn = s_registers[typeA][typeB].destroyFcn;
destroyFcn(contact, allocator);
}
cb2Contact::cb2Contact(cb2Fixture* fA, int indexA, cb2Fixture* fB, int indexB)
{
m_flags = e_enabledFlag;
m_fixtureA = fA;
m_fixtureB = fB;
m_indexA = indexA;
m_indexB = indexB;
m_manifold.pointCount = 0;
m_prev = NULL;
m_next = NULL;
m_nodeA.contact = NULL;
m_nodeA.prev = NULL;
m_nodeA.next = NULL;
m_nodeA.other = NULL;
m_nodeB.contact = NULL;
m_nodeB.prev = NULL;
m_nodeB.next = NULL;
m_nodeB.other = NULL;
m_toiCount = 0;
m_friction = cb2MixFriction(m_fixtureA->m_friction, m_fixtureB->m_friction);
m_restitution = cb2MixRestitution(m_fixtureA->m_restitution, m_fixtureB->m_restitution);
m_tangentSpeed = 0.0f;
}
// Update the contact manifold and touching status.
// Note: do not assume the fixture AABBs are overlapping or are valid.
void cb2Contact::Update(cb2ContactListener* listener)
{
cb2Manifold oldManifold = m_manifold;
// Re-enable this contact.
m_flags |= e_enabledFlag;
bool touching = false;
bool wasTouching = (m_flags & e_touchingFlag) == e_touchingFlag;
bool sensorA = m_fixtureA->IsSensor();
bool sensorB = m_fixtureB->IsSensor();
bool sensor = sensorA || sensorB;
cb2Body* bodyA = m_fixtureA->GetBody();
cb2Body* bodyB = m_fixtureB->GetBody();
const cb2Transform& xfA = bodyA->GetTransform();
const cb2Transform& xfB = bodyB->GetTransform();
// Is this contact a sensor?
if (sensor)
{
const cb2Shape* shapeA = m_fixtureA->GetShape();
const cb2Shape* shapeB = m_fixtureB->GetShape();
touching = cb2TestOverlap(shapeA, m_indexA, shapeB, m_indexB, xfA, xfB);
// Sensors don't generate manifolds.
m_manifold.pointCount = 0;
}
else
{
Evaluate(&m_manifold, xfA, xfB);
touching = m_manifold.pointCount > 0;
// Match old contact ids to new contact ids and copy the
// stored impulses to warm start the solver.
for (int i = 0; i < m_manifold.pointCount; ++i)
{
cb2ManifoldPoint* mp2 = m_manifold.points + i;
mp2->normalImpulse = 0.0f;
mp2->tangentImpulse = 0.0f;
cb2ContactID id2 = mp2->id;
for (int j = 0; j < oldManifold.pointCount; ++j)
{
cb2ManifoldPoint* mp1 = oldManifold.points + j;
if (mp1->id.key == id2.key)
{
mp2->normalImpulse = mp1->normalImpulse;
mp2->tangentImpulse = mp1->tangentImpulse;
break;
}
}
}
if (touching != wasTouching)
{
bodyA->SetAwake(true);
bodyB->SetAwake(true);
}
}
if (touching)
{
m_flags |= e_touchingFlag;
}
else
{
m_flags &= ~e_touchingFlag;
}
if (wasTouching == false && touching == true && listener)
{
listener->BeginContact(this);
}
if (wasTouching == true && touching == false && listener)
{
listener->EndContact(this);
}
if (sensor == false && touching && listener)
{
listener->PreSolve(this, &oldManifold);
}
}
|
1214ccd1bb69b9eea1c79e5a640ad0c7f15ec5ee
|
1c390cd4fd3605046914767485b49a929198b470
|
/poj/P3194.cpp
|
4864c857b43e3d36d043014d0740f5e11cff7a42
|
[] |
no_license
|
wwwwodddd/Zukunft
|
f87fe736b53506f69ab18db674311dd60de04a43
|
03ffffee9a76e99f6e00bba6dbae91abc6994a34
|
refs/heads/master
| 2023-01-24T06:14:35.691292
| 2023-01-21T15:42:32
| 2023-01-21T15:42:32
| 163,685,977
| 7
| 8
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 703
|
cpp
|
P3194.cpp
|
#include<stdio.h>
#include<string.h>
int n,x,y,w;
int m[120][120];
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int dfs(int x,int y)
{
if(m[x][y]==-1)
return 0;
int re=1,now;
now=m[x][y];
m[x][y]=-1;
for(int i=0;i<4;i++)
if(now==m[x+dx[i]][y+dy[i]])
re+=dfs(x+dx[i],y+dy[i]);
return re;
}
int main()
{
while(scanf("%d",&n)&&n)
{
memset(m,-1,sizeof(m));
w=0;
for(int i=1;i<n;i++)
for(int j=0;j<n;j++)
{
scanf("%d %d",&x,&y);
m[x][y]=i;
}
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(m[i][j]>=0)
if(dfs(i,j)!=n)
{
w=1;
goto end;
}
end:
printf("%s\n",w?"wrong":"good");
}
return 0;
}
|
5bd62152a3ef54c06c99aa48512dd0a8f34645f9
|
af396dd6e9d8087ad5f6b411730aae234f448b23
|
/base/utils/configure.cpp
|
7d0dcee00156141a7df3b9d2904c8899d6512948
|
[] |
no_license
|
ijaychen/jengine
|
bc90763b6d81472150eb5baa135e60c971f3aa26
|
11ad34c0494b6d23ab067b7edc48af85a93b8d68
|
refs/heads/master
| 2021-01-10T09:41:52.418984
| 2015-10-26T03:58:48
| 2015-10-26T03:58:48
| 44,941,600
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 183
|
cpp
|
configure.cpp
|
#ifndef BASE_UTILS_CONFIGURE_H
#define BASE_UTILS_CONFIGURE_H
#include "../global.h"
#include <string>
namespace base
{
namespace utils
{
void test_utils()
{
}
}
}
#endif
|
7df05142547c6b3688429d22d4875a192534a9d0
|
6861230929ac6a938e6cb1824cb55ab2e9ea7be9
|
/body.cpp
|
5232dfc25fd79e0c2cda01014c861c9f44a20767
|
[] |
no_license
|
abekkine/simula-gra
|
837c30170f5930d4241565852e13b4c35fe2422b
|
3908406c777c87d61a76f2eb9ee9ebb111ba2f96
|
refs/heads/master
| 2020-04-05T14:32:51.298919
| 2017-07-05T04:38:14
| 2017-07-05T04:38:14
| 94,676,348
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 13,014
|
cpp
|
body.cpp
|
#include "body.h"
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <random>
#include "display.h"
namespace body {
double cx = 0.0;
double cy = 0.0;
double cz = 0.0;
double Seed;
double Mass;
double TimeStep;
double SpeedRange;
double GravityConstant;
double ExplosionConstant = 2.5;
double CollisionRadius;
double TerminalAcceleration;
float ThetaXSpeed, ThetaYSpeed, ThetaZSpeed;
int IgnitionLimit = 0;
std::vector< Body > list;
int numBodies;
double* positions;
float* colors;
uint32_t max_bound = 0;
int32_t max_bound_ix = -1;
int32_t max_cam_steps = 50;
int32_t remaining_cam_steps = max_cam_steps;
float cube_frame[] = {
1, 1, -1, -1, 1, -1,
-1, 1, -1, -1, -1, -1,
-1, -1, -1, 1, -1, -1,
1, -1, -1, 1, 1, -1,
1, 1, 1, 1, 1, -1,
-1, 1, 1, -1, 1, -1,
1, -1, 1, 1, -1, -1,
-1, -1, 1, -1, -1, -1,
1, 1, 1, 1, -1, 1,
-1, 1, 1, 1, 1, 1,
-1, -1, 1, -1, 1, 1,
1, -1, 1, -1, -1, 1
};
void add_rotating_spherical(int num, double radius) {
numBodies = num;
positions = new double[num * 3];
colors = new float[num * 4];
std::uniform_real_distribution<double> rdist(0.3 * radius, radius);
std::uniform_real_distribution<double> pdist(-M_PI, M_PI);
std::uniform_real_distribution<double> qdist(0.0, 2.0*M_PI);
std::uniform_real_distribution<double> vdist(20.0, 40.0);
std::uniform_real_distribution<double> wdist(-radius, radius);
std::mt19937 rng;
rng.seed(Seed);
for (int i=0; i<num; i++) {
Body b(positions[3*i + 0], positions[3*i +1], positions[3*i + 2]);
b.m = Mass;
colors[4*i + 0] = 1.0;
colors[4*i + 1] = 0.0;
colors[4*i + 2] = 0.0;
colors[4*i + 3] = 1.0;
double r = rdist(rng);
double p = pdist(rng);
double q = qdist(rng);
b.x[0] = r * cos(p) * cos(q);
b.x[1] = r * cos(p) * sin(q);
b.x[2] = r * sin(p);
b.px = b.x[0];
b.py = b.x[1];
b.pz = b.x[2];
double v = vdist(rng);
b.vx[0] = 1.0 * b.x[1] * v / r;
b.vx[1] = -1.0 * b.x[0] * v / r;
b.vx[2] = 0.0;
b.pressure = 0.0;
b.bound = 0;
list.push_back(b);
}
}
void add_random_cubic(int num, double length) {
numBodies = num;
positions = new double[num * 3];
colors = new float[num * 4];
std::uniform_real_distribution<double> xdist(-length, length);
std::uniform_real_distribution<double> vdist(-SpeedRange, SpeedRange);
std::mt19937 rng;
rng.seed(std::random_device{}());
for (int i=0; i<num; i++) {
Body b(positions[3*i + 0], positions[3*i + 1], positions[3*i + 2]);
b.m = Mass;
for (int k=0; k<N; k++) {
b.x[k] = xdist(rng);
b.vx[k] = vdist(rng);
}
b.px = b.x[0];
b.py = b.x[1];
b.pz = b.x[2];
b.pressure = 0.0;
b.bound = 0;
list.push_back(b);
}
}
void add_random_spherical(int num, double radius) {
numBodies = num;
positions = new double[num * 3];
colors = new float[num * 4];
std::uniform_real_distribution<double> xdist(-radius, radius);
std::mt19937 rng;
rng.seed(std::random_device{}());
int i = 0;
while (i < num) {
double x1 = xdist(rng);
double x2 = xdist(rng);
double x3 = xdist(rng);
if (x1*x1 + x2*x2 + x3*x3 <= radius*radius) {
Body b(positions[3*i + 0], positions[3*i + 1], positions[3*i + 2]);
b.m = Mass;
for (int k=0; k<N; k++) {
b.x[k] = 0.0;
b.vx[k] = 0.0;
}
colors[4*i + 0] = 1.0;
colors[4*i + 1] = 0.0;
colors[4*i + 2] = 0.0;
colors[4*i + 3] = 1.0;
b.x[0] = x1;
b.x[1] = x2;
b.x[2] = x3;
b.vx[0] = 0.0;
b.vx[1] = 0.0;
b.vx[2] = 0.0;
b.px = b.x[0];
b.py = b.x[1];
b.pz = b.x[2];
b.pressure = 0.0;
b.bound = 0;
list.push_back(b);
i++;
}
}
}
void add_noise(double& x, double& y, double& z, std::mt19937& rng) {
std::uniform_real_distribution<double> dist(-2.0, 2.0);
x += dist(rng);
y += dist(rng);
z += dist(rng);
}
void add_uniform_cubic(int num, double length, bool noise) {
printf("add_uniform_cubic(%d, %f, %s)\n", num, length, noise ? "true" : "false");
double dNumAtEdge = pow((double)num, (1.0 / 3.0));
int iNumAtEdge = (int)floor(dNumAtEdge);
double edgeStep = length / iNumAtEdge;
printf("..dNumAtEdge(%f)\n", dNumAtEdge);
printf("..iNumAtEdge(%d)\n", iNumAtEdge);
printf("..edgeStep(%f)\n", edgeStep);
double px, py, pz;
numBodies = (int)iNumAtEdge;
numBodies = numBodies * numBodies * numBodies;
printf("..numBodies(%d)\n", numBodies);
positions = new double[numBodies * 3];
colors = new float[numBodies * 4];
printf("..positions[%d * 3](%8lx)\n", numBodies, (uint64_t)positions);
printf("..colors[%d * 4](%8lx)\n", numBodies, (uint64_t)colors);
std::mt19937 rng;
rng.seed(std::random_device{}());
int i=0;
for (int ix=0; ix<iNumAtEdge; ix++) {
for (int iy=0; iy<iNumAtEdge; iy++) {
for (int iz=0; iz<iNumAtEdge; iz++) {
px = ix * edgeStep - 0.5 * length;
py = iy * edgeStep - 0.5 * length;
pz = iz * edgeStep - 0.5 * length;
//printf("..i(%d), px(%f), py(%f), pz(%f)\n", i, px, py, pz);
if (noise) {
add_noise(px, py, pz, rng);
}
// create body.
{
Body b(positions[3*i+0], positions[3*i+1], positions[3*i+2]);
b.m = Mass;
for (int k=0; k<N; k++) {
b.x[k] = 0.0;
b.vx[k] = 0.0;
}
colors[4*i+0] = 1.0;
colors[4*i+1] = 0.0;
colors[4*i+2] = 0.0;
colors[4*i+3] = 1.0;
b.x[0] = px;
b.x[1] = py;
b.x[2] = pz;
b.pressure = 0.0;
b.bound = 0;
list.push_back(b);
i++;
}
}
}
}
printf("..i(%d), px(%f), py(%f), pz(%f)\n", i, px, py, pz);
}
float thetaX = 0.0;
float thetaY = 0.0;
float thetaZ = 0.0;
void render() {
glPushMatrix();
glLoadIdentity();
if (display::withLookAt) {
gluLookAt( 0.0, 0.0, 0.0,
cx, cy, cz,
0.0, 0.0, 1.0);
} else {
glRotatef(thetaX, 1.0, 0.0, 0.0);
glRotatef(thetaY, 0.0, 1.0, 0.0);
glRotatef(thetaZ, 0.0, 0.0, 1.0);
// Focus on max bound index
glTranslatef(-cx, -cy, -cz);
thetaX += ThetaXSpeed;
if (thetaX > 360.0) {
thetaX -= 360.0;
}
thetaY += ThetaYSpeed;
if (thetaY > 360.0) {
thetaY -= 360.0;
}
thetaZ += ThetaZSpeed;
if (thetaZ > 360.0) {
thetaZ -= 360.0;
}
}
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(3, GL_DOUBLE, 0, positions);
glColorPointer(4, GL_FLOAT, 0, colors);
glPointSize(2.0);
glDrawArrays(GL_POINTS, 0, numBodies);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
drawCubeFrame();
glPopMatrix();
}
void drawCubeFrame() {
if (max_bound_ix == -1) {
return;
}
glPushMatrix();
glTranslatef(list[max_bound_ix].px,
list[max_bound_ix].py,
list[max_bound_ix].pz);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, cube_frame);
glScalef(2.0, 2.0, 2.0);
glColor4f(1.0, 0.0, 0.0, 0.5);
glDrawArrays(GL_LINES, 0, 24);
glDisableClientState(GL_VERTEX_ARRAY);
glPopMatrix();
}
void update() {
double timeStep = TimeStep;
#pragma omp parallel for
for (int i=0; i<numBodies; i++) {
for(int k=0; k<N; k++) {
list[i].vx[k] += list[i].ax[k] * timeStep;
list[i].x[k] += list[i].vx[k] * timeStep;
list[i].ax[k] = 0.0;
}
list[i].px = list[i].x[0];
list[i].py = list[i].x[1];
list[i].pz = list[i].x[2];
// Update colors by pressure.
const float pmax = 4.5;
const float pmin = -2.0;
float c = std::log10(list[i].pressure);
if (c < pmin) {
c = pmin;
}
else if (c > pmax) {
c = pmax;
}
c -= pmin;
c = c / (pmax - pmin);
if (list[i].ignited) {
colors[4*i + 0] = 1.0;
colors[4*i + 1] = 0.91;
colors[4*i + 2] = 0.21;
} else {
colors[4*i + 0] = 0.43;
colors[4*i + 1] = 0.62;
colors[4*i + 2] = 1.0;
}
colors[4*i + 3] = c;
}
update_camera_path();
}
void update_camera_path() {
if (max_bound_ix != -1) {
float dx = list[max_bound_ix].px - cx;
float dy = list[max_bound_ix].py - cy;
float dz = list[max_bound_ix].pz - cz;
if (remaining_cam_steps > 2) {
cx += dx / remaining_cam_steps;
cy += dy / remaining_cam_steps;
cz += dz / remaining_cam_steps;
remaining_cam_steps--;
}
else {
cx += 0.1 * dx;
cy += 0.1 * dy;
cz += 0.1 * dz;
}
}
}
void explode_force(Body& body) {
puts("explode_force()");
double dx[N];
double dr2, dr;
#pragma omp parallel for
for (int i=0; i<numBodies; i++) {
dr2 = 0.0;
for(int k=0; k<N; k++) {
dx[k] = body.x[k] - list[i].x[k];
dr2 += dx[k] * dx[k];
}
dr = sqrt(dr2);
if (dr > CollisionRadius * 1.25) {
for(int k=0; k<N; k++) {
list[i].ax[k] -= ExplosionConstant * GravityConstant * Mass * dx[k] / dr2;
}
}
}
}
void apply_gravity(Body& from, Body& to) {
const double K = GravityConstant;
double dx[N];
double dr, dr2;
double to_ax[N], to_a;
double Kmr;
double vx[N];
dr2 = 0.0;
for (int k=0; k<N; k++) {
dx[k] = to.x[k] - from.x[k];
dr2 += dx[k] * dx[k];
}
dr = sqrt(dr2);
to_a = 0.0;
double drN = 1.0;
for (int k=0; k<N; k++) {
drN *= dr;
}
Kmr = K * to.m / drN;
for (int k=0; k<N; k++) {
to_ax[k] = Kmr * dx[k];
to_a += to_ax[k] * to_ax[k];
}
// if (to_a > 400.0) {
if (dr < CollisionRadius && to_a > TerminalAcceleration) {
for (int k=0; k<N; k++) {
vx[k] = (from.m * from.vx[k] + to.m * to.vx[k]) / (from.m + to.m);
from.vx[k] = to.vx[k] = vx[k];
}
from.pressure += TerminalAcceleration;
from.bound++;
if (from.bound > IgnitionLimit && from.ignited == false) {
from.ignited = true;
explode_force(from);
}
}
else {
for (int k=0; k<N; k++) {
from.ax[k] += to_ax[k];
}
from.pressure += to_a;
}
}
}
|
0dacfe9401b1be4c0f265505db700e8ecaca679a
|
20d1d2914d361fbc329865df9c6f2ed0b7e6d06b
|
/1042-1070/1053_11042939(AC).cpp
|
e530e048097dc7bad4b68e569ad0872ba84db39b
|
[] |
no_license
|
Annab96/CodeUp
|
10d019f0adc6c4ad216e6813d79d443de8c3b747
|
7f66d7c6d743d90855cf5f982d02997720a7fc2e
|
refs/heads/master
| 2020-08-23T23:33:33.981716
| 2019-10-30T05:31:19
| 2019-10-30T05:31:19
| 216,724,824
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 154
|
cpp
|
1053_11042939(AC).cpp
|
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
if(n==1) printf("0");
else if(n==0) printf("1");
else return 0;
}
|
51170bc05753c226fa311f50ae77b669623aeb02
|
d0cdccf1ecdcd6e1f7744977be9e824eb8206574
|
/src/Screen.cpp
|
149aba58b5137fb49490257e8bdc87d0f2ca0aee
|
[] |
no_license
|
mihhaiii/car-store1
|
09402e281b4970d34a683e934be0d9e0bb4e2f33
|
91e9479297f769ba8b15ea4baff9334cb66459af
|
refs/heads/master
| 2016-09-14T20:03:22.777291
| 2016-05-25T14:44:08
| 2016-05-25T14:44:08
| 58,675,761
| 0
| 0
| null | 2016-05-21T22:34:54
| 2016-05-12T20:48:42
|
C++
|
UTF-8
|
C++
| false
| false
| 246
|
cpp
|
Screen.cpp
|
#include "Screen.h"
Screen::Screen()
{
//ctor
_texture.loadFromFile("images/screen.jpg");
_sprite.setTexture(_texture);
}
Screen::~Screen()
{
//dtor
}
void Screen::show(sf::RenderWindow& window)
{
window.draw(_sprite);
}
|
7d2bddac237f9f237eadf3cf9881b0b2c763d7d5
|
0ec82c160d27c43de73f0cde3f33852b7847643b
|
/Sem1/Algo/Assignments/Assignment_DP_Graph/3.cpp
|
00a034fe6291382e62ed921d67b9716e6d445d21
|
[] |
no_license
|
Bhavesh-Gulecha/Assignments_IIITB
|
2619fac82843ec2c09f13b59ea512e205226366a
|
691021f6764eb9a7831456ea7e4fe6d75a855215
|
refs/heads/master
| 2020-04-07T13:16:23.602281
| 2018-11-16T19:07:45
| 2018-11-16T19:07:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,639
|
cpp
|
3.cpp
|
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
struct Node
{
int no;
int weight;
int max_val = INT_MIN;
int max_child_weight = INT_MIN;
};
vector <Node> adj[1000];
Node nodes[1000];
bool visited[1000];
void dfs(Node u)
{
visited[u.no] = true;
bool flag = false;
for(int i = 0; i < adj[u.no].size(); i++)
{
Node n = adj[u.no][i];
if(!visited[n.no]){
dfs(n);
flag = true;
}
}
if(!flag)
{
nodes[u.no].max_child_weight = nodes[u.no].weight;
nodes[u.no].max_val = nodes[u.no].weight;
}
for(int i = 0; i < adj[u.no].size(); i++)
{
Node x = adj[u.no][i];
nodes[u.no].max_child_weight = max(nodes[x.no].max_val,nodes[u.no].max_child_weight);
}
nodes[u.no].max_val = max(nodes[u.no].weight,nodes[u.no].max_child_weight);
}
int main()
{
int n,m;
cin>>n;
for(int i = 0; i < n; i++)
{
nodes[i].no = i;
cin>>nodes[i].weight;
nodes[i].max_val = nodes[i].weight;
}
cout<<"\nEnter the number of Edges : ";
cin>>m;
for(int i = 0; i < m; i++)
{
int u,v;
cin>>u>>v;
adj[u].pb(nodes[v]);
}
for(int i = 0; i < n; i++)
{
if(!visited[i])
{
dfs(nodes[i]);
}
}
int ans = INT_MIN;
for(int i = 0; i < n; i++)
{
//cout<<nodes[i].max_child_weight<<endl;
ans = max(ans, nodes[i].max_child_weight - nodes[i].weight);
}
cout<<ans<<endl;
return 0;
}
|
b2cf50f394cbc54ceb0bd08c8a0484e4e6e8c13b
|
bfc25ad1d6f57df069a5e456eb7ecfa8e5d0aba5
|
/seqSieve.cpp
|
8744e4bd551bddb369e21fe395fc587cf73a84c1
|
[] |
no_license
|
rjstorres/CPAR---The-Sieve-of-Erastosthenes
|
ea7abea4437b06a20401815621f297dd53ef7138
|
cd48312bdc7a1adfb5d155349a626fbbd2246bdf
|
refs/heads/master
| 2020-05-16T10:21:48.141632
| 2019-05-21T10:42:39
| 2019-05-21T10:42:39
| 182,980,367
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,351
|
cpp
|
seqSieve.cpp
|
#include <iostream>
#include <iomanip>
#include <math.h>
#include <omp.h>
#include <fstream>
#include <vector>
using namespace std;
double sequentialSieve (unsigned long long n)
{
n = pow(2,n);
vector<bool> primes(n,false);
unsigned long long k = 3;
double timeCounter = -(double)clock();
do
{
for (unsigned long long j = k*k ; j<n ; j+=2*k)
{ primes[j>>1]=true;
}
do
{
k+=2;
}while (k*k <= n && primes[k>>1]);
} while (k*k <= n);
int numberOfPrimes=0;
for (unsigned long long i=1; i<n; i+=2)
if (!primes[i>>1])
numberOfPrimes++;
timeCounter += (double)clock();
timeCounter /= CLOCKS_PER_SEC;
return timeCounter;
}
double sieveOpenMp(unsigned long long n, int n_threads){
n = pow(2,n);
vector<bool> primes(n,false); //initialized as false
unsigned long long k = 3;
double timeCounter = -(double)omp_get_wtime();
do
{
#pragma omp parallel for num_threads(n_threads)
for (unsigned long long j = k*k ; j<n ; j+=2*k)
{ primes[j>>1]=true;
}
do
{
k+=2;
}while (k*k <= n && primes[k>>1]);
} while (k*k <= n);
int numberOfPrimes=0;
for (unsigned long long i=1; i<n; i+=2)
if (!primes[i>>1])
numberOfPrimes++;
timeCounter += (double)(omp_get_wtime());
return timeCounter;
}
int main(){
std::ofstream myfile;
myfile.open("Benchmark1.csv");
myfile << "Algorithm, Run Number, 2^n size, Time, num_threads\n";
for (int j = 25; j <= 32; j ++ )
for (int i = 0; i < 3; i++)
{
double time = sequentialSieve(j);
myfile << "1," << i << "," << j << "," << setprecision(3) <<time <<",\n";
cout << "1," << i << "," << j << "," << setprecision(3) <<time <<",\n";
}
for (int k=2; k<=8;k++)
for (int j = 25; j <= 32; j ++ )
for (int i = 0; i < 3; i++)
{
double time = sieveOpenMp(j,k);
myfile << "1," << i << "," << j << "," << setprecision(3) <<time <<"," <<k<<",\n";
cout << "1," << i << "," << j << "," << setprecision(3) <<time <<"," <<k<<",\n";
}
return 0;
}
|
0dc47679acf6fab991d0be0129b21ec308777973
|
b34fa2931d6d3774925c03aa08495a2de494491e
|
/part-1/scanner/include/token.hpp
|
422c50e3dee14115c0c40dc63927d0935a88d3f8
|
[] |
no_license
|
Riounis/SparkAPITransformer
|
daa1d163d19f7ef4c3fa878c6141ab8e9a26c74e
|
323ab02a8703aca4e57140fe8134536e979dfed5
|
refs/heads/master
| 2020-04-05T01:44:00.223819
| 2018-12-13T02:52:56
| 2018-12-13T02:52:56
| 156,447,423
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,243
|
hpp
|
token.hpp
|
#ifndef TOKEN_HPP
#define TOKEN_HPP
#include <string>
#include <iostream>
#include "regex.hpp"
#define RESWORD 1
#define ID 2
#define NUM 3
#define STRING 4
#define SYM 5
#define SPACE 6
typedef struct {
int type;
std::string token;
std::string to_string() {
//std::cout << "in to_string\n";
//std::cout << token << std::endl;
std::string temp = "<"+token+", ";
if (type == RESWORD) {
//std::cout << "reserved word\n";
temp += "Reserved Word>";
}
if (type == ID) {
//std::cout << "identifier\n";
temp += "Identifier>";
}
if (type == NUM) {
//std::cout << "number\n";
temp += "Number>";
}
if (type == STRING) {
//std::cout << "string\n";
temp += "String>";
}
if (type == SYM) {
//std::cout << "symbol\n";
temp += "Symbol>";
}
if (type == SPACE) {
//std::cout << "space\n";
temp += "Space>";
}
return temp;
}
} Pair;
Pair get_token(std::string s);
bool is_valid(std::string s);
#endif
|
1eeada3e6420f608a30ab9aa7070fcd1e4f1aa36
|
a3d6556180e74af7b555f8d47d3fea55b94bcbda
|
/chrome/browser/ui/views/bookmarks/bookmark_menu_delegate_unittest.cc
|
42eebff97d35077cc056463cff7eb83beb190592
|
[
"BSD-3-Clause"
] |
permissive
|
chromium/chromium
|
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
|
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
|
refs/heads/main
| 2023-08-24T00:35:12.585945
| 2023-08-23T22:01:11
| 2023-08-23T22:01:11
| 120,360,765
| 17,408
| 7,102
|
BSD-3-Clause
| 2023-09-10T23:44:27
| 2018-02-05T20:55:32
| null |
UTF-8
|
C++
| false
| false
| 12,969
|
cc
|
bookmark_menu_delegate_unittest.cc
|
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h"
#include <memory>
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/bookmarks/bookmark_stats.h"
#include "chrome/browser/ui/toolbar/app_menu_model.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_profile.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/common/bookmark_metrics.h"
#include "components/bookmarks/test/bookmark_test_helpers.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h"
#include "ui/compositor/layer_tree_owner.h"
#include "ui/views/controls/menu/menu_delegate.h"
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/menu/submenu_view.h"
using base::ASCIIToUTF16;
using bookmarks::BookmarkModel;
using bookmarks::BookmarkNode;
namespace {
const char kBasePath[] = "file:///c:/tmp/";
} // namespace
class BookmarkMenuDelegateTest : public BrowserWithTestWindowTest {
public:
BookmarkMenuDelegateTest() : model_(nullptr) {}
BookmarkMenuDelegateTest(const BookmarkMenuDelegateTest&) = delete;
BookmarkMenuDelegateTest& operator=(const BookmarkMenuDelegateTest&) = delete;
void SetUp() override {
BrowserWithTestWindowTest::SetUp();
model_ = BookmarkModelFactory::GetForBrowserContext(profile());
bookmarks::test::WaitForBookmarkModelToLoad(model_);
AddTestData();
}
void TearDown() override {
DestroyDelegate();
BrowserWithTestWindowTest::TearDown();
}
TestingProfile::TestingFactories GetTestingFactories() override {
return {{BookmarkModelFactory::GetInstance(),
BookmarkModelFactory::GetDefaultFactory()},
{ManagedBookmarkServiceFactory::GetInstance(),
ManagedBookmarkServiceFactory::GetDefaultFactory()}};
}
protected:
bool ShouldCloseOnRemove(const bookmarks::BookmarkNode* node) const {
return bookmark_menu_delegate_->ShouldCloseOnRemove(node);
}
// Destroys the delegate. Do this rather than directly deleting
// |bookmark_menu_delegate_| as otherwise the menu is leaked.
void DestroyDelegate() {
if (!bookmark_menu_delegate_.get())
return;
// Since we never show the menu we need to pass the MenuItemView to
// MenuRunner so that the MenuItemView is destroyed.
views::MenuRunner menu_runner(bookmark_menu_delegate_->menu(), 0);
bookmark_menu_delegate_.reset();
}
void NewDelegate() {
DestroyDelegate();
bookmark_menu_delegate_ =
std::make_unique<BookmarkMenuDelegate>(browser(), nullptr);
}
void NewAndInitDelegateForPermanent() {
const BookmarkNode* node = model_->bookmark_bar_node();
NewDelegate();
bookmark_menu_delegate_->Init(&test_delegate_, nullptr, node, 0,
BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
BookmarkLaunchLocation::kNone);
}
const BookmarkNode* GetNodeForMenuItem(views::MenuItemView* menu) {
const auto& node_map = bookmark_menu_delegate_->menu_id_to_node_map_;
auto iter = node_map.find(menu->GetCommand());
return (iter == node_map.end()) ? nullptr : iter->second;
}
int next_menu_id() { return bookmark_menu_delegate_->next_menu_id_; }
// Forces all the menus to load by way of invoking WillShowMenu() on all menu
// items of tyep SUBMENU.
void LoadAllMenus() { LoadAllMenus(bookmark_menu_delegate_->menu()); }
raw_ptr<BookmarkModel, DanglingUntriaged> model_;
std::unique_ptr<BookmarkMenuDelegate> bookmark_menu_delegate_;
private:
void LoadAllMenus(views::MenuItemView* menu) {
EXPECT_EQ(views::MenuItemView::Type::kSubMenu, menu->GetType());
for (views::MenuItemView* item : menu->GetSubmenu()->GetMenuItems()) {
if (item->GetType() == views::MenuItemView::Type::kSubMenu) {
bookmark_menu_delegate_->WillShowMenu(item);
LoadAllMenus(item);
}
}
}
// Creates the following structure:
// bookmark bar node
// a
// F1
// f1a
// F11
// f11a
// F2
// other node
// oa
// OF1
// of1a
void AddTestData() {
const BookmarkNode* bb_node = model_->bookmark_bar_node();
std::string test_base(kBasePath);
model_->AddURL(bb_node, 0, u"a", GURL(test_base + "a"));
const BookmarkNode* f1 = model_->AddFolder(bb_node, 1, u"F1");
model_->AddURL(f1, 0, u"f1a", GURL(test_base + "f1a"));
const BookmarkNode* f11 = model_->AddFolder(f1, 1, u"F11");
model_->AddURL(f11, 0, u"f11a", GURL(test_base + "f11a"));
model_->AddFolder(bb_node, 2, u"F2");
// Children of the other node.
model_->AddURL(model_->other_node(), 0, u"oa", GURL(test_base + "oa"));
const BookmarkNode* of1 =
model_->AddFolder(model_->other_node(), 1, u"OF1");
model_->AddURL(of1, 0, u"of1a", GURL(test_base + "of1a"));
}
views::MenuDelegate test_delegate_;
};
TEST_F(BookmarkMenuDelegateTest, VerifyLazyLoad) {
NewAndInitDelegateForPermanent();
views::MenuItemView* root_item = bookmark_menu_delegate_->menu();
ASSERT_TRUE(root_item->HasSubmenu());
EXPECT_EQ(4u, root_item->GetSubmenu()->GetMenuItems().size());
EXPECT_EQ(5u, root_item->GetSubmenu()->children().size()); // + separator
views::MenuItemView* f1_item = root_item->GetSubmenu()->GetMenuItemAt(1);
ASSERT_TRUE(f1_item->HasSubmenu());
// f1 hasn't been loaded yet.
EXPECT_EQ(0u, f1_item->GetSubmenu()->GetMenuItems().size());
// Will show triggers a load.
int next_id_before_load = next_menu_id();
bookmark_menu_delegate_->WillShowMenu(f1_item);
// f1 should have loaded its children.
EXPECT_EQ(next_id_before_load + 2 * AppMenuModel::kNumUnboundedMenuTypes,
next_menu_id());
ASSERT_EQ(2u, f1_item->GetSubmenu()->GetMenuItems().size());
const BookmarkNode* f1_node =
model_->bookmark_bar_node()->children()[1].get();
EXPECT_EQ(f1_node->children()[0].get(),
GetNodeForMenuItem(f1_item->GetSubmenu()->GetMenuItemAt(0)));
EXPECT_EQ(f1_node->children()[1].get(),
GetNodeForMenuItem(f1_item->GetSubmenu()->GetMenuItemAt(1)));
// F11 shouldn't have loaded yet.
views::MenuItemView* f11_item = f1_item->GetSubmenu()->GetMenuItemAt(1);
ASSERT_TRUE(f11_item->HasSubmenu());
EXPECT_EQ(0u, f11_item->GetSubmenu()->GetMenuItems().size());
next_id_before_load = next_menu_id();
bookmark_menu_delegate_->WillShowMenu(f11_item);
// Invoke WillShowMenu() twice to make sure the second call doesn't cause
// problems.
bookmark_menu_delegate_->WillShowMenu(f11_item);
// F11 should have loaded its single child (f11a).
EXPECT_EQ(next_id_before_load + AppMenuModel::kNumUnboundedMenuTypes,
next_menu_id());
ASSERT_EQ(1u, f11_item->GetSubmenu()->GetMenuItems().size());
const BookmarkNode* f11_node = f1_node->children()[1].get();
EXPECT_EQ(f11_node->children()[0].get(),
GetNodeForMenuItem(f11_item->GetSubmenu()->GetMenuItemAt(0)));
}
// Verifies WillRemoveBookmarks() doesn't attempt to access MenuItemViews that
// have since been deleted.
TEST_F(BookmarkMenuDelegateTest, RemoveBookmarks) {
views::MenuDelegate test_delegate;
const BookmarkNode* node = model_->bookmark_bar_node()->children()[1].get();
NewDelegate();
bookmark_menu_delegate_->Init(&test_delegate, nullptr, node, 0,
BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS,
BookmarkLaunchLocation::kNone);
LoadAllMenus();
std::vector<const BookmarkNode*> nodes_to_remove = {
node->children()[1].get(),
};
bookmark_menu_delegate_->WillRemoveBookmarks(nodes_to_remove);
nodes_to_remove.clear();
bookmark_menu_delegate_->DidRemoveBookmarks();
}
// Verifies WillRemoveBookmarks() doesn't attempt to access MenuItemViews that
// have since been deleted.
TEST_F(BookmarkMenuDelegateTest, CloseOnRemove) {
views::MenuDelegate test_delegate;
const BookmarkNode* node = model_->bookmark_bar_node()->children()[1].get();
NewDelegate();
bookmark_menu_delegate_->Init(&test_delegate, nullptr, node, 0,
BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS,
BookmarkLaunchLocation::kNone);
// Any nodes on the bookmark bar should close on remove.
EXPECT_TRUE(
ShouldCloseOnRemove(model_->bookmark_bar_node()->children()[2].get()));
// Descendants of the bookmark should not close on remove.
EXPECT_FALSE(ShouldCloseOnRemove(
model_->bookmark_bar_node()->children()[1]->children()[0].get()));
EXPECT_FALSE(ShouldCloseOnRemove(model_->other_node()->children()[0].get()));
// Make it so the other node only has one child.
// Destroy the current delegate so that it doesn't have any references to
// deleted nodes.
DestroyDelegate();
while (model_->other_node()->children().size() > 1)
model_->Remove(model_->other_node()->children()[1].get(),
bookmarks::metrics::BookmarkEditSource::kOther);
NewDelegate();
bookmark_menu_delegate_->Init(&test_delegate, nullptr, node, 0,
BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS,
BookmarkLaunchLocation::kNone);
// Any nodes on the bookmark bar should close on remove.
EXPECT_TRUE(ShouldCloseOnRemove(model_->other_node()->children()[0].get()));
}
TEST_F(BookmarkMenuDelegateTest, DropCallback) {
views::MenuDelegate test_delegate;
const BookmarkNode* node = model_->bookmark_bar_node()->children()[1].get();
NewDelegate();
bookmark_menu_delegate_->Init(&test_delegate, nullptr, node, 0,
BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS,
BookmarkLaunchLocation::kNone);
LoadAllMenus();
views::MenuItemView* root_item = bookmark_menu_delegate_->menu();
gfx::Point menu_loc;
views::View::ConvertPointToScreen(root_item, &menu_loc);
ui::OSExchangeData drop_data;
drop_data.SetURL(GURL("http://www.chromium.org/"), std::u16string(u"z"));
ui::DropTargetEvent target_event(drop_data, gfx::PointF(menu_loc),
gfx::PointF(menu_loc),
ui::DragDropTypes::DRAG_COPY);
auto* f1_item = root_item->GetSubmenu()->GetMenuItemAt(1);
EXPECT_TRUE(bookmark_menu_delegate_->CanDrop(f1_item, drop_data));
EXPECT_EQ(model_->bookmark_bar_node()->children()[1]->children().size(), 2u);
auto drop_cb = bookmark_menu_delegate_->GetDropCallback(
f1_item, views::MenuDelegate::DropPosition::kAfter, target_event);
ui::mojom::DragOperation output_drag_op = ui::mojom::DragOperation::kNone;
std::move(drop_cb).Run(target_event, output_drag_op,
/*drag_image_layer_owner=*/nullptr);
EXPECT_EQ(output_drag_op, ui::mojom::DragOperation::kCopy);
EXPECT_EQ(model_->bookmark_bar_node()->children()[1]->children().size(), 3u);
}
TEST_F(BookmarkMenuDelegateTest, DropCallback_ModelChanged) {
views::MenuDelegate test_delegate;
const BookmarkNode* node = model_->bookmark_bar_node()->children()[1].get();
NewDelegate();
bookmark_menu_delegate_->Init(&test_delegate, nullptr, node, 0,
BookmarkMenuDelegate::HIDE_PERMANENT_FOLDERS,
BookmarkLaunchLocation::kNone);
LoadAllMenus();
views::MenuItemView* root_item = bookmark_menu_delegate_->menu();
gfx::Point menu_loc;
views::View::ConvertPointToScreen(root_item, &menu_loc);
ui::OSExchangeData drop_data;
drop_data.SetURL(GURL("http://www.chromium.org/"), std::u16string(u"z"));
ui::DropTargetEvent target_event(drop_data, gfx::PointF(menu_loc),
gfx::PointF(menu_loc),
ui::DragDropTypes::DRAG_COPY);
auto* f1_item = root_item->GetSubmenu()->GetMenuItemAt(1);
EXPECT_TRUE(bookmark_menu_delegate_->CanDrop(f1_item, drop_data));
EXPECT_EQ(model_->bookmark_bar_node()->children()[1]->children().size(), 2u);
auto drop_cb = bookmark_menu_delegate_->GetDropCallback(
f1_item, views::MenuDelegate::DropPosition::kAfter, target_event);
model_->AddURL(model_->bookmark_bar_node(), 2, u"z1",
GURL(std::string(kBasePath) + "z1"));
ui::mojom::DragOperation output_drag_op = ui::mojom::DragOperation::kNone;
std::move(drop_cb).Run(target_event, output_drag_op,
/*drag_image_layer_owner=*/nullptr);
EXPECT_EQ(output_drag_op, ui::mojom::DragOperation::kNone);
EXPECT_EQ(model_->bookmark_bar_node()->children()[1]->children().size(), 2u);
}
|
83da0baa91b9bf199683fe3b48ff70932e289888
|
00ce39387c73f99231b83d06a7add3b240f94a28
|
/1 - Freshman Year/Spring/CS182/SBBST/MySBBST.cpp
|
296f91c8e6fef37c914be9768b6dbde0993d0f5d
|
[] |
no_license
|
agincel/SIT
|
f2224dece26fafe851c1a18efd8f2dbfcbe622d5
|
42688ddfc4c359e79c328feeb1ca2a6c4a5e1352
|
refs/heads/master
| 2021-05-16T03:06:50.576161
| 2018-05-14T02:03:26
| 2018-05-14T02:03:26
| 35,850,044
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,669
|
cpp
|
MySBBST.cpp
|
#include "MySBBST.hh"
#include <iostream>
#include <cstring>
using namespace std;
/*
Adam Gincel
MySBBST.cpp
This file contains the isValidTree method for the AVL Tree.
I pledge my honor that I have abided by the Stevens Honor System.
*/
//public isValidTree
template bool MySBBST<int, int, intintCompare, intintCompare>::isValidTree();
template bool MySBBST<student, unsigned int, studentStudentComp, uintStudentComp>::isValidTree();
/*
isValidTree()
A public method that returns a boolean reflecting whether or not a tree is AVL compliant.
No input.
Return: A bool; true if tree is valid, false if tree is invalid.
*/
template <class Elem, class Key, class EEComp, class KEComp>
bool MySBBST<Elem, Key, EEComp, KEComp>::isValidTree()
{
return isValidTree(root);
}
//private isValidTree
template bool MySBBST<int, int, intintCompare, intintCompare>::isValidTree(MySBBSTNode *);
template bool MySBBST<student, unsigned int, studentStudentComp, uintStudentComp>::isValidTree(MySBBSTNode *);
/*
isValidTree()
A private recursive method that traverses the tree and checks to make sure there are no AVL violations.
Input: MySBBSTNode *node: The node being checked for an AVL violation.
Return: A bool; true if node is valid, false if node is invalid.
*/
template <class Elem, class Key, class EEComp, class KEComp>
bool MySBBST<Elem, Key, EEComp, KEComp>::isValidTree(MySBBSTNode *node)
{
if (node != NULL)
{
bool leftTest = isValidTree(node->leftChild);
bool rightTest = isValidTree(node->rightChild);
if (node->order > 1 || node->order < -1) //order is bad
return false;
else
return (leftTest && rightTest);
}
return true;
}
|
63d758d05fd362bdb60e3f19ef0040133a507723
|
d9008b05af4cc292233c0c4e14f0080e3be4f97a
|
/lang/System.h
|
2899edfb41636e6b4b8c31f76a07317ae527d913
|
[] |
no_license
|
hashikawau/backups
|
14890eefd1d0b3a374123fd217d3e665fde55662
|
eb6e239536ee0b5215db845303ce94f51e1f4dcb
|
refs/heads/master
| 2020-04-18T22:55:19.045846
| 2019-04-06T12:33:38
| 2019-04-06T12:33:38
| 167,808,035
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 485
|
h
|
System.h
|
#ifndef __Windows_lang_System
#define __Windows_lang_System
//===========================================================
//===========================================================
class System
{
private:
System();
~System();
public:
static long long int currentTimeMillis();
};
//===========================================================
//===========================================================
#endif //ifndef __Windows_lang_System
|
6c7fd263d1fda8842b4d8a198d1a3bb01003444b
|
4ca4d0ab0d5db7828cfd2af8a57bef13d1be5090
|
/atividade-03/include/Config.h
|
ed2bc96fa7b3110b83ba3dfd99fbc97912c49002
|
[] |
no_license
|
davicfg/UFRN-lp1-2020-5
|
8b97a881426f387770d331f5ce703b36f7d21951
|
941365732356795b14540bcc46cf8d0cfe4725f2
|
refs/heads/master
| 2022-11-24T19:41:47.159334
| 2020-07-21T02:00:56
| 2020-07-21T02:00:56
| 272,798,693
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 262
|
h
|
Config.h
|
#if !defined(CONIF_H)
#define CONIF_H
#include <string>
struct Config
{
Config(const std::string& filename);
std::string path;
std::string default_format;
std::string filename;
int load_config();
int create_default_file();
};
#endif // CONIF_H
|
9a8c8a476f08a3ecf85f5f77ce63d22519d82f42
|
24c6c4c156800d03ccc444306af5010ae600d465
|
/UVA/01. Accepted/01. Adhoc/12293 Box Game.cpp
|
d013db7c412b5effaefbec22d37117ee58272be5
|
[] |
no_license
|
RajibTheKing/ACMProgramming
|
5e1ba7e4271b372ddd2e2cf417bd1bffe5cd838a
|
d89e94fc671c7138c97d4fb9d197d5abbca99f6f
|
refs/heads/master
| 2021-12-14T01:33:09.537195
| 2021-12-05T19:58:17
| 2021-12-05T19:58:17
| 67,598,402
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 324
|
cpp
|
12293 Box Game.cpp
|
#include <stdio.h>
#define LL long long
int main ()
{
LL n;
while ( scanf ("%lld", &n) && n ) {
LL num = 1;
while ( num < n ) {
num *= 2;
num++;
}
if ( num == n ) printf ("Bob\n");
else printf ("Alice\n");
}
return 0;
}
|
7dda181be72ab47c1e6482efc963fbdae4839b6b
|
73e6b4b46006e4b0642941275552ae31d21dde35
|
/Algorithme et programmation/TP2/rendu/Teddy Dousset- Alexandre Pacaud.cpp
|
c3b4fa3a5c7f0c81f1c47c541f80731102f1c787
|
[] |
no_license
|
alejandro-reyesamaro/enseignement_nantes
|
6fe7430db1ee08e3b1e412d3821b8b886b430573
|
932dfa50ab8abbea2b6f605ead1fdcc4c35f8d60
|
refs/heads/master
| 2021-01-22T18:32:39.708860
| 2017-05-12T16:08:36
| 2017-05-12T16:08:36
| 85,087,797
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,159
|
cpp
|
Teddy Dousset- Alexandre Pacaud.cpp
|
//Alexandre Pacaud et Teddy Dousset groupe 243
#include <iostream>
#include <cmath>
using namespace std ;
bool nb_premier(int p) {
int i;
for (i=2; i<=sqrt(p); i++) { //un nombre est premier si on ne trouve aucun diviseur entre 2 et sa racine
if (p%i==0) { // on regarde si i divise p
return false;
}
}
return true;
}
int nb_min(int p) {
while (nb_premier(p)==false) { // tant que le nombre testé n'est pas premier, on passe au suivant
p=p+1;
}
return p;
}
int main()
{
int n;
do {
cout << "Entrez un nombre strictement positif : ";
cin >> n;
} while (n<=0); // Saisie forcée d'un entier strictement positif
cout << "Le nombre premier suivant ou égal de " << n << " est : " << nb_min(n) << "." <<endl;
return (0);
}
/* JEUX D'ESSAIS
Avec n=-9
Affiche " Entrez un nombre strictement positif : "
*
Avec n=0
Affiche " Entrez un nombre strictement positif : "
*
Avec n=29 (test avec un nombre premier)
Affiche "Le nombre premier suivant ou égal de 29 est : 29."
*
Avec n=30 (test avec un nombre non premier)
Affiche "Le nombre premier suivant ou égal de 30 est : 31."
*/
|
4ce4b014cbc0d06cffca448b25099f6d82828a54
|
680504735161a2ec8562e64a1c43a658e6656492
|
/ex3/valid_date.cpp
|
1ca222de631acfa96df98df81ca4884bddbbe5d3
|
[] |
no_license
|
fmi-lab/up-2018-kn-group2-sem
|
47b08060afcf4b81bd60ebbbfe684b7b34970d3b
|
7ff999b2da5a4c5bec871e1e4e33db71cd6bfc4f
|
refs/heads/master
| 2020-04-01T17:02:36.979052
| 2019-01-18T14:15:18
| 2019-01-18T14:15:18
| 153,410,264
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,007
|
cpp
|
valid_date.cpp
|
#include <iostream>
using namespace std;
int main() {
int day, month, year;
// input
cout << "Enter a date (dd mm yyyy): ";
cin >> day >> month >> year;
// it's a kind of magic
int maxDaysInMonth = 0;
// Option 1
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
maxDaysInMonth = 31;
} else if (month == 4 || month == 6 || month == 9 || month == 11) {
maxDaysInMonth = 30;
} else if (month == 2) {
bool isLeapYear = (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0));
maxDaysInMonth = isLeapYear ? 29 : 28;
}
// Option 2
// switch (month) {
// case 1: maxDaysInMonth = 31; break;
// case 2:
// bool isLeapYear = (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0));
// maxDaysInMonth = isLeapYear ? 29 : 28;
// break;
// case 3: maxDaysInMonth = 31; break;
// case 4: maxDaysInMonth = 30; break;
// case 5: maxDaysInMonth = 31; break;
// case 6: maxDaysInMonth = 30; break;
// case 7: maxDaysInMonth = 31; break;
// case 8: maxDaysInMonth = 31; break;
// case 9: maxDaysInMonth = 30; break;
// case 10: maxDaysInMonth = 31; break;
// case 11: maxDaysInMonth = 30; break;
// case 12: maxDaysInMonth = 31; break;
// default: maxDaysInMonth = 0;
// }
// Option 3
// switch (month) {
// case 1:
// case 3:
// case 5:
// case 7:
// case 8:
// case 10:
// case 12: maxDaysInMonth = 31; break;
// case 4:
// case 6:
// case 9:
// case 11: maxDaysInMonth = 30; break;
// case 2:
// bool isLeapYear = (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0));
// maxDaysInMonth = isLeapYear ? 29 : 28;
// // break;
// default: maxDaysInMonth = 0;
// }
bool isDateValid = (1 <= day && day <= maxDaysInMonth);
// output
if (isDateValid) {
cout << "Date is valid" << endl;
} else {
cout << "Date is NOT valid" << endl;
}
return 0;
}
|
8a1806be3cc0f658ac00351926454b9a9a856067
|
7baac8f89469c641f48d203646d47b2e3ff9988b
|
/66/WayToZero/main.cpp
|
ece7a879c01d8673c1e12ceb109b74361d717565
|
[] |
no_license
|
MaratZiganshin/EducationalCodeForces
|
d6b6fc40354d652305d322d70fb9e8f558f976eb
|
de88c66e7499d7a2ebbb48e4f92f1ced808586b8
|
refs/heads/master
| 2020-06-12T21:54:18.651115
| 2019-07-14T14:52:10
| 2019-07-14T14:52:10
| 194,437,169
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 680
|
cpp
|
main.cpp
|
#include <iostream>
#include <vector>
using namespace std;
int main() {
long long t;
cin >> t;
vector<long long> result;
for (long long i = 0; i < t; i++)
{
long long n, k;
cin >> n >> k;
long long count = 0;
while (n != 0)
{
if (n % k == 0)
{
n /= k;
count ++;
}
else
{
count += n % k;
n -= n % k;
}
}
result.push_back(count);
}
for (long long i = 0; i < result.size() - 1; i++)
cout << result[i] << endl;
cout << result[result.size() - 1];
}
|
2409d87f05d14a882fb8163220c0f74c168189e2
|
df0f62bd539c87e239e1836093443832fce84336
|
/perceptron_layer.cpp
|
6798c34b00fdf1e67ad23ec73c826a56c23b967d
|
[] |
no_license
|
rcomrad/PerceptronClassifier
|
a8d511c1778e00803077c1f98e8ea320a8f1139d
|
02c147c0576e7fb707f1e3ef3e43f6d296c5a3d3
|
refs/heads/master
| 2023-05-26T00:37:18.295699
| 2018-12-07T16:12:20
| 2018-12-07T16:12:20
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,570
|
cpp
|
perceptron_layer.cpp
|
#include "perceptron_layer.h"
//--------------------------------------------------------------------------------
// Perceptron layer implementation //
//--------------------------------------------------------------------------------
PerceptronLayer::PerceptronLayer(uint_32 aInputsNumber, uint_32 aNeuronsCount) :
mNeurons (aNeuronsCount, Perceptron(aInputsNumber))
{
//for (uint_32 i = 0; i < aNeuronsCount; ++i)
//{
// mNeurons.emplace_back(Perceptron(aInputsNumber));
//}
}
//--------------------------------------------------------------------------------
PerceptronLayer::~PerceptronLayer()
{
}
//--------------------------------------------------------------------------------
Args
PerceptronLayer::process(const Args &aInp)
{
Args resilt;
for (auto& i : mNeurons)
{
double cur = i.process(aInp);
resilt.emplace_back(cur);
}
return resilt;
}
//--------------------------------------------------------------------------------
Args
PerceptronLayer::correct(const Args &aInp)
{
for (int i = 0; i < mNeurons.size(); ++i)
{
mNeurons[i].changeWeights(aInp[i]);
}
// TODO:
return {};
}
//--------------------------------------------------------------------------------
uint_16
PerceptronLayer::size() const
{
return mNeurons.size();
}
//--------------------------------------------------------------------------------
const std::vector<double>&
PerceptronLayer::getPresentation(uint_32 aNeurin) const
{
return mNeurons[aNeurin].getPresentation();
}
//--------------------------------------------------------------------------------
|
bf0c2b11eb4a7e4e0407cba70912923d925dcff8
|
f0c4ebbf54d5aed19df22b760c5b0ce5257829c5
|
/shared/render/irenderable.cpp
|
9588daa136974aa45fdfabcbf289e2f59675d410
|
[
"MIT"
] |
permissive
|
proydakov/zeptobird
|
e85f3c5a2e3eca9b2bb63624d898c83e05f50318
|
c9e64aa8bd11e4ed9254bea222b03c6d027b6145
|
refs/heads/master
| 2021-06-16T02:16:05.766348
| 2021-04-18T12:51:43
| 2021-04-18T12:51:43
| 67,238,634
| 6
| 1
|
MIT
| 2019-06-16T17:08:31
| 2016-09-02T16:34:38
|
C++
|
UTF-8
|
C++
| false
| false
| 58
|
cpp
|
irenderable.cpp
|
#include "irenderable.h"
irenderable::~irenderable()
{
}
|
c590158c31764375bf23679509b2c202103e2f69
|
398786944277195735b76c47a6802097d5e7ee4b
|
/ImageProcessingFilters/vtkPolyDataMySQLTextWriter.cxx
|
761ad75313e7ef7e358c39a5bfe0643c0c973d2e
|
[
"BSD-2-Clause"
] |
permissive
|
krm15/GF2Exchange
|
8e56a12cf30695406591ef4e39205e2c09bc5712
|
690513a7edb90f2a58f4f771791d19cc1dd350fa
|
refs/heads/master
| 2021-01-24T18:39:45.425172
| 2017-03-09T17:53:59
| 2017-03-09T17:53:59
| 84,469,134
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,229
|
cxx
|
vtkPolyDataMySQLTextWriter.cxx
|
/*=========================================================================
Author: $Author: arnaudgelas $ // Author of last commit
Version: $Rev: 1150 $ // Revision of last commit
Date: $Date: 2010-03-30 15:00:47 -0400 (Tue, 30 Mar 2010) $ // Date of last commit
=========================================================================*/
/*=========================================================================
Authors: The GoFigure Dev. Team.
at Megason Lab, Systems biology, Harvard Medical school, 2009
Copyright (c) 2009, President and Fellows of Harvard College.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the President and Fellows of Harvard College
nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "vtkPolyDataMySQLTextWriter.h"
#include <sstream>
#include "vtkObjectFactory.h"
#include "vtkMath.h"
#include "vtkIdList.h"
#include "vtkSmartPointer.h"
vtkStandardNewMacro(vtkPolyDataMySQLTextWriter);
std::string vtkPolyDataMySQLTextWriter::GetMySQLText( vtkPolyData* iPolyData )
{
m_PolyData = iPolyData;
IsContour = IsPlanarContour();
if( IsContour )
{
return ContourProcessing();
}
else
{
return MeshProcessing();
}
}
vtkPolyDataMySQLTextWriter::vtkPolyDataMySQLTextWriter() : m_PolyData(0),
IsContour( true ) {}
vtkPolyDataMySQLTextWriter::~vtkPolyDataMySQLTextWriter() {}
bool vtkPolyDataMySQLTextWriter::IsPlanarContour()
{
double bounds[6];
m_PolyData->GetBounds( bounds );
for( int dim = 0; dim < 3; dim++ )
{
if( bounds[2*dim] == bounds[2*dim+1] )
{
return true;
}
}
return false;
}
std::string vtkPolyDataMySQLTextWriter::ContourProcessing()
{
vtkIdType N = m_PolyData->GetNumberOfPoints();
double pt[3];
std::stringstream oMyString;
oMyString <<N <<" ";
for( vtkIdType i = 0; i < N; i++ )
{
m_PolyData->GetPoint( i, pt );
oMyString <<pt[0] <<" " <<pt[1] <<" " <<pt[2] <<" ";
}
return oMyString.str();
}
std::string vtkPolyDataMySQLTextWriter::MeshProcessing()
{
vtkIdType N = m_PolyData->GetNumberOfPoints();
double pt[3];
std::stringstream oMyString;
oMyString <<N <<" ";
for( vtkIdType i = 0; i < N; i++ )
{
m_PolyData->GetPoint( i, pt );
oMyString <<pt[0] <<" " <<pt[1] <<" " <<pt[2] <<" ";
}
vtkSmartPointer< vtkIdList >
cell_points = vtkSmartPointer< vtkIdList >::New();
vtkIdType NbOfPointsInCell;
N = m_PolyData->GetNumberOfCells();
oMyString <<N <<" ";
for( vtkIdType i = 0; i < N; i++ )
{
m_PolyData->GetCellPoints( i, cell_points );
NbOfPointsInCell = cell_points->GetNumberOfIds();
oMyString <<NbOfPointsInCell <<" ";
for( vtkIdType k = 0; k < NbOfPointsInCell; k++ )
{
oMyString <<cell_points->GetId( k ) <<" ";
}
}
return oMyString.str();
}
|
b3b419620acd6e77e4229eee8045b526ccc0f041
|
31649ad74626b06a37a4f96d64bd75b10e0ff4b2
|
/Uva/501.cpp
|
b58d972525ef6abd498fcafb66b77a7cdccf0edb
|
[
"MIT"
] |
permissive
|
Dito9/ICPC
|
bd4d8ec92a6a58ed74d0d78328f2963e4bb9c1d0
|
757a9ee9fdd8cc83b5d9f3e492b6b5a8223d45aa
|
refs/heads/master
| 2020-05-15T07:27:02.745585
| 2014-03-07T07:01:28
| 2014-03-07T07:01:28
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,087
|
cpp
|
501.cpp
|
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <ctime>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb push_back
#define f(i,x,y) for(int i=x; i<y; i++)
#define FOR(it, A) for(typeof A.begin() it = A.begin(), it!=A.end(); it++)
#define quad(x) (x)*(x)
#define mp make_pair
#define clr(x,y) memset(x, y, sizeof x)
#define fst first
#define snd second
typedef pair<int, int>II;
typedef long long LL;
typedef long double LD;
int main(void){
int arr1[30001], arr2[30001];
int ind2, ncases, m, n;
scanf("%d",&ncases);
multiset<int> multi;
multiset<int>::iterator it;
for(int k=0; k<ncases; k++){
bool first=true;
multi.clear();
scanf("%d%d",&m,&n);
for(int i=0; i<m; i++){scanf("%d",&arr1[i]);}
for(int i=0; i<n; i++){scanf("%d",&arr2[i]);}
ind2 = 0;
for(int i=0; i<m; i++){
multi.insert(arr1[i]);
if (i!=0){ if(arr1[i]<(*it)){it--;}}
while(ind2<n && arr2[ind2]==i+1){
if(ind2==0) {it=multi.begin();
first=false;}
else{it++;}
printf("%d\n",*it);
ind2++;}
}
if ( k==(ncases-1) ){continue;}
else {printf("\n");}
}
return 0;
}
|
37935d046f46454087a8a7b9e49a7260910962ba
|
db01773d3f6dec3cb15dc9446eb75f41ec3757fc
|
/16/knapsack_01/knapsack_01.cpp
|
5a47e32ae90fd8813b5994edad3500b4bddf9ee5
|
[] |
no_license
|
coolsnowy/CLRS
|
786c23caa3f88e34b4146ac21e85c6854c6b01f1
|
6d78dbe3ff646259c2b263ef86ef44db64bdfd61
|
refs/heads/master
| 2020-03-24T16:56:25.819760
| 2018-10-15T04:27:47
| 2018-10-15T04:27:47
| 142,843,681
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,318
|
cpp
|
knapsack_01.cpp
|
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <list>
#include <stack>
#include <stdexcept>
#include <typeinfo>
#include <exception>
#include <queue>
#include <iterator>
#include <unistd.h>
#include <cassert>
#include <fstream>
#include <cmath>
#include <forward_list>
#include <ctime>
#include <array>
#include <sstream>
#include <iterator>
#include <numeric>
#include <algorithm>
#include <iomanip>
using namespace std;
struct object {
double weight;
double value;
};
int knapsack0_1 (vector<object> &vec, int w) {
vector<vector<double>> dp(vec.size() + 1, vector<double > (w + 1, 0));
int n = vec.size();
// be caution the place where use vector, should decrease the index by 1
for(int i = 1; i <= n; i++ ) {
for(int j = 1; j <= w; j++) {
if(j < vec[i - 1].weight) {
dp[i][j] = dp[i - 1][j];
} else {
dp[i][j] = std::max(dp[i - 1][j] , dp[i - 1][j - vec[i - 1].weight] + vec[i - 1].value);
}
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= w; j++) {
cout << dp[i][j] << " ";
}
cout << endl;
}
return dp[n][w];
}
int main() {
// {weight, value}
// vector<object> vec{{5, 12}, {4, 3}, {7, 10}, {2, 3}, {6, 6}};
vector<object> vec{{1, 60}, {2, 20}, {3, 120}};
auto result = knapsack0_1(vec, 5);
cout << result;
}
|
5a1dad83543070e9d56bfbf64622a50b6ac9a1e5
|
63bce0eee182ff7674a333aa4475d2273189b4fb
|
/SEM 3/DSPS/Assignment 2/Assignment2.cpp
|
04ddfa0916a29d3d83ee00f6d21a37405cc61bf5
|
[] |
no_license
|
abrar-abu/Engineering
|
0538d7bd0b2925560f668c28349e0596de117ac5
|
e8c7f2c146bef4b1a04d545e2a0ddd163d3dfebe
|
refs/heads/master
| 2021-08-06T14:48:48.627249
| 2017-11-06T07:40:12
| 2017-11-06T07:40:12
| 106,986,470
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,605
|
cpp
|
Assignment2.cpp
|
/*
* @Author: ubuntu
* @Date: 2017-11-06 11:23:27
* @Last Modified 2017-11-06
* @Last Modified time: 2017-11-06 11:33:10
*/
#include<iostream>
using namespace std;
class node //Declaration of Class
{
public:
int data;
node *prev;
node *next;
node() //Default Constructor
{
prev=next=NULL;
}
};
class dcll //Declaration of Class
{
public:
node *head;
void create(); //Prototype for create function
void display(); //Prototype for display function
void insert_beg(); //Prototype for insert_beg function
void insert_end(); //Prototype for insert_end function
void insert_between(); //Prototype for insert_between function
void del_beg(); //Prototype for del_beg function
void del_end(); //Prototype for del_end function
void del_between(); //Prototype for del_between function
void search(); //Prototype for search function
dcll() //Constructor Defination
{
head=NULL;
}
};
void dcll::create() //Creating the node
{
int flag=1;
char ans;
node *p,*temp;
head=new node;
do
{
p=new node;
p->next=NULL;
p->prev=NULL;
cout<<"\nEnter the data:";
cin>>p->data;
if(flag==1) //Flag for head node
{
head=p;
p->prev=head;
p->next=head;
flag=0; //Resting flag for other nodes
}
else
{
temp=head;
while(temp->next!=head) //Finding last node
temp=temp->next;
p->next=head;
p->prev=temp;
temp->next=p;
head->prev=p;
}
cout<<"\nYou want to enter more nodes?:";
cin>>ans;
}
while(ans=='Y'||ans=='y');
}
void dcll::display() //Function for Displaying node
{
node *temp;
temp=head;
if(temp==NULL)
cout<<"\n LIST IS EMPTY"; //Check the list is EMPTY or NOT
else
do
{
cout<<temp->data<<"==> ";
temp=temp->next;
}while(temp!=head);
}
void dcll::insert_beg() //Function for Insert at Start
{
node *p,*temp;
p=new node;
p->next=NULL;
p->prev=NULL;
cout<<"\nEnter data:";
cin>>p->data;
if(head==NULL) //If list is EMPTY,take new node as head
{
head=p;
p->prev=head;
p->next=head;
}
else
{
temp=head;
while(temp->next!=head)
temp=temp->next;
p->next=head;
p->prev=temp;
head->prev=p;
temp->next=p;
head=p;
}
cout<<"\nNode is inserted!";
}
void dcll::insert_end() //Function for Inserting node at end
{
node *p,*temp;
p=new node;
p->prev=NULL;
p->next=NULL;
cout<<"\nEnter the data:";
cin>>p->data;
if(head==NULL) //If list is EMPTY,take new node as HEAD
{
head=p;
p->next=head;
p->prev=head;
}
else
{
temp=head;
while(temp->next!=head)
temp=temp->next;
p->next=head;
p->prev=temp;
head->prev=p;
temp->next=p;
temp->next->prev=temp;
}
cout<<"\nNode is inserted!!";
}
void dcll::insert_between() //Function for Inserting node in Between
{
int element;
node *p,*temp;
p=new node;
p->next=NULL;
p->prev=NULL;
cout<<"\nEnter the data:";
cin>>p->data;
if(head==NULL)
{
head=p;
}
else
{
cout<<"\nEnter the element after which you want to insert node:";
cin>>element;
temp=head;
do
{
if(temp->data==element)
{
p->next=temp->next;
(temp->next)->prev=p;
temp->next=p;
p->prev=temp;
return;
}
else
{
temp=temp->next;
}
}while(temp!=head);
}
cout<<"\nNode is inserted!!";
}
void dcll::del_beg() //Function for deleting the node at Start
{
node *temp,*temp1;
temp=head;
temp1=temp->next;
while(temp->next!=head)
{
temp=temp->next;
}
temp->next=temp1;
temp1->prev=temp;
delete head;
head=temp1;
cout<<"\nDeleted the node at the beginning!!";
}
void dcll::del_end() //Function for Deleting the node at End
{
node *temp,*temp1;
temp=head;
while(temp->next!=head)
{
temp=temp->next;
}
temp1=temp->prev;
temp1->next=head;
head->prev=temp1;
delete temp;
temp=temp1;
cout<<"\n node in the last is deleted";
}
void dcll::del_between() //Function for Deleting the in Between node
{
node *temp,*temp1;
int element;
cout<<"\nEnter the data you want to delete:";
cin>>element;
temp=head;
if(temp->data==element)
{
temp=temp->next;
if(temp==temp1)
{
temp=temp1=NULL;
delete head;
cout<<"\n Node is deleted,linked list is empty";
}
else
{
while(temp->next!=head)
temp=temp->next;
temp->next=temp1;
temp1->prev=temp;
head=temp1;
cout<<"\nNode is deleted ";
}
}
else
{
while(temp->next!=head)
{
if((temp->next)->data==element)
{
temp1=temp->next;
temp->next=temp1->next;
(temp1->next)->prev=temp;
delete temp1;
cout<<"\nNode is deleted";
}
else
temp=temp->next;
}
}
}
void dcll::search() //Search Function
{
int element;
cout<<"\nEnter the element you want to search:";
cin>>element;
node *temp;
int flag;
temp=head;
if(temp==NULL) //Checking for EMPTY list condition
{
cout<<"\nThe list is empty";
}
flag=0;
while(temp->next!=head && flag==0)
{
if(temp->data==element)
{
flag=1;
}
else
{
temp=temp->next;
}
}
if(flag==1)
{
cout<<"\nThe node is present";
}
else
{
cout<<"The node is not present";
}
}
int main()
{
node n;
dcll d; //Object is Created
int c;
do
{
cout<<"\n Enter the option you want to perform with nodes: "<<endl;
cout<<"1.CREATE "<<endl;
cout<<"2.DISPLAY "<<endl;
cout<<"3.INSERT AT BEGINNING "<<endl;
cout<<"4.INSERT AT END "<<endl;
cout<<"5.INSERT IN BETWEEN "<<endl;
cout<<"6.DELETE NODE AT BEGINNING "<<endl;
cout<<"7.DELETE THE NODE AT THE END "<<endl;
cout<<"8.DELETE IN BETWEEN "<<endl;
cout<<"9.SEARCH THE NODE "<<endl;
cout<<"10.EXIT "<<endl;
cin>>c; //function calling
switch(c)
{
case 1:d.create();
break;
case 2:d.display();
break;
case 3:d.insert_beg();
break;
case 4:d.insert_end();
break;
case 5:d.insert_between();
break;
case 6:d.del_beg();
break;
case 7:d.del_end();
break;
case 8:d.del_between();
break;
case 9:d.search();
break;
case 10:break;
}
}while(c!=10);
return 0;
}
|
6b4a3a540e2a14cc08e1641197a447907aae4142
|
fa50ab598350886d1dc3190a0f4861f637668b95
|
/source/tnn/core/default_network.cc
|
ed022ccc421d2aa98371f30c4b851dd5fe87dbdf
|
[
"BSD-3-Clause"
] |
permissive
|
shaundai-tencent/TNN
|
d3cfe79da2cb5b70cbcf6fa9a00467da529485e4
|
6913aecb193c584e3fe4fcb32508d417744827c4
|
refs/heads/master
| 2023-07-17T14:57:52.586520
| 2021-08-17T06:04:19
| 2021-08-17T06:04:19
| 397,153,709
| 1
| 0
|
NOASSERTION
| 2021-08-17T07:32:31
| 2021-08-17T07:32:30
| null |
UTF-8
|
C++
| false
| false
| 26,727
|
cc
|
default_network.cc
|
// Tencent is pleased to support the open source community by making TNN available.
//
// Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#include "tnn/core/default_network.h"
#include <string.h>
#include "tnn/core/blob_int8.h"
#include "tnn/core/profile.h"
#include "tnn/interpreter/default_model_interpreter.h"
#include "tnn/interpreter/layer_param.h"
#include "tnn/interpreter/layer_resource_generator.h"
#include "tnn/memory_manager/blob_memory_pool_factory.h"
#include "tnn/optimizer/net_optimizer_manager.h"
#include "tnn/utils/blob_dump_utils.h"
#include "tnn/utils/blob_transfer_utils.h"
#include "tnn/utils/cpu_utils.h"
#include "tnn/utils/data_flag_utils.h"
#include "tnn/utils/dims_utils.h"
#include "tnn/utils/md5.h"
#include "tnn/utils/string_utils_inner.h"
namespace TNN_NS {
//reserved for incompatible
const std::string CACHE_TAG = "d1";
NetworkImplFactoryRegister<NetworkImplFactory<DefaultNetwork>> g_network_impl_default_factory_register(
NETWORK_TYPE_DEFAULT);
std::mutex DefaultNetwork::optimize_mtx_;
DefaultNetwork::DefaultNetwork()
: device_(nullptr), context_(nullptr), blob_manager_(nullptr), net_structure_(nullptr) {}
DefaultNetwork::~DefaultNetwork() {
DeInit();
}
Status DefaultNetwork::SetCpuNumThreads(int num_threads) {
if (context_)
return context_->SetNumThreads(num_threads);
else
return Status(TNNERR_CONTEXT_ERR, "context is nil");
}
/*
* The Network holds blob, blobmanager, layers etc.
* Those object is initialized in this function.
*/
Status DefaultNetwork::Init(NetworkConfig &net_config, ModelConfig &model_config, AbstractModelInterpreter *interpreter,
InputShapesMap min_inputs_shape, InputShapesMap max_inputs_shape, bool enable_const_folder) {
config_ = net_config;
Status ret = TNN_OK;
DefaultModelInterpreter *default_interpreter = dynamic_cast<DefaultModelInterpreter *>(interpreter);
CHECK_PARAM_NULL(default_interpreter);
NetStructure *net_structure = default_interpreter->GetNetStructure();
NetResource *net_resource = default_interpreter->GetNetResource();
if (net_structure == NULL || net_resource == NULL) {
LOGE("ERROR: network_ is nil, network_type may not support\n");
return Status(TNNERR_NULL_PARAM, "network_ is nil, network_type may not support");
}
device_ = GetDevice(net_config.device_type);
RETURN_VALUE_ON_NEQ(device_ != NULL, true, TNNERR_DEVICE_NOT_SUPPORT);
context_ = device_->CreateContext(net_config.device_id);
RETURN_VALUE_ON_NEQ(context_ != NULL, true, TNNERR_DEVICE_CONTEXT_CREATE);
#ifdef DEBUG
{
static bool cpu_support_fp16 = CpuUtils::CpuSupportFp16();
LOGD("support fp 16: %d\n", cpu_support_fp16 ? 1 : 0);
}
#endif
context_->SetPrecision(net_config.precision);
context_->SetEnableTuneKernel(net_config.enable_tune_kernel);
if(!net_config.cache_path.empty()) {
auto params_md5 = default_interpreter->GetParamsMd5();
if (params_md5.size() < 1) {
return Status(TNNERR_PARAM_ERR, "model params md5 missing");
}
context_->SetCachePath(net_config.cache_path);
context_->SetCacheFilePath(GenerateCacheFileName(model_config, params_md5[0]));
}
ret = context_->LoadLibrary(net_config.library_path);
RETURN_ON_NEQ(ret, TNN_OK);
/*
* The NetOptimizeManager holds a list of network optimization processes.
* The optimization process may change the network structure accoundingly.
* eg. fuse conv+bn, conv+relu.
*/
if (runtime_model_ == RUNTIME_MODE_NORMAL) {
// use mutex to protect net_resource and net_structure in multi-thread
std::unique_lock<std::mutex> lck(optimize_mtx_);
ret = optimizer::NetOptimizerManager::Optimize(net_structure, net_resource, net_config);
RETURN_ON_NEQ(ret, TNN_OK);
}
blob_manager_ = new BlobManager(device_);
ret = blob_manager_->Init(net_config, net_structure, max_inputs_shape, GetNetResourceDataType(net_resource));
RETURN_ON_NEQ(ret, TNN_OK);
ret = InitLayers(net_structure, net_resource);
RETURN_ON_NEQ(ret, TNN_OK);
ret = AllocateBlobMemory();
RETURN_ON_NEQ(ret, TNN_OK);
net_structure_ = net_structure;
net_resource_ = net_resource;
ret = context_->OnInstanceReshapeBegin();
RETURN_ON_NEQ(ret, TNN_OK);
ret = ReshapeLayers();
RETURN_ON_NEQ(ret, TNN_OK);
ret = context_->OnInstanceReshapeEnd();
return ret;
}
static inline bool IsLayoutReformatLayer(std::shared_ptr<LayerInfo> layer) {
if (layer->type == LAYER_REFORMAT) {
auto param = dynamic_cast<ReformatLayerParam *>(layer->param.get());
if (param->src_format != param->dst_format) {
return true;
}
}
return false;
}
/*
* InitLayer function does the following things:
* 1. Set Blob type accordingly.
* 2. Set data_type accordingly.
* 3. Infer the blob shapes.
* 4. Check the weights required.
*/
Status DefaultNetwork::InitLayers(NetStructure *net_structure, NetResource *net_resource) {
Status ret = TNN_OK;
bool is_quantized_net = GetQuantizedInfoFromNetStructure(net_structure);
// mark const blobs and blob data type
auto const_blobs = net_resource->constant_map;
for (auto layer_info : net_structure->layers) {
std::vector<std::string> &input_names = layer_info->inputs;
for (auto name : input_names) {
auto blob = blob_manager_->GetBlob(name);
if (const_blobs.find(name) != const_blobs.end()) {
if (runtime_model_ == RUNTIME_MODE_NORMAL) {
blob->SetFlag(DATA_FLAG_CHANGE_NEVER);
}
blob->GetBlobDesc().data_type = const_blobs[name]->GetDataType();
}
}
}
auto const_layers = net_resource->constant_layers;
// update blob precision, alloc new blob required
for (auto layer_info : net_structure->layers) {
if (runtime_model_ == RUNTIME_MODE_NORMAL && const_layers.find(layer_info->name) != const_layers.end()) {
continue;
}
// set layer nodes
std::vector<std::string> &input_names = layer_info->inputs;
std::vector<std::string> &output_names = layer_info->outputs;
DataFormat input_fmt = DATA_FORMAT_AUTO;
for (auto name : input_names) {
auto blob = blob_manager_->GetBlob(name);
// skip const blobs
if (const_blobs.count(name) == 0) {
input_fmt = blob->GetBlobDesc().data_format;
auto ret = UpdateBlobPrecision(layer_info, true, is_quantized_net, name, net_resource, &blob);
RETURN_ON_NEQ(ret, TNN_OK);
}
}
// output layout equals to input layout except for layout_reformat layer
DataFormat output_fmt = IsLayoutReformatLayer(layer_info) ?
dynamic_cast<ReformatLayerParam *>(layer_info->param.get())->dst_format : input_fmt;
#ifdef GENERATE_RESOURCE
if (runtime_model_ == RUNTIME_MODE_NORMAL) {
LayerType type = layer_info->type;
BaseLayer *cur_layer = CreateLayer(type);
if (cur_layer == NULL) {
LOGE("Error: CreateLayer failed, type:%d\n", type);
return Status(TNNERR_PARAM_ERR, "CreateLayer failed");
}
std::string layer_name = layer_info->name;
cur_layer->SetLayerName(layer_name);
cur_layer->SetRuntimeMode(runtime_model_);
cur_layer->SetConstantResource(&net_resource->constant_map);
cur_layer->SetConstantResourceFlag(&net_resource->constant_blob_flags);
std::vector<Blob *> inputs;
std::vector<Blob *> outputs_for_shape;
for (auto name : input_names) {
inputs.push_back(blob_manager_->GetBlob(name));
}
for (auto name : output_names) {
outputs_for_shape.push_back(blob_manager_->GetBlob(name));
}
// generate resource if null
if (net_resource->resource_map.count(layer_name) == 0) {
LayerParam *layer_param = layer_info->param.get();
LayerResource *layer_res = nullptr;
GenerateRandomResource(type, layer_param, &layer_res, inputs, &net_resource->constant_map);
net_resource->resource_map[layer_name] = std::shared_ptr<LayerResource>(layer_res);
}
cur_layer->InferShapeAhead(inputs, outputs_for_shape, layer_info->param.get(),
net_resource->resource_map[layer_name].get());
delete cur_layer;
}
#endif
for (auto name : output_names) {
auto blob = blob_manager_->GetBlob(name);
// skip const blobs
if (const_blobs.count(name) == 0) {
blob->GetBlobDesc().data_format = output_fmt;
auto ret = UpdateBlobPrecision(layer_info, false, is_quantized_net, name, net_resource, &blob);
RETURN_ON_NEQ(ret, TNN_OK);
}
}
}
// init layer
for (auto layer_info : net_structure->layers) {
if (runtime_model_ == RUNTIME_MODE_NORMAL && const_layers.find(layer_info->name) != const_layers.end()) {
continue;
}
LayerType type = layer_info->type;
BaseLayer *cur_layer = CreateLayer(type);
if (cur_layer == NULL) {
LOGE("Error: CreateLayer failed, type:%d\n", type);
return Status(TNNERR_PARAM_ERR, "CreateLayer failed");
}
std::string layer_name = layer_info->name;
cur_layer->SetLayerName(layer_name);
// set layer nodes
std::vector<Blob *> inputs;
std::vector<std::string> &input_names = layer_info->inputs;
for (auto name : input_names) {
auto blob = blob_manager_->GetBlob(name);
if (blob == nullptr) {
delete cur_layer;
LOGE("Input of layer(%s) are invalid", layer_name.c_str());
return Status(TNNERR_PARAM_ERR, "Input of layer are invalid");
}
// update layout reformat layer's param and blob datatype
if (IsLayoutReformatLayer(layer_info)) {
// only need to update model's input blob datatype
// others are already updated in UpdateBlobPrecision method
if (net_structure->inputs_shape_map.find(name) != net_structure->inputs_shape_map.end()) {
auto dtype = blob_manager_->GetBlob(layer_info->outputs[0])->GetBlobDesc().data_type;
LOGD("DefaultNetwork::InitLayers LayoutReformat set input: %s datatype as: %d\n",
name.c_str(), dtype);
blob->GetBlobDesc().data_type = dtype;
}
auto param = dynamic_cast<ReformatLayerParam *>(layer_info->param.get());
param->src_type = blob->GetBlobDesc().data_type;
param->dst_type = param->src_type;
}
inputs.push_back(blob);
}
std::vector<Blob *> outputs;
std::vector<std::string> &output_names = layer_info->outputs;
for (auto name : output_names) {
auto blob = blob_manager_->GetBlob(name);
if (blob == nullptr) {
delete cur_layer;
LOGE("Output of layer(%s) are invalid", layer_name.c_str());
return Status(TNNERR_PARAM_ERR, "Output of layer are invalid");
}
outputs.push_back(blob);
}
LayerResource *layer_resource = nullptr;
if (net_resource->resource_map.count(layer_name) != 0) {
layer_resource = net_resource->resource_map[layer_name].get();
}
cur_layer->SetRuntimeMode(runtime_model_);
cur_layer->SetConstantResource(&net_resource->constant_map);
cur_layer->SetConstantResourceFlag(&net_resource->constant_blob_flags);
ret = cur_layer->Init(context_, layer_info->param.get(), layer_resource, inputs, outputs, device_);
if (ret != TNN_OK) {
LOGE("Error Init layer %s (err: %d or 0x%X)\n", cur_layer->GetLayerName().c_str(), (int)ret, (int)ret);
// release layer if Init failed
delete cur_layer;
return ret;
}
cur_layer->SetRuntimeBlobMemoryPool(runtime_blob_pool_);
layers_.push_back(cur_layer);
}
return ret;
}
Status DefaultNetwork::AllocateBlobMemory() {
return blob_manager_->AllocateBlobMemory(DATA_FLAG_CHANGE_ALWAYS);
}
Status DefaultNetwork::GenerateInt8Blob(const std::string &name, NetResource *net_resource, Blob **blob) {
auto new_blob = new BlobInt8((*blob)->GetBlobDesc(), (*blob)->GetHandle());
CHECK_PARAM_NULL(new_blob);
std::string blob_scale_name = name + "_scale_data_";
#ifdef GENERATE_RESOURCE
if (net_resource->resource_map.count(blob_scale_name) == 0) {
LayerResource *layer_res = nullptr;
std::vector<Blob *> blobs = {*blob};
GenerateRandomResource(LAYER_BLOB_SCALE, nullptr, &layer_res, blobs);
net_resource->resource_map[blob_scale_name] = std::shared_ptr<LayerResource>(layer_res);
}
#endif
if (net_resource->resource_map.find(blob_scale_name) == net_resource->resource_map.end()) {
LOGE("Error Init layer, can not get output blob scale %s \n", blob_scale_name.c_str());
return TNNERR_NULL_PARAM;
}
new_blob->SetIntResource(reinterpret_cast<IntScaleResource *>(net_resource->resource_map[blob_scale_name].get()));
blob_manager_->ReplaceBlob(name, new_blob);
*blob = new_blob;
return TNN_OK;
}
Status DefaultNetwork::UpdateBlobPrecision(std::shared_ptr<LayerInfo> layer_info, bool is_input, bool is_quantized_net,
const std::string &name, NetResource *net_resource, Blob **blob) {
if (device_->GetDeviceType() != DEVICE_ARM && device_->GetDeviceType() != DEVICE_NAIVE &&
device_->GetDeviceType() != DEVICE_X86) {
return TNN_OK;
}
auto &desc = (*blob)->GetBlobDesc();
auto layer_type = layer_info->type;
if (layer_type != LAYER_REFORMAT) {
// non-reformat layer
if (is_quantized_net) {
// update blob of quantized network by layer info
if (layer_info->param->quantized && desc.data_type != DATA_TYPE_INT8) {
RETURN_ON_NEQ(GenerateInt8Blob(name, net_resource, blob), TNN_OK);
}
} else {
// update blob of non-quantized network by precision
auto original_data_type = desc.data_type;
if (original_data_type == DATA_TYPE_FLOAT || original_data_type == DATA_TYPE_HALF ||
original_data_type == DATA_TYPE_BFP16) {
if (config_.precision == PRECISION_NORMAL || config_.precision == PRECISION_AUTO) {
static bool cpu_support_fp16 = CpuUtils::CpuSupportFp16();
bool layer_implemented_fp16 = device_->GetImplementedPrecision(layer_type)->fp16_implemented;
desc.data_type = (cpu_support_fp16 && layer_implemented_fp16) ? DATA_TYPE_HALF : DATA_TYPE_FLOAT;
} else if (config_.precision == PRECISION_LOW) {
if (device_->GetDeviceType() == DEVICE_ARM) {
desc.data_type = DATA_TYPE_BFP16;
} else if (device_->GetDeviceType() == DEVICE_NAIVE ||
device_->GetDeviceType() == DEVICE_X86) {
desc.data_type = DATA_TYPE_FLOAT;
}
} else if (config_.precision == PRECISION_HIGH) {
desc.data_type = DATA_TYPE_FLOAT;
} else {
return Status(TNNERR_PARAM_ERR, "invalid precision");
}
}
}
} else {
// layout reformat, update later
if (IsLayoutReformatLayer(layer_info)) {
return TNN_OK;
}
// datatype reformat, update by layer param
if (is_input) {
auto src_type = reinterpret_cast<ReformatLayerParam *>(layer_info->param.get())->src_type;
if (src_type == DATA_TYPE_INT8) {
RETURN_ON_NEQ(GenerateInt8Blob(name, net_resource, blob), TNN_OK);
} else {
desc.data_type = src_type;
}
} else {
auto dst_type = reinterpret_cast<ReformatLayerParam *>(layer_info->param.get())->dst_type;
if (dst_type == DATA_TYPE_INT8) {
RETURN_ON_NEQ(GenerateInt8Blob(name, net_resource, blob), TNN_OK);
} else {
desc.data_type = dst_type;
}
}
}
return TNN_OK;
}
Status DefaultNetwork::GetForwardMemorySize(int &memory_size) {
memory_size = blob_manager_->GetAllBlobMemorySize();
return TNN_OK;
}
Status DefaultNetwork::SetForwardMemory(void *memory) {
return blob_manager_->SetForwardMemory(memory);
}
Status DefaultNetwork::GetAllInputBlobs(BlobMap &blobs) {
blob_manager_->GetAllInputBlobs(blobs);
return TNN_OK;
}
/*
* Returns the default output blobs in the network.
* Additional output blob may be assigned with TNN::AddOutput function
*/
Status DefaultNetwork::GetAllOutputBlobs(BlobMap &blobs) {
blob_manager_->GetAllOutputBlobs(blobs);
return TNN_OK;
}
/*
* Reshape function is called when the input shape changes.
* Memory allocation may be involved in Reshape function.
*/
Status DefaultNetwork::Reshape(const InputShapesMap &inputs) {
Status ret = TNN_OK;
bool shape_changed = false;
ret = PrepareDoReshape(inputs, shape_changed);
if(ret != TNN_OK) {
return ret;
}
if(shape_changed) {
return DoReshape();
}
return ret;
}
Status DefaultNetwork::PrepareDoReshape(const InputShapesMap& inputs, bool& shape_changed) {
shape_changed = false;
for (auto iter : inputs) {
Blob *blob = blob_manager_->GetBlob(iter.first);
if (blob == nullptr) {
LOGE("DefaultNetwork reshape blob is empty, maybe the blob name is wrong\n");
return Status(TNNERR_PARAM_ERR, "DefaultNetwork reshape blob is empty, maybe the blob name is wrong");
}
if(!DimsVectorUtils::Equal(blob->GetBlobDesc().dims, iter.second)) {
blob->GetBlobDesc().dims = iter.second;
shape_changed = true;
}
}
return TNN_OK;
}
Status DefaultNetwork::DoReshape() {
Status ret = TNN_OK;
ret = context_->OnInstanceReshapeBegin();
if (ret != TNN_OK) {
return ret;
}
ret = ReshapeLayers();
if (ret != TNN_OK) {
return ret;
}
ret = context_->OnInstanceReshapeEnd();
return ret;
}
Status DefaultNetwork::DeInit() {
for (size_t i = 0; i < layers_.size(); i++) {
if (layers_[i] != NULL) {
delete layers_[i];
}
}
layers_.clear();
if (blob_manager_ != NULL) {
delete blob_manager_;
blob_manager_ = NULL;
}
if (runtime_blob_pool_ != nullptr) {
delete runtime_blob_pool_;
runtime_blob_pool_ = nullptr;
}
if (context_ != NULL) {
delete context_;
context_ = NULL;
}
return TNN_OK;
}
/*
* CommandQueue is an abstract object.
* The actual object maybe:
* 1. OpenCl commnadqueue.
* 2. Metal command buffer.
* 3. Cuda Stream
* ...
*/
Status DefaultNetwork::GetCommandQueue(void **command_queue) {
if (context_ == NULL) {
return TNNERR_DEVICE_CONTEXT_CREATE;
}
return context_->GetCommandQueue(command_queue);
}
Status DefaultNetwork::ShareCommandQueue(AbstractNetwork *network) {
if (context_ == NULL) {
return TNNERR_DEVICE_CONTEXT_CREATE;
}
auto network_target = dynamic_cast<DefaultNetwork *>(network);
if (!network_target) {
return Status(TNNERR_DEVICE_CONTEXT_CREATE, "inpute network is DefaultNetwork");
}
return context_->ShareCommandQueue(network_target->GetContext());
}
Context* DefaultNetwork::GetContext() {
return context_;
}
Status DefaultNetwork::Forward() {
auto status = blob_manager_->CheckBlobMemoryState();
RETURN_ON_NEQ(status, TNN_OK);
if (runtime_blob_pool_) {
//now we allocate blob eachtime when running acc, so clear blob pool to avoid memory leak
runtime_blob_pool_->ClearBlobMemoryPool();
}
status = context_->OnInstanceForwardBegin();
RETURN_ON_NEQ(status, TNN_OK);
int cnt = 0;
for (auto layer : layers_) {
std::vector<Blob *> inputs = layer->GetInputBlobs();
std::vector<Blob *> outputs = layer->GetOutputBlobs();
{
#if DUMP_INPUT_BLOB
if (runtime_model_ == RUNTIME_MODE_NORMAL) {
// InputBlob data in dumped into files in NCHW_FLOAT format as default
std::string filename = layer->GetLayerName();
std::replace(filename.begin(), filename.end(), '/', '_');
for (int i = 0; i < inputs.size(); i++) {
char ss[1000];
if (g_tnn_dump_directory.length() > 0) {
snprintf(ss, 1000, "%s/%05d-%s-in-%d", g_tnn_dump_directory.c_str(), cnt, filename.c_str(), i);
} else {
snprintf(ss, 1000, "%05d-%s-in-%d", cnt, filename.c_str(), i);
}
auto ret = DumpDeviceBlob(inputs[i], context_, std::string(ss));
if (ret != TNN_OK) {
LOGE("dump blob failed\n");
return ret;
}
}
}
#endif // DUMP_INPUT_BLOB
status = layer->Forward();
LOGD("layer name: %s, forward result: %d \n", layer->GetLayerName().c_str(), (int)status);
LOGD("Output Shape: [%s]\n", layer->GetOutputBlobs()[0]->GetBlobDesc().description().c_str());
if (status != TNN_OK) {
LOGE("Forward error %s, exit\n", status.description().c_str());
return status;
}
#if DUMP_OUTPUT_BLOB
if (runtime_model_ == RUNTIME_MODE_NORMAL) {
// OutBlob data in dumped into files in NCHW_FLOAT format as default
std::string out_file_name = layer->GetLayerName();
std::replace(out_file_name.begin(), out_file_name.end(), '/', '_');
for (int i = 0; i < outputs.size(); i++) {
char ss[1000];
if (g_tnn_dump_directory.length() > 0) {
snprintf(ss, 1000, "%s/%05d-%s-out-%d", g_tnn_dump_directory.c_str(), cnt, out_file_name.c_str(), i);
} else {
snprintf(ss, 1000, "%05d-%s-out-%d", cnt, out_file_name.c_str(), i);
}
auto ret = DumpDeviceBlob(outputs[i], context_, std::string(ss));
if (ret != TNN_OK) {
LOGE("dump blob failed\n");
return ret;
}
}
}
#endif // DUMP_OUTPUT_BLOB
}
cnt++;
}
context_->OnInstanceForwardEnd();
context_->Synchronize();
return status;
}
#ifdef FORWARD_CALLBACK_ENABLE
Status DefaultNetwork::ForwardWithCallback(BlobStatisticCallback before, BlobStatisticCallback after) {
Status result = TNN_OK;
result = blob_manager_->CheckBlobMemoryState();
if (result != TNN_OK) {
return result;
}
context_->OnInstanceForwardBegin();
int cnt = 0;
for (auto layer : layers_) {
std::vector<Blob *> inputs = layer->GetInputBlobs();
std::vector<Blob *> outputs = layer->GetOutputBlobs();
auto layer_info = GetLayerInfoFromName(net_structure_, layer->GetLayerName());
if (before != nullptr)
before(inputs, layer_info.get());
result = layer->Forward();
if (result != TNN_OK) {
LOGE("Forward error %s, exit\n", result.description().c_str());
return result;
}
context_->Synchronize();
if (after != nullptr)
after(outputs, layer_info.get());
cnt++;
}
context_->OnInstanceForwardEnd();
return result;
}
#endif // end of FORWARD_CALLBACK_ENABLE
// @brief tnn instance network infer, it will not wait
// blob dump is not implement in this funciton.
Status DefaultNetwork::ForwardAsync(Callback call_back) {
Status result = TNN_OK;
result = blob_manager_->CheckBlobMemoryState();
if (result != TNN_OK) {
return result;
}
context_->OnInstanceForwardBegin();
for (auto layer : layers_) {
result = layer->Forward();
RETURN_ON_NEQ(result, TNN_OK);
}
context_->OnInstanceForwardEnd();
return result;
}
#if TNN_PROFILE
void DefaultNetwork::StartProfile() {
context_->StartProfile();
}
std::shared_ptr<ProfileResult> DefaultNetwork::FinishProfile() {
return context_->FinishProfile();
}
#endif
std::string DefaultNetwork::GenerateCacheFileName(ModelConfig &model_config, std::string& md5_str) {
return CACHE_TAG + "_" + ToString(config_.device_type) + "_" + ToString(config_.device_id)
+ "_" + ToString(config_.precision) + "_" + ToString(model_config.model_type) +
"_" + md5_str;
}
Status DefaultNetwork::ReshapeLayers() {
for (auto cur_layer : layers_) {
auto status = cur_layer->Reshape();
RETURN_ON_NEQ(status, TNN_OK);
//Note output shape may not change after reshape for const folder, but will do change after forward because shape may be determined at rumtime
LOGD("ReshapeLayers Output Shape: [%s]\n", cur_layer->GetOutputBlobs()[0]->GetBlobDesc().description().c_str());
}
return TNN_OK;
}
} // namespace TNN_NS
|
861136a7586b24daf49689e8a416b81f7713509d
|
1b5588f7c5ba611f1f3c411b2c6fe9794297abfc
|
/src/displayUtility.cpp
|
d72ff9db263ed48f3ccc83c63158e12cdc0a7ab0
|
[] |
no_license
|
FedeAi/freeRtos-extruder
|
6a90d5d1f19f4c6fc51fc4710828dd2eba22d5f8
|
c41eca5cf5b85c69e2781011747c0aebfb103e10
|
refs/heads/master
| 2022-02-15T10:38:06.144393
| 2019-07-25T16:46:51
| 2019-07-25T16:46:51
| 174,852,216
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,114
|
cpp
|
displayUtility.cpp
|
#include "displayUtility.h"
#include "configuration.h"
#include "menuManager.h"
#include "temperatureManager.h"
#include "Extruder.h"
#include "Menu.h"
DisplayManager::DisplayManager(unsigned portSHORT _stackDepth, UBaseType_t _priority, const char* _name, uint32_t _ticks, MenuManager * aMenuManager, TemperatureManager * aTemperatureManager, Extruder * aExtruderManager ) :
//menuManagerTest(aMenuManager),
Thread{ _stackDepth, _priority, _name },
ticks{ _ticks }
{
menuManagerTest = aMenuManager;
temperatureManager = aTemperatureManager;
extruderManager = aExtruderManager;
}
void DisplayManager::Main(){
for (;;) // A Task shall never return or exit.
{
menuManagerTest->updateMenu();
u8g2.clearBuffer();
menuManagerTest->ptMenu->drawPage();
u8g2.sendBuffer();
vTaskDelay(ticks);
}
}
|
3d867de0bb5d8716fddd7792344cbab62f06d7a2
|
c31e46a9a3199aa2eea81d61fb0de27317354e88
|
/P4largestPalindrome.cpp
|
c61b9b07dc413eb083f231f344c382e2fa17cd33
|
[] |
no_license
|
SeanSiders/projectEulerSolutions
|
268fcb617c92f6c34fd8744f567171eca1370304
|
0aa69178f7e3065de94b354b4b8c631873199d65
|
refs/heads/master
| 2020-12-03T20:03:47.780622
| 2020-01-02T22:11:39
| 2020-01-02T22:11:39
| 231,467,949
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 788
|
cpp
|
P4largestPalindrome.cpp
|
#include <iostream>
#include <cmath>
uint64_t largestPalindrome(uint64_t n)
{ /*return the largest palindrome that is the product of two numbers with n digits*/
uint64_t largestP = 0;
uint64_t top = pow(10, n) - 1;
uint64_t bottom = pow(10, (n - 1)) - 1;
for (uint64_t i = top; i > bottom; i--)
{
for (uint64_t k = i; k > bottom; k--)
{
uint64_t p = k * i;
uint64_t p2 = p;
uint64_t revP = 0;
for (int c = 0; c < n * 2; c++)
{
revP *= 10;
if (p2 < 10)
{
revP += p2;
}
else
{
revP += p2 % 10;
}
p2 /= 10;
}
if (revP == p && p > largestP)
{
largestP = p;
}
}
}
return largestP;
}
int main()
{
uint64_t maxNum;
std::cin >> maxNum;
std::cout << largestPalindrome(maxNum) << std::endl;
return 0;
}
|
41ddf8c060d32c8a242c533ab98acb58d18eadb2
|
49f608d8bcb5c1f468564f5f47b3f98c3ec239df
|
/abacus/core/impl/x86/x86_runtime_api.cpp
|
d958a5cee045f6599c19a47acb7495c7a01fe918
|
[] |
no_license
|
endurehero/WW
|
f767ee482eedd9ce7f2bf6bf2da79ee80223abfa
|
137a5ef09db138b4c55230df72d0d9c28d897a3f
|
refs/heads/master
| 2020-06-27T13:37:26.779513
| 2019-09-26T03:54:07
| 2019-09-27T10:38:09
| 199,966,976
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,617
|
cpp
|
x86_runtime_api.cpp
|
#include "abacus/core/target_wrapper.h"
namespace WW{
namespace abacus{
#ifdef USE_X86
static const int MALLOC_ALIGN = 64;
static inline void* mallocAlign(size_t size){
size_t offset = sizeof(void*) + MALLOC_ALIGN - 1;
char* p = static_cast<char*>(malloc(size + offset));
if(!p){
return nullptr;
}
void* r = reinterpret_cast<void*>(reinterpret_cast<size_t>(p + offset) & (~(MALLOC_ALIGN - 1)));
static_cast<void**>(r)[-1] = p;
memset(r, 0, size);
return r;
}
static inline void freeAlign(void* ptr){
if(ptr){
void* p = static_cast<void**>(ptr)[-1];
free(p); p = nullptr;
}
}
typedef TargetWrapper<X86> X86_API;
void X86_API::getDeviceCount(int& count){
count = 1;
}
void X86_API::setDevice(int){}
void X86_API::memAlloc(void** ptr, size_t n){
*ptr = static_cast<void*>(mallocAlign(n));
}
void X86_API::memFree(void* ptr){
freeAlign(ptr);
}
void X86_API::memSet(void* ptr, int value, size_t n){
memset(ptr, value, n);
}
void X86_API::createEvent(event_t* event, bool flag){}
void X86_API::destoryEvent(event_t event){}
void X86_API::recordEvent(event_t event, stream_t stream){}
void X86_API::createStream(stream_t* stream){}
void X86_API::createStreamWithFlag(stream_t* stream, unsigned int flag) {}
void X86_API::createStreamWithPriority(stream_t* stream, unsigned int flag, int priority){}
void X86_API::destoryStream(stream_t stream){}
void X86_API::queryEvent(event_t event){}
void X86_API::syncEvent(event_t event){}
void X86_API::syncStream(event_t event, stream_t stream){}
void X86_API::syncStream(stream_t stream){}
void X86_API::syncMemcpy(void* dst, size_t dst_offset, int dst_id, \
const void* src, size_t src_offset, int src_id, \
size_t count, __H2H){
memcpy(static_cast<char*>(dst) + dst_offset, static_cast<const char*>(src) + src_offset, count);
}
void X86_API::asyncMemcpy(void* dst, size_t dst_offset, int dst_id, \
const void* src, size_t src_offset, int src_id, \
size_t count, stream_t stream, __H2H){
memcpy(static_cast<char*>(dst) + dst_offset, static_cast<const char*>(src) + src_offset, count);
}
void X86_API::syncMemcpyP2p(void* dst, size_t dst_offset, int dst_id, \
const void* src, size_t src_offset, int src_id, size_t count){}
void X86_API::asyncMemcpyP2p(void* dst, size_t dst_offset, int dst_id, \
const void* src, size_t src_offset, int src_id, \
size_t count, stream_t stream){}
int X86_API::getDeviceId(){
return 0;
}
void X86_API::deviceSync(){}
#endif
}// namespace abacus
}// namespace WW
|
d5fc98044addde8ecf93729f399888599fa7b008
|
48c71e8e6b3d4a1693bc912fb273e5fdd3d1ae41
|
/LinkList/node.h
|
1203148f7e2d50f14b5f9a53b4c873e24ce5dcf8
|
[
"Apache-2.0"
] |
permissive
|
Epochyy/DataStructure
|
c4c4b623d9ac764afab3f11a6b14d27a79f04678
|
fb09658fb6f76fbfcd3e3433e5a74b248dc50dd1
|
refs/heads/master
| 2021-10-19T15:26:40.086408
| 2019-02-22T05:33:41
| 2019-02-22T05:33:41
| 95,552,777
| 0
| 1
| null | null | null | null |
WINDOWS-1252
|
C++
| false
| false
| 313
|
h
|
node.h
|
//node.h ½ÚµãÀà
template <typename T>
class node
{
public:
node();
node(T data);
~node();
node<T> *next;
T data;
};
template <typename T>
node<T>::node()
{
next = NULL;
}
template <typename T>
node<T>::node(T data)
{
this->data = data;
next = NULL;
}
template <typename T>
node<T>::~node()
{
}
|
bbd9a70301439b1b8eb0c98516a3ede1afc9b663
|
1dca551611e643f5692f726f6f3e90c6c00eb7f7
|
/DatabaseEngine/dbmodificationrule.cpp
|
75ff149686ec85618192f8fc3d55facf57c2b15c
|
[
"MIT"
] |
permissive
|
HowCanidothis/DevLib
|
d47b977dfa01999e4fd8f26cad7ef2c9c77471fa
|
58fb0fa099cc6cb5f58ad2e8481bc4ca3758cdfb
|
refs/heads/master
| 2023-08-22T21:21:47.705274
| 2023-08-16T09:41:32
| 2023-08-21T15:40:18
| 282,774,252
| 0
| 1
|
MIT
| 2022-12-22T05:17:14
| 2020-07-27T02:23:37
|
C++
|
UTF-8
|
C++
| false
| false
| 8,575
|
cpp
|
dbmodificationrule.cpp
|
#include "dbmodificationrule.h"
#include "dbtableheader.h"
#include "Core/Private/dbtablefielddelegate.h"
DbCopyFieldDelegate::DbCopyFieldDelegate()
: CopyFieldFunction(nullptr)
, DestinationOffset(-1)
, DefaultValueSetter([](CastablePtr&){})
{
}
void DbCopyFieldDelegate::Copy(CastablePtr& source, CastablePtr& destination) const
{
CopyFieldFunction(source, destination);
DefaultValueSetter(destination);
source += SourceOffset;
destination += DestinationOffset;
}
template<class OldFieldType, class NewFieldType>
static void copyPODField(const CastablePtr& source, CastablePtr& destination)
{
memcpy(destination.AsPtr<void>(), source.AsPtr<void>(), sizeof(NewFieldType));
}
template<class NewFieldType>
static void createField(const CastablePtr&, CastablePtr& destination)
{
new (destination.AsPtr<void>()) NewFieldType();
}
template<class OldFieldType, class NewFieldType>
static void copyField(const CastablePtr& source, CastablePtr& destination)
{
destination.As<NewFieldType>() = source.As<OldFieldType>();
}
template<>
static void copyField<MDbArrayBase, MDbArrayBase>(const CastablePtr& source, CastablePtr& destination)
{
// We can do this because destination array is always invalid
memcpy(destination.AsPtr<void>(), source.AsPtr<void>(), sizeof(MDbArrayBase));
}
static void dontCopyField(const CastablePtr&, CastablePtr&){}
template<class FieldType>
static void removeField(const CastablePtr&, CastablePtr&){}
template<>
static void removeField<MDbArrayBase>(const CastablePtr& source, CastablePtr&)
{
const_cast<MDbArrayBase&>(source.As<MDbArrayBase>()).Free();
}
// Arrays transform into primitive type without copying, only free their data
#define DECL_SWITCH(CppType, DbType) \
template<> void copyField<MDbArrayBase, CppType>(const CastablePtr& source, CastablePtr& ) \
{ \
const_cast<MDbArrayBase&>(source.As<MDbArrayBase>()).Free();\
} \
template<> void copyField<CppType, MDbArrayBase>(const CastablePtr&, CastablePtr& destination) \
{ \
new (destination.AsPtr<void>()) MDbArrayBase(); \
}
DB_FOREACH_PRIMITIVE_FIELDS(DECL_SWITCH)
DB_FOREACH_POD_FIELDS(DECL_SWITCH)
#undef DECL_SWITCH
#define DECL_SWITCH(CppType, DbType) \
case DbType: \
rule.CopyFieldFunction = ©Field<DbTableFieldTypeHelper<CppType>::DbCppType, NewCppType>; \
rule.SourceOffset = DbTableFieldTypeHelper<CppType>::Size; \
break;
#define DECL_POD_SWITCH(CppType, DbType) \
case DbType: \
rule.CopyFieldFunction = &createField<NewCppType>; \
rule.SourceOffset = DbTableFieldTypeHelper<CppType>::Size; \
break;
template<class NewCppType>
static void CreateRule(qint32 oldFieldType, qint32 newFieldType, DbCopyFieldDelegate& rule)
{
rule.FieldType = newFieldType;
rule.DestinationOffset = sizeof(NewCppType);
switch (oldFieldType) {
DB_FOREACH_PRIMITIVE_FIELDS(DECL_SWITCH)
DB_FOREACH_POD_FIELDS(DECL_POD_SWITCH)
default:
rule.CopyFieldFunction = ©Field<MDbArrayBase, NewCppType>;
rule.SourceOffset = sizeof(MDbArrayBase);
break;
}
}
#undef DECL_SWITCH
#undef DECL_POD_SWITCH
#define DECL_SWITCH(CppType, DbType) \
case DbType: \
rule.CopyFieldFunction = &createField<NewCppType>; \
rule.SourceOffset = DbTableFieldTypeHelper<CppType>::Size; \
break;
#define DECL_POD_SWITCH(CppType, DbType) \
case DbType: \
rule.CopyFieldFunction = ©PODField<DbTableFieldTypeHelper<CppType>::DbCppType, NewCppType>; \
rule.SourceOffset = DbTableFieldTypeHelper<CppType>::Size; \
break;
template<class NewCppType>
static void CreatePODRule(qint32 oldFieldType, qint32 newFieldType, DbCopyFieldDelegate& rule)
{
rule.FieldType = newFieldType;
rule.DestinationOffset = sizeof(NewCppType);
switch (oldFieldType) {
DB_FOREACH_PRIMITIVE_FIELDS(DECL_SWITCH)
DB_FOREACH_POD_FIELDS(DECL_POD_SWITCH)
default:
rule.CopyFieldFunction = ©Field<MDbArrayBase, NewCppType>;
rule.SourceOffset = sizeof(MDbArrayBase);
break;
}
}
DbModificationRule::DbModificationRule(DbTableHeader* header)
: m_header(header)
{
m_copyDelegates.resize(m_header->GetFieldsCount());
}
#define DECL_SWITCH_NEW_TYPE(CppType, DbType) \
case DbType: CreateRule<DbTableFieldTypeHelper<CppType>::DbCppType>(oldType, newType, delegate); break;
#define DECL_SWITCH_NEW_POD_TYPE(CppType, DbType) \
case DbType: CreatePODRule<DbTableFieldTypeHelper<CppType>::DbCppType>(oldType, newType, delegate); break;
DbModificationRule&DbModificationRule::EditField(const MDbTableField* field, DbTableFieldType newType, const QString& fieldName, const QString& defaultValue)
{
Q_ASSERT(!field->IsPrimaryKey());
auto indexOf = m_header->GetFields().IndexOf(const_cast<MDbTableField*>(field));
Q_ASSERT(indexOf != -1);
MDbTableField* tableField = m_header->GetFields().At(indexOf);
Q_ASSERT(tableField != nullptr);
auto oldType = tableField->Type;
auto& delegate = m_copyDelegates[indexOf];
switch (newType) {
DB_FOREACH_PRIMITIVE_FIELDS(DECL_SWITCH_NEW_TYPE)
DB_FOREACH_POD_FIELDS(DECL_SWITCH_NEW_POD_TYPE)
default:
CreateRule<MDbArrayBase>(oldType, newType, delegate);
break;
}
delegate.Name = fieldName;
delegate.DefaultValue = defaultValue;
return *this;
}
#undef DECL_SWITCH
#undef DECL_SWITCH_NEW_TYPE
#define DECL_SWITCH(CppType, DbType) \
case DbType: \
addFieldDelegate.CopyFieldFunction = &createField<DbTableFieldTypeHelper<CppType>::DbCppType>; \
addFieldDelegate.DefaultValueSetter = MDbTableField::CreateDefaultValueSetter(DbType, defaultValue); \
break;
DbModificationRule& DbModificationRule::AddField(DbTableFieldType type, const QString& fieldName, const QString& defaultValue)
{
DbCopyFieldDelegate addFieldDelegate;
addFieldDelegate.FieldType = type;
addFieldDelegate.Name = fieldName;
addFieldDelegate.SourceOffset = 0;
addFieldDelegate.DestinationOffset = static_cast<qint32>(MDbTableField::TypeSize(type));
addFieldDelegate.DefaultValue = defaultValue;
switch (type) {
DB_FOREACH_PRIMITIVE_FIELDS(DECL_SWITCH);
DB_FOREACH_POD_FIELDS(DECL_SWITCH);
DB_FOREACH_COMPLEX_FIELDS(DECL_SWITCH);
default:
break;
}
m_copyDelegates.append(addFieldDelegate);
return *this;
}
#undef DECL_SWITCH
DbModificationRule&DbModificationRule::RemoveField(const QString& fieldName)
{
auto field = m_header->GetField(fieldName);
Q_ASSERT(field != nullptr);
return RemoveField(field);
}
DbModificationRule&DbModificationRule::RemoveField(const MDbTableField* field)
{
auto indexOf = m_header->GetFields().IndexOf(const_cast<MDbTableField*>(field));
Q_ASSERT(indexOf != -1 && !field->IsPrimaryKey());
auto& delegate = m_copyDelegates[indexOf];
delegate.DestinationOffset = 0;
DbTableFieldDelegate fieldDelegate(field);
if(fieldDelegate.IsComplex()) {
delegate.CopyFieldFunction = &removeField<MDbArrayBase>;
} else {
delegate.CopyFieldFunction = &removeField<void>;
}
delegate.SourceOffset = field->Size;
return *this;
}
#define DECL_SWITCH(CppType, DbType) \
case DbType: \
it->CopyFieldFunction = ©Field<DbTableFieldTypeHelper<CppType>::DbCppType, DbTableFieldTypeHelper<CppType>::DbCppType>; \
it->SourceOffset = it->DestinationOffset = oldField->Size; \
break;
void DbModificationRule::initialize()
{
auto it = m_copyDelegates.begin();
for(MDbTableField* oldField : m_header->GetFields()) {
if(it->CopyFieldFunction == nullptr) {
if(it->DestinationOffset != 0) {
it->FieldType = oldField->Type;
it->Name = oldField->Name.ToString();
it->DefaultValue = oldField->DefaultValue.ToString();
switch (oldField->Type) {
DB_FOREACH_PRIMITIVE_FIELDS(DECL_SWITCH)
DB_FOREACH_POD_FIELDS(DECL_SWITCH)
DB_FOREACH_COMPLEX_FIELDS(DECL_SWITCH)
default: Q_ASSERT(false);
break;
}
}
}
it++;
}
}
#undef DECL_SWITCH
void DbModificationRule::copyRow(const CastablePtr& source,const CastablePtr& destination) const
{
CastablePtr movableSource(source);
CastablePtr movableDestination(destination);
for(const DbCopyFieldDelegate& delegate : m_copyDelegates) {
delegate.Copy(movableSource, movableDestination);
}
}
|
da1b4157db75016ca3609b9ed7e64a45289d50a8
|
b35d01edf8c2a8fcf36100f3dad4561805e1824a
|
/src/glwrap/PBRUniforms.h
|
528f74d1c9289d15c477d1e633a4a345a9d4821a
|
[] |
no_license
|
Dekuboy/CoBeBeEngine
|
b853a6117bf286b30e59f02dc071e66b93983a48
|
63683cc4c5e216c746ca346f857701b48ee4ef83
|
refs/heads/master
| 2022-08-03T22:44:54.086184
| 2022-07-11T15:15:08
| 2022-07-11T15:15:08
| 212,793,969
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 696
|
h
|
PBRUniforms.h
|
#include <glwrap/TextureUniforms.h>
namespace glwrap
{
enum PBRTexture
{
colour,
metalRough,
normal,
occlusion,
emissive,
colourFactor,
metalRoughFactor,
normalFactor,
occlusionFactor,
emissiveFactor
};
class SingleUniform : public TextureUniforms
{
public:
void getUniformName(int _enumType, std::string& _target);
bool setUniformName(int _enumType, std::string& _name);
private:
std::string m_textureName;
};
class PBRUniforms : public TextureUniforms
{
public:
PBRUniforms();
void getUniformName(int _enumType, std::string& _target);
bool setUniformName(int _enumType, std::string& _name);
private:
std::string m_pbrTextureNames[10];
};
}
|
2ceb3eceaf48d85b57e891b965836a8e2dbe912c
|
5d4f3ccfbea9e92f4cb0907f50e618d728059941
|
/MINVOTE2.cpp
|
dbbc5a704e60d4947d8666615226207fc84961ce
|
[
"MIT"
] |
permissive
|
govind1996/COMPETITIVE-PROGRAMMING
|
b563a369bc76b498e6ab8d0d9a350d8d4216ea57
|
338d5a7026a444a509f65bccfce5eab9c91c5a03
|
refs/heads/master
| 2018-12-22T13:32:17.328655
| 2018-10-03T15:00:45
| 2018-10-03T15:00:45
| 108,137,687
| 2
| 2
|
MIT
| 2018-10-03T15:00:47
| 2017-10-24T14:21:36
|
C++
|
UTF-8
|
C++
| false
| false
| 1,643
|
cpp
|
MINVOTE2.cpp
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
long int t;
cin>>t;
while(t--)
{
long int n;
scanf("%ld",&n);
vector<long int> arr(n);
// vector<long int> fs;
// vector<long int> bs;
vector<long int> sum(n+1,0);
vector<long int> ans(n+2,0);
// vector<long int> ans1(n,0);
for(long int i=0;i<n;i++)
{
scanf("%ld",&arr[i]);
sum[i+1]=sum[i]+arr[i];
}
bool flag=1;
for(long int i=0;i<n-1;i++)
{
for(long int j=i+1;j<n;j++)
{
if(sum[j]-sum[i+1]>arr[i])
{
ans[i+1]+=1;
ans[j]-=1;
flag=0;
break;
}
}
if(flag)
{
ans[i+1]+=1;
ans[n]-=1;
}
flag=1;
}
flag=1;
for(long int i=n-1;i>0;i--)
{
for(long int j=i-1;j>=0;j--)
{
if(sum[i]-sum[j+1]>arr[i])
{
ans[j+1]+=1;
ans[i]-=1;
flag=0;
break;
}
}
if(flag)
{
ans[0]+=1;
ans[i]-=1;
}
flag=1;
}
for(long int i=1;i<=n+1;i++)
ans[i]+=ans[i-1];
// cout<<ans1[n-1];
// cout<<endl;
for(long int i=0;i<n;i++)
cout<<ans[i]<<" ";
cout<<endl;
}
}
|
c223f50e18b9cd9a405fe0a6a3bda19f1c2af3b7
|
5d1d7efcc341b7ea20a7355d0532e52994b12d05
|
/04/03/main.cpp
|
783ade367bc9c77822645f2ef79d46599cc89155
|
[] |
no_license
|
violetfeline/cppBasic
|
23a5fb854c1957dd9347c4dc8047c32ec676add4
|
cceb7fbcff0bc481f51bcab7a8895f322a84d6a4
|
refs/heads/master
| 2023-02-08T22:26:03.836021
| 2020-12-27T16:32:32
| 2020-12-27T16:32:32
| 324,794,012
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 790
|
cpp
|
main.cpp
|
#include <iostream>
#include <string>
class TRAIN {
public:
std::string city_from = "";
std::string city_to = "";
std::string number = "";
};
int main() {
int n;
std::cin >> n;
TRAIN* trains = new TRAIN[n];
for(int i = 0; i < n; i++) {
std::cin >> trains[i].city_from >> trains[i].city_to >> trains[i].number;
}
std::string A, B, C;
std::cin >> A >> B >> C;
bool unreachable = true;
for(int i = 0; i < n; i++) {
if(trains[i].city_from == A && trains[i].city_to == B) {
for(int j = 0; j < n; j++) {
if(trains[j].city_from == B && trains[j].city_to == C) {
std::cout << trains[i].number << std::endl
<< trains[j].number << std::endl;
unreachable = false;
}
}
}
}
if(unreachable) {
std::cout << "Unreachable city!";
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.