blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 5
140
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 905
values | visit_date
timestamp[us]date 2015-08-09 11:21:18
2023-09-06 10:45:07
| revision_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-17 19:19:19
| committer_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-06 06:22:19
| github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-07 00:51:45
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-03-27 23:40:48
2023-08-21 23:17:38
⌀ | gha_language
stringclasses 141
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
10.4M
| extension
stringclasses 115
values | content
stringlengths 3
10.4M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
158
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
388dba6cb6c6bbd0717e3b650ac1b2f0a5e0f946 | 3ef446ff1ec258c98a39bf50ca2bf2e990920a82 | /src/network/ssl/qsslerror.cpp | d6b26a3614decf081c510226093ee3c08b10575c | [] | no_license | sese53/rtqt | 97f29d805588e75ff2da33b16fe8f25d113fc955 | 8c51d0b3fa7dbf421d0eb8d6839b85218f42f5ff | refs/heads/master | 2023-06-15T21:18:43.279322 | 2018-03-21T20:04:08 | 2018-03-21T20:04:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,914 | cpp | /****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\class QSslError
\brief The QSslError class provides an SSL error.
\since 4.3
\reentrant
\ingroup network
\ingroup ssl
\inmodule QtNetwork
QSslError provides a simple API for managing errors during QSslSocket's
SSL handshake.
\sa QSslSocket, QSslCertificate, QSslCipher
*/
/*!
\enum QSslError::SslError
Describes all recognized errors that can occur during an SSL handshake.
\value NoError
\value UnableToGetIssuerCertificate
\value UnableToDecryptCertificateSignature
\value UnableToDecodeIssuerPublicKey
\value CertificateSignatureFailed
\value CertificateNotYetValid
\value CertificateExpired
\value InvalidNotBeforeField
\value InvalidNotAfterField
\value SelfSignedCertificate
\value SelfSignedCertificateInChain
\value UnableToGetLocalIssuerCertificate
\value UnableToVerifyFirstCertificate
\value CertificateRevoked
\value InvalidCaCertificate
\value PathLengthExceeded
\value InvalidPurpose
\value CertificateUntrusted
\value CertificateRejected
\value SubjectIssuerMismatch
\value AuthorityIssuerSerialNumberMismatch
\value NoPeerCertificate
\value HostNameMismatch
\value UnspecifiedError
\value NoSslSupport
\value CertificateBlacklisted
\sa QSslError::errorString()
*/
#include "qsslerror.h"
#include "qsslsocket.h"
#ifndef QT_NO_DEBUG_STREAM
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
#endif
class QSslErrorPrivate
{
public:
QSslError::SslError error;
QSslCertificate certificate;
};
/*!
Constructs a QSslError object with no error and default certificate.
*/
// RVCT compiler in debug build does not like about default values in const-
// So as an workaround we define all constructor overloads here explicitly
QSslError::QSslError()
: d(new QSslErrorPrivate)
{
d->error = QSslError::NoError;
d->certificate = QSslCertificate();
}
/*!
Constructs a QSslError object. The argument specifies the \a
error that occurred.
*/
QSslError::QSslError(SslError error)
: d(new QSslErrorPrivate)
{
d->error = error;
d->certificate = QSslCertificate();
}
/*!
Constructs a QSslError object. The two arguments specify the \a
error that occurred, and which \a certificate the error relates to.
\sa QSslCertificate
*/
QSslError::QSslError(SslError error, const QSslCertificate &certificate)
: d(new QSslErrorPrivate)
{
d->error = error;
d->certificate = certificate;
}
/*!
Constructs an identical copy of \a other.
*/
QSslError::QSslError(const QSslError &other)
: d(new QSslErrorPrivate)
{
*d.data() = *other.d.data();
}
/*!
Destroys the QSslError object.
*/
QSslError::~QSslError()
{
}
/*!
\since 4.4
Assigns the contents of \a other to this error.
*/
QSslError &QSslError::operator=(const QSslError &other)
{
*d.data() = *other.d.data();
return *this;
}
/*!
\since 4.4
Returns true if this error is equal to \a other; otherwise returns false.
*/
bool QSslError::operator==(const QSslError &other) const
{
return d->error == other.d->error
&& d->certificate == other.d->certificate;
}
/*!
\fn bool QSslError::operator!=(const QSslError &other) const
\since 4.4
Returns true if this error is not equal to \a other; otherwise returns
false.
*/
/*!
Returns the type of the error.
\sa errorString(), certificate()
*/
QSslError::SslError QSslError::error() const
{
return d->error;
}
/*!
Returns a short localized human-readable description of the error.
\sa error(), certificate()
*/
QString QSslError::errorString() const
{
QString errStr;
switch (d->error) {
case NoError:
errStr = QSslSocket::tr("No error");
break;
case UnableToGetIssuerCertificate:
errStr = QSslSocket::tr("The issuer certificate could not be found");
break;
case UnableToDecryptCertificateSignature:
errStr = QSslSocket::tr("The certificate signature could not be decrypted");
break;
case UnableToDecodeIssuerPublicKey:
errStr = QSslSocket::tr("The public key in the certificate could not be read");
break;
case CertificateSignatureFailed:
errStr = QSslSocket::tr("The signature of the certificate is invalid");
break;
case CertificateNotYetValid:
errStr = QSslSocket::tr("The certificate is not yet valid");
break;
case CertificateExpired:
errStr = QSslSocket::tr("The certificate has expired");
break;
case InvalidNotBeforeField:
errStr = QSslSocket::tr("The certificate's notBefore field contains an invalid time");
break;
case InvalidNotAfterField:
errStr = QSslSocket::tr("The certificate's notAfter field contains an invalid time");
break;
case SelfSignedCertificate:
errStr = QSslSocket::tr("The certificate is self-signed, and untrusted");
break;
case SelfSignedCertificateInChain:
errStr = QSslSocket::tr("The root certificate of the certificate chain is self-signed, and untrusted");
break;
case UnableToGetLocalIssuerCertificate:
errStr = QSslSocket::tr("The issuer certificate of a locally looked up certificate could not be found");
break;
case UnableToVerifyFirstCertificate:
errStr = QSslSocket::tr("No certificates could be verified");
break;
case InvalidCaCertificate:
errStr = QSslSocket::tr("One of the CA certificates is invalid");
break;
case PathLengthExceeded:
errStr = QSslSocket::tr("The basicConstraints path length parameter has been exceeded");
break;
case InvalidPurpose:
errStr = QSslSocket::tr("The supplied certificate is unsuitable for this purpose");
break;
case CertificateUntrusted:
errStr = QSslSocket::tr("The root CA certificate is not trusted for this purpose");
break;
case CertificateRejected:
errStr = QSslSocket::tr("The root CA certificate is marked to reject the specified purpose");
break;
case SubjectIssuerMismatch: // hostname mismatch
errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because its"
" subject name did not match the issuer name of the current certificate");
break;
case AuthorityIssuerSerialNumberMismatch:
errStr = QSslSocket::tr("The current candidate issuer certificate was rejected because"
" its issuer name and serial number was present and did not match the"
" authority key identifier of the current certificate");
break;
case NoPeerCertificate:
errStr = QSslSocket::tr("The peer did not present any certificate");
break;
case HostNameMismatch:
errStr = QSslSocket::tr("The host name did not match any of the valid hosts"
" for this certificate");
break;
case NoSslSupport:
break;
case CertificateBlacklisted:
errStr = QSslSocket::tr("The peer certificate is blacklisted");
break;
default:
errStr = QSslSocket::tr("Unknown error");
break;
}
return errStr;
}
/*!
Returns the certificate associated with this error, or a null certificate
if the error does not relate to any certificate.
\sa error(), errorString()
*/
QSslCertificate QSslError::certificate() const
{
return d->certificate;
}
#ifndef QT_NO_DEBUG_STREAM
//class QDebug;
QDebug operator<<(QDebug debug, const QSslError &error)
{
debug << error.errorString();
return debug;
}
QDebug operator<<(QDebug debug, const QSslError::SslError &error)
{
debug << QSslError(error).errorString();
return debug;
}
#endif
QT_END_NAMESPACE
| [
"[email protected]"
] | |
2ca406b274ba383634c3412156f150094a752361 | f2302b7e791eee252c489a0a6e25dc90a885ddd7 | /motor/motor.cpp | a2e725253918f4014923d11282bc738bbbc30ffc | [] | no_license | winstonliu/AER201-Ref | 8b9936a7755fc88dc9a2d8d407b1dda9a619757f | 1e591a03363a44ae8d011651ef6cf4a3e5b2d2bf | refs/heads/master | 2021-01-19T22:13:39.453464 | 2015-03-28T21:08:58 | 2015-03-28T21:08:58 | 31,083,439 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,229 | cpp | #include "Arduino.h"
#include "motor.h"
motor::motor(int pin_enable, int pin_direction, int speed)
{
enable = pin_enable;
direction = pin_direction;
motorspeed = 255;
// Enable motor pins
pinMode(enable, OUTPUT);
pinMode(direction, OUTPUT);
}
void motor::stop()
{
motorspeed = 0;
status = MOTOR_OFF;
digitalWrite(enable, LOW);
digitalWrite(direction, LOW);
}
void motor::right(int speed)
{
status = MOTOR_RIGHT;
if (speed < 0)
speed = 0;
else if (speed > 255)
speed = 255;
motorspeed = speed;
// PWM
analogWrite(enable, speed);
digitalWrite(direction, LOW);
}
void motor::left(int speed)
{
status = MOTOR_LEFT;
if (speed < 0)
speed = 0;
else if (speed > 255)
speed = 255;
motorspeed = speed;
// PWM
analogWrite(enable, speed);
digitalWrite(direction, HIGH);
}
void motor::adjustSpeed(int speed)
{
motorspeed = speed;
switch(status)
{
case MOTOR_RIGHT:
right(speed);
break;
case MOTOR_LEFT:
left(speed);
break;
}
}
void motor::reverseDirection(int speed)
{
motorspeed = speed;
switch(status)
{
case MOTOR_RIGHT:
left(speed);
break;
case MOTOR_LEFT:
right(speed);
break;
}
}
motor_states motor::get_status() { return status; }
| [
"[email protected]"
] | |
644961757a62b69d36673df50f1f06708595cb18 | 4db5a101cbf63ea8e7478a604e4667bd1fa66770 | /src/solutions/untexturedobjects/gl/texcoord.cpp | 2b1e07140ed1aa059294440d061b4bfb3ad3041f | [
"Unlicense"
] | permissive | UIKit0/apitest | 71d77546243bc45f580e2ece93ad870225004ccf | cde1d337e7f0b60aa5bb943fb54219cccfa0ad06 | refs/heads/master | 2021-01-21T15:26:26.572636 | 2014-03-30T19:25:38 | 2014-03-30T19:25:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,033 | cpp | #include "pch.h"
#include "texcoord.h"
#include "framework/gfx_gl.h"
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
UntexturedObjectsGLTexCoord::UntexturedObjectsGLTexCoord()
: m_ib()
, m_vb()
, m_prog()
{}
// --------------------------------------------------------------------------------------------------------------------
bool UntexturedObjectsGLTexCoord::Init(const std::vector<UntexturedObjectsProblem::Vertex>& _vertices,
const std::vector<UntexturedObjectsProblem::Index>& _indices,
size_t _objectCount)
{
if (!UntexturedObjectsSolution::Init(_vertices, _indices, _objectCount)) {
return false;
}
// Program
const char* kUniformNames[] = { "ViewProjection", nullptr };
m_prog = CreateProgramT("cubes_gl_tex_coord_vs.glsl",
"cubes_gl_tex_coord_fs.glsl",
kUniformNames, &mUniformLocation);
if (m_prog == 0) {
console::warn("Unable to initialize solution '%s', shader compilation/linking failed.", GetName().c_str());
return false;
}
// Buffers
glGenBuffers(1, &m_vb);
glBindBuffer(GL_ARRAY_BUFFER, m_vb);
glBufferData(GL_ARRAY_BUFFER, sizeof(UntexturedObjectsProblem::Vertex) * _vertices.size(), &*_vertices.begin(), GL_STATIC_DRAW);
glGenBuffers(1, &m_ib);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ib);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(UntexturedObjectsProblem::Index) * _indices.size(), &*_indices.begin(), GL_STATIC_DRAW);
return glGetError() == GL_NO_ERROR;
}
// --------------------------------------------------------------------------------------------------------------------
void UntexturedObjectsGLTexCoord::Render(const std::vector<Matrix>& _transforms)
{
// Program
Vec3 dir = { -0.5f, -1, 1 };
Vec3 at = { 0, 0, 0 };
Vec3 up = { 0, 0, 1 };
dir = normalize(dir);
Vec3 eye = at - 250 * dir;
Matrix view = matrix_look_at(eye, at, up);
Matrix view_proj = mProj * view;
glUseProgram(m_prog);
glUniformMatrix4fv(mUniformLocation.ViewProjection, 1, GL_TRUE, &view_proj.x.x);
// Input Layout
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ib);
glBindBuffer(GL_ARRAY_BUFFER, m_vb);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(UntexturedObjectsProblem::Vertex), (void*)offsetof(UntexturedObjectsProblem::Vertex, pos));
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(UntexturedObjectsProblem::Vertex), (void*)offsetof(UntexturedObjectsProblem::Vertex, color));
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
// Rasterizer State
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
glDisable(GL_SCISSOR_TEST);
// Blend State
glDisable(GL_BLEND);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
// Depth Stencil State
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
for (auto it = _transforms.begin(); it != _transforms.end(); ++it) {
const Matrix* m = &*it;
glVertexAttrib4f(2, m->x.x, m->x.y, m->x.z, m->x.w);
glVertexAttrib4f(3, m->y.x, m->y.y, m->y.z, m->y.w);
glVertexAttrib4f(4, m->z.x, m->z.y, m->z.z, m->z.w);
glVertexAttrib4f(5, m->w.x, m->w.y, m->w.z, m->w.w);
glDrawElements(GL_TRIANGLES, mIndexCount, GL_UNSIGNED_SHORT, nullptr);
}
}
// --------------------------------------------------------------------------------------------------------------------
void UntexturedObjectsGLTexCoord::Shutdown()
{
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(0);
glDeleteBuffers(1, &m_ib);
glDeleteBuffers(1, &m_vb);
glDeleteProgram(m_prog);
}
| [
"[email protected]"
] | |
78c7ada0589ae5db739b36f3bf0aebdec3f3deee | 2be805b60cd6fb11fde84aec4870689cb04591ea | /Source/DNAAbilities/Private/DNADebuggerCategory_Abilities.cpp | 6795ce6099ee751af14af394a8780d3e3f6d83d8 | [] | no_license | Helical-Games/HG-DNAGameplay-UE4P | 8fd6e9bc89b501da3411a83e674fc21050986246 | 4f0bc2fb5eebc8c922a6513a88cc32db96b6a468 | refs/heads/master | 2021-01-20T14:47:30.652151 | 2017-05-12T17:25:49 | 2017-05-12T17:25:49 | 90,662,072 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,968 | cpp | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "Core.h"
#include "DNADebuggerCategory_Abilities.h"
#include "DNATagContainer.h"
#include "DNAAbilitySpec.h"
#include "DNAEffect.h"
#include "AbilitySystemComponent.h"
#if WITH_DNA_DEBUGGER
FDNADebuggerCategory_Abilities::FDNADebuggerCategory_Abilities()
{
SetDataPackReplication<FRepData>(&DataPack);
}
TSharedRef<FDNADebuggerCategory> FDNADebuggerCategory_Abilities::MakeInstance()
{
return MakeShareable(new FDNADebuggerCategory_Abilities());
}
void FDNADebuggerCategory_Abilities::FRepData::Serialize(FArchive& Ar)
{
Ar << OwnedTags;
int32 NumAbilities = Abilities.Num();
Ar << NumAbilities;
if (Ar.IsLoading())
{
Abilities.SetNum(NumAbilities);
}
for (int32 Idx = 0; Idx < NumAbilities; Idx++)
{
Ar << Abilities[Idx].Ability;
Ar << Abilities[Idx].Source;
Ar << Abilities[Idx].Level;
Ar << Abilities[Idx].bIsActive;
}
int32 NumGE = DNAEffects.Num();
Ar << NumGE;
if (Ar.IsLoading())
{
DNAEffects.SetNum(NumGE);
}
for (int32 Idx = 0; Idx < NumGE; Idx++)
{
Ar << DNAEffects[Idx].Effect;
Ar << DNAEffects[Idx].Context;
Ar << DNAEffects[Idx].Duration;
Ar << DNAEffects[Idx].Period;
Ar << DNAEffects[Idx].Stacks;
Ar << DNAEffects[Idx].Level;
}
}
void FDNADebuggerCategory_Abilities::CollectData(APlayerController* OwnerPC, AActor* DebugActor)
{
UDNAAbilitySystemComponent* AbilityComp = DebugActor ? DebugActor->FindComponentByClass<UDNAAbilitySystemComponent>() : nullptr;
if (AbilityComp)
{
static FDNATagContainer OwnerTags;
OwnerTags.Reset();
AbilityComp->GetOwnedDNATags(OwnerTags);
DataPack.OwnedTags = OwnerTags.ToStringSimple();
TArray<FDNAEffectSpec> ActiveEffectSpecs;
AbilityComp->GetAllActiveDNAEffectSpecs(ActiveEffectSpecs);
for (int32 Idx = 0; Idx < ActiveEffectSpecs.Num(); Idx++)
{
const FDNAEffectSpec& EffectSpec = ActiveEffectSpecs[Idx];
FRepData::FDNAEffectDebug ItemData;
ItemData.Effect = EffectSpec.ToSimpleString();
ItemData.Effect.RemoveFromStart(DEFAULT_OBJECT_PREFIX);
ItemData.Effect.RemoveFromEnd(TEXT("_C"));
ItemData.Context = EffectSpec.GetContext().ToString();
ItemData.Duration = EffectSpec.GetDuration();
ItemData.Period = EffectSpec.GetPeriod();
ItemData.Stacks = EffectSpec.StackCount;
ItemData.Level = EffectSpec.GetLevel();
DataPack.DNAEffects.Add(ItemData);
}
const TArray<FDNAAbilitySpec>& AbilitySpecs = AbilityComp->GetActivatableAbilities();
for (int32 Idx = 0; Idx < AbilitySpecs.Num(); Idx++)
{
const FDNAAbilitySpec& AbilitySpec = AbilitySpecs[Idx];
FRepData::FDNAAbilityDebug ItemData;
ItemData.Ability = GetNameSafe(AbilitySpec.Ability);
ItemData.Ability.RemoveFromStart(DEFAULT_OBJECT_PREFIX);
ItemData.Ability.RemoveFromEnd(TEXT("_C"));
ItemData.Source = GetNameSafe(AbilitySpec.SourceObject);
ItemData.Source.RemoveFromStart(DEFAULT_OBJECT_PREFIX);
ItemData.Level = AbilitySpec.Level;
ItemData.bIsActive = AbilitySpec.IsActive();
DataPack.Abilities.Add(ItemData);
}
}
}
void FDNADebuggerCategory_Abilities::DrawData(APlayerController* OwnerPC, FDNADebuggerCanvasContext& CanvasContext)
{
CanvasContext.Printf(TEXT("Owned Tags: {yellow}%s"), *DataPack.OwnedTags);
AActor* LocalDebugActor = FindLocalDebugActor();
UDNAAbilitySystemComponent* AbilityComp = LocalDebugActor ? LocalDebugActor->FindComponentByClass<UDNAAbilitySystemComponent>() : nullptr;
if (AbilityComp)
{
static FDNATagContainer OwnerTags;
OwnerTags.Reset();
AbilityComp->GetOwnedDNATags(OwnerTags);
CanvasContext.Printf(TEXT("Local Tags: {cyan}%s"), *OwnerTags.ToStringSimple());
}
CanvasContext.Printf(TEXT("DNA Effects: {yellow}%d"), DataPack.DNAEffects.Num());
for (int32 Idx = 0; Idx < DataPack.DNAEffects.Num(); Idx++)
{
const FRepData::FDNAEffectDebug& ItemData = DataPack.DNAEffects[Idx];
FString Desc = FString::Printf(TEXT("\t{yellow}%s {grey}source:{white}%s {grey}duration:{white}"), *ItemData.Effect, *ItemData.Context);
Desc += (ItemData.Duration > 0.0f) ? FString::Printf(TEXT("%.2f"), ItemData.Duration) : FString(TEXT("INF"));
if (ItemData.Period > 0.0f)
{
Desc += FString::Printf(TEXT(" {grey}period:{white}%.2f"), ItemData.Period);
}
if (ItemData.Stacks > 1)
{
Desc += FString::Printf(TEXT(" {grey}stacks:{white}%d"), ItemData.Stacks);
}
if (ItemData.Level > 1.0f)
{
Desc += FString::Printf(TEXT(" {grey}level:{white}%.2f"), ItemData.Level);
}
CanvasContext.Print(Desc);
}
CanvasContext.Printf(TEXT("DNA Abilities: {yellow}%d"), DataPack.Abilities.Num());
for (int32 Idx = 0; Idx < DataPack.Abilities.Num(); Idx++)
{
const FRepData::FDNAAbilityDebug& ItemData = DataPack.Abilities[Idx];
CanvasContext.Printf(TEXT("\t{yellow}%s {grey}source:{white}%s {grey}level:{white}%d {grey}active:{white}%s"),
*ItemData.Ability, *ItemData.Source, ItemData.Level, ItemData.bIsActive ? TEXT("YES") : TEXT("no"));
}
}
#endif // WITH_DNA_DEBUGGER
| [
"[email protected]"
] | |
50ad0c16c5b6f65d202dfb06eb071b78a2602a1d | 35ac2fb98b1f51b52f6478a857ea78ef9329d6c9 | /include/xviz/common/quaternion.hpp | 574d9023dc1b62998c98ac737ac793d2ff1f4b03 | [] | no_license | malasiot/xviz | 3759d3265f2184d51ff5b6c674212984241efef0 | be347349e40da02f4879d6ef0dd3c11f8d504df9 | refs/heads/master | 2023-07-12T23:38:45.208826 | 2023-07-10T08:30:44 | 2023-07-10T08:30:44 | 309,635,509 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,811 | hpp | #ifndef QUATERNION_HPP
#define QUATERNION_HPP
#include <xviz/common/vector3.hpp>
#include <xviz/common/matrix3x3.hpp>
#include <ostream>
namespace xviz {
class Quaternion {
public:
Quaternion(): s_(1), v_(0, 0, 0) {}
Quaternion(const Quaternion &q): s_(q.s_), v_(q.v_) {}
Quaternion(float s, const Vector3 &v): s_(s), v_(v) {}
Quaternion(float s, float x, float y, float z): s_(s), v_(x, y, z) {}
Quaternion(const Matrix3x3 &m);
Quaternion(const Vector3 &axis, float angle);
Matrix3x3 toMatrix() const ;
static Quaternion fromAxisAngle(const Vector3 &axis, float angle) ;
float & s() { return s_; }
Vector3 &v() { return v_; }
float s() const { return s_; }
const Vector3 & v() const { return v_; }
Quaternion & operator += (const Quaternion &q) { s_ += q.s_; v_ += q.v_; return *this; }
Quaternion & operator -= (const Quaternion &q) { s_ -= q.s_; v_ -= q.v_; return *this; }
Quaternion & operator = (const Quaternion &q);
Quaternion inverse() const ;
Quaternion conjugate() const ;
Vector3 transform(const Vector3 &v) ;
double length() {return sqrt((v_[0]*v_[0])+(v_[1]*v_[1])+(v_[2]*v_[2])+(s_*s_)); }
friend std::ostream &operator << (std::ostream &strm, const Quaternion &q) ;
protected:
float s_;
Vector3 v_;
};
Quaternion operator * (const Quaternion &q1, const Quaternion &q2);
Quaternion operator * (const Quaternion &q, const Vector3 &v);
Quaternion operator * (const Vector3 &v, const Quaternion &q) ;
Quaternion operator * (float s, const Quaternion &q);
Quaternion operator + (const Quaternion &q1, const Quaternion &q2) ;
Quaternion operator - (const Quaternion &q1, const Quaternion &q2) ;
inline Quaternion::Quaternion (const Matrix3x3 &m) {
float tr = m(0,0) + m(1,1) + m(2,2), s;
if ( tr >= 0 ) {
s = sqrt(tr + 1);
s_ = 0.5 * s;
s = 0.5 / s;
v_[0] = m(2,1) - m(1,2) * s;
v_[1] = m(0,2) - m(2,0) * s;
v_[2] = m(1,0) - m(0,1) * s;
} else {
int i = 0;
if (m(1,1) > m(0,0)) i = 1;
if (m(2,2) > m(i,i)) i = 2;
switch (i) {
case 0:
s = sqrt((m(0,0) - (m(1,1) + m(2,2))) + 1);
v_[0] = 0.5 * s;
s = 0.5 / s;
v_[1] = (m(0,1) + m(1,0)) * s;
v_[2] = (m(2,0) + m(0,2)) * s;
s_ = (m(2,1) - m(1,2)) * s;
break;
case 1:
s = sqrt((m(1,1) - (m(2,2) + m(0,0))) + 1);
v_[1] = 0.5 * s;
s = 0.5 / s;
v_[2] = (m(1,2) + m(2,1)) * s;
v_[0] = (m(0,1) + m(1,0)) * s;
s_ = (m(0,2) - m(2,0)) * s;
break;
case 2:
s = sqrt((m(2,2) - (m(0,0) + m(1,1))) + 1);
v_[2] = 0.5 * s;
s = 0.5 / s;
v_[0] = (m(2,0) + m(0,2)) * s;
v_[1] = (m(1,2) + m(2,1)) * s;
s_ = (m(1,0) - m(0,1)) * s;
break;
}
}
}
inline Matrix3x3 Quaternion::toMatrix() const {
const float s = s_, x = v_.x(), y =v_.y(), z = v_.z(),
sx2 = s*x*2, sy2 = s*y*2, sz2 = s*z*2,
xx2 = x*x*2, xy2 = x*y*2, xz2 = x*z*2,
yy2 = y*y*2, yz2 = y*z*2, zz2 = z*z*2;
return {
1-yy2-zz2, xy2-sz2, xz2+sy2,
xy2+sz2, 1-xx2-zz2, yz2-sx2,
xz2-sy2, yz2+sx2, 1-xx2-yy2
};
}
inline Quaternion::Quaternion(const Vector3 &axis, float angle):
s_(cos(0.5*angle)), v_(sin(0.5*angle)*axis) {}
inline Quaternion &
Quaternion::operator = (const Quaternion &q) {
v_ = q.v(); s_ = q.s();
return *this;
}
inline Quaternion
operator * (const Quaternion &q1, const Quaternion &q2) {
return Quaternion(q1.s() * q2.s() - dot(q1.v(), q2.v()),
q1.s() * q2.v() + q2.s() * q1.v() + cross(q1.v(), q2.v()));
}
inline Quaternion operator * (const Quaternion &q, const Vector3 &v) {
return { -dot(q.v(), v), q.s() * v + cross(q.v(), v) };
}
inline Quaternion operator * (const Vector3 &v, const Quaternion &q) {
return { -dot(v, q.v()), q.s() * v + cross(v, q.v()) };
}
inline Quaternion operator * (float s, const Quaternion &q) {
return { s*q.s(), s*q.v() };
}
inline Quaternion operator + (const Quaternion &q1, const Quaternion &q2) {
return { q1.s()+q2.s(), q1.v()+q2.v() };
}
inline Quaternion operator - (const Quaternion &q1, const Quaternion &q2) {
return { q1.s()-q2.s(), q1.v()-q2.v() };
}
inline Quaternion Quaternion::inverse () const {
float mag2 = s_ * s_ + dot(v_, v_);
return { s_/mag2, -v_/mag2 };
}
inline Quaternion Quaternion::conjugate() const {
return { s_, -v_ } ;
}
// for unit quaternions only
inline Vector3 Quaternion::transform (const Vector3 &v) {
// return (q * v * conjugate(q)).V();
return { (s_ * s_ - dot(v_, v_)) * v +
2.0 * dot(v, v_) * v_ +
2.0 * s_ * cross(v_, v) };
}
}
#endif
| [
"[email protected]"
] | |
979c40da22fed2bac4b16f9c7e7d58043fd738ec | 8c7f65e1e9732889c166d9ff4e84a5d3b8c744e2 | /contests/codechef/oct14_lunchtime/test.cpp | 17b448debe5d60d00eeb146788c1a35964ad6cc1 | [] | no_license | rushilpaul/competitive-programming | 045604e4b6782b9743426c7504364a932aa85f65 | 20f33b36f80fee490db0ab405048cdc12cd90364 | refs/heads/master | 2021-01-11T21:55:21.277372 | 2020-10-31T06:11:34 | 2020-10-31T06:11:34 | 78,875,026 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 806 | cpp | #include <bits/stdc++.h>
typedef long long LL;
using namespace std;
template<class T>
T read(T &n) { cin >> n; return n; }
template<class T1,class T2>
void read(T1 &n1, T2 &n2) { cin >> n1 >> n2; }
template<class T1,class T2,class T3>
void read(T1 &n1, T2 &n2, T3 &n3) { cin >> n1 >> n2 >> n3; }
template<class T1,class T2,class T3,class T4>
void read(T1 &n1, T2 &n2, T3 &n3, T4 &n4) { cin >> n1 >> n2 >> n3 >> n4; }
template<class T>
void read(T *ar, int n)
{
for(int a=0;a<n;a++) cin >> ar[a];
}
#define max_buf_size 2048
char _out_buf_[max_buf_size];
struct _init_
{
_init_() { setvbuf(stdout,_out_buf_,_IOFBF,max_buf_size); ios_base::sync_with_stdio(0); cin.tie(0); }
} _init_ob_unused;
int main()
{
int n,e,m; read(n,e,m);
printf("%d\n",pow(n,e));
return 0;
}
| [
"[email protected]"
] | |
5c4ac72ce2fd7b831c52d29122d442ab4fb90e2c | 46daa0451bc7c5f118ee72b3a01393a586664f7c | /src/CCA/Components/Arches/PropertyModelsV2/UFromRhoU.cc | 5b884667fbbb81ade98def38abd36dd61080fe58 | [
"MIT"
] | permissive | haoxiangmiao/uintah | 222679a7a45dc56590eda7f7bae85a551973f791 | c95ae973f400b18c175a61652ea4260584876f9f | refs/heads/master | 2020-08-17T18:06:35.344870 | 2019-10-14T13:54:07 | 2019-10-14T13:54:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,554 | cc | #include <CCA/Components/Arches/PropertyModelsV2/UFromRhoU.h>
#include <CCA/Components/Arches/UPSHelper.h>
using namespace Uintah;
using namespace ArchesCore;
//--------------------------------------------------------------------------------------------------
UFromRhoU::UFromRhoU( std::string task_name, int matl_index ) :
TaskInterface( task_name, matl_index ){}
//--------------------------------------------------------------------------------------------------
UFromRhoU::~UFromRhoU(){}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::problemSetup( ProblemSpecP& db ){
using namespace Uintah::ArchesCore;
m_u_vel_name = parse_ups_for_role( UVELOCITY, db, "uVelocitySPBC" );
m_v_vel_name = parse_ups_for_role( VVELOCITY, db, "vVelocitySPBC" );
m_w_vel_name = parse_ups_for_role( WVELOCITY, db, "wVelocitySPBC" );
m_density_name = parse_ups_for_role( DENSITY, db, "density" );
m_xmom = default_uMom_name;
m_ymom = default_vMom_name;
m_zmom = default_wMom_name;
m_eps_name = "cc_volume_fraction";
}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::create_local_labels(){
register_new_variable<SFCXVariable<double> >( m_u_vel_name );
register_new_variable<SFCYVariable<double> >( m_v_vel_name );
register_new_variable<SFCZVariable<double> >( m_w_vel_name );
}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::register_initialize( AVarInfo& variable_registry , const bool pack_tasks){
typedef ArchesFieldContainer AFC;
register_variable( m_density_name, AFC::REQUIRES, 1, AFC::NEWDW, variable_registry, m_task_name );
register_variable( m_xmom, AFC::REQUIRES, 0, AFC::NEWDW, variable_registry, m_task_name );
register_variable( m_ymom, AFC::REQUIRES, 0, AFC::NEWDW, variable_registry, m_task_name );
register_variable( m_zmom, AFC::REQUIRES, 0, AFC::NEWDW, variable_registry, m_task_name );
register_variable( m_u_vel_name, AFC::COMPUTES, variable_registry, m_task_name );
register_variable( m_v_vel_name, AFC::COMPUTES, variable_registry, m_task_name );
register_variable( m_w_vel_name, AFC::COMPUTES, variable_registry, m_task_name );
register_variable( m_eps_name, AFC::REQUIRES, 1, AFC::NEWDW, variable_registry, m_task_name );
}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::initialize( const Patch* patch, ArchesTaskInfoManager* tsk_info ){
compute_velocities( patch, tsk_info );
}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::register_timestep_init( AVarInfo& variable_registry , const bool pack_tasks){
typedef ArchesFieldContainer AFC;
register_variable( m_u_vel_name, AFC::COMPUTES, variable_registry, m_task_name );
register_variable( m_v_vel_name, AFC::COMPUTES, variable_registry, m_task_name );
register_variable( m_w_vel_name, AFC::COMPUTES, variable_registry, m_task_name );
register_variable( m_u_vel_name, AFC::REQUIRES,0, AFC::OLDDW, variable_registry, m_task_name );
register_variable( m_v_vel_name, AFC::REQUIRES,0, AFC::OLDDW, variable_registry, m_task_name );
register_variable( m_w_vel_name, AFC::REQUIRES,0, AFC::OLDDW, variable_registry, m_task_name );
}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::timestep_init( const Patch* patch, ArchesTaskInfoManager* tsk_info ){
constSFCXVariable<double>& old_u = tsk_info->get_const_uintah_field_add<constSFCXVariable<double> >(m_u_vel_name);
constSFCYVariable<double>& old_v = tsk_info->get_const_uintah_field_add<constSFCYVariable<double> >(m_v_vel_name);
constSFCZVariable<double>& old_w = tsk_info->get_const_uintah_field_add<constSFCZVariable<double> >(m_w_vel_name);
SFCXVariable<double>& u = tsk_info->get_uintah_field_add<SFCXVariable<double> >(m_u_vel_name);
SFCYVariable<double>& v = tsk_info->get_uintah_field_add<SFCYVariable<double> >(m_v_vel_name);
SFCZVariable<double>& w = tsk_info->get_uintah_field_add<SFCZVariable<double> >(m_w_vel_name);
u.copy(old_u);
v.copy(old_v);
w.copy(old_w);
}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::register_timestep_eval( VIVec& variable_registry, const int time_substep ,
const bool packed_tasks){
typedef ArchesFieldContainer AFC;
register_variable( m_density_name, AFC::REQUIRES, 1, AFC::NEWDW, variable_registry, time_substep, m_task_name );
register_variable( m_xmom, AFC::REQUIRES, 0, AFC::NEWDW, variable_registry, time_substep, m_task_name );
register_variable( m_ymom, AFC::REQUIRES, 0, AFC::NEWDW, variable_registry, time_substep, m_task_name );
register_variable( m_zmom, AFC::REQUIRES, 0, AFC::NEWDW, variable_registry, time_substep, m_task_name );
register_variable( m_eps_name, AFC::REQUIRES, 1, AFC::NEWDW, variable_registry, time_substep, m_task_name );
register_variable( m_u_vel_name, AFC::MODIFIES , variable_registry, time_substep, m_task_name );
register_variable( m_v_vel_name, AFC::MODIFIES , variable_registry, time_substep, m_task_name );
register_variable( m_w_vel_name, AFC::MODIFIES , variable_registry, time_substep, m_task_name );
}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::eval( const Patch* patch, ArchesTaskInfoManager* tsk_info ){
compute_velocities( patch, tsk_info );
}
//--------------------------------------------------------------------------------------------------
void UFromRhoU::compute_velocities( const Patch* patch, ArchesTaskInfoManager* tsk_info ){
constCCVariable<double>& rho = tsk_info->get_const_uintah_field_add<constCCVariable<double> >( m_density_name );
constCCVariable<double>& eps = tsk_info->get_const_uintah_field_add<constCCVariable<double> >( m_eps_name );
constSFCXVariable<double>& xmom = tsk_info->get_const_uintah_field_add<constSFCXVariable<double> >( m_xmom );
constSFCYVariable<double>& ymom = tsk_info->get_const_uintah_field_add<constSFCYVariable<double> >( m_ymom );
constSFCZVariable<double>& zmom = tsk_info->get_const_uintah_field_add<constSFCZVariable<double> >( m_zmom );
SFCXVariable<double>& u = tsk_info->get_uintah_field_add<SFCXVariable<double> >(m_u_vel_name);
SFCYVariable<double>& v = tsk_info->get_uintah_field_add<SFCYVariable<double> >(m_v_vel_name);
SFCZVariable<double>& w = tsk_info->get_uintah_field_add<SFCZVariable<double> >(m_w_vel_name);
u.initialize(0.0);
v.initialize(0.0);
w.initialize(0.0);
IntVector cell_lo = patch->getCellLowIndex();
IntVector cell_hi = patch->getCellHighIndex();
IntVector low_fx_patch_range = cell_lo;
IntVector high_fx_patch_range = cell_hi;
GET_WALL_BUFFERED_PATCH_RANGE(low_fx_patch_range,high_fx_patch_range,0,1,-1,1,-1,1);
Uintah::BlockRange x_range( low_fx_patch_range,high_fx_patch_range );
Uintah::parallel_for( x_range, [&](int i, int j, int k){
const double rho_face = (rho(i,j,k) + rho(i-1,j,k))/2.;
const double eps_face = ( (eps(i,j,k) + eps(i-1,j,k))/2. < 1. ) ? 0. : 1.;
u(i,j,k) = std::abs(rho_face) > 0. ? xmom(i,j,k) / rho_face * eps_face : 0.;
});
if ( patch->getBCType(Patch::xminus) != Patch::Neighbor ){
IntVector x_cell_lo = cell_lo;
IntVector x_cell_hi = cell_hi;
x_cell_lo[0] -= 1;
x_cell_hi[0] = x_cell_lo[0]+1;
Uintah::BlockRange bc_x_range( x_cell_lo, x_cell_hi );
Uintah::parallel_for( bc_x_range, [&](int i, int j, int k){
u(i,j,k) = u(i+1,j,k);
});
}
IntVector low_fy_patch_range = cell_lo;
IntVector high_fy_patch_range = cell_hi;
GET_WALL_BUFFERED_PATCH_RANGE(low_fy_patch_range,high_fy_patch_range,-1,1,0,1,-1,1);
Uintah::BlockRange y_range( low_fy_patch_range, high_fy_patch_range );
Uintah::parallel_for( y_range, [&](int i, int j, int k){
const double rho_face = (rho(i,j,k) + rho(i,j-1,k))/2.;
const double eps_face = ( (eps(i,j,k) + eps(i,j-1,k))/2. < 1. ) ? 0. : 1.;
v(i,j,k) = std::abs(rho_face) > 0. ? ymom(i,j,k) / rho_face * eps_face : 0.;
});
if ( patch->getBCType(Patch::yminus) != Patch::Neighbor ){
IntVector y_cell_lo = cell_lo;
IntVector y_cell_hi = cell_hi;
y_cell_lo[1] -= 1;
y_cell_hi[1] = y_cell_lo[1]+1;
Uintah::BlockRange bc_y_range( y_cell_lo, y_cell_hi );
Uintah::parallel_for( bc_y_range, [&](int i, int j, int k){
v(i,j,k) = v(i,j+1,k);
});
}
IntVector low_fz_patch_range = cell_lo;
IntVector high_fz_patch_range = cell_hi;
GET_WALL_BUFFERED_PATCH_RANGE(low_fz_patch_range,high_fz_patch_range,-1,1,-1,1,0,1);
Uintah::BlockRange z_range( low_fz_patch_range, high_fz_patch_range );
Uintah::parallel_for( z_range, [&](int i, int j, int k){
const double rho_face = (rho(i,j,k) + rho(i,j,k-1))/2.;
const double eps_face = ( (eps(i,j,k) + eps(i,j,k-1))/2. < 1. ) ? 0. : 1.;
w(i,j,k) = std::abs(rho_face) > 0. ? zmom(i,j,k) / rho_face * eps_face : 0.;
});
if ( patch->getBCType(Patch::zminus) != Patch::Neighbor ){
IntVector z_cell_lo = cell_lo;
IntVector z_cell_hi = cell_hi;
z_cell_lo[2] -= 1;
z_cell_hi[2] = z_cell_lo[2]+1;
Uintah::BlockRange bc_z_range( z_cell_lo, z_cell_hi );
Uintah::parallel_for( bc_z_range, [&](int i, int j, int k){
w(i,j,k) = w(i,j,k+1);
});
}
}
| [
"jthornoc@aee3fe44-4ef4-0310-ac56-cc817e9d0e43"
] | jthornoc@aee3fe44-4ef4-0310-ac56-cc817e9d0e43 |
23c556740f5e9c3f2fdb790902022076ea0c23f0 | 84becc1fad7dc2ed2404f1b44f8859929746fd6d | /qgleswidget.h | 31beee65c292457b05e5ae269251bfe01d53cfb0 | [] | no_license | cyt2017/opengl_shaderLesson05 | bb3144f3a9edbf52ef5f858082781169537aa012 | c394a95cd9bebbbc894978b07efded85d4126e36 | refs/heads/master | 2021-08-17T00:52:17.544042 | 2017-11-20T15:50:16 | 2017-11-20T15:50:16 | 111,430,803 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,499 | h | #ifndef QGLESWIDGET_H
#define QGLESWIDGET_H
#include <QWidget>
#include <FreeImage.h>
#include <QKeyEvent>
#include <QMouseEvent>
#include "tool/CELLMath.hpp"
#include "tool/program_p2_c4.h"
#include "tool/mycamera.h"
#define MESA_EGL_NO_X11_HEADERS
#include <EGL/egl.h>
#include <GLES2/gl2.h>
enum KEYMODE
{
KEY_NULL,
KEY_A,
KEY_S,
KEY_D,
KEY_W,
};
enum MOUSEMODE
{
MOUSE_NULL,
MOUSE_LEFTDOWN,
MOUSE_RIGHTDOWN,
MOUSE_LEFTUP,
MOUSE_RIGHTUP,
MOUSE_WHEEL,
};
//typedef struct
//{
// CELL::float2 pos;
// CELL::float2 uv;
// CELL::Rgba4Byte color;
//}Vertex;
typedef struct
{
float x,y,z;
float nx,ny,nz;
float u,v;
}Vertex;
typedef struct
{
float x,y,z;
float nx,ny,nz;
float u,v;
}V3N3;
class QGLESWIDGET : public QWidget
{
Q_OBJECT
public:
explicit QGLESWIDGET(QWidget *parent = 0);
~QGLESWIDGET();
//! 窗口的高度
int _width;
//! 窗口的宽度
int _height;
/// for gles2.0
EGLConfig _config;
EGLSurface _surface;
EGLContext _context;
EGLDisplay _display;
//! 增加shader
PROGRAM_P2_C4 _shader;
unsigned int _texture;
unsigned int _texture1;
unsigned int _textureAuto;
MYCAMERA _camera;
//!缓冲区<帧>
unsigned int _frameBO;
unsigned int _renderBO;
bool init_QGW(std::vector<QString> fileName);
//! 初始化 OpenGLES2.0
bool initOpenGLES20();
//! 销毁OpenGLES2.0
void destroyOpenGLES20();
virtual void render();
virtual unsigned int loadTexture(const char* fileName);
virtual unsigned int loadTextureMipmap(std::vector<QString> fName);
virtual unsigned int createTexture(int width,int height);
void drawImage();
void displayGround();
void displayRect();
QObject *parent;
//!实现键盘事件
bool eventFilter( QObject * target , QEvent * event );
void keyPressEvent(QKeyEvent * e);
//!鼠标事件
CELL::float2 pos;
MOUSEMODE typeMouse;
bool leftB;
bool rightB;
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
signals:
void sendKeyEvent(KEYMODE key);
void sendMouseEvent(MOUSEMODE mouse,CELL::int2 pstart,CELL::int2 pend);
void sendWheelEvent(MOUSEMODE mouse,int p,CELL::int2 pos);
public slots:
};
#endif // QGLESWIDGET_H
| [
"[email protected]"
] | |
3cfe85323c253dcbe7f0f87111fbd0bbfd920a15 | d24cd235387eace08c7c61f5ef86f062192de5e0 | /Source/USB2I2CHwModuleCtrlI2CUnit.h | a130aed82c3e214e57ae6207ba2164b78ea054e7 | [] | no_license | asafl1976/MVTerminal | e02b149e32b1927e281167c20a20f15422762714 | 019fd753b704d21b1f3787395d1e61b9a1075dfe | refs/heads/master | 2021-01-02T08:58:14.191737 | 2017-08-02T10:31:35 | 2017-08-02T10:31:35 | 99,104,278 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 308 | h | #pragma once
#include "HwModuleCtrlI2CUnit.h"
#include "HwModuleCtrl.h"
class CUSB2I2CHwModuleCtrlI2CUnit : public CHwModuleCtrlI2CUnit
{
public:
CUSB2I2CHwModuleCtrlI2CUnit(CHwModuleCtrl *pHwModuleCtrl,CHwModuleCtrlI2CUnitDrv* pI2CUnitDrv);
virtual ~CUSB2I2CHwModuleCtrlI2CUnit(void);
};
| [
"[email protected]"
] | |
7cf6fe055e32c2ec5edd1c04cb1f35ac1e6b6de5 | c97a7063b42d081ba05540b4c98e260856cbfd13 | /TowerofAngra/Debug/projectlevel/Source/projectlevel/HAnimInstance.cpp | 9a81174cee2cfb7b66868d68ece70dd7b12acdd8 | [] | no_license | MasterTyping/Shared-repository | 0846acac8ea2b055c44d76007c429425524832a0 | 2b583d2989b56fa9613ed45cfd6be94e566e0fde | refs/heads/master | 2023-03-01T18:24:32.805114 | 2019-05-17T07:19:26 | 2019-05-17T07:19:26 | 185,020,664 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 884 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "HAnimInstance.h"
UHAnimInstance::UHAnimInstance()
{
CurrentPawnSpeed = 0.f;
static ConstructorHelpers::FObjectFinder<UAnimMontage> ATTACK_MONTAGE(TEXT("/Game/Golem/Animations/SK_Golem_Skeleton_Montage.SK_Golem_Skeleton_Montage"));
if (ATTACK_MONTAGE.Succeeded())
{
AttackMontage = ATTACK_MONTAGE.Object;
}
}
void UHAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
Super::NativeUpdateAnimation(DeltaSeconds);
auto Pawn = TryGetPawnOwner();
if (::IsValid(Pawn))
{
CurrentPawnSpeed = Pawn->GetVelocity().Size();
}
}
void UHAnimInstance::PlayAttackMontage()
{
Montage_Play(AttackMontage, 1.f);
}
void UHAnimInstance::AnimNotify_AttackHitCheck()
{
OnAttackHitCheck.Broadcast();
}
void UHAnimInstance::AnimNotify_NextAttackCheck()
{
OnNextAttackCheck.Broadcast();
}
| [
"[email protected]"
] | |
76bf106ca389cd5439713763861d2b6093a26b34 | 068ca4ac99f7f31a49536666a36a3951c5595de2 | /macro/B0_ch1.h | f00d1c912e45e0afadad9c2d71eb868912f44021 | [] | no_license | lacaprara/b2pd_analysis | 1d4deb806bcd5a23dd069f747d4b5259264be8b4 | 71a72138cd9149008be808a0427740785e9bcaa3 | refs/heads/master | 2020-04-06T13:53:59.380213 | 2016-10-26T13:58:07 | 2016-10-26T13:58:07 | 48,995,200 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 43,449 | h | //////////////////////////////////////////////////////////
// This class has been automatically generated on
// Wed Dec 16 11:37:01 2015 by ROOT version 5.34/25
// from TTree B0/
// found on file: B0_etapr-eta-gg2pi_KS-pi+pi-_output_signal.root
//////////////////////////////////////////////////////////
#ifndef B0_ch1_h
#define B0_ch1_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
// Header file for the classes stored in the TTree if any.
class B0_ch1 {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
Int_t fCurrent; //!current Tree number in a TChain
// Fixed size dimensions of array or collections stored in the TTree if any.
// Declaration of leaf types
Int_t exp_no;
Int_t run_no;
Int_t evt_no;
Float_t B0_M;
Float_t B0_ErrM;
Float_t B0_SigM;
Float_t B0_etaP_M;
Float_t B0_etaP_ErrM;
Float_t B0_etaP_SigM;
Float_t B0_etaP_eta_M;
Float_t B0_etaP_eta_ErrM;
Float_t B0_etaP_eta_SigM;
Float_t B0_K_S0_M;
Float_t B0_K_S0_ErrM;
Float_t B0_K_S0_SigM;
Int_t B0_etaP_pi0_charge;
Int_t B0_etaP_pi1_charge;
Float_t B0_P;
Float_t B0_P4[4];
Float_t B0_etaP_P;
Float_t B0_etaP_P4[4];
Float_t B0_etaP_eta_P;
Float_t B0_etaP_eta_P4[4];
Float_t B0_K_S0_P;
Float_t B0_K_S0_P4[4];
Float_t B0_Pcms;
Float_t B0_P4cms[4];
Float_t B0_etaP_Pcms;
Float_t B0_etaP_P4cms[4];
Float_t B0_etaP_eta_Pcms;
Float_t B0_etaP_eta_P4cms[4];
Float_t B0_K_S0_Pcms;
Float_t B0_K_S0_P4cms[4];
Int_t B0_mcPDG;
Int_t B0_mcErrors;
Int_t B0_etaP_mcPDG;
Int_t B0_etaP_mcErrors;
Int_t B0_etaP_eta_mcPDG;
Int_t B0_etaP_eta_mcErrors;
Int_t B0_K_S0_mcPDG;
Int_t B0_K_S0_mcErrors;
Float_t B0_deltae;
Float_t B0_mbc;
Float_t B0_etaP_pi0_PIDk;
Float_t B0_etaP_pi0_PIDpi;
Float_t B0_etaP_pi0_PIDe;
Float_t B0_etaP_pi0_PIDmu;
Float_t B0_etaP_pi0_PIDp;
Float_t B0_etaP_pi1_PIDk;
Float_t B0_etaP_pi1_PIDpi;
Float_t B0_etaP_pi1_PIDe;
Float_t B0_etaP_pi1_PIDmu;
Float_t B0_etaP_pi1_PIDp;
Float_t B0_etaP_pi0_DLLPion;
Float_t B0_etaP_pi0_DLLKaon;
Float_t B0_etaP_pi0_DLLProt;
Float_t B0_etaP_pi0_DLLElec;
Float_t B0_etaP_pi0_DLLMuon;
Float_t B0_etaP_pi1_DLLPion;
Float_t B0_etaP_pi1_DLLKaon;
Float_t B0_etaP_pi1_DLLProt;
Float_t B0_etaP_pi1_DLLElec;
Float_t B0_etaP_pi1_DLLMuon;
Float_t B0_etaP_pi0_d0;
Float_t B0_etaP_pi0_z0;
Float_t B0_etaP_pi0_TrPval;
Float_t B0_etaP_pi1_d0;
Float_t B0_etaP_pi1_z0;
Float_t B0_etaP_pi1_TrPval;
Int_t B0_etaP_pi0_nCDCHits;
Int_t B0_etaP_pi0_nSVDHits;
Int_t B0_etaP_pi0_nPXDHits;
Int_t B0_etaP_pi1_nCDCHits;
Int_t B0_etaP_pi1_nSVDHits;
Int_t B0_etaP_pi1_nPXDHits;
Int_t B0_MC_MOTHER_ID;
Int_t B0_MC_GD_MOTHER_ID;
Int_t B0_MC_GD_GD_MOTHER_ID;
Int_t B0_etaP_MC_MOTHER_ID;
Int_t B0_etaP_MC_GD_MOTHER_ID;
Int_t B0_etaP_MC_GD_GD_MOTHER_ID;
Int_t B0_etaP_eta_MC_MOTHER_ID;
Int_t B0_etaP_eta_MC_GD_MOTHER_ID;
Int_t B0_etaP_eta_MC_GD_GD_MOTHER_ID;
Int_t B0_K_S0_MC_MOTHER_ID;
Int_t B0_K_S0_MC_GD_MOTHER_ID;
Int_t B0_K_S0_MC_GD_GD_MOTHER_ID;
Float_t B0_TruthP;
Float_t B0_TruthP4[4];
Float_t B0_TruthM;
Float_t B0_etaP_TruthP;
Float_t B0_etaP_TruthP4[4];
Float_t B0_etaP_TruthM;
Float_t B0_etaP_eta_TruthP;
Float_t B0_etaP_eta_TruthP4[4];
Float_t B0_etaP_eta_TruthM;
Float_t B0_K_S0_TruthP;
Float_t B0_K_S0_TruthP4[4];
Float_t B0_K_S0_TruthM;
Float_t B0_X;
Float_t B0_ErrX;
Float_t B0_Y;
Float_t B0_ErrY;
Float_t B0_Z;
Float_t B0_ErrZ;
Float_t B0_Rho;
Float_t B0_VtxPvalue;
Float_t B0_VtxProd[3];
Float_t B0_VtxProdCov[3][3];
Float_t B0_etaP_X;
Float_t B0_etaP_ErrX;
Float_t B0_etaP_Y;
Float_t B0_etaP_ErrY;
Float_t B0_etaP_Z;
Float_t B0_etaP_ErrZ;
Float_t B0_etaP_Rho;
Float_t B0_etaP_VtxPvalue;
Float_t B0_etaP_VtxProd[3];
Float_t B0_etaP_VtxProdCov[3][3];
Float_t B0_etaP_eta_X;
Float_t B0_etaP_eta_ErrX;
Float_t B0_etaP_eta_Y;
Float_t B0_etaP_eta_ErrY;
Float_t B0_etaP_eta_Z;
Float_t B0_etaP_eta_ErrZ;
Float_t B0_etaP_eta_Rho;
Float_t B0_etaP_eta_VtxPvalue;
Float_t B0_etaP_eta_VtxProd[3];
Float_t B0_etaP_eta_VtxProdCov[3][3];
Float_t B0_etaP_pi0_X;
Float_t B0_etaP_pi0_ErrX;
Float_t B0_etaP_pi0_Y;
Float_t B0_etaP_pi0_ErrY;
Float_t B0_etaP_pi0_Z;
Float_t B0_etaP_pi0_ErrZ;
Float_t B0_etaP_pi0_Rho;
Float_t B0_etaP_pi0_VtxPvalue;
Float_t B0_etaP_pi0_VtxProd[3];
Float_t B0_etaP_pi0_VtxProdCov[3][3];
Float_t B0_etaP_pi1_X;
Float_t B0_etaP_pi1_ErrX;
Float_t B0_etaP_pi1_Y;
Float_t B0_etaP_pi1_ErrY;
Float_t B0_etaP_pi1_Z;
Float_t B0_etaP_pi1_ErrZ;
Float_t B0_etaP_pi1_Rho;
Float_t B0_etaP_pi1_VtxPvalue;
Float_t B0_etaP_pi1_VtxProd[3];
Float_t B0_etaP_pi1_VtxProdCov[3][3];
Float_t B0_K_S0_X;
Float_t B0_K_S0_ErrX;
Float_t B0_K_S0_Y;
Float_t B0_K_S0_ErrY;
Float_t B0_K_S0_Z;
Float_t B0_K_S0_ErrZ;
Float_t B0_K_S0_Rho;
Float_t B0_K_S0_VtxPvalue;
Float_t B0_K_S0_VtxProd[3];
Float_t B0_K_S0_VtxProdCov[3][3];
Float_t B0_TruthX;
Float_t B0_TruthY;
Float_t B0_TruthZ;
Float_t B0_TruthRho;
Float_t B0_TruthVtxProd[3];
Float_t B0_etaP_TruthX;
Float_t B0_etaP_TruthY;
Float_t B0_etaP_TruthZ;
Float_t B0_etaP_TruthRho;
Float_t B0_etaP_TruthVtxProd[3];
Float_t B0_etaP_eta_TruthX;
Float_t B0_etaP_eta_TruthY;
Float_t B0_etaP_eta_TruthZ;
Float_t B0_etaP_eta_TruthRho;
Float_t B0_etaP_eta_TruthVtxProd[3];
Float_t B0_etaP_pi0_TruthX;
Float_t B0_etaP_pi0_TruthY;
Float_t B0_etaP_pi0_TruthZ;
Float_t B0_etaP_pi0_TruthRho;
Float_t B0_etaP_pi0_TruthVtxProd[3];
Float_t B0_etaP_pi1_TruthX;
Float_t B0_etaP_pi1_TruthY;
Float_t B0_etaP_pi1_TruthZ;
Float_t B0_etaP_pi1_TruthRho;
Float_t B0_etaP_pi1_TruthVtxProd[3];
Float_t B0_K_S0_TruthX;
Float_t B0_K_S0_TruthY;
Float_t B0_K_S0_TruthZ;
Float_t B0_K_S0_TruthRho;
Float_t B0_K_S0_TruthVtxProd[3];
Float_t B0_TagVx;
Float_t B0_TagVy;
Float_t B0_TagVz;
Float_t B0_TagVex;
Float_t B0_TagVey;
Float_t B0_TagVez;
Float_t B0_TagVPvalue;
Float_t B0_TruthTagVx;
Float_t B0_TruthTagVy;
Float_t B0_TruthTagVz;
Float_t B0_DeltaT;
Int_t B0_mcTagPDG;
Float_t B0_TruthDeltaT;
Float_t B0_ThrustB;
Float_t B0_ThrustO;
Float_t B0_CosTBTO;
Float_t B0_CosTBz;
Float_t B0_R2;
Float_t B0_cc1;
Float_t B0_cc2;
Float_t B0_cc3;
Float_t B0_cc4;
Float_t B0_cc5;
Float_t B0_cc6;
Float_t B0_cc7;
Float_t B0_cc8;
Float_t B0_cc9;
Float_t B0_mm2;
Float_t B0_et;
Float_t B0_hso00;
Float_t B0_hso01;
Float_t B0_hso02;
Float_t B0_hso03;
Float_t B0_hso04;
Float_t B0_hso10;
Float_t B0_hso12;
Float_t B0_hso14;
Float_t B0_hso20;
Float_t B0_hso22;
Float_t B0_hso24;
Float_t B0_hoo0;
Float_t B0_hoo1;
Float_t B0_hoo2;
Float_t B0_hoo3;
Float_t B0_hoo4;
Float_t B0__isSignal;
Float_t B0_etaP__isSignal;
Float_t B0_etaP_eta__isSignal;
Float_t B0_K_S0__isSignal;
Float_t B0__LPCA_Probability;
Float_t B0__FastBDT_Probability;
Float_t B0__transformedNetworkOutputLPCA_Probability010;
Float_t B0__transformedNetworkOutputFastBDT_Probability0010;
Int_t nCands;
Int_t iCand;
// List of branches
TBranch *b_exp_no; //!
TBranch *b_run_no; //!
TBranch *b_evt_no; //!
TBranch *b_B0_M; //!
TBranch *b_B0_ErrM; //!
TBranch *b_B0_SigM; //!
TBranch *b_B0_etaP_M; //!
TBranch *b_B0_etaP_ErrM; //!
TBranch *b_B0_etaP_SigM; //!
TBranch *b_B0_etaP_eta_M; //!
TBranch *b_B0_etaP_eta_ErrM; //!
TBranch *b_B0_etaP_eta_SigM; //!
TBranch *b_B0_K_S0_M; //!
TBranch *b_B0_K_S0_ErrM; //!
TBranch *b_B0_K_S0_SigM; //!
TBranch *b_B0_etaP_pi0_charge; //!
TBranch *b_B0_etaP_pi1_charge; //!
TBranch *b_B0_P; //!
TBranch *b_B0_P4; //!
TBranch *b_B0_etaP_P; //!
TBranch *b_B0_etaP_P4; //!
TBranch *b_B0_etaP_eta_P; //!
TBranch *b_B0_etaP_eta_P4; //!
TBranch *b_B0_K_S0_P; //!
TBranch *b_B0_K_S0_P4; //!
TBranch *b_B0_Pcms; //!
TBranch *b_B0_P4cms; //!
TBranch *b_B0_etaP_Pcms; //!
TBranch *b_B0_etaP_P4cms; //!
TBranch *b_B0_etaP_eta_Pcms; //!
TBranch *b_B0_etaP_eta_P4cms; //!
TBranch *b_B0_K_S0_Pcms; //!
TBranch *b_B0_K_S0_P4cms; //!
TBranch *b_B0_mcPDG; //!
TBranch *b_B0_mcErrors; //!
TBranch *b_B0_etaP_mcPDG; //!
TBranch *b_B0_etaP_mcErrors; //!
TBranch *b_B0_etaP_eta_mcPDG; //!
TBranch *b_B0_etaP_eta_mcErrors; //!
TBranch *b_B0_K_S0_mcPDG; //!
TBranch *b_B0_K_S0_mcErrors; //!
TBranch *b_B0_deltae; //!
TBranch *b_B0_mbc; //!
TBranch *b_B0_etaP_pi0_PIDk; //!
TBranch *b_B0_etaP_pi0_PIDpi; //!
TBranch *b_B0_etaP_pi0_PIDe; //!
TBranch *b_B0_etaP_pi0_PIDmu; //!
TBranch *b_B0_etaP_pi0_PIDp; //!
TBranch *b_B0_etaP_pi1_PIDk; //!
TBranch *b_B0_etaP_pi1_PIDpi; //!
TBranch *b_B0_etaP_pi1_PIDe; //!
TBranch *b_B0_etaP_pi1_PIDmu; //!
TBranch *b_B0_etaP_pi1_PIDp; //!
TBranch *b_B0_etaP_pi0_DLLPion; //!
TBranch *b_B0_etaP_pi0_DLLKaon; //!
TBranch *b_B0_etaP_pi0_DLLProt; //!
TBranch *b_B0_etaP_pi0_DLLElec; //!
TBranch *b_B0_etaP_pi0_DLLMuon; //!
TBranch *b_B0_etaP_pi1_DLLPion; //!
TBranch *b_B0_etaP_pi1_DLLKaon; //!
TBranch *b_B0_etaP_pi1_DLLProt; //!
TBranch *b_B0_etaP_pi1_DLLElec; //!
TBranch *b_B0_etaP_pi1_DLLMuon; //!
TBranch *b_B0_etaP_pi0_d0; //!
TBranch *b_B0_etaP_pi0_z0; //!
TBranch *b_B0_etaP_pi0_TrPval; //!
TBranch *b_B0_etaP_pi1_d0; //!
TBranch *b_B0_etaP_pi1_z0; //!
TBranch *b_B0_etaP_pi1_TrPval; //!
TBranch *b_B0_etaP_pi0_nCDCHits; //!
TBranch *b_B0_etaP_pi0_nSVDHits; //!
TBranch *b_B0_etaP_pi0_nPXDHits; //!
TBranch *b_B0_etaP_pi1_nCDCHits; //!
TBranch *b_B0_etaP_pi1_nSVDHits; //!
TBranch *b_B0_etaP_pi1_nPXDHits; //!
TBranch *b_B0_MC_MOTHER_ID; //!
TBranch *b_B0_MC_GD_MOTHER_ID; //!
TBranch *b_B0_MC_GD_GD_MOTHER_ID; //!
TBranch *b_B0_etaP_MC_MOTHER_ID; //!
TBranch *b_B0_etaP_MC_GD_MOTHER_ID; //!
TBranch *b_B0_etaP_MC_GD_GD_MOTHER_ID; //!
TBranch *b_B0_etaP_eta_MC_MOTHER_ID; //!
TBranch *b_B0_etaP_eta_MC_GD_MOTHER_ID; //!
TBranch *b_B0_etaP_eta_MC_GD_GD_MOTHER_ID; //!
TBranch *b_B0_K_S0_MC_MOTHER_ID; //!
TBranch *b_B0_K_S0_MC_GD_MOTHER_ID; //!
TBranch *b_B0_K_S0_MC_GD_GD_MOTHER_ID; //!
TBranch *b_B0_TruthP; //!
TBranch *b_B0_TruthP4; //!
TBranch *b_B0_TruthM; //!
TBranch *b_B0_etaP_TruthP; //!
TBranch *b_B0_etaP_TruthP4; //!
TBranch *b_B0_etaP_TruthM; //!
TBranch *b_B0_etaP_eta_TruthP; //!
TBranch *b_B0_etaP_eta_TruthP4; //!
TBranch *b_B0_etaP_eta_TruthM; //!
TBranch *b_B0_K_S0_TruthP; //!
TBranch *b_B0_K_S0_TruthP4; //!
TBranch *b_B0_K_S0_TruthM; //!
TBranch *b_B0_X; //!
TBranch *b_B0_ErrX; //!
TBranch *b_B0_Y; //!
TBranch *b_B0_ErrY; //!
TBranch *b_B0_Z; //!
TBranch *b_B0_ErrZ; //!
TBranch *b_B0_Rho; //!
TBranch *b_B0_VtxPvalue; //!
TBranch *b_B0_VtxProd; //!
TBranch *b_B0_VtxProdCov; //!
TBranch *b_B0_etaP_X; //!
TBranch *b_B0_etaP_ErrX; //!
TBranch *b_B0_etaP_Y; //!
TBranch *b_B0_etaP_ErrY; //!
TBranch *b_B0_etaP_Z; //!
TBranch *b_B0_etaP_ErrZ; //!
TBranch *b_B0_etaP_Rho; //!
TBranch *b_B0_etaP_VtxPvalue; //!
TBranch *b_B0_etaP_VtxProd; //!
TBranch *b_B0_etaP_VtxProdCov; //!
TBranch *b_B0_etaP_eta_X; //!
TBranch *b_B0_etaP_eta_ErrX; //!
TBranch *b_B0_etaP_eta_Y; //!
TBranch *b_B0_etaP_eta_ErrY; //!
TBranch *b_B0_etaP_eta_Z; //!
TBranch *b_B0_etaP_eta_ErrZ; //!
TBranch *b_B0_etaP_eta_Rho; //!
TBranch *b_B0_etaP_eta_VtxPvalue; //!
TBranch *b_B0_etaP_eta_VtxProd; //!
TBranch *b_B0_etaP_eta_VtxProdCov; //!
TBranch *b_B0_etaP_pi0_X; //!
TBranch *b_B0_etaP_pi0_ErrX; //!
TBranch *b_B0_etaP_pi0_Y; //!
TBranch *b_B0_etaP_pi0_ErrY; //!
TBranch *b_B0_etaP_pi0_Z; //!
TBranch *b_B0_etaP_pi0_ErrZ; //!
TBranch *b_B0_etaP_pi0_Rho; //!
TBranch *b_B0_etaP_pi0_VtxPvalue; //!
TBranch *b_B0_etaP_pi0_VtxProd; //!
TBranch *b_B0_etaP_pi0_VtxProdCov; //!
TBranch *b_B0_etaP_pi1_X; //!
TBranch *b_B0_etaP_pi1_ErrX; //!
TBranch *b_B0_etaP_pi1_Y; //!
TBranch *b_B0_etaP_pi1_ErrY; //!
TBranch *b_B0_etaP_pi1_Z; //!
TBranch *b_B0_etaP_pi1_ErrZ; //!
TBranch *b_B0_etaP_pi1_Rho; //!
TBranch *b_B0_etaP_pi1_VtxPvalue; //!
TBranch *b_B0_etaP_pi1_VtxProd; //!
TBranch *b_B0_etaP_pi1_VtxProdCov; //!
TBranch *b_B0_K_S0_X; //!
TBranch *b_B0_K_S0_ErrX; //!
TBranch *b_B0_K_S0_Y; //!
TBranch *b_B0_K_S0_ErrY; //!
TBranch *b_B0_K_S0_Z; //!
TBranch *b_B0_K_S0_ErrZ; //!
TBranch *b_B0_K_S0_Rho; //!
TBranch *b_B0_K_S0_VtxPvalue; //!
TBranch *b_B0_K_S0_VtxProd; //!
TBranch *b_B0_K_S0_VtxProdCov; //!
TBranch *b_B0_TruthX; //!
TBranch *b_B0_TruthY; //!
TBranch *b_B0_TruthZ; //!
TBranch *b_B0_TruthRho; //!
TBranch *b_B0_TruthVtxProd; //!
TBranch *b_B0_etaP_TruthX; //!
TBranch *b_B0_etaP_TruthY; //!
TBranch *b_B0_etaP_TruthZ; //!
TBranch *b_B0_etaP_TruthRho; //!
TBranch *b_B0_etaP_TruthVtxProd; //!
TBranch *b_B0_etaP_eta_TruthX; //!
TBranch *b_B0_etaP_eta_TruthY; //!
TBranch *b_B0_etaP_eta_TruthZ; //!
TBranch *b_B0_etaP_eta_TruthRho; //!
TBranch *b_B0_etaP_eta_TruthVtxProd; //!
TBranch *b_B0_etaP_pi0_TruthX; //!
TBranch *b_B0_etaP_pi0_TruthY; //!
TBranch *b_B0_etaP_pi0_TruthZ; //!
TBranch *b_B0_etaP_pi0_TruthRho; //!
TBranch *b_B0_etaP_pi0_TruthVtxProd; //!
TBranch *b_B0_etaP_pi1_TruthX; //!
TBranch *b_B0_etaP_pi1_TruthY; //!
TBranch *b_B0_etaP_pi1_TruthZ; //!
TBranch *b_B0_etaP_pi1_TruthRho; //!
TBranch *b_B0_etaP_pi1_TruthVtxProd; //!
TBranch *b_B0_K_S0_TruthX; //!
TBranch *b_B0_K_S0_TruthY; //!
TBranch *b_B0_K_S0_TruthZ; //!
TBranch *b_B0_K_S0_TruthRho; //!
TBranch *b_B0_K_S0_TruthVtxProd; //!
TBranch *b_B0_TagVx; //!
TBranch *b_B0_TagVy; //!
TBranch *b_B0_TagVz; //!
TBranch *b_B0_TagVex; //!
TBranch *b_B0_TagVey; //!
TBranch *b_B0_TagVez; //!
TBranch *b_B0_TagVPvalue; //!
TBranch *b_B0_TruthTagVx; //!
TBranch *b_B0_TruthTagVy; //!
TBranch *b_B0_TruthTagVz; //!
TBranch *b_B0_DeltaT; //!
TBranch *b_B0_mcTagPDG; //!
TBranch *b_B0_TruthDeltaT; //!
TBranch *b_B0_ThrustB; //!
TBranch *b_B0_ThrustO; //!
TBranch *b_B0_CosTBTO; //!
TBranch *b_B0_CosTBz; //!
TBranch *b_B0_R2; //!
TBranch *b_B0_cc1; //!
TBranch *b_B0_cc2; //!
TBranch *b_B0_cc3; //!
TBranch *b_B0_cc4; //!
TBranch *b_B0_cc5; //!
TBranch *b_B0_cc6; //!
TBranch *b_B0_cc7; //!
TBranch *b_B0_cc8; //!
TBranch *b_B0_cc9; //!
TBranch *b_B0_mm2; //!
TBranch *b_B0_et; //!
TBranch *b_B0_hso00; //!
TBranch *b_B0_hso01; //!
TBranch *b_B0_hso02; //!
TBranch *b_B0_hso03; //!
TBranch *b_B0_hso04; //!
TBranch *b_B0_hso10; //!
TBranch *b_B0_hso12; //!
TBranch *b_B0_hso14; //!
TBranch *b_B0_hso20; //!
TBranch *b_B0_hso22; //!
TBranch *b_B0_hso24; //!
TBranch *b_B0_hoo0; //!
TBranch *b_B0_hoo1; //!
TBranch *b_B0_hoo2; //!
TBranch *b_B0_hoo3; //!
TBranch *b_B0_hoo4; //!
TBranch *b_B0__isSignal; //!
TBranch *b_B0_etaP__isSignal; //!
TBranch *b_B0_etaP_eta__isSignal; //!
TBranch *b_B0_K_S0__isSignal; //!
TBranch *b_B0__LPCA_Probability; //!
TBranch *b_B0__FastBDT_Probability; //!
TBranch *b_B0__transformedNetworkOutputLPCA_Probability010; //!
TBranch *b_B0__transformedNetworkOutputFastBDT_Probability0010; //!
TBranch *b_m_nCands; //!
TBranch *b_m_iCand; //!
B0_ch1(TTree *tree=0,const char* outAppendix="");
bool _skipIfSignal;
virtual ~B0_ch1();
virtual Int_t Cut(Long64_t entry);
virtual Int_t GetEntry(Long64_t entry);
virtual Long64_t LoadTree(Long64_t entry);
virtual void Init(TTree *tree);
virtual void Loop(Long64_t maxEv=0);
virtual Bool_t Notify();
virtual void Show(Long64_t entry = -1);
Long64_t selectBestCand(Long64_t jentry, Long64_t nCandsCurrent) ;
void createHisto(const TString& dir) ;
void fillHisto(const TString& dir, const TString& hname, const double& value) ;
void saveHisto(const TString& dir) ;
void fillHistos(const TString& dir) ;
private:
TFile* ofile;
const char* _what;
};
#endif
#ifdef B0_ch1_cxx
B0_ch1::B0_ch1(TTree *tree, const char* outAppendix) : fChain(0) , _skipIfSignal(false), _what(outAppendix)
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
if (tree == 0) {
TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("B0_etapr-eta-gg2pi_KS-pi+pi-_output_signal.root");
if (!f || !f->IsOpen()) {
f = new TFile("B0_etapr-eta-gg2pi_KS-pi+pi-_output_signal.root");
}
f->GetObject("B0",tree);
}
Init(tree);
ofile=new TFile(Form("Histo_ch1_%s.root",outAppendix),"RECREATE");
if (string(outAppendix)=="mixed") _skipIfSignal=true;
}
B0_ch1::~B0_ch1()
{
if (!fChain) return;
delete fChain->GetCurrentFile();
}
Int_t B0_ch1::GetEntry(Long64_t entry)
{
// Read contents of entry.
if (!fChain) return 0;
return fChain->GetEntry(entry);
}
Long64_t B0_ch1::LoadTree(Long64_t entry)
{
// Set the environment to read one entry
if (!fChain) return -5;
Long64_t centry = fChain->LoadTree(entry);
if (centry < 0) return centry;
if (fChain->GetTreeNumber() != fCurrent) {
fCurrent = fChain->GetTreeNumber();
Notify();
}
return centry;
}
void B0_ch1::Init(TTree *tree)
{
// The Init() function is called when the selector needs to initialize
// a new tree or chain. Typically here the branch addresses and branch
// pointers of the tree will be set.
// It is normally not necessary to make changes to the generated
// code, but the routine can be extended by the user if needed.
// Init() will be called many times when running on PROOF
// (once per file to be processed).
// Set branch addresses and branch pointers
if (!tree) return;
fChain = tree;
fCurrent = -1;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("exp_no", &exp_no, &b_exp_no);
fChain->SetBranchAddress("run_no", &run_no, &b_run_no);
fChain->SetBranchAddress("evt_no", &evt_no, &b_evt_no);
fChain->SetBranchAddress("B0_M", &B0_M, &b_B0_M);
fChain->SetBranchAddress("B0_ErrM", &B0_ErrM, &b_B0_ErrM);
fChain->SetBranchAddress("B0_SigM", &B0_SigM, &b_B0_SigM);
fChain->SetBranchAddress("B0_eta'_M", &B0_etaP_M, &b_B0_etaP_M);
fChain->SetBranchAddress("B0_eta'_ErrM", &B0_etaP_ErrM, &b_B0_etaP_ErrM);
fChain->SetBranchAddress("B0_eta'_SigM", &B0_etaP_SigM, &b_B0_etaP_SigM);
fChain->SetBranchAddress("B0_eta'_eta_M", &B0_etaP_eta_M, &b_B0_etaP_eta_M);
fChain->SetBranchAddress("B0_eta'_eta_ErrM", &B0_etaP_eta_ErrM, &b_B0_etaP_eta_ErrM);
fChain->SetBranchAddress("B0_eta'_eta_SigM", &B0_etaP_eta_SigM, &b_B0_etaP_eta_SigM);
fChain->SetBranchAddress("B0_K_S0_M", &B0_K_S0_M, &b_B0_K_S0_M);
fChain->SetBranchAddress("B0_K_S0_ErrM", &B0_K_S0_ErrM, &b_B0_K_S0_ErrM);
fChain->SetBranchAddress("B0_K_S0_SigM", &B0_K_S0_SigM, &b_B0_K_S0_SigM);
fChain->SetBranchAddress("B0_eta'_pi0_charge", &B0_etaP_pi0_charge, &b_B0_etaP_pi0_charge);
fChain->SetBranchAddress("B0_eta'_pi1_charge", &B0_etaP_pi1_charge, &b_B0_etaP_pi1_charge);
fChain->SetBranchAddress("B0_P", &B0_P, &b_B0_P);
fChain->SetBranchAddress("B0_P4", B0_P4, &b_B0_P4);
fChain->SetBranchAddress("B0_eta'_P", &B0_etaP_P, &b_B0_etaP_P);
fChain->SetBranchAddress("B0_eta'_P4", B0_etaP_P4, &b_B0_etaP_P4);
fChain->SetBranchAddress("B0_eta'_eta_P", &B0_etaP_eta_P, &b_B0_etaP_eta_P);
fChain->SetBranchAddress("B0_eta'_eta_P4", B0_etaP_eta_P4, &b_B0_etaP_eta_P4);
fChain->SetBranchAddress("B0_K_S0_P", &B0_K_S0_P, &b_B0_K_S0_P);
fChain->SetBranchAddress("B0_K_S0_P4", B0_K_S0_P4, &b_B0_K_S0_P4);
fChain->SetBranchAddress("B0_Pcms", &B0_Pcms, &b_B0_Pcms);
fChain->SetBranchAddress("B0_P4cms", B0_P4cms, &b_B0_P4cms);
fChain->SetBranchAddress("B0_eta'_Pcms", &B0_etaP_Pcms, &b_B0_etaP_Pcms);
fChain->SetBranchAddress("B0_eta'_P4cms", B0_etaP_P4cms, &b_B0_etaP_P4cms);
fChain->SetBranchAddress("B0_eta'_eta_Pcms", &B0_etaP_eta_Pcms, &b_B0_etaP_eta_Pcms);
fChain->SetBranchAddress("B0_eta'_eta_P4cms", B0_etaP_eta_P4cms, &b_B0_etaP_eta_P4cms);
fChain->SetBranchAddress("B0_K_S0_Pcms", &B0_K_S0_Pcms, &b_B0_K_S0_Pcms);
fChain->SetBranchAddress("B0_K_S0_P4cms", B0_K_S0_P4cms, &b_B0_K_S0_P4cms);
fChain->SetBranchAddress("B0_mcPDG", &B0_mcPDG, &b_B0_mcPDG);
fChain->SetBranchAddress("B0_mcErrors", &B0_mcErrors, &b_B0_mcErrors);
fChain->SetBranchAddress("B0_eta'_mcPDG", &B0_etaP_mcPDG, &b_B0_etaP_mcPDG);
fChain->SetBranchAddress("B0_eta'_mcErrors", &B0_etaP_mcErrors, &b_B0_etaP_mcErrors);
fChain->SetBranchAddress("B0_eta'_eta_mcPDG", &B0_etaP_eta_mcPDG, &b_B0_etaP_eta_mcPDG);
fChain->SetBranchAddress("B0_eta'_eta_mcErrors", &B0_etaP_eta_mcErrors, &b_B0_etaP_eta_mcErrors);
fChain->SetBranchAddress("B0_K_S0_mcPDG", &B0_K_S0_mcPDG, &b_B0_K_S0_mcPDG);
fChain->SetBranchAddress("B0_K_S0_mcErrors", &B0_K_S0_mcErrors, &b_B0_K_S0_mcErrors);
fChain->SetBranchAddress("B0_deltae", &B0_deltae, &b_B0_deltae);
fChain->SetBranchAddress("B0_mbc", &B0_mbc, &b_B0_mbc);
fChain->SetBranchAddress("B0_eta'_pi0_PIDk", &B0_etaP_pi0_PIDk, &b_B0_etaP_pi0_PIDk);
fChain->SetBranchAddress("B0_eta'_pi0_PIDpi", &B0_etaP_pi0_PIDpi, &b_B0_etaP_pi0_PIDpi);
fChain->SetBranchAddress("B0_eta'_pi0_PIDe", &B0_etaP_pi0_PIDe, &b_B0_etaP_pi0_PIDe);
fChain->SetBranchAddress("B0_eta'_pi0_PIDmu", &B0_etaP_pi0_PIDmu, &b_B0_etaP_pi0_PIDmu);
fChain->SetBranchAddress("B0_eta'_pi0_PIDp", &B0_etaP_pi0_PIDp, &b_B0_etaP_pi0_PIDp);
fChain->SetBranchAddress("B0_eta'_pi1_PIDk", &B0_etaP_pi1_PIDk, &b_B0_etaP_pi1_PIDk);
fChain->SetBranchAddress("B0_eta'_pi1_PIDpi", &B0_etaP_pi1_PIDpi, &b_B0_etaP_pi1_PIDpi);
fChain->SetBranchAddress("B0_eta'_pi1_PIDe", &B0_etaP_pi1_PIDe, &b_B0_etaP_pi1_PIDe);
fChain->SetBranchAddress("B0_eta'_pi1_PIDmu", &B0_etaP_pi1_PIDmu, &b_B0_etaP_pi1_PIDmu);
fChain->SetBranchAddress("B0_eta'_pi1_PIDp", &B0_etaP_pi1_PIDp, &b_B0_etaP_pi1_PIDp);
fChain->SetBranchAddress("B0_eta'_pi0_DLLPion", &B0_etaP_pi0_DLLPion, &b_B0_etaP_pi0_DLLPion);
fChain->SetBranchAddress("B0_eta'_pi0_DLLKaon", &B0_etaP_pi0_DLLKaon, &b_B0_etaP_pi0_DLLKaon);
fChain->SetBranchAddress("B0_eta'_pi0_DLLProt", &B0_etaP_pi0_DLLProt, &b_B0_etaP_pi0_DLLProt);
fChain->SetBranchAddress("B0_eta'_pi0_DLLElec", &B0_etaP_pi0_DLLElec, &b_B0_etaP_pi0_DLLElec);
fChain->SetBranchAddress("B0_eta'_pi0_DLLMuon", &B0_etaP_pi0_DLLMuon, &b_B0_etaP_pi0_DLLMuon);
fChain->SetBranchAddress("B0_eta'_pi1_DLLPion", &B0_etaP_pi1_DLLPion, &b_B0_etaP_pi1_DLLPion);
fChain->SetBranchAddress("B0_eta'_pi1_DLLKaon", &B0_etaP_pi1_DLLKaon, &b_B0_etaP_pi1_DLLKaon);
fChain->SetBranchAddress("B0_eta'_pi1_DLLProt", &B0_etaP_pi1_DLLProt, &b_B0_etaP_pi1_DLLProt);
fChain->SetBranchAddress("B0_eta'_pi1_DLLElec", &B0_etaP_pi1_DLLElec, &b_B0_etaP_pi1_DLLElec);
fChain->SetBranchAddress("B0_eta'_pi1_DLLMuon", &B0_etaP_pi1_DLLMuon, &b_B0_etaP_pi1_DLLMuon);
fChain->SetBranchAddress("B0_eta'_pi0_d0", &B0_etaP_pi0_d0, &b_B0_etaP_pi0_d0);
fChain->SetBranchAddress("B0_eta'_pi0_z0", &B0_etaP_pi0_z0, &b_B0_etaP_pi0_z0);
fChain->SetBranchAddress("B0_eta'_pi0_TrPval", &B0_etaP_pi0_TrPval, &b_B0_etaP_pi0_TrPval);
fChain->SetBranchAddress("B0_eta'_pi1_d0", &B0_etaP_pi1_d0, &b_B0_etaP_pi1_d0);
fChain->SetBranchAddress("B0_eta'_pi1_z0", &B0_etaP_pi1_z0, &b_B0_etaP_pi1_z0);
fChain->SetBranchAddress("B0_eta'_pi1_TrPval", &B0_etaP_pi1_TrPval, &b_B0_etaP_pi1_TrPval);
fChain->SetBranchAddress("B0_eta'_pi0_nCDCHits", &B0_etaP_pi0_nCDCHits, &b_B0_etaP_pi0_nCDCHits);
fChain->SetBranchAddress("B0_eta'_pi0_nSVDHits", &B0_etaP_pi0_nSVDHits, &b_B0_etaP_pi0_nSVDHits);
fChain->SetBranchAddress("B0_eta'_pi0_nPXDHits", &B0_etaP_pi0_nPXDHits, &b_B0_etaP_pi0_nPXDHits);
fChain->SetBranchAddress("B0_eta'_pi1_nCDCHits", &B0_etaP_pi1_nCDCHits, &b_B0_etaP_pi1_nCDCHits);
fChain->SetBranchAddress("B0_eta'_pi1_nSVDHits", &B0_etaP_pi1_nSVDHits, &b_B0_etaP_pi1_nSVDHits);
fChain->SetBranchAddress("B0_eta'_pi1_nPXDHits", &B0_etaP_pi1_nPXDHits, &b_B0_etaP_pi1_nPXDHits);
fChain->SetBranchAddress("B0_MC_MOTHER_ID", &B0_MC_MOTHER_ID, &b_B0_MC_MOTHER_ID);
fChain->SetBranchAddress("B0_MC_GD_MOTHER_ID", &B0_MC_GD_MOTHER_ID, &b_B0_MC_GD_MOTHER_ID);
fChain->SetBranchAddress("B0_MC_GD_GD_MOTHER_ID", &B0_MC_GD_GD_MOTHER_ID, &b_B0_MC_GD_GD_MOTHER_ID);
fChain->SetBranchAddress("B0_eta'_MC_MOTHER_ID", &B0_etaP_MC_MOTHER_ID, &b_B0_etaP_MC_MOTHER_ID);
fChain->SetBranchAddress("B0_eta'_MC_GD_MOTHER_ID", &B0_etaP_MC_GD_MOTHER_ID, &b_B0_etaP_MC_GD_MOTHER_ID);
fChain->SetBranchAddress("B0_eta'_MC_GD_GD_MOTHER_ID", &B0_etaP_MC_GD_GD_MOTHER_ID, &b_B0_etaP_MC_GD_GD_MOTHER_ID);
fChain->SetBranchAddress("B0_eta'_eta_MC_MOTHER_ID", &B0_etaP_eta_MC_MOTHER_ID, &b_B0_etaP_eta_MC_MOTHER_ID);
fChain->SetBranchAddress("B0_eta'_eta_MC_GD_MOTHER_ID", &B0_etaP_eta_MC_GD_MOTHER_ID, &b_B0_etaP_eta_MC_GD_MOTHER_ID);
fChain->SetBranchAddress("B0_eta'_eta_MC_GD_GD_MOTHER_ID", &B0_etaP_eta_MC_GD_GD_MOTHER_ID, &b_B0_etaP_eta_MC_GD_GD_MOTHER_ID);
fChain->SetBranchAddress("B0_K_S0_MC_MOTHER_ID", &B0_K_S0_MC_MOTHER_ID, &b_B0_K_S0_MC_MOTHER_ID);
fChain->SetBranchAddress("B0_K_S0_MC_GD_MOTHER_ID", &B0_K_S0_MC_GD_MOTHER_ID, &b_B0_K_S0_MC_GD_MOTHER_ID);
fChain->SetBranchAddress("B0_K_S0_MC_GD_GD_MOTHER_ID", &B0_K_S0_MC_GD_GD_MOTHER_ID, &b_B0_K_S0_MC_GD_GD_MOTHER_ID);
fChain->SetBranchAddress("B0_TruthP", &B0_TruthP, &b_B0_TruthP);
fChain->SetBranchAddress("B0_TruthP4", B0_TruthP4, &b_B0_TruthP4);
fChain->SetBranchAddress("B0_TruthM", &B0_TruthM, &b_B0_TruthM);
fChain->SetBranchAddress("B0_eta'_TruthP", &B0_etaP_TruthP, &b_B0_etaP_TruthP);
fChain->SetBranchAddress("B0_eta'_TruthP4", B0_etaP_TruthP4, &b_B0_etaP_TruthP4);
fChain->SetBranchAddress("B0_eta'_TruthM", &B0_etaP_TruthM, &b_B0_etaP_TruthM);
fChain->SetBranchAddress("B0_eta'_eta_TruthP", &B0_etaP_eta_TruthP, &b_B0_etaP_eta_TruthP);
fChain->SetBranchAddress("B0_eta'_eta_TruthP4", B0_etaP_eta_TruthP4, &b_B0_etaP_eta_TruthP4);
fChain->SetBranchAddress("B0_eta'_eta_TruthM", &B0_etaP_eta_TruthM, &b_B0_etaP_eta_TruthM);
fChain->SetBranchAddress("B0_K_S0_TruthP", &B0_K_S0_TruthP, &b_B0_K_S0_TruthP);
fChain->SetBranchAddress("B0_K_S0_TruthP4", B0_K_S0_TruthP4, &b_B0_K_S0_TruthP4);
fChain->SetBranchAddress("B0_K_S0_TruthM", &B0_K_S0_TruthM, &b_B0_K_S0_TruthM);
fChain->SetBranchAddress("B0_X", &B0_X, &b_B0_X);
fChain->SetBranchAddress("B0_ErrX", &B0_ErrX, &b_B0_ErrX);
fChain->SetBranchAddress("B0_Y", &B0_Y, &b_B0_Y);
fChain->SetBranchAddress("B0_ErrY", &B0_ErrY, &b_B0_ErrY);
fChain->SetBranchAddress("B0_Z", &B0_Z, &b_B0_Z);
fChain->SetBranchAddress("B0_ErrZ", &B0_ErrZ, &b_B0_ErrZ);
fChain->SetBranchAddress("B0_Rho", &B0_Rho, &b_B0_Rho);
fChain->SetBranchAddress("B0_VtxPvalue", &B0_VtxPvalue, &b_B0_VtxPvalue);
fChain->SetBranchAddress("B0_VtxProd", B0_VtxProd, &b_B0_VtxProd);
fChain->SetBranchAddress("B0_VtxProdCov", B0_VtxProdCov, &b_B0_VtxProdCov);
fChain->SetBranchAddress("B0_eta'_X", &B0_etaP_X, &b_B0_etaP_X);
fChain->SetBranchAddress("B0_eta'_ErrX", &B0_etaP_ErrX, &b_B0_etaP_ErrX);
fChain->SetBranchAddress("B0_eta'_Y", &B0_etaP_Y, &b_B0_etaP_Y);
fChain->SetBranchAddress("B0_eta'_ErrY", &B0_etaP_ErrY, &b_B0_etaP_ErrY);
fChain->SetBranchAddress("B0_eta'_Z", &B0_etaP_Z, &b_B0_etaP_Z);
fChain->SetBranchAddress("B0_eta'_ErrZ", &B0_etaP_ErrZ, &b_B0_etaP_ErrZ);
fChain->SetBranchAddress("B0_eta'_Rho", &B0_etaP_Rho, &b_B0_etaP_Rho);
fChain->SetBranchAddress("B0_eta'_VtxPvalue", &B0_etaP_VtxPvalue, &b_B0_etaP_VtxPvalue);
fChain->SetBranchAddress("B0_eta'_VtxProd", B0_etaP_VtxProd, &b_B0_etaP_VtxProd);
fChain->SetBranchAddress("B0_eta'_VtxProdCov", B0_etaP_VtxProdCov, &b_B0_etaP_VtxProdCov);
fChain->SetBranchAddress("B0_eta'_eta_X", &B0_etaP_eta_X, &b_B0_etaP_eta_X);
fChain->SetBranchAddress("B0_eta'_eta_ErrX", &B0_etaP_eta_ErrX, &b_B0_etaP_eta_ErrX);
fChain->SetBranchAddress("B0_eta'_eta_Y", &B0_etaP_eta_Y, &b_B0_etaP_eta_Y);
fChain->SetBranchAddress("B0_eta'_eta_ErrY", &B0_etaP_eta_ErrY, &b_B0_etaP_eta_ErrY);
fChain->SetBranchAddress("B0_eta'_eta_Z", &B0_etaP_eta_Z, &b_B0_etaP_eta_Z);
fChain->SetBranchAddress("B0_eta'_eta_ErrZ", &B0_etaP_eta_ErrZ, &b_B0_etaP_eta_ErrZ);
fChain->SetBranchAddress("B0_eta'_eta_Rho", &B0_etaP_eta_Rho, &b_B0_etaP_eta_Rho);
fChain->SetBranchAddress("B0_eta'_eta_VtxPvalue", &B0_etaP_eta_VtxPvalue, &b_B0_etaP_eta_VtxPvalue);
fChain->SetBranchAddress("B0_eta'_eta_VtxProd", B0_etaP_eta_VtxProd, &b_B0_etaP_eta_VtxProd);
fChain->SetBranchAddress("B0_eta'_eta_VtxProdCov", B0_etaP_eta_VtxProdCov, &b_B0_etaP_eta_VtxProdCov);
fChain->SetBranchAddress("B0_eta'_pi0_X", &B0_etaP_pi0_X, &b_B0_etaP_pi0_X);
fChain->SetBranchAddress("B0_eta'_pi0_ErrX", &B0_etaP_pi0_ErrX, &b_B0_etaP_pi0_ErrX);
fChain->SetBranchAddress("B0_eta'_pi0_Y", &B0_etaP_pi0_Y, &b_B0_etaP_pi0_Y);
fChain->SetBranchAddress("B0_eta'_pi0_ErrY", &B0_etaP_pi0_ErrY, &b_B0_etaP_pi0_ErrY);
fChain->SetBranchAddress("B0_eta'_pi0_Z", &B0_etaP_pi0_Z, &b_B0_etaP_pi0_Z);
fChain->SetBranchAddress("B0_eta'_pi0_ErrZ", &B0_etaP_pi0_ErrZ, &b_B0_etaP_pi0_ErrZ);
fChain->SetBranchAddress("B0_eta'_pi0_Rho", &B0_etaP_pi0_Rho, &b_B0_etaP_pi0_Rho);
fChain->SetBranchAddress("B0_eta'_pi0_VtxPvalue", &B0_etaP_pi0_VtxPvalue, &b_B0_etaP_pi0_VtxPvalue);
fChain->SetBranchAddress("B0_eta'_pi0_VtxProd", B0_etaP_pi0_VtxProd, &b_B0_etaP_pi0_VtxProd);
fChain->SetBranchAddress("B0_eta'_pi0_VtxProdCov", B0_etaP_pi0_VtxProdCov, &b_B0_etaP_pi0_VtxProdCov);
fChain->SetBranchAddress("B0_eta'_pi1_X", &B0_etaP_pi1_X, &b_B0_etaP_pi1_X);
fChain->SetBranchAddress("B0_eta'_pi1_ErrX", &B0_etaP_pi1_ErrX, &b_B0_etaP_pi1_ErrX);
fChain->SetBranchAddress("B0_eta'_pi1_Y", &B0_etaP_pi1_Y, &b_B0_etaP_pi1_Y);
fChain->SetBranchAddress("B0_eta'_pi1_ErrY", &B0_etaP_pi1_ErrY, &b_B0_etaP_pi1_ErrY);
fChain->SetBranchAddress("B0_eta'_pi1_Z", &B0_etaP_pi1_Z, &b_B0_etaP_pi1_Z);
fChain->SetBranchAddress("B0_eta'_pi1_ErrZ", &B0_etaP_pi1_ErrZ, &b_B0_etaP_pi1_ErrZ);
fChain->SetBranchAddress("B0_eta'_pi1_Rho", &B0_etaP_pi1_Rho, &b_B0_etaP_pi1_Rho);
fChain->SetBranchAddress("B0_eta'_pi1_VtxPvalue", &B0_etaP_pi1_VtxPvalue, &b_B0_etaP_pi1_VtxPvalue);
fChain->SetBranchAddress("B0_eta'_pi1_VtxProd", B0_etaP_pi1_VtxProd, &b_B0_etaP_pi1_VtxProd);
fChain->SetBranchAddress("B0_eta'_pi1_VtxProdCov", B0_etaP_pi1_VtxProdCov, &b_B0_etaP_pi1_VtxProdCov);
fChain->SetBranchAddress("B0_K_S0_X", &B0_K_S0_X, &b_B0_K_S0_X);
fChain->SetBranchAddress("B0_K_S0_ErrX", &B0_K_S0_ErrX, &b_B0_K_S0_ErrX);
fChain->SetBranchAddress("B0_K_S0_Y", &B0_K_S0_Y, &b_B0_K_S0_Y);
fChain->SetBranchAddress("B0_K_S0_ErrY", &B0_K_S0_ErrY, &b_B0_K_S0_ErrY);
fChain->SetBranchAddress("B0_K_S0_Z", &B0_K_S0_Z, &b_B0_K_S0_Z);
fChain->SetBranchAddress("B0_K_S0_ErrZ", &B0_K_S0_ErrZ, &b_B0_K_S0_ErrZ);
fChain->SetBranchAddress("B0_K_S0_Rho", &B0_K_S0_Rho, &b_B0_K_S0_Rho);
fChain->SetBranchAddress("B0_K_S0_VtxPvalue", &B0_K_S0_VtxPvalue, &b_B0_K_S0_VtxPvalue);
fChain->SetBranchAddress("B0_K_S0_VtxProd", B0_K_S0_VtxProd, &b_B0_K_S0_VtxProd);
fChain->SetBranchAddress("B0_K_S0_VtxProdCov", B0_K_S0_VtxProdCov, &b_B0_K_S0_VtxProdCov);
fChain->SetBranchAddress("B0_TruthX", &B0_TruthX, &b_B0_TruthX);
fChain->SetBranchAddress("B0_TruthY", &B0_TruthY, &b_B0_TruthY);
fChain->SetBranchAddress("B0_TruthZ", &B0_TruthZ, &b_B0_TruthZ);
fChain->SetBranchAddress("B0_TruthRho", &B0_TruthRho, &b_B0_TruthRho);
fChain->SetBranchAddress("B0_TruthVtxProd", B0_TruthVtxProd, &b_B0_TruthVtxProd);
fChain->SetBranchAddress("B0_eta'_TruthX", &B0_etaP_TruthX, &b_B0_etaP_TruthX);
fChain->SetBranchAddress("B0_eta'_TruthY", &B0_etaP_TruthY, &b_B0_etaP_TruthY);
fChain->SetBranchAddress("B0_eta'_TruthZ", &B0_etaP_TruthZ, &b_B0_etaP_TruthZ);
fChain->SetBranchAddress("B0_eta'_TruthRho", &B0_etaP_TruthRho, &b_B0_etaP_TruthRho);
fChain->SetBranchAddress("B0_eta'_TruthVtxProd", B0_etaP_TruthVtxProd, &b_B0_etaP_TruthVtxProd);
fChain->SetBranchAddress("B0_eta'_eta_TruthX", &B0_etaP_eta_TruthX, &b_B0_etaP_eta_TruthX);
fChain->SetBranchAddress("B0_eta'_eta_TruthY", &B0_etaP_eta_TruthY, &b_B0_etaP_eta_TruthY);
fChain->SetBranchAddress("B0_eta'_eta_TruthZ", &B0_etaP_eta_TruthZ, &b_B0_etaP_eta_TruthZ);
fChain->SetBranchAddress("B0_eta'_eta_TruthRho", &B0_etaP_eta_TruthRho, &b_B0_etaP_eta_TruthRho);
fChain->SetBranchAddress("B0_eta'_eta_TruthVtxProd", B0_etaP_eta_TruthVtxProd, &b_B0_etaP_eta_TruthVtxProd);
fChain->SetBranchAddress("B0_eta'_pi0_TruthX", &B0_etaP_pi0_TruthX, &b_B0_etaP_pi0_TruthX);
fChain->SetBranchAddress("B0_eta'_pi0_TruthY", &B0_etaP_pi0_TruthY, &b_B0_etaP_pi0_TruthY);
fChain->SetBranchAddress("B0_eta'_pi0_TruthZ", &B0_etaP_pi0_TruthZ, &b_B0_etaP_pi0_TruthZ);
fChain->SetBranchAddress("B0_eta'_pi0_TruthRho", &B0_etaP_pi0_TruthRho, &b_B0_etaP_pi0_TruthRho);
fChain->SetBranchAddress("B0_eta'_pi0_TruthVtxProd", B0_etaP_pi0_TruthVtxProd, &b_B0_etaP_pi0_TruthVtxProd);
fChain->SetBranchAddress("B0_eta'_pi1_TruthX", &B0_etaP_pi1_TruthX, &b_B0_etaP_pi1_TruthX);
fChain->SetBranchAddress("B0_eta'_pi1_TruthY", &B0_etaP_pi1_TruthY, &b_B0_etaP_pi1_TruthY);
fChain->SetBranchAddress("B0_eta'_pi1_TruthZ", &B0_etaP_pi1_TruthZ, &b_B0_etaP_pi1_TruthZ);
fChain->SetBranchAddress("B0_eta'_pi1_TruthRho", &B0_etaP_pi1_TruthRho, &b_B0_etaP_pi1_TruthRho);
fChain->SetBranchAddress("B0_eta'_pi1_TruthVtxProd", B0_etaP_pi1_TruthVtxProd, &b_B0_etaP_pi1_TruthVtxProd);
fChain->SetBranchAddress("B0_K_S0_TruthX", &B0_K_S0_TruthX, &b_B0_K_S0_TruthX);
fChain->SetBranchAddress("B0_K_S0_TruthY", &B0_K_S0_TruthY, &b_B0_K_S0_TruthY);
fChain->SetBranchAddress("B0_K_S0_TruthZ", &B0_K_S0_TruthZ, &b_B0_K_S0_TruthZ);
fChain->SetBranchAddress("B0_K_S0_TruthRho", &B0_K_S0_TruthRho, &b_B0_K_S0_TruthRho);
fChain->SetBranchAddress("B0_K_S0_TruthVtxProd", B0_K_S0_TruthVtxProd, &b_B0_K_S0_TruthVtxProd);
fChain->SetBranchAddress("B0_TagVx", &B0_TagVx, &b_B0_TagVx);
fChain->SetBranchAddress("B0_TagVy", &B0_TagVy, &b_B0_TagVy);
fChain->SetBranchAddress("B0_TagVz", &B0_TagVz, &b_B0_TagVz);
fChain->SetBranchAddress("B0_TagVex", &B0_TagVex, &b_B0_TagVex);
fChain->SetBranchAddress("B0_TagVey", &B0_TagVey, &b_B0_TagVey);
fChain->SetBranchAddress("B0_TagVez", &B0_TagVez, &b_B0_TagVez);
fChain->SetBranchAddress("B0_TagVPvalue", &B0_TagVPvalue, &b_B0_TagVPvalue);
fChain->SetBranchAddress("B0_TruthTagVx", &B0_TruthTagVx, &b_B0_TruthTagVx);
fChain->SetBranchAddress("B0_TruthTagVy", &B0_TruthTagVy, &b_B0_TruthTagVy);
fChain->SetBranchAddress("B0_TruthTagVz", &B0_TruthTagVz, &b_B0_TruthTagVz);
fChain->SetBranchAddress("B0_DeltaT", &B0_DeltaT, &b_B0_DeltaT);
fChain->SetBranchAddress("B0_mcTagPDG", &B0_mcTagPDG, &b_B0_mcTagPDG);
fChain->SetBranchAddress("B0_TruthDeltaT", &B0_TruthDeltaT, &b_B0_TruthDeltaT);
fChain->SetBranchAddress("B0_ThrustB", &B0_ThrustB, &b_B0_ThrustB);
fChain->SetBranchAddress("B0_ThrustO", &B0_ThrustO, &b_B0_ThrustO);
fChain->SetBranchAddress("B0_CosTBTO", &B0_CosTBTO, &b_B0_CosTBTO);
fChain->SetBranchAddress("B0_CosTBz", &B0_CosTBz, &b_B0_CosTBz);
fChain->SetBranchAddress("B0_R2", &B0_R2, &b_B0_R2);
fChain->SetBranchAddress("B0_cc1", &B0_cc1, &b_B0_cc1);
fChain->SetBranchAddress("B0_cc2", &B0_cc2, &b_B0_cc2);
fChain->SetBranchAddress("B0_cc3", &B0_cc3, &b_B0_cc3);
fChain->SetBranchAddress("B0_cc4", &B0_cc4, &b_B0_cc4);
fChain->SetBranchAddress("B0_cc5", &B0_cc5, &b_B0_cc5);
fChain->SetBranchAddress("B0_cc6", &B0_cc6, &b_B0_cc6);
fChain->SetBranchAddress("B0_cc7", &B0_cc7, &b_B0_cc7);
fChain->SetBranchAddress("B0_cc8", &B0_cc8, &b_B0_cc8);
fChain->SetBranchAddress("B0_cc9", &B0_cc9, &b_B0_cc9);
fChain->SetBranchAddress("B0_mm2", &B0_mm2, &b_B0_mm2);
fChain->SetBranchAddress("B0_et", &B0_et, &b_B0_et);
fChain->SetBranchAddress("B0_hso00", &B0_hso00, &b_B0_hso00);
fChain->SetBranchAddress("B0_hso01", &B0_hso01, &b_B0_hso01);
fChain->SetBranchAddress("B0_hso02", &B0_hso02, &b_B0_hso02);
fChain->SetBranchAddress("B0_hso03", &B0_hso03, &b_B0_hso03);
fChain->SetBranchAddress("B0_hso04", &B0_hso04, &b_B0_hso04);
fChain->SetBranchAddress("B0_hso10", &B0_hso10, &b_B0_hso10);
fChain->SetBranchAddress("B0_hso12", &B0_hso12, &b_B0_hso12);
fChain->SetBranchAddress("B0_hso14", &B0_hso14, &b_B0_hso14);
fChain->SetBranchAddress("B0_hso20", &B0_hso20, &b_B0_hso20);
fChain->SetBranchAddress("B0_hso22", &B0_hso22, &b_B0_hso22);
fChain->SetBranchAddress("B0_hso24", &B0_hso24, &b_B0_hso24);
fChain->SetBranchAddress("B0_hoo0", &B0_hoo0, &b_B0_hoo0);
fChain->SetBranchAddress("B0_hoo1", &B0_hoo1, &b_B0_hoo1);
fChain->SetBranchAddress("B0_hoo2", &B0_hoo2, &b_B0_hoo2);
fChain->SetBranchAddress("B0_hoo3", &B0_hoo3, &b_B0_hoo3);
fChain->SetBranchAddress("B0_hoo4", &B0_hoo4, &b_B0_hoo4);
fChain->SetBranchAddress("B0__isSignal", &B0__isSignal, &b_B0__isSignal);
fChain->SetBranchAddress("B0_eta'__isSignal", &B0_etaP__isSignal, &b_B0_etaP__isSignal);
fChain->SetBranchAddress("B0_eta'_eta__isSignal", &B0_etaP_eta__isSignal, &b_B0_etaP_eta__isSignal);
fChain->SetBranchAddress("B0_K_S0__isSignal", &B0_K_S0__isSignal, &b_B0_K_S0__isSignal);
fChain->SetBranchAddress("B0__LPCA_Probability", &B0__LPCA_Probability, &b_B0__LPCA_Probability);
fChain->SetBranchAddress("B0__FastBDT_Probability", &B0__FastBDT_Probability, &b_B0__FastBDT_Probability);
fChain->SetBranchAddress("B0__transformedNetworkOutputLPCA_Probability010", &B0__transformedNetworkOutputLPCA_Probability010, &b_B0__transformedNetworkOutputLPCA_Probability010);
fChain->SetBranchAddress("B0__transformedNetworkOutputFastBDT_Probability0010", &B0__transformedNetworkOutputFastBDT_Probability0010, &b_B0__transformedNetworkOutputFastBDT_Probability0010);
fChain->SetBranchAddress("nCands", &nCands, &b_m_nCands);
fChain->SetBranchAddress("iCand", &iCand, &b_m_iCand);
Notify();
}
Bool_t B0_ch1::Notify()
{
// The Notify() function is called when a new file is opened. This
// can be either for a new TTree in a TChain or when when a new TTree
// is started when using PROOF. It is normally not necessary to make changes
// to the generated code, but the routine can be extended by the
// user if needed. The return value is currently not used.
return kTRUE;
}
void B0_ch1::Show(Long64_t entry)
{
// Print contents of entry.
// If entry is not specified, print current entry
if (!fChain) return;
fChain->Show(entry);
}
#endif // #ifdef B0_ch1_cxx
| [
"[email protected]"
] | |
11e5a1e1eb5f9d55fdbb03289c40ab7924a7c219 | 10525d5ecf44f3d4fd06a2f32da08c96ea017458 | /SlimeGame/Camera.hpp | 4329cd04b57bf2b7d249f60add50960b210e14a4 | [] | no_license | poul250/SlimeGame | d38e13e66e9a2e92e81ca4342daa5f0c03af3bae | b20a22dda8d44d55a517d9e153a29f5a13526962 | refs/heads/master | 2020-03-25T08:49:59.930700 | 2019-03-25T10:32:38 | 2019-03-25T10:32:38 | 143,633,824 | 0 | 1 | null | 2019-03-25T10:32:39 | 2018-08-05T17:29:43 | C++ | UTF-8 | C++ | false | false | 2,146 | hpp | #pragma once
#include <memory>
#include <cmath>
#include <SFML/Graphics.hpp>
#include "Assets.hpp"
#include "Entity.hpp"
using namespace sf;
class Camera : public View {
public:
Camera(FloatRect rect, RenderTarget * target = nullptr, int scale = 1);
Camera(RenderTarget * target = nullptr, int scale = 1);
virtual ~Camera();
void update();
void followEntity(Entity * entity);
void stopMove();
void defaultView();
void floatCamera(bool floatingCamera);
void moveTo(Entity * entity);
void setOffset(float x, float y);
void setOffset(Vector2f off);
void setTarget(RenderTarget * target);
void setScale(int scale);
//Getters
Vector2f getCoords() const;
float getWidth() const;
float getHeight() const;
private:
typedef void(Camera::*ShiftFunc)();
typedef void(Camera::*ActionFunc)();
typedef Vector2f(Camera::*CenterFunc)();
ActionFunc actionFunc;
CenterFunc centerFunc;
ShiftFunc shiftFunc;
//Shift funcs
void None();
void FollowEntity();
//Action funcs
void ExpMoveToEntity();
void Centering();
//Center funcs
Vector2f CenterOnEntity();
Vector2f FloatingCamera();
Vector2f MapCenter();
//Entity for centering
Entity * entity;
//Target, where change view
RenderTarget * target;
//Target scale
int scale;
//Center position
Vector2f xy;
// Size
float width, height;
//Shift from center
Vector2f shift = Vector2f(0.f, 0.f);
//Const Offset of cam
Vector2f off = Vector2f(0.f, 0.f);
//Variables for some functions
//ExpMoveToEntity
int count;
const int updsForMove = 60;
float upds = 0;
//FollowEntity
int moveDir = 0;
const float maxShift = 20;
const float shiftCoef = 0.90f;
//FloatingCamera
const int MAX_DIST = 10;
const float MAX_SPEED = 0.1;
const int MAX_EXISTING_TIME = 300;
int existingTime = 0;
Vector2f accel = Vector2f(0.f, 0.f);
Vector2f pointSpeed = Vector2f(0.f, 0.f);
Vector2f hiddenPoint = Vector2f(0.f, 0.f);
Vector2f currPoint = Vector2f(0.f, 0.f);
};
| [
"poul2@DESKTOP-9IP6EFH"
] | poul2@DESKTOP-9IP6EFH |
da92da826c6b13a758d072d45b77751577b0f9ef | 3597bc0f8e6b3a1d289eb0b71cfdfe420918ff45 | /revision_3/src/src/player/Player.cpp | efb81080ab643c4527009c764f20c3601d4c23e1 | [] | no_license | Techno-coder/UndertaleCPPLibrary | 61094bdc5a4139c4bdcde5e3792ad63e8f3b3227 | e09458d5b4f1f281a34d6140294d70818a270cca | refs/heads/master | 2021-06-18T00:24:36.813768 | 2017-05-24T07:12:11 | 2017-05-24T07:12:11 | 84,790,996 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 543 | cpp | #include "Player.h"
ug::Player::PlayerStatistics& ug::Player::getStatistics() {
return playerStatistics;
}
ug::Inventory &ug::Player::getInventory() {
return playerInventory;
}
ug::Player::Player() {
Item testItem([](Player &player, State &state) {
printf("POWOWOWOAODSO");
player.getStatistics().health.setValue(player.getStatistics().health.getValue() + 10);
});
playerInventory.addItem(testItem.clone());
playerInventory.addItem(testItem.clone());
playerInventory.addItem(testItem.clone());
}
| [
"[email protected]"
] | |
7b8b9e4407b4cae5b87fd49d53ccd4dba2d6ea6c | 4a5c9980f8528d144db077ed4a9dd383c7300d86 | /C,C++/examples/pointers/stdobjpolicy.hpp | 30d7bfbeaa5d51133faf5ec87178e31cb52212eb | [
"LicenseRef-scancode-other-permissive"
] | permissive | npatel007/Computer-Science-Notes | fd4f14f8b407764f373d833d947ee5d5280f4c18 | 772ea11c8c8f800b612291f23584a7258a73579c | refs/heads/master | 2023-03-10T06:26:52.295186 | 2020-03-06T09:03:17 | 2020-03-06T09:03:17 | 249,230,561 | 1 | 1 | null | 2020-03-22T17:00:34 | 2020-03-22T17:00:34 | null | UTF-8 | C++ | false | false | 630 | hpp | /* The following code example is taken from the book
* "C++ Templates - The Complete Guide"
* by David Vandevoorde and Nicolai M. Josuttis, Addison-Wesley, 2002
*
* (C) Copyright David Vandevoorde and Nicolai M. Josuttis 2002.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*/
class StandardObjectPolicy {
public:
template<typename T> void dispose (T* object) {
delete object;
}
};
| [
"[email protected]"
] | |
bf3aa18a8c1f69d01abe7b6dc501f0fa488eaac6 | 17b16a998ea8c493df9942ad8f01efa150d5b6b7 | /DataAcquisition/DataProcess/DataProcess.h | d28c3ca0f1a7a08a3e541997d1e40e7b860d7d76 | [] | no_license | nhs635/Doulos_CARS | 30a823f36da1f64d1234c2de0087b3e5464879cf | 394809c10bad7ca31b00db0013550435b0d93122 | refs/heads/master | 2023-01-07T07:10:43.145247 | 2020-11-06T00:53:25 | 2020-11-06T00:53:25 | 310,324,672 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,227 | h | #ifndef FLIM_PROCESS_H
#define FLIM_PROCESS_H
#include <Doulos/Configuration.h>
#ifndef FLIM_SPLINE_FACTOR
#error("FLIM_SPLINE_FACTOR is not defined for FLIM processing.");
#endif
#ifndef INTENSITY_THRES
#error("INTENSITY_THRES is not defined for FLIM processing.");
#endif
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <QString>
#include <QFile>
#include <ipps.h>
#include <ippi.h>
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <mkl_df.h>
#include <Common/array.h>
#include <Common/callback.h>
using namespace np;
struct FLIM_PARAMS
{
float bg;
float samp_intv = 1.0f;
float width_factor = 2.0f;
int ch_start_ind[5] = { 0, };
};
struct OPERATOR
{
public:
OPERATOR() : scoeff(nullptr), nx(-1), initiated(false)
{
}
~OPERATOR()
{
if (scoeff) delete[] scoeff;
}
void operator() (const Uint16Array2 &src, const FLIM_PARAMS &pParams)
{
// 0. Initialize
int _nx = src.size(0); //pParams.ch_start_ind[4] - pParams.ch_start_ind[0];
if ((nx != _nx) || !initiated)
initialize(pParams, _nx, FLIM_SPLINE_FACTOR, src.size(1));
// 1. Convert data
int offset;
ippsConvert_16u32f(src.raw_ptr(), crop_src.raw_ptr(), crop_src.length());
/// 2. Determine whether saturated
///ippsThreshold_32f(crop_src.raw_ptr(), sat_src.raw_ptr(), sat_src.length(), 65531, ippCmpLess);
///ippsSubC_32f_I(65531, sat_src.raw_ptr(), sat_src.length());
///int roi_len = (int)round(pulse_roi_length / ActualFactor);
///for (int i = 1; i < 4; i++)
///{
/// for (int j = 0; j < ny; j++)
/// {
/// saturated(j, i) = 0;
/// offset = pParams.ch_start_ind[i] - pParams.ch_start_ind[0];
/// ippsSum_32f(&sat_src(offset, j), roi_len, &saturated(j, i), ippAlgHintFast);
/// }
///}
// 3. BG subtraction
ippsSubC_32f_I(pParams.bg, crop_src.raw_ptr(), crop_src.length());
// 4. Window-wise integral to obtain intensity data
memcpy(crop_src0.raw_ptr(), crop_src.raw_ptr(), sizeof(float) * crop_src0.length());
tbb::parallel_for(tbb::blocked_range<size_t>(0, (size_t)ny),
[&](const tbb::blocked_range<size_t>& r) {
for (size_t i = r.begin(); i != r.end(); ++i)
{
///DFTaskPtr task1 = nullptr;
///dfsNewTask1D(&task1, nx, x, DF_UNIFORM_PARTITION, 1, &crop_src(0, (int)i), DF_MATRIX_STORAGE_ROWS);
///dfsEditPPSpline1D(task1, DF_PP_CUBIC, DF_PP_NATURAL, DF_BC_NOT_A_KNOT, 0, DF_NO_IC, 0, scoeff + (int)i * (nx - 1) * DF_PP_CUBIC, DF_NO_HINT);
///dfsConstruct1D(task1, DF_PP_SPLINE, DF_METHOD_STD);
///dfsInterpolate1D(task1, DF_INTERP, DF_METHOD_PP, nsite, x, DF_UNIFORM_PARTITION, 1, &dorder,
/// DF_NO_APRIORI_INFO, &ext_src(0, (int)i), DF_MATRIX_STORAGE_ROWS, NULL);
///dfDeleteTask(&task1);
for (int j = 0; j < 4; j++)
{
intensity((int)i, j) = 0;
if (saturated((int)i, j) < 1)
{
offset = ch_start_ind1[j] - ch_start_ind1[0];
ippsSum_32f(&crop_src(ch_start_ind1[j], (int)i), ch_start_ind1[j + 1] - ch_start_ind1[j], &intensity((int)i, j), ippAlgHintFast);
}
}
}
});
ippsDivC_32f_I(65532.0f, intensity.raw_ptr(), intensity.length());
}
void initialize(const FLIM_PARAMS& pParams, int _nx, int _upSampleFactor, int _alines)
{
/* Parameters */
nx = _nx; ny = _alines;
upSampleFactor = _upSampleFactor;
nsite = nx * upSampleFactor;
ActualFactor = (float)(nx * upSampleFactor - 1) / (float)(nx - 1);
x[0] = 0.0f; x[1] = (float)nx - 1.0f;
srcSize = { (int)nx, (int)ny };
dorder = 1;
/* Find pulse roi length for mean delay calculation */
for (int i = 0; i < 5; i++)
ch_start_ind1[i] = (int)round((float)pParams.ch_start_ind[i] * ActualFactor);
int diff_ind[4];
for (int i = 0; i < 4; i++)
diff_ind[i] = ch_start_ind1[i + 1] - ch_start_ind1[i];
ippsMin_32s(diff_ind, 4, &pulse_roi_length);
// char msg[256];
// sprintf(msg, "Initializing... %d", pulse_roi_length);
// SendStatusMessage(msg);
/* Array of spline coefficients */
if (scoeff) { delete[] scoeff; scoeff = nullptr; }
scoeff = new float[ny * (nx - 1) * DF_PP_CUBIC];
/* data buffer allocation */
crop_src = std::move(FloatArray2((int)nx, (int)ny));
crop_src0 = std::move(FloatArray2((int)nx, (int)ny));
sat_src = std::move(FloatArray2((int)nx, (int)ny));
ext_src = std::move(FloatArray2((int)nsite, (int)ny));
saturated = std::move(FloatArray2((int)ny, 4));
memset(saturated, 0, sizeof(float) * saturated.length());
/* intensity */
intensity = std::move(FloatArray2((int)ny, 4));
initiated = true;
}
private:
IppiSize srcSize;
float* scoeff;
float x[2];
MKL_INT dorder;
public:
bool initiated;
MKL_INT nx, ny; // original data length, dimension
MKL_INT nsite; // interpolated data length
int ch_start_ind1[5];
int upSampleFactor;
Ipp32f ActualFactor;
int pulse_roi_length;
FloatArray2 saturated;
FloatArray2 crop_src;
FloatArray2 crop_src0;
FloatArray2 sat_src;
FloatArray2 ext_src;
FloatArray2 intensity;
callback<const char*> SendStatusMessage;
};
class DataProcess
{
// Methods
public: // Constructor & Destructor
explicit DataProcess();
~DataProcess();
private: // Not to call copy constrcutor and copy assignment operator
DataProcess(const DataProcess&);
DataProcess& operator=(const DataProcess&);
public:
// Generate fluorescence intensity & lifetime
void operator()(FloatArray2& intensity, Uint16Array2& pulse);
// For FLIM parameters setting
void setParameters(Configuration* pConfig);
// Variables
public:
FLIM_PARAMS _params;
OPERATOR _operator; // resize objects
public:
// Callbacks
callback<const char*> SendStatusMessage;
};
#endif
| [
"[email protected]"
] | |
a55d401ed128e81a0242148471bc92de2821aa9c | 33496338a35c4f76eadec13dc56c7831b1896113 | /Plugins/GamsLibrary/Source/ThirdParty/Eigen/src/Core/ProductEvaluators.h | 792b1811c6c77c3ace74add559f86ba8edd8fa21 | [
"GPL-3.0-only",
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LGPL-2.1-only",
"MPL-2.0",
"LGPL-2.1-or-later",
"Minpack",
"BSD-2-Clause"
] | permissive | jredmondson/GamsPlugins | 1ce0c2301cf84b6398ae1a2a6cdef9a4d0c1992c | d133f86c263997a55f11b3b3d3344faeee60d726 | refs/heads/master | 2021-07-08T23:40:48.423530 | 2020-10-01T05:31:26 | 2020-10-01T05:31:26 | 196,622,579 | 3 | 1 | BSD-2-Clause | 2020-03-17T04:23:21 | 2019-07-12T17:54:49 | C++ | UTF-8 | C++ | false | false | 53,277 | h | // This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2006-2008 Benoit Jacob <[email protected]>
// Copyright (C) 2008-2010 Gael Guennebaud <[email protected]>
// Copyright (C) 2011 Jitse Niesen <[email protected]>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_PRODUCTEVALUATORS_H
#define EIGEN_PRODUCTEVALUATORS_H
namespace Eigen {
namespace internal {
/** \internal
* Evaluator of a product expression.
* Since products require special treatments to handle all possible cases,
* we simply defer the evaluation logic to a product_evaluator class
* which offers more partial specialization possibilities.
*
* \sa class product_evaluator
*/
template<typename Lhs, typename Rhs, int Options>
struct evaluator<Product<Lhs, Rhs, Options> >
: public product_evaluator<Product<Lhs, Rhs, Options> >
{
typedef Product<Lhs, Rhs, Options> XprType;
typedef product_evaluator<XprType> Base;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) : Base(xpr) {}
};
// Catch "scalar * ( A * B )" and transform it to "(A*scalar) * B"
// TODO we should apply that rule only if that's really helpful
template<typename Lhs, typename Rhs, typename Scalar1, typename Scalar2, typename Plain1>
struct evaluator_assume_aliasing<CwiseBinaryOp<internal::scalar_product_op<Scalar1,Scalar2>,
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
const Product<Lhs, Rhs, DefaultProduct> > >
{
static const bool value = true;
};
template<typename Lhs, typename Rhs, typename Scalar1, typename Scalar2, typename Plain1>
struct evaluator<CwiseBinaryOp<internal::scalar_product_op<Scalar1,Scalar2>,
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
const Product<Lhs, Rhs, DefaultProduct> > >
: public evaluator<Product<EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar1,Lhs,product), Rhs, DefaultProduct> >
{
typedef CwiseBinaryOp<internal::scalar_product_op<Scalar1,Scalar2>,
const CwiseNullaryOp<internal::scalar_constant_op<Scalar1>, Plain1>,
const Product<Lhs, Rhs, DefaultProduct> > XprType;
typedef evaluator<Product<EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar1,Lhs,product), Rhs, DefaultProduct> > Base;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr)
: Base(xpr.lhs().functor().m_other * xpr.rhs().lhs() * xpr.rhs().rhs())
{}
};
template<typename Lhs, typename Rhs, int DiagIndex>
struct evaluator<Diagonal<const Product<Lhs, Rhs, DefaultProduct>, DiagIndex> >
: public evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex> >
{
typedef Diagonal<const Product<Lhs, Rhs, DefaultProduct>, DiagIndex> XprType;
typedef evaluator<Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex> > Base;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr)
: Base(Diagonal<const Product<Lhs, Rhs, LazyProduct>, DiagIndex>(
Product<Lhs, Rhs, LazyProduct>(xpr.nestedExpression().lhs(), xpr.nestedExpression().rhs()),
xpr.index() ))
{}
};
// Helper class to perform a matrix product with the destination at hand.
// Depending on the sizes of the factors, there are different evaluation strategies
// as controlled by internal::product_type.
template< typename Lhs, typename Rhs,
typename LhsShape = typename evaluator_traits<Lhs>::Shape,
typename RhsShape = typename evaluator_traits<Rhs>::Shape,
int ProductType = internal::product_type<Lhs,Rhs>::value>
struct generic_product_impl;
template<typename Lhs, typename Rhs>
struct evaluator_assume_aliasing<Product<Lhs, Rhs, DefaultProduct> > {
static const bool value = true;
};
// This is the default evaluator implementation for products:
// It creates a temporary and call generic_product_impl
template<typename Lhs, typename Rhs, int Options, int ProductTag, typename LhsShape, typename RhsShape>
struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, LhsShape, RhsShape>
: public evaluator<typename Product<Lhs, Rhs, Options>::PlainObject>
{
typedef Product<Lhs, Rhs, Options> XprType;
typedef typename XprType::PlainObject PlainObject;
typedef evaluator<PlainObject> Base;
enum {
Flags = Base::Flags | EvalBeforeNestingBit
};
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit product_evaluator(const XprType& xpr)
: m_result(xpr.rows(), xpr.cols())
{
::new (static_cast<Base*>(this)) Base(m_result);
// FIXME shall we handle nested_eval here?,
// if so, then we must take care at removing the call to nested_eval in the specializations (e.g., in permutation_matrix_product, transposition_matrix_product, etc.)
// typedef typename internal::nested_eval<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
// typedef typename internal::nested_eval<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
// typedef typename internal::remove_all<LhsNested>::type LhsNestedCleaned;
// typedef typename internal::remove_all<RhsNested>::type RhsNestedCleaned;
//
// const LhsNested lhs(xpr.lhs());
// const RhsNested rhs(xpr.rhs());
//
// generic_product_impl<LhsNestedCleaned, RhsNestedCleaned>::evalTo(m_result, lhs, rhs);
generic_product_impl<Lhs, Rhs, LhsShape, RhsShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
}
protected:
PlainObject m_result;
};
// The following three shortcuts are enabled only if the scalar types match exactly.
// TODO: we could enable them for different scalar types when the product is not vectorized.
// Dense = Product
template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::assign_op<Scalar,Scalar>, Dense2Dense,
typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type>
{
typedef Product<Lhs,Rhs,Options> SrcXprType;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<Scalar,Scalar> &)
{
Index dstRows = src.rows();
Index dstCols = src.cols();
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
dst.resize(dstRows, dstCols);
// FIXME shall we handle nested_eval here?
generic_product_impl<Lhs, Rhs>::evalTo(dst, src.lhs(), src.rhs());
}
};
// Dense += Product
template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::add_assign_op<Scalar,Scalar>, Dense2Dense,
typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type>
{
typedef Product<Lhs,Rhs,Options> SrcXprType;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op<Scalar,Scalar> &)
{
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
// FIXME shall we handle nested_eval here?
generic_product_impl<Lhs, Rhs>::addTo(dst, src.lhs(), src.rhs());
}
};
// Dense -= Product
template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar>
struct Assignment<DstXprType, Product<Lhs,Rhs,Options>, internal::sub_assign_op<Scalar,Scalar>, Dense2Dense,
typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type>
{
typedef Product<Lhs,Rhs,Options> SrcXprType;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op<Scalar,Scalar> &)
{
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
// FIXME shall we handle nested_eval here?
generic_product_impl<Lhs, Rhs>::subTo(dst, src.lhs(), src.rhs());
}
};
// Dense ?= scalar * Product
// TODO we should apply that rule if that's really helpful
// for instance, this is not good for inner products
template< typename DstXprType, typename Lhs, typename Rhs, typename AssignFunc, typename Scalar, typename ScalarBis, typename Plain>
struct Assignment<DstXprType, CwiseBinaryOp<internal::scalar_product_op<ScalarBis,Scalar>, const CwiseNullaryOp<internal::scalar_constant_op<ScalarBis>,Plain>,
const Product<Lhs,Rhs,DefaultProduct> >, AssignFunc, Dense2Dense>
{
typedef CwiseBinaryOp<internal::scalar_product_op<ScalarBis,Scalar>,
const CwiseNullaryOp<internal::scalar_constant_op<ScalarBis>,Plain>,
const Product<Lhs,Rhs,DefaultProduct> > SrcXprType;
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void run(DstXprType &dst, const SrcXprType &src, const AssignFunc& func)
{
call_assignment_no_alias(dst, (src.lhs().functor().m_other * src.rhs().lhs())*src.rhs().rhs(), func);
}
};
//----------------------------------------
// Catch "Dense ?= xpr + Product<>" expression to save one temporary
// FIXME we could probably enable these rules for any product, i.e., not only Dense and DefaultProduct
template<typename OtherXpr, typename Lhs, typename Rhs>
struct evaluator_assume_aliasing<CwiseBinaryOp<internal::scalar_sum_op<typename OtherXpr::Scalar,typename Product<Lhs,Rhs,DefaultProduct>::Scalar>, const OtherXpr,
const Product<Lhs,Rhs,DefaultProduct> >, DenseShape > {
static const bool value = true;
};
template<typename OtherXpr, typename Lhs, typename Rhs>
struct evaluator_assume_aliasing<CwiseBinaryOp<internal::scalar_difference_op<typename OtherXpr::Scalar,typename Product<Lhs,Rhs,DefaultProduct>::Scalar>, const OtherXpr,
const Product<Lhs,Rhs,DefaultProduct> >, DenseShape > {
static const bool value = true;
};
template<typename DstXprType, typename OtherXpr, typename ProductType, typename Func1, typename Func2>
struct assignment_from_xpr_op_product
{
template<typename SrcXprType, typename InitialFunc>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void run(DstXprType &dst, const SrcXprType &src, const InitialFunc& /*func*/)
{
call_assignment_no_alias(dst, src.lhs(), Func1());
call_assignment_no_alias(dst, src.rhs(), Func2());
}
};
#define EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(ASSIGN_OP,BINOP,ASSIGN_OP2) \
template< typename DstXprType, typename OtherXpr, typename Lhs, typename Rhs, typename DstScalar, typename SrcScalar, typename OtherScalar,typename ProdScalar> \
struct Assignment<DstXprType, CwiseBinaryOp<internal::BINOP<OtherScalar,ProdScalar>, const OtherXpr, \
const Product<Lhs,Rhs,DefaultProduct> >, internal::ASSIGN_OP<DstScalar,SrcScalar>, Dense2Dense> \
: assignment_from_xpr_op_product<DstXprType, OtherXpr, Product<Lhs,Rhs,DefaultProduct>, internal::ASSIGN_OP<DstScalar,OtherScalar>, internal::ASSIGN_OP2<DstScalar,ProdScalar> > \
{}
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_sum_op,add_assign_op);
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_sum_op,add_assign_op);
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_sum_op,sub_assign_op);
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_difference_op,sub_assign_op);
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_difference_op,sub_assign_op);
EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_difference_op,add_assign_op);
//----------------------------------------
template<typename Lhs, typename Rhs>
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,InnerProduct>
{
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
dst.coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum();
}
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
dst.coeffRef(0,0) += (lhs.transpose().cwiseProduct(rhs)).sum();
}
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{ dst.coeffRef(0,0) -= (lhs.transpose().cwiseProduct(rhs)).sum(); }
};
/***********************************************************************
* Implementation of outer dense * dense vector product
***********************************************************************/
// Column major result
template<typename Dst, typename Lhs, typename Rhs, typename Func>
void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const false_type&)
{
evaluator<Rhs> rhsEval(rhs);
ei_declare_local_nested_eval(Lhs,lhs,Rhs::SizeAtCompileTime,actual_lhs);
// FIXME if cols is large enough, then it might be useful to make sure that lhs is sequentially stored
// FIXME not very good if rhs is real and lhs complex while alpha is real too
const Index cols = dst.cols();
for (Index j=0; j<cols; ++j)
func(dst.col(j), rhsEval.coeff(Index(0),j) * actual_lhs);
}
// Row major result
template<typename Dst, typename Lhs, typename Rhs, typename Func>
void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const true_type&)
{
evaluator<Lhs> lhsEval(lhs);
ei_declare_local_nested_eval(Rhs,rhs,Lhs::SizeAtCompileTime,actual_rhs);
// FIXME if rows is large enough, then it might be useful to make sure that rhs is sequentially stored
// FIXME not very good if lhs is real and rhs complex while alpha is real too
const Index rows = dst.rows();
for (Index i=0; i<rows; ++i)
func(dst.row(i), lhsEval.coeff(i,Index(0)) * actual_rhs);
}
template<typename Lhs, typename Rhs>
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,OuterProduct>
{
template<typename T> struct is_row_major : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {};
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
// TODO it would be nice to be able to exploit our *_assign_op functors for that purpose
struct set { template<typename Dst, typename Src> EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } };
struct add { template<typename Dst, typename Src> EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() += src; } };
struct sub { template<typename Dst, typename Src> EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() -= src; } };
struct adds {
Scalar m_scale;
explicit adds(const Scalar& s) : m_scale(s) {}
template<typename Dst, typename Src> void EIGEN_DEVICE_FUNC operator()(const Dst& dst, const Src& src) const {
dst.const_cast_derived() += m_scale * src;
}
};
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
internal::outer_product_selector_run(dst, lhs, rhs, set(), is_row_major<Dst>());
}
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
internal::outer_product_selector_run(dst, lhs, rhs, add(), is_row_major<Dst>());
}
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
internal::outer_product_selector_run(dst, lhs, rhs, sub(), is_row_major<Dst>());
}
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
{
internal::outer_product_selector_run(dst, lhs, rhs, adds(alpha), is_row_major<Dst>());
}
};
// This base class provides default implementations for evalTo, addTo, subTo, in terms of scaleAndAddTo
template<typename Lhs, typename Rhs, typename Derived>
struct generic_product_impl_base
{
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{ dst.setZero(); scaleAndAddTo(dst, lhs, rhs, Scalar(1)); }
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{ scaleAndAddTo(dst,lhs, rhs, Scalar(1)); }
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{ scaleAndAddTo(dst, lhs, rhs, Scalar(-1)); }
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
{ Derived::scaleAndAddTo(dst,lhs,rhs,alpha); }
};
template<typename Lhs, typename Rhs>
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemvProduct>
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemvProduct> >
{
typedef typename nested_eval<Lhs,1>::type LhsNested;
typedef typename nested_eval<Rhs,1>::type RhsNested;
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight };
typedef typename internal::remove_all<typename internal::conditional<int(Side)==OnTheRight,LhsNested,RhsNested>::type>::type MatrixType;
template<typename Dest>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
{
LhsNested actual_lhs(lhs);
RhsNested actual_rhs(rhs);
internal::gemv_dense_selector<Side,
(int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor,
bool(internal::blas_traits<MatrixType>::HasUsableDirectAccess)
>::run(actual_lhs, actual_rhs, dst, alpha);
}
};
template<typename Lhs, typename Rhs>
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,CoeffBasedProductMode>
{
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
// Same as: dst.noalias() = lhs.lazyProduct(rhs);
// but easier on the compiler side
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::assign_op<typename Dst::Scalar,Scalar>());
}
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
// dst.noalias() += lhs.lazyProduct(rhs);
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::add_assign_op<typename Dst::Scalar,Scalar>());
}
template<typename Dst>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)
{
// dst.noalias() -= lhs.lazyProduct(rhs);
call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op<typename Dst::Scalar,Scalar>());
}
// This is a special evaluation path called from generic_product_impl<...,GemmProduct> in file GeneralMatrixMatrix.h
// This variant tries to extract scalar multiples from both the LHS and RHS and factor them out. For instance:
// dst {,+,-}= (s1*A)*(B*s2)
// will be rewritten as:
// dst {,+,-}= (s1*s2) * (A.lazyProduct(B))
// There are at least four benefits of doing so:
// 1 - huge performance gain for heap-allocated matrix types as it save costly allocations.
// 2 - it is faster than simply by-passing the heap allocation through stack allocation.
// 3 - it makes this fallback consistent with the heavy GEMM routine.
// 4 - it fully by-passes huge stack allocation attempts when multiplying huge fixed-size matrices.
// (see https://stackoverflow.com/questions/54738495)
// For small fixed sizes matrices, howver, the gains are less obvious, it is sometimes x2 faster, but sometimes x3 slower,
// and the behavior depends also a lot on the compiler... This is why this re-writting strategy is currently
// enabled only when falling back from the main GEMM.
template<typename Dst, typename Func>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void eval_dynamic(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func &func)
{
enum {
HasScalarFactor = blas_traits<Lhs>::HasScalarFactor || blas_traits<Rhs>::HasScalarFactor,
ConjLhs = blas_traits<Lhs>::NeedToConjugate,
ConjRhs = blas_traits<Rhs>::NeedToConjugate
};
// FIXME: in c++11 this should be auto, and extractScalarFactor should also return auto
// this is important for real*complex_mat
Scalar actualAlpha = blas_traits<Lhs>::extractScalarFactor(lhs)
* blas_traits<Rhs>::extractScalarFactor(rhs);
eval_dynamic_impl(dst,
blas_traits<Lhs>::extract(lhs).template conjugateIf<ConjLhs>(),
blas_traits<Rhs>::extract(rhs).template conjugateIf<ConjRhs>(),
func,
actualAlpha,
typename conditional<HasScalarFactor,true_type,false_type>::type());
}
protected:
template<typename Dst, typename LhsT, typename RhsT, typename Func, typename Scalar>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s /* == 1 */, false_type)
{
EIGEN_UNUSED_VARIABLE(s);
eigen_internal_assert(s==Scalar(1));
call_restricted_packet_assignment_no_alias(dst, lhs.lazyProduct(rhs), func);
}
template<typename Dst, typename LhsT, typename RhsT, typename Func, typename Scalar>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s, true_type)
{
call_restricted_packet_assignment_no_alias(dst, s * lhs.lazyProduct(rhs), func);
}
};
// This specialization enforces the use of a coefficient-based evaluation strategy
template<typename Lhs, typename Rhs>
struct generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,LazyCoeffBasedProductMode>
: generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,CoeffBasedProductMode> {};
// Case 2: Evaluate coeff by coeff
//
// This is mostly taken from CoeffBasedProduct.h
// The main difference is that we add an extra argument to the etor_product_*_impl::run() function
// for the inner dimension of the product, because evaluator object do not know their size.
template<int Traversal, int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
struct etor_product_coeff_impl;
template<int StorageOrder, int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl;
template<typename Lhs, typename Rhs, int ProductTag>
struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape, DenseShape>
: evaluator_base<Product<Lhs, Rhs, LazyProduct> >
{
typedef Product<Lhs, Rhs, LazyProduct> XprType;
typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit product_evaluator(const XprType& xpr)
: m_lhs(xpr.lhs()),
m_rhs(xpr.rhs()),
m_lhsImpl(m_lhs), // FIXME the creation of the evaluator objects should result in a no-op, but check that!
m_rhsImpl(m_rhs), // Moreover, they are only useful for the packet path, so we could completely disable them when not needed,
// or perhaps declare them on the fly on the packet method... We have experiment to check what's best.
m_innerDim(xpr.lhs().cols())
{
EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits<Scalar>::MulCost);
EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits<Scalar>::AddCost);
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
#if 0
std::cerr << "LhsOuterStrideBytes= " << LhsOuterStrideBytes << "\n";
std::cerr << "RhsOuterStrideBytes= " << RhsOuterStrideBytes << "\n";
std::cerr << "LhsAlignment= " << LhsAlignment << "\n";
std::cerr << "RhsAlignment= " << RhsAlignment << "\n";
std::cerr << "CanVectorizeLhs= " << CanVectorizeLhs << "\n";
std::cerr << "CanVectorizeRhs= " << CanVectorizeRhs << "\n";
std::cerr << "CanVectorizeInner= " << CanVectorizeInner << "\n";
std::cerr << "EvalToRowMajor= " << EvalToRowMajor << "\n";
std::cerr << "Alignment= " << Alignment << "\n";
std::cerr << "Flags= " << Flags << "\n";
#endif
}
// Everything below here is taken from CoeffBasedProduct.h
typedef typename internal::nested_eval<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
typedef typename internal::nested_eval<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
typedef typename internal::remove_all<LhsNested>::type LhsNestedCleaned;
typedef typename internal::remove_all<RhsNested>::type RhsNestedCleaned;
typedef evaluator<LhsNestedCleaned> LhsEtorType;
typedef evaluator<RhsNestedCleaned> RhsEtorType;
enum {
RowsAtCompileTime = LhsNestedCleaned::RowsAtCompileTime,
ColsAtCompileTime = RhsNestedCleaned::ColsAtCompileTime,
InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsNestedCleaned::ColsAtCompileTime, RhsNestedCleaned::RowsAtCompileTime),
MaxRowsAtCompileTime = LhsNestedCleaned::MaxRowsAtCompileTime,
MaxColsAtCompileTime = RhsNestedCleaned::MaxColsAtCompileTime
};
typedef typename find_best_packet<Scalar,RowsAtCompileTime>::type LhsVecPacketType;
typedef typename find_best_packet<Scalar,ColsAtCompileTime>::type RhsVecPacketType;
enum {
LhsCoeffReadCost = LhsEtorType::CoeffReadCost,
RhsCoeffReadCost = RhsEtorType::CoeffReadCost,
CoeffReadCost = InnerSize==0 ? NumTraits<Scalar>::ReadCost
: InnerSize == Dynamic ? HugeCost
: InnerSize * (NumTraits<Scalar>::MulCost + LhsCoeffReadCost + RhsCoeffReadCost)
+ (InnerSize - 1) * NumTraits<Scalar>::AddCost,
Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT,
LhsFlags = LhsEtorType::Flags,
RhsFlags = RhsEtorType::Flags,
LhsRowMajor = LhsFlags & RowMajorBit,
RhsRowMajor = RhsFlags & RowMajorBit,
LhsVecPacketSize = unpacket_traits<LhsVecPacketType>::size,
RhsVecPacketSize = unpacket_traits<RhsVecPacketType>::size,
// Here, we don't care about alignment larger than the usable packet size.
LhsAlignment = EIGEN_PLAIN_ENUM_MIN(LhsEtorType::Alignment,LhsVecPacketSize*int(sizeof(typename LhsNestedCleaned::Scalar))),
RhsAlignment = EIGEN_PLAIN_ENUM_MIN(RhsEtorType::Alignment,RhsVecPacketSize*int(sizeof(typename RhsNestedCleaned::Scalar))),
SameType = is_same<typename LhsNestedCleaned::Scalar,typename RhsNestedCleaned::Scalar>::value,
CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime!=1),
CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime!=1),
EvalToRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
: (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0
: (bool(RhsRowMajor) && !CanVectorizeLhs),
Flags = ((unsigned int)(LhsFlags | RhsFlags) & HereditaryBits & ~RowMajorBit)
| (EvalToRowMajor ? RowMajorBit : 0)
// TODO enable vectorization for mixed types
| (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0)
| (XprType::IsVectorAtCompileTime ? LinearAccessBit : 0),
LhsOuterStrideBytes = int(LhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename LhsNestedCleaned::Scalar)),
RhsOuterStrideBytes = int(RhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename RhsNestedCleaned::Scalar)),
Alignment = bool(CanVectorizeLhs) ? (LhsOuterStrideBytes<=0 || (int(LhsOuterStrideBytes) % EIGEN_PLAIN_ENUM_MAX(1,LhsAlignment))!=0 ? 0 : LhsAlignment)
: bool(CanVectorizeRhs) ? (RhsOuterStrideBytes<=0 || (int(RhsOuterStrideBytes) % EIGEN_PLAIN_ENUM_MAX(1,RhsAlignment))!=0 ? 0 : RhsAlignment)
: 0,
/* CanVectorizeInner deserves special explanation. It does not affect the product flags. It is not used outside
* of Product. If the Product itself is not a packet-access expression, there is still a chance that the inner
* loop of the product might be vectorized. This is the meaning of CanVectorizeInner. Since it doesn't affect
* the Flags, it is safe to make this value depend on ActualPacketAccessBit, that doesn't affect the ABI.
*/
CanVectorizeInner = SameType
&& LhsRowMajor
&& (!RhsRowMajor)
&& (LhsFlags & RhsFlags & ActualPacketAccessBit)
&& (InnerSize % packet_traits<Scalar>::size == 0)
};
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const
{
return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum();
}
/* Allow index-based non-packet access. It is impossible though to allow index-based packed access,
* which is why we don't set the LinearAccessBit.
* TODO: this seems possible when the result is a vector
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const CoeffReturnType coeff(Index index) const
{
const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index;
const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0;
return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum();
}
template<int LoadMode, typename PacketType>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const PacketType packet(Index row, Index col) const
{
PacketType res;
typedef etor_product_packet_impl<bool(int(Flags)&RowMajorBit) ? RowMajor : ColMajor,
Unroll ? int(InnerSize) : Dynamic,
LhsEtorType, RhsEtorType, PacketType, LoadMode> PacketImpl;
PacketImpl::run(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res);
return res;
}
template<int LoadMode, typename PacketType>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const PacketType packet(Index index) const
{
const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index;
const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0;
return packet<LoadMode,PacketType>(row,col);
}
protected:
typename internal::add_const_on_value_type<LhsNested>::type m_lhs;
typename internal::add_const_on_value_type<RhsNested>::type m_rhs;
LhsEtorType m_lhsImpl;
RhsEtorType m_rhsImpl;
// TODO: Get rid of m_innerDim if known at compile time
Index m_innerDim;
};
template<typename Lhs, typename Rhs>
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, LazyCoeffBasedProductMode, DenseShape, DenseShape>
: product_evaluator<Product<Lhs, Rhs, LazyProduct>, CoeffBasedProductMode, DenseShape, DenseShape>
{
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
typedef Product<Lhs, Rhs, LazyProduct> BaseProduct;
typedef product_evaluator<BaseProduct, CoeffBasedProductMode, DenseShape, DenseShape> Base;
enum {
Flags = Base::Flags | EvalBeforeNestingBit
};
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit product_evaluator(const XprType& xpr)
: Base(BaseProduct(xpr.lhs(),xpr.rhs()))
{}
};
/****************************************
*** Coeff based product, Packet path ***
****************************************/
template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
{
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res)
{
etor_product_packet_impl<RowMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, innerDim, res);
res = pmadd(pset1<Packet>(lhs.coeff(row, Index(UnrollingIndex-1))), rhs.template packet<LoadMode,Packet>(Index(UnrollingIndex-1), col), res);
}
};
template<int UnrollingIndex, typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
{
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res)
{
etor_product_packet_impl<ColMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, innerDim, res);
res = pmadd(lhs.template packet<LoadMode,Packet>(row, Index(UnrollingIndex-1)), pset1<Packet>(rhs.coeff(Index(UnrollingIndex-1), col)), res);
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<RowMajor, 1, Lhs, Rhs, Packet, LoadMode>
{
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res)
{
res = pmul(pset1<Packet>(lhs.coeff(row, Index(0))),rhs.template packet<LoadMode,Packet>(Index(0), col));
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<ColMajor, 1, Lhs, Rhs, Packet, LoadMode>
{
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res)
{
res = pmul(lhs.template packet<LoadMode,Packet>(row, Index(0)), pset1<Packet>(rhs.coeff(Index(0), col)));
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode>
{
static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res)
{
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode>
{
static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res)
{
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
{
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res)
{
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
for(Index i = 0; i < innerDim; ++i)
res = pmadd(pset1<Packet>(lhs.coeff(row, i)), rhs.template packet<LoadMode,Packet>(i, col), res);
}
};
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
struct etor_product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
{
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res)
{
res = pset1<Packet>(typename unpacket_traits<Packet>::type(0));
for(Index i = 0; i < innerDim; ++i)
res = pmadd(lhs.template packet<LoadMode,Packet>(row, i), pset1<Packet>(rhs.coeff(i, col)), res);
}
};
/***************************************************************************
* Triangular products
***************************************************************************/
template<int Mode, bool LhsIsTriangular,
typename Lhs, bool LhsIsVector,
typename Rhs, bool RhsIsVector>
struct triangular_product_impl;
template<typename Lhs, typename Rhs, int ProductTag>
struct generic_product_impl<Lhs,Rhs,TriangularShape,DenseShape,ProductTag>
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,TriangularShape,DenseShape,ProductTag> >
{
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
template<typename Dest>
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
{
triangular_product_impl<Lhs::Mode,true,typename Lhs::MatrixType,false,Rhs, Rhs::ColsAtCompileTime==1>
::run(dst, lhs.nestedExpression(), rhs, alpha);
}
};
template<typename Lhs, typename Rhs, int ProductTag>
struct generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag>
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag> >
{
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
template<typename Dest>
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
{
triangular_product_impl<Rhs::Mode,false,Lhs,Lhs::RowsAtCompileTime==1, typename Rhs::MatrixType, false>::run(dst, lhs, rhs.nestedExpression(), alpha);
}
};
/***************************************************************************
* SelfAdjoint products
***************************************************************************/
template <typename Lhs, int LhsMode, bool LhsIsVector,
typename Rhs, int RhsMode, bool RhsIsVector>
struct selfadjoint_product_impl;
template<typename Lhs, typename Rhs, int ProductTag>
struct generic_product_impl<Lhs,Rhs,SelfAdjointShape,DenseShape,ProductTag>
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,SelfAdjointShape,DenseShape,ProductTag> >
{
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
template<typename Dest>
static EIGEN_DEVICE_FUNC
void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
{
selfadjoint_product_impl<typename Lhs::MatrixType,Lhs::Mode,false,Rhs,0,Rhs::IsVectorAtCompileTime>::run(dst, lhs.nestedExpression(), rhs, alpha);
}
};
template<typename Lhs, typename Rhs, int ProductTag>
struct generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag>
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag> >
{
typedef typename Product<Lhs,Rhs>::Scalar Scalar;
template<typename Dest>
static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha)
{
selfadjoint_product_impl<Lhs,0,Lhs::IsVectorAtCompileTime,typename Rhs::MatrixType,Rhs::Mode,false>::run(dst, lhs, rhs.nestedExpression(), alpha);
}
};
/***************************************************************************
* Diagonal products
***************************************************************************/
template<typename MatrixType, typename DiagonalType, typename Derived, int ProductOrder>
struct diagonal_product_evaluator_base
: evaluator_base<Derived>
{
typedef typename ScalarBinaryOpTraits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType Scalar;
public:
enum {
CoeffReadCost = NumTraits<Scalar>::MulCost + evaluator<MatrixType>::CoeffReadCost + evaluator<DiagonalType>::CoeffReadCost,
MatrixFlags = evaluator<MatrixType>::Flags,
DiagFlags = evaluator<DiagonalType>::Flags,
_StorageOrder = (Derived::MaxRowsAtCompileTime==1 && Derived::MaxColsAtCompileTime!=1) ? RowMajor
: (Derived::MaxColsAtCompileTime==1 && Derived::MaxRowsAtCompileTime!=1) ? ColMajor
: MatrixFlags & RowMajorBit ? RowMajor : ColMajor,
_SameStorageOrder = _StorageOrder == (MatrixFlags & RowMajorBit ? RowMajor : ColMajor),
_ScalarAccessOnDiag = !((int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheLeft)
||(int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheRight)),
_SameTypes = is_same<typename MatrixType::Scalar, typename DiagonalType::Scalar>::value,
// FIXME currently we need same types, but in the future the next rule should be the one
//_Vectorizable = bool(int(MatrixFlags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagFlags)&PacketAccessBit))),
_Vectorizable = bool(int(MatrixFlags)&PacketAccessBit)
&& _SameTypes
&& (_SameStorageOrder || (MatrixFlags&LinearAccessBit)==LinearAccessBit)
&& (_ScalarAccessOnDiag || (bool(int(DiagFlags)&PacketAccessBit))),
_LinearAccessMask = (MatrixType::RowsAtCompileTime==1 || MatrixType::ColsAtCompileTime==1) ? LinearAccessBit : 0,
Flags = ((HereditaryBits|_LinearAccessMask) & (unsigned int)(MatrixFlags)) | (_Vectorizable ? PacketAccessBit : 0),
Alignment = evaluator<MatrixType>::Alignment,
AsScalarProduct = (DiagonalType::SizeAtCompileTime==1)
|| (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::RowsAtCompileTime==1 && ProductOrder==OnTheLeft)
|| (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime==1 && ProductOrder==OnTheRight)
};
EIGEN_DEVICE_FUNC diagonal_product_evaluator_base(const MatrixType &mat, const DiagonalType &diag)
: m_diagImpl(diag), m_matImpl(mat)
{
EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits<Scalar>::MulCost);
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const
{
if(AsScalarProduct)
return m_diagImpl.coeff(0) * m_matImpl.coeff(idx);
else
return m_diagImpl.coeff(idx) * m_matImpl.coeff(idx);
}
protected:
template<int LoadMode,typename PacketType>
EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::true_type) const
{
return internal::pmul(m_matImpl.template packet<LoadMode,PacketType>(row, col),
internal::pset1<PacketType>(m_diagImpl.coeff(id)));
}
template<int LoadMode,typename PacketType>
EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::false_type) const
{
enum {
InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime,
DiagonalPacketLoadMode = EIGEN_PLAIN_ENUM_MIN(LoadMode,((InnerSize%16) == 0) ? int(Aligned16) : int(evaluator<DiagonalType>::Alignment)) // FIXME hardcoded 16!!
};
return internal::pmul(m_matImpl.template packet<LoadMode,PacketType>(row, col),
m_diagImpl.template packet<DiagonalPacketLoadMode,PacketType>(id));
}
evaluator<DiagonalType> m_diagImpl;
evaluator<MatrixType> m_matImpl;
};
// diagonal * dense
template<typename Lhs, typename Rhs, int ProductKind, int ProductTag>
struct product_evaluator<Product<Lhs, Rhs, ProductKind>, ProductTag, DiagonalShape, DenseShape>
: diagonal_product_evaluator_base<Rhs, typename Lhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>, OnTheLeft>
{
typedef diagonal_product_evaluator_base<Rhs, typename Lhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>, OnTheLeft> Base;
using Base::m_diagImpl;
using Base::m_matImpl;
using Base::coeff;
typedef typename Base::Scalar Scalar;
typedef Product<Lhs, Rhs, ProductKind> XprType;
typedef typename XprType::PlainObject PlainObject;
typedef typename Lhs::DiagonalVectorType DiagonalType;
enum { StorageOrder = Base::_StorageOrder };
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr)
: Base(xpr.rhs(), xpr.lhs().diagonal())
{
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
{
return m_diagImpl.coeff(row) * m_matImpl.coeff(row, col);
}
#ifndef EIGEN_GPUCC
template<int LoadMode,typename PacketType>
EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
{
// FIXME: NVCC used to complain about the template keyword, but we have to check whether this is still the case.
// See also similar calls below.
return this->template packet_impl<LoadMode,PacketType>(row,col, row,
typename internal::conditional<int(StorageOrder)==RowMajor, internal::true_type, internal::false_type>::type());
}
template<int LoadMode,typename PacketType>
EIGEN_STRONG_INLINE PacketType packet(Index idx) const
{
return packet<LoadMode,PacketType>(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx);
}
#endif
};
// dense * diagonal
template<typename Lhs, typename Rhs, int ProductKind, int ProductTag>
struct product_evaluator<Product<Lhs, Rhs, ProductKind>, ProductTag, DenseShape, DiagonalShape>
: diagonal_product_evaluator_base<Lhs, typename Rhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>, OnTheRight>
{
typedef diagonal_product_evaluator_base<Lhs, typename Rhs::DiagonalVectorType, Product<Lhs, Rhs, LazyProduct>, OnTheRight> Base;
using Base::m_diagImpl;
using Base::m_matImpl;
using Base::coeff;
typedef typename Base::Scalar Scalar;
typedef Product<Lhs, Rhs, ProductKind> XprType;
typedef typename XprType::PlainObject PlainObject;
enum { StorageOrder = Base::_StorageOrder };
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr)
: Base(xpr.lhs(), xpr.rhs().diagonal())
{
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
{
return m_matImpl.coeff(row, col) * m_diagImpl.coeff(col);
}
#ifndef EIGEN_GPUCC
template<int LoadMode,typename PacketType>
EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const
{
return this->template packet_impl<LoadMode,PacketType>(row,col, col,
typename internal::conditional<int(StorageOrder)==ColMajor, internal::true_type, internal::false_type>::type());
}
template<int LoadMode,typename PacketType>
EIGEN_STRONG_INLINE PacketType packet(Index idx) const
{
return packet<LoadMode,PacketType>(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx);
}
#endif
};
/***************************************************************************
* Products with permutation matrices
***************************************************************************/
/** \internal
* \class permutation_matrix_product
* Internal helper class implementing the product between a permutation matrix and a matrix.
* This class is specialized for DenseShape below and for SparseShape in SparseCore/SparsePermutation.h
*/
template<typename ExpressionType, int Side, bool Transposed, typename ExpressionShape>
struct permutation_matrix_product;
template<typename ExpressionType, int Side, bool Transposed>
struct permutation_matrix_product<ExpressionType, Side, Transposed, DenseShape>
{
typedef typename nested_eval<ExpressionType, 1>::type MatrixType;
typedef typename remove_all<MatrixType>::type MatrixTypeCleaned;
template<typename Dest, typename PermutationType>
static inline void run(Dest& dst, const PermutationType& perm, const ExpressionType& xpr)
{
MatrixType mat(xpr);
const Index n = Side==OnTheLeft ? mat.rows() : mat.cols();
// FIXME we need an is_same for expression that is not sensitive to constness. For instance
// is_same_xpr<Block<const Matrix>, Block<Matrix> >::value should be true.
//if(is_same<MatrixTypeCleaned,Dest>::value && extract_data(dst) == extract_data(mat))
if(is_same_dense(dst, mat))
{
// apply the permutation inplace
Matrix<bool,PermutationType::RowsAtCompileTime,1,0,PermutationType::MaxRowsAtCompileTime> mask(perm.size());
mask.fill(false);
Index r = 0;
while(r < perm.size())
{
// search for the next seed
while(r<perm.size() && mask[r]) r++;
if(r>=perm.size())
break;
// we got one, let's follow it until we are back to the seed
Index k0 = r++;
Index kPrev = k0;
mask.coeffRef(k0) = true;
for(Index k=perm.indices().coeff(k0); k!=k0; k=perm.indices().coeff(k))
{
Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>(dst, k)
.swap(Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>
(dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev));
mask.coeffRef(k) = true;
kPrev = k;
}
}
}
else
{
for(Index i = 0; i < n; ++i)
{
Block<Dest, Side==OnTheLeft ? 1 : Dest::RowsAtCompileTime, Side==OnTheRight ? 1 : Dest::ColsAtCompileTime>
(dst, ((Side==OnTheLeft) ^ Transposed) ? perm.indices().coeff(i) : i)
=
Block<const MatrixTypeCleaned,Side==OnTheLeft ? 1 : MatrixTypeCleaned::RowsAtCompileTime,Side==OnTheRight ? 1 : MatrixTypeCleaned::ColsAtCompileTime>
(mat, ((Side==OnTheRight) ^ Transposed) ? perm.indices().coeff(i) : i);
}
}
}
};
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
struct generic_product_impl<Lhs, Rhs, PermutationShape, MatrixShape, ProductTag>
{
template<typename Dest>
static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs)
{
permutation_matrix_product<Rhs, OnTheLeft, false, MatrixShape>::run(dst, lhs, rhs);
}
};
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
struct generic_product_impl<Lhs, Rhs, MatrixShape, PermutationShape, ProductTag>
{
template<typename Dest>
static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs)
{
permutation_matrix_product<Lhs, OnTheRight, false, MatrixShape>::run(dst, rhs, lhs);
}
};
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
struct generic_product_impl<Inverse<Lhs>, Rhs, PermutationShape, MatrixShape, ProductTag>
{
template<typename Dest>
static void evalTo(Dest& dst, const Inverse<Lhs>& lhs, const Rhs& rhs)
{
permutation_matrix_product<Rhs, OnTheLeft, true, MatrixShape>::run(dst, lhs.nestedExpression(), rhs);
}
};
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
struct generic_product_impl<Lhs, Inverse<Rhs>, MatrixShape, PermutationShape, ProductTag>
{
template<typename Dest>
static void evalTo(Dest& dst, const Lhs& lhs, const Inverse<Rhs>& rhs)
{
permutation_matrix_product<Lhs, OnTheRight, true, MatrixShape>::run(dst, rhs.nestedExpression(), lhs);
}
};
/***************************************************************************
* Products with transpositions matrices
***************************************************************************/
// FIXME could we unify Transpositions and Permutation into a single "shape"??
/** \internal
* \class transposition_matrix_product
* Internal helper class implementing the product between a permutation matrix and a matrix.
*/
template<typename ExpressionType, int Side, bool Transposed, typename ExpressionShape>
struct transposition_matrix_product
{
typedef typename nested_eval<ExpressionType, 1>::type MatrixType;
typedef typename remove_all<MatrixType>::type MatrixTypeCleaned;
template<typename Dest, typename TranspositionType>
static inline void run(Dest& dst, const TranspositionType& tr, const ExpressionType& xpr)
{
MatrixType mat(xpr);
typedef typename TranspositionType::StorageIndex StorageIndex;
const Index size = tr.size();
StorageIndex j = 0;
if(!is_same_dense(dst,mat))
dst = mat;
for(Index k=(Transposed?size-1:0) ; Transposed?k>=0:k<size ; Transposed?--k:++k)
if(Index(j=tr.coeff(k))!=k)
{
if(Side==OnTheLeft) dst.row(k).swap(dst.row(j));
else if(Side==OnTheRight) dst.col(k).swap(dst.col(j));
}
}
};
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
struct generic_product_impl<Lhs, Rhs, TranspositionsShape, MatrixShape, ProductTag>
{
template<typename Dest>
static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs)
{
transposition_matrix_product<Rhs, OnTheLeft, false, MatrixShape>::run(dst, lhs, rhs);
}
};
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
struct generic_product_impl<Lhs, Rhs, MatrixShape, TranspositionsShape, ProductTag>
{
template<typename Dest>
static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs)
{
transposition_matrix_product<Lhs, OnTheRight, false, MatrixShape>::run(dst, rhs, lhs);
}
};
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
struct generic_product_impl<Transpose<Lhs>, Rhs, TranspositionsShape, MatrixShape, ProductTag>
{
template<typename Dest>
static void evalTo(Dest& dst, const Transpose<Lhs>& lhs, const Rhs& rhs)
{
transposition_matrix_product<Rhs, OnTheLeft, true, MatrixShape>::run(dst, lhs.nestedExpression(), rhs);
}
};
template<typename Lhs, typename Rhs, int ProductTag, typename MatrixShape>
struct generic_product_impl<Lhs, Transpose<Rhs>, MatrixShape, TranspositionsShape, ProductTag>
{
template<typename Dest>
static void evalTo(Dest& dst, const Lhs& lhs, const Transpose<Rhs>& rhs)
{
transposition_matrix_product<Lhs, OnTheRight, true, MatrixShape>::run(dst, rhs.nestedExpression(), lhs);
}
};
} // end namespace internal
} // end namespace Eigen
#endif // EIGEN_PRODUCT_EVALUATORS_H
| [
"[email protected]"
] | |
74bb1601a073ba758f48190740136fdc923a982a | 773169c73bfa09c49046997b6aa92df68fec2b4e | /02_Bit_Manipulation/07_Counting_Set_Bits.cc | 24fb3cdee701cd0884672ed035e2ff73cd1ed021 | [] | no_license | the-stranded-alien/Competitive_Programming_CPP | a9995869bf34cc55ce55fa31da7f7b3b9aadb65d | 65dac7953fc1cfa8315f7fe40017abae7515d82f | refs/heads/master | 2022-12-22T06:39:12.240658 | 2020-09-16T12:57:28 | 2020-09-16T12:57:28 | 270,649,612 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 728 | cc | #include<iostream>
using namespace std;
// First Method
int countBits(int n) {
int ans = 0;
while(n > 0) {
ans += (n & 1);
n = (n >> 1);
}
return ans;
}
// Second Method
int countBitsFast(int n) {
int ans = 0;
while(n > 0) {
n = (n & (n - 1));
ans++;
}
return ans;
}
// Given a Number N, Find Number of Set Bits
// In Binary Representation of it.
int main() {
int n;
cout << "Enter N : ";
cin >> n;
cout << "Count Of Set Bits (Method 1) : " << countBits(n) << endl;
cout << "Count Of Set Bits (Method 2) : " << countBitsFast(n) << endl;
cout << "Count Of Set Bits (Built-In) : " << __builtin_popcount(n) << endl;
return 0;
} | [
"[email protected]"
] | |
ffd085707a67b6c6c38e6c76f9b7a6315cf5b016 | 0e7c19e654fa899f2de7cfe430025832d82532c6 | /src/ctt/ctt_benchmark.cc | 0190360133ae0c252ada15a3c1f9c7db19b7d335 | [] | no_license | JensLangerak/thesis | f3b08f70123cfce079ad33bab7739fb537935915 | 042155b5c441eac4e7ad1cd7f6ee8db2fc2bcb8e | refs/heads/master | 2023-08-23T08:27:10.411442 | 2021-09-30T19:32:43 | 2021-09-30T19:32:43 | 292,589,320 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 506 | cc | //
// Created by jens on 02-06-21.
//
#include "ctt_benchmark.h"
#include "ctt.h"
#include "ctt_converter.h"
#include "parser.h"
namespace simple_sat_solver::ctt {
using namespace simple_sat_solver::benchmark;
Pumpkin::ProblemSpecification CttBenchmark::GetProblem() {
problem_ = Parser::Parse(problem_file_full_path_);
CttConverter converter(problem_);
sat_problem_ = converter.GetSatProblem();
problem_specification_ = ConvertSatToPumpkin(sat_problem_);
return problem_specification_;
}
} | [
"[email protected]"
] | |
493ba54f24ffa3f9ccb65d39c17731604de196be | e24a366a7ac5dfb5975a468046c8626a9d56fa6d | /Obfuscator/Source/projects/compiler-rt/lib/esan/esan_sideline.h | 74551fbde850e4618d2c35bcc2f2e5f683fb63f0 | [
"NCSA",
"MIT"
] | permissive | fengjixuchui/iOS-Reverse | 01e17539bdbff7f2a783821010d3f36b5afba910 | 682a5204407131c29588dd22236babd1f8b2889d | refs/heads/master | 2021-06-26T17:25:41.993771 | 2021-02-11T10:33:32 | 2021-02-11T10:33:32 | 210,527,924 | 0 | 0 | MIT | 2021-02-11T10:33:33 | 2019-09-24T06:26:57 | null | UTF-8 | C++ | false | false | 2,146 | h | //===-- esan_sideline.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of EfficiencySanitizer, a family of performance tuners.
//
// Esan sideline thread support.
//===----------------------------------------------------------------------===//
#ifndef ESAN_SIDELINE_H
#define ESAN_SIDELINE_H
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_internal_defs.h"
#include "sanitizer_common/sanitizer_platform_limits_freebsd.h"
#include "sanitizer_common/sanitizer_platform_limits_posix.h"
namespace __esan {
typedef void (*SidelineFunc)(void *Arg);
// Currently only one sideline thread is supported.
// It calls the SidelineFunc passed to launchThread once on each sample at the
// given frequency in real time (i.e., wall clock time).
class SidelineThread {
public:
// We cannot initialize any fields in the constructor as it will be called
// *after* launchThread for a static instance, as esan.module_ctor is called
// before static initializers.
SidelineThread() {}
~SidelineThread() {}
// To simplify declaration in sanitizer code where we want to avoid
// heap allocations, the constructor and destructor do nothing and
// launchThread and joinThread do the real work.
// They should each be called just once.
bool launchThread(SidelineFunc takeSample, void *Arg, u32 FreqMilliSec);
bool joinThread();
// Must be called from the sideline thread itself.
bool adjustTimer(u32 FreqMilliSec);
private:
static int runSideline(void *Arg);
static void registerSignal(int SigNum);
static void handleSidelineSignal(int SigNum, __sanitizer_siginfo *SigInfo,
void *Ctx);
char *Stack;
SidelineFunc sampleFunc;
void *FuncArg;
u32 Freq;
uptr SidelineId;
atomic_uintptr_t SidelineExit;
};
} // namespace __esan
#endif // ESAN_SIDELINE_H
| [
"[email protected]"
] | |
886f06e287d3e59dabb2cca2b9838f82a8c3855b | 59989d95437172ce36c19b6236525465934b7e9b | /my.cpp | 28b8ccd6a44f5428146ad454da32e716e206aca7 | [
"MIT"
] | permissive | Dipesh-Budhiraja/library | 150dd9a31c7392b9497b9ab173b01faa07335c17 | f0930f06bee8ce5a669ff4cf9a484ac95413d7ef | refs/heads/master | 2021-01-16T19:25:59.228415 | 2017-10-25T18:03:41 | 2017-10-25T18:03:41 | 100,166,121 | 0 | 2 | null | 2017-10-25T18:03:42 | 2017-08-13T09:17:34 | C++ | UTF-8 | C++ | false | false | 7,428 | cpp | #include <fstream>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
//PROTOTYPES OF ALL FUNCTIONS
void optionSubmitted(int choice);
void create_student();
void display_all_students();
void display_specific_student(char rollNo[]);
void create_book();
void display_all_books();
void display_specific_book(char isbnNo[]);
bool issuedbook(char rollNoCheck[],char isbnNoCheck[]);
// function to link archive to book
//function to link book to students
//
//PROTOTYPES END HERE
//DECLARATION OF CLASSES
struct student{
char rollNo[20];
char sname[20];
char phonenum[11];
int bookcount;
student(){
strcpy(rollNo, "");
strcpy(sname, "");
strcpy(phonenum, "");
bookcount = 0;
}
};
struct book{
char isbnNo[20];
char bname[20];
char authorName[20];
book(){
strcpy(isbnNo, "");
strcpy(bname, "");
strcpy(authorName, "");
}
};
struct issued{
char rollNo[20];
char isbnNo[20];
issued(){
strcpy(rollNo, "");
strcpy(isbnNo, "");
}
};
struct archive{
char isbnNo[20];
int ctr;
archive(){
strcpy(isbnNo, "");
ctr = 0;
}
};
//DECLARATION OF CLASSES ENDS
//MAIN FUNCTION
int main(){
int choice;
do{
cout << "\n1. CREATE STUDENT RECORD" << endl;
cout << "2. DISPLAY ALL STUDENTS RECORD" << endl;
cout << "3. DISPLAY SPECIFIC STUDENT RECORD" << endl;
cout << "4. CREATE BOOK" << endl;
cout << "5. DISPLAY ALL BOOKS" << endl;
cout << "6. DISPLAY SPECIFIC BOOK" << endl;
cout << "7. EXIT\n" << endl;
cin >> choice;
optionSubmitted(choice);
}while(choice != 7);
return 0;
}
//OPTION SUBMITTED
void optionSubmitted(int choice){
switch(choice){
case 1: create_student(); break;
case 2: display_all_students(); break;
case 3: char rollNo[20];
getchar();
cout << "Enter rollNo of student: " << endl;
cin.getline(rollNo, 19);
display_specific_student(rollNo);
break;
case 4: create_book(); break;
case 5: display_all_books(); break;
case 6: char isbnNo[20];
getchar();
cout << "Enter isbnNo of student: " << endl;
cin.getline(isbnNo, 19);
display_specific_book(isbnNo); break;
default: "No Choice Matches"; break;
}
}
//CREATE STUDENT
void create_student(){
char rollNo[20];
char sname[20];
char phonenum[20];
getchar();
student obj;
cin.getline(rollNo, 19);
cin.getline(sname, 19);
cin.getline(phonenum, 19);
ofstream studentWrite;
studentWrite.open("students.dat", ios :: app | ios :: binary);
if(studentWrite.is_open()){
cout << "Student successfully written" << endl;
studentWrite.write((char*)&obj,sizeof(student));
studentWrite.close();
}
else{
cout << "file not opening" << endl;
}
}
void display_all_students(){
// char rollNo[20];
// char sname[20];
// char phonenum[20];
student temp;
getchar();
ifstream studentRead("students.dat",ios :: binary);
if(studentRead.is_open()){
cout << "file opened successfully \n";
while(studentRead.read((char*)&temp,sizeof(student))){
cout << temp.rollNo << " " << temp.sname << " " << temp.phonenum << " " << temp.bookcount << endl;
}
studentRead.close();
}
else{
cout << "file not opened \n";
}
}
void display_specific_student(char rollNoCheck[]){
// char rollNoCheck[20];
// char sname[20];
// char phonenum[20];
student temp;
ifstream studentRead("students.dat",ios :: binary);
if(studentRead.is_open()){
cout << "file opened successfully \n";
// cout << strcmp(rollNo, rollNoCheck);
while(studentRead.read((char*)&temp,sizeof(student))){
if(strcmp(temp.rollNo, rollNoCheck) == 0){
cout << temp.rollNo << " " << temp.sname << " " << temp.phonenum << endl;
break;
}
}
studentRead.close();
}
else{
cout << "file not opened \n";
}
}
void create_book(){
// char isbnNo[20];
// char bname[20];
// char authorName[20];
book obj; //redundant lines honestly
getchar();
cin.getline(obj.isbnNo, 19);
cin.getline(obj.bname, 19);
cin.getline(obj.authorName, 19);
ofstream bookWrite("books.dat", ios :: app|ios ::binary);
if(bookWrite.is_open()){
cout << "Book successfully written" << endl;
bookWrite.write((char*)&obj,sizeof(student));
bookWrite.close();
}
else{
cout << "file not opening" << endl;
}
}
void display_all_books(){
char isbnNo[20];
char bname[20];
char authorName[20];
getchar();
ifstream bookRead("books.dat",ios::binary);
if(bookRead.is_open()){
cout << "file opened successfully \n";
while(bookRead >> isbnNo >> bname >> authorName){
cout << isbnNo << " " << bname << " " << authorName << endl;
}
bookRead.close();
}
else{
cout << "file not opened \n";
}
}
void display_specific_book(char isbnNoCheck[]){
book temp;
ifstream bookRead("books.dat",ios ::binary);
if(bookRead.is_open()){
cout << "file opened successfully \n";
// cout << strcmp(rollNo, rollNoCheck);
while(bookRead.read((char*)&temp,sizeof(student))){
if(strcmp(temp.isbnNo, isbnNoCheck) == 0){
cout << temp.isbnNo << " " << temp.bname << " " << temp.authorName << endl;
break;
}
}
bookRead.close();
}
else{
cout << "file not opened \n";
}
}
bool issuedbook(char rollNoCheck[],char isbnNoCheck[20]){
student temp;
ifstream studentRead("students.dat",ios :: binary);
int pos = studentRead.tellg();
while(studentRead.read((char*)&temp,sizeof(student))){
if(strcmp(rollNoCheck,temp.rollNo)==0){
if(temp.bookcount<3){
archive archtemp;
ifstream archiveRead("archive.txt",ios :: binary);
int archpos = archiveRead.tellg();
while(archiveRead.read((char*)&archtemp,sizeof(archive))){
if(strcmp(archtemp.isbnNo,isbnNoCheck)==0){
if(archtemp.ctr>0){ /// if count of copies is more than '0'
studentRead.close(); /// only case of successful issue
archiveRead.close();
issued issuetemp;
strcpy(issuetemp.rollNo,rollNoCheck);
strcpy(issuetemp.isbnNo,isbnNoCheck);
temp.bookcount++;
archtemp.ctr--;
ofstream studentWrite("students.dat",ios :: binary | ios::ate); /// added book count to student
studentWrite.seekp(pos,ios :: beg);
studentWrite.write((char*)&temp,sizeof(student));
ofstream issuedWrite("issued.dat",ios :: binary); /// added book issued to issued file
issuedWrite.write((char*)&issuetemp,sizeof(issued));
ofstream archiveWrite("archive.dat",ios :: binary); /// removed book from archive
archiveWrite.seekp(archpos,ios :: beg);
archiveWrite.write((char*)&archtemp,sizeof(archive));
return true;
}
else{
cout<<"All the copies of this book have been issued\n"; /// all copies issued
return false;
}
archpos = archiveRead.tellg();
}
else{
cout<<"This book doesn't exist\n"; /// book doesn't exist
return false;
}
}
}
else{
cout<<"Maximum number of books issued for this student\n"; /// student has issued max number of books
return false;
}
pos = studentRead.tellg();
}
else{
cout<<"Student doesn't exist\n"; /// student doesn't exist in database
return false;
}
}
}
| [
"[email protected]"
] | |
b0b1cce5eef8d94e160df28ee5b5e12339c8c058 | 088deb3c9b0f6365a813b0c6a87d33e67ffb916c | /base/hyperneat/HyperNEAT/Hypercube_NEAT/src/Experiments/HCUBE_SpiderRobotExperiment.cpp | be85d46c75c2806b3a9bcfa0a1bf73a9b63a4651 | [] | no_license | CreativeMachinesLab/softbotEscape | d47b0cb416bfb489af2f73e31ddb9b7d126249b9 | e552c8dff2a95ab9b9b64065deda2102ff9f2388 | refs/heads/master | 2021-01-01T15:37:01.484182 | 2015-04-27T10:25:32 | 2015-04-27T10:25:32 | 34,642,315 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 30,507 | cpp | // code based on legged.cpp by Kosei Demura (2007-5-19) (demura.net)
#include "Experiments/HCUBE_SpiderRobotExperiment.h"
#define POSTHOC_RECORD
//#define SPIDERROBOT_INTERACTIVE_EVOLUTION
#define EUCLIDEAN_DISTANCE_FITNESS
#define DOUBLE
#define HIDDEN_LAYER
#include "HCUBE_Defines.h"
#define dDOUBLE //using ode double precision
#define LEGSWING_ODE_DEBUG (0)
//////////
namespace HCUBE
{
using namespace NEAT;
SpiderRobotExperiment::SpiderRobotExperiment(string _experimentName)
: Experiment(_experimentName),
numNodesX(3),
numNodesY(4),
numSheets(3)
{
convergence_step = (int) NEAT::Globals::getSingleton()->getParameterValue("ConvergenceStep");
if(convergence_step < 0)
convergence_step = INT_MAX; // never switch
//#ifdef USE_NLEG_ROBOT
// hingeType = (int) NEAT::Globals::getSingleton()->getParameterValue("TorsoHingeType");
//#endif
generateSubstrate();
}
NEAT::GeneticPopulation* SpiderRobotExperiment::createInitialPopulation(int populationSize)
{
GeneticPopulation *population = new GeneticPopulation();
vector<GeneticNodeGene> genes;
genes.push_back(GeneticNodeGene("Bias","NetworkSensor",0,false));
genes.push_back(GeneticNodeGene("X1","NetworkSensor",0,false));
genes.push_back(GeneticNodeGene("Y1","NetworkSensor",0,false));
genes.push_back(GeneticNodeGene("X2","NetworkSensor",0,false));
genes.push_back(GeneticNodeGene("Y2","NetworkSensor",0,false));
genes.push_back(GeneticNodeGene("Output_ab","NetworkOutputNode",1,false,ACTIVATION_FUNCTION_SIGMOID));
#ifdef HIDDEN_LAYER
genes.push_back(GeneticNodeGene("Output_bc","NetworkOutputNode",1,false,ACTIVATION_FUNCTION_SIGMOID));
#endif
#ifdef RECURRENT
genes.push_back(GeneticNodeGene("Output_recurrence", "NetworkOutputNode",1,false,ACTIVATION_FUNCTION_SIGMOID));
#endif
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
genes.push_back(GeneticNodeGene("Bias_b","NetworkOutputNode",1,false,ACTIVATION_FUNCTION_SIGMOID));
genes.push_back(GeneticNodeGene("Bias_c","NetworkOutputNode",1,false,ACTIVATION_FUNCTION_SIGMOID));
#endif
for (int a=0;a<populationSize;a++)
{
shared_ptr<GeneticIndividual> individual(new GeneticIndividual(genes,true,1.0));
for (int b=0;b<0;b++) // this loop will never be entered? Why is it here?
{
individual->testMutate();
}
population->addIndividual(individual);
}
cout << "Finished creating population\n";
return population;
}
void SpiderRobotExperiment::generateSubstrate()
{
cout << "Generating substrate...";
boost::object_pool<NEAT::NetworkNode> networkNodePool;
boost::object_pool<NEAT::NetworkLink> networkLinkPool;
NEAT::NetworkNode *nodes = NULL;
NEAT::NetworkLink *links = NULL;
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
double *nodeBiases = NULL;
#endif
try
{
//#define USE_EXTRA_NODE
#ifndef USE_EXTRA_NODE
nodes = (NEAT::NetworkNode*)malloc(sizeof(NEAT::NetworkNode)*numNodesX*numNodesY*numSheets);
#ifdef RECURRENT
links = (NEAT::NetworkLink*)malloc(sizeof(NEAT::NetworkLink)*numNodesX*numNodesY*numNodesX*numNodesY*(numSheets));
#else
links = (NEAT::NetworkLink*)malloc(sizeof(NEAT::NetworkLink)*numNodesX*numNodesY*numNodesX*numNodesY*(numSheets -1));
#endif
#else
nodes = (NEAT::NetworkNode*)malloc(sizeof(NEAT::NetworkNode)*numNodesX*numNodesY*numSheets+sizeof(NEAT::NetworkNode));
#ifdef RECURRENT
links = (NEAT::NetworkLink*)malloc(sizeof(NEAT::NetworkLink)*numNodesX*numNodesY*numNodesX*numNodesY*(numSheets)+(20*sizeof(NEAT::NetworkLink)));
#else
links = (NEAT::NetworkLink*)malloc(sizeof(NEAT::NetworkLink)*numNodesX*numNodesY*numNodesX*numNodesY*(numSheets-1)+(20*sizeof(NEAT::NetworkLink)));
#endif
#endif
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
nodeBiases = new double[numNodesX*numNodesY*numSheets];
#endif
}
catch (std::exception e)
{
cout << e.what() << endl;
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
nameLookup.clear();
cout << "Creating nodes...\n";
int nodeCounter=0;
//#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
// static ofstream debugFile("SPIDERROBOT_EXPERIMENT_DEBUG.txt");
//#endif
for (int y1=0;y1<numNodesY;y1++)
{
for (int x1=0;x1<numNodesX;x1++)
{
for (int z=0;z<numSheets;z++)
{
Node node(x1,y1,z);
//#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
// debugFile << "creating node (" << x1 << "," << y1 << "," << z << ") with name " << (toString(x1)+string("/")+toString(y1) + string("/") + toString(z)) << endl;
//#endif
nameLookup[node] = (toString(x1)+string("/")+toString(y1) + string("/") + toString(z));
new(&nodes[nodeCounter]) NetworkNode(nameLookup[node]);
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
nodeBiases[nodeCounter]=0.0;
#endif
nodeCounter++;
/*
if (
y1==(numNodesY/2)
)
{
(*(nodes.end()-1))->setUpdate(false);
}
else
{
(*(nodes.end()-1))->setUpdate(true);
}
*/
}
}
}
#ifdef USE_EXTRA_NODE
Node node(5,3,0);
nameLookup[node] = (toString(5)+string("/")+toString(3) + string("/") + toString(0));
cout << "\n\n***The name of the extra node is: " << nameLookup[node] << endl << endl;
new(&nodes[nodeCounter]) NetworkNode(nameLookup[node]);
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
nodeBiases[nodeCounter]=0.0;
#endif
nodeCounter++;
#endif
cout << "Creating links...\n";
int linkCounter=0;
for (int y1=0;y1<numNodesY;y1++)
{
for (int x1=0;x1<numNodesX;x1++)
{
for (int y2=0;y2<numNodesY;y2++)
{
for (int x2=0;x2<numNodesX;x2++)
{
#ifdef RECURRENT
for (int z1=0;z1<(numSheets);z1++)
#else
for (int z1=0;z1<(numSheets - 1);z1++)
#endif
{
int z2 = z1+1;
//for (int z2=z1+1;z2<=z1+1;z2++)
{
//#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
//debugFile << "creating link no. " << linkCounter << " which is ( " << y1 << "," << x1 << "," << z1 << ") to ( " << y2 << "," << x2 << "," << z2 << ")\n";
//#endif
try
{
if(z2 < numSheets)
{
new (&links[linkCounter]) NetworkLink(
&nodes[y1*numNodesX*numSheets + x1*numSheets + z1],
&nodes[y2*numNodesX*numSheets + x2*numSheets + z2],
0.0
);
}
//LHZ - z2 will only = numSheets when recurrence is turned on - when it is, we should
//loop the link back to the input
else
{
new (&links[linkCounter]) NetworkLink(
&nodes[y1*numNodesX*numSheets + x1*numSheets + z1],
&nodes[y2*numNodesX*numSheets + x2*numSheets],
0.0
);
}
linkCounter++;
}
catch (const char *c)
{
cout << c << endl;
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
catch (string s)
{
cout << s << endl;
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
catch (std::exception e)
{
cout << e.what() << endl;
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
catch (...)
{
cout << "AN EXCEPTION HAS OCCURED!\n";
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
}
}
}
}
}
}
#ifdef USE_EXTRA_NODE
for (int y = 0; y < 4; y++)
{
for (int x = 0; x < 5; x++)
{
try
{
//cout << "creating link no. " << linkCounter << " which is ( " << 5 << "," << 3 << "," << 0 << ") to ( " << y << "," << x << "," << 1 << ")\n";
new (&links[linkCounter]) NetworkLink(
&nodes[5*numNodesX*numSheets + 3*numSheets + 0],
&nodes[y*numNodesX*numSheets + x*numSheets + 1],
0.0
);
linkCounter++;
}
catch (const char *c)
{
cout << c << endl;
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
catch (string s)
{
cout << s << endl;
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
catch (std::exception e)
{
cout << e.what() << endl;
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
catch (...)
{
cout << "AN EXCEPTION HAS OCCURED!\n";
CREATE_PAUSE(string("Line Number: ")+toString(__LINE__));
}
}
}
#endif
//#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
// debugFile.close();
//#endif
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
cout << "Creating FastBiasNetwork\n";
substrate = NEAT::FastBiasNetwork<double>(
nodes,
nodeCounter,
links,
linkCounter,
nodeBiases
);
#else
cout << "Creating FastNetwork\n";
substrate = NEAT::FastNetwork<double>(
nodes,
nodeCounter,
links,
linkCounter
);
#endif
/*
while (!nodes.empty())
{
delete nodes[0];
nodes.erase(nodes.begin());
}
while (!links.empty())
{
delete links[0];
links.erase(links.begin());
}
*/
cout << "done!\n";
for (int a=0;a<nodeCounter;a++)
{
nodes[a].~NetworkNode();
}
for (int a=0;a<linkCounter;a++)
{
links[a].~NetworkLink();
}
free(nodes);
free(links);
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
delete[] nodeBiases;
#endif
}
NEAT::FastNetwork<double> SpiderRobotExperiment::populateAndReturnSubstrate(shared_ptr<const NEAT::GeneticIndividual> individual) {
populateSubstrate(individual, true);
return substrate;
}
void SpiderRobotExperiment::populateSubstrate(shared_ptr<const NEAT::GeneticIndividual> individual, bool toPrint)
{
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
static ofstream debugFile("SPIDERROBOT_EXPERIMENT_DEBUG.txt");
if(toPrint) {
// static ofstream debugFile("SPIDERROBOT_EXPERIMENT_DEBUG.txt");w
debugFile << "Populating substrate...\n";
}
#endif
#ifdef HIDDEN_LAYER
double cppnLinkWeightFromInputToHiddenSheet = 0.0;
double cppnLinkWeightFromHiddenToOutputSheet = 0.0;
double substrateLinkWeightFromInputToHiddenSheet = 0.0;
double substrateLinkWeightFromHiddenToOutputSheet = 0.0;
#else
double cppnLinkWeightFromInputToOutputSheet = 0.0;
double substrateLinkWeightFromInputToOutputSheet = 0.0;
#endif
#ifdef RECURRENT
double cppnLinkWeightFromOutputToInputSheet = 0.0;
double substrateLinkWeightFromOutputToInputSheet = 0.0;
#endif
////////////////////////////////////////////
//NEAT::FastNetwork<double> network = individual->spawnFastPhenotypeStack<double>();
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
NEAT::FastBiasNetwork<double> network = individual->spawnFastPhenotypeStack<double>();
#else
NEAT::FastNetwork<double> network = individual->spawnFastPhenotypeStack<double>();
#endif
//printCPPN(individual);
//<start> use this if evolving the period of the sine
//int xInt =numNodesX+10; //I am setting this to be off the grid, so this node will not be constrained (as much)
//// by what they are doing in the geometric region that the substrate network is formed from
//int yInt =numNodesY+10;
//int x1norm = xInt;
//int y1norm = yInt;
//xInt = numNodesX+11;
//yInt = numNodesY+11;
//int x2norm = xInt;
//int y2norm = yInt;
//
//network.reinitialize();
//network.setValue("X1",x1norm);
//network.setValue("Y1",y1norm);
//network.setValue("X2",x2norm);
//network.setValue("Y2",y2norm);
//network.setValue("Bias",0.3);
//network.update();
//timeStepDivisor = 1000.0*double(network.getValue("Output_ab"));
//if(visualize)printf("just got a timeStepDivisor: %f\n", timeStepDivisor);
//<end>
////////////////////////////////////////////
int linkCounter=0;
for (int y1=0;y1<numNodesY;y1++)
{
for (int x1=0;x1<numNodesX;x1++)
{
for (int y2=0;y2<numNodesY;y2++)
{
for (int x2=0;x2<numNodesX;x2++)
{
double x1normal;
double x2normal;
double y1normal;
double y2normal;
x1normal = normalize(x1,numNodesX);
x2normal = normalize(x2,numNodesX);
y1normal = normalize(y1,numNodesY);
y2normal = normalize(y2,numNodesY);
//now set the cppn values
network.reinitialize();
network.setValue("X1",x1normal);
network.setValue("X2",x2normal);
network.setValue("Y1",y1normal);
network.setValue("Y2",y2normal);
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
if(toPrint) {
debugFile << "Setting CPPN input values to X1: " << setw(4) << x1normal
<< " X2: " << setw(4) << x2normal;
if(dimensionality>=2){
debugFile << " Y1: " << setw(4) << y1normal
<< " Y2: " << setw(4) << y2normal;
}
if(dimensionality==3 or dimensionality==4){
debugFile << " Z1: " << setw(4) << z1normal
<< " Z2: " << setw(4) << z2normal;
}
debugFile << endl;
}
#endif
network.setValue("Bias",0.3);
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
// debugFile << " Bias: " << setw(2) << " .3";
#endif
network.update();
#ifdef HIDDEN_LAYER
cppnLinkWeightFromInputToHiddenSheet = double(network.getValue("Output_ab"));
cppnLinkWeightFromHiddenToOutputSheet = double(network.getValue("Output_bc"));
#else //no hidden
cppnLinkWeightFromInputToOutputSheet = double(network.getValue("Output_ab"));
#endif
#ifdef RECURRENT
cppnLinkWeightFromOutputToInputSheet = double(network.getValue("Output_recurrence"));
#endif
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
if(toPrint) {
debugFile << "Setting substrate link from ( x1: " << setw(4) << x1
<< ", y1: " << setw(4) << y1 << ") to "
<< "( x2: " << setw(4) << x2
<< ", y2: " << setw(4) << y2 << ")" << endl;
}
#endif
//cout << endl;
Node fromInputNode (x1, y1, 0); // z=0 cause its the input layer
Node *ptr_toNode;
#ifdef HIDDEN_LAYER
Node toHiddenNode (x2, y2, 1);
Node fromHiddenNode(x1, y1, 1);
Node toOutputNode (x2, y2, 2);
Node fromOutputNode (x1, y1, 2);
Node toInputNode (x2, y2, 0);
ptr_toNode = &toHiddenNode;
#else
Node toOutputNode (x2, y2, 1);
Node fromOutputNode (x1, y1, 1);
Node toInputNode (x2, y2, 0);
ptr_toNode = &toOutputNode;
#endif
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
// debugFile << "Setting substrate link from ( x1: " << setw(4) << x1
// << ", y1: " << setw(4) << y1 << ") to "
// << "( x2: " << setw(4) << x2
// << ", y2: " << setw(4) << y2 << ")" << endl;
/*
debugFile << "Setting substrate link x/y/z AB from: " << setw(4) << nameLookup[fromInputNode]
<< " to " << nameLookup[*ptr_toNode]
<< " to " << nameLookup[toHiddenNode]
<< " and BC from: " << nameLookup[fromHiddenNode] << " to " << nameLookup[toOutputNode] << endl;
*/
#endif
//assert
#ifndef USE_EXTRA_NODE
#ifdef RECURRENT
//fixme: make me
#else
if ((substrate.getLink(linkCounter)) == substrate.getLink(nameLookup[fromInputNode],nameLookup[*ptr_toNode])) {}
else {cout << "not the same" << endl; exit(9);}
#endif
#endif
//get the cppn output and set it to the relevant link the substrate
#ifdef HIDDEN_LAYER
substrateLinkWeightFromInputToHiddenSheet = zeroOrNormalize(cppnLinkWeightFromInputToHiddenSheet);
substrateLinkWeightFromHiddenToOutputSheet = zeroOrNormalize(cppnLinkWeightFromHiddenToOutputSheet);
substrate.getLink(nameLookup[fromInputNode],nameLookup[*ptr_toNode])->weight = substrateLinkWeightFromInputToHiddenSheet;
linkCounter++;
substrate.getLink(nameLookup[fromHiddenNode],nameLookup[toOutputNode])->weight = substrateLinkWeightFromHiddenToOutputSheet;
linkCounter++;
#else
substrateLinkWeightFromInputToOutputSheet = zeroOrNormalize(cppnLinkWeightFromInputToOutputSheet);
substrate.getLink(nameLookup[fromInputNode],nameLookup[*ptr_toNode])->weight = substrateLinkWeightFromInputToOutputSheet;
linkCounter++;
#endif
#ifdef RECURRENT
substrateLinkWeightFromOutputToInputSheet = zeroOrNormalize(cppnLinkWeightFromOutputToInputSheet);
substrate.getLink(nameLookup[fromOutputNode],nameLookup[toInputNode])->weight = substrateLinkWeightFromOutputToInputSheet;
#endif
if(toPrint) {
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
debugFile << " AB: " << setw(22) << setprecision(20) << substrate.getLink(nameLookup[fromInputNode],nameLookup[*ptr_toNode])->weight;
#ifdef HIDDEN_LAYER
debugFile << " BC: " << setw(22) << setprecision(20) << substrate.getLink(nameLookup[fromHiddenNode],nameLookup[toOutputNode])->weight;
#endif
#ifdef RECURRENT
debugFile << " RECUR: " << setw(22) << setprecision(20) << substrate.getLink(nameLookup[fromOutputNode],nameLookup[toInputNode])->weight;
#endif
#endif
}
#if LEGSWING_EXPERIMENT_ENABLE_BIASES
if (x2==0&&y2==0)
{
double nodeBias;
nodeBias = double(network.getValue("Bias_b"));
substrate.setBias(
nameLookup[Node(x1,y1,1)],
nodeBias
);
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
if(toPrint)
debugFile << " biasB: " << nodeBias;
#endif
nodeBias = double(network.getValue("Bias_c"));
substrate.setBias(
nameLookup[Node(x1,y1,2)],
nodeBias
);
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
if(toPrint)
debugFile << " biasC: " << nodeBias;
#endif
}
#endif
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
if(toPrint)
debugFile << endl;
#endif
}
}
}
}
//exit(3); //@end
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
if(toPrint)
debugFile << "done!\n";
#endif
#ifdef USE_EXTRA_NODE
for (int y2 = 0; y2 < numNodesY; y2++)
{
for (int x2 = 0; x2 < numNodesX; x2++)
{
int
x1 = 3,
y1 = 5;
double
x1normal,
x2normal,
y1normal,
y2normal;
x1normal = normalize(x1,numNodesX);
x2normal = normalize(x2,numNodesX);
y1normal = normalize(y1,numNodesY);
y2normal = normalize(y2,numNodesY);
network.reinitialize();
network.setValue("X1",x1normal);
network.setValue("X2",x2normal);
network.setValue("Y1",y1normal);
network.setValue("Y2",y2normal);
network.setValue("Bias",0.3);
network.update();
double cppnLinkWeightFromInputToHiddenSheet = double(network.getValue("Output_ab"));
Node fromInputNode (x1, y1, 0);
Node toHiddenNode (x2, y2, 1);
substrateLinkWeightFromInputToHiddenSheet = zeroOrNormalize(cppnLinkWeightFromInputToHiddenSheet);
substrate.getLink(nameLookup[fromInputNode],nameLookup[toHiddenNode])->weight = substrateLinkWeightFromInputToHiddenSheet;
linkCounter++;
}
}
#endif
}
double SpiderRobotExperiment::processEvaluation(shared_ptr<NEAT::GeneticIndividual> individual, bool postHocRecord = false)
{
// substrate_pointer = &substrate; //delthis? and move everything to substrate?
double substrateOutputVal;
double sineOfTimeStep;
//create empty inputs 2D vector
vector <double> rowVector;
vector <vector <double> > inputs;
for(int col=0; col< numNodesX;col++)
{
rowVector.push_back(0.0);
}
for(int row=0;row< numNodesY;row++)
{
inputs.push_back(rowVector);
}
ofstream jangle_file;
jangle_file.open ("spiderJointAngles.txt", ios::trunc );
for(int stepNum=0;stepNum < 480;stepNum++)
{
substrate.reinitialize();
substrate.dummyActivation();
sineOfTimeStep = sin(double(stepNum)/6.0)*M_PI;
inputs[0][2] = sineOfTimeStep; //TODO add sine wave value here
inputs[1][2] = 0.0; //this value remains zero
inputs[2][2] = 0.0; //this value remains zero
inputs[3][2] = 0.0; //this value remains zero
//set the values to the substrate
for(int row=0;row< numNodesY;row++) //for legs
{
for(int col=0; col< numNodesX;col++) //for columns in a row (first col is inner joint, second is outer, third is sine for the first row)
{
//set angles from previous iteration
substrate.setValue(nameLookup[HCUBE::Node(col,row,0)], inputs[row][col]);
}
}
cout << "inputting...." << endl;
print_vector_of_vectors(inputs);
substrate.update(numSheets-1);
cout << "output joints" << endl;
for(int row=0;row< numNodesY;row++) //for legs
{
for(int col=0; col< numNodesX;col++) //for columns in a row (first col is inner joint, second is outer, third is sine for the first row)
{
//set angles from previous iteration
substrateOutputVal = substrate.getValue(nameLookup[HCUBE::Node(col,row,2)]);
if(col <=1) //only print the leg values
{
jangle_file << substrateOutputVal << " ";
}
inputs[row][col] = substrateOutputVal;
}
}
jangle_file << endl;
cout << "inputs post-update" << endl;
print_vector_of_vectors(inputs);
//write them to a file
cout << "**********************" << endl;
}
jangle_file.close();
cout << "Trial Complete. "<< endl;
#ifdef SPIDERROBOT_INTERACTIVE_EVOLUTION
//OVERRIDING FITNESS FOR INTERACTIVE EVOLUTION
if(rewardOrg) return 1000*rewardOrg;
else return 1;
#endif
// if(numDirectionChanges>maxnumDirectionChanges) return 0.001;
double fitness; //JMC SPIDER FILL IN
cin >> fitness;
PRINT(fitness);
exit(2);
//printGeneticPertubationEffects(individual, fitness+1);
return fitness;
}
void SpiderRobotExperiment::processGroup(shared_ptr<NEAT::GeneticGeneration> generation)
{
shared_ptr<NEAT::GeneticIndividual> individual = group.front();
/*{
cout << "Starting Evaluation on object:" << this << endl;
cout << "Running on individual " << individual << endl;
}*/
//You get 1 point just for entering the game, wahooo!
individual->setFitness(1);
//individual->setUserData(shared_ptr<LegSwingStats>(new LegSwingStats()));
populateSubstrate(individual);
double fitness=0;
double maxFitness = 1; //starts at one because their fitness starts at one
fitness += processEvaluation(individual,NULL);
//cout<<"YOU ARE NOT EVALUATING CREATURE!!!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl;
//fitness++;
maxFitness += 4200;
individual->reward(fitness); //TODO: You are bumping fitness twice, giving you incorrect scores in the genchamp file, no?
static bool haveReportedMaxFitness = false;
if(!haveReportedMaxFitness){
cout << "maxFitness is: " << maxFitness << endl;
haveReportedMaxFitness = true;
}
#ifdef SPIDERROBOT_EXPERIMENT_DEBUG
cout << "Individual Evaluation complete!\n";
cout << "Fitness bump (does not include 1 free fitness point) was: " << fitness;
cout << "maxFitness is: " << maxFitness << endl;
#endif
}
void SpiderRobotExperiment::processIndividualPostHoc(shared_ptr<NEAT::GeneticIndividual> individual)
{
//visualize = false;
//You get 1 points just for entering the game, wahooo!
individual->setFitness(1);
//individual->setUserData(shared_ptr<LegSwingStats>(new LegSwingStats()));
populateSubstrate(individual);
printActualSubstrate();
double fitness=0;
double maxFitness = 1;
int testCases=0;
testCases++;
#ifdef POSTHOC_RECORD
printf("generating movie files. patience.");
fitness += processEvaluation(individual,true);
int result = std::system("convert -quality 100 *.ppm run.mpeg");
result = std::system("rm *.ppm");
(void) result;
#else
fitness += processEvaluation(individual,NULL);
#endif
maxFitness += 42;
cout << "TOTAL TEST CASES: " << testCases << endl;
cout << "Individual Evaluation complete!\n";
cout << maxFitness << endl;
individual->reward(fitness);
//if (fitness >= maxFitness*.95)
//{
// cout << "PROBLEM DOMAIN SOLVED!!!\n";
//}
}
Experiment* SpiderRobotExperiment::clone()
{
SpiderRobotExperiment* experiment = new SpiderRobotExperiment(*this);
return experiment;
}
void SpiderRobotExperiment::printSubstrate()
{
cout << "Printing substrate" << endl;
cout << "JMC: I think this function was hard coded for a 2-sheeted setup and does not work well. Use PrintActualSubstrate() instead." << endl;
exit(3);
ofstream substrate_file;
substrate_file.open ("substrateThatSolvedTheProblem.txt", ios::trunc );
cout << "num links: " <<substrate.getLinkCount() << endl;
substrate_file << "num links: " <<substrate.getLinkCount() << endl;
int counter=0;
for (int y1=0;y1<numNodesY;y1++)
{
for (int x1=0;x1<numNodesX;x1++)
{
for (int y2=0;y2<numNodesY;y2++)
{
for (int x2=0;x2<numNodesX;x2++)
{
if(counter > substrate.getLinkCount()){ cout << "error: you are trying to print a link that does not exist" << endl; exit(1);}
substrate_file << "from (x1,y1) to (x2,y2): (" << x1 << "," << y1 << ") to (" << x2 << "," << y2 << "): " ;
substrate_file << substrate.getLink(counter)->weight << endl;
counter++;
}
}
}
}
substrate_file.close();
return;
}
void SpiderRobotExperiment::printActualSubstrate()
{
cout << "Printing substrate" << endl;
ofstream substrate_file;
substrate_file.open ("substrateThatSolvedTheProblem.txt", ios::trunc );
int numLinks = substrate.getLinkCount();
//cout << "num links: " << numLinks << endl;
//substrate_file << "num links: " << numLinks << endl;
//cout << "num nodes: " << substrate.getNodeCount() << endl;
//substrate_file << "num nodes: " << substrate.getNodeCount() << endl;
for (int counter=0;counter<numLinks;counter++)
{
if(counter > substrate.getLinkCount()){ cout << "error: you are trying to print a link that does not exist" << endl; exit(1);}
//substrate_file << "counter: " << counter << " " << linkIndexToNameLookup[counter] << " :" << substrate.getLink(counter)->fromNode << " --> " << substrate.getLink(counter)->toNode << ": ";
//substrate_file << "link num: " << counter << " " << linkIndexToNameLookup[counter] << " : ";
substrate_file << substrate.getLink(counter)->weight << endl;
}
substrate_file.close();
return;
}
double SpiderRobotExperiment::normalize(const int & r_xyVal, const int & r_numNodesXorY)
{
// turn the xth or yth node into its coordinates on a grid from -1 to 1, e.g. x values (1,2,3,4,5) become (-1, -.5 , 0, .5, 1)
// this works with even numbers, and for x or y grids only 1 wide/tall, which was not the case for the original
// e.g. see findCluster for the orignal versions where it was not a funciton and did not work with odd or 1 tall/wide #s
double coord;
double increment = 2.0/(r_numNodesXorY-1);
if(r_numNodesXorY==1) coord = 0;
else coord = -1+(r_xyVal*increment);
return(coord);
}
void SpiderRobotExperiment::printCPPN(shared_ptr<const NEAT::GeneticIndividual> individual)
{
cout << "Printing cppn network" << endl;
ofstream network_file;
network_file.open ("CPPN-ThatSolvedTheProblem.txt", ios::trunc );
NEAT::FastNetwork <double> network = individual->spawnFastPhenotypeStack<double>(); //JMC: this creates the network CPPN associated with this individual used to produce the substrate (neural network)
network_file << "num links:" << network.getLinkCount() << endl;
network_file << "num nodes:" << network.getNodeCount() << endl;
int numLinks = network.getLinkCount();
int numNodes = network.getNodeCount();
ActivationFunction activationFunction;
//print out which node corresponds to which integer (e.g. so you can translate a fromNode of 1 to "x1"
map<string,int> localNodeNameToIndex = *network.getNodeNameToIndex();
for( map<string,int>::iterator iter = localNodeNameToIndex.begin(); iter != localNodeNameToIndex.end(); iter++ ) {
network_file << (*iter).first << " is node number: " << (*iter).second << endl;
}
for (size_t a=0;a<numLinks;a++)
{
NetworkIndexedLink<double> link = *network.getLink(a);
network_file << link.fromNode << "->" << link.toNode << " : " << link.weight << endl;
}
for (size_t a=0;a<numNodes;a++)
{
activationFunction = *network.getActivationFunction(a);
network_file << " activation function " << a << ": ";
if(activationFunction == ACTIVATION_FUNCTION_SIGMOID) network_file << "ACTIVATION_FUNCTION_SIGMOID";
if(activationFunction == ACTIVATION_FUNCTION_SIN) network_file << "ACTIVATION_FUNCTION_SIN";
if(activationFunction == ACTIVATION_FUNCTION_COS) network_file << "ACTIVATION_FUNCTION_COS";
if(activationFunction == ACTIVATION_FUNCTION_GAUSSIAN) network_file << "ACTIVATION_FUNCTION_GAUSSIAN";
if(activationFunction == ACTIVATION_FUNCTION_SQUARE) network_file << "ACTIVATION_FUNCTION_SQUARE";
if(activationFunction == ACTIVATION_FUNCTION_ABS_ROOT) network_file << "ACTIVATION_FUNCTION_ABS_ROOT";
if(activationFunction == ACTIVATION_FUNCTION_LINEAR) network_file << "ACTIVATION_FUNCTION_LINEAR";
if(activationFunction == ACTIVATION_FUNCTION_ONES_COMPLIMENT) network_file << "ACTIVATION_FUNCTION_ONES_COMPLIMENT";
if(activationFunction == ACTIVATION_FUNCTION_END) network_file << "ACTIVATION_FUNCTION_END";
network_file << endl;
}
network_file.close();
return;
}
double SpiderRobotExperiment::zeroOrNormalize(double mWeightToAlter){
assert(-1.0 <= mWeightToAlter && mWeightToAlter<= 1.0 ); // if this fails then the normalization is not valid.
return mWeightToAlter * 3.0;
}
bool SpiderRobotExperiment::converged(int generation) {
if(generation == convergence_step)
return true;
return false;
}
void SpiderRobotExperiment::print_vector_of_vectors(const vector<vector<double> > c_vector_of_vectors){
cout << endl;
for(int i=0; i< c_vector_of_vectors.size();i++) {//print rows in reverse order (since x=0 is the lowest)
for(int j=0;j<c_vector_of_vectors[i].size();j++){
cout << c_vector_of_vectors[i][j] << " ";
}
cout << endl;
}
}
}
| [
"[email protected]"
] | |
135a54782dab612adfb94e9114b992a2066ec564 | 1f05d449c725cce5046a1662b9f5b1c9313de60d | /Yellow/Week6/final/database/condition_parser.h | 2606c320f37a3d3b40af2e95d22ac7bf7690d7ac | [] | no_license | addicted-by/Belts | e5b92735fb41759ee08d65a706e5b3bcc4c4b45f | 1bec0168858ffbe3c3fc8c39dcf871f2fb11975c | refs/heads/main | 2023-07-16T02:00:44.007046 | 2021-08-31T19:27:34 | 2021-08-31T19:27:34 | 401,804,515 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 167 | h | #pragma once
#include "node.h"
#include <memory>
#include <iostream>
using namespace std;
shared_ptr<Node> ParseCondition(istream& is);
void TestParseCondition(); | [
"[email protected]"
] | |
01dbd534d4e475461b1f31e540fee0c3d283429d | a97a07b3a33e7a4adccee497b7a60f0a62299009 | /EXP综合实验三0519/EXP综合实验三0519/EXP综合实验三0519View.cpp | 3e7cad4ebe2f263069da5f5df9016bed4048720f | [] | no_license | jiangliman/JLM | 9330bb5e6eece3f1927c779b5c886a0ca45be8ed | 2c74369a396a5c5ceb908c14734246dbf6cd5f1c | refs/heads/master | 2021-03-26T08:35:44.973069 | 2020-06-24T13:24:56 | 2020-06-24T13:24:56 | 247,681,314 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,431 | cpp |
// EXP综合实验三0519View.cpp : CEXP综合实验三0519View 类的实现
//
#include "stdafx.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "EXP综合实验三0519.h"
#endif
#include "EXP综合实验三0519Set.h"
#include "EXP综合实验三0519Doc.h"
#include "EXP综合实验三0519View.h"
#include"ADD_DLG.h"
#include"EDIT_DLG.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CEXP综合实验三0519View
IMPLEMENT_DYNCREATE(CEXP综合实验三0519View, CRecordView)
BEGIN_MESSAGE_MAP(CEXP综合实验三0519View, CRecordView)
ON_BN_CLICKED(IDC_BUTTON3, &CEXP综合实验三0519View::OnBnClickedButton3)
ON_BN_CLICKED(IDABORT, &CEXP综合实验三0519View::OnBnClickedAbort)
ON_BN_CLICKED(IDC_BUTTON2, &CEXP综合实验三0519View::OnBnClickedButton2)
END_MESSAGE_MAP()
// CEXP综合实验三0519View 构造/析构
CEXP综合实验三0519View::CEXP综合实验三0519View()
: CRecordView(IDD_EXP0519_FORM)
, i(0)
{
m_pSet = NULL;
// TODO: 在此处添加构造代码
}
CEXP综合实验三0519View::~CEXP综合实验三0519View()
{
}
void CEXP综合实验三0519View::DoDataExchange(CDataExchange* pDX)
{
CRecordView::DoDataExchange(pDX);
// 可以在此处插入 DDX_Field* 函数以将控件“连接”到数据库字段,例如
// DDX_FieldText(pDX, IDC_MYEDITBOX, m_pSet->m_szColumn1, m_pSet);
// DDX_FieldCheck(pDX, IDC_MYCHECKBOX, m_pSet->m_bColumn2, m_pSet);
// 有关详细信息,请参阅 MSDN 和 ODBC 示例
DDX_Text(pDX, IDC_EDIT1, m_pSet->m_1);
}
BOOL CEXP综合实验三0519View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
return CRecordView::PreCreateWindow(cs);
}
void CEXP综合实验三0519View::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_EXP综合实验三0519Set;
CRecordView::OnInitialUpdate();
}
// CEXP综合实验三0519View 诊断
#ifdef _DEBUG
void CEXP综合实验三0519View::AssertValid() const
{
CRecordView::AssertValid();
}
void CEXP综合实验三0519View::Dump(CDumpContext& dc) const
{
CRecordView::Dump(dc);
}
CEXP综合实验三0519Doc* CEXP综合实验三0519View::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEXP综合实验三0519Doc)));
return (CEXP综合实验三0519Doc*)m_pDocument;
}
#endif //_DEBUG
// CEXP综合实验三0519View 数据库支持
CRecordset* CEXP综合实验三0519View::OnGetRecordset()
{
return m_pSet;
}
// CEXP综合实验三0519View 消息处理程序
void CEXP综合实验三0519View::OnBnClickedButton3()
{
// TODO: 在此添加控件通知处理程序代码
m_pSet->Delete();
m_pSet->MovePrev();
if (m_pSet->IsBOF())
m_pSet->MoveFirst();
UpdateData(false);
}
void CEXP综合实验三0519View::OnBnClickedAbort()
{
// TODO: 在此添加控件通知处理程序代码
ADD_DLG adddlg;
int r = adddlg.DoModal();
if (r == IDOK) {
long i = adddlg.ii;
m_pSet->AddNew();
m_pSet->m_1 = i;
m_pSet->Update();
UpdateData(false);
}
}
void CEXP综合实验三0519View::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
EDIT_DLG editdlg;
int r = editdlg.DoModal();
if (r == IDOK) {
long i = editdlg.iii;
m_pSet->Edit();
m_pSet->m_1 = i;
m_pSet->Update();
UpdateData(false);
}
}
| [
"[email protected]"
] | |
be1ab6069d78531d1c5033382f0e3c48a7974aff | 4ca0c84fb7af16b8470ab9ff408edd6d00c94f77 | /Competencias Semillero/2014/Septiembre 19/grave.cpp | eb1adb49334a9c6d684214b6d020f0636def77ac | [] | no_license | svanegas/programming_solutions | 87305a09dd2a2ea0c05b2e2fb703d5cd2b142fc0 | 32e5f6c566910e165effeb79ec34a8886edfccff | refs/heads/master | 2020-12-23T16:03:33.848189 | 2020-10-10T18:59:58 | 2020-10-10T18:59:58 | 12,229,967 | 8 | 10 | null | null | null | null | UTF-8 | C++ | false | false | 3,261 | cpp | //Santiago Vanegas Gil.
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <bitset>
#define D(x) cout << #x " is " << x << endl
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1.0);
template <class T> string toStr(const T &x)
{ stringstream s; s << x; return s.str(); }
template <class T> int toInt(const T &x)
{ stringstream s; s << x; int r; s >> r; return r; }
typedef long long ll;
struct edge {
int destX, destY;
ll weight;
edge (int DX, int DY, ll W) : destX(DX), destY(DY), weight(W) {}
};
const ll INF = 1LL << 60;
const int MAXN = 35;
int n, m, g, e;
int grass[MAXN][MAXN];
ll d[MAXN][MAXN];
vector <edge> graph[MAXN][MAXN];
enum grassType {GRASS, GRAVE, HOLE};
void
build_graph() {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
if (i == n - 1 && j == m - 1) break;
if (grass[i][j] == GRASS) {
if (i > 0 && grass[i-1][j] != GRAVE)
graph[i][j].push_back(edge(i-1, j, 1LL));
if (i < n - 1 && grass[i+1][j] != GRAVE)
graph[i][j].push_back(edge(i+1, j, 1LL));
if (j > 0 && grass[i][j-1] != GRAVE)
graph[i][j].push_back(edge(i, j-1, 1LL));
if (j < m - 1 && grass[i][j+1] != GRAVE)
graph[i][j].push_back(edge(i, j+1, 1LL));
}
}
}
}
bool
bellman_ford(int sI, int sJ) {
d[sI][sJ] = 0LL;
for (int i = 1; i <= ((n * m) - g) - 1; ++i) {
for (int u = 0; u < n; ++u) {
for (int v = 0; v < m; ++v) {
if (d[u][v] == INF) continue;
for (int k = 0; k < graph[u][v].size(); ++k) {
int nextI = graph[u][v][k].destX;
int nextJ = graph[u][v][k].destY;
ll w = graph[u][v][k].weight;
d[nextI][nextJ] = min(d[nextI][nextJ], d[u][v] + w);
}
}
}
}
for (int u = 0; u < n; ++u) {
for (int v = 0; v < m; ++v) {
for (int k = 0; k < graph[u][v].size(); ++k) {
if (d[u][v] >= INF) continue;
int nextI = graph[u][v][k].destX;
int nextJ = graph[u][v][k].destY;
ll w = graph[u][v][k].weight;
if (d[nextI][nextJ] > d[u][v] + w) return true;
}
}
}
return false;
}
int
main() {
while (scanf("%d %d", &n, &m) != EOF && n && m) {
for (int i = 0; i <= n; ++i) {
for (int j = 0; j <= m; ++j) {
grass[i][j] = GRASS;
d[i][j] = INF;
graph[i][j].clear();
}
}
scanf("%d", &g);
for (int i = 0; i < g; ++i) {
int x, y;
scanf("%d %d", &x, &y);
grass[x][y] = GRAVE;
}
scanf("%d", &e);
for (int i = 0; i < e; ++i) {
int x1, y1, x2, y2;
ll t;
scanf("%d %d %d %d %lld", &x1, &y1, &x2, &y2, &t);
grass[x1][y1] = HOLE;
graph[x1][y1].push_back(edge(x2, y2, t));
}
build_graph();
if (bellman_ford(0, 0)) printf("Never\n");
else if (d[n-1][m-1] == INF) printf("Impossible\n");
else printf("%d\n", d[n-1][m-1]);
}
return 0;
}
| [
"[email protected]"
] | |
eaa77210165aae50797b69db79318a29be1ebdbb | 84ac0f6981a5ca788e8ab15d66befb023f201c44 | /第三题.cpp | 9fb3c73d8438dfe3819f845a5e6d4ee67a10aa57 | [] | no_license | 827191466/ACM | 75d349c8438c79b44be5a3c7f01b53fba391e547 | 16a3f123bc3f9eac0ef83bfd3373e4ae3063eab9 | refs/heads/master | 2020-04-30T15:58:45.032935 | 2019-03-21T12:09:12 | 2019-03-21T12:09:12 | 176,935,284 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 791 | cpp | #include<iostream>
#include<algorithm>
using namespace std;
struct change{
int i;
int j;
};
bool cmp(change a,change b){
if(a.j!=b.j)
return a.j<b.j;
else
return a.i>b.i;
}
int main()
{
int t,t1,i,count;
string n;
cin>>t;
while(t--){
cin>>n;
int t1=n[n.length()-1]-'0';
change *t2=new change[n.length()];
count=0;
for(i=0;i<n.length()-1;i++){
if((n[i]-'0')%2==0){
t2[count].i=n[i]-'0';
t2[count].j=i;
count++;
}
}
if(count==0)
cout<<-1<<endl;
else{
sort(t2,t2+count,cmp);
for(i=0;i<count;i++)
{
if(t2[i].i<t1){
n[n.length()-1]=n[t2[i].j];
n[t2[i].j]=t1+'0';
break;
}
}
if(i==count){
n[n.length()-1]=n[t2[count-1].j];
n[t2[count-1].j]=t1+'0';
}
cout<<n<<endl;
}
}
return 0;
}
| [
"[email protected]"
] | |
73c3d596e59305140e3c859e956307c3ed12a31e | d2f5d19103e8bfb07f61e20e07e9eb75a98b4b6a | /Aether Space Dynamics Simulator/ephemeris.h | 8a02079edaf93575e8ba090beba679eda3790fa3 | [] | no_license | AetherSpaceSimulator/Source | 33aaa187c1e32b08de9a297e2256bfde719c7fd5 | 10f1d9d25340278cadf477638eac805e3a1763f5 | refs/heads/master | 2021-01-10T18:51:51.603291 | 2016-05-01T12:05:41 | 2016-05-01T12:05:41 | 57,460,555 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 727 | h | #ifndef _EPHEMERIS_H_
#define _EPHEMERIS_H_
#include "stdafx.h"
class Ephemeris_Class
{
public:
Ephemeris_Class();
Ephemeris_Class(const Ephemeris_Class&);
~Ephemeris_Class();
void Initialize();
void JdToYmd(const long lJD, int *piYear, int *piMonth, int *piDay);
bool UpdateEphemeris(std::string ephemeris_filename, double &eccentricity_, double &inclination_, double &LAN_,
double &AP_, double &TA_, double &SMA_, bool &ephemeris_ok_);
double get_calculations_epoch_c(){ return calculations_epoch_c; };
private:
int year;
int month;
int day;
std::string date_eph;
double calculations_epoch;
double calculations_epoch_b;
double calculations_epoch_c;
double date_;
};
#endif | [
"[email protected]"
] | |
fb14dd12508131355629c7ec2face68c1e90b9d2 | 313e686e0f0aa3b2535bc94c68644ca2ea7b8e61 | /src/server/game/Battlegrounds/BattlegroundQueue.h | fe3e21a38588fcdcb02ec5a3692516b8d8300b43 | [] | no_license | mysql1/TournamentCore | cf03d44094257a5348bd6c509357d512fb03a338 | 571238d0ec49078fb13f1965ce7b91c24f2ea262 | refs/heads/master | 2020-12-03T00:29:21.203000 | 2015-05-12T07:30:42 | 2015-05-12T07:30:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,680 | h | /*
* Copyright (C) 2014-2015 TournamentCore
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __BATTLEGROUNDQUEUE_H
#define __BATTLEGROUNDQUEUE_H
#include "Common.h"
#include "DBCEnums.h"
#include "Battleground.h"
#include "EventProcessor.h"
#include <deque>
//this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears
typedef std::list<Battleground*> BGFreeSlotQueueContainer;
#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10
struct GroupQueueInfo; // type predefinition
struct PlayerQueueInfo // stores information for players in queue
{
uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes
GroupQueueInfo* GroupInfo; // pointer to the associated groupqueueinfo
};
struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!)
{
std::map<ObjectGuid, PlayerQueueInfo*> Players; // player queue info map
uint32 Team; // Player team (ALLIANCE/HORDE)
BattlegroundTypeId BgTypeId; // battleground type id
bool IsRated; // rated
uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG
uint32 ArenaTeamId; // team id if rated match
uint32 JoinTime; // time when group was added
uint32 RemoveInviteTime; // time when we will remove invite for players in group
uint32 IsInvitedToBGInstanceGUID; // was invited to certain BG
uint32 ArenaTeamRating; // if rated match, inited to the rating of the team
uint32 ArenaMatchmakerRating; // if rated match, inited to the rating of the team
uint32 OpponentsTeamRating; // for rated arena matches
uint32 OpponentsMatchmakerRating; // for rated arena matches
};
enum BattlegroundQueueGroupTypes
{
BG_QUEUE_PREMADE_ALLIANCE = 0,
BG_QUEUE_PREMADE_HORDE = 1,
BG_QUEUE_NORMAL_ALLIANCE = 2,
BG_QUEUE_NORMAL_HORDE = 3
};
#define BG_QUEUE_GROUP_TYPES_COUNT 4
class Battleground;
class BattlegroundQueue
{
public:
BattlegroundQueue();
~BattlegroundQueue();
void BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0);
void UpdateEvents(uint32 diff);
void FillPlayersToBG(Battleground* bg, BattlegroundBracketId bracket_id);
bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
bool CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
GroupQueueInfo* AddGroup(Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId = 0);
void RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount);
bool IsPlayerInvited(ObjectGuid pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
bool GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo* ginfo);
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id);
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) const;
typedef std::map<ObjectGuid, PlayerQueueInfo> QueuedPlayersMap;
QueuedPlayersMap m_QueuedPlayers;
//do NOT use deque because deque.erase() invalidates ALL iterators
typedef std::list<GroupQueueInfo*> GroupsQueueType;
/*
This two dimensional array is used to store All queued groups
First dimension specifies the bgTypeId
Second dimension specifies the player's group types -
BG_QUEUE_PREMADE_ALLIANCE is used for premade alliance groups and alliance rated arena teams
BG_QUEUE_PREMADE_HORDE is used for premade horde groups and horde rated arena teams
BG_QUEUE_NORMAL_ALLIANCE is used for normal (or small) alliance groups or non-rated arena matches
BG_QUEUE_NORMAL_HORDE is used for normal (or small) horde groups or non-rated arena matches
*/
GroupsQueueType m_QueuedGroups[MAX_BATTLEGROUND_BRACKETS][BG_QUEUE_GROUP_TYPES_COUNT];
// class to select and invite groups to bg
class SelectionPool
{
public:
SelectionPool(): PlayerCount(0) { };
void Init();
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
bool KickGroup(uint32 size);
uint32 GetPlayerCount() const {return PlayerCount;}
public:
GroupsQueueType SelectedGroups;
private:
uint32 PlayerCount;
};
//one selection pool for horde, other one for alliance
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
uint32 GetPlayersInQueue(TeamId id);
private:
bool InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side);
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
// Event handler
EventProcessor m_events;
};
/*
This class is used to invite player to BG again, when minute lasts from his first invitation
it is capable to solve all possibilities
*/
class BGQueueInviteEvent : public BasicEvent
{
public:
BGQueueInviteEvent(ObjectGuid pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
{ }
virtual ~BGQueueInviteEvent() { }
virtual bool Execute(uint64 e_time, uint32 p_time) override;
virtual void Abort(uint64 e_time) override;
private:
ObjectGuid m_PlayerGuid;
uint32 m_BgInstanceGUID;
BattlegroundTypeId m_BgTypeId;
uint8 m_ArenaType;
uint32 m_RemoveTime;
};
/*
This class is used to remove player from BG queue after 1 minute 20 seconds from first invitation
We must store removeInvite time in case player left queue and joined and is invited again
We must store bgQueueTypeId, because battleground can be deleted already, when player entered it
*/
class BGQueueRemoveEvent : public BasicEvent
{
public:
BGQueueRemoveEvent(ObjectGuid pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
: m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId)
{ }
virtual ~BGQueueRemoveEvent() { }
virtual bool Execute(uint64 e_time, uint32 p_time) override;
virtual void Abort(uint64 e_time) override;
private:
ObjectGuid m_PlayerGuid;
uint32 m_BgInstanceGUID;
uint32 m_RemoveTime;
BattlegroundTypeId m_BgTypeId;
BattlegroundQueueTypeId m_BgQueueTypeId;
};
#endif
| [
"[email protected]"
] | |
0930db7e61cfd126e130e3475a47dc155da6f068 | 3edb034c4d9581a7acd831a3ea6022b626c217e8 | /crazyEights/Hand.h | 850864be2120a4c1a657c45a80acbf4004848088 | [] | no_license | degeerm/CS162-SPR2020 | 6405ccf1ac11eef1116a37b4ef8c25bdc6a060bc | c3096291ea3d86e20c5c746b2f17ae007557f942 | refs/heads/main | 2022-12-16T04:34:24.865361 | 2020-10-03T02:51:27 | 2020-10-03T02:51:27 | 300,767,397 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 622 | h | #ifndef HAND_H
#define HAND_H
#include <iostream>
#include <string>
#include <cmath>
#include "Card.h"
using namespace std;
class Hand{
private:
Card* cards;
int n_cards;
public:
Hand();
~Hand();
Hand(Hand &);
Hand(int);
Hand& operator= (const Hand&);
//Accessor/Mutator Methods
void add_one_card(Card);
Card remove_card(int);
void change_card(int, Card);
//void change_num_cards(int);
int get_num_cards();
Card* get_card_array();
//Error Handling/Status Checking
bool can_play(int, int);
bool check_suit(int);
bool check_rank(int);
void print_hand() const;
};
#endif
| [
"[email protected]"
] | |
c359096935116c80b72983b3dd33bb0f472bb70e | b54b6168ba35ce6ad34f5a26b5a4a3ab8afa124a | /kratos_3_0_0/applications/incompressible_fluid_application/custom_elements/nonewtonian_asgs_3d.h | 919ff90173be7808f884060bf325ca3bc5da8ebb | [] | no_license | svn2github/kratos | e2f3673db1d176896929b6e841c611932d6b9b63 | 96aa8004f145fff5ca6c521595cddf6585f9eccb | refs/heads/master | 2020-04-04T03:56:50.018938 | 2017-02-12T20:34:24 | 2017-02-12T20:34:24 | 54,662,269 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 15,598 | h | /*
==============================================================================
KratosIncompressibleFluidApplication
A library based on:
Kratos
A General Purpose Software for Multi-Physics Finite Element Analysis
Version 1.0 (Released on march 05, 2007).
Copyright 2007
Pooyan Dadvand, Riccardo Rossi
[email protected]
[email protected]
- CIMNE (International Center for Numerical Methods in Engineering),
Gran Capita' s/n, 08034 Barcelona, Spain
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 condition:
Distribution of this code for any commercial purpose is permissible
ONLY BY DIRECT ARRANGEMENT WITH THE COPYRIGHT OWNERS.
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.
==============================================================================
*/
//
// Project Name: Kratos
// Last Modified by: $Author: antonia $
// Date: $Date: 2009-01-21 14:14:49 $
// Revision: $Revision: 1.4 $
//
//
#if !defined(KRATOS_NONEWTONIAN_ASGS_3D_H_INCLUDED )
#define KRATOS_NONEWTONIAN_ASGS_3D_H_INCLUDED
// System includes
// External includes
#include "boost/smart_ptr.hpp"
// Project includes
#include "includes/define.h"
#include "includes/element.h"
#include "includes/ublas_interface.h"
#include "includes/variables.h"
#include "includes/serializer.h"
namespace Kratos
{
///@addtogroup IncompressibleFluidApplication
///@{
///@name Kratos Globals
///@{
///@}
///@name Type Definitions
///@{
///@}
///@name Enum's
///@{
///@}
///@name Functions
///@{
///@}
///@name Kratos Classes
///@{
/// This class allows the calculation of a Non-Newtonian fluid using a visco rigid constitutive model.
/** @author Antonia Larese De Tetto <[email protected]>
*
* This class implements a 2D linear triangular element. A non-newtonian constituve law is developed using a visco-rigid model.
* The solutions system is solved via a monolithic approach.
* The dofs per node: velocity and pressure.
* Time integration scheme: Bossak residualbased predictor-corrector @see residualbased_predictorcorrector_velocity_bossak_scheme
* Strategy: @see residualbased_newton_raphson_strategy
* Stabilization technique: ASGS (optionally OSS can be used activating the OSS_SWITCH parameter)
* Python solvers that can use this elelement: @see monolithic_solver_lagrangian_nonnewtonian, monolithic_solver_eulerian
*
*/
class NoNewtonianASGS3D
: public Element
{
public:
///@name Type Definitions
///@{
/// Counted pointer of NoNewtonianASGS3D
KRATOS_CLASS_POINTER_DEFINITION(NoNewtonianASGS3D);
///@}
///@name Life Cycle
///@{
/// Default constructor.
NoNewtonianASGS3D(IndexType NewId, GeometryType::Pointer pGeometry);
NoNewtonianASGS3D(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);
/// Destructor.
virtual ~NoNewtonianASGS3D();
///@}
///@name Operators
///@{
///@}
///@name Operations
///@{
/// Create a new element of this type
/**
* Returns a pointer to a new NoNewtonianASGS2D element, created using given input
* @param NewId: the ID of the new element
* @param ThisNodes: the nodes of the new element
* @param pProperties: the properties assigned to the new element
* @return a Pointer to the new element
*/
Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, PropertiesType::Pointer pProperties) const;
///Calculate the local external force vector and resize local sistem matrices
void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector, ProcessInfo& rCurrentProcessInfo);
///Calulate the residual (RHS) of the solution system
void CalculateRightHandSide(VectorType& rRightHandSideVector, ProcessInfo& rCurrentProcessInfo);
//virtual void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix, ProcessInfo& rCurrentProcessInfo);
/// Provides the global indices for each one of this element's local rows
/**
* this determines the elemental equation ID vector for all elemental
* DOFs
* @param rResult: A vector containing the global Id of each row
* @param rCurrentProcessInfo: the current process info object
*/
void EquationIdVector(EquationIdVectorType& rResult, ProcessInfo& rCurrentProcessInfo);
/// Returns a list of the element's Dofs
/**
* @param ElementalDofList: the list of DOFs
* @param rCurrentProcessInfo: the current process info instance
*/
void GetDofList(DofsVectorType& ElementalDofList,ProcessInfo& CurrentProcessInfo);
/// Returns the values on the integration points
/**
* @param rVariable: Kratos vector variable to compute (implemented for the variable viscosity variable and for the rate of strain variable)
* @param Output: Values of variable on integration points
* @param rCurrentProcessInfo: Process info instance
*/
void GetValueOnIntegrationPoints(const Variable<double>& rVariable, std::vector<double>& rValues, const ProcessInfo& rCurrentProcessInfo);
// void InitializeSolutionStep(ProcessInfo& CurrentProcessInfo);
void Calculate( const Variable<array_1d<double,3> >& rVariable,
array_1d<double,3>& Output,
const ProcessInfo& rCurrentProcessInfo);
void GetFirstDerivativesVector(Vector& values, int Step = 0);
void GetSecondDerivativesVector(Vector& values, int Step = 0);
// void DampMatrix(MatrixType& rDampMatrix, ProcessInfo& rCurrentProcessInfo);
///Calculate all the lhs contributions multiplied by velocity: i.e. the convective, pressure, viscous, darcy contributions
void CalculateLocalVelocityContribution(MatrixType& rDampMatrix,VectorType& rRightHandSideVector,ProcessInfo& rCurrentProcessInfo);
///@}
///@name Access
///@{
///@}
///@name Inquiry
///@{
///@}
///@name Input and output
///@{
/// Turn back information as a string.
virtual std::string Info() const
{
return "NoNewtonianASGS3D #" ;
}
/// Print information about this object.
virtual void PrintInfo(std::ostream& rOStream) const
{
rOStream << Info() << Id();
}
/// Print object's data.
// virtual void PrintData(std::ostream& rOStream) const;
///@}
///@name Friends
///@{
///@}
protected:
///@name Protected static Member Variables
///@{
///@}
///@name Protected member Variables
///@{
///Evaluates the elemental density, and (fluid) viscosity
virtual void calculatedensity(Geometry< Node<3> > geom, double& density, double& viscosity);
///Evaluates the residual of the solution system including the viscous contribution \f$ rhs = -lhs u - B^{T} \tau \f$
virtual void CalculateResidual(const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX,const MatrixType& K, VectorType& F, const double m, const double volume);
///Compute the projection in case OSS stabilization thechnique is chosen (OSS_SWITCH should be set = 1.0);
virtual void ComputeProjections(array_1d<double,12>& adv_proj , array_1d<double,4>& div_proj, const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX,const double thawone,const double thawtwo,const array_1d<double,4>& N,const double volume, const double time);
///Evaluates the following stabilization terms: \f$ (a \cdot \nabla w, \partial_{t} u) \f$
virtual void CalculateAdvMassStblTerms(MatrixType& M,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const array_1d<double,4>& N, const double thawone,const double volume);
///Evaluates the following stabilization terms: \f$ (\nabla q, \partial_{t} u) \f$
virtual void CalculateGradMassStblTerms(MatrixType& M,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const array_1d<double,4>& N,const double thawone,const double volume);
///Calculate the mass contribution to the K global matrix
virtual void CalculateMassContribution(MatrixType& K,const double time,const double volume);
///Calculate the linearized viscous contribution ONLY to the LHS @todo Make linearization works quadratically
virtual void CalculateViscousTerm(MatrixType& K,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const int it_num, const double m, const double volume);
///Calculate the advective contribution to the lhs
virtual void CalculateAdvectiveTerm(MatrixType& K,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const array_1d<double, 4 > & N, const double thawone, const double thawtwo, const double time,const double volume);
///Calculate the pressure contribution to the lhs and divergence term as well
virtual void CalculatePressureTerm(MatrixType& K,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const array_1d<double,4>& N,const double time ,const double volume);
///Calculate the following stabilization terms: \f$ (a \nabla w, \nabla \cdot u) \f$
virtual void CalculateDivStblTerm(MatrixType& K,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const double thawtwo,const double volume);
///Calculate the following stabilization terms: \f$ (a \nabla w, a \nabla w \nabla p + f) \f$ and \f$ (\nabla q, a \nabla u ) \f$
virtual void CalculateAdvStblAllTerms(MatrixType& K,VectorType& F,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX,const array_1d<double,4>& N, const double thawone,const double time,const double volume);
///Calculate the following stabilization terms: \f$ (\nabla q, \nabla p + f) \f$
virtual void CalculateGradStblAllTerms(MatrixType& K,VectorType& F,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const array_1d<double,4>& N, const double time,const double thawone,const double volume);
///Add body forces to the lhs
virtual void AddBodyForceAndMomentum(VectorType& F,const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const array_1d<double,4>& N, const double time,const double volume,const double thawone,const double thawtwo);
///Calculate stabilization parameter
virtual void CalculateTau(const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const array_1d<double,4>& N,double& thawone, double& thawtwo, const double time,const double area,const ProcessInfo& rCurrentProcessInfo);
///Add the projection in case OSS stabilization thechnique is chosen (OSS_SWITCH should be set = 1.0);
virtual void AddProjectionForces(VectorType& F, const boost::numeric::ublas::bounded_matrix<double,4,3>& DN_DX, const double volume,const double thawone,const double thawtwo);
///Calcualte the mass contributions
virtual void MassMatrix(MatrixType& rMassMatrix, ProcessInfo& rCurrentProcessInfo);
///Calculate the shape function derivatives matrix
virtual void CalculateB( boost::numeric::ublas::bounded_matrix<double, 6, 12 > & B,const boost::numeric::ublas::bounded_matrix<double, 4, 3 > & DN_DX);
///Calculate the symmetric gradient of velocity
virtual void CalculateGradSymVel(array_1d<double, 6> & grad_sym_vel, double & gamma_dot,const boost::numeric::ublas::bounded_matrix<double, 6, 12 > & B);
// virtual void CalculateApparentViscosity(double & ApparentViscosity, const double & grad_sym_vel_norm, const double & mu, const double & YeldStress, const double mcoef);
///Evaluates the viscosity of the nodes variable in function of the rate of strain
/**
* @param ApparentViscosity: \f$ \tilde{\nu} \f$ non-newtonian variable viscosity
* @param ApparentViscosityDerivative: \f$ \frac{\partial \tilde{\nu}}{\partial \gamma } \f$
* @param grad_sym_vel: Simmetric gradient of velocity \f$ \nabla^{s} u = \varepsilon \f$
* @param gamma_dot: rate of strain \f$ \gamma = \sqrt{2 \varepsilon:\varepsilon } \f$
* @param B: Matrix 3x6 of the shape function derivatives
* @param mu: fluid minimum viscosity possible
*/
virtual void CalculateApparentViscosity(double & ApparentViscosity, double & ApparentViscosityDerivative, array_1d<double,6> & grad_sym_vel, double & gamma_dot, const boost::numeric::ublas::bounded_matrix<double, 6, 12 > & B, const double & mu, const double & m_coef);
// virtual void CalculateApparentViscosityStbl(double & ApparentViscosity, double & ApparentViscosityDerivative, array_1d<double,6> & grad_sym_vel, double & gamma_dot, const boost::numeric::ublas::bounded_matrix<double, 6, 12 > & B, const double & mu);
///@}
///@name Protected Operators
///@{
///@}
///@name Serialization
///@{
// A private default constructor necessary for serialization
NoNewtonianASGS3D() : Element()
{
}
///@}
///@name Protected Operations
///@{
///@}
///@name Protected Access
///@{
///@}
///@name Protected Inquiry
///@{
///@}
///@name Protected LifeCycle
///@{
///@}
private:
///@name Static Member Variables
///@{
///@}
///@name Member Variables
///@{
// MatrixType mlhs0;
// MatrixType mKvisc0;
double mDevStress;
///@}
///@name Serialization
///@{
friend class Serializer;
virtual void save(Serializer& rSerializer) const
{
KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, Element);
rSerializer.save("DevStress",mDevStress);
}
virtual void load(Serializer& rSerializer)
{
KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, Element);
rSerializer.load("DevStress",mDevStress);
}
///@}
///@name Private Operators
///@{
///@}
///@name Private Operations
///@{
///@}
///@name Private Access
///@{
///@}
///@name Private Inquiry
///@{
///@}
///@name Un accessible methods
///@{
/// Assignment operator.
//NoNewtonianASGS3D& operator=(const NoNewtonianDASGS& rOther);
/// Copy constructor.
//NoNewtonianASGS3D(const NoNewtonianASGS& rOther);
///@}
}; // Class NoNewtonianASGS3D
///@}
///@name Type Definitions
///@{
///@}
///@name Input and output
///@{
/// input stream function
/* inline std::istream& operator >> (std::istream& rIStream,
Fluid2DASGS& rThis);
*/
/// output stream function
/* inline std::ostream& operator << (std::ostream& rOStream,
const Fluid2DASGS& rThis)
{
rThis.PrintInfo(rOStream);
rOStream << std::endl;
rThis.PrintData(rOStream);
return rOStream;
}*/
///@}
///@} IncompressibleFluidApplication group
} // namespace Kratos.
#endif // KRATOS_NONEWTONIAN_ASGS_3D_H_INCLUDED defined
| [
"pooyan@4358b7d9-91ec-4505-bf62-c3060f61107a"
] | pooyan@4358b7d9-91ec-4505-bf62-c3060f61107a |
f893775c2369b9af6ffcdb80930898cebc7ffd9e | 493ac26ce835200f4844e78d8319156eae5b21f4 | /flow_simulation/ideal_flow/processor3/0.4/k | 54accfed20d789407f0d942bcfc9d6e78b804470 | [] | no_license | mohan-padmanabha/worm_project | 46f65090b06a2659a49b77cbde3844410c978954 | 7a39f9384034e381d5f71191122457a740de3ff0 | refs/heads/master | 2022-12-14T14:41:21.237400 | 2020-08-21T13:33:10 | 2020-08-21T13:33:10 | 289,277,792 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,205 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.4";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField nonuniform List<scalar>
1431
(
3.02259
2.02208
0.48813
0.464406
0.157811
1.56663
0.195003
1.81222
1.79646
0.167101
1.64817
1.71639
1.55485
0.212923
0.191009
0.219097
0.193591
0.45224
0.181149
0.637014
2.57079
0.332837
1.86135
2.2201
1.86947
1.18466
1.24562
0.22286
0.915706
0.532509
0.80105
1.12352
0.738227
0.122455
1.41178
1.49508
2.8092
0.279964
0.435302
0.964432
2.4668
2.85459
1.38381
0.2691
1.1545
0.237131
0.37142
1.077
0.217597
0.729877
1.49534
0.385221
1.5686
2.17068
2.28432
1.47832
0.102572
2.06838
0.187394
0.272347
0.131052
0.218668
0.528531
0.334866
0.276806
0.121364
0.235826
0.49376
0.185458
0.234729
1.0615
0.135315
0.360708
0.0873269
0.209916
0.163054
0.331386
0.628168
0.2811
0.368163
0.193853
0.28552
2.26267
0.344063
1.12917
0.681404
0.195403
0.578894
1.5323
1.9759
0.571867
0.149521
0.235325
0.37965
2.13266
0.542019
2.09398
2.11058
0.289058
0.516556
1.77685
0.248862
0.228682
0.343159
0.690165
1.07255
1.41478
1.54954
1.57551
0.205272
0.243837
1.68626
0.738976
2.36478
2.2962
0.148649
0.176551
0.412563
0.45926
0.431937
0.281906
0.324251
1.22972
0.216741
0.669895
0.561725
0.399266
0.229431
0.775033
0.753252
0.175146
0.532468
1.08947
0.209836
0.852728
0.824945
0.800537
0.214395
1.2853
0.18586
0.348925
0.70691
0.197022
0.248856
1.90989
0.717471
0.565319
1.75149
0.435534
0.214918
0.607653
0.208118
1.03477
0.533386
1.37015
0.446628
1.20713
1.39197
2.14245
0.558148
1.62904
1.64515
0.250612
0.313709
1.05828
2.6639
2.35168
2.28354
0.501096
2.218
1.86193
1.78939
0.866661
1.29976
1.86409
1.19561
0.732925
1.44517
1.51133
1.37127
0.127055
0.457082
1.53837
3.30789
1.38921
1.34069
1.25479
1.72897
0.891804
1.27855
0.768462
0.960104
1.00612
1.7915
0.428821
1.24629
1.71512
1.05293
0.178177
1.4499
1.58843
0.269379
1.28368
0.248783
1.67434
0.818679
1.15353
0.171964
1.49648
1.40371
0.644822
0.220798
1.36223
1.09509
1.389
0.708397
1.09746
0.973035
1.53677
1.17758
1.32755
1.53847
0.296358
0.291492
1.45163
1.92302
1.5534
2.21741
1.2587
0.899294
1.14596
0.781889
1.04228
0.96569
1.16911
2.03445
1.29837
1.12263
0.743593
1.69126
1.16341
1.21731
1.67049
0.966888
0.930762
0.628422
1.05763
1.3026
1.40304
0.463222
0.223346
1.41
0.486459
0.346345
0.794058
2.38101
0.459568
2.28542
1.83432
1.05486
0.967483
1.27389
1.54143
0.537364
1.58763
1.42233
1.74212
2.27984
1.03151
0.0998132
1.57736
1.22568
2.12752
1.79534
1.5398
0.82877
1.49414
0.961716
0.828547
1.13657
1.7305
2.31881
0.714796
1.55837
1.98615
2.30122
2.46458
1.95286
1.14485
1.7158
0.14926
1.83111
1.86068
1.90077
0.783025
1.23095
1.48637
1.51994
0.763597
0.910408
1.67123
0.77819
2.13682
1.53266
1.16189
0.452148
1.5304
1.00043
2.81219
2.19195
1.11348
0.858928
0.174735
0.899003
1.71752
1.44705
1.14149
2.17914
0.176547
5.36617
1.32512
1.34286
0.350367
1.9251
1.30858
0.438853
0.420859
1.9333
2.35919
0.342589
1.1478
0.199167
1.85668
0.361594
0.874227
1.46785
2.07633
2.11773
1.3466
1.03426
0.687603
1.44183
0.96999
2.36122
1.76506
0.895724
1.8501
1.51285
1.01103
1.82091
0.812143
0.209898
1.92767
1.10807
0.213996
1.65462
1.08383
0.614991
1.28066
2.48959
0.339398
1.21161
1.01526
2.09006
0.188397
0.929215
1.85149
4.05916
1.24186
0.691653
1.51218
0.160832
1.68095
1.31673
2.29846
2.86027
1.21154
1.41493
0.567146
3.38557
1.72595
1.40014
1.70082
0.240837
5.36373
1.68007
1.31953
1.83537
1.05065
1.29731
1.56757
1.42078
1.46517
0.441176
1.77899
1.88397
1.84212
1.87024
1.91609
1.54803
1.01382
2.21897
1.55987
2.29681
1.29595
1.78488
1.62789
0.900343
1.61556
1.75978
1.09785
1.28066
1.73331
1.29221
1.80585
0.269931
1.05283
1.07704
1.47729
1.70299
1.63362
1.50505
1.55079
1.0609
1.67301
0.17603
0.488477
0.284448
0.793075
1.83802
1.69352
1.81191
1.97098
1.94885
2.00282
1.90179
1.76938
1.98498
1.79757
1.94094
0.204271
1.32507
0.196585
0.184301
0.21622
0.169669
0.192356
0.180263
0.2459
0.234173
0.213927
0.770754
0.211348
0.326834
0.196393
0.217796
0.303953
1.99585
0.432802
0.72712
0.26553
0.7373
1.87182
0.222767
0.648124
0.697229
0.290074
1.78659
0.750581
1.71402
0.212009
0.320819
0.29391
0.383919
1.29593
1.31228
0.641666
0.712521
0.191723
0.418232
0.390268
0.233395
1.3232
1.14558
0.311612
0.353559
0.309312
0.255741
0.926536
0.730519
1.34638
0.831421
0.9212
0.659104
0.300022
0.341053
0.891297
1.32941
1.02908
0.850587
0.811668
0.786282
0.985668
0.427752
1.29868
1.34952
0.221656
1.30657
1.14314
0.294357
0.589072
0.419819
0.28934
0.837405
0.454635
0.634272
0.704132
0.744208
0.596526
1.3457
0.584594
1.29406
1.04027
0.415013
0.937467
0.604923
1.23427
0.953107
0.21441
0.76015
1.56224
1.57623
1.28935
1.38474
1.98562
0.641273
1.59772
0.602493
1.03813
0.194146
1.81027
0.596364
2.5259
1.51181
1.56257
1.47489
1.43559
0.522794
1.82292
2.1495
1.21605
0.47738
2.15067
1.52489
0.624166
1.42728
0.606167
0.92972
0.527459
3.02453
2.16232
1.20533
1.21686
1.84452
4.3468
1.7854
1.65145
0.299537
1.04213
2.18961
1.76746
1.01999
1.74477
1.51421
1.00948
0.943117
0.58887
1.58733
1.51016
1.63177
1.78243
0.897473
0.89586
0.979827
0.976907
1.24196
0.898
1.5522
1.19026
0.543059
1.21554
2.49291
1.54762
1.41688
1.52016
1.8701
0.374664
1.26222
1.81141
1.37783
0.608236
1.29055
1.57769
1.52048
0.846234
1.22465
1.11858
0.935806
1.14476
0.188967
0.605374
1.7241
1.52339
1.51291
1.84497
2.0405
1.20033
0.683676
0.663633
1.32747
2.24236
1.40611
0.902649
1.46725
1.75569
0.756588
1.94058
0.195994
0.889888
1.5562
1.63267
1.71036
0.258233
1.70063
1.76255
0.91853
1.65821
1.95552
1.9147
1.55854
1.97238
1.33323
1.48371
1.54199
2.19056
1.62504
0.868325
1.16343
0.88046
1.20604
0.906459
2.51577
1.30698
0.903425
0.213562
1.19283
1.85805
0.76254
0.532804
1.72766
1.72461
1.90026
1.35536
1.87422
1.05716
0.690011
0.780138
0.602742
1.6538
0.250147
1.64747
2.36513
0.973795
1.89667
0.775059
0.586902
0.98399
0.360359
1.17862
1.89914
1.88483
1.67717
1.1503
0.977087
0.655733
0.498743
1.28343
1.84514
0.210323
0.858195
1.64548
1.26663
2.41016
0.716592
0.404076
2.1608
1.27158
0.552361
0.262575
1.08433
1.14354
1.01476
1.79508
0.565022
1.96293
1.00776
1.08236
1.21614
1.34722
1.53335
1.91329
1.74956
0.92891
1.42407
0.535654
2.54127
1.1698
1.55071
1.74387
1.99438
2.65929
0.841951
1.38502
1.81331
0.944386
2.03632
1.42129
1.35576
1.51014
1.99769
0.714842
2.44402
0.805732
1.81366
1.9123
1.28375
2.3304
1.32021
0.984604
0.64416
0.615812
1.88105
1.98111
0.809848
1.4564
0.914968
0.324457
0.318331
1.7852
0.236258
1.18413
1.58055
1.89685
0.227904
2.73836
1.70245
2.07426
0.265949
1.71963
1.31971
2.74409
2.06936
1.41118
0.19653
0.347983
1.45401
0.22305
0.198941
1.6197
1.61871
1.20102
1.05902
1.55006
2.22938
2.11112
1.43321
0.132008
1.76586
1.82355
1.21959
1.07226
0.833731
1.8327
0.795823
0.974926
1.24422
1.11964
1.36198
0.911011
1.2889
1.08495
0.521246
1.16914
1.88603
1.06959
0.176787
0.733347
0.968753
0.683356
1.68377
1.00076
0.34377
0.536906
1.52036
1.50744
5.18714
1.05116
1.64343
1.7857
1.21049
4.03058
0.31559
1.49234
1.29174
2.35353
2.19931
1.14597
0.194084
2.39191
1.92702
0.18193
1.47498
1.84841
1.87059
1.06081
0.632376
2.23131
0.69849
0.214248
0.632043
2.0955
1.3375
0.998226
0.946158
1.24553
2.28221
0.230534
2.30587
1.80603
1.60788
1.78422
0.43787
0.581153
1.12401
1.58675
1.94208
0.839865
2.87521
1.68669
1.4599
1.30909
0.698056
1.366
1.5851
0.352335
0.575158
1.15119
0.550398
0.663427
0.765221
1.63016
1.13106
0.792156
1.42167
1.5706
1.63798
1.4696
0.756397
1.47846
1.53558
1.8182
4.35933
1.89827
0.89935
0.25952
0.319016
0.225199
1.80584
1.5789
1.97626
1.64271
0.747321
2.01581
0.946022
3.70925
2.06296
1.36805
0.650276
0.801313
0.820928
0.817209
0.816848
0.703761
0.774282
0.56492
0.598269
0.579574
0.581063
0.588163
0.755183
0.587942
0.540132
0.551403
0.579374
0.748085
0.723037
0.566326
0.70034
0.691935
0.554137
0.68478
1.35698
1.22573
0.760297
0.586249
1.04155
0.324162
0.254533
1.22281
1.19706
0.682581
0.235039
0.920242
1.68192
2.51591
0.32258
0.249808
1.29899
0.628888
1.52458
0.23257
0.212494
2.47981
0.101802
0.666197
1.39575
1.20892
0.795144
1.15221
1.22018
0.856309
0.284759
1.42121
2.10216
1.89755
1.73873
1.20397
0.632795
0.357246
0.25715
0.638251
1.83852
0.955254
0.534794
0.623876
1.44032
0.87803
0.243379
0.443328
1.08975
0.811546
1.23246
1.79361
1.45354
1.47448
0.307074
0.342609
1.14604
0.633034
0.163302
0.0969458
1.5718
0.987106
1.00786
0.190086
0.258367
0.380268
1.07265
0.212765
5.77418
1.66601
1.10786
0.5615
2.01493
1.74729
2.20006
0.206843
1.04673
0.744553
0.134632
0.756472
1.66261
1.03005
3.00785
1.56814
0.648191
1.71036
0.585886
1.04664
0.337129
1.50468
0.899789
0.371237
1.59197
1.30661
1.38486
0.836511
2.73376
0.853805
0.745571
0.394347
1.04147
1.10015
0.29399
1.40933
1.30358
1.28614
0.456719
1.29646
1.21246
1.2511
3.4896
0.186814
0.873347
0.529375
0.348184
1.81373
2.20624
0.536054
1.7697
0.762327
1.45387
1.32493
1.61944
0.228805
1.2157
1.29418
1.34499
1.20603
2.42994
1.15364
0.0977123
0.791291
0.108418
2.01234
1.45468
1.15028
2.71621
1.73398
1.31368
1.91135
0.653936
1.46397
0.417469
0.278819
0.185439
0.907899
0.284001
1.34682
2.48254
1.59982
0.986908
2.30074
1.43974
0.702026
0.553156
1.63775
1.18914
1.58527
1.20351
2.51207
1.77793
1.21368
0.641425
1.26553
1.22952
1.21455
1.1696
1.1298
1.08908
1.22613
1.05515
0.158459
0.128653
0.146082
0.148465
0.1345
0.149242
1.73455
0.477051
2.16905
1.29969
2.09411
0.540002
0.368877
1.24473
0.715051
0.213799
1.65519
0.532587
1.13529
1.64494
0.0999844
0.8797
0.108375
2.23012
1.50251
1.34342
1.45724
0.913506
1.51313
1.13645
4.7928
1.18503
0.40877
0.854909
2.40629
0.575559
1.53414
1.16848
0.740757
1.75232
0.239535
0.170324
0.685005
0.532534
0.265105
0.333822
0.259967
0.275718
0.388325
0.800629
2.44067
2.6116
0.857573
0.344226
1.5954
1.8555
0.548479
1.13091
1.69066
1.57955
1.33438
0.228678
0.477168
0.364552
1.04761
0.186789
1.42949
1.72225
1.67769
2.26646
0.539168
1.18839
0.147085
0.613824
2.29927
1.58812
1.78586
1.05465
0.701422
1.43042
2.39515
0.850309
1.46453
1.13341
0.704534
0.290343
0.923884
0.238023
0.347666
1.58503
1.79238
0.853146
0.964761
1.50817
0.245838
2.13224
0.780572
1.62356
2.03806
0.988017
1.42949
0.748541
1.43525
1.97284
1.17025
2.33089
1.01973
0.361846
0.454903
0.22507
1.46103
2.2101
2.79748
2.08021
1.78495
0.475718
2.70028
0.130406
0.422029
0.34086
0.210738
0.477247
2.20418
0.668907
0.852727
1.23096
1.60226
0.180861
1.81841
1.18285
0.353694
0.548883
0.252595
0.107894
2.28693
0.491821
2.0143
1.18929
1.47799
1.68198
1.38654
0.804889
0.522059
0.183841
0.559848
1.49304
1.33497
1.21069
4.56038
1.12835
1.04195
1.10683
1.21353
1.07271
0.195371
1.73871
0.888833
1.78547
1.51334
1.89045
2.87377
0.757874
0.204587
1.39543
0.210539
0.690551
1.36461
1.41148
2.20395
1.61712
1.71934
1.37555
1.33452
1.37922
0.2266
0.540916
0.600031
0.219796
0.698497
1.15796
1.76739
1.22446
1.25825
0.674259
0.585984
0.860604
1.14174
0.73101
1.30292
1.9813
2.19987
1.24391
0.162648
1.35297
1.49214
1.84134
2.05793
1.53661
0.833742
0.529156
1.00113
0.390438
1.1401
0.867001
1.30538
2.37873
1.90192
0.325751
0.352976
1.7999
1.34025
0.855314
1.33372
0.195095
2.39029
0.967452
0.75685
0.749364
4.03739
1.48451
1.94418
0.616065
0.504264
1.22485
1.36384
1.82452
0.960443
0.875136
0.465672
3.45543
0.116841
1.47806
2.0627
0.817677
1.6625
2.43735
1.72678
2.48846
1.06101
0.709743
0.314271
1.87265
1.08631
0.111696
1.21932
0.188512
2.1556
1.01124
2.79921
0.659315
0.147641
0.10192
1.24043
1.29332
0.215372
0.683882
2.30596
0.220684
0.386106
0.544965
2.27558
0.602563
1.11981
0.120502
0.650161
1.28603
1.73309
3.08135
1.07001
1.49789
0.121233
0.549389
0.780112
1.05562
0.19286
1.63007
0.672252
0.813281
0.818203
1.08851
1.89168
1.06832
0.185218
1.23612
0.767813
0.494439
1.04518
1.68271
0.326202
0.662124
0.720877
0.822889
1.1463
0.184932
0.17356
1.79916
1.48015
1.00688
1.15109
0.660939
0.863202
0.738374
1.2774
0.597188
0.545214
0.42909
0.336558
0.115422
0.679986
1.79235
1.20125
0.683572
1.78327
0.818304
1.4182
1.25589
0.681124
0.184299
0.214503
0.927648
1.24477
0.183669
0.577535
0.395229
0.940961
0.333206
0.740669
1.20889
1.70925
0.446202
0.713749
1.05415
0.824804
0.364986
0.106457
0.754233
0.389535
0.885589
1.23703
0.202095
0.48162
1.04204
1.94374
0.273427
0.555054
0.185097
0.630068
0.554141
0.126173
)
;
boundaryField
{
frontAndBack
{
type empty;
}
wallOuter
{
type kqRWallFunction;
value nonuniform List<scalar>
96
(
0.915706
0.532509
0.542019
0.973795
0.98399
0.977087
0.858195
0.716592
0.404076
1.27158
0.262575
1.14354
0.565022
1.00776
1.21614
1.32021
0.984604
0.615812
0.132008
0.974926
0.176787
1.06081
0.632376
1.3375
0.998226
0.650276
0.801313
0.820928
0.817209
0.816848
0.703761
0.774282
0.56492
0.598269
0.579574
0.581063
0.588163
0.755183
0.587942
0.540132
0.551403
0.579374
0.748085
0.723037
0.566326
0.70034
0.691935
0.554137
0.68478
0.666197
0.955254
0.534794
0.633034
0.0969458
1.00786
0.648191
0.836511
0.873347
0.529375
0.536054
1.34499
0.0977123
0.108418
1.15028
1.18914
1.20351
1.21368
0.641425
1.26553
1.22952
1.21455
1.1696
1.1298
1.08908
1.22613
1.05515
0.158459
0.128653
0.146082
0.148465
0.1345
0.149242
0.540002
0.0999844
0.532534
0.539168
1.01973
0.107894
1.33497
1.30292
0.833742
0.529156
0.116841
1.06101
1.01124
0.10192
)
;
}
inlet
{
type fixedValue;
value nonuniform 0();
}
outlet
{
type zeroGradient;
}
wallInner
{
type kqRWallFunction;
value nonuniform List<scalar>
126
(
0.187394
0.272347
0.131052
0.218668
0.528531
0.334866
0.276806
0.121364
0.235826
0.49376
0.185458
0.234729
1.0615
0.135315
0.360708
0.0873269
0.209916
0.163054
0.331386
0.628168
0.2811
0.368163
0.193853
0.28552
0.516556
0.148649
0.176551
0.412563
0.45926
0.431937
0.281906
0.324251
1.22972
0.216741
0.669895
0.561725
0.399266
0.175146
0.532468
0.18586
0.348925
0.197022
0.248856
0.565319
0.214918
0.208118
0.533386
1.05828
0.127055
1.34069
1.25479
0.428821
0.644822
0.0998132
0.828547
1.13657
0.14926
1.48637
1.51994
0.910408
0.77819
0.858928
0.174735
0.899003
0.438853
0.420859
1.1478
1.03426
0.687603
0.614991
1.21161
1.01526
0.900343
1.07704
0.427752
0.454635
0.76015
0.602493
0.596364
0.522794
0.47738
0.527459
1.00948
1.58733
1.19026
2.49291
0.608236
0.902649
0.258233
2.19056
1.30698
1.96293
1.08236
1.31971
0.89935
1.80584
0.811546
0.701422
0.659315
0.147641
0.214503
0.927648
0.183669
0.395229
0.940961
0.333206
1.20889
0.446202
0.713749
1.05415
0.824804
0.364986
0.106457
0.389535
0.885589
1.23703
0.202095
0.48162
1.04204
1.94374
0.273427
0.555054
0.185097
0.630068
0.554141
0.126173
)
;
}
procBoundary3to1
{
type processor;
value nonuniform List<scalar>
48
(
2.96161
2.35618
2.61723
3.14646
1.65119
2.35963
2.35618
0.539199
1.8703
0.276029
0.276029
0.270585
0.270585
0.832444
0.705921
0.26492
0.296504
0.266871
0.296504
0.261188
0.855088
0.824444
0.261188
1.60575
0.291342
0.252049
0.689298
0.824444
0.630844
0.505066
0.505066
0.546712
0.546712
1.8703
0.237061
1.49153
0.716643
0.291342
2.60692
1.39542
0.832444
1.12579
1.36276
0.261188
0.597665
0.990983
1.59083
0.890649
)
;
}
procBoundary3to2
{
type processor;
value nonuniform List<scalar>
29
(
0.774325
0.774325
0.114829
0.147272
0.194054
0.376178
0.309563
0.551005
0.230527
0.218341
0.576231
0.303117
0.642696
0.52968
0.34652
0.467087
0.188259
0.202911
0.589131
0.59192
0.47212
0.188259
0.166469
0.202911
0.275012
0.193653
0.202911
0.437722
0.437722
)
;
}
}
// ************************************************************************* //
| [
"[email protected]"
] | ||
1518aacb20c0e765764e807c7707b4cb500572c1 | e6b17aee390d8cb9c76ea373a9be1d64e9044e23 | /code/main/Temperature.cpp | 9330584ad333dac0f6f01a267a4e56d3e6320c30 | [] | no_license | brendonCM/High-altitude-balloon-platform | 025e97b5027fa24737a271620c8aab40dde407dc | ae020121790f0b06074abf8cda71acc2805fe80b | refs/heads/master | 2021-06-18T07:38:17.223766 | 2021-02-21T11:08:44 | 2021-02-21T11:08:44 | 154,193,744 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,084 | cpp | #include "Temperature.h"
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <stdlib.h>
using namespace std;
#define Analog_Path "/sys/bus/iio/devices/iio:device0/in_voltage"
Temperature::Temperature(int pin):pin_number{pin}
{
Read_Analog_Input();
Calc_Temp();
}
float Temperature::Get_Temp()
{
return internal_temperature;
}
void Temperature::Read_Analog_Input()
{
stringstream pin_path;
pin_path << Analog_Path << pin_number << "_raw";
ifstream path_file(pin_path.str().c_str(),ios_base::in);
if (path_file.good())
{
path_file >> analog_value;
}
else
{
cerr << "Could not open path :" << pin_path.str() << endl;
}
}
void Temperature::Calc_Temp()
{
float cur_voltage = analog_value * (3.30f / 3000.0f) - 0.1421;
// to check if voltage is close to zero
if (cur_voltage < 0)
cur_voltage = 0;
internal_temperature = (cur_voltage - 0.5f) / 0.01f;
// to set the temperature to zero, becuase if not zero, internal temp does not work
if (internal_temperature < 0){internal_temperature = 0;}
}
Temperature::~Temperature()
{
}
| [
"localhost"
] | localhost |
84074132f816e1580bdfe5ca58da31527a3b39d8 | 948f4e13af6b3014582909cc6d762606f2a43365 | /testcases/juliet_test_suite/testcases/CWE122_Heap_Based_Buffer_Overflow/s10/CWE122_Heap_Based_Buffer_Overflow__c_src_char_cat_73a.cpp | 13f06080cfe5414768f1f6403806a1a493db8532 | [] | no_license | junxzm1990/ASAN-- | 0056a341b8537142e10373c8417f27d7825ad89b | ca96e46422407a55bed4aa551a6ad28ec1eeef4e | refs/heads/master | 2022-08-02T15:38:56.286555 | 2022-06-16T22:19:54 | 2022-06-16T22:19:54 | 408,238,453 | 74 | 13 | null | 2022-06-16T22:19:55 | 2021-09-19T21:14:59 | null | UTF-8 | C++ | false | false | 2,851 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_src_char_cat_73a.cpp
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_src.label.xml
Template File: sources-sink-73a.tmpl.cpp
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Initialize data as a large string
* GoodSource: Initialize data as a small string
* Sinks: cat
* BadSink : Copy data to string using strcat
* Flow Variant: 73 Data flow: data passed in a list from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <list>
#include <wchar.h>
using namespace std;
namespace CWE122_Heap_Based_Buffer_Overflow__c_src_char_cat_73
{
#ifndef OMITBAD
/* bad function declaration */
void badSink(list<char *> dataList);
void bad()
{
char * data;
list<char *> dataList;
data = (char *)malloc(100*sizeof(char));
/* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */
memset(data, 'A', 100-1); /* fill with 'A's */
data[100-1] = '\0'; /* null terminate */
/* Put data in a list */
dataList.push_back(data);
dataList.push_back(data);
dataList.push_back(data);
badSink(dataList);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declarations */
/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink(list<char *> dataList);
static void goodG2B()
{
char * data;
list<char *> dataList;
data = (char *)malloc(100*sizeof(char));
/* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */
memset(data, 'A', 50-1); /* fill with 'A's */
data[50-1] = '\0'; /* null terminate */
/* Put data in a list */
dataList.push_back(data);
dataList.push_back(data);
dataList.push_back(data);
goodG2BSink(dataList);
}
void good()
{
goodG2B();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
using namespace CWE122_Heap_Based_Buffer_Overflow__c_src_char_cat_73; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| [
"[email protected]"
] | |
5e2de10739a8963eacf63fd4c3de3ff00bda1c10 | 2db94860142aafab6384432454d53c26961000c9 | /include/gkm_world/process_spawn.cpp | 465ef66ec6026d6abd1f78f4a65f956b99afbc99 | [
"BSD-2-Clause"
] | permissive | PetrPPetrov/gkm-world | beaef1cd0e4a194378e4f4105d7d230e454cffc8 | 7c24d1646e04b439733a7eb603c9a00526b39f4c | refs/heads/master | 2021-11-12T19:53:19.418391 | 2021-09-15T20:15:06 | 2021-09-15T20:15:06 | 224,483,703 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 647 | cpp | // Copyright 2018-2020 Petr Petrovich Petrov. All rights reserved.
// License: https://github.com/PetrPPetrov/gkm-world/blob/master/LICENSE
#ifdef _WIN32
#define _SCL_SECURE_NO_WARNINGS
#endif
#ifdef _WIN32
#define BOOST_USE_WINDOWS_H
#define WIN32_LEAN_AND_MEAN
#include <boost/process/windows.hpp>
#endif
#include <boost/process.hpp>
#include "process_spawn.h"
std::string findNodeServerPath() {
return boost::process::search_path("node_server").generic_string();
}
void processSpawn(const std::string& executable_name, const std::string& node_server_port_number) {
boost::process::spawn(executable_name, node_server_port_number);
}
| [
"[email protected]"
] | |
49dfa6b9c14ebfe41c43aaf16f93db079d9111a9 | f905dd28978e857a4345de7eeab7c6ea8d4abe2a | /include/opengv/types.hpp | 9b8b241956f4b243ca9e0344d1d725435b6c24b1 | [] | no_license | jhuxiang/opengv | 299ad7db250eed3c218d8fd9940bceec0d5e4b11 | acd24febbd92e05c2352f611ed73a3c7204995df | refs/heads/master | 2021-01-17T21:03:51.200693 | 2013-10-21T01:53:05 | 2013-10-21T01:53:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,901 | hpp | /******************************************************************************
* Author: Laurent Kneip *
* Contact: [email protected] *
* License: Copyright (c) 2013 Laurent Kneip, ANU. 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 ANU 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 ANU OR THE 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. *
******************************************************************************/
/**
* \file types.hpp
* \brief A collection of variables used in geometric vision for the
* computation of calibrated absolute and relative pose.
*/
#ifndef OPENGV_TYPES_HPP_
#define OPENGV_TYPES_HPP_
#include <stdlib.h>
#include <vector>
#include <Eigen/Eigen>
/**
* \brief The namespace of this library.
*/
namespace opengv
{
/** A 3-vector of unit length used to describe landmark observations/bearings
* in camera frames (always expressed in camera frames)
*/
typedef Eigen::Vector3d
bearingVector_t;
/** An array of bearing-vectors */
typedef std::vector<bearingVector_t, Eigen::aligned_allocator<bearingVector_t> >
bearingVectors_t;
/** A 3-vector describing a translation/camera position */
typedef Eigen::Vector3d
translation_t;
/** An array of translations */
typedef std::vector<translation_t, Eigen::aligned_allocator<translation_t> >
translations_t;
/** A rotation matrix */
typedef Eigen::Matrix3d
rotation_t;
/** An array of rotation matrices as returned by fivept_kneip [7] */
typedef std::vector<rotation_t, Eigen::aligned_allocator<rotation_t> >
rotations_t;
/** A 3x4 transformation matrix containing rotation \f$ \mathbf{R} \f$ and
* translation \f$ \mathbf{t} \f$ as follows:
* \f$ \left( \begin{array}{cc} \mathbf{R} & \mathbf{t} \end{array} \right) \f$
*/
typedef Eigen::Matrix<double,3,4>
transformation_t;
/** An array of transformations */
typedef std::vector<transformation_t, Eigen::aligned_allocator<transformation_t> >
transformations_t;
/** A 3-vector containing the cayley parameters of a rotation matrix */
typedef Eigen::Vector3d
cayley_t;
/** Essential matrix \f$ \mathbf{E} \f$ between two viewpoints:
*
* \f$ \mathbf{E} = \f$ skew(\f$\mathbf{t}\f$) \f$ \mathbf{R} \f$,
*
* where \f$ \mathbf{t} \f$ describes the position of viewpoint 2 seen from
* viewpoint 1, and \f$\mathbf{R}\f$ describes the rotation from viewpoint 2
* to viewpoint 1.
*/
typedef Eigen::Matrix3d
essential_t;
/** An array of essential matrices */
typedef std::vector<essential_t, Eigen::aligned_allocator<essential_t> >
essentials_t;
/** An essential matrix with complex entires (as returned from
* fivept_stewenius [5])
*/
typedef Eigen::Matrix3cd
complexEssential_t;
/** An array of complex-type essential matrices */
typedef std::vector< complexEssential_t, Eigen::aligned_allocator< complexEssential_t> >
complexEssentials_t;
/** A 3-vector describing a point in 3D-space */
typedef Eigen::Vector3d
point_t;
/** An array of 3D-points */
typedef std::vector<point_t, Eigen::aligned_allocator<point_t> >
points_t;
/** A 3-vector containing the Eigenvalues of matrix \f$ \mathbf{M} \f$ in the
* eigensolver-algorithm (described in [11])
*/
typedef Eigen::Vector3d
eigenvalues_t;
/** A 3x3 matrix containing the eigenvectors of matrix \f$ \mathbf{M} \f$ in the
* eigensolver-algorithm (described in [11])
*/
typedef Eigen::Matrix3d
eigenvectors_t;
/** EigensolverOutput holds the output-parameters of the eigensolver-algorithm
* (described in [11])
*/
typedef struct EigensolverOutput
{
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
/** Position of viewpoint 2 seen from viewpoint 1 (unscaled) */
translation_t translation;
/** Rotation from viewpoint 2 back to viewpoint 1 */
rotation_t rotation;
/** The eigenvalues of matrix \f$ \mathbf{M} \f$ */
eigenvalues_t eigenvalues;
/** The eigenvectors of matrix matrix \f$ \mathbf{M} \f$ */
eigenvectors_t eigenvectors;
} eigensolverOutput_t;
}
#endif /* OPENGV_TYPES_HPP_ */
| [
"[email protected]"
] | |
0302296729251082a0ac6915d9a0435259ef12a7 | f300d0ce28fa7c3bc1788bddefc69d894bac8932 | /Sources/Message Coder/message_encoder.h | e6c262fbe6e6a171333f254c39f38fe6b9aa03a1 | [] | no_license | zzfd97/TCM-Simulator | 42251ba7cc8cc3f617cf7ca035d031332062fbe3 | b636dc341c6028f54d4e339a0289517f1449c8a1 | refs/heads/master | 2021-12-16T14:04:25.960626 | 2017-09-19T21:48:54 | 2017-09-19T21:48:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 543 | h | //
// message_encoder.h
// TCM-Simulator
//
// Created by Szymon Mrozek on 17.05.2017.
// Copyright © 2017 Szymon Mrozek. All rights reserved.
//
#ifndef message_encoder_h
#define message_encoder_h
#include <string>
#include <vector>
class MessageEncoder{
public:
MessageEncoder();
~MessageEncoder();
void encode(std::string new_message);
std::vector<char>* getCharStream();
private:
std::string message_;
std::vector<char>* char_output_stream_;
};
#endif /* message_encoder_h */
| [
"[email protected]"
] | |
24368870852da1001ebf55ccd54d53262d2967db | f2c7ef303988ee8c491bc84ff8f1594820b7abe4 | /test/at.t.cpp | e716f5a57282081a6fe6468a4a63abfc3b900801 | [
"MIT"
] | permissive | SiwenZhang/gsl-lite | 17e555a18e0dfd7b3b80d9ece69bdf5445c7743a | 11d1839f8dfcbdde99071bf3807dee2d7929848a | refs/heads/master | 2021-01-13T09:34:04.035021 | 2016-10-09T18:55:23 | 2016-10-09T18:57:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,399 | cpp | //
// gsl-lite is based on GSL: Guideline Support Library,
// https://github.com/microsoft/gsl
//
// Copyright (c) 2015 Martin Moene
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "gsl-lite.t.h"
CASE( "at(): Terminates access to non-existing C-array elements" )
{
int a[] = { 1, 2, 3, 4 };
EXPECT_THROWS( at(a, 4) );
}
CASE( "at(): Terminates access to non-existing std::array elements (C++11)" )
{
#if gsl_HAVE_ARRAY
std::array<int, 4> a = {{ 1, 2, 3, 4 }};
EXPECT_THROWS( at(a, 4) );
#else
EXPECT( !!"std::array<> is not available (no C++11)" );
#endif
}
CASE( "at(): Terminates access to non-existing std::vector elements" )
{
std::vector<int> a; // = { 1, 2, 3, 4 };
for ( int i = 0; i < 4; ++i )
{
a.push_back( i + 1 );
}
EXPECT_THROWS( at(a, 4) );
}
CASE( "at(): Terminates access to non-existing std::initializer_list elements (C++11)" )
{
// Note: GCC 4.6.3 has std::initializer_list but selects at(Cont & cont,...) overload.
#if gsl_HAVE_INITIALIZER_LIST && ( !gsl_COMPILER_GCC_VERSION || gsl_COMPILER_GCC_VERSION >= 473 )
std::initializer_list<int> a = { 1, 2, 3, 4 };
EXPECT_THROWS( at(a, 4) );
#else
EXPECT( !!"std::initializer_list<> is not available (no C++11)" );
#endif
}
CASE( "at(): Terminates access to non-existing gsl::span elements" )
{
int arr[] = { 1, 2, 3, 4 };
span<int> a( arr );
EXPECT_THROWS( at(a, 4) );
}
CASE( "at(): Allows access to existing C-array elements" )
{
int a[] = { 1, 2, 3, 4 };
for ( int i = 0; i < 4; ++i )
{
EXPECT( at(a, i) == i + 1 );
}
}
CASE( "at(): Allows access to existing std::array elements (C++11)" )
{
#if gsl_HAVE_ARRAY
std::array<int, 4> a = {{ 1, 2, 3, 4 }};
for ( int i = 0; i < 4; ++i )
{
EXPECT( at(a, i) == i + 1 );
}
#else
EXPECT( !!"std::array<> is not available (no C++11)" );
#endif
}
CASE( "at(): Allows access to existing std::vector elements" )
{
std::vector<int> a; // = { 1, 2, 3, 4 };
for ( int i = 0; i < 4; ++i )
{
a.push_back( i + 1 );
EXPECT( at(a, i) == i + 1 );
}
}
CASE( "at(): Allows access to std::initializer_list elements (C++11)" )
{
// Note: GCC 4.6.3 has std::initializer_list but selects at(Cont & cont,...) overload.
#if gsl_HAVE_INITIALIZER_LIST && ( !gsl_COMPILER_GCC_VERSION || gsl_COMPILER_GCC_VERSION >= 473 )
std::initializer_list<int> a = { 1, 2, 3, 4 };
for ( int i = 0; i < 4; ++i )
{
EXPECT( at(a, i) == i + 1 );
}
#else
EXPECT( !!"std::initializer_list<> is not available (no C++11)" );
#endif
}
CASE( "at(): Allows access to gsl::span elements" )
{
int arr[] = { 1, 2, 3, 4 };
span<int> a( arr );
for ( int i = 0; i < 4; ++i )
{
EXPECT( at(a, i) == i + 1 );
}
}
// end of file
| [
"[email protected]"
] | |
5f746bcd31a7cf13a6a5a8eda928b62b05cbf8ff | 73cfd700522885a3fec41127e1f87e1b78acd4d3 | /_Include/boost/date_time/date_facet.hpp | 98c69dd91d3f1a5dc0257280d7231c9e4788c439 | [] | no_license | pu2oqa/muServerDeps | 88e8e92fa2053960671f9f57f4c85e062c188319 | 92fcbe082556e11587887ab9d2abc93ec40c41e4 | refs/heads/master | 2023-03-15T12:37:13.995934 | 2019-02-04T10:07:14 | 2019-02-04T10:07:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 30,307 | hpp | ////////////////////////////////////////////////////////////////////////////////
// date_facet.hpp
#ifndef _DATE_TIME_DATE_FACET__HPP___
#define _DATE_TIME_DATE_FACET__HPP___
/* Copyright (c) 2004-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Martin Andrian, Jeff Garland, Bart Garst
* $Date$
*/
#include <locale>
#include <string>
#include <vector>
#include <iterator> // ostreambuf_iterator
#include <boost/throw_exception.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/period.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/special_values_formatter.hpp>
#include <boost/date_time/period_formatter.hpp>
#include <boost/date_time/period_parser.hpp>
#include <boost/date_time/date_generator_formatter.hpp>
#include <boost/date_time/date_generator_parser.hpp>
#include <boost/date_time/format_date_parser.hpp>
namespace boost { namespace date_time {
/*! Class that provides format based I/O facet for date types.
*
* This class allows the formatting of dates by using format string.
* Format strings are:
*
* - %A => long_weekday_format - Full name Ex: Tuesday
* - %a => short_weekday_format - Three letter abbreviation Ex: Tue
* - %B => long_month_format - Full name Ex: October
* - %b => short_month_format - Three letter abbreviation Ex: Oct
* - %x => standard_format_specifier - defined by the locale
* - %Y-%b-%d => default_date_format - YYYY-Mon-dd
*
* Default month format == %b
* Default weekday format == %a
*/
template <class date_type,
class CharT,
class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > >
class date_facet : public std::locale::facet {
public:
typedef typename date_type::duration_type duration_type;
// greg_weekday is gregorian_calendar::day_of_week_type
typedef typename date_type::day_of_week_type day_of_week_type;
typedef typename date_type::day_type day_type;
typedef typename date_type::month_type month_type;
typedef boost::date_time::period<date_type,duration_type> period_type;
typedef std::basic_string<CharT> string_type;
typedef CharT char_type;
typedef boost::date_time::period_formatter<CharT> period_formatter_type;
typedef boost::date_time::special_values_formatter<CharT> special_values_formatter_type;
typedef std::vector<std::basic_string<CharT> > input_collection_type;
// used for the output of the date_generators
typedef date_generator_formatter<date_type, CharT> date_gen_formatter_type;
typedef partial_date<date_type> partial_date_type;
typedef nth_kday_of_month<date_type> nth_kday_type;
typedef first_kday_of_month<date_type> first_kday_type;
typedef last_kday_of_month<date_type> last_kday_type;
typedef first_kday_after<date_type> kday_after_type;
typedef first_kday_before<date_type> kday_before_type;
static const char_type long_weekday_format[3];
static const char_type short_weekday_format[3];
static const char_type long_month_format[3];
static const char_type short_month_format[3];
static const char_type default_period_separator[4];
static const char_type standard_format_specifier[3];
static const char_type iso_format_specifier[7];
static const char_type iso_format_extended_specifier[9];
static const char_type default_date_format[9]; // YYYY-Mon-DD
static std::locale::id id;
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
std::locale::id& __get_id (void) const { return id; }
#endif
explicit date_facet(::size_t a_ref = 0)
: std::locale::facet(a_ref),
//m_format(standard_format_specifier)
m_format(default_date_format),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format)
{}
explicit date_facet(const char_type* format_str,
const input_collection_type& short_names,
::size_t ref_count = 0)
: std::locale::facet(ref_count),
m_format(format_str),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
m_month_short_names(short_names)
{}
explicit date_facet(const char_type* format_str,
period_formatter_type per_formatter = period_formatter_type(),
special_values_formatter_type sv_formatter = special_values_formatter_type(),
date_gen_formatter_type dg_formatter = date_gen_formatter_type(),
::size_t ref_count = 0)
: std::locale::facet(ref_count),
m_format(format_str),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
m_period_formatter(per_formatter),
m_date_gen_formatter(dg_formatter),
m_special_values_formatter(sv_formatter)
{}
void format(const char_type* const format_str) {
m_format = format_str;
}
virtual void set_iso_format()
{
m_format = iso_format_specifier;
}
virtual void set_iso_extended_format()
{
m_format = iso_format_extended_specifier;
}
void month_format(const char_type* const format_str) {
m_month_format = format_str;
}
void weekday_format(const char_type* const format_str) {
m_weekday_format = format_str;
}
void period_formatter(period_formatter_type per_formatter) {
m_period_formatter= per_formatter;
}
void special_values_formatter(const special_values_formatter_type& svf)
{
m_special_values_formatter = svf;
}
void short_weekday_names(const input_collection_type& short_names)
{
m_weekday_short_names = short_names;
}
void long_weekday_names(const input_collection_type& long_names)
{
m_weekday_long_names = long_names;
}
void short_month_names(const input_collection_type& short_names)
{
m_month_short_names = short_names;
}
void long_month_names(const input_collection_type& long_names)
{
m_month_long_names = long_names;
}
void date_gen_phrase_strings(const input_collection_type& new_strings,
typename date_gen_formatter_type::phrase_elements beg_pos=date_gen_formatter_type::first)
{
m_date_gen_formatter.elements(new_strings, beg_pos);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const date_type& d) const
{
if (d.is_special()) {
return do_put_special(next, a_ios, fill_char, d.as_special());
}
//The following line of code required the date to support a to_tm function
return do_put_tm(next, a_ios, fill_char, to_tm(d), m_format);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const duration_type& dd) const
{
if (dd.is_special()) {
return do_put_special(next, a_ios, fill_char, dd.get_rep().as_special());
}
typedef std::num_put<CharT, OutItrT> num_put;
if (std::has_facet<num_put>(a_ios.getloc())) {
return std::use_facet<num_put>(a_ios.getloc()).put(next, a_ios, fill_char, dd.get_rep().as_number());
}
else {
num_put* f = new num_put();
std::locale l = std::locale(a_ios.getloc(), f);
a_ios.imbue(l);
return f->put(next, a_ios, fill_char, dd.get_rep().as_number());
}
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const month_type& m) const
{
//if (d.is_special()) {
// return do_put_special(next, a_ios, fill_char, d.as_special());
//}
//The following line of code required the date to support a to_tm function
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
dtm.tm_mon = m - 1;
return do_put_tm(next, a_ios, fill_char, dtm, m_month_format);
}
//! puts the day of month
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const day_type& day) const
{
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
dtm.tm_mday = day.as_number();
char_type tmp[3] = {'%','d'};
string_type temp_format(tmp);
return do_put_tm(next, a_ios, fill_char, dtm, temp_format);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const day_of_week_type& dow) const
{
//if (d.is_special()) {
// return do_put_special(next, a_ios, fill_char, d.as_special());
//}
//The following line of code required the date to support a to_tm function
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
dtm.tm_wday = dow;
return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const period_type& p) const
{
return m_period_formatter.put_period(next, a_ios, fill_char, p, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const partial_date_type& pd) const
{
return m_date_gen_formatter.put_partial_date(next, a_ios, fill_char, pd, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const nth_kday_type& nkd) const
{
return m_date_gen_formatter.put_nth_kday(next, a_ios, fill_char, nkd, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const first_kday_type& fkd) const
{
return m_date_gen_formatter.put_first_kday(next, a_ios, fill_char, fkd, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const last_kday_type& lkd) const
{
return m_date_gen_formatter.put_last_kday(next, a_ios, fill_char, lkd, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const kday_before_type& fkb) const
{
return m_date_gen_formatter.put_kday_before(next, a_ios, fill_char, fkb, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const kday_after_type& fka) const
{
return m_date_gen_formatter.put_kday_after(next, a_ios, fill_char, fka, *this);
}
protected:
virtual OutItrT do_put_special(OutItrT next,
std::ios_base& /*a_ios*/,
char_type /*fill_char*/,
const boost::date_time::special_values sv) const
{
m_special_values_formatter.put_special(next, sv);
return next;
}
virtual OutItrT do_put_tm(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const tm& tm_value,
string_type a_format) const
{
// update format string with custom names
if (m_weekday_long_names.size()) {
boost::algorithm::replace_all(a_format,
long_weekday_format,
m_weekday_long_names[tm_value.tm_wday]);
}
if (m_weekday_short_names.size()) {
boost::algorithm::replace_all(a_format,
short_weekday_format,
m_weekday_short_names[tm_value.tm_wday]);
}
if (m_month_long_names.size()) {
boost::algorithm::replace_all(a_format,
long_month_format,
m_month_long_names[tm_value.tm_mon]);
}
if (m_month_short_names.size()) {
boost::algorithm::replace_all(a_format,
short_month_format,
m_month_short_names[tm_value.tm_mon]);
}
// use time_put facet to create final string
const char_type* p_format = a_format.c_str();
return std::use_facet<std::time_put<CharT> >(a_ios.getloc()).put(next, a_ios,
fill_char,
&tm_value,
p_format,
p_format + a_format.size());
}
protected:
string_type m_format;
string_type m_month_format;
string_type m_weekday_format;
period_formatter_type m_period_formatter;
date_gen_formatter_type m_date_gen_formatter;
special_values_formatter_type m_special_values_formatter;
input_collection_type m_month_short_names;
input_collection_type m_month_long_names;
input_collection_type m_weekday_short_names;
input_collection_type m_weekday_long_names;
private:
};
template <class date_type, class CharT, class OutItrT>
std::locale::id date_facet<date_type, CharT, OutItrT>::id;
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::long_weekday_format[3] = {'%','A'};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::short_weekday_format[3] = {'%','a'};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::long_month_format[3] = {'%','B'};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::short_month_format[3] = {'%','b'};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::default_period_separator[4] = { ' ', '/', ' '};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] =
{'%', 'x' };
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] =
{'%', 'Y', '%', 'm', '%', 'd' };
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] =
{'%', 'Y', '-', '%', 'm', '-', '%', 'd' };
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::default_date_format[9] =
{'%','Y','-','%','b','-','%','d'};
//! Input facet
template <class date_type,
class CharT,
class InItrT = std::istreambuf_iterator<CharT, std::char_traits<CharT> > >
class date_input_facet : public std::locale::facet {
public:
typedef typename date_type::duration_type duration_type;
// greg_weekday is gregorian_calendar::day_of_week_type
typedef typename date_type::day_of_week_type day_of_week_type;
typedef typename date_type::day_type day_type;
typedef typename date_type::month_type month_type;
typedef typename date_type::year_type year_type;
typedef boost::date_time::period<date_type,duration_type> period_type;
typedef std::basic_string<CharT> string_type;
typedef CharT char_type;
typedef boost::date_time::period_parser<date_type, CharT> period_parser_type;
typedef boost::date_time::special_values_parser<date_type,CharT> special_values_parser_type;
typedef std::vector<std::basic_string<CharT> > input_collection_type;
typedef format_date_parser<date_type, CharT> format_date_parser_type;
// date_generators stuff goes here
typedef date_generator_parser<date_type, CharT> date_gen_parser_type;
typedef partial_date<date_type> partial_date_type;
typedef nth_kday_of_month<date_type> nth_kday_type;
typedef first_kday_of_month<date_type> first_kday_type;
typedef last_kday_of_month<date_type> last_kday_type;
typedef first_kday_after<date_type> kday_after_type;
typedef first_kday_before<date_type> kday_before_type;
static const char_type long_weekday_format[3];
static const char_type short_weekday_format[3];
static const char_type long_month_format[3];
static const char_type short_month_format[3];
static const char_type four_digit_year_format[3];
static const char_type two_digit_year_format[3];
static const char_type default_period_separator[4];
static const char_type standard_format_specifier[3];
static const char_type iso_format_specifier[7];
static const char_type iso_format_extended_specifier[9];
static const char_type default_date_format[9]; // YYYY-Mon-DD
static std::locale::id id;
explicit date_input_facet(::size_t a_ref = 0)
: std::locale::facet(a_ref),
m_format(default_date_format),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
m_year_format(four_digit_year_format),
m_parser(m_format, std::locale::classic())
// default period_parser & special_values_parser used
{}
explicit date_input_facet(const string_type& format_str,
::size_t a_ref = 0)
: std::locale::facet(a_ref),
m_format(format_str),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
m_year_format(four_digit_year_format),
m_parser(m_format, std::locale::classic())
// default period_parser & special_values_parser used
{}
explicit date_input_facet(const string_type& format_str,
const format_date_parser_type& date_parser,
const special_values_parser_type& sv_parser,
const period_parser_type& per_parser,
const date_gen_parser_type& date_gen_parser,
::size_t ref_count = 0)
: std::locale::facet(ref_count),
m_format(format_str),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
m_year_format(four_digit_year_format),
m_parser(date_parser),
m_date_gen_parser(date_gen_parser),
m_period_parser(per_parser),
m_sv_parser(sv_parser)
{}
void format(const char_type* const format_str) {
m_format = format_str;
}
virtual void set_iso_format()
{
m_format = iso_format_specifier;
}
virtual void set_iso_extended_format()
{
m_format = iso_format_extended_specifier;
}
void month_format(const char_type* const format_str) {
m_month_format = format_str;
}
void weekday_format(const char_type* const format_str) {
m_weekday_format = format_str;
}
void year_format(const char_type* const format_str) {
m_year_format = format_str;
}
void period_parser(period_parser_type per_parser) {
m_period_parser = per_parser;
}
void short_weekday_names(const input_collection_type& weekday_names)
{
m_parser.short_weekday_names(weekday_names);
}
void long_weekday_names(const input_collection_type& weekday_names)
{
m_parser.long_weekday_names(weekday_names);
}
void short_month_names(const input_collection_type& month_names)
{
m_parser.short_month_names(month_names);
}
void long_month_names(const input_collection_type& month_names)
{
m_parser.long_month_names(month_names);
}
void date_gen_element_strings(const input_collection_type& col)
{
m_date_gen_parser.element_strings(col);
}
void date_gen_element_strings(const string_type& first,
const string_type& second,
const string_type& third,
const string_type& fourth,
const string_type& fifth,
const string_type& last,
const string_type& before,
const string_type& after,
const string_type& of)
{
m_date_gen_parser.element_strings(first,second,third,fourth,fifth,last,before,after,of);
}
void special_values_parser(special_values_parser_type sv_parser)
{
m_sv_parser = sv_parser;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
date_type& d) const
{
d = m_parser.parse_date(from, to, m_format, m_sv_parser);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
month_type& m) const
{
m = m_parser.parse_month(from, to, m_month_format);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
day_of_week_type& wd) const
{
wd = m_parser.parse_weekday(from, to, m_weekday_format);
return from;
}
//! Expects 1 or 2 digit day range: 1-31
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
day_type& d) const
{
d = m_parser.parse_var_day_of_month(from, to);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
year_type& y) const
{
y = m_parser.parse_year(from, to, m_year_format);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
duration_type& dd) const
{
// skip leading whitespace
while(std::isspace(*from) && from != to) { ++from; }
/* num_get.get() will always consume the first character if it
* is a sign indicator (+/-). Special value strings may begin
* with one of these signs so we'll need a copy of it
* in case num_get.get() fails. */
char_type c = '\0';
// TODO Are these characters somewhere in the locale?
if(*from == '-' || *from == '+') {
c = *from;
}
typedef std::num_get<CharT, InItrT> num_get;
typename duration_type::duration_rep_type val = 0;
std::ios_base::iostate err = std::ios_base::goodbit;
if (std::has_facet<num_get>(a_ios.getloc())) {
from = std::use_facet<num_get>(a_ios.getloc()).get(from, to, a_ios, err, val);
}
else {
num_get* ng = new num_get();
std::locale l = std::locale(a_ios.getloc(), ng);
a_ios.imbue(l);
from = ng->get(from, to, a_ios, err, val);
}
if(err & std::ios_base::failbit){
typedef typename special_values_parser_type::match_results match_results;
match_results mr;
if(c == '-' || c == '+') { // was the first character consumed?
mr.cache += c;
}
m_sv_parser.match(from, to, mr);
if(mr.current_match == match_results::PARSE_ERROR) {
boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"));
BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return from); // should never reach
}
dd = duration_type(static_cast<special_values>(mr.current_match));
}
else {
dd = duration_type(val);
}
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
period_type& p) const
{
p = m_period_parser.get_period(from, to, a_ios, p, duration_type::unit(), *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
nth_kday_type& nkd) const
{
nkd = m_date_gen_parser.get_nth_kday_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
partial_date_type& pd) const
{
pd = m_date_gen_parser.get_partial_date_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
first_kday_type& fkd) const
{
fkd = m_date_gen_parser.get_first_kday_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
last_kday_type& lkd) const
{
lkd = m_date_gen_parser.get_last_kday_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
kday_before_type& fkb) const
{
fkb = m_date_gen_parser.get_kday_before_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
kday_after_type& fka) const
{
fka = m_date_gen_parser.get_kday_after_type(from, to, a_ios, *this);
return from;
}
protected:
string_type m_format;
string_type m_month_format;
string_type m_weekday_format;
string_type m_year_format;
format_date_parser_type m_parser;
date_gen_parser_type m_date_gen_parser;
period_parser_type m_period_parser;
special_values_parser_type m_sv_parser;
private:
};
template <class date_type, class CharT, class OutItrT>
std::locale::id date_input_facet<date_type, CharT, OutItrT>::id;
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::long_weekday_format[3] = {'%','A'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::short_weekday_format[3] = {'%','a'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::long_month_format[3] = {'%','B'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::short_month_format[3] = {'%','b'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::four_digit_year_format[3] = {'%','Y'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::two_digit_year_format[3] = {'%','y'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::default_period_separator[4] = { ' ', '/', ' '};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] =
{'%', 'x' };
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] =
{'%', 'Y', '%', 'm', '%', 'd' };
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] =
{'%', 'Y', '-', '%', 'm', '-', '%', 'd' };
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::default_date_format[9] =
{'%','Y','-','%','b','-','%','d'};
} } // namespaces
#endif
/////////////////////////////////////////////////
// vnDev.Games - Trong.LIVE - DAO VAN TRONG //
////////////////////////////////////////////////////////////////////////////////
| [
"[email protected]"
] | |
927fa9b287334e8eb672e31c7ee09879724e1cd3 | f52f707ec84d92d6dba89c7727dd1ac04a39751e | /branches/VAST-0.3.4/ACE_wrappers/ace/config-win32-ghs.h | 38c1d82c0d784897f316995eeac8839198c0cfe0 | [] | no_license | jonathlela/vast | aaf280cbe022a3aba9d74e2a23be5b3440c62b83 | 85f32b246e9d22011bd2b18554fef4005ab354b3 | refs/heads/master | 2020-06-07T23:41:46.051207 | 2011-04-12T18:35:00 | 2011-04-12T18:35:00 | 1,603,636 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,235 | h | // -*- C++ -*-
// config-win32-ghs.h,v 4.12 2006/02/10 09:44:33 jwillemsen Exp
// The following configuration file contains defines for Green Hills compilers.
#ifndef ACE_CONFIG_WIN32_GHS_H
#define ACE_CONFIG_WIN32_GHS_H
#include /**/ "ace/pre.h"
#ifndef ACE_CONFIG_WIN32_H
#error Use config-win32.h in config.h instead of this header
#endif /* ACE_CONFIG_WIN32_H */
#ifndef WIN32
# define WIN32
#endif /* WIN32 */
#undef _M_IX86
// This turns on ACE_HAS_PENTIUM
#define _M_IX86 500
// GHS does not provide DLL support
#define ACE_HAS_DLL 0
#define TAO_HAS_DLL 0
#undef _DLL
//Green Hills Native x86 does not support structural exceptions
# undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS
# undef ACE_HAS_WCHAR
# define ACE_CONFIG_INCLUDE_GHS_COMMON
# include "ace/config-ghs-common.h"
// Changed ACE_TEXT to ACE_LIB_TEXT in the following line
# define ACE_CC_NAME ACE_LIB_TEXT ("Green Hills C++")
# define ACE_CC_MAJOR_VERSION (1)
# define ACE_CC_MINOR_VERSION (8)
# define ACE_CC_BETA_VERSION (9)
# define ACE_CC_PREPROCESSOR "GCX.EXE"
# define ACE_CC_PREPROCESSOR_ARGS "-E"
// GHS uses Microsoft's standard cpp library, which has auto_ptr.
# undef ACE_LACKS_AUTO_PTR
// Microsoft's standard cpp library auto_ptr doesn't have reset ().
# define ACE_AUTO_PTR_LACKS_RESET
#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS)
// This section below was extracted from config-win32-msvc
#define ACE_HAS_ITOA
#define ACE_ITOA_EQUIVALENT ::_itoa
#define ACE_STRCASECMP_EQUIVALENT ::_stricmp
#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp
#define ACE_WCSDUP_EQUIVALENT ::_wcsdup
// This section above was extracted from config-win32-msvc
# define ACE_EXPORT_NESTED_CLASSES 1
# define ACE_HAS_CPLUSPLUS_HEADERS 1
//# define ACE_HAS_EXCEPTIONS 1
# define ACE_HAS_GNU_CSTRING_H 1
# define ACE_HAS_NONCONST_SELECT_TIMEVAL 1
# define ACE_HAS_SIG_ATOMIC_T 1
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
# define ACE_HAS_STDCPP_STL_INCLUDES 1
# define ACE_HAS_STRERROR 1
# define ACE_HAS_STRING_CLASS 1
# define ACE_HAS_STRPTIME 1
# define ACE_HAS_TEMPLATE_SPECIALIZATION 1
# define ACE_HAS_TEMPLATE_TYPEDEFS 1
# define ACE_HAS_TYPENAME_KEYWORD 1
//# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION
# define ACE_HAS_USER_MODE_MASKS 1
# define ACE_LACKS_ACE_IOSTREAM 1
//# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1
# define ACE_LACKS_NATIVE_STRPTIME 1
//# define ACE_LACKS_PRAGMA_ONCE 1
# define ACE_LACKS_STRRECVFD 1
//# define ACE_NEW_THROWS_EXCEPTIONS 1
# define ACE_SIZEOF_LONG_DOUBLE 10
# define ACE_TEMPLATES_REQUIRE_SOURCE 1
// Changed ACE_TEXT to ACE_LIB_TEXT in the following two lines
# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u")
# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d")
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
// Set the following to zero to placate SString.h ACE_WString CTOR
# undef ACE_WSTRING_HAS_USHORT_SUPPORT
// Green Hills Native x86 does not support __int64 keyword
# define ACE_LACKS_LONGLONG_T
/* need to ensure these are included before <iomanip> */
# include <time.h>
# include <stdlib.h>
# if !defined (ACE_LD_DECORATOR_STR) && defined (_DEBUG)
# define ACE_LD_DECORATOR_STR ACE_LIB_TEXT ("d")
# endif
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_GHS_H */
| [
"cavour@e31416da-b748-0410-9b4e-cac2f8189b79"
] | cavour@e31416da-b748-0410-9b4e-cac2f8189b79 |
fe030ab2f4f8d5996d12a541a455de6fc35a201e | 82815230eeaf24d53f38f2a3f144dd8e8d4bc6b5 | /Airfoil/wingMotion/wingMotion2D_pimpleFoam/0.46/uniform/cumulativeContErr | f8b71886635406ac2805df337c41eb7400376354 | [
"MIT"
] | permissive | ishantja/KUHPC | 6355c61bf348974a7b81b4c6bf8ce56ac49ce111 | 74967d1b7e6c84fdadffafd1f7333bf533e7f387 | refs/heads/main | 2023-01-21T21:57:02.402186 | 2020-11-19T13:10:42 | 2020-11-19T13:10:42 | 312,429,902 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 962 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedScalarField;
location "0.46/uniform";
object cumulativeContErr;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
value -5.714523903e-10;
// ************************************************************************* //
| [
"[email protected]"
] | ||
9fa5988923536e716f40840aee7f2ae5e75fed1f | 654ef9cdc43ad3b21750d4d6f3fbac90d89dd901 | /1.6 Ballot 2.0/main.cpp | b03f89c638b0ec9600905c537c6fbf1ce102960a | [] | no_license | hylade/Procedure-Design-Game | 48ae61ee2d8f27494e61bed037ab7576c3e9b022 | 1267bbf379c8ce2c355406998effed5d091db2f4 | refs/heads/master | 2020-03-22T20:01:33.996290 | 2018-09-07T04:24:21 | 2018-09-07T04:24:21 | 140,568,266 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,439 | cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAX_N = 1000;
bool Binary_search(int x, int n, int k[]){ //通过二分搜索,降低时间复杂度,由O(n^4)变为O(n^3logn)
int l = 0, r = n;
while (r - l >= 1)
{
int i = (r + l) / 2;
if (k[i] == x)
{
return true;
}
else if(k[i] < x)
{
l = i + 1;
}
else
{
r = i;
}
}
return false;
}
int main()
{
int n, m, k[MAX_N];
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++)
{
scanf("%d", &k[i]);
}
sort(k, k+n); // sort函数有三个参数,第三个参数是排序的方法,可以正序,也可以倒序,此参数可以不填;
// 其余两个参数必填,第一个参数是数组的起始地址,第二个是结束地址
bool f = false;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
for (int a = 0; a < n; a++)
{
if (Binary_search(m - k[i] - k[j] - k[a], n, k))
{
f = true;
}
}
}
}
if (f)
{
printf("YES");
}
else
{
printf("NO");
}
return 0;
}
| [
"[email protected]"
] | |
68f94f4593dde52c95c2cbbbc658bd5069df3f2d | d3fe85d57034c1020f6e9d4ad2fc4ffb8e95fd1a | /src/person.h | 28692ca122f7cdaa1981e88a2cfc3031366370ce | [] | no_license | cormaccrehan/People-Simulation | af40f820d4409970f974e663023d35d5ae81ebd5 | a69d21833a31fa0d1d1f2b09f556bbe795b3f6d0 | refs/heads/main | 2023-06-16T23:22:00.911170 | 2021-07-08T18:59:21 | 2021-07-08T18:59:21 | 384,217,191 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,170 | h | #ifndef PERSON_H
#define PERSON_H
#include "ofMain.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
using namespace glm;
//references used in code:
//https://openframeworks.cc/documentation/3d/ofNode/#show_rotateDeg
//https://www.youtube.com/watch?v=uWzPe_S-RVE&t=1551s
//Boids class example
class Person
{
public:
Person();
~Person();
Person(const Person& t);//copy constructor
void move(ofVec3f velocity);//to be called in update
void updateInteraction(vector<Person>& _people, float checkdist,float boundradius, float bouncespeed, int _personNum);//to be called in update
void draw();
ofVec3f getVelocity();
ofVec3f getPosition();
void setPosition(float x, float y, float z);
private:
void helloInteraction();//for hello movement
void resetArmAfterWave();//set arm back to original position after waive
void checkBoundary(float speed, float size);//checks to see if gone out of radius
void walkingAngles();//double pendulum calculation for leg movement
//various direction vectors
ofVec3f oppositeVelocity(); //to apply to people after waive
ofVec3f setVelocity(ofVec3f _velocity);
ofVec3f velocity;
ofVec3f personPos;
//person interaction data
void personInteraction(vector<Person>& _people,int _personNum);
int startInteractionTimerClock();
int personStopTimer = 0;
//collision booleans
bool getCollision();
bool setCollisionOpposite();
bool setCollisionFalse();
bool isCollision = false;
float distToCheck; //check distance from boundery
//position for getPosition vector
float xPos;
float yPos;
float zPos;
void moveAngleCalc(float x, float z);
void moveLegs();
//right arm
ofBoxPrimitive backArm;
ofBoxPrimitive frontArm;
ofSpherePrimitive shoulderJoint;
ofSpherePrimitive armJoint;
//other arm
ofBoxPrimitive backArm1;
ofBoxPrimitive frontArm1;
ofSpherePrimitive shoulderJoint1;
ofSpherePrimitive armJoint1;
//other arm
ofBoxPrimitive thigh; //backarm
ofBoxPrimitive shin;//front arm
ofSpherePrimitive thighJoint;//thighJoint
ofSpherePrimitive knee;//armjoint
//other arm
ofBoxPrimitive thigh1;
ofBoxPrimitive shin1;
ofSpherePrimitive thighJoint1;
ofSpherePrimitive knee1;
//body
ofBoxPrimitive body;
//head
ofSpherePrimitive head;
// data members for pendulum equation
float a1 = 0;
float a2 = 0;
float r1 = 200;
float r2 = 200;
float m1 = 40;
float m2 = 40;
float x1;
float x2;
float y1;
float y2;
float a1Deg = 30;
float a2Deg = 20;
float a1_v = 0;
float a2_v = 0;
float a2_a = 0;
float g = 1;
float degRot = 0;//delete
float pa1;
float pa2;
ofNode rotation;
float w;
float x;
float y;
float z;
float myX; //tester
float armPosx = -100;
float armPosy = -100;
float sizeScale = 0.5;
bool leftLeg = true;
};
#endif
| [
"[email protected]"
] | |
95f7f291b11054176579c616187be4e6bdbcfa18 | eb50a330cb3d2402d17bee9a5f91f2b372c1e1c1 | /Codeforces/array and operation.cpp | 6c339457fa9c09e7629987582fd264c1ee57c9c4 | [] | no_license | MaxSally/Competitive_Programming | 2190552a8c8a97d13f33d5fdbeb94c5d92fa9038 | 8c57924224ec0d1bbc5f17078505ef8864f4caa3 | refs/heads/master | 2023-04-27T22:28:19.276998 | 2023-04-12T22:47:10 | 2023-04-12T22:47:10 | 270,885,835 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,553 | cpp | //https://codeforces.com/problemset/problem/498/C
/*
* Author : MaxSally
*/
/******** All Required Header Files ********/
#include<bits/stdc++.h>
using namespace std;
/******* All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i <= k ; ++i)
#define rrep(i, j, k) for (int i = j; i >= k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
#define inf (int) (1e9 + 7)
#define epsi 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define read(type) readInt<type>()
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define left tuyiuoi
#define right fgjhk
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) rep(i, l, r) cout << a[i] << " "; cout << endl
#define flagHere cout << "here" << endl;
const double pi=acos(-1.0);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
const int N = 105;
struct Edge{
int v, rev, c, f;
};
vector<Edge> g[N];
int n, m, a[N], p[N], q[N], numPow[N];
class MaxFlow{
private:
vi pNode, pEdge, delta;
bool bfs(int s, int t){
queue<int> q; q.push(s);
vector<bool> visited; visited.resize(N, 0); visited[s] = 1;
delta.assign(N, inf); pNode.assign(N, -1); pEdge.assign(N, -2);
while(!q.empty()){
//debuga1(visited, 0, N - 1);
int u = q.front(); q.pop();
rep(i, 0, g[u].size() - 1){
Edge e = g[u][i];
//flagHere
if(visited[e.v] || e.c - e.f == 0) continue;
visited[e.v] = 1;
q.push(e.v);
delta[e.v] = min(delta[u], e.c - e.f);
pEdge[e.v] = i;
pNode[e.v] = u;
}
}
/*rep(i, 0, N - 1){
if(g[i].size()){
cout << i << endl;
rep(j, 0, g[i].size() - 1){
cout << g[i][j].v << " " << g[i][j].c << " " << g[i][j].f << endl;
}
cout << endl;
}
}*/
return visited[t];
}
int increaseFlow(int s, int t){
double df = delta[t];
for(int cur = t; cur != s; cur = pNode[cur]){
int node = pNode[cur], edge = pEdge[cur];
g[node][edge].f += df;
g[cur][g[node][edge].rev].f -= df;
}
return delta[t];
}
public:
void addEdge(int u, int v, int c){
g[u].pb({v, g[v].size(), c, 0});
g[v].pb({u, g[u].size() - 1, 0, 0});
}
int findMaxFlow(int div){
mem(numPow, 0);
rep(i, 0, n){
g[i].clear();
}
rep(i, 1, n){
while(a[i] % div == 0){
a[i] /= div;
numPow[i]++;
}
}
rep(i, 1, m){
addEdge(p[i], q[i], min(numPow[p[i]], numPow[q[i]]));
}
rep(i, 1, n){
if(i % 2){
addEdge(0, i, numPow[i]);
}else{
addEdge(i, n + 1, numPow[i]);
}
}
int maximumFlow = 0;
int s = 0, t = n + 1;
while(bfs(s, t)){
maximumFlow += increaseFlow(s, t);
}
return maximumFlow;
}
};
int main(){
io
freopen("input.txt","r",stdin);
cin >> n >> m;
MaxFlow MF;
rep(i, 1, n){
cin >> a[i];
}
rep(i, 1, m){
cin >> p[i] >> q[i];
if(q[i] % 2) swap(p[i], q[i]);
}
int res = 0;
rep(i, 1, n){
rep(j, 2, (int) sqrt(a[i])){
if(a[i] % j == 0)
res += MF.findMaxFlow(j);
}
if(a[i] > 1) res += MF.findMaxFlow(a[i]);
}
cout << res;
return 0;
}
| [
"[email protected]"
] | |
d3e5550ed6ead41f7ff9cf2798867a4fa960522b | de69bc4d515ad056e8da223e945b96c0dc2bc94e | /new-circle/forward2.cxx | 3612a297ac87b5f81dc948c872ef8522c0f8f254 | [] | no_license | seanbaxter/circle | b7d9f7e25734f005d91b20b3f91ea68fa3cb9e34 | f260a80b4279ef7276edeef3b9a3f5f4a0ca6e7c | refs/heads/master | 2023-08-28T15:55:22.091193 | 2023-05-02T19:05:14 | 2023-05-02T19:05:14 | 170,960,160 | 1,992 | 76 | null | 2023-08-19T21:54:34 | 2019-02-16T03:55:15 | C++ | UTF-8 | C++ | false | false | 478 | cxx | // T&& is now freed up to mean rvalue reference.
#feature on forward
void f1(forward auto x); // This is a forwarding parameter.
void f2(auto&& x); // This is an rvalue reference parameter.
int main() {
int x = 1;
f1(1); // Pass an xvalue to the forward parameter.
f1(x); // Pass an lvalue to the forward parameter.
f2(1); // Pass an xvalue to rvalue reference parameter.
f2(x); // Error: cannot pass an lvalue to the rvalue reference parameter.
}
| [
"[email protected]"
] | |
1ab5357e625e8e322a1e7929a37a180072fa5aff | 2bc417eabc94baf5612ef547e429e15c985afa2a | /SpinEngine/Source/Gameplay/ExtendBlock.h | 70b2a22f23b9082f2cfdea14d34ba0ff50ebcae9 | [] | no_license | TeamSpinningChairs/SpinEngine | 30c73bb8e3d98d4162593731dd9101daa0f86e9c | 0d766fd7715530a37259cc60942931bdf1d20220 | refs/heads/master | 2020-05-18T10:43:02.106178 | 2015-02-13T07:52:11 | 2015-02-13T07:52:11 | 30,432,413 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,112 | h | /****************************************************************************/
/*!
\author Steven Gallwas
\par email: s.gallwas\@digipen.edu
\par Course: GAM 200
\brief
This file contains the implementation for the base messaging system.
Copyright: All content @ 2014 DigiPen (USA) Corporation, all rights reserved.
*/
/****************************************************************************/
#pragma once
#include "SwitchComponent.h"
#include "IComponent.h"
#include "IEntity.h"
#include "TileMapDetection.h"
#define CREATE_DELAY 0.25f
enum SpawnDIR
{
SPAWN_UP,
SPAWN_DOWN,
SPAWN_LEFT,
SPAWN_RIGHT,
SPAWN_TOTAL
};
struct SpawnInstruction
{
SpawnInstruction(int dir, int numblocks);
int Direction;
int NumBlocks;
};
// I might want this for later
class BlockSpawner : public IComponent
{
public:
bool Initialize();
void Serialize (DynamicElement* props, Serializer::DataNode* data) {}
void Update(float dt);
void Release();
void RestartInstruction();
void PauseInstruction();
void AddInstruction(SpawnInstruction NewInstruction);
void ClearAllInstructions();
void RepeatAllInstructions();
private:
// pointer to the last block that was made
GameObject CurrentBlock;
// array of instruction structs, so we can tell the block to do things
std::vector<SpawnInstruction> Instructions;
SwitchComponent * Blockswitch;
int CurrentInstruction;
int BlocksMade;
float CreateTimer;
};
// component for the level 2 platforms
class ExtendBlock : public IComponent
{
public:
ExtendBlock(GameObject);
bool Initialize();
void Serialize (DynamicElement* props, Serializer::DataNode* data) {}
void Update(float dt);
void Release();
void DeactivateDirection(int direction);
void ActivateDirection(int direction);
void SetCreateTimer(float timer);
private:
float CreateTimer;
TileMapDetection * TileDetection;
bool CreateDirections[SPAWN_TOTAL];
Vector3D CurrentBlockPosition[SPAWN_TOTAL];
//std::vector<bool> CreateDirections;
//std::vector<Vector3D> CurrentBlockPosition;
void CreateBlock(int Direction);
SwitchComponent * BlockSwitch;
}; | [
"[email protected]"
] | |
e768a5db079acb3b80155853c5686b720e94eca5 | ad594d3d1cc6fe4c34b596d9564a7b1bf54a2f7a | /13.cpp | 4d00fa888ec1b141564423818cb1b35038661a25 | [] | no_license | colinlee1999/leetcode | 16199151de09073754e2d209af170fd3b489bb21 | 5ada773459ca45a942113a96581550a1b1af9987 | refs/heads/master | 2020-05-21T23:13:27.766217 | 2017-08-23T06:07:28 | 2017-08-23T06:07:28 | 61,930,482 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,154 | cpp | #include "iostream"
#include "vector"
#include "set"
#include "map"
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
Solution() {
alpha.insert(pair<char,int>('M',1000));
alpha.insert(pair<char,int>('D',500));
alpha.insert(pair<char,int>('C',100));
alpha.insert(pair<char,int>('L',50));
alpha.insert(pair<char,int>('X',10));
alpha.insert(pair<char,int>('V',5));
alpha.insert(pair<char,int>('I',1));
order_string = "MDCLXVI";
}
int romanToInt(string s) {
if (s.length() > 0)
{
size_t pos;
for (string::iterator it = order_string.begin(); it != order_string.end(); it++)
{
if ((pos = s.find(*it)) != s.npos) break;
}
return alpha[s[pos]] - romanToInt(s.substr(0, pos)) + romanToInt(s.substr(pos + 1));
}
else
{
return 0;
}return 0;
}
private:
map<char, int> alpha;
string order_string;
};
int main()
{
Solution s;
cout<<s.romanToInt("DCXLVIII")<<endl;
cout<<s.romanToInt("MMDXLIX")<<endl;
cout<<s.romanToInt("MCMXLIV")<<endl;
cout<<s.romanToInt("MCMXCIX")<<endl;
cin.get();
}
| [
"[email protected]"
] | |
b0b467436e05bb6ae16058c198ceb281ad77f2e7 | e82b166c7ad87494f9235c425d47e4b07f9dd50a | /torch/csrc/jit/tensorexpr/loopnest.cpp | 82b2a14e914c4b94687eb4ec7d492f3135138769 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | lkskstlr/pytorch | ecb73f27f1f35963d5e8d7d693bdc6a8ca955bc1 | ca6441a397471f3278b7f50683c2cd5d53cd6dff | refs/heads/master | 2022-05-23T06:37:20.321028 | 2020-04-25T10:33:11 | 2020-04-25T10:33:11 | 258,746,769 | 1 | 0 | NOASSERTION | 2020-04-25T10:21:01 | 2020-04-25T10:21:00 | null | UTF-8 | C++ | false | false | 46,341 | cpp | #include <torch/csrc/jit/tensorexpr/loopnest.h>
#include <queue>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <c10/util/Logging.h>
#include <c10/util/string_utils.h>
#include <torch/csrc/jit/tensorexpr/bounds_inference.h>
#include <torch/csrc/jit/tensorexpr/eval.h>
#include <torch/csrc/jit/tensorexpr/expr.h>
#include <torch/csrc/jit/tensorexpr/ir.h>
#include <torch/csrc/jit/tensorexpr/ir_mutator.h>
#include <torch/csrc/jit/tensorexpr/ir_printer.h>
#include <torch/csrc/jit/tensorexpr/ir_simplifier.h>
#include <torch/csrc/jit/tensorexpr/tensor.h>
namespace torch {
namespace jit {
namespace tensorexpr {
namespace {
// Evaluates a constant expression and returns its value.
template <typename T>
static T EvalConstExpr(const ExprHandle& expr) {
ExprEval<SimpleIREvaluator> eval(expr);
return eval.value<T>();
}
} // namespace
class IndexFlattener : public IRMutator {
public:
Stmt* flatten(Stmt* s) {
return s->accept_mutator(this);
}
const Expr* mutate(const Load* v) override {
if (v->indices().size() == 1) {
return v;
}
return new Load(
v->dtype(),
v->buf(),
{flatten_index(v->buf()->dims(), v->indices())},
v->mask());
}
Stmt* mutate(const Store* v) override {
const Expr* value = v->value();
const Expr* new_value = value->accept_mutator(this);
if (v->indices().size() == 1 && value == new_value) {
return (Stmt*)v;
}
return new Store(
v->buf(),
{flatten_index(v->buf()->dims(), v->indices())},
new_value,
v->mask());
}
};
class ReductionExpander : public IRMutator {
public:
Stmt* expand(Stmt* s) {
return s->accept_mutator(this);
}
Stmt* mutate(const For* v) override {
Stmt* body_new = v->body()->accept_mutator(this);
if (body_new == v->body()) {
body_new = Stmt::clone(v->body());
}
Stmt* ret = v->cloneWithNewBody(body_new);
for (size_t i = 0; i < initializers_.size();) {
InitializerInfo& info = initializers_[i];
auto end = std::remove(info.vars.begin(), info.vars.end(), v->var());
if (end == info.vars.end()) {
info.skipped_loops.push_back(v);
i++;
continue;
}
info.vars.erase(end);
if (info.vars.empty()) {
const ReduceOp* op = info.op;
std::vector<const Expr*> indices(
op->output_args().begin(), op->output_args().end());
Stmt* init = new Store(
op->accumulator(), indices, op->initializer(), new IntImm(1));
for (auto it = info.skipped_loops.rbegin();
it != info.skipped_loops.rend();
it++) {
const For* old_for = *it;
init = old_for->cloneWithNewBody(init);
}
info.skipped_loops.clear();
if (Block* b = dynamic_cast<Block*>(ret)) {
b->prepend_stmt(init);
} else {
ret = new Block({init, ret});
}
initializers_.erase(initializers_.begin() + i);
continue;
}
i++;
}
return ret;
}
const Expr* mutate(const ReduceOp* v) override {
const std::vector<const Var*>& reduce_vars(v->reduce_args());
initializers_.emplace_back(InitializerInfo(v, reduce_vars));
return v->complete().node();
}
private:
struct InitializerInfo {
InitializerInfo(const ReduceOp* o, std::vector<const Var*> v)
: op(o), vars(std::move(v)) {}
const ReduceOp* op;
std::vector<const Var*> vars;
std::vector<const For*> skipped_loops;
};
std::vector<InitializerInfo> initializers_;
};
class Vectorizer : public IRMutator {
public:
Stmt* vectorize(const For* v) {
Stmt* body = v->body();
const Var* var = v->var();
const Expr* start = v->start();
const Expr* stop = v->stop();
const IntImm* start_imm = dynamic_cast<const IntImm*>(start);
const IntImm* stop_imm = dynamic_cast<const IntImm*>(stop);
if (!start_imm) {
throw std::runtime_error(
"Can't vectorize due to non-constant loop start!");
}
if (!stop_imm) {
throw std::runtime_error(
"Can't vectorize due to non-constant loop stop!");
}
var_ = var;
start_ = start_imm;
lanes_ = stop_imm->value();
Stmt* new_body = body->accept_mutator(this);
if (new_body == body) {
throw std::runtime_error("Vectorization failed!");
}
return new_body;
}
const Expr* mutate(const Add* v) override {
std::vector<const Expr*> inputs = {v->lhs(), v->rhs()};
return try_vectorize(v, inputs, [&]() {
return ExprHandle(inputs[0]) + ExprHandle(inputs[1]);
});
}
const Expr* mutate(const Sub* v) override {
std::vector<const Expr*> inputs = {v->lhs(), v->rhs()};
return try_vectorize(v, inputs, [&]() {
return ExprHandle(inputs[0]) - ExprHandle(inputs[1]);
});
}
const Expr* mutate(const Mul* v) override {
std::vector<const Expr*> inputs = {v->lhs(), v->rhs()};
return try_vectorize(v, inputs, [&]() {
return ExprHandle(inputs[0]) * ExprHandle(inputs[1]);
});
}
const Expr* mutate(const Div* v) override {
std::vector<const Expr*> inputs = {v->lhs(), v->rhs()};
return try_vectorize(v, inputs, [&]() {
return ExprHandle(inputs[0]) / ExprHandle(inputs[1]);
});
}
const Expr* mutate(const Max* v) override {
std::vector<const Expr*> inputs = {v->lhs(), v->rhs()};
return try_vectorize(v, inputs, [&]() {
return Max::make(
ExprHandle(inputs[0]), ExprHandle(inputs[1]), v->propagate_nans());
});
}
const Expr* mutate(const Min* v) override {
std::vector<const Expr*> inputs = {v->lhs(), v->rhs()};
return try_vectorize(v, inputs, [&]() {
return Min::make(
ExprHandle(inputs[0]), ExprHandle(inputs[1]), v->propagate_nans());
});
}
const Expr* mutate(const CompareSelect* v) override {
std::vector<const Expr*> inputs = {
v->lhs(), v->rhs(), v->ret_val1(), v->ret_val2()};
return try_vectorize(v, inputs, [&]() {
return CompareSelect::make(
ExprHandle(inputs[0]),
ExprHandle(inputs[1]),
ExprHandle(inputs[2]),
ExprHandle(inputs[3]),
v->compare_select_op());
});
}
const Expr* mutate(const Cast* v) override {
std::vector<const Expr*> inputs = {v->src_value()};
return try_vectorize(v, inputs, [&]() {
return Cast::make(
Dtype(v->dtype().scalar_type(), lanes_), ExprHandle(inputs[0]));
});
}
const Expr* mutate(const Var* v) override {
if (v == var_) {
return Ramp::make(ExprHandle(start_), 1, lanes_).node();
}
return v;
}
const Expr* mutate(const Let* v) override {
const Expr* var = v->var();
const Expr* value = v->value();
const Expr* body = v->body();
std::vector<const Expr*> inputs = {body};
return try_vectorize(v, inputs, [&]() {
return Let::make(
ExprHandle(var), ExprHandle(value), ExprHandle(inputs[0]));
});
}
const Expr* mutate(const Ramp* v) override {
const Expr* base = v->base();
const Expr* stride = v->stride();
const Expr* base_new = base->accept_mutator(this);
const Expr* stride_new = stride->accept_mutator(this);
if (base_new == base && stride_new == stride) {
return v;
}
throw std::runtime_error("Can't vectorize a Ramp!");
}
const Expr* mutate(const Load* v) override {
Dtype dtype(v->dtype().scalar_type(), lanes_);
const Buf* buf = v->buf();
std::vector<const Expr*> inputs = {v->flat_index(), v->mask()};
return try_vectorize(v, inputs, [&]() {
return Load::make(
dtype,
BufHandle(buf),
{ExprHandle(inputs[0])},
ExprHandle(inputs[1]));
});
}
const Expr* mutate(const Broadcast* v) override {
const Expr* val = v->value();
const Expr* new_val = val->accept_mutator(this);
if (new_val == val) {
return v;
}
throw std::runtime_error("Can't vectorize a Broadcast!");
}
const Expr* mutate(const IfThenElse* v) override {
const Expr* condition = v->condition();
const Expr* new_condition = condition->accept_mutator(this);
if (new_condition != condition) {
throw std::runtime_error("Can't vectorize an IfThenElse condition!");
}
std::vector<const Expr*> inputs = {v->true_value(), v->false_value()};
return try_vectorize(v, inputs, [&]() {
return IfThenElse::make(
ExprHandle(condition), ExprHandle(inputs[0]), ExprHandle(inputs[1]));
});
}
const Expr* mutate(const BaseCallNode* v) override {
std::vector<const Expr*> inputs = v->params();
return try_vectorize(
v, inputs, [&]() { return ExprHandle(DefaultMutator(v, inputs)); });
}
Stmt* mutate(const Store* v) override {
const Buf* buf = v->buf();
std::vector<const Expr*> inputs = {v->flat_index(), v->value(), v->mask()};
return try_vectorize(v, inputs, [&]() {
return Store::make(
BufHandle(buf),
{ExprHandle(inputs[0])},
ExprHandle(inputs[1]),
ExprHandle(inputs[2]));
});
}
Stmt* mutate(const For* v) override {
const Var* var = v->var();
const Expr* start = v->start();
const Expr* stop = v->stop();
LoopOptions loop_options = v->loop_options();
const Expr* new_start = start->accept_mutator(this);
const Expr* new_stop = stop->accept_mutator(this);
if (new_start != start || new_stop != stop) {
throw std::runtime_error(
"Can't vectorize nested For with dependent loop bounds!");
}
Stmt* body = v->body();
Stmt* new_body = body->accept_mutator(this);
if (new_body == body) {
return (For*)v;
}
return new For(var, new_start, new_stop, new_body, loop_options);
}
template <typename T>
const Expr* try_vectorize(
const Expr* e,
std::vector<const Expr*>& inputs,
T&& vec_ctor) {
bool vectorize = vectorize_inputs(inputs);
if (vectorize) {
return vec_ctor().node();
}
return e;
}
template <typename T>
Stmt* try_vectorize(
const Stmt* s,
std::vector<const Expr*>& inputs,
T&& vec_ctor) {
bool vectorize = vectorize_inputs(inputs);
if (vectorize) {
return vec_ctor();
}
return (Stmt*)s;
}
bool vectorize_inputs(std::vector<const Expr*>& inputs) {
bool any_vectorized = false;
bool all_vectorized = true;
std::vector<const Expr*> new_inputs;
// Attempt to vectorize each input.
for (const Expr*& in : inputs) {
const Expr* new_in = in->accept_mutator(this);
new_inputs.push_back(new_in);
if (new_in != in) {
any_vectorized = true;
} else {
all_vectorized = false;
}
}
// If none of them vectorized, then don't vectorize this.
if (!any_vectorized) {
return false;
}
// Insert broadcasts for any inputs that weren't vectorized.
for (size_t i = 0; i < inputs.size(); ++i) {
if (inputs[i] == new_inputs[i]) {
inputs[i] = Broadcast::make(ExprHandle(inputs[i]), lanes_).node();
} else {
inputs[i] = new_inputs[i];
}
}
// And then vectorize this node.
return true;
}
const Var* var_ = nullptr;
int lanes_ = 0;
const Expr* start_ = nullptr;
};
void LoopNest::vectorize(Stmt* stmt) {
For* f = dynamic_cast<For*>(stmt);
if (!f) {
return;
}
Block* b = dynamic_cast<Block*>(f->get_parent());
if (!b) {
return;
}
Vectorizer v;
Stmt* old_f = Stmt::clone(f);
Stmt* new_f = nullptr;
try {
new_f = FlattenIndexes(f);
new_f = v.vectorize(dynamic_cast<For*>(new_f));
} catch (std::runtime_error& e) {
// Partial vectorization may have corrupted f
new_f = old_f;
}
b->replace_stmt(f, new_f);
}
class Flattener : public IRMutator {
private:
Expr* mutate(const FunctionCall* v) override {
const Tensor* t = v->tensor();
const Buf* b = t->buf();
Buffer buffer(BufHandle(b), t->body()->dtype());
const std::vector<const Expr*>& params = v->params();
std::vector<ExprHandle> params_expr(params.size());
for (size_t i = 0; i < params.size(); i++) {
params_expr[i] = ExprHandle(params[i]);
}
return buffer(params_expr).node();
}
};
class FunctionInliner : public IRMutator {
public:
FunctionInliner(const std::vector<Function*>& funcs) : funcs_(funcs) {
for (Function* func : funcs) {
// TODO: Support multiple-output functions
if (func->func_vars().size() != 1) {
throw unimplemented_lowering();
}
func_var_set_.insert(func->func_var(0)->base_handle());
}
}
protected:
bool should_inline(Function* func) const {
return func_var_set_.count(func->func_var(0)->base_handle()) > 0;
}
// For the target function, insert the caller/callee pair into the replacement
// mapping.
const Expr* mutate(const FunctionCall* v) override {
Function* func = v->tensor()->function();
const Buf* buf = v->tensor()->buf();
// TODO: Support multiple-output functions
if (func->func_vars().size() != 1) {
throw unimplemented_lowering();
}
if (should_inline(func)) {
// Insert the caller/callee pair into the mapping.
for (size_t i = 0; i < buf->ndim(); i++) {
const Var* func_callee_arg = dynamic_cast<const Var*>(func->arg(i));
const Expr* func_caller_param = v->param(i);
auto iter = inline_mapping_.find(func_callee_arg);
if (iter != inline_mapping_.end()) {
throw std::runtime_error(
"Duplicated variables: " + func_callee_arg->name_hint());
}
inline_mapping_[func_callee_arg] = func_caller_param;
}
// Call the actual replacement.
const Expr* body = func->body(v->tensor()->output_index());
const Expr* result = body->accept_mutator(this);
// Remove the caller/callee relationship.
for (size_t i = 0; i < buf->ndim(); i++) {
const Var* func_callee_arg = dynamic_cast<const Var*>(func->arg(i));
auto iter = inline_mapping_.find(func_callee_arg);
if (iter == inline_mapping_.end()) {
throw std::runtime_error(
"Var already removed: " + func_callee_arg->name_hint());
}
inline_mapping_.erase(iter);
}
return result;
} else {
return IRMutator::mutate(v);
}
}
// Replace the target variable with the caller expressions.
const Expr* mutate(const Var* v) override {
auto iter = inline_mapping_.find(v);
if (iter == inline_mapping_.end()) {
return IRMutator::mutate(v);
} else {
const Expr* expr = iter->second;
// Continue to transform the value from the lookup table.
return expr->accept_mutator(this);
}
}
// Remove the buffer write the inlined function.
Stmt* mutate(const Store* v) override {
if (func_var_set_.count(v->base_handle()) > 0) {
return nullptr;
} else {
return IRMutator::mutate(v);
}
}
private:
std::unordered_map<const Var*, const Expr*> inline_mapping_;
std::vector<Function*> funcs_;
std::unordered_set<const Var*> func_var_set_;
};
// Inlining for functions containing rand(). Since rand() is stateful we can't
// simply inline it everywhere, or else we may generate new randoms where we
// should us a previously generated one. As a contrived example:
// %1 = rand()
// %2 = %1 + 1
// %3 = %1 - 1
// %4 = %2 - %3
// Fully inlining this expr would, incorrectly, yield:
// %4 = (rand() + 1) - (rand() - 1)
// when in fact the two uses of %1 should cancel. To avoid this issue, we
// instead generate:
// %4 = (let x = rand(); (x + 1) - (x - 1))
//
// The overall approach is to replace every rand() intrinsic with a newly
// generated variable, and then bind those variables to rand() calls in the
// body of the innermost control structure.
class RandomInliner : public FunctionInliner {
public:
explicit RandomInliner(const std::vector<Function*>& funcs)
: FunctionInliner(funcs) {}
using FunctionInliner::mutate;
// Bind random vars in the true and false branches of a conditional.
Stmt* mutate(const Cond* v) override {
const Expr* cond = v->condition();
Stmt* true_stmt = v->true_stmt();
Stmt* false_stmt = v->false_stmt();
const Expr* cond_new = cond->accept_mutator(this);
Stmt* true_new = true_stmt ? true_stmt->accept_mutator(this) : true_stmt;
true_new = bind_random_vars(true_new);
Stmt* false_new =
false_stmt ? false_stmt->accept_mutator(this) : false_stmt;
false_new = bind_random_vars(false_new);
if (cond_new == cond && true_new == true_stmt && false_new == false_stmt) {
return const_cast<Cond*>(v); // NOLINT
}
return new Cond(cond_new, true_new, false_new);
}
// Bind random vars in the innermost loop where they are used.
Stmt* mutate(const For* v) override {
const Var* var = v->var();
const Expr* start = v->start();
const Expr* stop = v->stop();
Stmt* body = v->body();
LoopOptions loop_options = v->loop_options();
Stmt* orig_body = Stmt::clone(body);
Stmt* new_body = orig_body->accept_mutator(this);
new_body = bind_random_vars(new_body);
if (new_body == orig_body) {
return const_cast<For*>(v); // NOLINT
}
if (new_body == nullptr) {
return nullptr;
}
return new For(var, start, stop, new_body, loop_options);
}
// Inline calls containing rand(). Create a new random variable for each
// call being inlined, and remember which function is currently being inlined
// so we can look up the right variable to replace it with.
const Expr* mutate(const FunctionCall* v) override {
if (!should_inline(v->tensor()->function())) {
return v;
}
Function* prev_func = current_func_;
current_func_ = v->tensor()->function();
// Remember the calling args; if we find another call with different args,
// bail out because this case is too complicated.
auto it = call_args_.find(current_func_);
if (it == call_args_.end()) {
call_args_.emplace(current_func_, std::cref(v->params()));
} else {
if (v->params() != it->second.get()) {
throw std::runtime_error("Complex indexing pattern in rand() tensor");
}
}
// Assign a new random variable for this function, if needed.
if (!random_vars_.count(current_func_)) {
const std::string& name = current_func_->func_var(0)->name_hint();
random_vars_.emplace(current_func_, new Var(name, v->dtype()));
}
const Expr* result = FunctionInliner::mutate(v);
current_func_ = prev_func;
return result;
}
// Replace rand() intrinsics.
const Expr* mutate(const Intrinsics* v) override {
if (v->op_type() != kRand) {
return v;
}
if (!current_func_) {
return v;
}
auto it = random_vars_.find(current_func_);
if (it == random_vars_.end()) {
return v;
}
return it->second;
}
private:
// Emit let statements for all encountered random vars, thenclear them.
Stmt* bind_random_vars(Stmt* s) {
for (auto const& p : random_vars_) {
Var* v = p.second;
s = new LetStmt(v, new Intrinsics(kRand, v->dtype()), s);
}
random_vars_.clear();
return s;
}
// Track the function currently being inlined.
Function* current_func_ = nullptr;
// Map functions being inlined to the generated random variable.
std::unordered_map<Function*, Var*> random_vars_;
// Remember arguments of calls containing rand, and force all calls to have
// the same argument list. We use pointer equality of Exprs, which is
// extremely strict but works for simple cases.
using ArgVec = std::reference_wrapper<const std::vector<const Expr*>>;
std::unordered_map<Function*, ArgVec> call_args_;
};
static Stmt* InjectInlines(
Stmt* stmt,
const std::vector<Function*>& inlined_funcs) {
FunctionInliner inliner(inlined_funcs);
Stmt* stmt_old = stmt;
Stmt* stmt_new = stmt_old->accept_mutator(&inliner);
return stmt_new;
}
static Stmt* InlineRandom(Stmt* stmt, const std::vector<Function*>& funcs) {
RandomInliner inliner(funcs);
return stmt->accept_mutator(&inliner);
}
class DepTracker : public IRVisitor {
public:
std::vector<Tensor*> findUsedTensors(Tensor* tensor) {
used_tensors.clear();
tensor->body()->accept(this);
return used_tensors;
}
private:
void visit(const FunctionCall* v) override {
used_tensors.push_back(const_cast<Tensor*>(v->tensor())); // NOLINT
}
std::vector<Tensor*> used_tensors;
};
std::vector<Tensor*> LoopNest::findAllNeededTensors(
const std::vector<Tensor*>& tensors) {
DepTracker d;
std::queue<Tensor*> q;
std::unordered_set<Tensor*> queued;
std::vector<Tensor*> result;
std::unordered_set<Tensor*> processed;
for (Tensor* t : tensors) {
if (queued.insert(t).second) {
q.push(t);
}
}
while (!q.empty()) {
Tensor* t = q.front();
q.pop();
queued.erase(t);
std::vector<Tensor*> deps = d.findUsedTensors(t);
bool all_processed = true;
for (Tensor* dep : deps) {
if (!processed.count(dep)) {
if (queued.insert(dep).second) {
q.push(dep);
}
all_processed = false;
}
}
if (all_processed) {
result.push_back(t);
if (processed.count(t)) {
throw malformed_input("failure to find all processed Tensors");
}
processed.insert(t);
} else {
if (queued.count(t)) {
throw malformed_input("failure to find all queued Tensors");
}
q.push(t);
queued.insert(t);
}
}
return result;
}
LoopNest::LoopNest(const std::vector<Tensor*>& output_tensors)
: output_tensors_(output_tensors.begin(), output_tensors.end()) {
// Find all tensors we need to compute (including dependencies) and put them
// in a topological order
std::vector<Tensor*> tensors_to_compute =
findAllNeededTensors(output_tensors);
// Find all intermediate tensors, we'll need that for inserting alloc/free
// statements
std::unordered_set<Tensor*> tensors_to_compute_set(
tensors_to_compute.begin(), tensors_to_compute.end());
for (Tensor* t : tensors_to_compute) {
if (!output_tensors_.count(t)) {
intermediate_tensors_.insert(t);
}
}
std::vector<Stmt*> loops;
for (Tensor* t : tensors_to_compute) {
Stmt* loop = lowerToStmt(t);
loops.push_back(loop);
}
root_stmt_ = new Block(loops);
}
Stmt* LoopNest::lowerToStmt(Tensor* t) {
Function* f = t->function();
// TODO: Support multiple-output functions
Stmt* body = f->ElementStmt(0);
stmt_to_tensor_[body] = t;
tensor_to_stmt_[t] = body;
if (f->ndim() == 0) {
return body;
}
if (f->ndim() == 0) {
throw malformed_input("Tensor lowered to zero dimensions");
}
for (size_t i = 0; i < f->ndim(); i++) {
// Going in reverse order: from innermost loop to the outermost
size_t dim_index = f->ndim() - i - 1;
body = new For(f->arg(dim_index), new IntImm(0), f->dim(dim_index), body);
}
return body;
}
void LoopNest::computeInline(Stmt* s) {
// TODO: check if `s` is a body of a loop
inlined_functions_.insert(stmt_to_tensor_.at(s)->function());
}
void LoopNest::computeInlineWithRandom(Stmt* s) {
inlined_random_functions_.insert(stmt_to_tensor_.at(s)->function());
}
// TODO: Unify with DepTracker
class UseFinder : public IRVisitor {
public:
std::unordered_map<const Buf*, std::vector<BufUse>> findUses(Stmt* s) {
uses_.clear();
s->accept(this);
return uses_;
}
private:
void visit(const Store* v) override {
if (stores_[v->buf()].insert(last_stmt_).second) {
uses_[v->buf()].push_back({(Stmt*)v, true});
}
last_stmt_ = (Stmt*)v;
IRVisitor::visit(v);
}
void visit(const Load* v) override {
if (loads_[v->buf()].insert(last_stmt_).second) {
uses_[v->buf()].push_back({last_stmt_, false});
}
IRVisitor::visit(v);
}
Stmt* last_stmt_ = nullptr;
std::unordered_map<const Buf*, std::vector<BufUse>> uses_;
// Sets of loads and stores in order to keep the results unique
std::unordered_map<const Buf*, std::unordered_set<Stmt*>> loads_;
std::unordered_map<const Buf*, std::unordered_set<Stmt*>> stores_;
};
std::unordered_map<const Buf*, std::vector<BufUse>> findUses(Stmt* s) {
UseFinder uf;
return uf.findUses(s);
}
class ContainedStmtsFinder : public IRVisitor {
public:
// Simply list all Stores and LetStmts that are children of the given stmt
const std::unordered_set<Stmt*>& findContainedStmts(Stmt* s) {
contained_.clear();
s->accept(this);
return contained_;
}
private:
void visit(const Store* v) override {
contained_.insert((Stmt*)v);
IRVisitor::visit(v);
}
void visit(const LetStmt* v) override {
contained_.insert((Stmt*)v);
IRVisitor::visit(v);
}
std::unordered_set<Stmt*> contained_;
};
bool containsAll(const std::vector<BufUse>& uses, Block* b) {
std::unordered_set<Stmt*> not_found;
for (auto use : uses) {
not_found.insert(use.s);
}
ContainedStmtsFinder csf;
const std::unordered_set<Stmt*>& contained = csf.findContainedStmts(b);
for (auto s : contained) {
not_found.erase(s);
}
return not_found.empty();
}
Block* findParentBlock(Stmt* s) {
while (s) {
if (auto b = dynamic_cast<Block*>(s)) {
return b;
}
s = s->get_parent();
}
return nullptr;
}
Block* findLowestContainingBlock(const std::vector<BufUse>& uses) {
// TODO: we're not using the most efficient algorithm here for simplicity.
// Replace with something more performant in case it becomes a bottleneck.
Block* b = findParentBlock(uses[0].s);
while (b && !containsAll(uses, b)) {
b = findParentBlock(b->get_parent());
}
return b;
}
Stmt* LoopNest::insertAllocFree(Stmt* stmt) {
// Add allocs and frees for intermediate buffers at the global level.
// TODO: move allocs and frees to the imemediate areas to reuse buffers.
if (intermediate_tensors_.size() == 0ULL) {
return stmt;
}
Block* b = dynamic_cast<Block*>(stmt);
if (!b) {
b = new Block({stmt});
}
// TODO: Fix the traversal, currently the order is non-deterministic
for (Tensor* tensor : intermediate_tensors_) {
if (inlined_functions_.count(tensor->function()) ||
inlined_random_functions_.count(tensor->function())) {
// No need to allocate memory for intermediate tensors.
continue;
}
if (output_tensors_.count(tensor) > 0) {
// No need to allocate memory if the tensors are given as input/output.
continue;
}
Stmt* alloc = new Allocate(
tensor->buf()->base_handle(), tensor->body()->dtype(), tensor->dims());
Stmt* free = new Free(tensor->buf()->base_handle());
b->prepend_stmt(alloc);
b->append_stmt(free);
}
// Now insert allocations and frees for temporary buffers. Do that in the
// innermost possible scope.
std::unordered_map<const Buf*, std::vector<BufUse>> uses = findUses(stmt);
for (const auto& temp_buf : temp_bufs_) {
const Buf* buf = temp_buf.first;
Stmt* alloc =
new Allocate(buf->base_handle(), temp_buf.second, buf->dims());
Stmt* free = new Free(buf->base_handle());
Block* alloc_block = findLowestContainingBlock(uses.at(buf));
alloc_block->prepend_stmt(alloc);
alloc_block->append_stmt(free);
}
return b;
}
void LoopNest::prepareForCodegen() {
std::vector<Function*> inlined_functions_vec(
inlined_functions_.begin(), inlined_functions_.end());
std::vector<Function*> inlined_randoms_vec(
inlined_random_functions_.begin(), inlined_random_functions_.end());
root_stmt_ = InjectInlines(root_stmt_, inlined_functions_vec);
root_stmt_ = InlineRandom(root_stmt_, inlined_randoms_vec);
// Expand reduction ops.
ReductionExpander reduceExpander;
root_stmt_ = reduceExpander.expand(root_stmt_);
// Flatten function calls.
Flattener flattener;
root_stmt_ = root_stmt_->accept_mutator(&flattener);
root_stmt_ = FlattenIndexes(root_stmt_);
// Add allocs and frees for intermediate buffers at the global level.
root_stmt_ = insertAllocFree(root_stmt_);
}
void LoopNest::splitWithTail(
For* f,
int factor,
For** outer,
For** inner,
For** tail) {
Block* p = dynamic_cast<Block*>(f->get_parent());
if (!f) {
throw malformed_input("splitWithTail attempted on null loop", f);
} else if (!p) {
throw malformed_input("splitWithTail attempted on loop with no parent", p);
}
bool tail_is_needed = true;
if (dynamic_cast<const IntImm*>(f->start()) &&
dynamic_cast<const IntImm*>(f->stop())) {
int start_val = dynamic_cast<const IntImm*>(f->start())->value();
int stop_val = dynamic_cast<const IntImm*>(f->stop())->value();
int size_val = stop_val - start_val;
int tail_size = size_val % factor;
if (tail_size == 0) {
tail_is_needed = false;
}
}
const IntImm* factor_expr = new IntImm(factor);
const Expr* size = new Sub(f->stop(), f->start());
const Expr* split_count = new Div(size, factor_expr);
const Expr* tail_size = new Mod(size, factor_expr);
const std::string& loop_var_name = f->var()->name_hint();
Dtype loop_var_dtype = f->var()->dtype();
const Var* i_inner = new Var(loop_var_name + "_inner", loop_var_dtype);
const Var* i_outer = new Var(loop_var_name + "_outer", loop_var_dtype);
// x -> x.outer * inner.size + x.inner
const Expr* combined_index1 = new Add(new Mul(i_outer, factor_expr), i_inner);
Stmt* body_inner =
Substitute(Stmt::clone(f->body()), {{f->var(), combined_index1}});
*inner = new For(i_inner, new IntImm(0), factor_expr, body_inner);
*outer = new For(i_outer, new IntImm(0), split_count, *inner);
// TODO: cleanup API for adding/removing statements
p->replace_stmt(f, *outer);
if (tail_is_needed) {
const Var* i_tail = new Var(loop_var_name + "_tail", loop_var_dtype);
// x -> x.tail + outer.size * inner.size
const Expr* combined_index2 =
new Add(i_tail, new Mul(split_count, factor_expr));
Stmt* body_tail =
Substitute(Stmt::clone(f->body()), {{f->var(), combined_index2}});
*tail = new For(i_tail, new IntImm(0), tail_size, body_tail);
p->append_stmt(*tail);
} else {
*tail = nullptr;
}
// TODO: record history of transformations
}
void LoopNest::splitWithMask(For* f, int factor, For** outer, For** inner) {
Block* p = dynamic_cast<Block*>(f->get_parent());
if (!p) {
std::cerr << "Parent is not a Block!\n";
return;
}
bool tail_is_needed = true;
if (dynamic_cast<const IntImm*>(f->start()) &&
dynamic_cast<const IntImm*>(f->stop())) {
int start_val = dynamic_cast<const IntImm*>(f->start())->value();
int stop_val = dynamic_cast<const IntImm*>(f->stop())->value();
int size_val = stop_val - start_val;
int tail_size = size_val % factor;
if (tail_size == 0) {
tail_is_needed = false;
}
}
const IntImm* factor_expr = new IntImm(factor);
const Expr* size = new Sub(f->stop(), f->start());
// split_count = (size + factor - 1) / factor
const Expr* split_count =
new Div(new Sub(new Add(size, factor_expr), new IntImm(1)), factor_expr);
const std::string& loop_var_name = f->var()->name_hint();
Dtype loop_var_dtype = f->var()->dtype();
const Var* i_inner = new Var(loop_var_name + "_inner", loop_var_dtype);
const Var* i_outer = new Var(loop_var_name + "_outer", loop_var_dtype);
// x -> x.outer * inner.size + x.inner
const Expr* combined_index = new Add(new Mul(i_outer, factor_expr), i_inner);
Stmt* body_inner = Stmt::clone(f->body());
// TODO: is it ok that we're doing it eagerly? In the other implementation we
// are only materializing predicates at the last, lowering, step.
if (tail_is_needed) {
const IntImm* start = dynamic_cast<const IntImm*>(f->start());
if (!start || start->value() != 0) {
throw unimplemented_lowering();
}
const Expr* predicate =
CompareSelect::make(ExprHandle(f->var()), ExprHandle(f->stop()), kLT)
.node();
body_inner = Cond::make(ExprHandle(predicate), body_inner, nullptr);
}
body_inner = Substitute(body_inner, {{f->var(), combined_index}});
*inner = new For(i_inner, new IntImm(0), factor_expr, body_inner);
*outer = new For(i_outer, new IntImm(0), split_count, *inner);
// TODO: cleanup API for adding/removing statements
p->replace_stmt(f, *outer);
// TODO: record history of transformations
}
void LoopNest::reorderAxis(Tensor* t, For* a, For* b) {
if (a == b) {
// nothing to do.
return;
}
// find inner and outer.
For* outer{nullptr};
For* inner{nullptr};
std::deque<For*> internal_axes;
// Find relevant axes, store reversed.
for (For* loop : getLoopStmtsFor(t)) {
if (loop == a || loop == b) {
if (outer == nullptr) {
outer = loop;
internal_axes.push_front(loop);
} else {
inner = loop;
internal_axes.push_front(loop);
}
} else if (outer && !inner) {
internal_axes.push_front(loop);
}
}
if (!inner || !outer) {
throw std::runtime_error("Reordered a loop not in LoopNest");
}
Block* root = dynamic_cast<Block*>(outer->get_parent());
CHECK(root);
// Do a shallow copy of the inner blocks.
Block* body = new Block({});
for (auto* s : inner->body()->stmts()) {
inner->body()->remove_stmt(s);
body->append_stmt(s);
}
For* before{outer};
For* after{nullptr};
For* last = internal_axes.front();
Stmt* newInner = body;
// This is the major complexity in loop reordering: handling statements not in
// the straight line of the reorder. To handle this we partition the tree into
// the section before the critical path and after the critical path.
//
// An example of this pattern is:
// for i in ..
// Statement A
// for j in ..
// Statement B
// Statement C
//
// When reordering loop i and j we need to ensure that Statement A and C are
// still both executed with the loop extents of i, and that the three
// statements are not reordered (as much as possible).
for (auto* loop : internal_axes) {
// If the inner loop had a component after the loop we must wrap it in a For
// loop matching this level of the tree.
if (after != nullptr) {
after = loop->cloneWithNewBody(after);
}
bool pastMidpoint = false;
bool hadBeforeStmts = false;
for (Stmt* s : loop->body()->stmts()) {
if (s == last) {
// This is the midpoint.
loop->body()->remove_stmt(s);
if (!hadBeforeStmts) {
// If there were no existing statements this loop does not need to be
// preserved and we can roll it into the above loop.
last = loop;
}
pastMidpoint = true;
} else if (pastMidpoint) {
// Statements after the reordered path must be moved to a new tree after
// the reordered statement has occurred to preserve ordering.
loop->body()->remove_stmt(s);
if (after == nullptr) {
after = loop->cloneWithNewBody(s);
} else {
after->body()->append_stmt(s);
}
} else {
// We can leave any statements before the reordered loop alone, so long
// as we preserve the loop structure.
hadBeforeStmts = true;
}
}
}
// If the top level is now empty, eliminate it.
if (before->body()->nstmts() == 0) {
root->remove_stmt(before);
before = nullptr;
}
// now we can actually reorder the chosen axes.
std::swap(internal_axes.front(), internal_axes.back());
// Create the reordered internals:
for (auto* loop : internal_axes) {
newInner = loop->cloneWithNewBody(newInner);
}
// Append the new statements to the root of the tree.
root->append_stmt(newInner);
if (after) {
root->append_stmt(after);
}
} // namespace tensorexpr
std::vector<For*> LoopNest::getLoopStmtsFor(Tensor* t) const {
std::vector<For*> result;
Stmt* cur_stmt = tensor_to_stmt_.at(t);
while (cur_stmt) {
if (auto* loop = dynamic_cast<For*>(cur_stmt)) {
result.push_back(loop);
}
cur_stmt = cur_stmt->get_parent();
}
return std::vector<For*>(result.rbegin(), result.rend());
}
void LoopNest::setGPUBlockIndex(For* f, int block_index) {
f->set_gpu_block_index(block_index);
}
void LoopNest::setGPUThreadIndex(For* f, int thread_index) {
f->set_gpu_thread_index(thread_index);
}
Stmt* LoopNest::getLoopBodyFor(Tensor* t) const {
return tensor_to_stmt_.at(t);
}
bool LoopNest::hasLoopBodyFor(Tensor* t) const {
return tensor_to_stmt_.count(t) > 0;
}
Stmt* FlattenIndexes(Stmt* s) {
IndexFlattener idx_flattener;
return idx_flattener.flatten(s);
}
// Auxiliary class for rewriting we're doing in `compute_at`. See
// LoopNest::computeAt for more details.
class LoopComputeAtRewriter : public IRMutator {
public:
LoopComputeAtRewriter(
const Buf* buf,
const Buf* new_buf,
std::vector<const Expr*> offsets)
: buf_(buf), new_buf_(new_buf), offsets_(std::move(offsets)) {}
private:
const Buf* buf_;
const Buf* new_buf_;
std::vector<const Expr*> offsets_;
const Expr* mutate(const Load* v) override {
if (v->buf() != buf_) {
return v;
}
std::vector<const Expr*> new_indices(v->indices().size());
for (size_t i = 0; i < v->indices().size(); i++) {
new_indices[i] =
IRSimplifier::simplify(new Sub(v->indices()[i], offsets_[i]));
}
return new Load(v->dtype(), new_buf_, new_indices, v->mask());
}
const Expr* mutate(const FunctionCall* v) override {
if (v->tensor()->func_var() != buf_) {
return v;
}
std::vector<const Expr*> new_indices;
for (size_t i = 0; i < v->nparams(); i++) {
new_indices.push_back(
IRSimplifier::simplify(new Sub(v->param(i), offsets_[i])));
}
return new Load(v->dtype(), new_buf_, new_indices, new IntImm(1));
}
};
static Store* getStoreStmtOfProducer(Stmt* s) {
if (Store* st = dynamic_cast<Store*>(s)) {
return st;
}
if (Block* b = dynamic_cast<Block*>(s)) {
for (Stmt* ss : b->stmts()) {
if (Store* st = dynamic_cast<Store*>(ss)) {
return st;
}
}
}
return nullptr;
}
static std::vector<const Var*> getOuterLoopIndexes(Stmt* s) {
std::vector<const Var*> res;
Stmt* cur = s;
while (cur) {
if (auto l = dynamic_cast<For*>(cur)) {
res.push_back(l->var());
}
cur = cur->get_parent();
}
return res;
}
/*
* WHAT COMPUTE_AT DOES
* ====================
*
* Suppose we have two loops:
*
* for i in 0..100:
* for j in 0..200:
* A[i,j] = sin(i*j)
* for i in 0..100:
* for j in 0..199:
* B[i,j] = A[i,j] + A[i, j+1]
*
* If we compute these loops as is, we would have to allocate two buffers:
* 100x200 for A and 100x199 for B. To decrease the memory usage one can use
* compute_inline primitive, which would result in the following:
*
* for i in 0..100:
* for j in 0..199:
* B[i,j] = sin(i*j) + sin(i*(j+1))
*
* We now need only one buffer - 100x199 for B. However, we're now doing some
* redundant computations: we're calling `sin` twice as much as in the first
* version.
*
* Ultimately, we nede to choose at what point we prefer to compute values of
* A[i,j] - we can do it in the very beginning for the entire buffer A (the
* first option) or compute it on the fly when we compute B (the second option).
* There are also options in between those two: we can compute a part of B which
* is required for a computation of part of B, e.g. for a single row of B. The
* code would then look like:
*
* for i in 0..100:
* for j in 0..200:
* A[j] = sin(i*j)
* for j in 0..199:
* B[i,j] = A[j] + A[j+1]
*
* In this case we're only using 1x200 for A, and we're avoiding redundant
* computations.
*
* The purpose of `compute_at` is to achieve exactly this transformation.
*
* compute_at requires to specify What to compute and Where to compute: in our
* example we would call compute_at(What=`A[i,j] = sin(i*j)`, Where=`for i in
* 0..100`).
*
* More info about compute_at could be found in Halide's tutorials:
* https://halide-lang.org/tutorials/tutorial_lesson_08_scheduling_2.html
*
* HOW COMPUTE_AT WORKS
* ====================
*
* The most important part of compute_at is bounds inference: we need to figure
* out what part of the used tensors we need to compute when we move the
* computation to a new scope. In the example above, we need bounds inference to
* tell us that in order to compute A at each iteration of the outer loop, we
* need to compute A within indices [i:i+1,0:200].
*
* This info allows us to conclude that we need a temp buffer of size 1x200.
*
* Once this is known we need to insert statements for allocation and freeing
* the temporary buffer and copy the original computation to fill the temp
* buffer with proper values. When we copy the computation we also must rewrite
* indices used in it: old indices are referring to the old loop and are not
* valid in the new loop.
*
* To easier follow the logic, let's examine an example. Suppose we start from
* the following loop nest:
* for py in 0..100:
* for px in 0..100:
* producer[py,px] = py*px
* for cy in 0..100:
* for cx in 0..100:
* consumer[cy,cx] = producer[cy,cx]
*
* And then we're running `compute_at(producer, cy)`.
*
* What we would like to get is the following loop nest:
* for py in 0..100:
* for px in 0..100:
* producer[py,px] = py*px
* for cy in 0..100:
* Allocate(temp, {1, 100})
* for ty in 0..1:
* for tx in 0..100:
* temp[ty,tx] = (ty+cy)*(tx+0)
* for cx in 0..100:
* consumer[cy,cx] = temp[0,cx]
* Free(temp)
*
* NB: this loop nest can and should be simplified (e.g. the producer loop can
* be removed since its result is no longer used), but this clean-up
* optimization is performed separately (currently, not performed at all).
*
* If we examine the final loop nest, we can identify that the following steps
* needs to be performed:
* - Bounds inference needs to tell us that we need a 1x100 buffer for temp.
* - Allocate and Free statements for this buffer need to be inserted to the
* loop.
* - A new loop-nest should be inserted to the loop CY for computing `temp`
* and it should replicate the loopnest of producer (PY,PX loops). The indices
* in the loop body need to be offset by (cy, 0) - the offsets come from
* bounds inference too.
* - The computation of `consumer` needs to be rewritten so that it uses
* `temp` instead of `producer`. The indices in the corresponding accesses
* also need to be offset.
*/
void LoopNest::computeAt(Stmt* s, For* f) {
Store* st = getStoreStmtOfProducer(s);
if (!st) {
return;
}
// Infer bounds info for all accesses that we make in the loop
auto loop_bounds_info = inferBounds(f->body());
// store_bounds_info holds bounds info for the store we're trying to move to
// the loop. If its result isn't accessed in the loop at all - do nothing and
// exit early.
TensorAccessBoundsInfo store_bounds_info;
bool found = false;
for (const TensorAccessBoundsInfo& p : loop_bounds_info) {
if (p.buf == st->buf()) {
store_bounds_info = p;
found = true;
}
}
if (!found) {
return;
}
// Compute dimensions of the temp buffer we would need to allocate
std::vector<const Expr*> dims;
for (size_t i = 0; i < store_bounds_info.start.size(); i++) {
const Expr* dim = IRSimplifier::simplify(new Add(
new Sub(store_bounds_info.stop[i], store_bounds_info.start[i]),
new IntImm(1)));
dims.push_back(dim);
}
// TODO: Use name-hint of the producer instead of "temp"
const Buf* temp_buf =
new Buf(new Var("temp", store_bounds_info.buf->dtype()), dims);
// Generate index variables for 'temp'
std::vector<const Expr*> temp_indices(dims.size());
for (size_t i = 0; i < dims.size(); i++) {
// TODO: Use name-hint of the producer indices instead of 'idx'
temp_indices[i] = new Var(std::string("idx") + c10::to_string(i), kInt);
}
// Prepare substitute rules for constructing the temp statement from the prod
// statement
// TODO: Instead of going up the loop nest we should go through the indices in
// the original tensor expression. The loops in the nest might've been
// modified (e.g. split or merged) so that the loop indices no longer
// correspond to the indices of the original expression and even their number
// might be different. In that case, the loop below would crash.
std::vector<const Var*> prod_indices = getOuterLoopIndexes(s);
std::vector<std::pair<const Var*, const Expr*>> rewrite_indices_map;
for (size_t i = 0; i < prod_indices.size(); i++) {
const Expr* offset = store_bounds_info.start[i];
rewrite_indices_map.push_back(
{prod_indices[i], new Add(temp_indices[i], offset)});
}
// Construct the temp statement
Stmt* bd = new Store(
temp_buf,
temp_indices,
Substitute(st->value(), rewrite_indices_map),
st->mask());
// Construct the loop nest for the temp computation
for (size_t i = 0; i < dims.size(); i++) {
// We're creating loops from innermost to outermost, so we need to access
// dimensions in reversed order.
size_t dim_idx = dims.size() - 1 - i;
bd = new For(
dynamic_cast<const Var*>(temp_indices[dim_idx]),
new IntImm(0),
dims[dim_idx],
bd);
}
// Add constructed stmts to the consumer loop
f->body()->prepend_stmt(bd);
// Rewrite accesses to producer in consumer with accesses to temp
LoopComputeAtRewriter lr(
store_bounds_info.buf, temp_buf, store_bounds_info.start);
Stmt* new_f = f->accept_mutator(&lr);
if (f != new_f) {
Block* bb = dynamic_cast<Block*>(f->get_parent());
bb->replace_stmt(f, new_f);
}
// Mark the new temp buffer as requiring an alloc (it will be inserted as a
// part of prepareForCodegen).
temp_bufs_.emplace_back(std::make_pair(temp_buf, st->value()->dtype()));
}
} // namespace tensorexpr
} // namespace jit
} // namespace torch
| [
"[email protected]"
] | |
f9599f6692d8c833a6508fb0d99c183359563c0f | ec5c76bb61b7c705db40b34a991e434710057a4d | /OpenJudge/编程填空:按要求输出.cpp | 1939971218abfcb4754a6d04b0b0d49ded4bec23 | [] | no_license | wr786/Key-to-PKU-cxsjsx | c6805afc652e77ad7675822c2b1d2f4d9e2ec7f0 | 50f91fd4a1c8b9e4b3f460b4f93ec2d167fc2103 | refs/heads/master | 2021-07-07T14:42:11.983182 | 2021-05-07T09:58:44 | 2021-05-07T09:58:44 | 241,523,494 | 18 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 508 | cpp | #include <iterator>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <stack>
#include <iostream>
#include <set>
using namespace std;
int a[10] = {0, 6, 7, 3, 9, 5, 8, 6, 4, 9};
int b[10] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
int main(int argc, char** argv) {
// 在此处补充你的代码
map<int, int> c;
map<int, int>::iterator it;
for(int i=0; i<10; i++)
c[a[i]] = b[i];
for(it=c.begin(); it!=c.end(); it++)
cout<<it->second<<" ";
return 0;
} | [
"[email protected]"
] | |
c5cba91c434b29b9c314194d3d18a0e1eecdb2dc | ee2d4d8340f136d9e0af4491eedf2315cb4e5486 | /Train - Chapter 1/sprime.cpp | 537b3b5761a5788c4cb63fd9fc32db1cfa1a4a90 | [] | permissive | HarryCha777/USACO-Solutions | 4dd9a4f6e03e1f2fa080da86feee820a1a55db18 | 4ac981d835ce45ac176d9c82ca4d6718ffaa964f | refs/heads/main | 2021-06-19T23:18:42.805622 | 2019-06-11T07:00:00 | 2019-06-11T07:00:00 | 189,929,637 | 1 | 0 | MIT | 2019-06-03T16:34:01 | 2019-06-03T03:37:50 | C++ | UTF-8 | C++ | false | false | 3,141 | cpp | /*
ID: harrych2
PROG: sprime
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <bitset>
#include <cmath>
using namespace std;
int prevSize, currSize = 4;
vector<int> prime;
bool checkPrime(int num)
{
if (num <= 1 || num % 2 == 0) return false;
if (num == 2 || num == 3 || num == 5 || num == 7) return true;
for (int i = 3; i <= sqrt(num); i += 2)
if (num % i == 0) return false;
return true;
}
void addPrimes()
{
for (int i = prevSize; i < currSize; i++) // cannot just use prime.size() because it is keep increasing
for (int j = 1; j <= 9; j += 2)
{
int num = prime[i] * 10 + j; // only built upon prev. primes. No even numbers on any digit!
if (checkPrime(num)) prime.push_back(num); cout << num << " ";
}
prevSize = currSize; currSize = prime.size(); // update for next time
}
int main()
{
ifstream in("sprime.in");
ofstream out("sprime.out");
int n; in >> n;
prime.push_back(2), prime.push_back(3), prime.push_back(5), prime.push_back(7); // push back 2, 3, 5, 7
for (int i = 0; i < n - 1; i++)
addPrimes();
for (int i = 0; i < prime.size(); i++)
if (prime[i] >= pow(10, n - 1) && prime[i] <= pow(10, n)) // just setting the bound...nothing complicated here.
out << prime[i] << endl;
return 0;
}
/*
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <bitset>
#include <cmath>
using namespace std;
typedef long long ll;
bitset <10000010> bs;
vector<int> primes;
void sieve(ll low, ll limit)
{
bs.set(); bs[0] = bs[1] = 0;
for (ll i = 2; i <= limit + 1; i++)
if (bs[i])
{
for (ll j = i * i; j <= limit + 1; j += i)
bs[j] = 0;
if ((int)i >= low) primes.push_back((int)i); // MUCH faster than checking this 'if' in main!
}
}
string toStr(int n) // to_string doesn't work on USACO training because to_string is in C++11
{
stringstream ss;
ss << n;
return ss.str();
}
int main()
{
ifstream in("sprime.in");
ofstream out("sprime.out");
int n; in >> n;
switch (n)
{
case 1:sieve(1, 9); break;
case 2:sieve(10, 99); break;
case 3:sieve(100, 999); break;
case 4:sieve(1000, 9999); break;
case 5:sieve(10000, 99999); break;
case 6:sieve(100000, 999999); break;
case 7:sieve(1000000, 9999999); break;
case 8:sieve(1000000, 9999999); break; // same as case 7
}cout << "WWW";
if (n != 8)
for (int i = 0; i < primes.size(); i++)
{
int num = primes[i]; // we'll change the value. So don't use actual one!
bool sprime = true;
for (int i = 0; i < n - 1; i++)
{
num /= 10;
if (!bs[num]) sprime = false;
}
if (sprime) out << primes[i] << endl;
}
else
{
for (int i = 10000001; i <= 99999999; i+=2)
{
int num = i; // we'll change the value. So don't use actual one!
bool sprime = true;
for (int j = 0; j < n - 1; j++)
{
num /= 10;
if (!bs[num]) sprime = false;
}
if (!sprime) continue;
bool prime = true;
for (int j = 3; j <= sqrt(i); j+=2)
{
if (i % j == 0)
{
prime = false;
break;
}
}
if (prime) cout << i << endl;
}
}
//while (1);
return 0;
}*/ | [
"[email protected]"
] | |
9d3d06894d010120a5155a5568060158a892127d | 3a7322640a619ffe793e88de4807c58f2a645fb6 | /cpp/counter/counter.hpp | 57fbbd4d368190248a8f87c83d3b724008a9e8d0 | [] | no_license | MiritHadar/Practice | d0e60fce8c9346212fd3e1071cb7395e63bec69a | 471e75393e02d61601a235fe65f0121ae1121b5c | refs/heads/master | 2020-09-08T01:30:03.102784 | 2020-04-30T14:03:51 | 2020-04-30T14:03:51 | 220,971,061 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 607 | hpp | /*
********************************************************************************
Developer : Mirit Hadar
Reviewer :
Last Update :
Status :
********************************************************************************
*/
#ifndef __OL67_counter
#define __OL67_counter
#include <cstdio> /* I/O */
#include <cstddef> /* size_t */
#include <iostream> /* cout */
using namespace std;
class StaticCounter
{
private:
static size_t s_Cntr;
public:
StaticCounter();
size_t GetId();
static void Print();
private:
size_t m_id;
};
#endif /* __OL67_counter */
| [
"[email protected]"
] | |
c5f5f13ffb056fb239ce98f4165ab21bfa9c8945 | c6a8eba7dedee65362948567d39595ede3bc1376 | /KGE/Core/Data/CommonHashes.hpp | e05060d1ca15f823482fa716f45293c9617d7c7c | [
"MIT"
] | permissive | jkeywo/KGE | 014718add09d6bbccf9f95513fad167e0276823b | 5ad2619a4e205dd549cdf638854db356a80694ea | refs/heads/master | 2021-01-13T01:14:48.634544 | 2014-04-16T17:14:14 | 2014-04-16T17:14:14 | 17,664,341 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 463 | hpp | #pragma once
namespace KGE
{
// event parameter names
const Hash g_xHASH_SOURCE("Source"); // component that called the event
// events
const Hash g_xHASH_ONCREATE("OnCreate");
const Hash g_xHASH_ONACTIVATE("OnActivate");
const Hash g_xHASH_ONDEACTIVATE("OnDeactivate");
const Hash g_xHASH_ONDESTROY("OnDestroy");
const Hash g_xHASH_ONUPDATE("OnUpdate");
const Hash g_xHASH_ONRENDER("OnRender");
const Hash g_xHASH_ONHANDLEINPUT("OnHandleInput");
}
| [
"[email protected]"
] | |
7b604c66b0a9d47bec2e0421b2b489c649f12d7e | 3ef9dbe0dd6b8161b75950f682ec2fc24f79a90e | /NWERCmock1/e.cpp | 7832953929b809a5e74fecc728c5d57cf2d05d4f | [
"MIT"
] | permissive | JackBai0914/Competitive-Programming-Codebase | abc0cb911e5f6b32d1bd14416f9eb398b7c65bb9 | a1cabf0fa5072b07a7da25d66bf455eb45b0b7e9 | refs/heads/main | 2023-03-29T14:17:36.190798 | 2021-04-14T23:15:12 | 2021-04-14T23:15:12 | 358,065,977 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,290 | cpp | /*
* * * * * * * * * * * * * * * * * *
*
* @author: Xingjian Bai
* @date: 2021-03-26 19:54:40
* @description:
*
*
* @notes:
* g++ -fsanitize=address -ftrapv
* * * * * * * * * * * * * * * * * */
#include <bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define TIME (double)clock()/CLOCKS_PER_SEC
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
const int mod = 1000000007;
const ll oo = 1e18;
const ld eps = 1e-8;
#define debug(x) cerr << "(debug mod) " << #x << " = " << x << endl
bool isDigit(char c) {return '0' <= c && c <= '9';}
string A, B;
typedef struct node {
vector <int> box;
node *l, *r;
int stat; //0: random, 1: fixed, 2: sorted
} *pnode;
int ed = 0;
pnode build (const string &s, int st) {
if (s[st] == '[') {
//bottom
pnode ne = new node();
ne->stat = 1;
int c = 0;
for (int i = 1; s[i] != ']'; ++ i, ed = i) {
if (isDigit(s[i]))
c = c * 10 + s[i] - '0';
else {
ne->box.push_back(c);
c = 0;
}
}
ne->box.push_back(c);
return ne;
}
else if (s[st] == 's' && s[st + 1] == 'o') {
pnode ne = build(s, st + 8);
ne->stat = 2;
ed ++;
return ne;
}
else if (s[st] == 's' && s[st + 1] == 'h') {
pnode ne = build(s, st + 8);
ne->stat = 0;
ed ++;
return ne;
}
else {
pnode l = build(s, st + 7);
pnode r = build(s, ed + 2);
pnode ne = new node();
ne->l = l; ne->r = r;
return ne;
}
}
pnode ra, rb;
vector <int> extract (pnode ra) {
}
bool equal (vector <int> a, vector <int> b) {
}
bool allEqual (vector <int> a) {
}
bool compare(pnode ra, pnode rb) {
if (ra->stat > rb->stat)
swap(ra , rb);
if (ra->stat == 0 && rb->stat == 0) {
vector <int> va = extract(ra);
vector <int> vb = extract(rb);
sort(va.begin(), va.end());
sort(vb.begin(), vb.end());
return equal(va, vb);
}
if (ra->stat == 0 && ra->stat == 2) {
vector <int> va = extract(ra);
vector <int> vb = extract(rb);
sort(va.begin(), va.end());
sort(vb.begin(), vb.end());
if (!equal(va, vb) || !allEqual(va))
return false;
else
return true;
}
}
int main() {
ios::sync_with_stdio(false);
cin >> A >> B;
ra = build(A, 0);
rb = build(B, 0);
bool ans = compare(ra, rb);
return 0;
} | [
"[email protected]"
] | |
df535492aee48698e78df6fb34f3a402943598b8 | 6ef83a9583e26cf4a530fb33f5fcd18c73f3c118 | /main.cpp | fcc5ee42ea90ae622c95a95e885928b79e855dc1 | [] | no_license | pawelmajchrzak/KsiazkaAdresowaOOP | eee44218d3e1207a4b5ea90ffa2499bd24150e6b | 6a44a2c5738e5faad21b91be5d978196fcaa09ea | refs/heads/master | 2023-02-24T18:04:07.550356 | 2021-01-25T21:11:37 | 2021-01-25T21:11:37 | 328,799,222 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,182 | cpp | #include <iostream>
#include "KsiazkaAdresowa.h"
using namespace std;
int main()
{
KsiazkaAdresowa ksiazkaAdresowa("Uzytkownicy.txt","Adresaci.txt");
char wybor;
while (true)
{
if (ksiazkaAdresowa.pobierzIdZalogowanegoUzytkownika() == 0)
{
wybor = ksiazkaAdresowa.wybierzOpcjeZMenuGlownego();
switch (wybor)
{
case '1':
ksiazkaAdresowa.rejestracjaUzytkownika();
break;
case '2':
ksiazkaAdresowa.logowanieUzytkownika();
break;
case '9':
exit(0);
break;
default:
cout << endl << "Nie ma takiej opcji w menu." << endl << endl;
system("pause");
break;
}
}
else
{
/*
if (adresaci.empty() == true)
// Pobieramy idOstatniegoAdresata, po to aby zoptymalizowac program.
// Dzieki temu, kiedy uztykwonik bedzie dodawal nowego adresata
// to nie bedziemy musieli jeszcze raz ustalac idOstatniegoAdresata
idOstatniegoAdresata = wczytajAdresatowZalogowanegoUzytkownikaZPliku(adresaci, idZalogowanegoUzytkownika);
*/
wybor = ksiazkaAdresowa.wybierzOpcjeZMenuUzytkownika();
switch (wybor)
{
case '1':
ksiazkaAdresowa.dodajAdresata();
break;
case '2':
ksiazkaAdresowa.wyszukajAdresatowPoImieniu();
break;
case '3':
ksiazkaAdresowa.wyszukajAdresatowPoNazwisku();
break;
case '4':
ksiazkaAdresowa.wypiszWszystkichAdresatow();
break;
case '5':
ksiazkaAdresowa.usunAdresata();
break;
case '6':
ksiazkaAdresowa.edytujAdresata();
break;
case '7':
ksiazkaAdresowa.zmianaHaslaZalogowanegoUzytkownika();
break;
case '8':
ksiazkaAdresowa.wylogowanieUzytkownika();
break;
}
}
}
return 0;
}
/*
ksiazkaAdresowa.wypiszWszystkichUzytkownikow();
ksiazkaAdresowa.logowanieUzytkownika();
ksiazkaAdresowa.dodajAdresata();
ksiazkaAdresowa.wypiszWszystkichAdresatow();
ksiazkaAdresowa.wylogowanieUzytkownika();
ksiazkaAdresowa.zmianaHaslaZalogowanegoUzytkownika();
ksiazkaAdresowa.rejestracjaUzytkownika();
ksiazkaAdresowa.wyszukajAdresatowPoImieniu();
ksiazkaAdresowa.wyszukajAdresatowPoNazwisku();
ksiazkaAdresowa.usunAdresata();
ksiazkaAdresowa.edytujAdresata();
ksiazkaAdresowa.wypiszWszystkichAdresatow();
return 0;
}
*/
/*
//Testy PlikZAdresatami
int main()
{
PlikZAdresatami plikZAdresatami ("Adresaci-test.txt");
Adresat adresat(1,9,"Janek","Twardowski","999 888 333","[email protected]","ul. Jankowa 3a")
plikZAdresatami.dopiszAdresataDoPliku(adresat);
adresat.pobierzImie("Marek");
adres.usunAdresata();
}
*/
| [
"[email protected]"
] | |
f7580316588e5fdbe322c9032304d56391bb72e3 | 6d72a386a7bbf7488d569e11216d3c6c6c073674 | /leetcode/cpp/reverseKGroup/main.cpp | d1cd728ae71d43d493f9025a946ff6e9ee1a4ea0 | [] | no_license | Alwaysproblem/simplecode | aea5c5a910c357263be1a071bc555e2dab20e332 | b1ee0ad390c9e1193109b97b8c66351aaa6f6b8b | refs/heads/master | 2023-07-22T16:00:14.859769 | 2023-07-22T14:59:23 | 2023-07-22T14:59:23 | 165,994,898 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,241 | cpp | /*
* @lc app=leetcode.cn id=25 lang=cpp
*
* [25] K 个一组翻转链表
*/
#include <fmt/format.h>
#include <fmt/ranges.h>
#include <iostream>
#include <unordered_map>
#include <vector>
#include "common_types/LinkedList/LinkedList.h"
using namespace std;
using ListNode = LinkedListNode<int>;
// @lc code=start
class Solution {
public:
ListNode* reverse(ListNode* head, ListNode* target) {
ListNode *pre = nullptr, *cur = head, *nxt = head;
while (cur != target) {
nxt = cur->next;
cur->next = pre;
pre = cur;
cur = nxt;
}
return pre;
}
ListNode* reverseKGroup(ListNode* head, int k) {
if (!head) return head;
ListNode* cur = nullptr;
int i = 0;
for (cur = head; cur != nullptr && i < k; cur = cur->next, i++)
;
if (i < k) return head;
ListNode* tail = reverseKGroup(cur, k);
ListNode* new_head = reverse(head, cur);
head->next = tail;
return new_head;
}
};
// @lc code=end
int main() {
vector<int> v = {1, 2, 3, 4, 5};
int k = 2;
ListNode* head = BuildLinkedlist<int>(v);
showLinkedList<int>(head);
Solution sol;
ListNode* r = sol.reverseKGroup(head, k);
showLinkedList<int>(r);
DestroyLinkedlist<int>(head);
return 0;
}
| [
"[email protected]"
] | |
98349b4f8cd8384bde6e28ad9518ce4cdc2fd28f | d266eb7b6ba92c7658b563975c14b64d4e5d50cc | /libs/post/graph2dhybrid/datamodel/graph2dhybridwindowgridabstractpolylineresultdataitem.cpp | 9a5fe4a38e66ff829e56f6978f6c987b56563dc5 | [] | no_license | scharlton2/prepost-gui | 5c0a7d45c1f7156513d63e915d19f71233f15f88 | 007fdfcaf4d3e42b606e8edad8285b6de2bfd440 | refs/heads/master | 2023-08-31T01:54:11.798622 | 2022-12-26T01:51:06 | 2022-12-26T01:51:06 | 68,759,445 | 0 | 0 | null | 2020-05-14T22:28:47 | 2016-09-20T22:47:28 | C++ | UTF-8 | C++ | false | false | 10,840 | cpp | #include "graph2dhybridwindowgridabstractpolylineresultdataitem.h"
#include "graph2dhybridwindowresultcopydataitem.h"
#include "../graph2dhybridwindow.h"
#include "../graph2dhybridwindowcontrolwidget.h"
#include <guicore/postcontainer/posttimesteps.h>
#include <guicore/postcontainer/postzonedatacontainer.h>
#include <misc/stringtool.h>
#include <QStandardItem>
#include <QVector3D>
#include <vtkCell.h>
#include <vtkCellData.h>
#include <vtkCutter.h>
#include <vtkMath.h>
#include <vtkPlane.h>
#include <vtkPointData.h>
#include <vtkSmartPointer.h>
#include <vtkStructuredGrid.h>
#include <vtkUnstructuredGrid.h>
namespace {
const double MINIMUM_DIFF = 0.001; // 1 millmeter
}
Graph2dHybridWindowGridAbstractPolylineResultDataItem::Graph2dHybridWindowGridAbstractPolylineResultDataItem(const Graph2dHybridWindowResultSetting::Setting& setting, int index, Graph2dWindowDataItem* parent) :
Graph2dHybridWindowResultDataItem(setting.name(), index, setting, parent),
m_physVal {setting.name()}
{}
Graph2dHybridWindowGridAbstractPolylineResultDataItem::~Graph2dHybridWindowGridAbstractPolylineResultDataItem()
{}
Graph2dHybridWindowResultCopyDataItem* Graph2dHybridWindowGridAbstractPolylineResultDataItem::copy(Graph2dHybridWindowResultCopyGroupDataItem* p)
{
// @todo check this again.
Graph2dHybridWindowResultCopyDataItem* ret = Graph2dHybridWindowResultDataItem::copy(p);
const Graph2dHybridWindowResultSetting& s = dataModel()->setting();
Graph2dHybridWindowResultSetting::DataTypeInfo* info = s.targetDataTypeInfo();
PostSolutionInfo* postInfo = dataModel()->postSolutionInfo();
Graph2dHybridWindow* w = dynamic_cast<Graph2dHybridWindow*>(dataModel()->mainWindow());
Graph2dHybridWindowControlWidget* c = w->controlWidget();
int currentStep = postInfo->currentStep();
const QList<double>& timesteps = postInfo->timeSteps()->timesteps();
double time;
if (timesteps.count() == 0) {
time = 0;
} else {
if (currentStep < timesteps.count()) {
time = timesteps.at(currentStep);
} else {
time = 0;
}
}
QStringList args;
args.append(m_standardItem->text());
args.append(QString::number(time));
if (info->dataType == Graph2dHybridWindowResultSetting::dtDim1DStructured) {
ret->setId(Graph2dHybridWindowResultCopyDataItem::idt1D, args);
} else if (info->dataType == Graph2dHybridWindowResultSetting::dtDim2DStructured) {
if (s.xAxisMode() == Graph2dHybridWindowResultSetting::xaI) {
args.append(QString::number(c->jValue() + 1));
ret->setId(Graph2dHybridWindowResultCopyDataItem::idtI2D, args);
} else {
args.append(QString::number(c->iValue() + 1));
ret->setId(Graph2dHybridWindowResultCopyDataItem::idtJ2D, args);
}
} else if (info->dataType == Graph2dHybridWindowResultSetting::dtDim3DStructured) {
if (s.xAxisMode() == Graph2dHybridWindowResultSetting::xaI) {
args.append(QString::number(c->jValue() + 1));
args.append(QString::number(c->kValue() + 1));
ret->setId(Graph2dHybridWindowResultCopyDataItem::idtI3D, args);
} else if (s.xAxisMode() == Graph2dHybridWindowResultSetting::xaJ) {
args.append(QString::number(c->iValue() + 1));
args.append(QString::number(c->kValue() + 1));
ret->setId(Graph2dHybridWindowResultCopyDataItem::idtJ3D, args);
} else {
args.append(QString::number(c->iValue() + 1));
args.append(QString::number(c->jValue() + 1));
ret->setId(Graph2dHybridWindowResultCopyDataItem::idtK3D, args);
}
}
return ret;
}
void Graph2dHybridWindowGridAbstractPolylineResultDataItem::doLoadFromProjectMainFile(const QDomNode& /*node*/)
{
// ProjectDataItem::doLoadFromProjectMainFile is abstract
// loaded in:
// void Graph2dHybridWindowResultSetting::loadFromProjectMainFile(const QDomNode& node)
}
void Graph2dHybridWindowGridAbstractPolylineResultDataItem::doSaveToProjectMainFile(QXmlStreamWriter& /*writer*/)
{
// ProjectDataItem::doLoadFromProjectMainFile is abstract
// loaded in:
// void Graph2dHybridWindowResultSetting::loadFromProjectMainFile(const QDomNode& node)
}
void Graph2dHybridWindowGridAbstractPolylineResultDataItem::updateValues(int /*fn*/)
{
m_xValues.clear();
m_yValues.clear();
const Graph2dHybridWindowResultSetting& s = dataModel()->setting();
Graph2dHybridWindowResultSetting::DataTypeInfo* info = s.targetDataTypeInfo();
PostSolutionInfo* postInfo = dataModel()->postSolutionInfo();
PostZoneDataContainer* cont = postInfo->zoneContainer(info->dimension, info->zoneName);
if (cont == 0) {return;}
vtkPointSet* grid = vtkPointSet::SafeDownCast(cont->data());
if (info->gridLocation == Vertex) {
updateValuesVertex(grid);
}
else if (info->gridLocation == CellCenter) {
updateValuesCellCenter(grid);
} else {
Q_ASSERT(false); // Unhandled GridLocation_t
}
}
void Graph2dHybridWindowGridAbstractPolylineResultDataItem::updateValuesVertex(vtkPointSet* grid)
{
vtkDataArray* da = grid->GetPointData()->GetArray(iRIC::toStr(m_physVal).c_str());
if (da == nullptr) {
// no data found.
return;
}
std::vector<QPointF>& pts = getPolyLine();
double origin[3];
std::map<double, std::vector<double> > amap;
double prev_end_pt[3];
vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::New();
cutter->SetInputData(grid);
for (int idx = 0; idx < pts.size() - 1; ++idx) {
// create plane from point[n] -> point[n+1]
double a[3] = { pts[idx].x(), pts[idx].y(), 0. };
double b[3] = { pts[idx + 1].x(), pts[idx + 1].y(), 0. };
double ab[3] = { (b[0] - a[0]), (b[1] - a[1]), 0. };
double ac[3] = { 0., 0., 1. };
double cross[3];
vtkMath::Cross(ab, ac, cross);
plane->SetOrigin(a);
plane->SetNormal(cross);
cutter->SetCutFunction(plane);
cutter->Update();
vtkDataArray *da = cutter->GetOutput()->GetPointData()->GetArray(iRIC::toStr(m_physVal).c_str());
double max[3];
double min[3];
min[0] = std::min(a[0], b[0]);
max[0] = std::max(a[0], b[0]);
min[1] = std::min(a[1], b[1]);
max[1] = std::max(a[1], b[1]);
for (int i = 0; i < 2; ++i) {
if (max[i] - min[i] < MINIMUM_DIFF) {
min[i] -= MINIMUM_DIFF / 2;
max[i] += MINIMUM_DIFF / 2;
}
}
origin[0] = pts[idx].x();
origin[1] = pts[idx].y();
amap.clear();
int numT = da->GetNumberOfTuples();
for (int i = 0; i < numT; ++i) {
double p[3];
cutter->GetOutput()->GetPoint(i, p);
// y value
double value = 0;
if (da->GetNumberOfComponents() == 1) {
value = da->GetTuple1(i);
}
else if (da->GetNumberOfComponents() == 3) {
double* v;
v = da->GetTuple3(i);
value = std::sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
}
// x value
if ((min[0] <= p[0] && p[0] <= max[0]) && (min[1] <= p[1] && p[1] <= max[1])) {
std::vector<double> v;
v.push_back(p[0]);
v.push_back(p[1]);
v.push_back(value);
QVector3D d0(origin[0] - p[0], origin[1] - p[1], 0.0);
amap.insert(std::pair<double, std::vector<double> >(d0.length(), v));
}
}
double offset = 0;
if (amap.size() == 0) continue;
if (m_xValues.size() > 0) {
double start_pt[3];
start_pt[0] = (*amap.cbegin()).second[0];
start_pt[1] = (*amap.cbegin()).second[1];
QVector3D d(prev_end_pt[0] - start_pt[0], prev_end_pt[1] - start_pt[1], 0.0);
offset = m_xValues.last() + d.length();
}
double distance = 0;
if (m_xValues.size() > 0) distance = m_xValues.last();
for (const auto& pr : amap) {
distance = pr.first - amap.cbegin()->first;
m_xValues.push_back(distance + offset);
m_yValues.push_back(pr.second[2]);
}
prev_end_pt[0] = amap.crbegin()->second[0];
prev_end_pt[1] = amap.crbegin()->second[1];
}
}
void Graph2dHybridWindowGridAbstractPolylineResultDataItem::updateValuesCellCenter(vtkPointSet* grid)
{
vtkDataArray* da = grid->GetCellData()->GetArray(iRIC::toStr(m_physVal).c_str());
if (da == nullptr) {
// no data found.
return;
}
std::vector<QPointF>& pts = getPolyLine();
double origin[3];
std::map<double, std::vector<double> > amap;
double prev_end_pt[3];
vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::New();
cutter->SetInputData(grid);
for (int idx = 0; idx < pts.size() - 1; ++idx) {
// create plane from point[n] -> point[n+1]
double a[3] = { pts[idx].x(), pts[idx].y(), 0. };
double b[3] = { pts[idx + 1].x(), pts[idx + 1].y(), 0. };
double ab[3] = { (b[0] - a[0]), (b[1] - a[1]), 0. };
double ac[3] = { 0., 0., 1. };
double cross[3];
vtkMath::Cross(ab, ac, cross);
plane->SetOrigin(a);
plane->SetNormal(cross);
cutter->SetCutFunction(plane);
cutter->Update();
vtkDataArray *da = cutter->GetOutput()->GetCellData()->GetArray(iRIC::toStr(m_physVal).c_str());
double max[3];
double min[3];
min[0] = std::min(a[0], b[0]);
max[0] = std::max(a[0], b[0]);
min[1] = std::min(a[1], b[1]);
max[1] = std::max(a[1], b[1]);
for (int i = 0; i < 2; ++i) {
if (max[i] - min[i] < MINIMUM_DIFF) {
min[i] -= MINIMUM_DIFF / 2;
max[i] += MINIMUM_DIFF / 2;
}
}
origin[0] = pts[idx].x();
origin[1] = pts[idx].y();
amap.clear();
int numT = da->GetNumberOfTuples();
for (int i = 0; i < numT; ++i) {
double p[3];
// determine center of cell
vtkCell* cell = cutter->GetOutput()->GetCell(i);
vtkIdType npoints = cell->GetPoints()->GetNumberOfPoints();
p[0] = p[1] = 0;
for (vtkIdType n = 0; n < npoints; ++n) {
double x[3];
cell->GetPoints()->GetPoint(n, x);
p[0] += x[0];
p[1] += x[1];
}
p[0] /= npoints;
p[1] /= npoints;
// y value
double value = 0;
if (da->GetNumberOfComponents() == 1) {
value = da->GetTuple1(i);
}
else if (da->GetNumberOfComponents() == 3) {
double* v;
v = da->GetTuple3(i);
value = std::sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
}
// x value
if ((min[0] <= p[0] && p[0] <= max[0]) && (min[1] <= p[1] && p[1] <= max[1]))
{
std::vector<double> v;
v.push_back(p[0]);
v.push_back(p[1]);
v.push_back(value);
QVector3D d0(origin[0] - p[0], origin[1] - p[1], 0.0);
amap.insert(std::pair<double, std::vector<double> >(d0.length(), v));
}
}
double offset = 0;
if (amap.size() == 0) continue;
if (m_xValues.size() > 0) {
double start_pt[3];
start_pt[0] = (*amap.cbegin()).second[0];
start_pt[1] = (*amap.cbegin()).second[1];
QVector3D d(prev_end_pt[0] - start_pt[0], prev_end_pt[1] - start_pt[1], 0.0);
offset = m_xValues.last() + d.length();
}
double distance = 0;
if (m_xValues.size() > 0) distance = m_xValues.last();
for (const auto& pr : amap) {
distance = pr.first - amap.cbegin()->first;
m_xValues.push_back(distance + offset);
m_yValues.push_back(pr.second[2]);
}
prev_end_pt[0] = amap.crbegin()->second[0];
prev_end_pt[1] = amap.crbegin()->second[1];
}
}
| [
"[email protected]"
] | |
ba927403370ce04b45760d4136ab0031e321f397 | a3cc15da4c0eeca4a61f2cf7e6a08b7a4684264c | /Medcode.h | 3fa7b242b90bafc16b33e528f9aaa98b53398487 | [] | no_license | lingshaoqing/hospital-3 | 194a6db54896a0005d4c6e8429d739f1b007b378 | 85bcc4a941bd4d96c174abdcce16a8e403d3872f | refs/heads/master | 2021-01-01T03:46:44.829954 | 2016-05-12T09:45:46 | 2016-05-12T09:45:46 | 58,628,006 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,555 | h | //{{AFX_INCLUDES()
#include "mshflexgrid.h"
//}}AFX_INCLUDES
#if !defined(AFX_MEDCODE_H__7A218AAF_58C8_4F9F_9A5F_BEAE0CA46D52__INCLUDED_)
#define AFX_MEDCODE_H__7A218AAF_58C8_4F9F_9A5F_BEAE0CA46D52__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Medcode.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMedcode dialog
class CMedcode : public CDialog
{
// Construction
public:
CMedcode(CWnd* pParent = NULL); // standard constructor
enum { SQLID= 37,COL_ID=24 ,SQLID2=38,FIRST_ITEM=0, SECOND_ITEM=1,SQLID3=39 ,
BM_POS=4 };
// Dialog Data
//{{AFX_DATA(CMedcode)
enum { IDD = IDD_DIALOG_MED_CODE };
CComboBox m_combo2;
CComboBox m_combo1;
CString m_bm;
CString m_py;
CMSHFlexGrid m_grid;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMedcode)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
public:
CStringArray typeCode,typeCode_1;
CString strSql;
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CMedcode)
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeCombo1();
virtual void OnOK();
afx_msg void OnModify();
afx_msg void OnAdd();
afx_msg void OnMenuitemBcybZjb();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MEDCODE_H__7A218AAF_58C8_4F9F_9A5F_BEAE0CA46D52__INCLUDED_)
| [
"[email protected]"
] | |
6ef8cfba12f557b3279b2272e6b26c866a959670 | 4777443274efd07c54fb15d804dc75f395cb23b4 | /LinkedLists/misListas.cpp | 28b23746997948eb5b1497e395e47151f29b04ae | [] | no_license | EA-Gadgeter/Estrucutras-de-Datos-CPP | 021499d482c3784535e42804c5f3068fbc3e9576 | 228b41d803bf9d0fec9737426ebc4c11d4759c02 | refs/heads/main | 2023-09-04T13:21:08.442900 | 2021-10-16T05:19:03 | 2021-10-16T05:19:03 | 400,075,369 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 259 | cpp | #include <iostream>
#include "Lista.hpp"
using namespace std;
int main(){
Lista lLst = Lista();
lLst.insertLeft("Moscu");
lLst.insertLeft("Rusia");
lLst.insert("Tlacotepec");
lLst.show();
lLst.del("Moscu");
lLst.show();
} | [
"[email protected]"
] | |
adfd3a1b91f43125cc0461f54c27e6b22bfff611 | 1b1c2942e9b392bb7684caaea762d0d47b091d74 | /Source/backend/MolecularUnit.h | 780f7e55e60775b99717ee7ab1447cf974504aca | [] | no_license | itismynamenow/QtGUIForEASAL | 132fc65d95b29a9babc6197870fa9c99befe291c | 75eb50e1ddcb5e06723616516c80969ab6b4ebd0 | refs/heads/master | 2020-03-10T23:11:47.618228 | 2018-04-18T00:30:28 | 2018-04-18T00:30:28 | 129,635,843 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,074 | h | /*
This file is part of EASAL.
EASAL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
EASAL 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/>.
*/
/*
Seems like getXFAtom belongs in the class atom
*/
#ifndef MOLECULARUNIT_H_
#define MOLECULARUNIT_H_
#ifdef WIN32
#include <windows.h>
#endif
#include <vector>
#include <list>
#include "Atom.h"
#include "Utils.h"
#include "Stree.h"
#include "PredefinedInteractions.h"
#include <string>
#include <algorithm>
#include <fstream>
#include <iostream>
/*
* This class allows a MolecularUnit to be easily passed and manipulated.
* It is primarily a sequence of atoms with additional methods to
* manipulate and get information about the list.
*/
class MolecularUnit
{
public:
/////////////////////////////////
// Constructors/Destructors
/////////////////////////////////
/** @brief Default constructor */
MolecularUnit();
/** @brief Constructor with atom list initilization */
MolecularUnit(std::vector<Atom*> atoms);
/** @brief copy constr */
MolecularUnit(const MolecularUnit &another);
/** @brief Destructor */
virtual ~MolecularUnit();
/////////////////////////////////
// Atoms of the helix
/////////////////////////////////
/**
* @param a The pointer of an atom to add to the helix.
*/
void addAtom(Atom *a);
/**
* @return The list of atoms in the helix
*/
std::vector<Atom*> getAtoms();
/**
* @return True if helix contains no atoms, False otherwise.
*/
bool empty();
/**
* @see addAtom
* @return The number of atoms added to the the helix.
*/
size_t size();
/**
* @param a Pointer to the atom of interest
* @return True if helix contains a, False otherwise.
*/
bool contains(Atom *a);
/**
* @return The index'th atom added to the helix, or NULL if OOB
*/
Atom* getAtomAt(size_t index);
/**
* @param label The name of the atom of interest
* @return The pointer of the atom in the helix with name == label, or NULL
*/
Atom* getAtomByLabel(std::string label);
/**
* @see getAtomAt
* @param a The pointer of the atom of interest
* @return The index of atom a in the private list of atoms in the helix, if not in helix -0
*/
int getIndexOf(Atom* a);
/////////////////////////////////
// Atom transformation
/////////////////////////////////
/**
* @brief This method applies a (supplied) transformation to the atoms of a helix a
* specified number of times and outputs a vector of those transformed atoms.
*
* Transformation is achieved by using fromB, toB and applied on helixB. HelixA is fixed.
*
* @return The vector of new atoms. Copies of all the original atoms with new locations.
* @param from For the transformation.
* @param to For the transformation.
* @param repeat The number of times to repeat the transformation
*/
std::vector<Atom*> getXFAtoms(double from[][3], double to[][3], size_t repeat = 0);
/**
* @brief Similar to getFXAtoms, but you supply the precalculated transformation
* matrix
*
* @see getXFAtoms
* @param trans_mat For the transformation.
*/
std::vector<Atom*> getXFAtoms(const std::vector<double> &trans_mat, size_t repeat = 0);
/**
* @brief Similar to getFXAtoms, but is done to only one atom once
* This method applies a transformation to a single atom of a helix and
* outputs a new transformed atom;
* The transformation applied needs to be supplied.
*
* @see getXFAtoms
* @return The new atom. Copy of the original atoms with a new location.
*/
Atom* getXFAtom(size_t index, const std::vector<double> &trans_mat, size_t repeat = 0);
//added by Brian, same as getXFAtom but returns coordinates of the atom instead of the atom object
double* getTransformedCoordinates(int index, const std::vector<double> &trans_mat);
double* getCoordinates(int index);
/////////////////////////////////
// Dumbbell methods
/////////////////////////////////
/**
* @return A vector of pairs that represent atoms in this helix
* The distance between atoms of each pair is in the range between RootNodeCreation::min and RootNodeCreation::max
* These will be used as candidates for the dumbbells
*/
std::vector<std::pair<int,int> >getDumbbells();
/////////////////////////////////
// Limits
/////////////////////////////////
/**
* @brief Call this to have the MolecularUnit determine its max and min xyz values
* by considering all atoms it already contains.
*/
void calcLimits();
/**
* @brief Overwrites the given arrays with the max and min xyz values of the
* the helix atoms.
* This function alters the arrays given to it to reflect the maximum and minimum values for the xyz of the helix atoms.
* Used for the scale purpose of the display of nodeselection window
*/
void getLimits(double max_xyz[3], double min_xyz[3]);
/////////////////////////////////
// Other public methods
/////////////////////////////////
/**
* @brief Changes the location of all the atoms by subtracting off the
* average location. Does not change limits.
*/
void centerAtoms();
/////////////////////////////////
// Sphere Tree methods
/////////////////////////////////
/**
* @brief Builds a sphere tree using the atoms in the helix.
*/
void buildStree();
/**
* @see buildStree
* @return The sphere tree based on the atoms in the helix (should call
* buildStree first).
*/
Stree* getStree();
/** @brief Creates a molecular unit consists of only contact/interface atoms. */
void simplify(PredefinedInteractions &distfinder, bool first_label);
/////////////////////////////////
// Print
/////////////////////////////////
/**
* @brief The ostream print method
* This operator allows the helix to be sent to the console or another filestream.
*/
friend std::ostream& operator<<(std::ostream& os, MolecularUnit& h);
private:
/*
* The collection of atoms as they sit.
*/
std::vector<Atom*> atoms;
/*
* The corners of an axis aligned volume containing all the atomic centers.
*/
double hi[3],lo[3];
public:
Stree* stree;
// TODO Now the atoms and interface are separate, which changes a lot of
// things
std::map<std::string, Atom*> index;
void readMolecularUnitFromFile(string filename, vector<int> ignored_rows, unsigned int x_col, unsigned int y_col, unsigned int z_col, int radius_col, int label_col, int atomNo_col);
void init_MolecularUnit_A_from_settings(PredefinedInteractions *df, bool nogui);
void init_MolecularUnit_B_from_settings(PredefinedInteractions *df, bool nogui);
};
#endif /*MOLECULARUNIT_H_*/
| [
"[email protected]"
] | |
2e9d412ef87f0431fb61ba4a4f00d69937209765 | 184bcf7925e6718b3021946581576f8cae80526b | /Game/2016-ICPC-Dalian-site/H.cpp | cb2d57efb52820eca6f50245882407e4fdff47c4 | [] | no_license | iPhreetom/ACM | a99be74de61df37c427ffb685b375febad74ed9a | f3e639172be326846fe1f70437dcf98c90241aa0 | refs/heads/master | 2021-06-14T08:11:24.003465 | 2019-09-13T22:54:34 | 2019-09-13T22:54:34 | 142,748,718 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 279 | cpp | // fyt
#include<bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int n;
while(cin>>n){
if(n%2 == 1){
cout<<0<<endl;
}
else{
cout<<1<<endl;
}
}
return 0;
}
| [
"[email protected]"
] | |
a760517dd7fe6e6220059a879e5ef04ec7eff23c | 24fbbee491c7e864c565af34c97215af3875b63a | /aizu/ALDS1/SelectSort.cpp | 6492b90e8e210d0d54176cabd8d14db04752e4d5 | [] | no_license | nekonabesan/AtCorder | e51fb0009ec96fd61dfe16a2e46f2d8755a5fc29 | e90856cf3d1ee07624a6fb8a42cd27d21e7dcffa | refs/heads/master | 2022-09-19T08:10:28.110029 | 2022-09-11T14:57:03 | 2022-09-11T14:57:03 | 178,515,216 | 0 | 0 | null | 2022-09-11T14:57:04 | 2019-03-30T05:21:36 | C++ | UTF-8 | C++ | false | false | 987 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void echo(int array[], int num) {
for(int i = 0; i < num; i++) {
if(i > 0) printf(" ");
printf("%d", array[i]);
}
printf("\n");
}
int sort(int array[], int num) {
int tmp = 0;
int cnt = 0;
int minj = 0;
for (int i = 0; i < num; i++) {
minj = i;
for (int j = i; j < num; j++) {
if (array[j] < array[minj]) {
minj = j;
}
}
if (i != minj) cnt++;
tmp = array[i];
array[i] = array[minj];
array[minj] = tmp;
}
return cnt;
}
int main(void) {
int num = 0;
int cnt = 0;
scanf("%d", &num);
int *array = (int *)malloc(num * sizeof(int));
for (int i = 0; i < num; i++) {
scanf("%d", &array[i]);
}
cnt = sort(array, num);
echo(array, num);
printf("%d\n", cnt);
free(array);
return 0;
} | [
"[email protected]"
] | |
43496c2307ef3998908c010f25f73c177650bfa5 | 225b9a9ce807b669f5da0224b374bbf496d0bc70 | /其他/二分/test20191112power.cpp | 2a0b3fd2fd49f849441015d78e4938cebd7b8043 | [] | no_license | Kewth/OJStudy | 2ed55f9802d430fc65647d8931c028b974935c03 | 153708467133338a19d5537408750b4732d6a976 | refs/heads/master | 2022-08-15T06:18:48.271942 | 2022-07-25T02:18:20 | 2022-07-25T02:18:20 | 172,679,963 | 6 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 31 | cpp | ../../test/2019/11/12/power.cpp | [
"[email protected]"
] | |
e74a62853d71db55a591bb1717cf077ad7631b0a | 84897b6a25f876b21246c2c7e1404c9c411be987 | /src/include/base/RCNonCopyable.h | dd8e2db4c4c0cbcb1516145b35e4f116c33f504a | [] | no_license | drivestudy/HaoZip | 07718a53e38bc5893477575ddf3fccfb3b18c5fd | 9e0564b4a11870224543357004653b798fd625e0 | refs/heads/master | 2021-07-24T06:33:24.651453 | 2017-11-05T01:19:18 | 2017-11-05T01:19:18 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,345 | h | /********************************************************************************
* 版权所有(C)2008,2009,2010,好压软件工作室,保留所有权利。 *
********************************************************************************
* 作者 : HaoZip *
* 版本 : 1.7 *
* 联系方式: [email protected] *
* 官方网站: www.haozip.com *
********************************************************************************/
#ifndef __RCNonCopyable_h_
#define __RCNonCopyable_h_ 1
#include "base/RCDefs.h"
BEGIN_NAMESPACE_RCZIP
#ifdef _DEBUG
/** 禁止对象复制的公用基类
*/
class RCNonCopyable
{
protected:
/** 默认构造函数
*/
RCNonCopyable() {} ;
/** 默认析构函数
*/
~RCNonCopyable() {} ;
private:
/** 拷贝构造函数
*/
RCNonCopyable(const RCNonCopyable& from) ;
/** 赋值操作符
*/
const RCNonCopyable& operator= (const RCNonCopyable& from) ;
};
#else
/** Release版本的空基类优化
*/
class RCNonCopyable
{
};
#endif
END_NAMESPACE_RCZIP
#endif //__RCNonCopyable_h_
| [
"[email protected]"
] | |
e526a14661e0126c7e8d166e995dd41352d099e8 | 772d932a0e5f6849227a38cf4b154fdc21741c6b | /CPP_Joc_Windows_Android/SH_Client_Win_Cpp_Cmake/App/src/worldGame3D/gw/capabilities/event/CapabilityEvent.h | a7f5a7e4b0983d64fae6bcd74a8e21a1d85ba2ec | [] | no_license | AdrianNostromo/CodeSamples | 1a7b30fb6874f2059b7d03951dfe529f2464a3c0 | a0307a4b896ba722dd520f49d74c0f08c0e0042c | refs/heads/main | 2023-02-16T04:18:32.176006 | 2021-01-11T17:47:45 | 2021-01-11T17:47:45 | 328,739,437 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 563 | h | #pragma once
#include <base/gh.h>
#include <string>
#include <rpg3D/gw/entity/module/toolsHandler/tool/ITool.h>
class IWorldEntity;
namespace worldGame3D {
namespace gw {
class CapabilityEvent {pub dCtor(CapabilityEvent);
priv static int typeCounter;
pub int type;
pub std::string name;
pub unsigned char capabilityBitIndex = 0;
pub bool state = false;
pub explicit CapabilityEvent(std::string name);
pub void clearData();
pub CapabilityEvent* setData(unsigned char capabilityBitIndex, bool state);
pub virtual ~CapabilityEvent();
};
};
};
| [
"[email protected]"
] | |
65277c5f909156fbc154102a087efd3c217ef03a | a8a33be43032fbe67bf72de21d619c98253383f9 | /combination/datacollect_fla/gstreamer-app-src/gst-app-src.h | df6e36a9a6b76899d81f5d76bff198957a4e813a | [
"BSD-3-Clause"
] | permissive | realdealneil/data_capture_tools | 4ea6c2e442cf5af162f37987623ce326269dc61d | 9c0a1832daee6916f2195c77cf4f6876c69073a3 | refs/heads/master | 2022-06-05T16:33:12.378933 | 2020-05-05T20:47:57 | 2020-05-05T20:47:57 | 261,565,808 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,051 | h | #ifndef GST_APP_SRC_H_INCLUDED
#define GST_APP_SRC_H_INCLUDED
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <stdio.h>
//#include <gst/video/video.h>
#include "FlyCapture2.h"
#include <stdio.h>
#include <unistd.h>
#include "vectornav.h"
#include "ChrImuPacketParser.h"
#include <memory>
FlyCapture2::Property frameRateProp;
FILE* timeStampFile = NULL;
struct cameraData {
unsigned int frameCounter;
unsigned int embedTime;
FlyCapture2::TimeStamp fc2Timestamp;
double tegraTime;
attitude_imu chrAttitude;
attitude_imu vnAttitude;
} camData;
struct ConfigOptions // cmdline and config file options go here
{
std::string output; // where to write the video
std::string encoder;
std::string encoder_name;
int saveVideo;
int enableDisplay;
int iHeight;
int iWidth;
int frameRate;
int bitRate;
int iframeinterval;
int nFramesToCapture; // number of frames to capture
int saveMetadata;
bool useChrImu;
std::string chrDevice;
int chrBaud;
bool useVectorNav;
std::string vnDevice;
int vnBaud;
int vnType;
ConfigOptions()
: useChrImu(true)
, chrDevice("/dev/chrimu")
, chrBaud(921600)
, useVectorNav(true)
, vnDevice("/dev/vectornav")
, vnBaud(921600)
, vnType(2)
{}
} co;
int want = 1;
static GMainLoop *loop;
#define WIDTH 1280
#define HEIGHT 720
//#define NUM_FRAMES_TO_CAPTURE 3600
//#define TARGET_BITRATE 10000000
//uint16_t b_white[WIDTH*HEIGHT];
//uint16_t b_black[WIDTH*HEIGHT];
//! Point Grey Camera:
FlyCapture2::Camera pg_camera;
FlyCapture2::Error pg_error;
FlyCapture2::EmbeddedImageInfo pg_embeddedInfo;
FlyCapture2::ImageMetadata pg_metadata;
FlyCapture2::CameraInfo pg_camInfo;
FlyCapture2::Format7ImageSettings fmt7ImageSettings;
FlyCapture2::Format7PacketInfo fmt7PacketInfo;
FlyCapture2::Format7Info fmt7Info;
FlyCapture2::PixelFormat k_fmt7PixFmt;
FlyCapture2::Mode k_fmt7Mode;
FlyCapture2::Image pg_rawImage;
int imageSize = 0;
class GstreamerAppSrc
{
public:
GstreamerAppSrc()
: m_chrImu(NULL)
{};
static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data);
static void cb_need_data (GstElement *appsrc, guint unused_size, gpointer user_data);
bool OpenCamera(int frameRate);
int factory_make(char const* location);
int pipeline_make();
int watcher_make();
GstElement *pipeline;
GstElement *source;
GstElement *filter1;
GstElement *convert;
GstElement *convFilter;
GstElement *queue;
GstElement *encoder;
GstElement *filter2;
GstElement *parser;
GstElement *muxer;
GstElement *sink;
GstCaps *filter1_caps;
GstCaps *filter2_caps;
GstCaps *convFilterCaps;
GstBus *bus;
guint bus_watch_id;
int InitImu();
int ReadImu();
//! Camera IMU device
chrImuPacketParser *m_chrImu;
private:
//! VectorNav IMU device:
Vn100 m_vn100imu;
Vn200 m_vn200imu;
static void VectorNavCallback( void* sender, VnDeviceCompositeData* data);
};
GstreamerAppSrc gstreamerAppSrc;
#endif // GST-APP-SRC_H_INCLUDED
| [
"[email protected]"
] | |
3a60831e14ff85874a29d73973fbb6f3a98df9a8 | 189f52bf5454e724d5acc97a2fa000ea54d0e102 | /ras/fluidisedBed/0.1/alpha.particlesMean | 33ffe7f71ee6124e4aa345f1855a6f5a369a2c49 | [] | no_license | pyotr777/openfoam_samples | 5399721dd2ef57545ffce68215d09c49ebfe749d | 79c70ac5795decff086dd16637d2d063fde6ed0d | refs/heads/master | 2021-01-12T16:52:18.126648 | 2016-11-05T08:30:29 | 2016-11-05T08:30:29 | 71,456,654 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 68,220 | particlesmean | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1606+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.1";
object alpha.particlesMean;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField nonuniform List<scalar>
6000
(
0.406198
0.419495
0.417585
0.414986
0.411099
0.407451
0.403808
0.401892
0.400756
0.400025
0.39961
0.399383
0.399159
0.398995
0.39892
0.398995
0.399072
0.399197
0.399367
0.399531
0.39978
0.400239
0.401328
0.404106
0.408065
0.411863
0.415292
0.418114
0.419853
0.403166
0.402318
0.407313
0.405766
0.402507
0.399548
0.397561
0.396039
0.395
0.394182
0.393641
0.393298
0.393043
0.392804
0.392644
0.392556
0.392598
0.392708
0.392894
0.393065
0.393243
0.393473
0.393882
0.394692
0.395799
0.39734
0.399438
0.40222
0.405429
0.406587
0.400489
0.415331
0.429618
0.429576
0.42569
0.419784
0.414803
0.411471
0.409349
0.407971
0.407191
0.406738
0.406472
0.406311
0.406239
0.406212
0.406231
0.406284
0.406369
0.406522
0.406771
0.407204
0.407981
0.409383
0.411462
0.414845
0.419667
0.425515
0.429364
0.428974
0.413831
0.434348
0.456339
0.458227
0.456081
0.451045
0.445294
0.440083
0.435714
0.432288
0.429833
0.428155
0.427098
0.426439
0.42609
0.425942
0.425953
0.426122
0.426481
0.427125
0.428182
0.429839
0.432326
0.435786
0.440106
0.44537
0.450964
0.456013
0.458188
0.455926
0.433169
0.455842
0.482347
0.485782
0.485536
0.482283
0.477158
0.471599
0.466113
0.461178
0.457012
0.453702
0.45129
0.449643
0.44866
0.448215
0.448223
0.448698
0.449686
0.451325
0.453739
0.457038
0.461249
0.466219
0.471661
0.477263
0.482292
0.48558
0.485898
0.482129
0.45499
0.479144
0.506621
0.510952
0.511807
0.510107
0.506392
0.501747
0.496635
0.491476
0.486626
0.482364
0.47892
0.476368
0.474749
0.473981
0.473991
0.47479
0.476414
0.478966
0.48241
0.486669
0.491561
0.496741
0.501821
0.506479
0.510154
0.511877
0.511083
0.506489
0.478607
0.502745
0.526347
0.530472
0.531741
0.531301
0.529378
0.526472
0.522891
0.518881
0.514777
0.510893
0.507521
0.504871
0.503088
0.502212
0.502225
0.503131
0.504919
0.507567
0.510935
0.51482
0.518953
0.522968
0.526528
0.529427
0.531337
0.531783
0.530539
0.526225
0.502459
0.52274
0.539774
0.543024
0.544173
0.544485
0.544026
0.542903
0.541226
0.539078
0.536642
0.534138
0.531808
0.529871
0.5285
0.527806
0.527817
0.528532
0.529908
0.531844
0.534171
0.536676
0.539121
0.541268
0.542934
0.544047
0.544501
0.544187
0.543041
0.539694
0.522615
0.535638
0.547439
0.54984
0.550671
0.55122
0.551461
0.551416
0.551099
0.550515
0.5497
0.548735
0.54773
0.546824
0.546141
0.545781
0.545787
0.546156
0.546844
0.547751
0.548752
0.549719
0.550532
0.551114
0.551428
0.551469
0.551227
0.550675
0.549844
0.547415
0.535596
0.541965
0.551323
0.553362
0.55397
0.554491
0.55489
0.555166
0.555342
0.555426
0.555422
0.555339
0.555197
0.555034
0.554891
0.554811
0.554811
0.554896
0.555041
0.555205
0.555344
0.555428
0.555429
0.555345
0.555168
0.554893
0.554494
0.553972
0.553364
0.551321
0.541955
0.545357
0.55361
0.555455
0.555951
0.556405
0.556786
0.55708
0.557308
0.557486
0.557623
0.557725
0.557797
0.557846
0.557874
0.557887
0.557886
0.557874
0.557846
0.557799
0.557726
0.557625
0.557487
0.557308
0.557081
0.556786
0.556405
0.555951
0.555455
0.55361
0.545352
0.548171
0.555256
0.556886
0.557329
0.557729
0.558067
0.558322
0.558516
0.558664
0.558775
0.558858
0.558919
0.558961
0.558987
0.559001
0.558999
0.558987
0.55896
0.558919
0.558858
0.558776
0.558663
0.558516
0.558323
0.558067
0.557729
0.557328
0.556883
0.555253
0.548167
0.550656
0.556495
0.557915
0.558343
0.558707
0.558998
0.559209
0.559361
0.559471
0.559548
0.5596
0.559636
0.559657
0.559669
0.559676
0.559675
0.559669
0.559657
0.559636
0.5596
0.559547
0.55947
0.559361
0.559211
0.559
0.558707
0.558342
0.557914
0.556489
0.550648
0.552718
0.557441
0.55868
0.559111
0.559442
0.559686
0.55985
0.559963
0.56004
0.56009
0.560123
0.560142
0.56015
0.560155
0.560158
0.560158
0.560156
0.560151
0.560142
0.560121
0.56009
0.560038
0.559963
0.559853
0.559689
0.559445
0.559113
0.55868
0.557434
0.552707
0.554371
0.558197
0.559295
0.559695
0.559997
0.560187
0.560307
0.560384
0.560433
0.560464
0.560481
0.56049
0.560492
0.560494
0.560496
0.560494
0.560497
0.560494
0.560489
0.560482
0.560462
0.560435
0.560386
0.560313
0.560193
0.560003
0.559701
0.559297
0.558192
0.554356
0.555706
0.558836
0.559809
0.560149
0.560393
0.560535
0.560619
0.56067
0.560695
0.560713
0.560719
0.560716
0.560715
0.560713
0.560715
0.560715
0.560717
0.560717
0.560717
0.56072
0.560708
0.560699
0.560669
0.560629
0.560537
0.560394
0.560153
0.559816
0.558835
0.555692
0.556815
0.559399
0.560242
0.560505
0.560658
0.560753
0.560806
0.56085
0.560861
0.56087
0.56087
0.560858
0.560852
0.560845
0.560843
0.560845
0.560847
0.560854
0.560857
0.560871
0.560862
0.560871
0.560847
0.560821
0.560753
0.560658
0.56051
0.560252
0.559404
0.556806
0.557771
0.5599
0.560578
0.560745
0.560821
0.560862
0.5609
0.560944
0.560959
0.560964
0.560958
0.560938
0.560925
0.560916
0.560905
0.560913
0.56091
0.560929
0.560933
0.560959
0.560955
0.560975
0.560943
0.560909
0.560858
0.56082
0.560748
0.560588
0.55991
0.557769
0.55861
0.560311
0.560769
0.560861
0.560888
0.560912
0.560936
0.560971
0.561001
0.561017
0.561004
0.560971
0.560952
0.560941
0.560926
0.560941
0.560932
0.560962
0.560966
0.561002
0.560997
0.56103
0.560988
0.560945
0.560908
0.560886
0.560861
0.560774
0.560322
0.558616
0.559312
0.560576
0.560834
0.560882
0.560893
0.560927
0.560958
0.560984
0.561003
0.561034
0.561021
0.560983
0.560956
0.56094
0.560918
0.560938
0.560922
0.560966
0.560969
0.561013
0.56102
0.561045
0.561011
0.560963
0.560923
0.560891
0.56088
0.560836
0.560583
0.559323
0.559825
0.560678
0.560839
0.560839
0.560862
0.560925
0.560971
0.560992
0.560996
0.561023
0.561011
0.56097
0.560937
0.560921
0.560894
0.560908
0.560902
0.560942
0.560958
0.561005
0.561022
0.56105
0.561009
0.560974
0.560924
0.56086
0.560837
0.560841
0.56068
0.559834
0.560136
0.560689
0.560793
0.560755
0.560842
0.560924
0.560977
0.560992
0.56098
0.560995
0.560981
0.560938
0.560901
0.560877
0.560852
0.560862
0.560863
0.560902
0.560931
0.560982
0.561005
0.561035
0.561
0.560979
0.560926
0.560844
0.560757
0.560791
0.56069
0.56014
0.560273
0.560638
0.560643
0.560728
0.56083
0.560927
0.560976
0.560979
0.560952
0.560934
0.560932
0.560889
0.560846
0.560817
0.560791
0.560797
0.560805
0.560845
0.560884
0.560937
0.560962
0.560988
0.560981
0.560978
0.560932
0.560836
0.560735
0.560643
0.560634
0.56027
0.560276
0.560507
0.560583
0.560696
0.560827
0.560933
0.560967
0.56095
0.560904
0.560859
0.560852
0.560818
0.560773
0.560741
0.560716
0.560721
0.560731
0.560772
0.560817
0.560863
0.560879
0.560914
0.560947
0.560965
0.560939
0.560839
0.560711
0.560586
0.560506
0.56027
0.560234
0.560418
0.560557
0.560683
0.560822
0.560928
0.560937
0.560894
0.560829
0.560763
0.560727
0.560721
0.560682
0.560652
0.560627
0.560631
0.560642
0.560684
0.560721
0.560745
0.560772
0.560824
0.560888
0.560932
0.560936
0.560854
0.5607
0.560562
0.560423
0.560238
0.560225
0.560384
0.560546
0.560705
0.560814
0.560871
0.560865
0.560797
0.560721
0.56064
0.560585
0.560578
0.560567
0.560541
0.560518
0.560519
0.560532
0.560569
0.560582
0.560593
0.560648
0.560691
0.560795
0.560856
0.560899
0.560846
0.560727
0.560558
0.560394
0.560231
0.560217
0.560374
0.560574
0.560751
0.560814
0.560763
0.560719
0.560645
0.560576
0.560483
0.560418
0.560399
0.560393
0.560398
0.560387
0.560377
0.560399
0.560415
0.560417
0.560408
0.560492
0.560479
0.560655
0.56072
0.560793
0.560825
0.56077
0.560593
0.560388
0.560226
0.56021
0.560387
0.560632
0.560785
0.560779
0.560665
0.560516
0.56042
0.56039
0.56028
0.560197
0.560186
0.560161
0.560201
0.560237
0.560192
0.560246
0.560206
0.560244
0.560165
0.560288
0.560247
0.560428
0.560518
0.560662
0.560773
0.560793
0.56065
0.560406
0.560223
0.56021
0.560437
0.560689
0.560773
0.560697
0.560534
0.560348
0.560194
0.560161
0.560053
0.55995
0.559899
0.559897
0.559937
0.560069
0.560006
0.560073
0.559975
0.560035
0.559919
0.560017
0.560054
0.560185
0.560339
0.560522
0.560681
0.560766
0.560699
0.560458
0.560226
0.560228
0.560505
0.560718
0.560713
0.560569
0.560356
0.560147
0.559989
0.559912
0.559839
0.559762
0.559704
0.559689
0.559726
0.55988
0.559816
0.559878
0.559757
0.559793
0.559746
0.559806
0.559873
0.559982
0.560136
0.560338
0.560546
0.560693
0.560712
0.560519
0.560248
0.560284
0.560562
0.560699
0.560608
0.560389
0.560127
0.559914
0.559777
0.559715
0.559663
0.559614
0.559575
0.559557
0.559575
0.559672
0.559652
0.559677
0.559581
0.559585
0.559602
0.559645
0.559698
0.559773
0.559903
0.560107
0.56036
0.560578
0.560678
0.560559
0.560301
0.560346
0.56058
0.560613
0.560448
0.560133
0.559822
0.559644
0.55957
0.559541
0.559514
0.559485
0.559459
0.559442
0.559448
0.559492
0.55951
0.559502
0.559443
0.55945
0.559472
0.559501
0.559533
0.55957
0.55964
0.559806
0.560103
0.560414
0.560587
0.560562
0.56035
0.560392
0.560538
0.560482
0.560183
0.559726
0.559503
0.559435
0.559407
0.559395
0.559382
0.559363
0.559346
0.559332
0.559326
0.559361
0.559375
0.559349
0.559321
0.559327
0.55935
0.559373
0.559393
0.55941
0.559435
0.559498
0.559707
0.560149
0.560455
0.560515
0.560383
0.560407
0.560457
0.560286
0.559682
0.559362
0.559297
0.559283
0.559277
0.559271
0.559262
0.559249
0.559241
0.559227
0.559207
0.559216
0.559222
0.559207
0.559199
0.55921
0.559234
0.559257
0.559273
0.559279
0.559285
0.559294
0.559355
0.559654
0.560253
0.560432
0.560389
0.560369
0.560327
0.559793
0.559227
0.559148
0.559153
0.559166
0.559171
0.559164
0.55915
0.559134
0.559129
0.559114
0.559095
0.55908
0.559079
0.559073
0.559078
0.559092
0.559118
0.559145
0.559163
0.559171
0.559167
0.559154
0.559146
0.559216
0.559751
0.5603
0.560347
0.560289
0.560073
0.559178
0.558976
0.559011
0.559043
0.559076
0.559079
0.559055
0.559032
0.559011
0.559003
0.558996
0.558973
0.55895
0.558941
0.558939
0.558947
0.558965
0.558995
0.559024
0.559056
0.559076
0.559076
0.559044
0.559015
0.558981
0.55917
0.56003
0.560266
0.560166
0.559394
0.558872
0.55885
0.558875
0.558964
0.559004
0.558975
0.55892
0.558894
0.558868
0.558864
0.558858
0.558843
0.558806
0.558799
0.558795
0.558808
0.558825
0.558857
0.558889
0.558931
0.55897
0.558998
0.55896
0.558888
0.558863
0.558877
0.559363
0.560137
0.559728
0.558876
0.558753
0.558763
0.558815
0.558873
0.558906
0.558837
0.558745
0.55873
0.5587
0.558701
0.558707
0.558689
0.558633
0.55864
0.558627
0.558656
0.558664
0.558705
0.558721
0.55878
0.55881
0.558871
0.558863
0.558838
0.558781
0.558763
0.558874
0.559687
0.559181
0.558691
0.55868
0.558761
0.558825
0.558784
0.558731
0.558642
0.558497
0.558519
0.558507
0.558507
0.558516
0.558525
0.558421
0.558469
0.558433
0.558493
0.55848
0.558533
0.558519
0.558587
0.55857
0.558669
0.558783
0.558844
0.558783
0.558693
0.558703
0.55916
0.558824
0.558629
0.558704
0.558816
0.558785
0.55865
0.558517
0.558401
0.558282
0.558264
0.558284
0.55831
0.558307
0.558328
0.558194
0.558272
0.558191
0.558326
0.558264
0.558342
0.558274
0.558342
0.558357
0.55849
0.558648
0.558794
0.558833
0.558724
0.558644
0.558826
0.558726
0.558657
0.558787
0.558793
0.558649
0.558463
0.558307
0.558188
0.5581
0.55805
0.558035
0.558067
0.558066
0.558106
0.557974
0.558018
0.557981
0.558119
0.558022
0.558115
0.558035
0.558091
0.558162
0.558288
0.558458
0.55865
0.558798
0.558803
0.558678
0.558735
0.558687
0.558729
0.558774
0.558657
0.558444
0.558236
0.558091
0.557995
0.557926
0.557881
0.557852
0.557839
0.557834
0.557871
0.557772
0.557788
0.557791
0.55788
0.557821
0.557863
0.557868
0.557912
0.557977
0.558078
0.55823
0.55844
0.558655
0.55878
0.558745
0.558701
0.558695
0.558715
0.558637
0.558455
0.558199
0.558004
0.557887
0.557815
0.557764
0.557727
0.557698
0.557682
0.557672
0.55767
0.55763
0.557629
0.557637
0.557678
0.557672
0.557693
0.557714
0.557753
0.557805
0.55788
0.558
0.558193
0.558445
0.558639
0.558722
0.558708
0.558668
0.558605
0.558464
0.558207
0.557955
0.557795
0.557703
0.557647
0.557606
0.557576
0.557554
0.557542
0.55753
0.557515
0.557504
0.557503
0.557508
0.557527
0.557534
0.557549
0.55757
0.557601
0.557643
0.557702
0.557792
0.557946
0.558194
0.558462
0.558608
0.558676
0.558588
0.558465
0.558248
0.557946
0.557733
0.55761
0.557534
0.557483
0.557449
0.557426
0.55741
0.557401
0.557392
0.557385
0.557379
0.557379
0.557384
0.557391
0.557397
0.557407
0.557426
0.557452
0.557487
0.557537
0.557608
0.557721
0.557929
0.55824
0.558466
0.558595
0.558483
0.558306
0.557984
0.557693
0.557535
0.55744
0.55737
0.557325
0.557292
0.557273
0.557263
0.557259
0.557256
0.557253
0.557253
0.557254
0.557255
0.557255
0.557258
0.557265
0.557278
0.557301
0.557335
0.55738
0.557439
0.55752
0.55767
0.55797
0.558304
0.558489
0.558359
0.558102
0.557711
0.557458
0.557358
0.557279
0.557206
0.557168
0.557137
0.557118
0.557112
0.557113
0.557117
0.557119
0.557127
0.557127
0.557124
0.557117
0.557114
0.557119
0.557127
0.557149
0.557184
0.557224
0.557279
0.557332
0.557436
0.557693
0.55809
0.558362
0.558219
0.557825
0.557456
0.557271
0.557182
0.557116
0.557027
0.557003
0.556978
0.55696
0.55696
0.556962
0.556975
0.55698
0.556989
0.556991
0.556986
0.556973
0.556966
0.556971
0.556969
0.556994
0.557024
0.557066
0.557107
0.557147
0.557253
0.557435
0.557805
0.55822
0.558023
0.557541
0.557253
0.557118
0.557013
0.556935
0.556823
0.556815
0.556806
0.556791
0.5568
0.556807
0.556822
0.556825
0.556848
0.556843
0.556841
0.556819
0.556814
0.556813
0.556805
0.55682
0.556853
0.556879
0.556905
0.557001
0.557106
0.557238
0.557518
0.558008
0.55774
0.557308
0.557107
0.556985
0.556862
0.556749
0.556641
0.556594
0.556613
0.556594
0.556623
0.556632
0.556659
0.556646
0.556696
0.556675
0.556683
0.556637
0.556648
0.556626
0.55662
0.556616
0.556644
0.556651
0.556743
0.556863
0.55698
0.557097
0.55729
0.557719
0.557504
0.557164
0.556989
0.55685
0.556704
0.556574
0.556467
0.556399
0.556376
0.556358
0.556427
0.556437
0.556488
0.556429
0.556532
0.55649
0.556509
0.556435
0.556469
0.556431
0.55641
0.55638
0.556407
0.556473
0.55658
0.556714
0.556854
0.556985
0.557151
0.557487
0.557336
0.557046
0.556867
0.556695
0.556529
0.55639
0.55629
0.556224
0.556193
0.556173
0.556189
0.556218
0.556282
0.556206
0.556338
0.556291
0.556326
0.556227
0.556278
0.556217
0.556182
0.556186
0.556226
0.556297
0.556406
0.556549
0.556711
0.556871
0.557036
0.557321
0.557198
0.556926
0.556721
0.55652
0.556338
0.556199
0.556109
0.556056
0.556029
0.556014
0.556014
0.556026
0.556054
0.556018
0.556108
0.556075
0.556106
0.556044
0.556047
0.556009
0.555998
0.556019
0.556054
0.556118
0.55622
0.556367
0.556549
0.556735
0.556923
0.557186
0.557066
0.556788
0.55655
0.556326
0.556138
0.556007
0.555931
0.555891
0.555872
0.555864
0.555867
0.555872
0.555884
0.555877
0.555904
0.555893
0.555903
0.555871
0.555863
0.555849
0.555846
0.555859
0.555887
0.555939
0.556029
0.556173
0.556368
0.556577
0.556795
0.557059
0.556929
0.556631
0.556358
0.556115
0.555938
0.555822
0.55576
0.555729
0.555717
0.555715
0.555722
0.55573
0.555741
0.555742
0.555747
0.555743
0.555739
0.555726
0.555717
0.555706
0.555699
0.555704
0.555724
0.555765
0.555842
0.555973
0.556167
0.556396
0.55665
0.55693
0.556784
0.556454
0.556148
0.555897
0.555744
0.555649
0.555599
0.555572
0.555562
0.555565
0.555576
0.555589
0.555601
0.555608
0.555611
0.555607
0.5556
0.55559
0.555576
0.555562
0.555551
0.55555
0.555565
0.555597
0.555663
0.555772
0.555954
0.556196
0.556486
0.556792
0.556629
0.556255
0.555929
0.555689
0.55556
0.555488
0.555446
0.555418
0.555408
0.555411
0.555426
0.555444
0.555459
0.555471
0.555474
0.555471
0.555462
0.555451
0.555434
0.555416
0.555402
0.555396
0.555408
0.555438
0.555493
0.555583
0.555732
0.55598
0.5563
0.556645
0.556462
0.556041
0.555714
0.5555
0.55538
0.555324
0.555293
0.555263
0.555253
0.555256
0.555272
0.555294
0.555312
0.555331
0.555335
0.555332
0.555324
0.555309
0.555291
0.555268
0.555252
0.555241
0.555254
0.555282
0.555333
0.555405
0.555524
0.555761
0.556094
0.556487
0.556279
0.555822
0.555517
0.555337
0.555224
0.555141
0.555132
0.555097
0.555092
0.555097
0.555116
0.55514
0.555162
0.555185
0.555191
0.55519
0.555182
0.555165
0.555145
0.555112
0.555099
0.555082
0.555095
0.555121
0.555168
0.55522
0.55534
0.555553
0.555876
0.556316
0.556063
0.555619
0.555352
0.555198
0.555083
0.554981
0.554934
0.554902
0.554916
0.554929
0.554951
0.554979
0.555002
0.555033
0.555033
0.555041
0.55503
0.555012
0.554988
0.55495
0.554936
0.554912
0.554917
0.554937
0.554979
0.55506
0.555187
0.55537
0.555663
0.55612
0.555862
0.555447
0.555215
0.555071
0.554942
0.554822
0.554733
0.554684
0.55471
0.554743
0.554773
0.554804
0.554826
0.554871
0.554866
0.554882
0.55486
0.554848
0.554819
0.55477
0.554764
0.554726
0.554708
0.554727
0.554799
0.554911
0.555047
0.555215
0.555475
0.555906
0.555683
0.555303
0.555093
0.554942
0.554791
0.554653
0.554551
0.554489
0.554487
0.554539
0.554573
0.554613
0.554629
0.554695
0.554679
0.55471
0.554663
0.554651
0.554632
0.554583
0.554583
0.554513
0.554492
0.554537
0.554627
0.554755
0.554908
0.555079
0.555317
0.555718
0.555525
0.555178
0.554976
0.554801
0.554623
0.55447
0.554364
0.554309
0.554292
0.554324
0.554363
0.5544
0.554418
0.554491
0.554467
0.55449
0.554458
0.554441
0.554424
0.554387
0.554388
0.554311
0.554306
0.554352
0.554444
0.554585
0.55476
0.554949
0.555178
0.555551
0.555388
0.555063
0.554848
0.554643
0.554436
0.554273
0.554173
0.554129
0.554119
0.554142
0.554174
0.554208
0.554232
0.554263
0.554281
0.554288
0.554283
0.554265
0.554246
0.554212
0.554186
0.554135
0.554128
0.554166
0.55425
0.554396
0.554595
0.554809
0.555049
0.555403
0.555264
0.554946
0.554701
0.55446
0.55423
0.554067
0.553979
0.553948
0.553951
0.553976
0.554007
0.55404
0.554067
0.554085
0.554108
0.554122
0.554119
0.554106
0.554081
0.554046
0.554006
0.553965
0.553952
0.553978
0.55405
0.554192
0.554409
0.554652
0.55492
0.555269
0.555146
0.554816
0.554528
0.554249
0.554011
0.553858
0.553789
0.553771
0.553785
0.553814
0.553851
0.553888
0.553919
0.553942
0.55396
0.553971
0.553965
0.553949
0.55392
0.553881
0.553836
0.553797
0.553779
0.553794
0.553851
0.55398
0.554199
0.55447
0.554776
0.555139
0.555023
0.554665
0.554326
0.554011
0.553786
0.553656
0.553604
0.553599
0.553619
0.553654
0.553696
0.553738
0.553774
0.553799
0.553817
0.553823
0.553815
0.553793
0.553758
0.553715
0.553668
0.55363
0.553609
0.553617
0.553661
0.55377
0.553972
0.554262
0.554612
0.555003
0.554888
0.554487
0.554095
0.553759
0.553563
0.553464
0.55343
0.553431
0.553456
0.553493
0.55354
0.553586
0.553626
0.553652
0.553671
0.553673
0.553662
0.553634
0.553594
0.553548
0.553499
0.553462
0.553442
0.553447
0.553482
0.553568
0.553735
0.554033
0.554423
0.554855
0.554736
0.554277
0.553844
0.553511
0.553345
0.553286
0.553262
0.553267
0.55329
0.55333
0.553379
0.553429
0.553473
0.553504
0.553521
0.553521
0.553504
0.553472
0.553428
0.553378
0.553328
0.553293
0.553274
0.553282
0.553313
0.553379
0.553512
0.553796
0.554207
0.554693
0.55457
0.554037
0.553584
0.553282
0.553148
0.553117
0.553095
0.5531
0.553123
0.553163
0.553215
0.553268
0.553315
0.553348
0.553367
0.553362
0.553343
0.553308
0.553259
0.553204
0.553152
0.553119
0.553101
0.553116
0.553147
0.553199
0.553313
0.553564
0.553973
0.554515
0.554367
0.553779
0.553337
0.553094
0.55298
0.552943
0.552921
0.552927
0.552948
0.552989
0.553044
0.553102
0.553151
0.553189
0.553204
0.553199
0.553176
0.55314
0.553082
0.553019
0.552964
0.552938
0.552923
0.55294
0.552969
0.553031
0.553143
0.553353
0.553737
0.554301
0.554136
0.553527
0.553123
0.552931
0.552829
0.552762
0.552724
0.552733
0.552756
0.552799
0.552862
0.552923
0.552981
0.55302
0.553036
0.553027
0.553004
0.552961
0.552881
0.552815
0.552756
0.552748
0.552733
0.552738
0.552778
0.552873
0.552992
0.553174
0.553518
0.554085
0.553906
0.553297
0.552955
0.552792
0.552682
0.552586
0.552522
0.552512
0.552539
0.552585
0.552662
0.552731
0.552795
0.552845
0.552851
0.552846
0.552818
0.552763
0.552676
0.55261
0.552551
0.552535
0.552523
0.552521
0.552589
0.552716
0.552852
0.55302
0.553322
0.553877
0.553684
0.553102
0.552817
0.552666
0.552526
0.552397
0.552311
0.552285
0.552308
0.55236
0.552439
0.552514
0.552589
0.552641
0.552644
0.552645
0.552603
0.552549
0.552477
0.552405
0.552339
0.552304
0.552286
0.552302
0.552394
0.552547
0.552713
0.552885
0.553155
0.553679
0.55348
0.552949
0.552704
0.552538
0.552352
0.552188
0.55208
0.552055
0.552085
0.552144
0.552219
0.552293
0.552361
0.552409
0.552425
0.552426
0.552396
0.552347
0.552277
0.552202
0.552123
0.552076
0.552048
0.552074
0.552178
0.552358
0.552569
0.552765
0.553011
0.553498
0.553301
0.552826
0.552605
0.552394
0.55215
0.55195
0.551832
0.55181
0.551859
0.551927
0.552006
0.552085
0.552154
0.552201
0.552224
0.552226
0.552199
0.552151
0.552078
0.551994
0.551908
0.551838
0.551799
0.551826
0.551934
0.552145
0.552409
0.552651
0.552889
0.553336
0.553156
0.552738
0.552506
0.552214
0.551903
0.551673
0.551569
0.551563
0.551627
0.551708
0.551794
0.551879
0.551953
0.551995
0.552028
0.55203
0.552003
0.551952
0.551876
0.551785
0.551689
0.551606
0.551551
0.551555
0.551653
0.551885
0.552215
0.552535
0.552794
0.553199
0.553055
0.552677
0.552375
0.551972
0.551584
0.551361
0.551295
0.551318
0.551391
0.551486
0.55158
0.55167
0.551745
0.551787
0.55183
0.551832
0.551805
0.551751
0.551671
0.551575
0.551471
0.551379
0.551309
0.551282
0.551339
0.551555
0.551956
0.552391
0.552722
0.553102
0.553
0.552579
0.552176
0.551592
0.551178
0.551033
0.551034
0.551088
0.551166
0.551265
0.551365
0.551459
0.551538
0.551588
0.551628
0.551631
0.551604
0.551545
0.551462
0.551363
0.551258
0.551162
0.551084
0.551027
0.551013
0.551135
0.551553
0.552172
0.552608
0.553037
0.552875
0.552429
0.55174
0.551
0.550752
0.550755
0.550823
0.550887
0.550957
0.551049
0.551148
0.551245
0.551328
0.551386
0.551423
0.551425
0.551396
0.551337
0.551251
0.55115
0.551047
0.550959
0.550889
0.550824
0.550747
0.550727
0.550936
0.551692
0.552449
0.552904
0.552737
0.552082
0.550784
0.550509
0.550472
0.550593
0.550682
0.550724
0.550764
0.550835
0.55093
0.551029
0.551117
0.551179
0.551214
0.551216
0.551186
0.551124
0.551036
0.550935
0.550839
0.550771
0.550734
0.550693
0.550596
0.550465
0.550468
0.550712
0.552041
0.552764
0.55259
0.550841
0.550437
0.550251
0.550375
0.550564
0.550618
0.55059
0.55057
0.550614
0.550705
0.550809
0.550901
0.550967
0.551002
0.551004
0.550971
0.550906
0.550815
0.550713
0.550624
0.550581
0.550606
0.550639
0.550581
0.55038
0.550232
0.550401
0.550775
0.552613
0.552328
0.550518
0.550199
0.550144
0.550477
0.550652
0.550582
0.550424
0.55034
0.55037
0.550466
0.550577
0.550677
0.550749
0.550785
0.550785
0.550751
0.55068
0.550582
0.550476
0.550384
0.550354
0.550444
0.550607
0.550679
0.550492
0.550134
0.550166
0.550482
0.55228
0.550945
0.55029
0.549981
0.550311
0.550771
0.550754
0.550445
0.550142
0.550043
0.550087
0.550204
0.550333
0.550443
0.550523
0.55056
0.55056
0.55052
0.550443
0.550334
0.550216
0.550106
0.55006
0.550162
0.550469
0.550782
0.550793
0.550321
0.54995
0.550255
0.550902
0.550619
0.550083
0.550113
0.550889
0.551068
0.550658
0.550075
0.549715
0.549656
0.549755
0.549916
0.550071
0.550198
0.550285
0.550326
0.550324
0.550279
0.550192
0.550071
0.549924
0.549775
0.549669
0.549727
0.550086
0.550683
0.551087
0.550917
0.550113
0.55005
0.550584
0.550361
0.550042
0.550974
0.55144
0.551013
0.550193
0.549402
0.549085
0.549168
0.549377
0.549602
0.549794
0.549938
0.550039
0.550077
0.550075
0.550025
0.549927
0.54979
0.549605
0.549389
0.549168
0.549074
0.549396
0.550208
0.551026
0.551471
0.551001
0.550028
0.550329
0.550184
0.550942
0.551756
0.551284
0.550527
0.549231
0.548272
0.548286
0.548613
0.54897
0.54927
0.549499
0.549661
0.549775
0.549811
0.549809
0.549751
0.549647
0.549493
0.54927
0.548975
0.548612
0.548268
0.548251
0.549231
0.550543
0.551314
0.551789
0.550959
0.550153
0.550719
0.551985
0.551588
0.550834
0.549433
0.547272
0.546831
0.547433
0.548059
0.548563
0.548925
0.549183
0.549359
0.549477
0.549518
0.549515
0.549459
0.54935
0.549178
0.548924
0.548562
0.548057
0.547424
0.546813
0.547261
0.549439
0.550864
0.551617
0.552017
0.550714
0.551857
0.5519
0.5512
0.549951
0.54651
0.544379
0.545572
0.546687
0.547573
0.548177
0.548581
0.548854
0.549034
0.549148
0.5492
0.549198
0.549146
0.549033
0.548853
0.54858
0.548175
0.547571
0.546683
0.545562
0.544372
0.546487
0.549977
0.551228
0.551928
0.551875
0.552228
0.551574
0.550492
0.546188
0.540936
0.542574
0.544686
0.54619
0.547179
0.547814
0.548231
0.54851
0.548691
0.548803
0.548855
0.548855
0.548802
0.548692
0.548508
0.54823
0.547811
0.547177
0.546186
0.544681
0.542551
0.540895
0.546144
0.550518
0.551602
0.552256
0.551935
0.551068
0.547042
0.536127
0.538188
0.541926
0.544301
0.545855
0.546827
0.54745
0.547857
0.548131
0.548307
0.548416
0.548465
0.548466
0.548414
0.548308
0.548128
0.547857
0.547446
0.546826
0.545853
0.544298
0.541918
0.538171
0.536102
0.547027
0.551096
0.551963
0.551527
0.548347
0.533772
0.534509
0.537792
0.541772
0.544125
0.545577
0.546478
0.547061
0.547446
0.547703
0.54787
0.547971
0.548018
0.548018
0.54797
0.54787
0.547702
0.547446
0.547059
0.546477
0.545576
0.544124
0.541771
0.537786
0.534489
0.533723
0.548335
0.551555
0.550282
0.531778
0.531962
0.534134
0.538369
0.541898
0.544001
0.545286
0.546096
0.546625
0.546977
0.547212
0.547364
0.547455
0.547498
0.547498
0.547455
0.547364
0.547211
0.546977
0.546624
0.546095
0.545286
0.544
0.541898
0.538372
0.534115
0.531942
0.53174
0.550275
0.544386
0.529635
0.53216
0.53523
0.539334
0.542092
0.543841
0.544935
0.54564
0.546106
0.546416
0.546622
0.546755
0.546835
0.546873
0.546873
0.546835
0.546755
0.546621
0.546415
0.546105
0.54564
0.544934
0.543841
0.542092
0.539336
0.535224
0.53214
0.529614
0.544362
0.537752
0.528388
0.533355
0.536395
0.539937
0.542113
0.543552
0.544468
0.545065
0.545458
0.54572
0.545893
0.546005
0.546072
0.546104
0.546104
0.546072
0.546005
0.545893
0.545719
0.545458
0.545065
0.544468
0.543552
0.542113
0.539937
0.536396
0.533348
0.528366
0.537738
0.53345
0.527238
0.534528
0.537006
0.540109
0.541907
0.543079
0.54382
0.544298
0.544612
0.544821
0.544958
0.545046
0.5451
0.545125
0.545125
0.5451
0.545046
0.544957
0.54482
0.544611
0.544298
0.54382
0.543079
0.541907
0.540109
0.537008
0.534529
0.527218
0.533447
0.530175
0.526942
0.535581
0.537491
0.540066
0.541418
0.542282
0.542824
0.543173
0.543405
0.54356
0.543662
0.543728
0.543768
0.543787
0.543787
0.543767
0.543727
0.543661
0.54356
0.543405
0.543173
0.542823
0.542282
0.541418
0.540067
0.537492
0.535584
0.526935
0.530172
0.527581
0.530207
0.536671
0.537477
0.539207
0.539961
0.540478
0.540808
0.541042
0.541205
0.541316
0.541392
0.541444
0.541476
0.541491
0.541491
0.541475
0.541443
0.541392
0.541316
0.541204
0.541042
0.540808
0.540478
0.539962
0.539208
0.537479
0.536672
0.530212
0.52758
0.523296
0.528365
0.530561
0.530441
0.530599
0.530289
0.530115
0.529982
0.52991
0.529871
0.529858
0.529858
0.529867
0.529875
0.529881
0.529881
0.529875
0.529866
0.529858
0.529858
0.52987
0.529909
0.529981
0.530115
0.530289
0.530599
0.530442
0.530562
0.528367
0.523296
0.464136
0.473712
0.473287
0.469467
0.466236
0.463424
0.461405
0.459949
0.458916
0.458186
0.457688
0.457346
0.45713
0.456999
0.45694
0.45694
0.456999
0.45713
0.457345
0.457687
0.458185
0.458914
0.459948
0.461404
0.463423
0.466235
0.469468
0.473288
0.473714
0.464139
0.226091
0.240886
0.247716
0.246396
0.243805
0.240927
0.238504
0.236555
0.235047
0.233901
0.233047
0.232436
0.232015
0.231752
0.231627
0.231627
0.231751
0.232014
0.232436
0.233047
0.2339
0.235046
0.236555
0.238504
0.240927
0.243806
0.246397
0.247719
0.240891
0.226097
0.0879602
0.101989
0.117364
0.12254
0.124348
0.124316
0.123741
0.123006
0.122307
0.121709
0.121209
0.120836
0.120554
0.120377
0.12029
0.12029
0.120376
0.120554
0.120836
0.121209
0.12171
0.122308
0.123007
0.123743
0.124318
0.124351
0.122544
0.117369
0.101996
0.0879671
0.0217957
0.0288645
0.0408422
0.0473052
0.0512043
0.0529609
0.0538038
0.0541363
0.0542366
0.0542357
0.0541811
0.0541215
0.0540588
0.0540164
0.0539944
0.0539944
0.0540165
0.054059
0.0541219
0.0541817
0.0542366
0.0542379
0.0541381
0.0538062
0.052964
0.0512082
0.04731
0.0408469
0.0288691
0.0217994
0.00246918
0.00355838
0.00643193
0.00872644
0.0106211
0.0117402
0.0124391
0.0128429
0.0130813
0.0132251
0.01331
0.0133604
0.0133878
0.0134019
0.0134078
0.0134079
0.013402
0.0133879
0.0133606
0.0133103
0.0132255
0.0130819
0.0128438
0.0124402
0.0117415
0.0106227
0.00872812
0.00643324
0.00355924
0.0024698
0.000107111
0.000149981
0.000329861
0.000534569
0.000753946
0.000915332
0.00103218
0.00110918
0.00115933
0.00119256
0.00121423
0.00122852
0.00123732
0.00124222
0.00124443
0.00124443
0.00124223
0.00123732
0.00122854
0.00121425
0.0011926
0.00115939
0.00110928
0.00103231
0.000915481
0.000754105
0.00053471
0.000329949
0.000150023
0.000107143
1.50593e-06
1.8082e-06
4.44463e-06
8.60612e-06
1.42083e-05
1.92606e-05
2.34337e-05
2.64734e-05
2.86026e-05
3.00716e-05
3.10794e-05
3.1753e-05
3.21864e-05
3.2431e-05
3.25416e-05
3.25416e-05
3.24309e-05
3.21862e-05
3.1753e-05
3.10797e-05
3.00724e-05
2.86041e-05
2.64757e-05
2.34368e-05
1.92643e-05
1.42118e-05
8.60872e-06
4.44591e-06
1.8087e-06
1.50642e-06
5.58582e-09
5.17273e-09
1.29922e-08
2.96036e-08
5.68963e-08
8.66256e-08
1.14476e-07
1.36705e-07
1.53357e-07
1.652e-07
1.73649e-07
1.79255e-07
1.8298e-07
1.8508e-07
1.86019e-07
1.86018e-07
1.85078e-07
1.82977e-07
1.79252e-07
1.73648e-07
1.65202e-07
1.53364e-07
1.36717e-07
1.14492e-07
8.66441e-08
5.69121e-08
2.96133e-08
1.29962e-08
5.17408e-09
5.58759e-09
5.72878e-12
4.17363e-12
8.00752e-12
1.91198e-11
4.06397e-11
6.83632e-11
9.74639e-11
1.22718e-10
1.42794e-10
1.57489e-10
1.68242e-10
1.75307e-10
1.80094e-10
1.82766e-10
1.83931e-10
1.8393e-10
1.82763e-10
1.80089e-10
1.75303e-10
1.6824e-10
1.5749e-10
1.42801e-10
1.2273e-10
9.74801e-11
6.83798e-11
4.06522e-11
1.91265e-11
8.00993e-12
4.17437e-12
5.7292e-12
1.29397e-12
1.15623e-12
1.03269e-12
9.94633e-13
9.66619e-13
9.69384e-13
9.60632e-13
9.48347e-13
9.51034e-13
9.63235e-13
9.52879e-13
9.37167e-13
9.52099e-13
9.58948e-13
9.62093e-13
9.62122e-13
9.59031e-13
9.52232e-13
9.37337e-13
9.53089e-13
9.63472e-13
9.51285e-13
9.48603e-13
9.609e-13
9.69655e-13
9.66843e-13
9.94878e-13
1.03289e-12
1.15629e-12
1.2933e-12
9.6032e-13
8.62992e-13
7.72181e-13
7.51803e-13
7.34268e-13
7.39577e-13
7.33996e-13
7.25604e-13
7.28837e-13
7.37466e-13
7.29028e-13
7.16343e-13
7.28307e-13
7.33741e-13
7.36449e-13
7.36473e-13
7.33809e-13
7.28416e-13
7.16483e-13
7.29199e-13
7.37659e-13
7.29041e-13
7.2581e-13
7.34209e-13
7.3979e-13
7.34439e-13
7.51989e-13
7.72326e-13
8.63007e-13
9.59705e-13
6.78819e-13
6.17301e-13
5.56232e-13
5.48055e-13
5.38123e-13
5.4428e-13
5.41346e-13
5.36435e-13
5.40436e-13
5.46674e-13
5.40637e-13
5.31165e-13
5.40501e-13
5.44753e-13
5.47042e-13
5.47061e-13
5.44808e-13
5.40587e-13
5.31275e-13
5.40773e-13
5.46826e-13
5.40596e-13
5.36596e-13
5.4151e-13
5.44442e-13
5.38248e-13
5.48191e-13
5.56336e-13
6.173e-13
6.78318e-13
4.55883e-13
4.23102e-13
3.86706e-13
3.85627e-13
3.80467e-13
3.86136e-13
3.84646e-13
3.81936e-13
3.85802e-13
3.90133e-13
3.86038e-13
3.79277e-13
3.86082e-13
3.89242e-13
3.91019e-13
3.91034e-13
3.89283e-13
3.86147e-13
3.79361e-13
3.86141e-13
3.90249e-13
3.85923e-13
3.82057e-13
3.84769e-13
3.86256e-13
3.80557e-13
3.85725e-13
3.86778e-13
4.23099e-13
4.55516e-13
2.89926e-13
2.77423e-13
2.58707e-13
2.60922e-13
2.58493e-13
2.63037e-13
2.62261e-13
2.60812e-13
2.63929e-13
2.66811e-13
2.64131e-13
2.59509e-13
2.64082e-13
2.663e-13
2.67545e-13
2.67555e-13
2.6633e-13
2.64129e-13
2.5957e-13
2.64205e-13
2.66894e-13
2.64016e-13
2.609e-13
2.6235e-13
2.63123e-13
2.58554e-13
2.60991e-13
2.58757e-13
2.7742e-13
2.89682e-13
1.74637e-13
1.73976e-13
1.65919e-13
1.68951e-13
1.67892e-13
1.71155e-13
1.70709e-13
1.69941e-13
1.72116e-13
1.73944e-13
1.72239e-13
1.69217e-13
1.72034e-13
1.73502e-13
1.74283e-13
1.7429e-13
1.73523e-13
1.72066e-13
1.69258e-13
1.7229e-13
1.74001e-13
1.72175e-13
1.7e-13
1.70768e-13
1.71213e-13
1.67932e-13
1.68997e-13
1.65951e-13
1.73974e-13
1.74485e-13
9.98462e-14
1.04325e-13
1.01658e-13
1.04275e-13
1.03807e-13
1.05924e-13
1.05623e-13
1.05203e-13
1.06541e-13
1.07634e-13
1.06579e-13
1.04691e-13
1.06275e-13
1.07189e-13
1.07628e-13
1.07633e-13
1.07202e-13
1.06296e-13
1.04718e-13
1.06611e-13
1.07671e-13
1.06579e-13
1.05241e-13
1.05661e-13
1.05961e-13
1.03831e-13
1.04304e-13
1.01678e-13
1.04324e-13
9.97576e-14
5.43056e-14
5.97637e-14
5.93388e-14
6.11782e-14
6.09358e-14
6.21826e-14
6.19554e-14
6.17117e-14
6.24405e-14
6.30505e-14
6.24164e-14
6.12925e-14
6.21012e-14
6.26348e-14
6.28543e-14
6.2857e-14
6.26426e-14
6.21136e-14
6.13086e-14
6.24359e-14
6.30724e-14
6.24634e-14
6.17347e-14
6.19784e-14
6.2205e-14
6.09491e-14
6.11952e-14
5.93506e-14
5.97631e-14
5.42567e-14
2.81425e-14
3.26648e-14
3.29383e-14
3.40715e-14
3.39186e-14
3.45875e-14
3.44143e-14
3.42648e-14
3.46148e-14
3.493e-14
3.45626e-14
3.3925e-14
3.42969e-14
3.45884e-14
3.46852e-14
3.46867e-14
3.45928e-14
3.43039e-14
3.3934e-14
3.45736e-14
3.49424e-14
3.46278e-14
3.42778e-14
3.44274e-14
3.46002e-14
3.39254e-14
3.4081e-14
3.29448e-14
3.26644e-14
2.81167e-14
1.3909e-14
1.70163e-14
1.73738e-14
1.80067e-14
1.79018e-14
1.82296e-14
1.81049e-14
1.80117e-14
1.81573e-14
1.8307e-14
1.81027e-14
1.77581e-14
1.79099e-14
1.80589e-14
1.80954e-14
1.80962e-14
1.80612e-14
1.79136e-14
1.77629e-14
1.81085e-14
1.83136e-14
1.81642e-14
1.80187e-14
1.81118e-14
1.82363e-14
1.7905e-14
1.80117e-14
1.73772e-14
1.7016e-14
1.3896e-14
6.55986e-15
8.44474e-15
8.70932e-15
9.03583e-15
8.96586e-15
9.11263e-15
9.02994e-15
8.97345e-15
9.02308e-15
9.088e-15
8.97939e-15
8.80197e-15
8.85516e-15
8.92641e-15
8.93728e-15
8.93769e-15
8.92758e-15
8.85701e-15
8.8044e-15
8.98234e-15
9.09132e-15
9.02655e-15
8.97696e-15
9.03344e-15
9.11603e-15
8.96728e-15
9.03832e-15
8.71097e-15
8.44456e-15
6.55364e-15
2.9538e-15
3.99315e-15
4.1527e-15
4.31014e-15
4.26687e-15
4.32675e-15
4.27649e-15
4.24395e-15
4.25531e-15
4.28071e-15
4.22567e-15
4.13856e-15
4.15316e-15
4.18506e-15
4.18681e-15
4.187e-15
4.18562e-15
4.15403e-15
4.13971e-15
4.22707e-15
4.28229e-15
4.25696e-15
4.24562e-15
4.27816e-15
4.32837e-15
4.26743e-15
4.31132e-15
4.15347e-15
3.99304e-15
2.95095e-15
1.27062e-15
1.80034e-15
1.88577e-15
1.95731e-15
1.93274e-15
1.95481e-15
1.92671e-15
1.9091e-15
1.90836e-15
1.91712e-15
1.89056e-15
1.84974e-15
1.85171e-15
1.8651e-15
1.86443e-15
1.86452e-15
1.86535e-15
1.85211e-15
1.85026e-15
1.8912e-15
1.91783e-15
1.90911e-15
1.90986e-15
1.92747e-15
1.95554e-15
1.93293e-15
1.95784e-15
1.88611e-15
1.80028e-15
1.26937e-15
5.22557e-16
7.74779e-16
8.16817e-16
8.47639e-16
8.34784e-16
8.41986e-16
8.27455e-16
8.18526e-16
8.15587e-16
8.18104e-16
8.05902e-16
7.87621e-16
7.86611e-16
7.9187e-16
7.91013e-16
7.9105e-16
7.91978e-16
7.8678e-16
7.87846e-16
8.06174e-16
8.18411e-16
8.15909e-16
8.18853e-16
8.27781e-16
8.42304e-16
8.34844e-16
8.47866e-16
8.1696e-16
7.74748e-16
5.22032e-16
2.05661e-16
3.18684e-16
3.38033e-16
3.50681e-16
3.44449e-16
3.46426e-16
3.39426e-16
3.35179e-16
3.32878e-16
3.33371e-16
3.28029e-16
3.20199e-16
3.19083e-16
3.21017e-16
3.20454e-16
3.20469e-16
3.2106e-16
3.19152e-16
3.20291e-16
3.2814e-16
3.33496e-16
3.3301e-16
3.35313e-16
3.3956e-16
3.46557e-16
3.44463e-16
3.50774e-16
3.38091e-16
3.1867e-16
2.05451e-16
7.75448e-17
1.25469e-16
1.33883e-16
1.38845e-16
1.36026e-16
1.3641e-16
1.33251e-16
1.3135e-16
1.30015e-16
1.29989e-16
1.27758e-16
1.24546e-16
1.2386e-16
1.24523e-16
1.2423e-16
1.24236e-16
1.2454e-16
1.23886e-16
1.24582e-16
1.27802e-16
1.30038e-16
1.30067e-16
1.31403e-16
1.33304e-16
1.36461e-16
1.36027e-16
1.38882e-16
1.33906e-16
1.25463e-16
7.74642e-17
2.80452e-17
4.7355e-17
5.08332e-17
5.27005e-17
5.15035e-17
5.14991e-17
5.01573e-17
4.93531e-17
4.86899e-17
4.85948e-17
4.77052e-17
4.64415e-17
4.61005e-17
4.63114e-17
4.61779e-17
4.61801e-17
4.63178e-17
4.61106e-17
4.64549e-17
4.77215e-17
4.86133e-17
4.87093e-17
4.9373e-17
5.01772e-17
5.15186e-17
5.15023e-17
5.27143e-17
5.08417e-17
4.73525e-17
2.80156e-17
9.74133e-18
1.71592e-17
1.8532e-17
1.92077e-17
1.87282e-17
1.86732e-17
1.81339e-17
1.78114e-17
1.75146e-17
1.7449e-17
1.71095e-17
1.66321e-17
1.6483e-17
1.65443e-17
1.64891e-17
1.64899e-17
1.65466e-17
1.64866e-17
1.66369e-17
1.71154e-17
1.74556e-17
1.75216e-17
1.78187e-17
1.81412e-17
1.86802e-17
1.87272e-17
1.92127e-17
1.8535e-17
1.71583e-17
9.73096e-18
3.25376e-18
5.97814e-18
6.49697e-18
6.73263e-18
6.55067e-18
6.51321e-18
6.30743e-18
6.18441e-18
6.06182e-18
6.02799e-18
5.90383e-18
5.73047e-18
5.67093e-18
5.68686e-18
5.66566e-18
5.66593e-18
5.68765e-18
5.67218e-18
5.73214e-18
5.90586e-18
6.03029e-18
6.06425e-18
6.18691e-18
6.30994e-18
6.51567e-18
6.55009e-18
6.73438e-18
6.49804e-18
5.97783e-18
3.25029e-18
1.04643e-18
2.0053e-18
2.19353e-18
2.2729e-18
2.20722e-18
2.18867e-18
2.11383e-18
2.06904e-18
2.02168e-18
2.00663e-18
1.96304e-18
1.90244e-18
1.88035e-18
1.8838e-18
1.87616e-18
1.87625e-18
1.88406e-18
1.88076e-18
1.90299e-18
1.96372e-18
2.0074e-18
2.02249e-18
2.06988e-18
2.11467e-18
2.18949e-18
2.20695e-18
2.27349e-18
2.19389e-18
2.00521e-18
1.04532e-18
3.24429e-19
6.48506e-19
7.14175e-19
7.40033e-19
7.17415e-19
7.09533e-19
6.83519e-19
6.67914e-19
6.50635e-19
6.44572e-19
6.29854e-19
6.0944e-19
6.01733e-19
6.0222e-19
5.99618e-19
5.99646e-19
6.02304e-19
6.01866e-19
6.09618e-19
6.30071e-19
6.44817e-19
6.50895e-19
6.68183e-19
6.83789e-19
7.09799e-19
7.17306e-19
7.40225e-19
7.14294e-19
6.48481e-19
3.24091e-19
9.70796e-20
2.02449e-19
2.24516e-19
2.32678e-19
2.25225e-19
2.22193e-19
2.13528e-19
2.08312e-19
2.02323e-19
2.00054e-19
1.95269e-19
1.88635e-19
1.86088e-19
1.86039e-19
1.85195e-19
1.85204e-19
1.86064e-19
1.86128e-19
1.88689e-19
1.95336e-19
2.0013e-19
2.02404e-19
2.08395e-19
2.13611e-19
2.22276e-19
2.25184e-19
2.32737e-19
2.24554e-19
2.02442e-19
9.69829e-20
2.80701e-20
6.10785e-20
6.82318e-20
7.07299e-20
6.83758e-20
6.72931e-20
6.45207e-20
6.28445e-20
6.08633e-20
6.00649e-20
5.85642e-20
5.64819e-20
5.568e-20
5.56035e-20
5.5342e-20
5.53445e-20
5.56111e-20
5.56921e-20
5.64983e-20
5.85842e-20
6.00876e-20
6.08873e-20
6.28695e-20
6.45457e-20
6.73178e-20
6.8361e-20
7.07477e-20
6.82429e-20
6.1077e-20
2.80438e-20
7.85132e-21
1.78285e-20
2.00678e-20
2.08104e-20
2.00958e-20
1.97321e-20
1.88784e-20
1.83595e-20
1.77316e-20
1.74651e-20
1.70106e-20
1.63788e-20
1.61372e-20
1.60967e-20
1.6019e-20
1.60197e-20
1.60989e-20
1.61407e-20
1.63835e-20
1.70164e-20
1.74717e-20
1.77386e-20
1.83667e-20
1.88857e-20
1.97392e-20
2.00909e-20
2.08155e-20
2.0071e-20
1.78282e-20
7.84451e-21
2.1265e-21
5.04018e-21
5.71795e-21
5.93249e-21
5.7237e-21
5.60775e-21
5.3543e-21
5.19929e-21
5.00808e-21
4.92322e-21
4.7901e-21
4.60458e-21
4.53472e-21
4.51808e-21
4.49601e-21
4.49621e-21
4.51869e-21
4.5357e-21
4.6059e-21
4.79171e-21
4.92505e-21
5.01003e-21
5.20131e-21
5.35632e-21
5.60975e-21
5.72211e-21
5.93392e-21
5.71884e-21
5.04017e-21
2.12482e-21
5.58257e-22
1.38137e-21
1.57989e-21
1.6402e-21
1.58137e-21
1.54609e-21
1.47342e-21
1.42867e-21
1.37259e-21
1.34671e-21
1.30896e-21
1.2562e-21
1.23675e-21
1.23076e-21
1.22476e-21
1.22481e-21
1.23093e-21
1.23701e-21
1.25655e-21
1.3094e-21
1.34721e-21
1.37312e-21
1.42922e-21
1.47397e-21
1.54664e-21
1.58089e-21
1.64059e-21
1.58014e-21
1.38138e-21
5.57856e-22
1.42183e-22
3.67374e-22
4.23703e-22
4.40209e-22
4.24199e-22
4.13913e-22
3.93759e-22
3.8126e-22
3.65385e-22
3.578e-22
3.47426e-22
3.32875e-22
3.27652e-22
3.25683e-22
3.2411e-22
3.24125e-22
3.25727e-22
3.27722e-22
3.32969e-22
3.47541e-22
3.57931e-22
3.65524e-22
3.81405e-22
3.93905e-22
4.14057e-22
4.24061e-22
4.40314e-22
4.23771e-22
3.67384e-22
1.42091e-22
3.51638e-23
9.48898e-23
1.10386e-22
1.14788e-22
1.10575e-22
1.07691e-22
1.02278e-22
9.88961e-23
9.45515e-23
9.24104e-23
8.96442e-23
8.57503e-23
8.43946e-23
8.37887e-23
8.33919e-23
8.33954e-23
8.37998e-23
8.44124e-23
8.57742e-23
8.96737e-23
9.24439e-23
9.45872e-23
9.89334e-23
1.02316e-22
1.07728e-22
1.10537e-22
1.14816e-22
1.10404e-22
9.48942e-23
3.51431e-23
8.45147e-24
2.38234e-23
2.79601e-23
2.91048e-23
2.80316e-23
2.7252e-23
2.58425e-23
2.4955e-23
2.38036e-23
2.32202e-23
2.2504e-23
2.14919e-23
2.11512e-23
2.09747e-23
2.0878e-23
2.08789e-23
2.09775e-23
2.11556e-23
2.14979e-23
2.25113e-23
2.32285e-23
2.38125e-23
2.49643e-23
2.58519e-23
2.72614e-23
2.80216e-23
2.9112e-23
2.79651e-23
2.3825e-23
8.44695e-24
1.97561e-24
5.81846e-24
6.89092e-24
7.18126e-24
6.91629e-24
6.71273e-24
6.35645e-24
6.13036e-24
5.83453e-24
5.68079e-24
5.50058e-24
5.24489e-24
5.16184e-24
5.11281e-24
5.09e-24
5.09022e-24
5.11347e-24
5.1629e-24
5.24633e-24
5.50235e-24
5.6828e-24
5.83669e-24
6.13263e-24
6.35876e-24
6.71504e-24
6.91375e-24
7.1831e-24
6.89225e-24
5.81898e-24
1.97465e-24
4.49502e-25
1.38343e-24
1.65366e-24
1.72554e-24
1.66208e-24
1.61063e-24
1.52314e-24
1.46717e-24
1.39339e-24
1.35415e-24
1.31004e-24
1.24721e-24
1.22755e-24
1.21448e-24
1.20928e-24
1.20933e-24
1.21464e-24
1.2278e-24
1.24754e-24
1.31046e-24
1.35463e-24
1.3939e-24
1.46772e-24
1.52369e-24
1.61119e-24
1.66145e-24
1.726e-24
1.65401e-24
1.38358e-24
4.49304e-25
9.96192e-26
3.20446e-25
3.86681e-25
4.04054e-25
3.89297e-25
3.76698e-25
3.55801e-25
3.4233e-25
3.24445e-25
3.14734e-25
3.04225e-25
2.89191e-25
2.84668e-25
2.81315e-25
2.80163e-25
2.80175e-25
2.8135e-25
2.84725e-25
2.89268e-25
3.0432e-25
3.14843e-25
3.24563e-25
3.42456e-25
3.5593e-25
3.7683e-25
3.89151e-25
4.04167e-25
3.86767e-25
3.2049e-25
9.95791e-26
2.15195e-26
7.2361e-26
8.81629e-26
9.22652e-26
8.89312e-26
8.59365e-26
8.10783e-26
7.79225e-26
7.37057e-26
7.13715e-26
6.89323e-26
6.54281e-26
6.44153e-26
6.35848e-26
6.33376e-26
6.33401e-26
6.35926e-26
6.44279e-26
6.54452e-26
6.89536e-26
7.13959e-26
7.37322e-26
7.7951e-26
8.11079e-26
8.59668e-26
8.88978e-26
9.22922e-26
8.81843e-26
7.23725e-26
2.15116e-26
4.53404e-27
1.594e-26
1.96122e-26
2.05588e-26
1.98264e-26
1.91348e-26
1.80346e-26
1.73145e-26
1.63465e-26
1.58011e-26
1.52492e-26
1.44529e-26
1.4232e-26
1.40329e-26
1.39814e-26
1.39819e-26
1.40345e-26
1.42347e-26
1.44566e-26
1.52538e-26
1.58065e-26
1.63523e-26
1.73208e-26
1.80412e-26
1.91416e-26
1.9819e-26
2.05652e-26
1.96173e-26
1.59429e-26
4.53253e-27
9.32352e-28
3.42752e-27
4.25931e-27
4.47287e-27
4.31634e-27
4.16098e-27
3.91812e-27
3.75795e-27
3.5414e-27
3.41741e-27
3.29559e-27
3.11905e-27
3.07206e-27
3.02577e-27
3.01538e-27
3.01549e-27
3.02612e-27
3.07263e-27
3.11983e-27
3.29657e-27
3.41854e-27
3.54264e-27
3.75931e-27
3.91956e-27
4.1625e-27
4.31476e-27
4.47433e-27
4.26053e-27
3.42824e-27
9.32062e-28
1.87232e-28
7.19835e-28
9.03614e-28
9.50734e-28
9.18172e-28
8.84196e-28
8.31892e-28
7.97144e-28
7.499e-28
7.22445e-28
6.96195e-28
6.5799e-28
6.48236e-28
6.37785e-28
6.35749e-28
6.35772e-28
6.37858e-28
6.48355e-28
6.5815e-28
6.96397e-28
7.22679e-28
7.5016e-28
7.97431e-28
8.32199e-28
8.84524e-28
9.17844e-28
9.51061e-28
9.03893e-28
7.20008e-28
1.87177e-28
3.67394e-29
1.47742e-28
1.87372e-28
1.97544e-28
1.90947e-28
1.83707e-28
1.72711e-28
1.65352e-28
1.55293e-28
1.49367e-28
1.43842e-28
1.35765e-28
1.33788e-28
1.31493e-28
1.31107e-28
1.31111e-28
1.31508e-28
1.33812e-28
1.35797e-28
1.43882e-28
1.49414e-28
1.55346e-28
1.65411e-28
1.72774e-28
1.83776e-28
1.90881e-28
1.97615e-28
1.87434e-28
1.47781e-28
3.67295e-29
7.04821e-30
2.96503e-29
3.79962e-29
4.01454e-29
3.88433e-29
3.73388e-29
3.50805e-29
3.35587e-29
3.14669e-29
3.02187e-29
2.90822e-29
2.74134e-29
2.70219e-29
2.65312e-29
2.646e-29
2.64609e-29
2.6534e-29
2.70265e-29
2.74197e-29
2.90902e-29
3.0228e-29
3.14774e-29
3.35705e-29
3.50935e-29
3.73531e-29
3.88304e-29
4.01607e-29
3.80098e-29
2.96591e-29
7.04635e-30
1.32267e-30
5.82158e-30
7.5391e-30
7.98371e-30
7.73326e-30
7.42814e-30
6.97481e-30
6.66719e-30
6.24212e-30
5.98543e-30
5.7568e-30
5.41958e-30
5.34375e-30
5.24148e-30
5.22882e-30
5.22899e-30
5.24202e-30
5.34463e-30
5.42078e-30
5.75832e-30
5.98722e-30
6.24415e-30
6.66952e-30
6.9774e-30
7.43103e-30
7.73078e-30
7.98692e-30
7.54198e-30
5.82349e-30
1.32232e-30
2.42923e-31
1.11883e-30
1.46441e-30
1.5545e-30
1.50754e-30
1.4471e-30
1.35811e-30
1.2973e-30
1.21283e-30
1.16125e-30
1.11625e-30
1.04957e-30
1.0352e-30
1.0144e-30
1.01223e-30
1.01226e-30
1.0145e-30
1.03537e-30
1.04979e-30
1.11653e-30
1.16159e-30
1.21321e-30
1.29775e-30
1.35861e-30
1.44768e-30
1.50708e-30
1.55515e-30
1.46501e-30
1.11922e-30
2.42861e-31
4.36869e-32
2.10578e-31
2.78601e-31
2.96486e-31
2.87902e-31
2.76204e-31
2.59106e-31
2.47346e-31
2.30921e-31
2.20788e-31
2.12115e-31
1.99208e-31
1.96542e-31
1.92411e-31
1.92053e-31
1.92058e-31
1.9243e-31
1.96572e-31
1.99248e-31
2.12167e-31
2.2085e-31
2.30992e-31
2.4743e-31
2.59201e-31
2.76314e-31
2.87817e-31
2.96615e-31
2.7872e-31
2.10658e-31
4.36756e-32
7.69678e-33
3.88319e-32
5.19377e-32
5.54177e-32
5.38878e-32
5.16737e-32
4.84577e-32
4.62312e-32
4.31042e-32
4.11568e-32
3.95196e-32
3.7072e-32
3.65876e-32
3.57858e-32
3.57293e-32
3.57303e-32
3.57891e-32
3.65929e-32
3.70793e-32
3.95288e-32
4.11678e-32
4.31171e-32
4.62465e-32
4.84754e-32
5.16944e-32
5.38726e-32
5.54427e-32
5.1961e-32
3.8848e-32
7.69469e-33
1.32904e-33
7.01938e-33
9.49205e-33
1.01559e-32
9.89014e-33
9.48009e-33
8.88754e-33
8.47464e-33
7.89152e-33
7.5251e-33
7.22222e-33
6.76742e-33
6.68114e-33
6.52891e-33
6.52048e-33
6.52066e-33
6.52948e-33
6.68207e-33
6.76869e-33
7.22385e-33
7.52704e-33
7.89381e-33
8.47737e-33
8.89076e-33
9.48392e-33
9.88747e-33
1.01606e-32
9.49644e-33
7.02241e-33
1.32868e-33
2.2503e-34
1.24432e-33
1.70139e-33
1.82561e-33
1.7806e-33
1.70626e-33
1.59926e-33
1.52422e-33
1.41765e-33
1.35012e-33
1.29518e-33
1.21232e-33
1.19725e-33
1.16896e-33
1.1678e-33
1.16783e-33
1.16906e-33
1.19741e-33
1.21254e-33
1.29546e-33
1.35045e-33
1.41805e-33
1.5247e-33
1.59983e-33
1.70695e-33
1.78014e-33
1.82647e-33
1.7022e-33
1.24487e-33
2.24968e-34
3.73768e-35
2.16408e-34
2.99226e-34
3.22029e-34
3.14604e-34
3.01403e-34
2.82457e-34
2.69086e-34
2.4999e-34
2.37792e-34
2.28017e-34
2.13209e-34
2.10626e-34
2.05479e-34
2.05335e-34
2.0534e-34
2.05495e-34
2.10653e-34
2.13245e-34
2.28064e-34
2.37849e-34
2.50057e-34
2.69169e-34
2.82557e-34
3.01525e-34
3.14526e-34
3.22182e-34
2.99371e-34
2.16509e-34
3.73656e-35
6.09261e-36
3.69409e-35
5.16561e-35
5.57641e-35
5.45719e-35
5.22747e-35
4.89841e-35
4.66471e-35
4.32901e-35
4.11298e-35
3.9423e-35
3.68259e-35
3.63916e-35
3.54736e-35
3.54595e-35
3.54603e-35
3.54764e-35
3.63961e-35
3.68321e-35
3.94308e-35
4.11392e-35
4.33013e-35
4.6661e-35
4.90012e-35
5.22959e-35
5.45587e-35
5.57908e-35
5.16813e-35
3.69585e-35
6.09067e-36
9.75041e-37
6.19158e-36
8.75673e-36
9.48328e-36
9.29711e-36
8.90522e-36
8.3443e-36
7.94345e-36
7.3643e-36
6.98897e-36
6.69637e-36
6.24923e-36
6.1775e-36
6.01698e-36
6.01641e-36
6.01655e-36
6.01743e-36
6.17823e-36
6.25023e-36
6.69765e-36
6.99051e-36
7.36615e-36
7.94576e-36
8.34717e-36
8.9088e-36
9.29495e-36
9.48782e-36
8.76101e-36
6.19455e-36
9.74711e-37
1.53261e-37
1.01935e-36
1.45823e-36
1.58442e-36
1.5562e-36
1.49062e-36
1.39675e-36
1.32925e-36
1.23114e-36
1.16714e-36
1.11787e-36
1.04227e-36
1.03063e-36
1.00309e-36
1.00331e-36
1.00333e-36
1.00317e-36
1.03075e-36
1.04243e-36
1.11808e-36
1.16739e-36
1.23144e-36
1.32962e-36
1.39722e-36
1.49122e-36
1.55585e-36
1.58517e-36
1.45894e-36
1.01985e-36
1.53203e-37
2.36693e-38
1.64908e-37
2.38635e-37
2.60163e-37
2.56021e-37
2.45252e-37
2.29823e-37
2.18658e-37
2.02335e-37
1.91619e-37
1.83468e-37
1.70907e-37
1.69051e-37
1.64415e-37
1.64501e-37
1.64505e-37
1.64427e-37
1.6907e-37
1.70933e-37
1.83501e-37
1.91659e-37
2.02383e-37
2.18718e-37
2.29899e-37
2.4535e-37
2.55964e-37
2.60286e-37
2.38749e-37
1.64988e-37
2.36599e-38
3.59295e-39
2.62244e-38
3.83901e-38
4.19992e-38
4.14123e-38
3.96766e-38
3.71846e-38
3.53701e-38
3.27015e-38
3.0939e-38
2.96135e-38
2.75623e-38
2.72712e-38
2.65049e-38
2.6527e-38
2.65275e-38
2.65067e-38
2.72742e-38
2.75664e-38
2.96186e-38
3.09451e-38
3.27089e-38
3.53795e-38
3.71965e-38
3.96921e-38
4.14033e-38
4.20186e-38
3.8408e-38
2.62368e-38
3.59141e-39
5.36265e-40
4.10077e-39
6.07337e-39
6.66807e-39
6.58832e-39
6.31356e-39
5.91794e-39
5.62809e-39
5.19921e-39
4.91432e-39
4.70236e-39
4.37305e-39
4.32814e-39
4.20368e-39
4.2085e-39
4.20859e-39
4.20398e-39
4.32861e-39
4.37368e-39
4.70316e-39
4.91527e-39
5.20035e-39
5.62952e-39
5.91979e-39
6.31599e-39
6.58691e-39
6.6711e-39
6.07613e-39
4.10272e-39
5.36014e-40
7.87251e-41
6.30775e-40
9.45174e-40
1.04152e-39
1.03122e-39
9.8849e-40
9.26733e-40
8.81201e-40
8.13422e-40
7.68153e-40
7.34813e-40
6.82812e-40
6.75993e-40
6.56129e-40
6.57086e-40
6.571e-40
6.56174e-40
6.76065e-40
6.82909e-40
7.34934e-40
7.68297e-40
8.13595e-40
8.81418e-40
9.27013e-40
9.88862e-40
1.031e-39
1.04198e-39
9.45584e-40
6.31066e-40
7.86865e-41
1.13711e-41
9.54704e-41
1.44745e-40
1.60096e-40
1.58853e-40
1.52322e-40
1.42839e-40
1.35804e-40
1.25267e-40
1.18192e-40
1.13032e-40
1.04953e-40
1.03933e-40
1.00816e-40
1.00995e-40
1.00997e-40
1.00823e-40
1.03944e-40
1.04968e-40
1.1305e-40
1.18214e-40
1.25292e-40
1.35836e-40
1.42881e-40
1.52378e-40
1.58818e-40
1.60164e-40
1.44804e-40
9.55126e-41
1.13654e-41
1.61654e-42
1.42228e-41
2.18191e-41
2.42255e-41
2.409e-41
2.31088e-41
2.1676e-41
2.06062e-41
1.89943e-41
1.79066e-41
1.71204e-41
1.5885e-41
1.57349e-41
1.52539e-41
1.52857e-41
1.5286e-41
1.52549e-41
1.57366e-41
1.58873e-41
1.71231e-41
1.79097e-41
1.8998e-41
2.06109e-41
2.16821e-41
2.3117e-41
2.40847e-41
2.42353e-41
2.18274e-41
1.42287e-41
1.61571e-42
2.26253e-43
2.0862e-42
3.23851e-42
3.6097e-42
3.59752e-42
3.45255e-42
3.23947e-42
3.07934e-42
2.8366e-42
2.67203e-42
2.55409e-42
2.36812e-42
2.34634e-42
2.27329e-42
2.27875e-42
2.2788e-42
2.27345e-42
2.34659e-42
2.36845e-42
2.55449e-42
2.67249e-42
2.83714e-42
3.08001e-42
3.24033e-42
3.45373e-42
3.59673e-42
3.61109e-42
3.23966e-42
2.08703e-42
2.26136e-43
3.11861e-44
3.01379e-43
4.73429e-43
5.29787e-43
5.292e-43
5.08128e-43
4.76926e-43
4.53326e-43
4.17333e-43
3.92817e-43
3.75392e-43
3.47823e-43
3.44707e-43
3.33789e-43
3.34695e-43
3.34703e-43
3.33812e-43
3.44744e-43
3.47871e-43
3.7545e-43
3.92883e-43
4.17409e-43
4.53419e-43
4.77046e-43
5.08294e-43
5.29081e-43
5.29979e-43
4.73583e-43
3.01493e-43
3.11698e-44
4.23461e-45
4.28918e-44
6.81847e-44
7.66096e-44
7.67015e-44
7.36877e-44
6.91875e-44
6.57614e-44
6.05047e-44
5.69082e-44
5.43717e-44
5.03455e-44
4.99061e-44
4.82995e-44
4.84456e-44
4.84467e-44
4.83029e-44
4.99114e-44
5.03525e-44
5.43801e-44
5.69176e-44
6.05153e-44
6.57742e-44
6.92039e-44
7.37105e-44
7.66838e-44
7.66357e-44
6.82046e-44
4.29071e-44
4.23238e-45
5.6659e-46
6.0154e-45
9.67745e-45
1.09178e-44
1.09565e-44
1.05322e-44
9.89273e-45
9.40267e-45
8.64625e-45
8.1265e-45
7.76261e-45
7.18326e-45
7.12209e-45
6.88925e-45
6.91225e-45
6.91241e-45
6.88975e-45
7.12286e-45
7.18426e-45
7.7638e-45
8.12781e-45
8.64771e-45
9.40439e-45
9.89494e-45
1.05353e-44
1.09539e-44
1.09213e-44
9.67993e-45
6.01738e-45
5.66296e-46
7.47211e-47
8.31578e-46
1.35392e-45
1.5338e-45
1.54289e-45
1.48408e-45
1.39452e-45
1.32543e-45
1.21816e-45
1.14415e-45
1.09268e-45
1.01052e-45
1.00211e-45
9.6887e-46
9.72403e-46
9.72426e-46
9.68941e-46
1.00222e-45
1.01066e-45
1.09285e-45
1.14433e-45
1.21836e-45
1.32566e-45
1.39482e-45
1.48448e-45
1.54252e-45
1.53425e-45
1.35422e-45
8.31826e-46
7.46831e-47
9.71537e-48
1.13344e-46
1.86764e-46
2.1247e-46
2.1424e-46
2.06212e-46
1.93849e-46
1.84245e-46
1.69249e-46
1.58859e-46
1.51683e-46
1.40194e-46
1.39054e-46
1.34376e-46
1.34907e-46
1.34911e-46
1.34386e-46
1.39069e-46
1.40214e-46
1.51706e-46
1.58884e-46
1.69275e-46
1.84276e-46
1.93886e-46
2.06265e-46
2.14188e-46
2.12527e-46
1.86798e-46
1.13375e-46
9.71049e-48
1.24574e-48
1.52356e-47
2.54079e-47
2.90285e-47
2.93411e-47
2.82614e-47
2.65784e-47
2.5262e-47
2.31946e-47
2.17568e-47
2.07696e-47
1.91855e-47
1.90327e-47
1.83839e-47
1.84621e-47
1.84626e-47
1.83853e-47
1.90349e-47
1.91883e-47
2.07728e-47
2.17602e-47
2.31982e-47
2.52659e-47
2.65832e-47
2.82682e-47
2.93338e-47
2.90357e-47
2.54116e-47
1.52392e-47
1.24513e-48
1.57561e-49
2.02023e-48
3.40981e-48
3.91251e-48
3.96428e-48
3.82119e-48
3.5952e-48
3.4172e-48
3.13608e-48
2.93983e-48
2.80586e-48
2.59041e-48
2.57017e-48
2.48145e-48
2.49275e-48
2.49281e-48
2.48164e-48
2.57048e-48
2.5908e-48
2.80631e-48
2.94029e-48
3.13656e-48
3.4177e-48
3.59581e-48
3.82205e-48
3.96329e-48
3.91341e-48
3.41017e-48
2.02063e-48
1.57486e-49
1.96624e-50
2.64315e-49
4.51521e-49
5.20348e-49
5.28523e-49
5.09832e-49
4.79891e-49
4.56139e-49
4.18427e-49
3.92001e-49
3.74059e-49
3.4515e-49
3.42498e-49
3.3053e-49
3.32133e-49
3.32142e-49
3.30557e-49
3.4254e-49
3.45203e-49
3.7412e-49
3.92064e-49
4.1849e-49
4.56204e-49
4.79967e-49
5.09939e-49
5.28391e-49
5.20456e-49
4.51553e-49
2.6436e-49
1.96532e-50
2.42155e-51
3.41293e-50
5.90086e-50
6.83025e-50
6.95461e-50
6.71389e-50
6.32238e-50
6.00956e-50
5.51028e-50
5.15917e-50
4.92197e-50
4.53915e-50
4.50478e-50
4.34552e-50
4.36785e-50
4.36798e-50
4.34589e-50
4.50536e-50
4.53987e-50
4.9228e-50
5.16001e-50
5.51111e-50
6.01039e-50
6.32331e-50
6.71519e-50
6.95288e-50
6.83156e-50
5.90104e-50
3.41339e-50
2.42044e-51
2.94388e-52
4.35032e-51
7.61274e-51
8.8508e-51
9.03413e-51
8.72835e-51
8.22296e-51
7.81618e-51
7.1637e-51
6.70323e-51
6.39359e-51
5.89322e-51
5.84912e-51
5.63998e-51
5.67055e-51
5.67073e-51
5.64048e-51
5.84989e-51
5.89419e-51
6.3947e-51
6.70434e-51
7.16478e-51
7.81722e-51
8.2241e-51
8.72992e-51
9.03191e-51
8.85235e-51
7.61268e-51
4.35072e-51
2.94257e-52
3.53364e-53
5.47519e-52
9.69732e-52
1.13247e-51
1.15877e-51
1.12045e-51
1.05602e-51
1.00378e-51
9.19589e-52
8.59966e-52
8.20047e-52
7.55475e-52
7.49869e-52
7.2276e-52
7.26877e-52
7.269e-52
7.22827e-52
7.49972e-52
7.55603e-52
8.20193e-52
8.60112e-52
9.19728e-52
1.00391e-51
1.05616e-51
1.12064e-51
1.15849e-51
1.13265e-51
9.69689e-52
5.4755e-52
3.53209e-53
4.18891e-54
6.80553e-53
1.21996e-52
1.43107e-52
1.4679e-52
1.4205e-52
1.33938e-52
1.27309e-52
1.1658e-52
1.08956e-52
1.03871e-52
9.56424e-53
9.49363e-53
9.1467e-53
9.20121e-53
9.20151e-53
9.14757e-53
9.49499e-53
9.56591e-53
1.0389e-52
1.08975e-52
1.16597e-52
1.27325e-52
1.33954e-52
1.42072e-52
1.46755e-52
1.43128e-52
1.21986e-52
6.80566e-53
4.18711e-54
4.90521e-55
8.35618e-54
1.51606e-53
1.78642e-53
1.83686e-53
1.77898e-53
1.67803e-53
1.5949e-53
1.45983e-53
1.36353e-53
1.29953e-53
1.19595e-53
1.18713e-53
1.14328e-53
1.15039e-53
1.15043e-53
1.1434e-53
1.1873e-53
1.19617e-53
1.29978e-53
1.36377e-53
1.46005e-53
1.5951e-53
1.67822e-53
1.77923e-53
1.83644e-53
1.78666e-53
1.51589e-53
8.35603e-54
4.90315e-55
5.67537e-56
1.01376e-54
1.8615e-54
2.20334e-54
2.27102e-54
2.2012e-54
2.07703e-54
1.97397e-54
1.80594e-54
1.68574e-54
1.60612e-54
1.47731e-54
1.46637e-54
1.41164e-54
1.42075e-54
1.4208e-54
1.41178e-54
1.46659e-54
1.47758e-54
1.60643e-54
1.68605e-54
1.80622e-54
1.97421e-54
2.07725e-54
2.20149e-54
2.27052e-54
2.20362e-54
1.86123e-54
1.01371e-54
5.67304e-56
6.49004e-57
1.21549e-55
2.25882e-55
2.68565e-55
2.77474e-55
2.69149e-55
2.54045e-55
2.41408e-55
2.20747e-55
2.05919e-55
1.96123e-55
1.80294e-55
1.78946e-55
1.72197e-55
1.73349e-55
1.73356e-55
1.72215e-55
1.78974e-55
1.80329e-55
1.96163e-55
2.05958e-55
2.20782e-55
2.41437e-55
2.54071e-55
2.69182e-55
2.77415e-55
2.68597e-55
2.25841e-55
1.21538e-55
6.48747e-57
7.33819e-58
1.44064e-56
2.70937e-56
3.23578e-56
3.35093e-56
3.25274e-56
3.07099e-56
2.91766e-56
2.66649e-56
2.48563e-56
2.36641e-56
2.17416e-56
2.15766e-56
2.07541e-56
2.08976e-56
2.08984e-56
2.07563e-56
2.15801e-56
2.17459e-56
2.3669e-56
2.4861e-56
2.66692e-56
2.91801e-56
3.07128e-56
3.25311e-56
3.35025e-56
3.23614e-56
2.70879e-56
1.44046e-56
7.33537e-58
8.20652e-59
1.68832e-57
3.21309e-57
3.85446e-57
4.00069e-57
3.88605e-57
3.66957e-57
3.48539e-57
3.1834e-57
2.96522e-57
2.82168e-57
2.59084e-57
2.57074e-57
2.47168e-57
2.48928e-57
2.48938e-57
2.47195e-57
2.57117e-57
2.59137e-57
2.82228e-57
2.96581e-57
3.18392e-57
3.4858e-57
3.6699e-57
3.88645e-57
3.99991e-57
3.85486e-57
3.21231e-57
1.68805e-57
8.20346e-59
9.08032e-60
1.95686e-58
3.76831e-58
4.54041e-58
4.72296e-58
4.59031e-58
4.33494e-58
4.11582e-58
3.75661e-58
3.49624e-58
3.32516e-58
3.05111e-58
3.02672e-58
2.90877e-58
2.93003e-58
2.93015e-58
2.90911e-58
3.02724e-58
3.05174e-58
3.32588e-58
3.49694e-58
3.75723e-58
4.1163e-58
4.3353e-58
4.59074e-58
4.72208e-58
4.54084e-58
3.76729e-58
1.95648e-58
9.07704e-60
9.94438e-61
2.24382e-59
4.37165e-59
5.29011e-59
5.51421e-59
5.36188e-59
5.06336e-59
4.80502e-59
4.38217e-59
4.07466e-59
3.87278e-59
3.55103e-59
3.52157e-59
3.38271e-59
3.40799e-59
3.40813e-59
3.38311e-59
3.52218e-59
3.55178e-59
3.87364e-59
4.07549e-59
4.3829e-59
4.80557e-59
5.06376e-59
5.36233e-59
5.51323e-59
5.29059e-59
4.37034e-59
2.24331e-59
9.94091e-61
1.07839e-61
2.54601e-60
5.01792e-60
6.09768e-60
6.36819e-60
6.19432e-60
5.84827e-60
5.54624e-60
5.05348e-60
4.69397e-60
4.45802e-60
4.08438e-60
4.04893e-60
3.88727e-60
3.91685e-60
3.91701e-60
3.88773e-60
4.04965e-60
4.08527e-60
4.45903e-60
4.69494e-60
5.05432e-60
5.54687e-60
5.8487e-60
6.19479e-60
6.36711e-60
6.09819e-60
5.01629e-60
2.54535e-60
1.07803e-61
1.15853e-62
2.85963e-61
5.7002e-61
6.95474e-61
7.2758e-61
7.07813e-61
6.68005e-61
6.3297e-61
5.76107e-61
5.34489e-61
5.07171e-61
4.64249e-61
4.59998e-61
4.41385e-61
4.44791e-61
4.4481e-61
4.41439e-61
4.60082e-61
4.64352e-61
5.07287e-61
5.34602e-61
5.76204e-61
6.33041e-61
6.68051e-61
7.07861e-61
7.27462e-61
6.95528e-61
5.69822e-61
2.85878e-61
1.15816e-62
1.23371e-63
3.1803e-62
6.4099e-62
7.85043e-62
8.22492e-62
8.00067e-62
7.54588e-62
7.14241e-62
6.49246e-62
6.01533e-62
5.70191e-62
5.21416e-62
5.16339e-62
4.95144e-62
4.99e-62
4.99022e-62
4.95205e-62
5.16434e-62
5.21533e-62
5.70324e-62
6.01661e-62
6.49357e-62
7.1432e-62
7.54635e-62
8.00115e-62
8.22365e-62
7.851e-62
6.40752e-62
3.17926e-62
1.23333e-63
1.30306e-64
3.50331e-63
7.13687e-63
8.77144e-63
9.20044e-63
8.946e-63
8.42962e-63
7.96815e-63
7.23217e-63
6.69033e-63
6.33401e-63
5.7857e-63
5.72536e-63
5.48668e-63
5.52959e-63
5.52985e-63
5.48737e-63
5.72643e-63
5.78703e-63
6.33552e-63
6.69178e-63
7.2334e-63
7.96902e-63
8.43011e-63
8.94646e-63
9.19907e-63
8.77201e-63
7.13405e-63
3.50205e-63
1.30267e-64
1.36601e-65
3.82366e-64
7.86958e-64
9.70206e-64
1.01842e-63
9.89498e-64
9.31192e-64
8.78755e-64
7.96181e-64
7.35234e-64
6.95094e-64
6.34126e-64
6.26996e-64
6.00419e-64
6.05113e-64
6.05141e-64
6.00496e-64
6.27116e-64
6.34273e-64
6.95262e-64
7.35395e-64
7.96318e-64
8.78849e-64
9.31242e-64
9.8954e-64
1.01827e-63
9.70261e-64
7.8663e-64
3.82217e-64
1.36561e-65
1.42236e-66
4.13625e-65
8.5952e-65
1.06242e-64
1.11552e-64
1.08253e-64
1.01704e-64
9.57841e-65
8.66057e-65
7.98161e-65
7.53367e-65
6.86325e-65
6.77966e-65
6.4871e-65
6.53752e-65
6.53783e-65
6.48795e-65
6.78097e-65
6.86488e-65
7.53552e-65
7.98338e-65
8.66206e-65
9.57942e-65
1.01709e-64
1.08257e-64
1.11536e-64
1.06248e-64
8.59143e-65
4.13451e-65
1.42195e-66
1.47211e-67
4.43589e-66
9.29968e-66
1.15177e-65
1.20896e-65
1.17121e-65
1.09803e-65
1.03164e-65
9.30581e-66
8.55698e-66
8.062e-66
7.3332e-66
7.2361e-66
6.91787e-66
6.97104e-66
6.97138e-66
6.91878e-66
7.23753e-66
7.33496e-66
8.06401e-66
8.5589e-66
9.30743e-66
1.03174e-65
1.09807e-65
1.17124e-65
1.20879e-65
1.15182e-65
9.29541e-66
4.43389e-66
1.47169e-67
1.51544e-68
4.71733e-67
9.96781e-67
1.23603e-66
1.29613e-66
1.25282e-66
1.17149e-66
1.09759e-66
9.87424e-67
9.05695e-67
8.51573e-67
7.7328e-67
7.62128e-67
7.27935e-67
7.33441e-67
7.33477e-67
7.28033e-67
7.62281e-67
7.73468e-67
8.51788e-67
9.05901e-67
9.87597e-67
1.0977e-66
1.17154e-66
1.25285e-66
1.29595e-66
1.23606e-66
9.96305e-67
4.71506e-67
1.51501e-68
1.55258e-69
4.97516e-68
1.05832e-67
1.31279e-67
1.37427e-67
1.32455e-67
1.23474e-67
1.15316e-67
1.03433e-67
9.46117e-68
8.87603e-68
8.04528e-68
7.91891e-68
7.55618e-68
7.61214e-68
7.61252e-68
7.55721e-68
7.92052e-68
8.04726e-68
8.8783e-68
9.46335e-68
1.03451e-67
1.15328e-67
1.23478e-67
1.32457e-67
1.37408e-67
1.31281e-67
1.05779e-67
4.97261e-68
1.55212e-69
1.58333e-70
5.20362e-69
1.11284e-68
1.37955e-68
1.44057e-68
1.38365e-68
1.28523e-68
1.19604e-68
1.06929e-68
9.75219e-69
9.12723e-69
8.25696e-69
8.11593e-69
7.73622e-69
7.79208e-69
7.79247e-69
7.73729e-69
8.1176e-69
8.25903e-69
9.1296e-69
9.75446e-69
1.06948e-68
1.19616e-68
1.28527e-68
1.38366e-68
1.44038e-68
1.37955e-68
1.11227e-68
5.2008e-69
1.58285e-70
1.60726e-71
5.39659e-70
1.15853e-69
1.43382e-69
1.49238e-69
1.42763e-69
1.32079e-69
1.22436e-69
1.0908e-69
9.91733e-70
9.25851e-70
8.35885e-70
8.20407e-70
7.81196e-70
7.86677e-70
7.86717e-70
7.81306e-70
8.20579e-70
8.36097e-70
9.26095e-70
9.91967e-70
1.09099e-69
1.22448e-69
1.32082e-69
1.42763e-69
1.49218e-69
1.43381e-69
1.15792e-69
5.39353e-70
1.60675e-71
1.6226e-72
5.54736e-71
1.19362e-70
1.47333e-70
1.52744e-70
1.45456e-70
1.33986e-70
1.23693e-70
1.09798e-70
9.95051e-71
9.26549e-71
8.34795e-71
8.1811e-71
7.78175e-71
7.83467e-71
7.83509e-71
7.78286e-71
8.18283e-71
8.3501e-71
9.26796e-71
9.95289e-71
1.09818e-70
1.23705e-70
1.3399e-70
1.45455e-70
1.52723e-70
1.4733e-70
1.19297e-70
5.54407e-71
1.62206e-72
1.62789e-73
5.6495e-72
1.21652e-71
1.49627e-71
1.54419e-71
1.46335e-71
1.34181e-71
1.23346e-71
1.09083e-71
9.85354e-72
9.15133e-72
8.22816e-72
8.05156e-72
7.65042e-72
7.70081e-72
7.70122e-72
7.65152e-72
8.05329e-72
8.2303e-72
9.15381e-72
9.85593e-72
1.09103e-71
1.23358e-71
1.34183e-71
1.46333e-71
1.54397e-71
1.49621e-71
1.21584e-71
5.646e-72
1.62731e-73
1.61861e-74
5.69648e-73
1.22598e-72
1.50159e-72
1.54212e-72
1.45402e-72
1.32706e-72
1.2147e-72
1.07027e-72
9.63681e-73
8.92714e-73
8.01048e-73
7.82706e-73
7.42951e-73
7.47696e-73
7.47737e-73
7.43059e-73
7.82876e-73
8.0126e-73
8.9296e-73
9.63918e-73
1.07047e-72
1.21481e-72
1.32708e-72
1.45398e-72
1.54189e-72
1.5015e-72
1.22528e-72
5.69282e-73
1.618e-74
1.59503e-75
5.68485e-74
1.22163e-73
1.48948e-73
1.52206e-73
1.42789e-73
1.29729e-73
1.18258e-73
1.03831e-73
9.32054e-74
8.61324e-74
7.71422e-74
7.52703e-74
7.13781e-74
7.18213e-74
7.18253e-74
7.13887e-74
7.52869e-74
7.71629e-74
8.61565e-74
9.32286e-74
1.03851e-73
1.1827e-73
1.29731e-73
1.42785e-73
1.52183e-73
1.48938e-73
1.22091e-73
5.68108e-74
1.59439e-75
1.55563e-76
5.61273e-75
1.20415e-74
1.46164e-74
1.48657e-74
1.38804e-74
1.25572e-74
1.14027e-74
9.97875e-75
8.93213e-75
8.23568e-75
7.36321e-75
7.17517e-75
6.79806e-75
6.83928e-75
6.83966e-75
6.79908e-75
7.17677e-75
7.36521e-75
8.23802e-75
8.93439e-75
9.98065e-75
1.14038e-74
1.25573e-74
1.38799e-74
1.48634e-74
1.46151e-74
1.20343e-74
5.6089e-75
1.55497e-76
1.51668e-77
5.49116e-76
1.1758e-75
1.42169e-75
1.43988e-75
1.33878e-75
1.20655e-75
1.09181e-75
9.5264e-76
8.50528e-76
7.82605e-76
6.98594e-76
6.79941e-76
6.43681e-76
6.47513e-76
6.4755e-76
6.43779e-76
6.80095e-76
6.98787e-76
7.8283e-76
8.50747e-76
9.52823e-76
1.09191e-75
1.20656e-75
1.33873e-75
1.43965e-75
1.42154e-75
1.17509e-75
5.48731e-76
1.51599e-77
1.64285e-78
5.90129e-77
1.26341e-76
1.52304e-76
1.5369e-76
1.42344e-76
1.27821e-76
1.15273e-76
1.00287e-76
8.93082e-77
8.20067e-77
7.30878e-77
7.10495e-77
6.72053e-77
6.75993e-77
6.76032e-77
6.72156e-77
7.10659e-77
7.31083e-77
8.20308e-77
8.93316e-77
1.00307e-76
1.15284e-76
1.27822e-76
1.42338e-76
1.53665e-76
1.52285e-76
1.26263e-76
5.89706e-77
1.64206e-78
)
;
boundaryField
{
inlet
{
type calculated;
value nonuniform List<scalar>
30
(
0.406198
0.419495
0.417585
0.414986
0.411099
0.407451
0.403808
0.401892
0.400756
0.400025
0.39961
0.399383
0.399159
0.398995
0.39892
0.398995
0.399072
0.399197
0.399367
0.399531
0.39978
0.400239
0.401328
0.404106
0.408065
0.411863
0.415292
0.418114
0.419853
0.403166
)
;
}
outlet
{
type calculated;
value nonuniform List<scalar>
30
(
1.64285e-78
5.90129e-77
1.26341e-76
1.52304e-76
1.5369e-76
1.42344e-76
1.27821e-76
1.15273e-76
1.00287e-76
8.93082e-77
8.20067e-77
7.30878e-77
7.10495e-77
6.72053e-77
6.75993e-77
6.76032e-77
6.72156e-77
7.10659e-77
7.31083e-77
8.20308e-77
8.93316e-77
1.00307e-76
1.15284e-76
1.27822e-76
1.42338e-76
1.53665e-76
1.52285e-76
1.26263e-76
5.89706e-77
1.64206e-78
)
;
}
walls
{
type calculated;
value nonuniform List<scalar>
400
(
0.406198
0.402318
0.415331
0.434348
0.455842
0.479144
0.502745
0.52274
0.535638
0.541965
0.545357
0.548171
0.550656
0.552718
0.554371
0.555706
0.556815
0.557771
0.55861
0.559312
0.559825
0.560136
0.560273
0.560276
0.560234
0.560225
0.560217
0.56021
0.56021
0.560228
0.560284
0.560346
0.560392
0.560407
0.560369
0.560289
0.560166
0.559728
0.559181
0.558824
0.558726
0.558687
0.558695
0.558668
0.558588
0.558483
0.558359
0.558219
0.558023
0.55774
0.557504
0.557336
0.557198
0.557066
0.556929
0.556784
0.556629
0.556462
0.556279
0.556063
0.555862
0.555683
0.555525
0.555388
0.555264
0.555146
0.555023
0.554888
0.554736
0.55457
0.554367
0.554136
0.553906
0.553684
0.55348
0.553301
0.553156
0.553055
0.553
0.552875
0.552737
0.55259
0.552328
0.550945
0.550619
0.550361
0.550184
0.550719
0.551857
0.552228
0.551935
0.551527
0.550282
0.544386
0.537752
0.53345
0.530175
0.527581
0.523296
0.464136
0.226091
0.0879602
0.0217957
0.00246918
0.000107111
1.50593e-06
5.58582e-09
5.72878e-12
1.29397e-12
9.6032e-13
6.78819e-13
4.55883e-13
2.89926e-13
1.74637e-13
9.98462e-14
5.43056e-14
2.81425e-14
1.3909e-14
6.55986e-15
2.9538e-15
1.27062e-15
5.22557e-16
2.05661e-16
7.75448e-17
2.80452e-17
9.74133e-18
3.25376e-18
1.04643e-18
3.24429e-19
9.70796e-20
2.80701e-20
7.85132e-21
2.1265e-21
5.58257e-22
1.42183e-22
3.51638e-23
8.45147e-24
1.97561e-24
4.49502e-25
9.96192e-26
2.15195e-26
4.53404e-27
9.32352e-28
1.87232e-28
3.67394e-29
7.04821e-30
1.32267e-30
2.42923e-31
4.36869e-32
7.69678e-33
1.32904e-33
2.2503e-34
3.73768e-35
6.09261e-36
9.75041e-37
1.53261e-37
2.36693e-38
3.59295e-39
5.36265e-40
7.87251e-41
1.13711e-41
1.61654e-42
2.26253e-43
3.11861e-44
4.23461e-45
5.6659e-46
7.47211e-47
9.71537e-48
1.24574e-48
1.57561e-49
1.96624e-50
2.42155e-51
2.94388e-52
3.53364e-53
4.18891e-54
4.90521e-55
5.67537e-56
6.49004e-57
7.33819e-58
8.20652e-59
9.08032e-60
9.94438e-61
1.07839e-61
1.15853e-62
1.23371e-63
1.30306e-64
1.36601e-65
1.42236e-66
1.47211e-67
1.51544e-68
1.55258e-69
1.58333e-70
1.60726e-71
1.6226e-72
1.62789e-73
1.61861e-74
1.59503e-75
1.55563e-76
1.51668e-77
1.64285e-78
0.403166
0.400489
0.413831
0.433169
0.45499
0.478607
0.502459
0.522615
0.535596
0.541955
0.545352
0.548167
0.550648
0.552707
0.554356
0.555692
0.556806
0.557769
0.558616
0.559323
0.559834
0.56014
0.56027
0.56027
0.560238
0.560231
0.560226
0.560223
0.560226
0.560248
0.560301
0.56035
0.560383
0.560389
0.560347
0.560266
0.560137
0.559687
0.55916
0.558826
0.558735
0.558701
0.558708
0.558676
0.558595
0.558489
0.558362
0.55822
0.558008
0.557719
0.557487
0.557321
0.557186
0.557059
0.55693
0.556792
0.556645
0.556487
0.556316
0.55612
0.555906
0.555718
0.555551
0.555403
0.555269
0.555139
0.555003
0.554855
0.554693
0.554515
0.554301
0.554085
0.553877
0.553679
0.553498
0.553336
0.553199
0.553102
0.553037
0.552904
0.552764
0.552613
0.55228
0.550902
0.550584
0.550329
0.550153
0.550714
0.551875
0.552256
0.551963
0.551555
0.550275
0.544362
0.537738
0.533447
0.530172
0.52758
0.523296
0.464139
0.226097
0.0879671
0.0217994
0.0024698
0.000107143
1.50642e-06
5.58759e-09
5.7292e-12
1.2933e-12
9.59705e-13
6.78318e-13
4.55516e-13
2.89682e-13
1.74485e-13
9.97576e-14
5.42567e-14
2.81167e-14
1.3896e-14
6.55364e-15
2.95095e-15
1.26937e-15
5.22032e-16
2.05451e-16
7.74642e-17
2.80156e-17
9.73096e-18
3.25029e-18
1.04532e-18
3.24091e-19
9.69829e-20
2.80438e-20
7.84451e-21
2.12482e-21
5.57856e-22
1.42091e-22
3.51431e-23
8.44695e-24
1.97465e-24
4.49304e-25
9.95791e-26
2.15116e-26
4.53253e-27
9.32062e-28
1.87177e-28
3.67295e-29
7.04635e-30
1.32232e-30
2.42861e-31
4.36756e-32
7.69469e-33
1.32868e-33
2.24968e-34
3.73656e-35
6.09067e-36
9.74711e-37
1.53203e-37
2.36599e-38
3.59141e-39
5.36014e-40
7.86865e-41
1.13654e-41
1.61571e-42
2.26136e-43
3.11698e-44
4.23238e-45
5.66296e-46
7.46831e-47
9.71049e-48
1.24513e-48
1.57486e-49
1.96532e-50
2.42044e-51
2.94257e-52
3.53209e-53
4.18711e-54
4.90315e-55
5.67304e-56
6.48747e-57
7.33537e-58
8.20346e-59
9.07704e-60
9.94091e-61
1.07803e-61
1.15816e-62
1.23333e-63
1.30267e-64
1.36561e-65
1.42195e-66
1.47169e-67
1.51501e-68
1.55212e-69
1.58285e-70
1.60675e-71
1.62206e-72
1.62731e-73
1.618e-74
1.59439e-75
1.55497e-76
1.51599e-77
1.64206e-78
)
;
}
frontAndBackPlanes
{
type empty;
}
}
// ************************************************************************* //
| [
"[email protected]"
] | |
e00ddbb066b640e5f84c5ee5abdc5303e0349913 | ea778bab27868d2841c1428d31358ccfe3baca02 | /AnKang_ZhongFu/cheliangyunshubaobiaodlg.h | 70c74679f8bd4719dc1d7b532b61a83f90067b11 | [] | no_license | WenYunZi/erp | a355cb7df29abb0b7e26b874d1a342b078d2f91b | c42f6d934ff8fa4938ce4cd70b50358623a86c98 | refs/heads/master | 2020-05-07T17:33:52.927440 | 2019-04-11T06:41:48 | 2019-04-11T06:41:48 | 180,730,895 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,538 | h | #ifndef CHELIANGYUNSHUBAOBIAODLG_H
#define CHELIANGYUNSHUBAOBIAODLG_H
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QTextEdit>
#include <QStandardItemModel>
#include <QTableView>
#include <QComboBox>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QDate>
#include <QVBoxLayout>
#include <QDateEdit>
#include <QDebug>
#include <QCheckBox>
#include <QPushButton>
#include <QToolButton>
#include <QIcon>
#include <QListView>
#include <QToolBar>
#include <QLibrary>
#include <QByteArray>
#include <QLibrary>
#include <QAction>
#include <QString>
#include <QMessageBox>
#include <QAxWidget>
#include <QAxObject>
#include "mymysql.h"
class cheliangyunshubaobiaoDlg : public QDialog
{
Q_OBJECT
public:
explicit cheliangyunshubaobiaoDlg(QWidget *parent = 0);
void refresh();
private:
QLibrary *library;
QDateTimeEdit *dateEdit1;
QDateTimeEdit *dateEdit2;
QCheckBox *checkBox1;
QCheckBox *checkBox2;
QCheckBox *checkBox3;
QCheckBox *checkBox4;
QCheckBox *checkBox5;
QCheckBox *checkBox6;
QComboBox *comBox1;
QComboBox *comBox2;
QComboBox *comBox3;
QComboBox *comBox4;
QComboBox *comBox5;
QComboBox *comBox6;
QPushButton *btn1;
QPushButton *btn2;
QPushButton *btn3;
QAxWidget *reportView;
QAxObject *m_report;
private slots:
void on_fahuomingxi();
void on_cheliangyunju();
void on_cheliangyouhao();
void on_comBox3Correspond();
};
#endif // CHELIANGYUNSHUBAOBIAODLG_H
| [
"[email protected]"
] | |
cecd3c9b47ece2d6157147713f705607915cd76f | 3a0ebf56e5effee404480f6bf8dfb8a7f804b1cf | /Practica3_EuclidesMcd/main.cpp | be205a238ea3f4c7d368b4ae552bc857851bb128 | [] | no_license | jdotaz/Algebra-Abs | 5f14427348c59ecb0a0cd41731a1b4867586a657 | 42275ed359906d2658c749fb17439b29c90aa952 | refs/heads/master | 2023-01-28T04:07:15.414385 | 2020-07-17T07:45:40 | 2020-07-17T07:45:40 | 255,448,936 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,749 | cpp | #include <iostream>
#include <stdlib.h>
#include <NTL/ZZ.h>
#include <NTL/RR.h>
#include <ctime>
#include "Euclides.h"
#include "EuclidesLimpio.h"
using namespace std;
using namespace NTL;
int main(){
ZZ a,b,resultado;
unsigned t0, t1;
RR time;
//EuclidesLimpio mcd; //Descomentar esta parte para ver el tiempo de ejecucion de los algoritmos sin interferencia de la comprobacion paso a paso
Euclides mcd; //Descomentar esta parte para ver la comprobacion paso a paso
cin>>a;
cin>>b;
t0=clock();
cout<<"algoritmo 1:"<<endl;
cout<<"a= "<<a<<endl<<"b= "<<b<<endl;
resultado=mcd.mcd1(a,b);
cout<<endl<<"mcd.mcd1("<<a<<","<<b<<")="<<resultado<<endl<<endl;
t1=clock();
time = (RR(t1-t0)/CLOCKS_PER_SEC);
cout << "Tiempo de ejecucion: : " << time << endl;
system("pause");
system("cls");
t0=clock();
cout<<"algoritmo 2:"<<endl;
cout<<"a= "<<a<<endl<<"b= "<<b<<endl;
resultado=mcd.mcd2(a,b);
cout<<endl<<"mcd.mcd2("<<a<<","<<b<<")="<<resultado<<endl<<endl;
t1=clock();
time = (RR(t1-t0)/CLOCKS_PER_SEC);
cout << "Tiempo de ejecucion: : " << time << endl;
system("pause");
system("cls");
t0=clock();
cout<<"algoritmo 3:"<<endl;
cout<<"a= "<<a<<endl<<"b= "<<b<<endl;
resultado=mcd.mcd3(a,b);
cout<<endl<<"mcd.mcd3("<<a<<","<<b<<")="<<resultado<<endl<<endl;
t1=clock();
time = (RR(t1-t0)/CLOCKS_PER_SEC);
cout << "Tiempo de ejecucion: : " << time << endl;
system("pause");
system("cls");
t0=clock();
cout<<"algoritmo 4:"<<endl;
cout<<"a= "<<a<<endl<<"b= "<<b<<endl;
resultado=mcd.mcd4(a,b);
cout<<endl<<"mcd.mcd4("<<a<<","<<b<<")="<<resultado<<endl<<endl;
t1=clock();
time = (RR(t1-t0)/CLOCKS_PER_SEC);
cout << "Tiempo de ejecucion: : " << time << endl;
system("pause");
system("cls");
t0=clock();
cout<<"algoritmo 5:"<<endl;
cout<<"a= "<<a<<endl<<"b= "<<b<<endl;
resultado=mcd.mcd5(a,b);
cout<<endl<<"mcd.mcd5("<<a<<","<<b<<")="<<resultado<<endl<<endl;
t1=clock();
time = (RR(t1-t0)/CLOCKS_PER_SEC);
cout << "Tiempo de ejecucion: : " << time << endl;
system("pause");
system("cls");
t0=clock();
cout<<"algoritmo 6:"<<endl;
cout<<"a= "<<a<<endl<<"b= "<<b<<endl;
resultado=mcd.mcd6(a,b);
cout<<endl<<"mcd.mcd6("<<a<<","<<b<<")="<<resultado<<endl<<endl;
t1=clock();
time = (RR(t1-t0)/CLOCKS_PER_SEC);
cout << "Tiempo de ejecucion: : " << time << endl;
system("pause");
system("cls");
t0=clock();
cout<<"algoritmo 7:"<<endl;
cout<<"a= "<<a<<endl<<"b= "<<b<<endl;
resultado=mcd.mcd7(a,b);
cout<<endl<<"mcd.mcd7("<<a<<","<<b<<")="<<resultado<<endl<<endl;
t1=clock();
time = (RR(t1-t0)/CLOCKS_PER_SEC);
cout << "Tiempo de ejecucion: : " << time << endl;
system("pause");
system("cls");
return 0;
}
| [
"[email protected]"
] | |
4953f64ecee3523a4c57a118946dddee06b22672 | 735f408926194b0a92977e01a3fe588e648fec9d | /primeNumber.cpp | e3934d88447c542f22500e98f1b81a2015cdae45 | [] | no_license | sreemonta20/codeforces-math | 6aace5b94defa4e756d0741e6c07e591b530ca79 | 89ebc6e1c3e1c09b55863c6c66ff8eee673c6a56 | refs/heads/master | 2023-05-04T17:20:25.602004 | 2021-05-25T18:08:16 | 2021-05-25T18:08:16 | 370,774,463 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 611 | cpp | #include <iostream>
using namespace std;
// build --> ctrl+shift + B
//run --> ctrl +F5
//run in terminal --> ./watermeloncf4a
int main()
{
int n, i;
bool isPrime = true;
cout << "Enter a number to check Prime or not: \t";
cin >> n;
if(n<=1) {
isPrime = false;
}
for( i= 2; i<n; i++){
if(n%i == 0){
isPrime = false;
break;
}
}
if(isPrime){
cout << n << " is a prime number\n";
return 0;
}
else{
cout << n << " is not a prime number\n";
return 0;
}
} | [
"[email protected]"
] | |
b485b22c30ecc3acee1829c4f05bf4fed4d827e5 | 740b3808efcbe894dfdcec6a968e252ca4914db0 | /InvoiceApp/ui_uploadinginfoform.h | 1a744672b05fc608fb839a8d8499492a5092f593 | [] | no_license | 16071454/work | d3f66992b95fc6178021768bd22c149e1a37e464 | 59aeda691115ff7fe52e4227c81d5aee50ea4df4 | refs/heads/master | 2021-01-04T04:21:04.129842 | 2020-02-28T12:31:26 | 2020-02-28T12:31:26 | 240,381,956 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,235 | h | /********************************************************************************
** Form generated from reading UI file 'uploadinginfoform.ui'
**
** Created by: Qt User Interface Compiler version 5.5.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_UPLOADINGINFOFORM_H
#define UI_UPLOADINGINFOFORM_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QFrame>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_UploadingInfoForm
{
public:
QVBoxLayout *verticalLayout;
QGridLayout *gridLayout;
QHBoxLayout *horizontalLayout_11;
QLabel *label_5;
QLineEdit *lineEdit_project;
QHBoxLayout *horizontalLayout_10;
QLabel *label_4;
QLineEdit *lineEdit_company;
QHBoxLayout *horizontalLayout_12;
QLabel *label_6;
QLineEdit *lineEdit_wbs;
QHBoxLayout *horizontalLayout_9;
QLabel *label_3;
QLineEdit *lineEdit_name;
QHBoxLayout *horizontalLayout_6;
QLabel *label;
QLineEdit *lineEdit_fourcode;
QHBoxLayout *horizontalLayout_7;
QLabel *label_2;
QComboBox *comboBox;
QFrame *line_2;
QHBoxLayout *horizontalLayout_13;
QVBoxLayout *verticalLayout_2;
QHBoxLayout *horizontalLayout_3;
QLabel *label_amount;
QHBoxLayout *horizontalLayout_2;
QLabel *label_sumprice;
QSpacerItem *horizontalSpacer_2;
QLabel *label_date;
QFrame *line;
void setupUi(QWidget *UploadingInfoForm)
{
if (UploadingInfoForm->objectName().isEmpty())
UploadingInfoForm->setObjectName(QStringLiteral("UploadingInfoForm"));
UploadingInfoForm->resize(831, 239);
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(UploadingInfoForm->sizePolicy().hasHeightForWidth());
UploadingInfoForm->setSizePolicy(sizePolicy);
UploadingInfoForm->setStyleSheet(QLatin1String("QWidget#UploadingInfoForm{background-color: rgb(240, 243, 247);}\n"
""));
verticalLayout = new QVBoxLayout(UploadingInfoForm);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
gridLayout = new QGridLayout();
gridLayout->setObjectName(QStringLiteral("gridLayout"));
horizontalLayout_11 = new QHBoxLayout();
horizontalLayout_11->setObjectName(QStringLiteral("horizontalLayout_11"));
label_5 = new QLabel(UploadingInfoForm);
label_5->setObjectName(QStringLiteral("label_5"));
QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Preferred);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(label_5->sizePolicy().hasHeightForWidth());
label_5->setSizePolicy(sizePolicy1);
label_5->setMinimumSize(QSize(116, 0));
label_5->setMaximumSize(QSize(116, 16777215));
label_5->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_11->addWidget(label_5);
lineEdit_project = new QLineEdit(UploadingInfoForm);
lineEdit_project->setObjectName(QStringLiteral("lineEdit_project"));
QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
sizePolicy2.setHeightForWidth(lineEdit_project->sizePolicy().hasHeightForWidth());
lineEdit_project->setSizePolicy(sizePolicy2);
lineEdit_project->setMinimumSize(QSize(200, 0));
lineEdit_project->setMaximumSize(QSize(200, 16777215));
lineEdit_project->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 10pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";\n"
"background-color: rgb(200, 200, 200);"));
lineEdit_project->setReadOnly(true);
horizontalLayout_11->addWidget(lineEdit_project);
gridLayout->addLayout(horizontalLayout_11, 2, 0, 1, 1);
horizontalLayout_10 = new QHBoxLayout();
horizontalLayout_10->setObjectName(QStringLiteral("horizontalLayout_10"));
label_4 = new QLabel(UploadingInfoForm);
label_4->setObjectName(QStringLiteral("label_4"));
sizePolicy1.setHeightForWidth(label_4->sizePolicy().hasHeightForWidth());
label_4->setSizePolicy(sizePolicy1);
label_4->setMinimumSize(QSize(116, 0));
label_4->setMaximumSize(QSize(116, 16777215));
label_4->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_10->addWidget(label_4);
lineEdit_company = new QLineEdit(UploadingInfoForm);
lineEdit_company->setObjectName(QStringLiteral("lineEdit_company"));
sizePolicy2.setHeightForWidth(lineEdit_company->sizePolicy().hasHeightForWidth());
lineEdit_company->setSizePolicy(sizePolicy2);
lineEdit_company->setMinimumSize(QSize(350, 0));
lineEdit_company->setMaximumSize(QSize(350, 16777215));
lineEdit_company->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 10pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";\n"
"background-color: rgb(200, 200, 200);"));
lineEdit_company->setReadOnly(true);
horizontalLayout_10->addWidget(lineEdit_company);
gridLayout->addLayout(horizontalLayout_10, 1, 1, 1, 1);
horizontalLayout_12 = new QHBoxLayout();
horizontalLayout_12->setObjectName(QStringLiteral("horizontalLayout_12"));
label_6 = new QLabel(UploadingInfoForm);
label_6->setObjectName(QStringLiteral("label_6"));
sizePolicy1.setHeightForWidth(label_6->sizePolicy().hasHeightForWidth());
label_6->setSizePolicy(sizePolicy1);
label_6->setMinimumSize(QSize(116, 0));
label_6->setMaximumSize(QSize(116, 16777215));
label_6->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_12->addWidget(label_6);
lineEdit_wbs = new QLineEdit(UploadingInfoForm);
lineEdit_wbs->setObjectName(QStringLiteral("lineEdit_wbs"));
QSizePolicy sizePolicy3(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy3.setHorizontalStretch(0);
sizePolicy3.setVerticalStretch(0);
sizePolicy3.setHeightForWidth(lineEdit_wbs->sizePolicy().hasHeightForWidth());
lineEdit_wbs->setSizePolicy(sizePolicy3);
lineEdit_wbs->setMinimumSize(QSize(350, 0));
lineEdit_wbs->setMaximumSize(QSize(350, 16777215));
lineEdit_wbs->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 10pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";\n"
"background-color: rgb(200, 200, 200);"));
lineEdit_wbs->setReadOnly(true);
horizontalLayout_12->addWidget(lineEdit_wbs);
gridLayout->addLayout(horizontalLayout_12, 2, 1, 1, 1);
horizontalLayout_9 = new QHBoxLayout();
horizontalLayout_9->setObjectName(QStringLiteral("horizontalLayout_9"));
label_3 = new QLabel(UploadingInfoForm);
label_3->setObjectName(QStringLiteral("label_3"));
sizePolicy1.setHeightForWidth(label_3->sizePolicy().hasHeightForWidth());
label_3->setSizePolicy(sizePolicy1);
label_3->setMinimumSize(QSize(116, 0));
label_3->setMaximumSize(QSize(116, 16777215));
label_3->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_9->addWidget(label_3);
lineEdit_name = new QLineEdit(UploadingInfoForm);
lineEdit_name->setObjectName(QStringLiteral("lineEdit_name"));
sizePolicy2.setHeightForWidth(lineEdit_name->sizePolicy().hasHeightForWidth());
lineEdit_name->setSizePolicy(sizePolicy2);
lineEdit_name->setMinimumSize(QSize(200, 0));
lineEdit_name->setMaximumSize(QSize(200, 16777215));
lineEdit_name->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 10pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";\n"
"background-color: rgb(200, 200, 200);"));
lineEdit_name->setReadOnly(true);
horizontalLayout_9->addWidget(lineEdit_name);
gridLayout->addLayout(horizontalLayout_9, 1, 0, 1, 1);
horizontalLayout_6 = new QHBoxLayout();
horizontalLayout_6->setObjectName(QStringLiteral("horizontalLayout_6"));
label = new QLabel(UploadingInfoForm);
label->setObjectName(QStringLiteral("label"));
sizePolicy1.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
label->setSizePolicy(sizePolicy1);
label->setMinimumSize(QSize(116, 0));
label->setMaximumSize(QSize(116, 16777215));
label->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_6->addWidget(label);
lineEdit_fourcode = new QLineEdit(UploadingInfoForm);
lineEdit_fourcode->setObjectName(QStringLiteral("lineEdit_fourcode"));
sizePolicy2.setHeightForWidth(lineEdit_fourcode->sizePolicy().hasHeightForWidth());
lineEdit_fourcode->setSizePolicy(sizePolicy2);
lineEdit_fourcode->setMinimumSize(QSize(200, 0));
lineEdit_fourcode->setMaximumSize(QSize(200, 16777215));
lineEdit_fourcode->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 10pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
lineEdit_fourcode->setMaxLength(4);
horizontalLayout_6->addWidget(lineEdit_fourcode);
gridLayout->addLayout(horizontalLayout_6, 0, 0, 1, 1);
horizontalLayout_7 = new QHBoxLayout();
horizontalLayout_7->setObjectName(QStringLiteral("horizontalLayout_7"));
label_2 = new QLabel(UploadingInfoForm);
label_2->setObjectName(QStringLiteral("label_2"));
sizePolicy1.setHeightForWidth(label_2->sizePolicy().hasHeightForWidth());
label_2->setSizePolicy(sizePolicy1);
label_2->setMinimumSize(QSize(116, 0));
label_2->setMaximumSize(QSize(116, 16777215));
label_2->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_7->addWidget(label_2);
comboBox = new QComboBox(UploadingInfoForm);
comboBox->setObjectName(QStringLiteral("comboBox"));
sizePolicy3.setHeightForWidth(comboBox->sizePolicy().hasHeightForWidth());
comboBox->setSizePolicy(sizePolicy3);
comboBox->setMinimumSize(QSize(350, 0));
comboBox->setMaximumSize(QSize(350, 16777215));
comboBox->setLayoutDirection(Qt::LeftToRight);
comboBox->setStyleSheet(QStringLiteral(""));
horizontalLayout_7->addWidget(comboBox);
gridLayout->addLayout(horizontalLayout_7, 0, 1, 1, 1);
verticalLayout->addLayout(gridLayout);
line_2 = new QFrame(UploadingInfoForm);
line_2->setObjectName(QStringLiteral("line_2"));
line_2->setFrameShape(QFrame::HLine);
line_2->setFrameShadow(QFrame::Sunken);
verticalLayout->addWidget(line_2);
horizontalLayout_13 = new QHBoxLayout();
horizontalLayout_13->setObjectName(QStringLiteral("horizontalLayout_13"));
verticalLayout_2 = new QVBoxLayout();
verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2"));
horizontalLayout_3 = new QHBoxLayout();
horizontalLayout_3->setObjectName(QStringLiteral("horizontalLayout_3"));
label_amount = new QLabel(UploadingInfoForm);
label_amount->setObjectName(QStringLiteral("label_amount"));
sizePolicy.setHeightForWidth(label_amount->sizePolicy().hasHeightForWidth());
label_amount->setSizePolicy(sizePolicy);
label_amount->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_3->addWidget(label_amount);
verticalLayout_2->addLayout(horizontalLayout_3);
horizontalLayout_2 = new QHBoxLayout();
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
label_sumprice = new QLabel(UploadingInfoForm);
label_sumprice->setObjectName(QStringLiteral("label_sumprice"));
sizePolicy.setHeightForWidth(label_sumprice->sizePolicy().hasHeightForWidth());
label_sumprice->setSizePolicy(sizePolicy);
label_sumprice->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_2->addWidget(label_sumprice);
verticalLayout_2->addLayout(horizontalLayout_2);
horizontalLayout_13->addLayout(verticalLayout_2);
horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
horizontalLayout_13->addItem(horizontalSpacer_2);
label_date = new QLabel(UploadingInfoForm);
label_date->setObjectName(QStringLiteral("label_date"));
sizePolicy.setHeightForWidth(label_date->sizePolicy().hasHeightForWidth());
label_date->setSizePolicy(sizePolicy);
label_date->setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);\n"
"font: 75 12pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";"));
horizontalLayout_13->addWidget(label_date);
verticalLayout->addLayout(horizontalLayout_13);
line = new QFrame(UploadingInfoForm);
line->setObjectName(QStringLiteral("line"));
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
verticalLayout->addWidget(line);
line->raise();
line_2->raise();
retranslateUi(UploadingInfoForm);
QMetaObject::connectSlotsByName(UploadingInfoForm);
} // setupUi
void retranslateUi(QWidget *UploadingInfoForm)
{
UploadingInfoForm->setWindowTitle(QApplication::translate("UploadingInfoForm", "Form", 0));
label_5->setText(QApplication::translate("UploadingInfoForm", "\351\241\271 \347\233\256 \344\277\241 \346\201\257\357\274\232", 0));
label_4->setText(QApplication::translate("UploadingInfoForm", "\346\212\245 \351\224\200 \345\205\254 \345\217\270\357\274\232", 0));
label_6->setText(QApplication::translate("UploadingInfoForm", "WBS \351\230\266 \346\256\265\357\274\232", 0));
label_3->setText(QApplication::translate("UploadingInfoForm", "\346\212\245 \351\224\200 \344\272\272\357\274\232", 0));
label->setText(QApplication::translate("UploadingInfoForm", "\345\233\233 \344\275\215 \347\274\226 \345\217\267:", 0));
label_2->setText(QApplication::translate("UploadingInfoForm", "\345\215\225 \346\215\256 \347\261\273 \345\236\213\357\274\232", 0));
comboBox->clear();
comboBox->insertItems(0, QStringList()
<< QApplication::translate("UploadingInfoForm", "\346\224\257\345\207\272\345\207\255\345\215\225", 0)
<< QApplication::translate("UploadingInfoForm", "\345\267\256\346\227\205\346\212\245\351\224\200\345\215\225", 0)
<< QApplication::translate("UploadingInfoForm", "\346\224\257\347\245\250\351\242\206\347\224\250\345\215\225", 0)
<< QApplication::translate("UploadingInfoForm", "\347\205\247\346\230\216\346\211\200-\346\224\257\345\207\272\345\207\255\345\215\225", 0)
<< QApplication::translate("UploadingInfoForm", "\347\205\247\346\230\216\346\211\200-\345\267\256\346\227\205\346\212\245\351\224\200\345\215\225", 0)
<< QApplication::translate("UploadingInfoForm", "\347\205\247\346\230\216\346\211\200-\346\224\257\347\245\250\351\242\206\347\224\250\345\215\225", 0)
);
label_amount->setText(QApplication::translate("UploadingInfoForm", "TextLabel", 0));
label_sumprice->setText(QApplication::translate("UploadingInfoForm", "TextLabel", 0));
label_date->setText(QApplication::translate("UploadingInfoForm", "TextLabel", 0));
} // retranslateUi
};
namespace Ui {
class UploadingInfoForm: public Ui_UploadingInfoForm {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_UPLOADINGINFOFORM_H
| [
"[email protected]"
] | |
ffba7e24fd43625f52335ad986e3dd57d05933c1 | 5456502f97627278cbd6e16d002d50f1de3da7bb | /chrome/test/chromedriver/chrome/geolocation_override_manager_unittest.cc | f9b3b8c61ab587de7db17feb603bd8d93e1f2605 | [
"BSD-3-Clause"
] | permissive | TrellixVulnTeam/Chromium_7C66 | 72d108a413909eb3bd36c73a6c2f98de1573b6e5 | c8649ab2a0f5a747369ed50351209a42f59672ee | refs/heads/master | 2023-03-16T12:51:40.231959 | 2017-12-20T10:38:26 | 2017-12-20T10:38:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,262 | cc | // Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/values.h"
#include "chrome/test/chromedriver/chrome/geolocation_override_manager.h"
#include "chrome/test/chromedriver/chrome/geoposition.h"
#include "chrome/test/chromedriver/chrome/recorder_devtools_client.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
void AssertGeolocationCommand(const Command& command,
const Geoposition& geoposition) {
ASSERT_EQ("Page.setGeolocationOverride", command.method);
double latitude, longitude, accuracy;
ASSERT_TRUE(command.params.GetDouble("latitude", &latitude));
ASSERT_TRUE(command.params.GetDouble("longitude", &longitude));
ASSERT_TRUE(command.params.GetDouble("accuracy", &accuracy));
ASSERT_EQ(geoposition.latitude, latitude);
ASSERT_EQ(geoposition.longitude, longitude);
ASSERT_EQ(geoposition.accuracy, accuracy);
}
} // namespace
TEST(GeolocationOverrideManager, OverrideSendsCommand) {
RecorderDevToolsClient client;
GeolocationOverrideManager manager(&client);
Geoposition geoposition = {1, 2, 3};
manager.OverrideGeolocation(geoposition);
ASSERT_EQ(1u, client.commands_.size());
ASSERT_NO_FATAL_FAILURE(
AssertGeolocationCommand(client.commands_[0], geoposition));
geoposition.latitude = 5;
manager.OverrideGeolocation(geoposition);
ASSERT_EQ(2u, client.commands_.size());
ASSERT_NO_FATAL_FAILURE(
AssertGeolocationCommand(client.commands_[1], geoposition));
}
TEST(GeolocationOverrideManager, SendsCommandOnConnect) {
RecorderDevToolsClient client;
GeolocationOverrideManager manager(&client);
ASSERT_EQ(0u, client.commands_.size());
ASSERT_EQ(kOk, manager.OnConnected(&client).code());
Geoposition geoposition = {1, 2, 3};
manager.OverrideGeolocation(geoposition);
ASSERT_EQ(1u, client.commands_.size());
ASSERT_EQ(kOk, manager.OnConnected(&client).code());
ASSERT_EQ(2u, client.commands_.size());
ASSERT_NO_FATAL_FAILURE(
AssertGeolocationCommand(client.commands_[1], geoposition));
}
TEST(GeolocationOverrideManager, SendsCommandOnNavigation) {
RecorderDevToolsClient client;
GeolocationOverrideManager manager(&client);
base::DictionaryValue main_frame_params;
ASSERT_EQ(kOk,
manager.OnEvent(&client, "Page.frameNavigated", main_frame_params)
.code());
ASSERT_EQ(0u, client.commands_.size());
Geoposition geoposition = {1, 2, 3};
manager.OverrideGeolocation(geoposition);
ASSERT_EQ(1u, client.commands_.size());
ASSERT_EQ(kOk,
manager.OnEvent(&client, "Page.frameNavigated", main_frame_params)
.code());
ASSERT_EQ(2u, client.commands_.size());
ASSERT_NO_FATAL_FAILURE(
AssertGeolocationCommand(client.commands_[1], geoposition));
base::DictionaryValue sub_frame_params;
sub_frame_params.SetString("frame.parentId", "id");
ASSERT_EQ(
kOk,
manager.OnEvent(&client, "Page.frameNavigated", sub_frame_params).code());
ASSERT_EQ(2u, client.commands_.size());
}
| [
"[email protected]"
] | |
1706866704045ae6964eb7fc5907da61f33fe129 | b1f7a2309825dbe6d5953f6582d7f442d1d40422 | /lc-cn/每日温度.cpp | ff19ab3f281e71d9a31a72e1154583ac8c450cf2 | [] | no_license | helloMickey/Algorithm | cbb8aea2a4279b2d76002592a658c54475977ff0 | d0923a9e14e288def11b0a8191097b5fd7a85f46 | refs/heads/master | 2023-07-03T00:58:05.754471 | 2021-08-09T14:42:49 | 2021-08-09T14:42:49 | 201,753,017 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,659 | cpp | // https://leetcode-cn.com/problems/daily-temperatures/
class Solution {
public:
// 单调栈.... O(2n)
vector<int> dailyTemperatures(vector<int> temperatures){
vector<int> res(temperatures.size(), 0);
stack<int> idx_stack; // 递减栈
for(int i = 0; i < temperatures.size(); i++){
while(!idx_stack.empty() &&
temperatures[idx_stack.top()] < temperatures[i])
{
int cur_idx = idx_stack.top(); idx_stack.pop();
res[cur_idx] = i - cur_idx; // 记录第一个比 cur_idx 温度高的所隔天数
}
idx_stack.push(i);
}
return res;
}
// 暴力算法 O(2n)
/*
可以进行优化 -> 由于温度都是在 [30, 100] 范围内的整数,
所以可以通过数组记录每个温度值第一次出现的下标 count
对于每一天的温度,从count中的temp[i] + 1 下标开始遍历 count,找到其中大于i的最小值(里i最近的一天)
复杂度 O(kn)
*/
vector<int> dailyTemperatures_1(vector<int>& temperatures) {
int days = temperatures.size();
vector<int> res(days, 0);
for(int i = days-2; i > -1; i--){
int j = i + 1;
while((j < days) && temperatures[j] <= temperatures[i]){// 找大于 temp[i] 的那一天
if(res[j] == 0) break; // 之后的都不会更大了
j += res[j]; // 找下一个比 temp[j] 大的值
}
if(j < days) res[i] = temperatures[j] > temperatures[i] ? (j-i) : 0;
}
return res;
}
}; | [
"[email protected]"
] | |
94d5aabcd69c243ba0a5dc820d78e4997f100eb0 | 5898d3bd9e4cb58043b40fa58961c7452182db08 | /part3/ch16/16-2-5-constructor/src/Date1.h | 4499f36697edc4f04a8ed59b525a62840cc11d29 | [] | no_license | sasaki-seiji/ProgrammingLanguageCPP4th | 1e802f3cb15fc2ac51fa70403b95f52878223cff | 2f686b385b485c27068328c6533926903b253687 | refs/heads/master | 2020-04-04T06:10:32.942026 | 2017-08-10T11:35:08 | 2017-08-10T11:35:08 | 53,772,682 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 216 | h | /*
* Date1.h
*
* Created on: 2016/07/16
* Author: sasaki
*/
#ifndef DATE1_H_
#define DATE1_H_
class Date1 {
int d, m, y;
public:
Date1(int dd, int mm, int yy);
void print();
};
#endif /* DATE1_H_ */
| [
"[email protected]"
] | |
a768334f294dc75b438225e130e8320e0acc3268 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_2645486_1/C++/dtn/energy.cpp | 285d6351412a5436f2921dfc0a42015412d9c2b7 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,422 | cpp | //============================================================================
// Name : codejam.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
using namespace std;
#define MIN(a, b) ((a > b) ? b : a)
#define MAX(a, b) ((a > b) ? a : b)
int main() {
ifstream fi;
ofstream fo;
fi.open("in.in");
fo.open("out.txt");
int t;
fi >> t;
for (int c = 1; c <= t; c++) {
int e, r, n;
unsigned long long total = 0;
fi >> e >> r >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
fi >> v[i];
//for (int i = 0; i< n; i++) cout << v[i] << endl;
int re = e;
for (int i = 0; i < n; i++) {
if (i == n - 1) {
total = total + re * v[i];
re = 0;
} else {
//find next big
int j = i + 1;
while (j < n) {
if (v[j] <= v[i]) j++;
else break;
}
if (j == n) { // no one
total = total + re*v[i];
re = 0;
} else {
int use = MIN(re, re + (j-i) * r - e);
if (use < 0) use = 0;
total = total + use * v[i];
re = re - use;
}
}
re = re + r;
}
fo << "Case #" << c << ": " << total <<"\n";
}
fo.close();
fi.close();
return 0;
}
| [
"[email protected]"
] | |
e0a370f15b7e1cf1e56ca790d619d085d5468871 | fed98c76e41d51a24f262fa4c2ea17aea10539de | /src/zhanghong/src/00213_house_robber_2/00213_house_robber_2_test.cc | a993b6525292b3352ba2f7a7bb78b90ac014b51b | [] | no_license | generalibm/leetcode | 78c06c9cc8d3e164e3c87818a841e26c9a5009d5 | 3d7d18ae9fd50b457b7cb39b27568a2eafb856bc | refs/heads/master | 2021-06-24T11:24:11.572522 | 2019-11-13T12:34:44 | 2019-11-13T12:34:44 | 188,649,239 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 480 | cc | #include "gtest/gtest.h"
#include "00213_house_robber_2.h"
using namespace Solution00213;
namespace SolutionTest00213 {
class SolutionTest : public ::testing::Test {
protected:
Solution sol;
};
TEST_F(SolutionTest, Example1)
{
EXPECT_EQ(3, sol.rob( { 2, 3, 2 }));
}
TEST_F(SolutionTest, Example2)
{
EXPECT_EQ(4, sol.rob( { 1, 2, 3, 1 }));
}
TEST_F(SolutionTest, Example3)
{
EXPECT_EQ(7, sol.rob( { 1, 5, 2, 1, 2 }));
}
}
| [
"[email protected]"
] | |
0eff597d8cd007221eec319b1170bcbb9f1d8f07 | e2f2b7156686213fa70dc6bab69213f834463ba7 | /cpp/space-age/space_age.h | 8cf64c4ed879f9d07939fb285cddddd0a733ee68 | [] | no_license | a62mds/exercism | bf799a032b78adbaa9a9f137022cc634b1ec0a22 | a0797b173b235f1cb699c241c014c40594146d72 | refs/heads/master | 2020-05-21T23:55:30.356519 | 2019-12-08T02:39:52 | 2019-12-08T02:39:52 | 64,046,878 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,470 | h | #ifndef SPACE_AGE_H
#define SPACE_AGE_H
namespace space_age {
class space_age {
private:
const double earth_s_per_y{31557600.0};
const double earth_y_per_s{1.0/earth_s_per_y};
const double earth_y_per_mrc_y{0.2408467};
const double earth_y_per_vns_y{0.61519726};
const double earth_y_per_mrs_y{1.8808158};
const double earth_y_per_jup_y{11.862615};
const double earth_y_per_sat_y{29.447498};
const double earth_y_per_urn_y{84.016846};
const double earth_y_per_nep_y{164.79132};
double m_age_in_seconds{0.0};
double m_age_in_earth_y{0.0};
public:
space_age(double age_in_seconds) :
m_age_in_seconds(age_in_seconds),
m_age_in_earth_y(age_in_seconds * earth_y_per_s) {}
double seconds() const { return m_age_in_seconds; }
double on_earth() const { return m_age_in_earth_y; }
double on_mercury() const { return m_age_in_earth_y / earth_y_per_mrc_y; }
double on_venus() const { return m_age_in_earth_y / earth_y_per_vns_y; }
double on_mars() const { return m_age_in_earth_y / earth_y_per_mrs_y; }
double on_jupiter() const { return m_age_in_earth_y / earth_y_per_jup_y; }
double on_saturn() const { return m_age_in_earth_y / earth_y_per_sat_y; }
double on_uranus() const { return m_age_in_earth_y / earth_y_per_urn_y; }
double on_neptune() const { return m_age_in_earth_y / earth_y_per_nep_y; }
};
}
#endif
| [
"[email protected]"
] | |
514d3532819ec5dadd99cd6ab5e27790a031e6c1 | b836edf09339296713aa6167e774910b32311396 | /src/chem_charge_balance.cpp | 9f87bb2153a03d90b5056dde15489440e6f9d694 | [] | no_license | eje74/BioZement | a672d4b001229ae2b7e92b72770ffedbaf111d0a | 11dcec1a091518ca8195a9a57cd06fe78c03ac81 | refs/heads/master | 2023-04-19T02:20:45.244592 | 2022-10-14T14:08:12 | 2022-10-14T14:08:12 | 551,495,514 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,530 | cpp | #include "chem_global.h"
double f_pH(double x, int no_call, struct BasVec *Vchem, void (*mbal)(int, struct BasVec *))
{
int i;
real f_tmp;
struct ChemTable *SM_basis, *SM_all;
SM_basis = Vchem->ICS->SM_basis;
SM_all = Vchem->ICS->SM_all;
/* H+ */
Vchem->log_a[Vchem->pos_pH] = x;
Vchem->log_m[Vchem->pos_pH] = x-Vchem->log_g[Vchem->pos_pH];
/*--------------------- apply mass balance -------------------------*/
if (Vchem ->size_mass>0)
{
//if (_DEBUG_FLAG_) printf("\mbal(no_call=%d, Vchem);\n",no_call);
mbal(no_call, Vchem);
//if (_DEBUG_FLAG_) printf("\nafter\n");
}
else /* calculate the concentration of the rock buffered species and complexes */
{
if(Vchem->size_rock>0)
calc_rock_spec_conc(Vchem);
calc_complex(SM_all, Vchem);
}
/* sum up basis species */
f_tmp = 0.;
if(Vchem->DL)
{
for(i=0;i<Vchem->size;++i)
{
f_tmp += pow10(Vchem->log_m[i])*SM_basis->charge[i];
}
}
else
{
for(i=0;i<Vchem->size;++i)
{
f_tmp += pow10(Vchem->log_m[i])*(SM_basis->scharge[i]+SM_basis->charge[i]);
}
}
/* SM_all->charge[i] = 0 for all surface complexes */
/* SM_all->scharge[i] = 0 for all aqueous complexes */
if(Vchem->DL)
for(i=0;i<SM_all->size[0];++i) f_tmp += pow10(SM_all->log_m[i])*SM_all->charge[i];
else
for(i=0;i<SM_all->size[0];++i) f_tmp += pow10(SM_all->log_m[i])*(SM_all->charge[i]+SM_all->scharge[i]);
/* add the charge of the cation exchanger */
if(Vchem->pos_X >= 0) f_tmp -= Vchem->ctot[Vchem->pos_X];
return (double) f_tmp;
}
/*
************************************************************************
* C math library
* function ZEROIN - obtain a function zero within the given range
*
* Input
* double zeroin(ax,bx,f,tol)
* double ax; Root will be seeked for within
* double bx; a range [ax,bx]
* double (*f)(double x); Name of the function whose zero
* will be seeked for
* double tol; Acceptable tolerance for the root
* value.
* May be specified as 0.0 to cause
* the program to find the root as
* accurate as possible
*
* Output
* Zeroin returns an estimate for the root with accuracy
* 4*EPSILON*abs(x) + tol
*
* Algorithm
* G.Forsythe, M.Malcolm, C.Moler, Computer methods for mathematical
* computations. M., Mir, 1980, p.180 of the Russian edition
*
* The function makes use of the bissection procedure combined with
* the linear or quadric inverse interpolation.
* At every step program operates on three abscissae - a, b, and c.
* b - the last and the best approximation to the root
* a - the last but one approximation
* c - the last but one or even earlier approximation than a that
* 1) |f(b)| <= |f(c)|
* 2) f(b) and f(c) have opposite signs, i.e. b and c confine
* the root
* At every step Zeroin selects one of the two new approximations, the
* former being obtained by the bissection procedure and the latter
* resulting in the interpolation (if a,b, and c are all different
* the quadric interpolation is utilized, otherwise the linear one).
* If the latter (i.e. obtained by the interpolation) point is
* reasonable (i.e. lies within the current interval [b,c] not being
* too close to the boundaries) it is accepted. The bissection result
* is used in the other case. Therefore, the range of uncertainty is
* ensured to be reduced at least by the factor 1.6
*
************************************************************************
*/
//double zeroin( x_init, indx, ax, bx,f,tol,Vchem) /* An estimate to the root */
//double ax; /* Left border | of the range */
//double bx; /* Right border| the root is seeked*/
//double x_init; /* previous solution */
//int indx ; /* use initial guess ? */
//double (*f)(double x, int no_call, struct BasVec *Vchem); /* Function under investigation */
//double tol; /* Acceptable tolerance */
//struct BasVec *Vchem;
//{
// double a,b,c; /* Abscissae, descr. see above */
// double fa; /* f(a) */
// double fb; /* f(b) */
// double fc; /* f(c) */
// double crit;
// int icrit;
// int iter;
//
// crit = 2.;
// icrit = 0;
// iter =0;
// if(indx)
// {
// a=x_init-2.;
// b=x_init+1.;
// fa = (*f)(a,icrit,Vchem );
// fb = (*f)(b,icrit,Vchem );
// c=a; fc=fa;
// } else
// {
// fa=fb=1.;
// }
// if(fa*fb>0) /* if init guess is bad */
// {
// a = ax; b = bx; fa = (*f)(a,icrit, Vchem ); fb = (*f)(b,icrit,Vchem);
// c = a; fc = fa;
// }
// for(;;) /* Main iteration loop */
// {
// double prev_step = b-a; /* Distance from the last but one*/
// /* to the last approximation */
// double tol_act; /* Actual tolerance */
// double p; /* Interpolation step is calcu- */
// double q; /* lated in the form p/q; divi- */
// /* sion operations is delayed */
// /* until the last moment */
// double new_step; /* Step at this iteration */
//
// if( fabs(fc) < fabs(fb) )
// { /* Swap data for b to be the */
// a = b; b = c; c = a; /* best approximation */
// fa=fb; fb=fc; fc=fa;
// }
// tol_act = 2*CHEM_EPSILON_*fabs(b) + tol/2;
// new_step = (c-b)/2;
//
// if( fabs(new_step) <= tol_act || fb == (double)0 )
// {
// if(Vchem->ICS->PRINT_DEBUG_CHEM) printf("ZEROIN: No iter: %d \n", iter);
// return b; /* Acceptable approx. is found */
// }
//
// /* Decide if the interpolation can be tried */
// if( fabs(prev_step) >= tol_act /* If prev_step was large enough*/
// && fabs(fa) > fabs(fb) ) /* and was in true direction, */
// { /* Interpolatiom may be tried */
// register double t1,cb,t2;
// cb = c-b;
// if( a==c ) /* If we have only two distinct */
// { /* points linear interpolation */
// t1 = fb/fa; /* can only be applied */
// p = cb*t1;
// q = 1.0 - t1;
// }
// else /* Quadric inverse interpolation*/
// {
// q = fa/fc; t1 = fb/fc; t2 = fb/fa;
// p = t2 * ( cb*q*(q-t1) - (b-a)*(t1-1.0) );
// q = (q-1.0) * (t1-1.0) * (t2-1.0);
// }
// if( p>(double)0 ) /* p was calculated with the op-*/
// q = -q; /* posite sign; make p positive */
// else /* and assign possible minus to */
// p = -p; /* q */
//
// if( p < (0.75*cb*q-fabs(tol_act*q)/2) /* If b+p/q falls in [b,c]*/
// && p < fabs(prev_step*q/2) ) /* and isn't too large */
// new_step = p/q; /* it is accepted */
// /* If p/q is too large then the */
// /* bissection procedure can */
// /* reduce [b,c] range to more */
// /* extent */
// }
//
// if( fabs(new_step) < tol_act ) {/* Adjust the step to be not less*/
// if( new_step > (double)0 ) { /* than tolerance */
// new_step = tol_act;
// } else {
// new_step = -tol_act;
// }
// }
// iter++;
// a = b; fa = fb; /* Save the previous approx. */
// b += new_step;
// if(fabs(a-b)<crit) icrit = 1;
// fb = (*f)(b, icrit, Vchem); /* Do step to a new approxim. */
// if( (fb > 0 && fc > 0) || (fb < 0 && fc < 0) )
// { /* Adjust c for it to have a sign*/
// c = a; fc = fa; /* opposite to that of b */
// }
//
// }
//
//}
/*
************************************************************************
* C math library
* function ZEROIN - obtain a function zero within the given range
*
* Input
* double zeroin(ax,bx,f,tol)
* double ax; Root will be seeked for within
* double bx; a range [ax,bx]
* double (*f)(double x); Name of the function whose zero
* will be seeked for
* double tol; Acceptable tolerance for the root
* value.
* May be specified as 0.0 to cause
* the program to find the root as
* accurate as possible
*
* Output
* Zeroin returns an estimate for the root with accuracy
* 4*EPSILON*abs(x) + tol
*
* Algorithm
* G.Forsythe, M.Malcolm, C.Moler, Computer methods for mathematical
* computations. M., Mir, 1980, p.180 of the Russian edition
*
* The function makes use of the bissection procedure combined with
* the linear or quadric inverse interpolation.
* At every step program operates on three abscissae - a, b, and c.
* b - the last and the best approximation to the root
* a - the last but one approximation
* c - the last but one or even earlier approximation than a that
* 1) |f(b)| <= |f(c)|
* 2) f(b) and f(c) have opposite signs, i.e. b and c confine
* the root
* At every step Zeroin selects one of the two new approximations, the
* former being obtained by the bissection procedure and the latter
* resulting in the interpolation (if a,b, and c are all different
* the quadric interpolation is utilized, otherwise the linear one).
* If the latter (i.e. obtained by the interpolation) point is
* reasonable (i.e. lies within the current interval [b,c] not being
* too close to the boundaries) it is accepted. The bissection result
* is used in the other case. Therefore, the range of uncertainty is
* ensured to be reduced at least by the factor 1.6
*
************************************************************************
*/
//double zeroin2( ax, bx,f,tol,Vchem) /* An estimate to the root */
//double ax; /* Left border | of the range */
//double bx; /* Right border| the root is seeked*/
//double (*f)(double x, struct BasVec *Vchem); /* Function under investigation */
//double tol; /* Acceptable tolerance */
//struct BasVec *Vchem;
//{
// double a,b,c; /* Abscissae, descr. see above */
// double fa; /* f(a) */
// double fb; /* f(b) */
// double fc; /* f(c) */
// int iter;
// iter =0;
// a = ax; b = bx; fa = (*f)(a,Vchem ); fb = (*f)(b,Vchem);
// c = a; fc = fa;
// iter = 0;
// if(fa*fb>0) printf("ZERION2 : fa and fb have same sign!\n");
// while(fabs(a-b) > tol)
// {
// c =(a+b)*.5;fc=(*f)(c,Vchem);
// if(fc*fa > 0)
// {
// a = c;
// fa=fc;
// }
// else
// {
// b=c;
// }
//
// iter ++;
// }
//
//
//}
/*
void print_fpH(real x1, real x2, struct BasVec *Vchem)
{
int i, pos_ph;
int N=100;
real dx, x_init, value;
FILE *fp;
fp=my_fopen("pH_debug.out", "w");
fclose(fp);
dx = (x2-x1)/((real) N);
x_init = x1;
for(i=0;i<N;++i)
{
fp=my_fopen("pH_debug.out", "a");
value = f_pH(x_init,0,Vchem);
fprintf(fp,"%lf\t%lf\n", -x_init, value);
if(Vchem->ICS->PRINT_DEBUG_CHEM)
printf("%lf\t%lf\n", -x_init, value);
x_init +=dx;
fclose(fp);
}
return;
}
*/
| [
"[email protected]"
] | |
17e0aea2c719b48cbb50669b56b1635a1ed08077 | 06ed6153be0405570ce8cbf2f970b492a142bf3c | /SpriteCreator/Interface.cpp | d549101b0848ad3fe534bf9a4a4f6ef8950a1d79 | [] | no_license | Dequilla/MID | 1e2532449c386deed2bc7fa79a169c723a43db2a | f504abcfeb92206f016e65b4d71f2a6c423eeabb | refs/heads/master | 2021-01-13T04:28:42.045985 | 2017-01-27T23:56:52 | 2017-01-27T23:56:52 | 79,908,030 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,100 | cpp | #include "Interface.h"
void deq::Interface::draw(sf::RenderWindow& window)
{
for (auto &element : m_elements)
{
element->draw(window);
}
}
void deq::Interface::input(const sf::Event& input)
{
for (auto &element : m_elements)
{
element->input(input);
}
}
void deq::Interface::update(const float& deltaTime)
{
for (auto &element : m_elements)
{
element->update(deltaTime);
}
}
void deq::Interface::addElement(std::string id, Element* element)
{
m_elements.push_back(element);
int index = m_elements.size() - 1;
m_elementIndexs.emplace(id, index);
}
void deq::Interface::removeElement(std::string id)
{
int index = m_elementIndexs.at(id);
m_elements.erase(m_elements.begin() + index);
}
void deq::Interface::removeElement(int index)
{
m_elements.erase(m_elements.begin() + index);
}
deq::Element* deq::Interface::getElement(std::string id)
{
int index = m_elementIndexs.at(id);
return m_elements.at(index);
}
deq::Element* deq::Interface::getElement(int index)
{
return m_elements.at(index);
}
void deq::Button::updateDimensions()
{
// Position
sf::Vector2f leftPos = sf::Vector2f(m_position.x, m_position.y);
sf::Vector2f centerPos = sf::Vector2f(m_position.x + m_sideSpriteWidth, m_position.y);
sf::Vector2f rightPos = sf::Vector2f(centerPos.x + m_centerSpriteWidth, m_position.y);
m_leftSprite.setPosition(leftPos);
m_centerSprite.setPosition(centerPos);
m_rightSprite.setPosition(rightPos);
// Size
m_sideSpriteWidth = m_size.x * 0.25f;
m_centerSpriteWidth = m_size.x - m_sideSpriteWidth * 2;
m_leftSprite.setSize(m_sideSpriteWidth, m_size.y);
m_centerSprite.setSize(m_centerSpriteWidth, m_size.y);
m_rightSprite.setSize(m_sideSpriteWidth, m_size.y);
// Fit the text
float size = m_size.y;
size = size * 0.5f;
m_text.setCharacterSize(size);
if (m_text.getGlobalBounds().width > m_size.x)
{
// If text is too wide
size = m_size.x / m_text.getString().getSize();
size = size * 0.9f;
m_text.setCharacterSize(size);
}
m_text.setOrigin(m_text.getLocalBounds().width / 2, m_text.getLocalBounds().height / 2);
m_text.setPosition(m_position.x + m_size.x / 2, m_position.y + m_size.y / 2);
}
void deq::Button::updateButton(const float& deltaTime)
{
// Update sprite looks
if (pressed)
{
m_leftSprite.setAnimation("leftPressed");
m_centerSprite.setAnimation("centerPressed");
m_rightSprite.setAnimation("rightPressed");
}
else if (released)
{
}
else
{
m_leftSprite.setAnimation("leftUnpressed");
m_centerSprite.setAnimation("centerUnpressed");
m_rightSprite.setAnimation("rightUnpressed");
}
m_leftSprite.update(deltaTime);
m_centerSprite.update(deltaTime);
m_rightSprite.update(deltaTime);
released = false;
}
void deq::Button::init()
{
m_leftSprite.setAnimation("leftUnpressed");
m_centerSprite.setAnimation("centerUnpressed");
m_rightSprite.setAnimation("rightUnpressed");
}
deq::Button::Button() : deq::Element(sf::Vector2f(0, 0), sf::Vector2f(100, 30))
{
init();
updateDimensions();
}
deq::Button::Button(sf::Vector2f position, sf::Vector2f size) : deq::Element(position, size)
{
init();
updateDimensions();
}
void deq::Button::draw(sf::RenderWindow& window)
{
window.draw(m_leftSprite);
window.draw(m_centerSprite);
window.draw(m_rightSprite);
window.draw(m_text);
}
void deq::Button::input(const sf::Event& input)
{
if (input.type == sf::Event::MouseButtonPressed)
{
if (input.mouseButton.button == sf::Mouse::Button::Left)
{
sf::Vector2f mousePos(input.mouseButton.x, input.mouseButton.y);
sf::FloatRect buttonBounds(this->m_position + globalInteractionOffset, this->m_size);
if (buttonBounds.contains(mousePos))
{
pressed = true;
}
}
}
else if (input.type == sf::Event::MouseButtonReleased)
{
if (input.mouseButton.button == sf::Mouse::Left)
{
released = true;
pressed = false;
}
}
}
void deq::Button::update(const float& deltaTime)
{
updateButton(deltaTime);
}
void deq::Button::setFont(std::string path)
{
m_font = loadFont(path);
m_text.setFont(*m_font);
updateDimensions();
}
void deq::Button::setText(sf::String text)
{
m_text.setString(text);
updateDimensions();
}
void deq::Button::setSize(float width, float height)
{
m_size.x = width;
m_size.y = height;
updateDimensions();
}
void deq::Button::setPosition(float left, float top)
{
m_position.x = left;
m_position.y = top;
updateDimensions();
}
void deq::Button::setBackgroundColor(sf::Color color)
{
m_centerSprite.setColor(color);
m_leftSprite.setColor(color);
m_rightSprite.setColor(color);
}
void deq::Button::setTextFillColor(sf::Color color)
{
m_text.setFillColor(color);
}
deq::SelectFileButton::SelectFileButton() : deq::Button(sf::Vector2f(0, 0), sf::Vector2f(100, 30)){}
deq::SelectFileButton::SelectFileButton(sf::Vector2f position, sf::Vector2f size) : deq::Button(position, size){}
void deq::SelectFileButton::update(const float& deltaTime)
{
if (released)
{
File file = openFileDialog("Open a spritesheet", "Images\0*.png;\0Any files\0*.*;\0\0"); // TODO: Change so it is not just a spritesheet button
}
updateButton(deltaTime);
} | [
"[email protected]"
] | |
cdaf0df86dad9fecc9701412ec57226862459c0c | d45bdd03e49cb6762a1332d34cc752bf780e4b24 | /MyTask/MyTask/EnergySaliencyFT.cpp | f75b460799cf13f83385eb51e034e0e67b155ec8 | [] | no_license | HuangSuqii/GaoDSH | 20601948b8a5f7863f9915957b8e38f731664b4a | 3238f3b7dfbd1c7ffce992c14b4eff4b73c54ff0 | refs/heads/master | 2021-01-22T04:34:33.768285 | 2016-10-07T16:08:05 | 2016-10-07T16:08:05 | 68,430,039 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 789 | cpp | #include "EnergySaliencyFT.h"
EnergySaliencyFT* EnergySaliencyFT::mSingleton = NULL;
void EnergySaliencyFT::AlgrithomProcessor(Mat& srcImg, Mat& desImg)
{
srcImg.convertTo(srcImg, CV_32FC3, 1.0 / 255);
desImg = GetFT(srcImg);
}
Mat EnergySaliencyFT::GetFT(CMat &img3f)
{
CV_Assert(img3f.data != NULL && img3f.type() == CV_32FC3);
Mat sal(img3f.size(), CV_32F), tImg;
GaussianBlur(img3f, tImg, Size(3, 3), 0);
cvtColor(tImg, tImg, CV_BGR2Lab);
Scalar colorM = mean(tImg);
for (int r = 0; r < tImg.rows; r++) {
float *s = sal.ptr<float>(r);
float *lab = tImg.ptr<float>(r);
for (int c = 0; c < tImg.cols; c++, lab += 3)
s[c] = (float)(sqr(colorM[0] - lab[0]) + sqr(colorM[1] - lab[1]) + sqr(colorM[2] - lab[2]));
}
normalize(sal, sal, 0, 1, NORM_MINMAX);
return sal;
} | [
"[email protected]"
] | |
a8966d13c330c18e8a00ca7eb7889e4ebf116309 | a80b1d9c01a8ea225911d83c8765196a189a8ff0 | /ch02/ex2.5.cc | 106d39b9c693f2d6125a5217fba270c3dc2d199f | [] | no_license | maywuyi/cpp-primer | 66e920728f5cddb85727b179adf75dfff3a157c8 | fc7985445c3b2b691309fbf7579cb1a5202a7e13 | refs/heads/master | 2020-09-15T11:59:52.490325 | 2019-11-19T15:02:52 | 2019-11-19T15:02:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 195 | cc | #include <iostream>
using namespace std;
int main() {
auto v1 = 1.2L;
cout << typeid(v1).name() << endl; // long double
auto v2 = 1.2F;
cout << typeid(v2).name() << endl; // f
} | [
"[email protected]"
] | |
e6508e6b0405aed91fe9b9ee6b272fedff87a41f | 843bf30616705b5ce817d1a27cbace44b5f980e1 | /mooon/include/mooon/sys/pool_thread.h | aab67fcd0d2d37a0ac6065eb6c8d89cabcb576e1 | [] | no_license | eyjian/mooon | 971d7ffcae167cd67675d8e2262d13db0de18841 | 80e8e74c1b26f6ab41ce6df8f4e09e4f45d8b57c | refs/heads/master | 2022-02-01T22:12:18.055955 | 2021-12-23T10:41:44 | 2021-12-23T10:41:44 | 27,848,358 | 69 | 59 | null | null | null | null | UTF-8 | C++ | false | false | 4,121 | h | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: jian yi, [email protected]
*/
#ifndef MOOON_SYS_POOL_THREAD_H
#define MOOON_SYS_POOL_THREAD_H
#include "mooon/sys/event.h"
#include "mooon/sys/syscall_exception.h"
#include "mooon/sys/thread.h"
SYS_NAMESPACE_BEGIN
// 用于线程池的线程抽象基类
class CPoolThread: public CRefCountable
{
private:
friend class CPoolThreadHelper;
template <class ThreadClass> friend class CThreadPool;
class CPoolThreadHelper: public CThread
{
public:
CPoolThreadHelper(CPoolThread* pool_thread);
void millisleep(int milliseconds) throw (CSyscallException);
private:
virtual void run();
virtual void before_start() throw (utils::CException, CSyscallException);
virtual void before_stop() throw (utils::CException, CSyscallException);
private:
CPoolThread* _pool_thread;
};
protected: // 禁止直接创建CPoolThread的实例
CPoolThread() throw (utils::CException, CSyscallException);
virtual ~CPoolThread();
/***
* 毫秒级sleep,线程可以调用它进入睡眠状态,并且可以通过调用wakeup唤醒,
* 请注意只本线程可以调用此函数,其它线程调用无效
*/
void do_millisleep(int milliseconds) throw (CSyscallException);
private:
/***
* 线程执行体
*/
virtual void run() = 0;
/***
* 在run之前被调用
* @return 如果返回true,则会进入run,否则线程直接退出
*/
virtual bool before_run() throw () { return true; }
/***
* 在run之后被调用
*/
virtual void after_run() throw () { }
/***
* start执行前被调用
*/
virtual void before_start() throw (utils::CException, CSyscallException) {}
/***
* stop执行前可安插的动作
*/
virtual void before_stop() throw (utils::CException, CSyscallException) {}
/** 设置线程在池中的顺序号 */
void set_index(uint16_t index) { _index = index; }
public:
/** 设置参数,在before_start之前被回调 */
virtual void set_parameter(void* parameter) { }
public:
/***
* 唤醒池线程,池线程启动后,都会进入睡眠状态,
* 直接调用wakeup将它唤醒
*/
void wakeup() throw (CSyscallException);
/***
* 得到池线程在线程池中的序号,序号从0开始,
* 且连续,但总是小于线程个数值。
*/
uint16_t get_index() const throw () { return _index; }
/** 设置线程栈大小,应当在before_start中设置。
* @stack_size: 栈大小字节数
* @exception: 不抛出异常
*/
void set_stack_size(size_t stack_size) throw ();
/** 得到线程栈大小字节数
* @exception: 如果失败,则抛出CSyscallException异常
*/
size_t get_stack_size() const throw (CSyscallException);
/** 得到本线程号 */
uint32_t get_thread_id() const throw ();
private:
void start() throw (CSyscallException); /** 仅供CThreadPool调用 */
void stop() throw (CSyscallException); /** 仅供CThreadPool调用 */
private:
uint16_t _index; /** 池线程在池中的位置 */
CPoolThreadHelper* _pool_thread_helper;
};
SYS_NAMESPACE_END
#endif // MOOON_SYS_POOL_THREAD_H
| [
"[email protected]"
] | |
0ed2331bfe6beb97fc5beda17963eaf74a6ae70b | 1dbf007249acad6038d2aaa1751cbde7e7842c53 | /dds/include/huaweicloud/dds/v3/model/SwitchSlowlogDesensitizationResponse.h | 928c618c0ecb45c129c352479de58fa32cc53b03 | [] | permissive | huaweicloud/huaweicloud-sdk-cpp-v3 | 24fc8d93c922598376bdb7d009e12378dff5dd20 | 71674f4afbb0cd5950f880ec516cfabcde71afe4 | refs/heads/master | 2023-08-04T19:37:47.187698 | 2023-08-03T08:25:43 | 2023-08-03T08:25:43 | 324,328,641 | 11 | 10 | Apache-2.0 | 2021-06-24T07:25:26 | 2020-12-25T09:11:43 | C++ | UTF-8 | C++ | false | false | 1,218 | h |
#ifndef HUAWEICLOUD_SDK_DDS_V3_MODEL_SwitchSlowlogDesensitizationResponse_H_
#define HUAWEICLOUD_SDK_DDS_V3_MODEL_SwitchSlowlogDesensitizationResponse_H_
#include <huaweicloud/dds/v3/DdsExport.h>
#include <huaweicloud/core/utils/ModelBase.h>
#include <huaweicloud/core/http/HttpResponse.h>
namespace HuaweiCloud {
namespace Sdk {
namespace Dds {
namespace V3 {
namespace Model {
using namespace HuaweiCloud::Sdk::Core::Utils;
using namespace HuaweiCloud::Sdk::Core::Http;
/// <summary>
/// Response Object
/// </summary>
class HUAWEICLOUD_DDS_V3_EXPORT SwitchSlowlogDesensitizationResponse
: public ModelBase, public HttpResponse
{
public:
SwitchSlowlogDesensitizationResponse();
virtual ~SwitchSlowlogDesensitizationResponse();
/////////////////////////////////////////////
/// ModelBase overrides
void validate() override;
web::json::value toJson() const override;
bool fromJson(const web::json::value& json) override;
/////////////////////////////////////////////
/// SwitchSlowlogDesensitizationResponse members
protected:
#ifdef RTTR_FLAG
RTTR_ENABLE()
#endif
};
}
}
}
}
}
#endif // HUAWEICLOUD_SDK_DDS_V3_MODEL_SwitchSlowlogDesensitizationResponse_H_
| [
"[email protected]"
] | |
6072b2d2466e3926f970aaf126ce7437b4389ae2 | d2244dc530ce05ebc8d8e654c4bcf0dae991e78b | /android_art-xposed-lollipop-mr1/compiler/llvm/utils_llvm.h | df8fc443e9bcf77f3cc9311c3f7f270188d309e5 | [
"NCSA",
"Apache-2.0"
] | permissive | java007hf/Dynamicloader | 6fe4b1de14de751247ecd1b9bda499e100f4ec75 | 474427de20057b9c890622bb168810a990591573 | refs/heads/master | 2021-09-05T21:19:30.482850 | 2018-01-31T03:10:39 | 2018-01-31T03:10:39 | 119,626,890 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,008 | h | /*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ART_COMPILER_LLVM_UTILS_LLVM_H_
#define ART_COMPILER_LLVM_UTILS_LLVM_H_
#include <llvm/Analysis/Verifier.h>
namespace art {
#ifndef NDEBUG
#define VERIFY_LLVM_FUNCTION(func) ::llvm::verifyFunction(func, ::llvm::AbortProcessAction)
#else
#define VERIFY_LLVM_FUNCTION(func)
#endif
} // namespace art
#endif // ART_COMPILER_LLVM_UTILS_LLVM_H_
| [
"[email protected]"
] | |
01d613ec5001212a16ff72ddce7a25c776769b7e | 364e81cb0c01136ac179ff42e33b2449c491b7e5 | /spell/branches/2.0/include/SPELL_WS/SPELLwsInstanceDataHandler.H | e64e37de41e1124914f3f0dcb6600af711d55c8c | [] | no_license | unnch/spell-sat | 2b06d9ed62b002e02d219bd0784f0a6477e365b4 | fb11a6800316b93e22ee8c777fe4733032004a4a | refs/heads/master | 2021-01-23T11:49:25.452995 | 2014-10-14T13:04:18 | 2014-10-14T13:04:18 | 42,499,379 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,854 | h | // ################################################################################
// FILE : SPELLwsInstanceDataHandler.H
// DATE : Mar 17, 2011
// PROJECT : SPELL
// DESCRIPTION: WS data handler for instances
// --------------------------------------------------------------------------------
//
// Copyright (C) 2008, 2011 SES ENGINEERING, Luxembourg S.A.R.L.
//
// This file is part of SPELL.
//
// SPELL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// SPELL 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 SPELL. If not, see <http://www.gnu.org/licenses/>.
//
// ################################################################################
#ifndef __SPELL_WS_INSTANCE_DATAHANDLER_H__
#define __SPELL_WS_INSTANCE_DATAHANDLER_H__
// FILES TO INCLUDE ////////////////////////////////////////////////////////
// Local includes ----------------------------------------------------------
#include "SPELL_WS/SPELLwsObjectDataHandler.H"
// Project includes --------------------------------------------------------
// System includes ---------------------------------------------------------
/** \addtogroup SPELL_WS */
/*@{*/
// FORWARD REFERENCES //////////////////////////////////////////////////////
// ENUMS ///////////////////////////////////////////////////////////////////
// TYPES ///////////////////////////////////////////////////////////////////
// DEFINES /////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/**
** \brief Data handler for Python instance objects
**
** \par Description and usage:
**
** Data handlers are classes that deal with Python object read/write
** and serialization processes, used for writing or reading ws files.
**
**////////////////////////////////////////////////////////////////////////////
class SPELLwsInstanceDataHandler : public SPELLwsObjectDataHandler
{
public: //--------------------------------------------------------------------
// EXCEPTIONS ////////////////////////////////////////////////////////////
// ENUMS /////////////////////////////////////////////////////////////////
// TYPES /////////////////////////////////////////////////////////////////
// LIFECYCLE /////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
/** Constructor.
*
* \param object IN: the associated Python object (class)
**////////////////////////////////////////////////////////////////////
SPELLwsInstanceDataHandler( PyObject* object );
//////////////////////////////////////////////////////////////////////
/** Destructor.
**////////////////////////////////////////////////////////////////////
virtual ~SPELLwsInstanceDataHandler();
// METHODS ///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
/** \see SPELLwsObjectDataHandler.
**////////////////////////////////////////////////////////////////////
void write();
//////////////////////////////////////////////////////////////////////
/** \see SPELLwsObjectDataHandler.
**////////////////////////////////////////////////////////////////////
void read();
protected: //-----------------------------------------------------------------
// EXCEPTIONS ////////////////////////////////////////////////////////////
// ENUMS /////////////////////////////////////////////////////////////////
// TYPES /////////////////////////////////////////////////////////////////
// LIFECYCLE /////////////////////////////////////////////////////////////
// METHODS ///////////////////////////////////////////////////////////////
// DATA MEMBERS //////////////////////////////////////////////////////////
private: /////////////////////////////////////////////////////////////////////
// EXCEPTIONS ////////////////////////////////////////////////////////////
// ENUMS /////////////////////////////////////////////////////////////////
// TYPES /////////////////////////////////////////////////////////////////
// LIFECYCLE /////////////////////////////////////////////////////////////
// METHODS ///////////////////////////////////////////////////////////////
// DATA MEMBERS //////////////////////////////////////////////////////////
};
/*@}*/
#endif
| [
"rafael.chinchilla@b4576358-0e6a-c6b8-6e87-62523fae65e4"
] | rafael.chinchilla@b4576358-0e6a-c6b8-6e87-62523fae65e4 |
257d821e015dd4f422ffa0b78d98a4c7bb0ff47a | eee540bbf66c5cef562f8e4d52d0d6b48346aaad | /Cpp_Primer/5rd/0302/mutex_lock/MutexLock.h | 41683ad2d8e5d13288295f4a891eafcaad4238e0 | [
"MIT"
] | permissive | honeytavis/cpp | 6ae9917854b7dfad7e6657021731a6e405b7f7ec | 232cb0add3f5b481b62a9a23d086514e2c425279 | refs/heads/master | 2021-01-10T10:04:04.277433 | 2016-10-13T06:23:45 | 2016-10-13T06:23:45 | 51,231,814 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 181 | h | #ifndef MUTEXLOCK_H
#define MUTEXLOCK_H
class MutexLock {
public:
MutexLock();
~MutexLock();
void lock();
void unlock();
private:
pthread_mutex_t mutex_;
};
#endif
| [
"email"
] | email |
8a87db5a4d47d1a484bd09e3463c230551531f78 | 90517ce1375e290f539748716fb8ef02aa60823b | /solved/l-n/modex/modex.cpp | 754d59aad04b1b07ad566fbc26ee8a5c48cd46d3 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | Code4fun4ever/pc-code | 23e4b677cffa57c758deeb655fd4f71b36807281 | 77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90 | refs/heads/master | 2021-01-15T08:15:00.681534 | 2014-09-08T05:28:39 | 2014-09-08T05:28:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 366 | cpp | #include <cstdio>
typedef long long i64;
int x, y, n;
int mod_pow(int _b, i64 e, int m) {
i64 res = 1;
for (i64 b=_b; e; e >>= 1, b = b*b%m) if (e & 1) res = res*b%m;
return res;
}
int main()
{
int c;
scanf("%d", &c);
while (c--) {
scanf("%d%d%d", &x, &y, &n);
printf("%d\n", mod_pow(x, y, n));
}
return 0;
}
| [
"[email protected]"
] | |
b84e3d244ba56e03e13335bd88c3c3b09a0e5277 | 3ef99240a541f699d71d676db514a4f3001b0c4b | /UVa Online Judge/v115/11597.cc | e0acdc55251d7c7b8ee5dd3c5733f4f948b2b7f2 | [
"MIT"
] | permissive | mjenrungrot/competitive_programming | 36bfdc0e573ea2f8656b66403c15e46044b9818a | e0e8174eb133ba20931c2c7f5c67732e4cb2b703 | refs/heads/master | 2022-03-26T04:44:50.396871 | 2022-02-10T11:44:13 | 2022-02-10T11:44:13 | 46,323,679 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,219 | cc | /*=============================================================================
# Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/
# FileName: 11597.cc
# Description: UVa Online Judge - 11597
=============================================================================*/
#include <bits/stdc++.h>
#pragma GCC optimizer("Ofast")
#pragma GCC target("avx2")
using namespace std;
typedef pair<int, int> ii;
typedef pair<long long, long long> ll;
typedef pair<double, double> dd;
typedef tuple<int, int, int> iii;
typedef tuple<long long, long long, long long> lll;
typedef tuple<double, double, double> ddd;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<dd> vdd;
// Debug Snippets
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char* x) { cerr << '\"' << x << '\"'; }
void __print(const string& x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V>& x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template <typename T>
void __print(const T& x) {
int f = 0;
cerr << '{';
for (auto& i : x) cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
__print(t);
if (sizeof...(v)) cerr << ", ";
_print(v...);
}
#define debug(x...) \
cerr << "[" << #x << "] = ["; \
_print(x)
template <class Ch, class Tr, class Container>
basic_ostream<Ch, Tr>& operator<<(basic_ostream<Ch, Tr>& os,
Container const& x) {
os << "{ ";
for (auto& y : x) os << y << " ";
return os << "}";
}
template <class X, class Y>
ostream& operator<<(ostream& os, pair<X, Y> const& p) {
return os << "[ " << p.first << ", " << p.second << "]";
}
// End Debug Snippets
vs split(string line) {
vs output;
istringstream iss(line);
string tmp;
while (iss >> tmp) {
output.push_back(tmp);
}
return output;
}
vs split(string line, regex re) {
vs output;
sregex_token_iterator it(line.begin(), line.end(), re, -1), it_end;
while (it != it_end) {
output.push_back(it->str());
it++;
}
return output;
}
const int INF_INT = 1e9 + 7;
const long long INF_LL = 1e18;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, n_test = 0;
while (cin >> N) {
if (N == 0) break;
cout << "Case " << ++n_test << ": " << N / 2 << endl;
}
return 0;
} | [
""
] | |
5f4c8aae5530e934817fc06529a6a96ca46300ab | b5858212d27a6c5dafdfdeac5e086e9f9c368652 | /C01/ex05/Brain.cpp | f397cd7f5fcc734ef39d01a8d88c090a58e10535 | [] | no_license | Eredion/42-CPP | fa1b2f709df298cab2566b7cbb8744efe2884772 | 896ef288a55aaa42ed3686b86d1426224e0ab101 | refs/heads/master | 2021-04-02T14:34:42.085625 | 2020-08-25T09:42:39 | 2020-08-25T09:42:39 | 248,285,679 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 188 | cpp | #include "Brain.hpp"
Brain::Brain()
{
std::stringstream str;
str << this;
ptr = str.str();
}
std::string Brain::identify()
{
return(this->ptr);
}
Brain::~Brain()
{
return ;
}
| [
"[email protected]"
] | |
23132a654a4ac09e4b549432f114d2199d99f1b2 | 4a4f8d670e727fff8dbcf1166bf8e0eba47d5ad8 | /DHT11_test/DHT11_test/DHT11_test.ino | af7ee8e04a270291d016d257fa901fce5a2b9d75 | [] | no_license | JiekangHuang/Arduino | 9278c3f52e54826a8cab65227032c66c5b582470 | 496ebb76e3ee55c8302b50a62c3c99c9095362e6 | refs/heads/master | 2020-05-18T11:38:43.170904 | 2019-12-28T01:16:40 | 2019-12-28T01:16:40 | 184,381,377 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 527 | ino | <<<<<<< HEAD
void setup()
{
=======
#include "DHT/dht.h"
#define dht_pin 8
dht DHT;
void setup()
{
Serial.begin(9600);
delay(500);
Serial.print("***Electropeak***\n\n");
>>>>>>> 534b9e43658fd8682ac836b7f7f72ac293c9a799
}
void loop()
{
<<<<<<< HEAD
=======
DHT.read11(dht_pin);
Serial.print("humidity = ");
Serial.print(DHT.humidity);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(DHT.temperature);
Serial.println("C ");
delay(3000);
>>>>>>> 534b9e43658fd8682ac836b7f7f72ac293c9a799
} | [
"[email protected]"
] | |
514497495702bdb4418ebe4ea420d0ea522929c9 | d27dd4a3a77876701db816589108f8a9be72d73e | /prehmm.cpp | 248426d5115e2b827362757dee2cb51773179a60 | [] | no_license | hkxIron/ch_segment | 79459a7141bf3776f6304ee6e8fecf9817610d4e | 9a08e7fa39df79555926d6048710c8e9193f3244 | refs/heads/master | 2020-03-23T03:36:48.068935 | 2018-07-13T21:03:05 | 2018-07-13T21:03:05 | 141,039,476 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,912 | cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <map>
#include "util.h"
using namespace std;
/*
* 函数功能:将训练语料和测试语料中出现的汉字进行编码,将他们的对应关系存入文件
* 格式为:汉字-编码,编码从0开始
* 函数输入:infile_1 训练语料文件名
* infile_2 测试语料文件名
* outfile 指定的输出文件名
* 函数输出:名为outfile的文件
*/
void makeDB(string infile_1, string infile_2, string outfile){
//读取输入文件
ifstream fin_1(infile_1.c_str());
ifstream fin_2(infile_2.c_str());
if(!(fin_1 && fin_2)){
cerr << "makeDB : Open input file fail !" << endl;
exit(-1);
}
//打开输出文件
ofstream fout(outfile.c_str());
if(!fout){
cerr << "makeDB : Open output file fail !" << endl;
exit(-1);
}
map<string, int> map_cchar;
int id = -1;
string line = "";
string cchar = "";
//读取输入文件内容
while(getline(fin_1, line)){
line = replace_all(line, "/", "");
if(line.size() >= 3){
//逐字读取
for(int i = 0; i < line.size() - 2; i += 3){
cchar = line.substr(i, 3);
if(map_cchar.find(cchar) == map_cchar.end()){
++id;
map_cchar[cchar] = id;
}
}
}
}
while(getline(fin_2, line)){
line = replace_all(line, "/", "");
if(line.size() >= 3){
//逐字读取
for(int i = 0; i < line.size() - 2; i += 3){
cchar = line.substr(i, 3);
if(map_cchar.find(cchar) == map_cchar.end()){
++id;
map_cchar[cchar] = id;
}
}
}
}
//输出到文件
map<string, int>::iterator iter;
for(iter = map_cchar.begin(); iter != map_cchar.end(); ++iter){
//cout << iter -> first << " " << iter -> second << endl;
fout << iter -> first << " " << iter -> second << endl;
}
fin_1.close();
fin_2.close();
fout.close();
}
/*
* 函数功能:将训练语料每个汉字后面加入对应的BMES状态
* 函数输入:infile 训练语料文件名
* outfile 指定的输出文件名
* 函数输出:名为outfile的文件
*/
void makeBMES(string infile, string outfile){
ifstream fin(infile.c_str());
ofstream fout(outfile.c_str());
if(!(fin && fout)){
cerr << "makeBMES : Open file failed !" << endl;
exit(-1);
}
string word_in = "";
string word_out = "";
string line_in = "";
string line_out = "";
while(getline(fin, line_in)){
if(line_in.size() >= 3){
line_out.clear();
line_in = replace_all(line_in, "/", " ");
istringstream strstm(line_in);
while(strstm >> word_in){
word_out.clear();
if(word_in.size()%3 != 0){
cout << "单词不符合要求:" << word_in << endl;
continue;
}
int num = word_in.size()/3; //单词中包含多少个汉字
if(num == 0){
continue;
}
if(num == 1){
word_out = word_in;
word_out += "/S";
}else{
//复制单词中的第一个字
word_out.insert(word_out.size(), word_in, 0, 3);
word_out += "/B";
//逐个复制单词中间的字
for(int i = 1; i < num - 1; i++){
word_out.insert(word_out.size(), word_in, 3*i, 3);
word_out += "/M";
}
//复制单词中最后的汉字
word_out.insert(word_out.size(), word_in, 3*num - 3, 3);
word_out += "/E";
}
line_out += word_out;
}
fout << line_out << endl;
}
}
}
/*
* 主函数
*/
int main(int argc, char *argv[]){
if(argc < 5){
cout << "Usage: " << argv[0] << " train_file test_file db_file bmes_file" << endl;
exit(-1);
}
//构造DB文件,输入训练语料、测试语料、输出文件名
makeDB(argv[1], argv[2], argv[3]);
//构造BMES文件,输入训练语料、输出文件名
makeBMES(argv[1], argv[4]);
}
| [
"[email protected]"
] | |
6bdeac09172f06d4dc0dcf5a83cc3ed2497c9bb1 | 5223c7b017c300761d12848fa35877a65792f990 | /TRI_21.CPP | 4c47208a036d127caad8b802cd158d25d8639cff | [] | no_license | adarshspatel/CPPProgramming | 06541af949a1a6bf3168ad7a9b68d86efc0b1d88 | 5bedfb3f72b4cb450ef021200c6a705aaae1be39 | refs/heads/master | 2023-05-29T14:39:48.512195 | 2023-05-12T14:17:31 | 2023-05-12T14:17:31 | 163,592,845 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 283 | cpp | //Written by Adarsh Patel
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int n,i,j,l,k=1;
printf("Enter Number of Rows : ");
scanf("%d",&n);
for(i=n;i>=1;i--)
{
for(l=1,k=i;l<=n-i+1;l++)
{
printf("%3d",k);
k++;
}
printf("\n");
}
getch();
}
| [
"[email protected]"
] | |
ffa1297d020b56966a72a4c145412104f6a1560d | 78918391a7809832dc486f68b90455c72e95cdda | /boost_lib/boost/xpressive/detail/core/sub_match_vector.hpp | 4049b739d529d68928b281d3cabdfa5f41acaac2 | [
"MIT"
] | permissive | kyx0r/FA_Patcher | 50681e3e8bb04745bba44a71b5fd04e1004c3845 | 3f539686955249004b4483001a9e49e63c4856ff | refs/heads/master | 2022-03-28T10:03:28.419352 | 2020-01-02T09:16:30 | 2020-01-02T09:16:30 | 141,066,396 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,829 | hpp | ///////////////////////////////////////////////////////////////////////////////
// sub_match_vector.hpp
//
// Copyright 2008 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_XPRESSIVE_DETAIL_CORE_SUB_MATCH_VECTOR_HPP_EAN_10_04_2005
#define BOOST_XPRESSIVE_DETAIL_CORE_SUB_MATCH_VECTOR_HPP_EAN_10_04_2005
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/noncopyable.hpp>
#include <boost/iterator_adaptors.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/core/sub_match_impl.hpp>
namespace boost
{
namespace xpressive
{
namespace detail
{
#if BOOST_ITERATOR_ADAPTORS_VERSION >= 0x0200
//////////////////////////////////////////////////////////////////////////
// sub_match_iterator
//
template<typename Value, typename MainIter>
struct sub_match_iterator
: iterator_adaptor
<
sub_match_iterator<Value, MainIter>
, MainIter
, Value
, std::random_access_iterator_tag
>
{
typedef iterator_adaptor
<
sub_match_iterator<Value, MainIter>
, MainIter
, Value
, std::random_access_iterator_tag
> base_t;
sub_match_iterator(MainIter baseiter)
: base_t(baseiter)
{
}
};
#endif
//////////////////////////////////////////////////////////////////////////
// sub_match_vector
//
template<typename BidiIter>
struct sub_match_vector
: private noncopyable
{
private:
struct dummy
{
int i_;
};
typedef int dummy::*bool_type;
public:
typedef sub_match<BidiIter> value_type;
typedef std::size_t size_type;
typedef value_type const &const_reference;
typedef const_reference reference;
typedef typename iterator_difference<BidiIter>::type difference_type;
typedef typename iterator_value<BidiIter>::type char_type;
typedef typename sub_match<BidiIter>::string_type string_type;
#if BOOST_ITERATOR_ADAPTORS_VERSION >= 0x0200
typedef sub_match_iterator
<
value_type const
, sub_match_impl<BidiIter> const *
> const_iterator;
#else
typedef iterator_adaptor
<
sub_match_impl<BidiIter> const *
, default_iterator_policies
, value_type
, value_type const &
, value_type const *
> const_iterator;
#endif // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
typedef const_iterator iterator;
sub_match_vector()
: size_(0)
, sub_matches_(0)
{
}
const_reference operator [](size_type index) const
{
static value_type const s_null;
return (index >= this->size_)
? s_null
: *static_cast<value_type const *>(&this->sub_matches_[ index ]);
}
size_type size() const
{
return this->size_;
}
bool empty() const
{
return 0 == this->size();
}
const_iterator begin() const
{
return const_iterator(this->sub_matches_);
}
const_iterator end() const
{
return const_iterator(this->sub_matches_ + this->size_);
}
operator bool_type() const
{
return (!this->empty() && (*this)[0].matched) ? &dummy::i_ : 0;
}
bool operator !() const
{
return this->empty() || !(*this)[0].matched;
}
void swap(sub_match_vector<BidiIter> &that)
{
std::swap(this->size_, that.size_);
std::swap(this->sub_matches_, that.sub_matches_);
}
private:
friend struct detail::core_access<BidiIter>;
void init_(sub_match_impl<BidiIter> *sub_matches, size_type size)
{
this->size_ = size;
this->sub_matches_ = sub_matches;
}
void init_(sub_match_impl<BidiIter> *sub_matches, size_type size, sub_match_vector<BidiIter> const &that)
{
BOOST_ASSERT(size == that.size_);
this->size_ = size;
this->sub_matches_ = sub_matches;
std::copy(that.sub_matches_, that.sub_matches_ + that.size_, this->sub_matches_);
}
size_type size_;
sub_match_impl<BidiIter> *sub_matches_;
};
}
}
} // namespace boost::xpressive::detail
#endif
| [
"[email protected]"
] | |
96812d607f353c263fa78ac623b9bbfced95f5c0 | 5838cf8f133a62df151ed12a5f928a43c11772ed | /NT/multimedia/directx/dxg/ref8/common/refdev.cpp | 0d0fcb2d34244a25850d88d0473c51972311f303 | [] | no_license | proaholic/Win2K3 | e5e17b2262f8a2e9590d3fd7a201da19771eb132 | 572f0250d5825e7b80920b6610c22c5b9baaa3aa | refs/heads/master | 2023-07-09T06:15:54.474432 | 2021-08-11T09:09:14 | 2021-08-11T09:09:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 33,788 | cpp | ///////////////////////////////////////////////////////////////////////////////
// Copyright (C) Microsoft Corporation, 2000.
//
// refdev.cpp
//
// Direct3D Reference Device - public interfaces
//
///////////////////////////////////////////////////////////////////////////////
#include "pch.cpp"
#pragma hdrstop
// This is a global static array of the block sizes in bytes for the
// various DXTn compression formats
int g_DXTBlkSize[NUM_DXT_FORMATS] =
{
sizeof(DXTBlockRGB),
sizeof(DXTBlockAlpha4),
sizeof(DXTBlockAlpha4),
sizeof(DXTBlockAlpha3),
sizeof(DXTBlockAlpha3),
};
//-----------------------------------------------------------------------------
//
// Memory management function installation
//
//-----------------------------------------------------------------------------
// global pointers to memory allocation functions (used through MEM* macros)
LPVOID (__cdecl *g_pfnMemAlloc)( size_t size ) = NULL;
void (__cdecl *g_pfnMemFree)( LPVOID lptr ) = NULL;
LPVOID (__cdecl *g_pfnMemReAlloc)( LPVOID ptr, size_t size ) = NULL;
// install memory management functions - must be called before instancing
// rasterizer object
void RefRastSetMemif(
LPVOID(__cdecl *pfnMemAlloc)(size_t),
void(__cdecl *pfnMemFree)(LPVOID),
LPVOID(__cdecl *pfnMemReAlloc)(LPVOID,size_t))
{
DPFRR(1, "RefRastSetMemif %08x %08x %08x\n",
pfnMemAlloc,pfnMemFree,pfnMemReAlloc);
g_pfnMemAlloc = pfnMemAlloc;
g_pfnMemFree = pfnMemFree;
g_pfnMemReAlloc = pfnMemReAlloc;
}
///////////////////////////////////////////////////////////////////////////////
// //
// Public Interface Methods //
// //
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// SetRenderTarget -
//
//-----------------------------------------------------------------------------
void
RefDev::SetRenderTarget( RDRenderTarget* pRenderTarget )
{
m_pRenderTarget = pRenderTarget;
// update the W scaling values for mapping interpolated W's into buffer range
m_fWBufferNorm[0] = pRenderTarget->m_fWRange[0];
FLOAT fWRange = pRenderTarget->m_fWRange[1] - pRenderTarget->m_fWRange[0];
m_fWBufferNorm[1] = ( 0. != fWRange ) ? ( 1./fWRange ) : ( 1. );
}
//-----------------------------------------------------------------------------
//
// SetTextureStageState -
//
//-----------------------------------------------------------------------------
// map DX6(&7) texture filtering enums to DX8 enums
static DWORD
MapDX6toDX8TexFilter( DWORD dwStageState, DWORD dwValue )
{
switch (dwStageState)
{
case D3DTSS_MAGFILTER:
switch (dwValue)
{
case D3DTFG_POINT : return D3DTEXF_POINT;
case D3DTFG_LINEAR : return D3DTEXF_LINEAR;
case D3DTFG_FLATCUBIC : return D3DTEXF_FLATCUBIC;
case D3DTFG_GAUSSIANCUBIC : return D3DTEXF_GAUSSIANCUBIC;
case D3DTFG_ANISOTROPIC : return D3DTEXF_ANISOTROPIC;
}
break;
case D3DTSS_MINFILTER:
switch (dwValue)
{
case D3DTFN_POINT : return D3DTEXF_POINT;
case D3DTFN_LINEAR : return D3DTEXF_LINEAR;
case D3DTFN_ANISOTROPIC : return D3DTEXF_ANISOTROPIC;
}
break;
case D3DTSS_MIPFILTER:
switch (dwValue)
{
case D3DTFP_NONE : return D3DTEXF_NONE;
case D3DTFP_POINT : return D3DTEXF_POINT;
case D3DTFP_LINEAR : return D3DTEXF_LINEAR;
}
break;
}
return 0x0;
}
void
RefDev::SetTextureStageState(
DWORD dwStage, DWORD dwStageState, DWORD dwValue )
{
// check for range before continuing
if ( dwStage >= D3DHAL_TSS_MAXSTAGES)
{
return;
}
if (dwStageState > D3DTSS_MAX)
{
return;
}
// set in internal per-stage state
m_TextureStageState[dwStage].m_dwVal[dwStageState] = dwValue;
m_dwRastFlags |= RDRF_TEXTURESTAGESTATE_CHANGED;
switch ( dwStageState )
{
case D3DTSS_TEXTUREMAP:
// bind texture indicated by handle to m_pTexture array
if (IsDriverDX6AndBefore() || IsInterfaceDX6AndBefore())
{
// This is the legacy behavior (prev. to DX7)
MapTextureHandleToDevice( dwStage );
}
else
{
// This is the new behavior (DX7 and beyond)
SetTextureHandle( dwStage, dwValue );
}
m_dwRastFlags |= RDRF_LEGACYPIXELSHADER_CHANGED;
break;
case D3DTSS_COLOROP:
m_dwRastFlags |= RDRF_LEGACYPIXELSHADER_CHANGED;
break;
// not including legacy headers, so don't have D3DTSS_ADDRESS
// case D3DTSS_ADDRESS:
// // map single set ADDRESS to U, V controls (pre-DX8 interfaces only)
// m_TextureStageState[dwStage].m_dwVal[D3DTSS_ADDRESSU] = dwValue;
// m_TextureStageState[dwStage].m_dwVal[D3DTSS_ADDRESSV] = dwValue;
// break;
case D3DTSS_MAGFILTER:
case D3DTSS_MINFILTER:
case D3DTSS_MIPFILTER:
if ( IsDriverDX7AndBefore() )
{
m_TextureStageState[dwStage].m_dwVal[dwStageState]
= MapDX6toDX8TexFilter( dwStageState, dwValue );
}
break;
}
}
//-----------------------------------------------------------------------------
//
// TextureCreate - Instantiates new RDSurface2D object, computes texture handle
// to associate with it, and returns both to caller. Note that texture handle
// is a pointer and can be used to get at the corresponding texture object.
//
//-----------------------------------------------------------------------------
BOOL
RefDev::TextureCreate(
LPD3DTEXTUREHANDLE phTex, RDSurface2D** ppTex )
{
// allocate internal texture structure
*ppTex = new RDSurface2D();
_ASSERTa( NULL != *ppTex, "new failure on texture create", return FALSE; );
// use separately allocated pointer for handle
RDSurface2D** ppTexForHandle = (RDSurface2D**)MEMALLOC( sizeof(RDSurface2D*) );
_ASSERTa( NULL != ppTexForHandle, "malloc failure on texture create", return FALSE; );
*ppTexForHandle = *ppTex;
// return texture handle
(*ppTex)->m_hTex = (ULONG_PTR)ppTexForHandle;
*phTex = (*ppTex)->m_hTex;
return TRUE;
}
//-----------------------------------------------------------------------------
//
// TextureDestroy -
//
//-----------------------------------------------------------------------------
BOOL
RefDev::TextureDestroy( D3DTEXTUREHANDLE hTex )
{
// first check if texture about to be destroyed is mapped - if so then
// unmap it
for ( int iStage=0; iStage<D3DHAL_TSS_MAXSTAGES; iStage++ )
{
if ( hTex == m_TextureStageState[iStage].m_dwVal[D3DTSS_TEXTUREMAP] )
{
SetTextureStageState( iStage, D3DTSS_TEXTUREMAP, 0x0 );
}
}
// resolve handle to RDSurface2D pointer
RDSurface2D* pTex = MapHandleToTexture( hTex );
if ( NULL == pTex ) { return FALSE; }
// free the handle pointer
#ifdef _IA64_
_ASSERTa(FALSE, "This will not work on IA64", return FALSE;);
#endif
RDSurface2D** ppTex = (RDSurface2D**)ULongToPtr(hTex);
if ( NULL != ppTex) { MEMFREE( ppTex ); }
// free the RDSurface2D
delete pTex;
return TRUE;
}
//-----------------------------------------------------------------------------
//
// TextureGetSurf -
//
//-----------------------------------------------------------------------------
DWORD
RefDev::TextureGetSurf( D3DTEXTUREHANDLE hTex )
{
RDSurface2D* pTex = MapHandleToTexture(hTex);
if ( NULL == pTex ) { return 0x0; }
return PtrToUlong( pTex->m_pDDSLcl[0] );
}
//-----------------------------------------------------------------------------
//
// GetCurrentTextureMaps - This function fills in a passed array texture handles
// and pointers. The array should be sized by D3DHAL_TSS_MAXSTAGES.
//
// This is used to facilitate external locking/unlocking of surfaces used for
// textures.
//
//-----------------------------------------------------------------------------
int
RefDev::GetCurrentTextureMaps(
D3DTEXTUREHANDLE *phTex, RDSurface2D** pTex)
{
UpdateActiveTexStageCount();
for ( int i=0; i<m_cActiveTextureStages; i++ )
{
if ( NULL == m_pTexture[i] )
{
phTex[i] = 0x0;
pTex[i] = NULL;
}
else
{
phTex[i] = m_pTexture[i]->m_hTex;
pTex[i] = m_pTexture[i];
}
}
return m_cActiveTextureStages;
}
//-----------------------------------------------------------------------------
//
// SceneCapture - Used to trigger fragment buffer resolve.
//
//-----------------------------------------------------------------------------
//#define DO_SCENE_RENDER_TIME
#ifdef DO_SCENE_RENDER_TIME
#include <mmsystem.h>
#endif
void
RefDev::SceneCapture( DWORD dwFlags )
{
static INT32 iScene = 0;
static INT32 iLastSceneEnd = 0;
#ifdef DO_SCENE_RENDER_TIME
static DWORD timeBS = 0;
#endif
switch (dwFlags)
{
case D3DHAL_SCENE_CAPTURE_START:
iScene++;
#ifdef DO_SCENE_RENDER_TIME
timeBS = timeGetTime();
#endif
break;
case D3DHAL_SCENE_CAPTURE_END:
if (iScene == iLastSceneEnd) break; // getting multiple END per BEGIN
iLastSceneEnd = iScene;
#ifdef DO_SCENE_RENDER_TIME
{
DWORD timeES = timeGetTime();
FLOAT dt = (FLOAT)(timeES - timeBS)/1000.f;
timeBS = 0;
RDDebugPrintf("SceneRenderTime: %f", dt );
}
#endif
break;
}
}
//-----------------------------------------------------------------------------
//
// Query functions to get pointer to current render target and render state.
//
//-----------------------------------------------------------------------------
RDRenderTarget*
RefDev::GetRenderTarget(void)
{
return m_pRenderTarget;
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
HRESULT
RefDev::UpdateRastState( void )
{
// check 'dirty' flags
if (m_dwRastFlags & RDRF_MULTISAMPLE_CHANGED)
{
// update multi-sample RS related state
m_Rast.SetSampleMode(
m_pRenderTarget->m_pColor->m_iSamples,
m_dwRenderState[D3DRS_MULTISAMPLEANTIALIAS] );
m_Rast.SetSampleMask(
m_dwRenderState[D3DRS_MULTISAMPLEMASK] );
m_dwRastFlags &= ~(RDRF_MULTISAMPLE_CHANGED);
}
if (m_dwRastFlags & RDRF_PIXELSHADER_CHANGED)
{
if (m_CurrentPShaderHandle)
{
m_Rast.m_pCurrentPixelShader =
GetPShader(m_CurrentPShaderHandle);
m_Rast.m_bLegacyPixelShade = FALSE;
}
else
{
// legacy pixel shader
m_Rast.UpdateLegacyPixelShader();
m_Rast.m_pCurrentPixelShader = m_Rast.m_pLegacyPixelShader;
m_Rast.m_bLegacyPixelShade = TRUE;
}
UpdateActiveTexStageCount();
m_dwRastFlags &= ~(RDRF_PIXELSHADER_CHANGED);
}
if (m_dwRastFlags & RDRF_LEGACYPIXELSHADER_CHANGED)
{
if (m_Rast.m_bLegacyPixelShade)
{
m_Rast.UpdateLegacyPixelShader();
m_Rast.m_pCurrentPixelShader = m_Rast.m_pLegacyPixelShader;
UpdateActiveTexStageCount();
}
m_dwRastFlags &= ~(RDRF_LEGACYPIXELSHADER_CHANGED);
}
if (m_dwRastFlags & RDRF_TEXTURESTAGESTATE_CHANGED)
{
m_Rast.UpdateTextureControls();
m_dwRastFlags &= ~(RDRF_TEXTURESTAGESTATE_CHANGED);
}
return S_OK;
}
//-----------------------------------------------------------------------------
//
// Begin/End bracket functions - Called before/after a list of primitives are
// rendered.
//
//-----------------------------------------------------------------------------
HRESULT
RefDev::BeginRendering( void )
{
// If already in Begin, do nothing
if( m_bInBegin ) return S_OK;
#ifdef _X86_
// save floating point mode and set to extended precision mode
{
WORD wTemp, wSave;
__asm
{
fstcw wSave
mov ax, wSave
or ax, 300h ;; extended precision mode
// and ax, 00FFh ;; single precision mode + round nearest or even
mov wTemp, ax
fldcw wTemp
}
m_wSaveFP = wSave;
}
#endif
m_bInBegin = TRUE;
return S_OK;
}
//-----------------------------------------------------------------------------
HRESULT
RefDev::EndRendering( void )
{
if ( m_bInBegin )
{
#ifdef _X86_
// restore floating point mode
{
WORD wSave = m_wSaveFP;
__asm {fldcw wSave}
}
#endif
m_bInBegin = FALSE;
}
return S_OK;
}
//-----------------------------------------------------------------------------
//
// Clear specified rectangles in the render target
// Directly handles the command from the DP2 stream
//
//-----------------------------------------------------------------------------
HRESULT RefDev::Clear(LPD3DHAL_DP2COMMAND pCmd)
{
D3DHAL_DP2CLEAR *pData = (D3DHAL_DP2CLEAR*)(pCmd + 1);
WORD i;
INT32 x,y;
RDColor fillColor(pData->dwFillColor);
RDDepth fillDepth;
if (m_pRenderTarget->m_pDepth)
{
fillDepth.SetSType(m_pRenderTarget->m_pDepth->GetSurfaceFormat());
}
fillDepth = pData->dvFillDepth;
struct
{
D3DHAL_DP2COMMAND cmd;
D3DHAL_DP2CLEAR data;
} WholeViewport;
if (!(pData->dwFlags & D3DCLEAR_COMPUTERECTS))
{
// Do nothing for non-pure device
}
else
if (pCmd->wStateCount == 0)
{
// When wStateCount is zero we need to clear whole viewport
WholeViewport.cmd = *pCmd;
WholeViewport.cmd.wStateCount = 1;
WholeViewport.data.dwFlags = pData->dwFlags;
WholeViewport.data.dwFillColor = pData->dwFillColor;
WholeViewport.data.dvFillDepth = pData->dvFillDepth;
WholeViewport.data.dwFillStencil = pData->dwFillStencil;
WholeViewport.data.Rects[0].left = m_Clipper.m_Viewport.dwX;
WholeViewport.data.Rects[0].top = m_Clipper.m_Viewport.dwY;
WholeViewport.data.Rects[0].right = m_Clipper.m_Viewport.dwX +
m_Clipper.m_Viewport.dwWidth;
WholeViewport.data.Rects[0].bottom = m_Clipper.m_Viewport.dwY +
m_Clipper.m_Viewport.dwHeight;
// Replace pointers and continue as usual
pCmd = (LPD3DHAL_DP2COMMAND)&WholeViewport;
pData = &WholeViewport.data;
}
else
{
// We need to cull all rects against the current viewport
UINT nRects = pCmd->wStateCount;
// Compute how much memory we need to process rects
UINT NeededSize = sizeof(D3DHAL_DP2COMMAND) +
sizeof(D3DHAL_DP2CLEAR) +
(nRects-1) * sizeof(RECT); // One rect is in DP2CLEAR
HRESULT hr = S_OK;
HR_RET(m_ClearRectBuffer.Grow(NeededSize));
RECT vwport; // Viewport rectangle to cull against
vwport.left = m_Clipper.m_Viewport.dwX;
vwport.top = m_Clipper.m_Viewport.dwY;
vwport.right = m_Clipper.m_Viewport.dwX + m_Clipper.m_Viewport.dwWidth;
vwport.bottom = m_Clipper.m_Viewport.dwY + m_Clipper.m_Viewport.dwHeight;
// Go through input rects and build output rect array
LPRECT pInputRects = pData->Rects;
LPRECT pOutputRects = (LPRECT)(&m_ClearRectBuffer[0] +
sizeof(D3DHAL_DP2COMMAND) +
sizeof(D3DHAL_DP2CLEAR) -
sizeof(RECT));
UINT nOutputRects = 0;
for (UINT i = 0; i < nRects; i++)
{
if (IntersectRect(&pOutputRects[nOutputRects], &vwport,
&pInputRects[i]))
{
nOutputRects++;
}
}
if (nOutputRects == 0)
return S_OK;
// Now replace pCmd and pData pointers and continue as usual
LPD3DHAL_DP2CLEAR pOldData = pData;
LPD3DHAL_DP2COMMAND pOldCmd = pCmd;
pCmd = (LPD3DHAL_DP2COMMAND)&m_ClearRectBuffer[0];
pData = (D3DHAL_DP2CLEAR*)(pCmd + 1);
*pCmd = *pOldCmd;
pCmd->wStateCount = (WORD)nOutputRects;
pData->dwFlags = pOldData->dwFlags;
pData->dwFillColor = pOldData->dwFillColor;
pData->dvFillDepth = pOldData->dvFillDepth;
pData->dwFillStencil = pOldData->dwFillStencil;
}
#ifdef _X86_
// Float to integer conversion routines for 24+ bit buffers work
// only with extended FPU mode.
//
WORD wSaveFP;
// save floating point mode and set to extended precision mode
{
WORD wTemp, wSave;
__asm
{
fstcw wSaveFP
mov ax, wSaveFP
or ax, 300h ;; extended precision mode
mov wTemp, ax
fldcw wTemp
}
}
#endif
if(pData->dwFlags & D3DCLEAR_TARGET)
{
if (m_dwRenderState[D3DRENDERSTATE_DITHERENABLE] == FALSE)
{
m_pRenderTarget->Clear(fillColor, pCmd);
}
else
{
for (i = 0; i < pCmd->wStateCount; i++)
{
for (y = pData->Rects[i].top; y < pData->Rects[i].bottom; ++y)
{
for (x = pData->Rects[i].left; x < pData->Rects[i].right; ++x)
{
m_pRenderTarget->WritePixelColor(x, y, fillColor, TRUE);
}
}
}
}
}
switch (pData->dwFlags & (D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL))
{
case (D3DCLEAR_ZBUFFER):
m_pRenderTarget->ClearDepth(fillDepth, pCmd);
break;
case (D3DCLEAR_STENCIL):
m_pRenderTarget->ClearStencil(pData->dwFillStencil, pCmd);
break;
case (D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL):
m_pRenderTarget->ClearDepthStencil(fillDepth, pData->dwFillStencil, pCmd);
break;
}
#ifdef _X86_
// restore floating point mode
{
__asm {fldcw wSaveFP}
}
#endif
return D3D_OK;
}
//-----------------------------------------------------------------------------
//
// Clear specified rectangles in the render target
// Directly handles the command from the DP2 stream
//
//-----------------------------------------------------------------------------
void RDRenderTarget::Clear(RDColor fillColor, LPD3DHAL_DP2COMMAND pCmd)
{
LPD3DHAL_DP2CLEAR pData = (LPD3DHAL_DP2CLEAR)(pCmd + 1);
UINT32 dwColor = 0;
fillColor.ConvertTo( m_pColor->GetSurfaceFormat(), 0.5f, (char*)&dwColor);
for (DWORD i = 0; i < pCmd->wStateCount; i++)
{
DWORD x0 = pData->Rects[i].left;
DWORD y0 = pData->Rects[i].top;
DWORD dwWidth = ( pData->Rects[i].right - x0 ) * m_pColor->GetSamples();
DWORD dwHeight = pData->Rects[i].bottom - y0;
char* pSurface = PixelAddress( x0, y0, 0, 0, m_pColor );
switch ( m_pColor->GetSurfaceFormat() )
{
case RD_SF_B8G8R8A8:
case RD_SF_B8G8R8X8:
{
for (DWORD y = dwHeight; y > 0; y--)
{
UINT32 *p = (UINT32*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p++ = dwColor;
}
pSurface += m_pColor->GetPitch();
}
}
break;
case RD_SF_B8G8R8:
{
for (DWORD y = dwHeight; y > 0; y--)
{
UINT8 *p = (UINT8*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p++ = ((UINT8*)&dwColor)[0];
*p++ = ((UINT8*)&dwColor)[1];
*p++ = ((UINT8*)&dwColor)[2];
}
pSurface += m_pColor->GetPitch();
}
}
break;
case RD_SF_B4G4R4A4:
case RD_SF_B5G6R5:
case RD_SF_B5G5R5A1:
case RD_SF_B5G5R5X1:
{
for (DWORD y = dwHeight; y > 0; y--)
{
UINT16 *p = (UINT16*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p++ = (UINT16)dwColor;
}
pSurface += m_pColor->GetPitch();
}
}
break;
case RD_SF_B2G3R3:
{
for (DWORD y = dwHeight; y > 0; y--)
{
UINT8 *p = (UINT8*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p++ = (UINT8)dwColor;
}
pSurface += m_pColor->GetPitch();
}
}
break;
default:
{
for (int y = y0; y < pData->Rects[i].bottom; ++y)
{
for (int x = x0; x < pData->Rects[i].right; ++x)
{
this->WritePixelColor(x, y, fillColor, TRUE);
}
}
}
}
}
}
//-----------------------------------------------------------------------------
//
// Clear specified rectangles in the depth buffer
// Directly handles the command from the DP2 stream
//
//-----------------------------------------------------------------------------
void RDRenderTarget::ClearDepth(RDDepth fillDepth, LPD3DHAL_DP2COMMAND pCmd)
{
LPD3DHAL_DP2CLEAR pData = (LPD3DHAL_DP2CLEAR)(pCmd + 1);
if (!m_pDepth) return;
for (DWORD i = 0; i < pCmd->wStateCount; i++)
{
DWORD x0 = pData->Rects[i].left;
DWORD y0 = pData->Rects[i].top;
DWORD dwWidth = ( pData->Rects[i].right - x0 ) * m_pDepth->GetSamples();
DWORD dwHeight = pData->Rects[i].bottom - y0;
char* pSurface = PixelAddress( x0, y0, 0, 0, m_pDepth );
switch ( m_pDepth->GetSurfaceFormat() )
{
case RD_SF_Z16S0:
{
UINT16 Depth = UINT16(fillDepth);
for (DWORD y = dwHeight; y > 0; y--)
{
UINT16 *p = (UINT16*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p++ = Depth;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_Z24S8:
case RD_SF_Z24X8:
case RD_SF_Z24X4S4:
{
UINT32 Depth = UINT32(fillDepth) << 8;
for (DWORD y = dwHeight; y > 0; y--)
{
UINT32 *p = (UINT32*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
// need to do read-modify-write to not step on stencil
*p++ = (*p & ~(0xffffff00)) | Depth;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_S8Z24:
case RD_SF_X8Z24:
case RD_SF_X4S4Z24:
{
UINT32 Depth = UINT32(fillDepth) & 0x00ffffff;
for (DWORD y = dwHeight; y > 0; y--)
{
UINT32 *p = (UINT32*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
// need to do read-modify-write to not step on stencil
*p++ = (*p & ~(0x00ffffff)) | Depth;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_Z15S1:
{
UINT16 Depth = UINT16(fillDepth) << 1;
for (DWORD y = dwHeight; y > 0; y--)
{
UINT16 *p = (UINT16*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
// need to do read-modify-write to not step on stencil
*p++ = (*p & ~(0xfffe)) | Depth;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_S1Z15:
{
UINT16 Depth = UINT16(fillDepth) & 0x7fff;
for (DWORD y = dwHeight; y > 0; y--)
{
UINT16 *p = (UINT16*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
// need to do read-modify-write to not step on stencil
*p++ = (*p & ~(0x7fff)) | Depth;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_Z32S0:
{
UINT32 Depth = UINT32(fillDepth);
for (DWORD y = dwHeight; y > 0; y--)
{
UINT32 *p = (UINT32*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p++ = Depth;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
default:
{
for (int y = y0; y < pData->Rects[i].bottom; ++y)
{
for (int x = x0; x < pData->Rects[i].right; ++x)
{
this->WritePixelDepth(x, y, fillDepth);
}
}
}
}
}
}
//-----------------------------------------------------------------------------
//
// Clear specified rectangles in the stencil buffer
// Directly handles the command from the DP2 stream
//
//-----------------------------------------------------------------------------
void RDRenderTarget::ClearStencil(UINT8 uStencil, LPD3DHAL_DP2COMMAND pCmd)
{
LPD3DHAL_DP2CLEAR pData = (LPD3DHAL_DP2CLEAR)(pCmd + 1);
for (DWORD i = 0; i < pCmd->wStateCount; i++)
{
DWORD x0 = pData->Rects[i].left;
DWORD y0 = pData->Rects[i].top;
DWORD dwWidth = (pData->Rects[i].right - x0 ) * m_pDepth->GetSamples();
DWORD dwHeight = pData->Rects[i].bottom - y0;
char* pSurface = PixelAddress( x0, y0, 0, 0, m_pDepth );
switch ( m_pDepth->GetSurfaceFormat() )
{
case RD_SF_Z24S8:
{
for (DWORD y = dwHeight; y > 0; y--)
{
UINT8 *p = (UINT8*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p = uStencil;
p += 4;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_S8Z24:
{
for (DWORD y = dwHeight; y > 0; y--)
{
UINT8 *p = (UINT8*)&pSurface[3];
for (DWORD x = dwWidth; x > 0; x--)
{
*p = uStencil;
p += 4;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_Z24X4S4:
{
UINT32 stencil = uStencil & 0xf;
for (DWORD y = dwHeight; y > 0; y--)
{
UINT32 *p = (UINT32*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
// need to do read-modify-write to not step on depth
*p++ = (*p & ~(0x000000ff)) | stencil;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_X4S4Z24:
{
UINT32 stencil = (uStencil & 0xf) << 24;
for (DWORD y = dwHeight; y > 0; y--)
{
UINT32 *p = (UINT32*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
// need to do read-modify-write to not step on depth
*p++ = (*p & ~(0xff000000)) | stencil;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_Z15S1:
{
UINT16 stencil = uStencil & 0x1;
for (DWORD y = dwHeight; y > 0; y--)
{
UINT16 *p = (UINT16*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
// need to do read-modify-write to not step on depth
*p++ = (*p & ~(0x0001)) | stencil;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_S1Z15:
{
UINT16 stencil = uStencil << 15;
for (DWORD y = dwHeight; y > 0; y--)
{
UINT16 *p = (UINT16*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
// need to do read-modify-write to not step on depth
*p++ = (*p & ~(0x8000)) | stencil;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_Z16S0:
case RD_SF_Z32S0:
break;
default:
{
for (int y = y0; y < pData->Rects[i].bottom; ++y)
{
for (int x = x0; x < pData->Rects[i].right; ++x)
{
this->WritePixelStencil(x, y, uStencil);
}
}
}
}
}
}
//-----------------------------------------------------------------------------
//
// Clear specified rectangles in the depth and stencil buffers
// Directly handles the command from the DP2 stream
//
//-----------------------------------------------------------------------------
void RDRenderTarget::ClearDepthStencil(RDDepth fillDepth, UINT8 uStencil, LPD3DHAL_DP2COMMAND pCmd)
{
LPD3DHAL_DP2CLEAR pData = (LPD3DHAL_DP2CLEAR)(pCmd + 1);
for (DWORD i = 0; i < pCmd->wStateCount; i++)
{
DWORD x0 = pData->Rects[i].left;
DWORD y0 = pData->Rects[i].top;
DWORD dwWidth = ( pData->Rects[i].right - x0 ) * m_pDepth->GetSamples();
DWORD dwHeight = pData->Rects[i].bottom - y0;
char* pSurface = PixelAddress( x0, y0, 0, 0, m_pDepth );
switch (m_pDepth->GetSurfaceFormat())
{
case RD_SF_Z16S0:
case RD_SF_Z32S0:
break;
case RD_SF_Z24S8:
case RD_SF_Z24X8:
case RD_SF_S8Z24:
case RD_SF_X8Z24:
case RD_SF_Z24X4S4:
case RD_SF_X4S4Z24:
{
UINT32 v;
switch (m_pDepth->GetSurfaceFormat())
{
case RD_SF_Z24S8: v = (UINT32(fillDepth) << 8) + uStencil; break;
case RD_SF_Z24X8: v = (UINT32(fillDepth) << 8); break;
case RD_SF_S8Z24: v = (UINT32(fillDepth) & 0x00ffffff) + (uStencil << 24); break;
case RD_SF_X8Z24: v = (UINT32(fillDepth) & 0x00ffffff); break;
case RD_SF_Z24X4S4: v = (UINT32(fillDepth) << 8) + (uStencil & 0xf); break;
case RD_SF_X4S4Z24: v = (UINT32(fillDepth) & 0x00ffffff) + ((uStencil & 0xf) << 24); break;
}
for (DWORD y = dwHeight; y > 0; y--)
{
UINT32 *p = (UINT32*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p++ = v;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
case RD_SF_Z15S1:
case RD_SF_S1Z15:
{
UINT16 v;
switch (m_pDepth->GetSurfaceFormat())
{
case RD_SF_Z15S1: v = (UINT16(fillDepth) << 1) + (uStencil & 0x1); break;
case RD_SF_S1Z15: v = (UINT16(fillDepth) & 0x7fff) + (uStencil << 15); break;
}
for (DWORD y = dwHeight; y > 0; y--)
{
UINT16 *p = (UINT16*)pSurface;
for (DWORD x = dwWidth; x > 0; x--)
{
*p++ = v;
}
pSurface += m_pDepth->GetPitch();
}
}
break;
default:
{
for (int y = y0; y < pData->Rects[i].bottom; ++y)
{
for (int x = x0; x < pData->Rects[i].right; ++x)
{
this->WritePixelDepth(x, y, fillDepth);
this->WritePixelStencil(x, y, uStencil);
}
}
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
// end
| [
"[email protected]"
] | |
2919d84c0f7d2eaca7d322307b0e3204d8c404fc | 3528b9ecb29dc8c2401580a50888ff21014b57dc | /inc/ExtKitSerialDebugger.h | d605ec1d9019ae81cc9592da8e2b1f49282ad388 | [
"MIT"
] | permissive | softgraph/microbit-dal-ext-kit | 97d79be1f419c0e7c67d4abedfb859e47866147b | c88c8aa9ac341503792b7aaad1e8b46e6d739ff9 | refs/heads/master | 2020-04-28T05:06:31.610800 | 2019-12-20T14:50:43 | 2019-12-20T14:50:43 | 175,007,349 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,716 | h | /// The set of components and utilities for C++ applications using `microbit-dal` (also known as micro:bit runtime)
/** @package microbit_dal_ext_kit
*/
/// Serial Debugger component
/** @file
@author Copyright (c) 2019 Tomoyuki Nakashima.<br>
This code is licensed under MIT license. See `LICENSE` in the project root for more information.
@note Run Doxygen (http://www.doxygen.nl) with `Doxyfile` in the project root to generate the documentation.
*/
#ifndef EXT_KIT_SERIAL_DEBUGGER_H
#define EXT_KIT_SERIAL_DEBUGGER_H
#include "ManagedString.h"
#include "ExtKitComponent.h"
class MicroBitEvent;
namespace microbit_dal_ext_kit {
/// An ext-kit Component which provides the console for debugging using a serial port over USB
class SerialDebugger : public Component
{
public:
/// Constructor
SerialDebugger(const char* name);
protected:
/// Inherited
/* Component */ void doHandleComponentAction(Action action);
/// Called when the serial debugger is enabled (ready to activate)
virtual /* SerialDebugger */ void doHandleSerialDebuggerEnabled();
/// Called when the serial debugger is disabled
virtual /* SerialDebugger */ void doHandleSerialDebuggerDisabled();
/// Called when a character is received from the serial port
virtual /* SerialDebugger */ void doHandleSerialReceived(char c);
/// Called when a command for Direct Input Mode is ready to evaluate
virtual /* SerialDebugger */ bool /* consumed */ doHandleDirectCommand(ManagedString command);
/// Called when a command for Line Input Mode is ready to evaluate
virtual /* SerialDebugger */ bool /* consumed */ doHandleLineCommand(ManagedString command);
/// Called when Show Help command is received
virtual /* SerialDebugger */ void debug_sendCmdHelp();
/// Called when Show Help command for Direct Input Mode is requested
virtual /* SerialDebugger */ void debug_sendHelpForDirectCommands();
/// Called when Show Help command for Line Input Mode is requested
virtual /* SerialDebugger */ void debug_sendHelpForLineCommands();
/// Send Lines
void debug_sendLines(const char* const * lineArray /* terminated by 0 */);
/// Called when Show Configuration command is received
virtual /* SerialDebugger */ void debug_sendConfig();
/// Called when Show Device information command is received
virtual /* SerialDebugger */ void debug_sendDeviceInfo();
/// Command string buffer
ManagedString mCommand;
/// Previous character
char mPrevChar;
/// Mode character of Line Input Mode. 0 means Direct Input Mode.
char mLineModeChar;
private:
/// Handle serial received event
void handleSerialReceived(MicroBitEvent event);
}; // SerialDebugger
} // microbit_dal_ext_kit
#endif // EXT_KIT_SERIAL_DEBUGGER_H
| [
"[email protected]"
] | |
e09007089762ca73d773bdfd880716f20b98ac19 | 63c71060f36866bca4ac27304cef6d5755fdc35c | /src/NMS/NmsClient.h | a11f7f8d65b58499349d9f489f6402eb08eb8c85 | [] | no_license | 15831944/barry_dev | bc8441cbfbd4b62fbb42bee3dcb79ff7f5fcaf8a | d4a83421458aa28ca293caa7a5567433e9358596 | refs/heads/master | 2022-03-24T07:00:26.810732 | 2015-12-22T07:19:58 | 2015-12-22T07:19:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,150 | h | ////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2005
// Packet Engineering, Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification is not permitted unless authorized in writing by a duly
// appointed officer of Packet Engineering, Inc. or its derivatives
//
// File Name: NmsClient.h
// Description:
//
//
// Modification History:
//
////////////////////////////////////////////////////////////////////////////
#ifndef Omn_NMS_NmsClient_h
#define Omn_NMS_NmsClient_h
#include "Network/NetEtyType.h"
#include "Util/RCObject.h"
#include "Util/RCObjImp.h"
#include "Util/ValList.h"
#include "UtilComm/Ptrs.h"
#include "UtilComm/TcpListener.h"
#include "UtilComm/TcpClient.h"
#include "XmlParser/Ptrs.h"
class OmnSoMgcpEndpoint;
class OmnNmsClient : public virtual OmnRCObject,
public OmnTcpListener
{
OmnDefineRCObject;
private:
struct NmsClient
{
OmnNetEtyType::E mType;
OmnTcpClientPtr mConn;
NmsClient()
:
mType(OmnNetEtyType::eInvalidNetEntity)
{
}
NmsClient(const OmnNetEtyType::E t,
const OmnTcpClientPtr &c)
:
mType(t),
mConn(c)
{
}
};
OmnVList<NmsClient> mClients;
// OmnTcpCltGrpPtr mTcpClts;
public:
OmnNmsClient();
~OmnNmsClient();
bool start();
bool stop();
bool stopProg(const OmnString &name, OmnString &err);
bool config(const OmnXmlItemPtr &def);
bool readResp(const OmnString &name,
const OmnTcpClientPtr &conn,
OmnString &err);
bool checkProgStatus(const OmnString &name, OmnString &rslt);
bool downloadAlgData(const int algId);
OmnTcpClientPtr getClientConn(const OmnString &name);
OmnTcpClientPtr getSrConn();
bool isProgDefined(const OmnString &name);
virtual OmnString getName() const {return "NmsClient";}
virtual void recvMsg(const OmnConnBuffPtr &buff,
const OmnTcpClientPtr &conn);
private:
bool addEndpoint(const OmnConnBuffPtr &buff, bool &finished);
void procNmsCmd(const OmnConnBuffPtr &, const OmnTcpClientPtr &);
void procEpCmd(const OmnConnBuffPtr &, const OmnTcpClientPtr &);
};
#endif
| [
"[email protected]"
] | |
a01889a4a421da4bc444437974fef99e6787ef18 | 3c49d8f59d2939edaeb1cb99cc0fa352f73ef0c8 | /loc/inc/particlef.hpp | 1b5dca6d311a8689f29794bf6280af5731ec0ec9 | [] | no_license | aomaesalu/TuumBot | e8e53207f4461111c4949c84eb93ad84529fc3bc | d384a91ff89a61a4db7d4c373252bf7d64744208 | refs/heads/master | 2021-01-21T02:40:39.376695 | 2015-12-09T07:25:00 | 2015-12-09T07:25:00 | 37,606,573 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,355 | hpp | /** @file particlef.hpp
* Particle filter declaration.
*
* @authors Meelik Kiik
* @version 0.1
* @date 24. October 2015
*/
#ifndef RTX_LOC_PARTICLE_FILTER_H
#define RTX_LOC_PARTICLE_FILTER_H
#include <sstream>
#include <vector>
#include <string>
#include <stdint.h>
#include "loc_core.hpp"
using namespace rtx;
namespace loc {
struct Particle {
int x; int y; double o;
long double prob;
Particle(int _x, int _y, double _o) {
x = _x; y = _y; o = _o;
prob = 1;
}
std::string serialize() {
std::stringstream ss;
ss << "<Particle ";
ss << x << ", " << y << ", " << o <<", " << prob << ">";
return ss.str();
}
};
typedef std::vector<Particle> ParticleSet;
class ParticleFilter {
private:
ParticleSet m_particles;
uint32_t m_size;
long double m_mx_probability;
double m_noise_fw;
double m_noise_rot;
double m_noise_sense;
public:
ParticleFilter();
void init(uint32_t, int, int, int, int);
ParticleSet* getParticles() { return &m_particles; }
void calcStandardDeviation(double&, double&, double&);
void update(MotionVec);
void process(LandmarkSet);
void filter();
SystemState evaluate();
double calcError(SystemState);
void printParticleInfo();
};
};
#endif
| [
"[email protected]"
] | |
d2970ae8fb4b81d9637bdd63bf5f810ebf9b368a | 448d2e592a7d8288cde7a28ab65de4c856e2d5b9 | /Homework01/VectorOverloading/Vector2D/Vector2D-test/test.cpp | 304ef2bf59d138340f9bb705148970c5b13baea7 | [] | no_license | prog1261-2020/homework-JacobShannon316 | 250d53ecf2e736b29745b27d526f4d3c39c71b87 | b3fef32b782246ad2b14e3967fef9c7ad6af4464 | refs/heads/master | 2020-12-10T17:09:06.350807 | 2020-02-25T19:09:13 | 2020-02-25T19:09:13 | 233,655,204 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,777 | cpp | #include "gtest/gtest.h"
#include "Vector2D.h"
TEST(Vector2DTestSuite, constructorTest01) {
Vector2D v1(1, 1);
std::string expectedResult = "(1, 1)";
std::string result = v1.toString();
EXPECT_EQ(expectedResult, result);
}
TEST(Vector2DTestSuite, equalTest01) {
Vector2D v1(1, 1);
Vector2D v2(1, 1);
EXPECT_TRUE(v1 == v2);
}
TEST(Vector2DTestSuite, equalTest02) {
Vector2D v1(1, 1);
Vector2D v2(1, 1);
EXPECT_FALSE(v1 != v2);
}
TEST(Vector2DTestSuite, equalTest03) {
Vector2D v1(1, 1);
Vector2D v2(1, 1);
EXPECT_FALSE(v1 != v2);
}
TEST(Vector2DTestSuite, GreaterThanTest01) {
Vector2D v1(1, 1);
Vector2D v2(2, 2);
EXPECT_FALSE(v1 > v2);
}
TEST(Vector2DTestSuite, GreaterThanTest02) {
Vector2D v1(2, 2);
Vector2D v2(1, 1);
EXPECT_FALSE(v1 < v2);
}
TEST(Vector2DTestSuite, LessThanTest01) {
Vector2D v1(1, 1);
Vector2D v2(2, 2);
EXPECT_FALSE(v1 > v2);
}
TEST(Vector2DTestSuite, LessThanTest02) {
Vector2D v1(1, 1);
Vector2D v2(2, 2);
EXPECT_FALSE(v1 < v2);
}
TEST(Vector2DTestSuite, EqualLessThanTest01) {
Vector2D v1(2, 2);
Vector2D v2(1, 1);
EXPECT_TRUE(v1 <= v2);
}
TEST(Vector2DTestSuite, EqualLessThanTest02) {
Vector2D v1(1, 1);
Vector2D v2(2, 2);
EXPECT_TRUE(v1 <= v2);
}
TEST(Vector2DTestSuite, EqualGreaterThanTest01) {
Vector2D v1(2, 2);
Vector2D v2(1, 1);
EXPECT_TRUE(v1 >= v2);
}
TEST(Vector2DTestSuite, EqualGreaterThanTest02) {
Vector2D v1(1, 1);
Vector2D v2(2, 2);
EXPECT_TRUE(v1 >= v2);
}
TEST(Vector2DTestSuite, arithmaticOperatorTest03) {
Vector2D v1(3, 4);
Vector2D expectedResult(3, 4);
Vector2D v2 = ++v1;
ASSERT_EQ(v1, expectedResult);
ASSERT_EQ(v2, Vector2D(2, 3));
}
| [
"[email protected]"
] | |
0731c9637eff1063d396f34f75ce760dc5d2b410 | 8643f81d1311f56853979cf4f99b6593bc3a9f69 | /src/ezn_winman.cpp | 123748be1f1a011a242228c457cc2a580fbc48ad | [
"MIT"
] | permissive | lahoising/ezn-winman | 4e7e27ecfa82e4d31f4ab4b07f06a7c634885842 | 6f83a1bd3859550c36f1a543e7e9c9c9622ef40a | refs/heads/main | 2023-08-22T17:40:41.699321 | 2021-09-18T04:37:27 | 2021-09-18T04:37:27 | 401,151,179 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,014 | cpp | #include <iostream>
#include <GLFW/glfw3.h>
#include <ezn_winman.h>
#include <ezn_window.h>
namespace ezn
{
Winman::Winman()
{
if(!glfwInit())
{
printf("unable to initialize glfw\n");
return;
}
glfwSetErrorCallback(Winman::ErrorCallback);
}
Winman::~Winman()
{
this->Close();
}
void Winman::Close()
{
for(Window *ptr : this->windows)
delete ptr;
glfwTerminate();
}
void Winman::Update()
{
glfwPollEvents();
for(Window *ptr : this->windows)
{
ptr->Update();
}
while(!this->windowCloseQueue.empty())
{
this->windows.erase(this->windowCloseQueue.front());
this->windowCloseQueue.pop();
}
}
int Winman::GetMonitorsCount(){ int count; glfwGetMonitors(&count); return count; }
void Winman::ToggleVSync(bool on)
{
glfwSwapInterval(on? 1 : 0);
}
void Winman::ErrorCallback(int error, const char *description)
{
fprintf(stderr, "Glfw Error (%d): %s\n", error, description);
}
} // namespace ezn | [
"[email protected]"
] | |
aae7accd93cc420ee699cd4b53edcab15c2800dd | 59fcc1ee1b077c51e89d44b2ae3f578f6eafcfec | /project-euler/problem4.cpp | 9305e3f189b065b4ea7799f7dd6a91f17087565c | [
"MIT"
] | permissive | rjoleary/programming-problems | cd4b810f032d755042ef0237d92e385c20287f13 | 9027592f8c70ccbfccbec74f91414744cf505501 | refs/heads/master | 2020-05-24T12:03:55.124360 | 2014-02-18T21:32:49 | 2014-02-18T21:32:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 891 | cpp | #include <iostream>
// Reverses the digits in an integer. Ex: 1234 -> 4321
int reverse(int value);
int main()
{
// Test all possible combinations of a*b and keep the largest palindrome.
int largestProduct = 0;
for (int a = 999; a >= 0; a--)
{
for (int b = a; b >= 0; b--)
{
int product = a * b;
// Since b iterates in reverse, a significant number of combinations
// do not need to be checked.
if (product < largestProduct)
break;
if (reverse(product) == product)
largestProduct = std::max(product, largestProduct);
}
}
std::cout << largestProduct << '\n';
}
int reverse(int value)
{
int reverse = 0;
while (value > 0)
{
reverse *= 10;
reverse += value % 10;
value = value / 10;
}
return reverse;
}
| [
"[email protected]"
] | |
a066abacf7b1b793728ec2d92dd3fbee16fd85e8 | fcf2c589debaf910adc075a128a7b949eb92f8c0 | /src/ast/ast_parameter.cpp | e59284aa7df89e3d86b79c0344d9cc0075d09c72 | [] | no_license | ostiff/c89-mips-compiler | f7372ac4f4a70bc19946f8f668233ebcb3a47fde | 77f7db910694a141d883946ac8b7f7374e2aafe3 | refs/heads/main | 2023-04-16T23:34:12.258653 | 2021-04-27T13:03:43 | 2021-04-27T13:03:43 | 362,108,304 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 402 | cpp | #include "ast_parameter.hpp"
std::string Parameter_Declaration::getdeclSpec() const{
return declSpec;
}
ExpressionPtr Parameter_Declaration::getDecl() const{
return decl;
}
ExpressionPtr Parameter_Declaration::getAbstDecl() const{
return abstDecl;
}
void Parameter_Declaration::printPy(std::ostream &dst, int depth) const{
if(decl != NULL){
decl->printPy(dst,depth);
}
} | [
"[email protected]"
] | |
ec5f8b51c99a7be6c2f8c882a620597ab13638da | b4a62ce03c7dbf3cac4bed88e3d64372f807386e | /0114_Flatten_Binary_Tree_to_Linked_List/1.cpp | 6cbed823eb44eb49f48a4c35b9fde96782d303b4 | [] | no_license | xinlin192/myleetcode | f2f58c42e29e55673c91d8384d6727e913b69286 | 7c3227b059f931a176772c4bfd203c56da6d61fe | refs/heads/master | 2021-09-10T20:05:05.816976 | 2018-04-01T09:01:10 | 2018-04-01T09:01:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 786 | cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void flatten(TreeNode* root) {
TreeNode *cur = root;
stack<TreeNode*> s;
while (cur != NULL) {
if (cur->left != NULL) {
if (cur->right != NULL) {
s.push(cur->right);
}
cur->right = cur->left;
cur->left = NULL;
} else if (cur->right == NULL) {
if (!s.empty()) {
cur->right = s.top();
s.pop();
}
}
cur = cur->right;
}
}
};
| [
"[email protected]"
] | |
4bc7ee65f0eba709ea370228f9dde9d97c57e524 | 578057387314e1796fb3b16cb95b71f7a23410d6 | /tests/unittests/lit_cases/test_dnnl/test_einsum_transpose_dnnl.cc | a0312ceeb1a1895a8c06fbd31a228010bc9ddeb8 | [
"Apache-2.0"
] | permissive | alibaba/heterogeneity-aware-lowering-and-optimization | 986b417eb8e4d229fc8cc6e77bb4eff5c6fa654d | 966d4aa8f72f42557df58a4f56a7d44b88068e80 | refs/heads/master | 2023-08-28T22:15:13.439329 | 2023-01-06T00:39:07 | 2023-01-06T07:26:38 | 289,420,807 | 256 | 94 | Apache-2.0 | 2023-06-13T10:38:25 | 2020-08-22T04:45:46 | C++ | UTF-8 | C++ | false | false | 1,808 | cc | //===-test_einsum_transpose_dnnl.cc-----------------------------------------------------------===//
//
// Copyright (C) 2019-2020 Alibaba Group Holding Limited.
//
// 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.
// =============================================================================
// clang-format off
// Testing CXX Code Gen using ODLA API on dnnl
// RUN: %halo_compiler -target cxx -o %data_path/test_einsum_transpose/test_data_set_0/output_0.cc -x onnx -emit-data-as-c %data_path/test_einsum_transpose/test_data_set_0/output_0.pb
// RUN: %halo_compiler -target cxx -o %data_path/test_einsum_transpose/test_data_set_0/input_0.cc -x onnx -emit-data-as-c %data_path/test_einsum_transpose/test_data_set_0/input_0.pb
// RUN: %halo_compiler -target cxx -batch-size 1 %halo_compile_flags %data_path/test_einsum_transpose/model.onnx -o %t.cc
// RUN: %cxx -c -fPIC -o %t.o %t.cc -I%odla_path/include
// RUN: %cxx -g %s %t.o %t.bin -I%T -I%odla_path/include -I%unittests_path -I%data_path/test_einsum_transpose/test_data_set_0 %odla_link %device_link -lodla_dnnl -o %t_dnnl.exe -Wno-deprecated-declarations
// RUN: %t_dnnl.exe 0.0001 0 dnnl %data_path/test_einsum_transpose | FileCheck %s
// CHECK: Result Pass
// clang-format on
// XFAIL: *
#include "test_einsum_transpose_dnnl.cc.tmp.main.cc.in"
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.