blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8f5cf28c5c4b56080ab2beae292568d8d9c2de65 | 948f4e13af6b3014582909cc6d762606f2a43365 | /testcases/juliet_test_suite/testcases/CWE195_Signed_to_Unsigned_Conversion_Error/s02/CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_malloc_82.h | 09f6ca8fcfe57b3814453e0cd07dd9d11ceed6fb | [] | 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 | 1,393 | h | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_malloc_82.h
Label Definition File: CWE195_Signed_to_Unsigned_Conversion_Error.label.xml
Template File: sources-sink-82.tmpl.h
*/
/*
* @description
* CWE: 195 Signed to Unsigned Conversion Error
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Positive integer
* BadSink : Allocate memory using malloc() with the size of data
* Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
*
* */
#include "std_testcase.h"
namespace CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_malloc_82
{
class CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_malloc_82_base
{
public:
/* pure virtual function */
virtual void action(int data) = 0;
};
#ifndef OMITBAD
class CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_malloc_82_bad : public CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_malloc_82_base
{
public:
void action(int data);
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_malloc_82_goodG2B : public CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_malloc_82_base
{
public:
void action(int data);
};
#endif /* OMITGOOD */
}
| [
"yzhang0701@gmail.com"
] | yzhang0701@gmail.com |
ac15819fbbfde650423535e9d93f29e4f076c497 | 3700305318e94769f0680b28942b68e80e31568e | /Ethereal/Private/NPCs/Characters/NPCCharacterMaster.cpp | 3d05f68694ae7b7dbe67e0bc3d940cceec6530d9 | [
"Apache-2.0"
] | permissive | xaerowl/EtherealLegends | 6ec29bd21c8c2f501a1d5ddd3a7d7e819fbd0549 | 61e8af475497653f532af65624667cc09de3f824 | refs/heads/master | 2021-01-19T03:35:09.658875 | 2017-04-01T05:37:53 | 2017-04-01T05:37:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 861 | cpp | // © 2014 - 2017 Soverance Studios
// http://www.soverance.com
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "Ethereal.h"
#include "NPCCharacterMaster.h"
ANPCCharacterMaster::ANPCCharacterMaster(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
MapMarkerFX->SetColorParameter(FName(TEXT("BeamColor")), FColor::Orange);
} | [
"scott.mccutchen@soverance.com"
] | scott.mccutchen@soverance.com |
608c56de4a325ece91372703fe06c6df0d6e0b60 | 07a6233bf28e103bd826211973cf30bf970a918d | /chapter2/2.31.cpp | 0f49e967a6585104d53d987b809cf4cac38b63b5 | [] | no_license | luo3300612/c-primer | 59df9d05b3dcc6719826a0e1cea431c22f50e68d | 2c89dc29fb0b18957f6b03ddbf25667e37103942 | refs/heads/master | 2020-05-03T15:10:35.012823 | 2019-11-05T00:34:29 | 2019-11-05T00:34:29 | 178,699,152 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 91 | cpp | //合法
//非法,int指针不可以指向const int 指针;合法
//非法同上,合法 | [
"591486669@qq.com"
] | 591486669@qq.com |
30b2f6e56ff58bc04c2839ccd817f632983bc760 | 207c015e853f69b456d49a915198be21925b3435 | /Source/FPSProject/Private/LaunchPad.cpp | 7cb11c69bf5a07dd44fd68f225af2729d67faf0d | [] | no_license | bonomjy07/StealthGame | 7008d39f14d21b02bce9cb9b5a677bc1a51fcc4d | 706405ccaa40592f69ed876777f9ef0efdbb1898 | refs/heads/master | 2022-07-22T08:34:19.611059 | 2020-05-10T15:39:18 | 2020-05-10T15:39:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,480 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "LaunchPad.h"
#include "Components/StaticMeshComponent.h"
#include "Components/BoxComponent.h"
#include "GameFramework/Character.h"
#include "Kismet/GameplayStatics.h"
#include "Particles/ParticleSystem.h"
// Sets default values
ALaunchPad::ALaunchPad()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
BoxComp = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxComp"));
BoxComp->SetBoxExtent(FVector(200.f));
BoxComp->OnComponentBeginOverlap.AddDynamic(this, &ALaunchPad::HandleOverlap);
RootComponent = BoxComp;
ArrowMeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("ArrowMeshComp"));
ArrowMeshComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);
ArrowMeshComp->SetupAttachment(RootComponent);
BaseMeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("BaseMeshComp"));
BaseMeshComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);
BaseMeshComp->SetupAttachment(RootComponent);
LaunchStrength = 1000.f;
LaunchPitchOffset = 35.f;
}
void ALaunchPad::HandleOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
// Calculate Launch velocity
FRotator LaunchRotation = GetActorRotation();
LaunchRotation.Pitch += LaunchPitchOffset;
FVector LaunchDirection = LaunchRotation.Vector();
FVector LaunchVelocity = LaunchDirection * LaunchStrength;
// Launch the character
ACharacter* Character = Cast<ACharacter>(OtherActor);
if (Character)
{
Character->LaunchCharacter(LaunchVelocity, true, true);
// Spawn fx
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), LaunchPadEffect, GetActorLocation());
UGameplayStatics::PlaySound2D(this, LaunchPadSound);
}
// Launch the actor who has component simulating physics
else if (OtherComp && OtherComp->IsSimulatingPhysics())
{
OtherComp->AddImpulse(LaunchVelocity * OtherComp->GetMass());
// Spawn fx
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), LaunchPadEffect, GetActorLocation());
UGameplayStatics::PlaySound2D(this, LaunchPadSound);
}
}
// Called when the game starts or when spawned
void ALaunchPad::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ALaunchPad::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
| [
"bonomjy07@naver.com"
] | bonomjy07@naver.com |
86a8720f4c88ef654da59d3949bcd41ca956d6a3 | 9d3cb955f6a47e14a6f05abba4263ff290e29171 | /word2vec_logcorpussize/word2vec_ops.cc | 26a892194cd6ec4116a4c6c932ed99d0a526ee3a | [
"Apache-2.0"
] | permissive | ziyin-dl/log_corpus_size | 1231f47c2e942d478f47e0606c05cd5908c0f542 | 40eef0829944fd0c97596691c5bf57c17a7688a8 | refs/heads/master | 2020-03-16T05:13:55.578888 | 2018-05-07T23:46:27 | 2018-05-07T23:46:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,644 | cc | /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/framework/op.h"
namespace tensorflow {
REGISTER_OP("SkipgramWord2vec")
.Output("vocab_word: string")
.Output("vocab_freq: int32")
.Output("words_per_epoch: int64")
.Output("current_epoch: int32")
.Output("total_words_processed: int64")
.Output("examples: int32")
.Output("labels: int32")
.SetIsStateful()
.Attr("filename: string")
.Attr("batch_size: int")
.Attr("window_size: int = 5")
.Attr("min_count: int = 5")
.Attr("vocab_size_in: int = 10000")
.Attr("subsample: float = 1e-3")
.Doc(R"doc(
Parses a text file and creates a batch of examples.
vocab_word: A vector of words in the corpus.
vocab_freq: Frequencies of words. Sorted in the non-ascending order.
words_per_epoch: Number of words per epoch in the data file.
current_epoch: The current epoch number.
total_words_processed: The total number of words processed so far.
examples: A vector of word ids.
labels: A vector of word ids.
filename: The corpus's text file name.
batch_size: The size of produced batch.
window_size: The number of words to predict to the left and right of the target.
min_count: The minimum number of word occurrences for it to be included in the
vocabulary.
subsample: Threshold for word occurrence. Words that appear with higher
frequency will be randomly down-sampled. Set to 0 to disable.
)doc");
REGISTER_OP("NegTrainWord2vec")
.Input("w_in: Ref(float)")
.Input("w_out: Ref(float)")
.Input("examples: int32")
.Input("labels: int32")
.Input("lr: float")
.SetIsStateful()
.Attr("vocab_count: list(int)")
.Attr("num_negative_samples: int")
.Doc(R"doc(
Training via negative sampling.
w_in: input word embedding.
w_out: output word embedding.
examples: A vector of word ids.
labels: A vector of word ids.
vocab_count: Count of words in the vocabulary.
num_negative_samples: Number of negative samples per example.
)doc");
} // end namespace tensorflow
| [
"zyin@chaos2.stanford.edu"
] | zyin@chaos2.stanford.edu |
16ce2a784aad7df60d55d2cdf5d10824f85b6f5c | 34b8bb9621ea4ab5a5e5614f6723000f91e5e18d | /src/libs/sockets/sx_socketconnectrefused.hpp | bd02220aada1d7e018b81919f575d1a7e838c103 | [
"Apache-2.0"
] | permissive | suggitpe/RPMS | 39784b8f0dade1d2a078afc26a4dd4b2e4c67176 | 7a12da0128f79b8b0339fd7146105ba955079b8c | refs/heads/master | 2021-01-10T19:19:23.391960 | 2019-04-29T06:46:22 | 2019-04-29T06:46:22 | 10,453,608 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 222 | hpp | #ifndef __sx_socketconnectrefused_hpp
#define __sx_socketconnectrefused_hpp
#include <si_exception.hpp>
#include <sockets/sx_socket.hpp>
EXCEPTION_DECL_STRT(SX_SocketConnectRefused, SX_Socket)
EXCEPTION_DECL_END
#endif
| [
"me@suggs.org.uk"
] | me@suggs.org.uk |
a4fc331d33025b7e55043806389010a24f7bd931 | 1bfc8362cb441e734e325c2b77f887b60eff5db8 | /s10_revisao/pessoa.cpp | 77422ac2c911b2c5d15093e95540212c21944471 | [] | no_license | senapk/prc_2020_1 | 505f9fe21ada397114b0f42786a6fea08ee06f0c | 3ff920b0b524a746663df05c5f81fb9738769f73 | refs/heads/master | 2021-01-08T07:32:36.442137 | 2020-10-07T21:51:49 | 2020-10-07T21:51:49 | 241,956,959 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 237 | cpp | #include "pessoa.hpp"
#include <iostream>
using namespace std;
Pessoa::Pessoa(string n, int i){
nome = n;
idade = i;
}
string Pessoa::getNome() const{
return nome;
}
void Pessoa::envelhecer(){
idade = idade + 1;
} | [
"sena.ufc@gmail.com"
] | sena.ufc@gmail.com |
ec63d57f32b5674f5089bd17746d857bcec0fa48 | 4afcf7dc92bf5c9f859693238b062244b62d4597 | /Entropy/ObjectLayer.h | 9a8a94b3499c7d14be16fa69a798999d5eb5b6f6 | [] | no_license | jandricksen/Entropy | c3ca23862a7c1c86b8ac8a9b08029dfdb43a9970 | 4d3428a4b97ec0e88e9052036ad40acf0a9a4fae | refs/heads/master | 2020-04-11T09:55:04.311458 | 2015-10-03T11:30:48 | 2015-10-03T11:30:48 | 41,471,284 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 654 | h | #pragma once
#include <vector>
#include "Layer.h"
#include "CollisionManager.h"
class GameObject;
class ObjectLayer : public Layer
{
public:
virtual ~ObjectLayer();
// pass a level object through
virtual void update(Level* pLevel, double delta);
virtual void render();
// return a pointer to this layers objects, the level parser will fill this
std::vector<GameObject*>* getGameObject()
{
return &m_gameObjects;
}
virtual std::string type() { return "ObjectLayer"; };
private:
// check for collisions between game objects
CollisionManager m_collisionManager;
// a list of game objects
std::vector<GameObject*> m_gameObjects;
}; | [
"jamesandricksen@gmail.com"
] | jamesandricksen@gmail.com |
fbc9529b912c073b3a8879aa542e50ba90d3ec14 | 0845ae2ca02071debcfd4ac24be871236c01784f | /src/library/compiler/util.h | 0f5d3e5e592d7c8faa7af4ece70ce14bd0788140 | [
"Apache-2.0"
] | permissive | GaloisInc/lean4 | 74c267eb0e900bfaa23df8de86039483ecbd60b7 | 228ddd5fdcd98dd4e9c009f425284e86917938aa | refs/heads/master | 2022-01-25T17:22:36.301592 | 2019-07-09T23:39:32 | 2019-07-09T23:39:32 | 192,390,898 | 0 | 0 | null | 2019-06-17T17:32:30 | 2019-06-17T17:32:29 | null | UTF-8 | C++ | false | false | 8,229 | h | /*
Copyright (c) 2018 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#pragma once
#include "util/pair_ref.h"
#include "util/list_ref.h"
#include "util/name_hash_set.h"
#include "kernel/expr.h"
#include "kernel/type_checker.h"
#include "library/constants.h"
#include "library/util.h"
namespace lean {
/* Return the `some(n)` if `I` is the name of an inductive datatype that contains only constructors with 0-arguments,
and `n` is `1`, `2` or `4`, i.e., the number of bytes that should be used to store a value of this type.
Otherwise, it return `none`.
Remark: if the inductive datatype `I` has more than `2^32` constructors (very unlikely), the result is also `none`. */
optional<unsigned> is_enum_type(environment const & env, name const & I);
optional<expr> to_uint_type(unsigned nbytes);
/* A "compiler" declaration `x := e` */
typedef pair_ref<name, expr> comp_decl;
typedef list_ref<comp_decl> comp_decls;
unsigned get_num_nested_lambdas(expr e);
bool is_lcnf_atom(expr const & e);
expr elim_trivial_let_decls(expr const & e);
bool has_inline_attribute(environment const & env, name const & n);
bool has_noinline_attribute(environment const & env, name const & n);
bool has_inline_if_reduce_attribute(environment const & env, name const & n);
expr unfold_macro_defs(environment const & env, expr const & e);
/* Return true if the given argument is mdata relevant to the compiler
Remark: we currently don't keep any metadata in the compiler. */
inline bool is_lc_mdata(expr const &) { return false; }
bool is_cases_on_recursor(environment const & env, name const & n);
/* We defined the "arity" of a cases_on application as the sum:
```
number of inductive parameters +
1 + // motive
number of inductive indices +
1 + // major premise
number of constructors // cases_on has a minor premise for each constructor
```
\pre is_cases_on_recursor(env, c) */
unsigned get_cases_on_arity(environment const & env, name const & c, bool before_erasure = true);
/* Return the `inductive_val` for the cases_on constant `c`. */
inline inductive_val get_cases_on_inductive_val(environment const & env, name const & c) {
lean_assert(is_cases_on_recursor(env, c));
return env.get(c.get_prefix()).to_inductive_val();
}
inline inductive_val get_cases_on_inductive_val(environment const & env, expr const & c) {
lean_assert(is_constant(c));
return get_cases_on_inductive_val(env, const_name(c));
}
inline bool is_cases_on_app(environment const & env, expr const & e) {
expr const & fn = get_app_fn(e);
return is_constant(fn) && is_cases_on_recursor(env, const_name(fn));
}
/* Return the major premise of a cases_on-application.
\pre is_cases_on_app(env, c) */
expr get_cases_on_app_major(environment const & env, expr const & c, bool before_erasure = true);
unsigned get_cases_on_major_idx(environment const & env, name const & c, bool before_erasure = true);
/* Return the pair `(b, e)` such that `i in [b, e)` is argument `i` in a `c` cases_on
application is a minor premise.
\pre is_cases_on_recursor(env, c) */
pair<unsigned, unsigned> get_cases_on_minors_range(environment const & env, name const & c, bool before_erasure = true);
inline bool is_quot_primitive(environment const & env, name const & n) {
optional<constant_info> info = env.find(n);
return info && info->is_quot();
}
inline bool is_lc_unreachable_app(expr const & e) { return is_app_of(e, get_lc_unreachable_name(), 1); }
inline bool is_lc_proof_app(expr const & e) { return is_app_of(e, get_lc_proof_name(), 1); }
expr mk_lc_unreachable(type_checker::state & s, local_ctx const & lctx, expr const & type);
inline name mk_join_point_name(name const & n) { return name(n, "_join"); }
bool is_join_point_name(name const & n);
/* Create an auxiliary names for a declaration that saves the result of the compilation
after step simplification. */
inline name mk_cstage1_name(name const & decl_name) {
return name(decl_name, "_cstage1");
}
/* Create an auxiliary names for a declaration that saves the result of the compilation
after step erasure. */
inline name mk_cstage2_name(name const & decl_name) {
return name(decl_name, "_cstage2");
}
/* Set `used[i] = true` if `fvars[i]` occurs in `e` */
void mark_used_fvars(expr const & e, buffer<expr> const & fvars, buffer<bool> & used);
/* Return true if `e` contains the free variable `fvar` */
bool has_fvar(expr const & e, expr const & fvar);
expr replace_fvar(expr const & e, expr const & fvar, expr const & new_term);
void sort_fvars(local_ctx const & lctx, buffer<expr> & fvars);
/* Return the "code" size for `e` */
unsigned get_lcnf_size(environment const & env, expr e);
// =======================================
// Auxiliary expressions for erasure.
// We use them after we have erased proofs and unnecessary type information.
// `enf` stands for "erasure normal form". It is LCNF after erasure.
/* Create a neutral expression used at ENF */
expr mk_enf_neutral();
/* Create an unreachable expression used at ENF */
expr mk_enf_unreachable();
expr mk_enf_object_type();
expr mk_enf_neutral_type();
/* "Void" type used in LLNF. Remark: the ENF types neutral and object are also used in LLNF. */
expr mk_llnf_void_type();
bool is_enf_neutral(expr const & e);
bool is_enf_unreachable(expr const & e);
bool is_enf_object_type(expr const & e);
bool is_llnf_void_type(expr const & e);
bool is_llnf_unboxed_type(expr const & type);
expr mk_runtime_type(type_checker::state & st, local_ctx const & lctx, expr e);
// =======================================
/* Return true if `n` is the name of a type with builtin support in the code generator. */
bool is_runtime_builtin_type(name const & n);
inline bool is_runtime_builtin_type(expr const & e) {
return is_constant(e) && is_runtime_builtin_type(const_name(e));
}
/* Return true if `n` is the name of a type that is treated as a scalar type by the code generator. */
bool is_runtime_scalar_type(name const & n);
bool is_irrelevant_type(type_checker::state & st, local_ctx lctx, expr const & type);
bool is_irrelevant_type(environment const & env, expr const & type);
void collect_used(expr const & e, name_hash_set & S);
/* Return true iff `e` contains a free variable in `s` */
bool depends_on(expr const & e, name_hash_set const & s);
bool is_stage2_decl(environment const & env, name const & n);
environment register_stage1_decl(environment const & env, name const & n, names const & ls, expr const & t, expr const & v);
environment register_stage2_decl(environment const & env, name const & n, expr const & t, expr const & v);
/* Return `some n` iff `e` is of the forms `expr.lit (literal.nat n)` or `uint*.of_nat (expr.lit (literal.nat n))` */
optional<nat> get_num_lit_ext(expr const & e);
inline bool is_morally_num_lit(expr const & e) { return static_cast<bool>(get_num_lit_ext(e)); }
/* Return `some n` if `c` is of the form `fix_core_n` where `n in [1, 6]`.
Remark: this function is assuming the core library contains `fix_core_1` ... `fix_core_6` definitions. */
optional<unsigned> is_fix_core(name const & c);
/* Return the `fix_core_n` constant, and `none` if `n` is not in `[1, 6]`.
Remark: this function is assuming the core library contains `fix_core_1` ... `fix_core_6` definitions.
Remark: this function assumes universe levels have already been erased. */
optional<expr> mk_enf_fix_core(unsigned n);
bool lcnf_check_let_decls(environment const & env, comp_decl const & d);
bool lcnf_check_let_decls(environment const & env, comp_decls const & ds);
// =======================================
/* Similar to `type_checker::eta_expand`, but preserves LCNF */
expr lcnf_eta_expand(type_checker::state & st, local_ctx lctx, expr e);
// =======================================
// UInt and USize helper functions
expr mk_usize_type();
bool is_usize_type(expr const & e);
optional<unsigned> is_builtin_scalar(expr const & type);
optional<unsigned> is_enum_type(environment const & env, expr const & type);
// =======================================
void initialize_compiler_util();
void finalize_compiler_util();
}
| [
"leonardo@microsoft.com"
] | leonardo@microsoft.com |
5877a0e6889a385ba2f384acc16f8ab4e71e78f9 | f655cf22d9eb9ce00003280907ad0a1d061109c6 | /kdrive/xorg-server-1.6.5-apple3/hw/xfree86/xorgconf.cpp | acf90f13ff5775b4725dcda809bf7d2ae7f8c4cb | [
"MIT-open-group",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-x11-adobe",
"HPND-sell-variant",
"ICU",
"ISC",
"SGI-B-1.1",
"MIT",
"LicenseRef-scancode-xfree86-1.0",
"X11-distribute-modifications-variant",
"HPND",
"LicenseRef-scancode-mit-old-style",
"Lice... | permissive | QPC-github/X11server | c9b313d5811e556f2cad7424adfc8d2ac322b1f5 | 532470604f6f17ad20bd2b08e07b4f09b4ab1a7c | refs/heads/main | 2023-07-28T20:22:48.192175 | 2011-06-01T05:16:52 | 2021-10-06T05:04:20 | 589,235,418 | 1 | 1 | null | 2023-01-15T14:27:05 | 2023-01-15T14:27:04 | null | UTF-8 | C++ | false | false | 19,082 | cpp | XCOMM $XdotOrg$
XCOMM
XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc.
XCOMM
XCOMM Permission is hereby granted, free of charge, to any person obtaining a
XCOMM copy of this software and associated documentation files (the "Software"),
XCOMM to deal in the Software without restriction, including without limitation
XCOMM the rights to use, copy, modify, merge, publish, distribute, sublicense,
XCOMM and/or sell copies of the Software, and to permit persons to whom the
XCOMM Software is furnished to do so, subject to the following conditions:
XCOMM
XCOMM The above copyright notice and this permission notice shall be included in
XCOMM all copies or substantial portions of the Software.
XCOMM
XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
XCOMM THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
XCOMM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
XCOMM SOFTWARE.
XCOMM
XCOMM Except as contained in this notice, the name of the XFree86 Project shall
XCOMM not be used in advertising or otherwise to promote the sale, use or other
XCOMM dealings in this Software without prior written authorization from the
XCOMM XFree86 Project.
XCOMM
XCOMM $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $
XCOMM **********************************************************************
XCOMM This is a sample configuration file only, intended to illustrate
XCOMM what a config file might look like. Refer to the XF86Config(4/5)
XCOMM man page for details about the format of this file. This man page
XCOMM is installed as MANPAGE
XCOMM **********************************************************************
XCOMM The ordering of sections is not important in version 4.0 and later.
XCOMM **********************************************************************
XCOMM Files section. This allows default font and rgb paths to be set
XCOMM **********************************************************************
Section "Files"
XCOMM Multiple FontPath entries are allowed (which are concatenated together),
XCOMM as well as specifying multiple comma-separated entries in one FontPath
XCOMM command (or a combination of both methods)
FontPath LOCALFONTPATH
FontPath MISCFONTPATH
FontPath T1FONTPATH
FontPath TRUETYPEFONTPATH
FontPath DPI75FONTPATH
FontPath DPI100FONTPATH
XCOMM ModulePath can be used to set a search path for the X server modules.
XCOMM The default path is shown here.
XCOMM ModulePath MODULEPATH
EndSection
XCOMM **********************************************************************
XCOMM Module section -- this is an optional section which is used to specify
XCOMM which run-time loadable modules to load when the X server starts up.
XCOMM **********************************************************************
Section "Module"
XCOMM This loads the DBE extension module.
Load "dbe"
XCOMM This loads the miscellaneous extensions module, and disables
XCOMM initialisation of the XFree86-DGA extension within that module.
SubSection "extmod"
Option "omit xfree86-dga"
EndSubSection
XCOMM This loads the Type1 and FreeType font modules
Load "type1"
Load "freetype"
EndSection
XCOMM **********************************************************************
XCOMM Server flags section. This contains various server-wide Options.
XCOMM **********************************************************************
Section "ServerFlags"
XCOMM Uncomment this to cause a core dump at the spot where a signal is
XCOMM received. This may leave the console in an unusable state, but may
XCOMM provide a better stack trace in the core dump to aid in debugging
XCOMM Option "NoTrapSignals"
XCOMM Uncomment this to disable the <Crtl><Alt><Fn> VT switch sequence
XCOMM (where n is 1 through 12). This allows clients to receive these key
XCOMM events.
XCOMM Option "DontVTSwitch"
XCOMM Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
XCOMM This allows clients to receive this key event.
XCOMM Option "DontZap"
XCOMM Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching
XCOMM sequences. This allows clients to receive these key events.
XCOMM Option "DontZoom"
XCOMM Uncomment this to disable tuning with the xvidtune client. With
XCOMM it the client can still run and fetch card and monitor attributes,
XCOMM but it will not be allowed to change them. If it tries it will
XCOMM receive a protocol error.
XCOMM Option "DisableVidModeExtension"
XCOMM Uncomment this to enable the use of a non-local xvidtune client.
XCOMM Option "AllowNonLocalXvidtune"
XCOMM Uncomment this to disable dynamically modifying the input device
XCOMM (mouse and keyboard) settings.
XCOMM Option "DisableModInDev"
XCOMM Uncomment this to enable the use of a non-local client to
XCOMM change the keyboard or mouse settings (currently only xset).
XCOMM Option "AllowNonLocalModInDev"
XCOMM Set the basic blanking screen saver timeout.
Option "blank time" "10" # 10 minutes
XCOMM Set the DPMS timeouts. These are set here because they are global
XCOMM rather than screen-specific. These settings alone don't enable DPMS.
XCOMM It is enabled per-screen (or per-monitor), and even then only when
XCOMM the driver supports it.
Option "standby time" "20"
Option "suspend time" "30"
Option "off time" "60"
XCOMM On some platform the server needs to estimate the sizes of PCI
XCOMM memory and pio ranges. This is done by assuming that PCI ranges
XCOMM don't overlap. Some broken BIOSes tend to set ranges of inactive
XCOMM devices wrong. Here one can adjust how aggressive the assumptions
XCOMM should be. Default is 0.
XCOMM Option "EstimateSizesAggresively" "0"
EndSection
XCOMM **********************************************************************
XCOMM Input devices
XCOMM **********************************************************************
XCOMM **********************************************************************
XCOMM Core keyboard's InputDevice section
XCOMM **********************************************************************
Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
XCOMM Set the keyboard auto repeat parameters. Not all platforms implement
XCOMM this.
Option "AutoRepeat" "500 5"
XCOMM Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)).
XCOMM Option "Xleds" "1 2 3"
XCOMM To disable the XKEYBOARD extension, uncomment XkbDisable.
XCOMM Option "XkbDisable"
XCOMM To customise the XKB settings to suit your keyboard, modify the
XCOMM lines below (which are the defaults). For example, for a European
XCOMM keyboard, you will probably want to use one of:
XCOMM
XCOMM Option "XkbModel" "pc102"
XCOMM Option "XkbModel" "pc105"
XCOMM
XCOMM If you have a Microsoft Natural keyboard, you can use:
XCOMM
XCOMM Option "XkbModel" "microsoft"
XCOMM
XCOMM If you have a US "windows" keyboard you will want:
XCOMM
XCOMM Option "XkbModel" "pc104"
XCOMM
XCOMM Then to change the language, change the Layout setting.
XCOMM For example, a german layout can be obtained with:
XCOMM
XCOMM Option "XkbLayout" "de"
XCOMM
XCOMM or:
XCOMM
XCOMM Option "XkbLayout" "de"
XCOMM Option "XkbVariant" "nodeadkeys"
XCOMM
XCOMM If you'd like to switch the positions of your capslock and
XCOMM control keys, use:
XCOMM
XCOMM Option "XkbOptions" "ctrl:swapcaps"
XCOMM These are the default XKB settings for xorg
XCOMM
XCOMM Option "XkbRules" "xorg"
XCOMM Option "XkbModel" "pc101"
XCOMM Option "XkbLayout" "us"
XCOMM Option "XkbVariant" ""
XCOMM Option "XkbOptions" ""
EndSection
XCOMM **********************************************************************
XCOMM Core Pointer's InputDevice section
XCOMM **********************************************************************
Section "InputDevice"
XCOMM Identifier and driver
Identifier "Mouse1"
Driver "mouse"
XCOMM The mouse protocol and device. The device is normally set to /dev/mouse,
XCOMM which is usually a symbolic link to the real device.
Option "Protocol" "Microsoft"
Option "Device" "/dev/mouse"
XCOMM On platforms where PnP mouse detection is supported the following
XCOMM protocol setting can be used when using a newer PnP mouse:
XCOMM Option "Protocol" "Auto"
XCOMM When using mouse connected to a PS/2 port (aka "MousePort"), set the
XCOMM the protocol as follows. On some platforms some other settings may
XCOMM be available.
XCOMM Option "Protocol" "PS/2"
XCOMM Baudrate and SampleRate are only for some older Logitech mice. In
XCOMM almost every case these lines should be omitted.
XCOMM Option "BaudRate" "9600"
XCOMM Option "SampleRate" "150"
XCOMM Emulate3Buttons is an option for 2-button mice
XCOMM Emulate3Timeout is the timeout in milliseconds (default is 50ms)
XCOMM Option "Emulate3Buttons"
XCOMM Option "Emulate3Timeout" "50"
XCOMM ChordMiddle is an option for some 3-button Logitech mice, or any
XCOMM 3-button mouse where the middle button generates left+right button
XCOMM events.
XCOMM Option "ChordMiddle"
EndSection
Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "Protocol" "MouseMan"
Option "Device" "/dev/mouse2"
EndSection
XCOMM Some examples of extended input devices
XCOMM Section "InputDevice"
XCOMM Identifier "spaceball"
XCOMM Driver "magellan"
XCOMM Option "Device" "/dev/cua0"
XCOMM EndSection
XCOMM
XCOMM Section "InputDevice"
XCOMM Identifier "spaceball2"
XCOMM Driver "spaceorb"
XCOMM Option "Device" "/dev/cua0"
XCOMM EndSection
XCOMM
XCOMM Section "InputDevice"
XCOMM Identifier "touchscreen0"
XCOMM Driver "microtouch"
XCOMM Option "Device" "/dev/ttyS0"
XCOMM Option "MinX" "1412"
XCOMM Option "MaxX" "15184"
XCOMM Option "MinY" "15372"
XCOMM Option "MaxY" "1230"
XCOMM Option "ScreenNumber" "0"
XCOMM Option "ReportingMode" "Scaled"
XCOMM Option "ButtonNumber" "1"
XCOMM Option "SendCoreEvents"
XCOMM EndSection
XCOMM
XCOMM Section "InputDevice"
XCOMM Identifier "touchscreen1"
XCOMM Driver "elo2300"
XCOMM Option "Device" "/dev/ttyS0"
XCOMM Option "MinX" "231"
XCOMM Option "MaxX" "3868"
XCOMM Option "MinY" "3858"
XCOMM Option "MaxY" "272"
XCOMM Option "ScreenNumber" "0"
XCOMM Option "ReportingMode" "Scaled"
XCOMM Option "ButtonThreshold" "17"
XCOMM Option "ButtonNumber" "1"
XCOMM Option "SendCoreEvents"
XCOMM EndSection
XCOMM **********************************************************************
XCOMM Monitor section
XCOMM **********************************************************************
XCOMM Any number of monitor sections may be present
Section "Monitor"
XCOMM The identifier line must be present.
Identifier "Generic Monitor"
XCOMM HorizSync is in kHz unless units are specified.
XCOMM HorizSync may be a comma separated list of discrete values, or a
XCOMM comma separated list of ranges of values.
XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
XCOMM HorizSync 31.5 # typical for a single frequency fixed-sync monitor
XCOMM HorizSync 30-64 # multisync
XCOMM HorizSync 31.5, 35.2 # multiple fixed sync frequencies
XCOMM HorizSync 15-25, 30-50 # multiple ranges of sync frequencies
XCOMM VertRefresh is in Hz unless units are specified.
XCOMM VertRefresh may be a comma separated list of discrete values, or a
XCOMM comma separated list of ranges of values.
XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S
XCOMM USER MANUAL FOR THE CORRECT NUMBERS.
XCOMM VertRefresh 60 # typical for a single frequency fixed-sync monitor
XCOMM VertRefresh 50-100 # multisync
XCOMM VertRefresh 60, 65 # multiple fixed sync frequencies
XCOMM VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies
XCOMM Modes can be specified in two formats. A compact one-line format, or
XCOMM a multi-line format.
XCOMM A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz)
XCOMM These two are equivalent
XCOMM ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525
Mode "640x480"
DotClock 25.175
HTimings 640 664 760 800
VTimings 480 491 493 525
EndMode
XCOMM These two are equivalent
XCOMM ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace
XCOMM Mode "1024x768i"
XCOMM DotClock 45
XCOMM HTimings 1024 1048 1208 1264
XCOMM VTimings 768 776 784 817
XCOMM Flags "Interlace"
XCOMM EndMode
XCOMM If a monitor has DPMS support, that can be indicated here. This will
XCOMM enable DPMS when the monitor is used with drivers that support it.
XCOMM Option "dpms"
XCOMM If a monitor requires that the sync signals be superimposed on the
XCOMM green signal, the following option will enable this when used with
XCOMM drivers that support it. Only a relatively small range of hardware
XCOMM (and drivers) actually support this.
XCOMM Option "sync on green"
EndSection
XCOMM **********************************************************************
XCOMM Graphics device section
XCOMM **********************************************************************
XCOMM Any number of graphics device sections may be present
Section "Device"
XCOMM The Identifier must be present.
Identifier "Generic VGA"
XCOMM The Driver line must be present. When using run-time loadable driver
XCOMM modules, this line instructs the server to load the specified driver
XCOMM module. Even when not using loadable driver modules, this line
XCOMM indicates which driver should interpret the information in this section.
Driver "vga"
XCOMM The chipset line is optional in most cases. It can be used to override
XCOMM the driver's chipset detection, and should not normally be specified.
XCOMM Chipset "generic"
XCOMM Various other lines can be specified to override the driver's automatic
XCOMM detection code. In most cases they are not needed.
XCOMM VideoRam 256
XCOMM Clocks 25.2 28.3
XCOMM The BusID line is used to specify which of possibly multiple devices
XCOMM this section is intended for. When this line isn't present, a device
XCOMM section can only match up with the primary video device. For PCI
XCOMM devices a line like the following could be used. This line should not
XCOMM normally be included unless there is more than one video device
XCOMM intalled.
XCOMM BusID "PCI:0:10:0"
XCOMM Various option lines can be added here as required. Some options
XCOMM are more appropriate in Screen sections, Display subsections or even
XCOMM Monitor sections.
XCOMM Option "hw cursor" "off"
EndSection
Section "Device"
Identifier "any supported Trident chip"
Driver "trident"
EndSection
Section "Device"
Identifier "MGA Millennium I"
Driver "mga"
Option "hw cursor" "off"
BusID "PCI:0:10:0"
EndSection
Section "Device"
Identifier "MGA G200 AGP"
Driver "mga"
BusID "PCI:1:0:0"
Option "pci retry"
EndSection
XCOMM **********************************************************************
XCOMM Screen sections.
XCOMM **********************************************************************
XCOMM Any number of screen sections may be present. Each describes
XCOMM the configuration of a single screen. A single specific screen section
XCOMM may be specified from the X server command line with the "-screen"
XCOMM option.
Section "Screen"
XCOMM The Identifier, Device and Monitor lines must be present
Identifier "Screen 1"
Device "Generic VGA"
Monitor "Generic Monitor"
XCOMM The favoured Depth and/or Bpp may be specified here
DefaultDepth 8
SubSection "Display"
Depth 8
Modes "640x480"
ViewPort 0 0
Virtual 800 600
EndSubsection
SubSection "Display"
Depth 4
Modes "640x480"
EndSubSection
SubSection "Display"
Depth 1
Modes "640x480"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen MGA1"
Device "MGA Millennium I"
Monitor "Generic Monitor"
Option "no accel"
DefaultDepth 16
XCOMM DefaultDepth 24
SubSection "Display"
Depth 8
Modes "1280x1024"
Option "rgb bits" "8"
Visual "StaticColor"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x1024"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen MGA2"
Device "MGA G200 AGP"
Monitor "Generic Monitor"
DefaultDepth 8
SubSection "Display"
Depth 8
Modes "1280x1024"
Option "rgb bits" "8"
Visual "StaticColor"
EndSubSection
EndSection
XCOMM **********************************************************************
XCOMM ServerLayout sections.
XCOMM **********************************************************************
XCOMM Any number of ServerLayout sections may be present. Each describes
XCOMM the way multiple screens are organised. A specific ServerLayout
XCOMM section may be specified from the X server command line with the
XCOMM "-layout" option. In the absence of this, the first section is used.
XCOMM When now ServerLayout section is present, the first Screen section
XCOMM is used alone.
Section "ServerLayout"
XCOMM The Identifier line must be present
Identifier "Main Layout"
XCOMM Each Screen line specifies a Screen section name, and optionally
XCOMM the relative position of other screens. The four names after
XCOMM primary screen name are the screens to the top, bottom, left and right
XCOMM of the primary screen. In this example, screen 2 is located to the
XCOMM right of screen 1.
Screen "Screen MGA 1" "" "" "" "Screen MGA 2"
Screen "Screen MGA 2" "" "" "Screen MGA 1" ""
XCOMM Each InputDevice line specifies an InputDevice section name and
XCOMM optionally some options to specify the way the device is to be
XCOMM used. Those options include "CorePointer", "CoreKeyboard" and
XCOMM "SendCoreEvents". In this example, "Mouse1" is the core pointer,
XCOMM and "Mouse2" is an extended input device that also generates core
XCOMM pointer events (i.e., both mice will move the standard pointer).
InputDevice "Mouse1" "CorePointer"
InputDevice "Mouse2" "SendCoreEvents"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
Section "ServerLayout"
Identifier "another layout"
Screen "Screen 1"
Screen "Screen MGA 1"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
Section "ServerLayout"
Identifier "simple layout"
Screen "Screen 1"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
| [
"91980991+AppleOSSDistributions@users.noreply.github.com"
] | 91980991+AppleOSSDistributions@users.noreply.github.com |
f1cf038b1e18e76262eb431d9c1e7c54bc5f0d9d | 5219cfd2306331c38f9da316c5d2eda520ef94b5 | /tests/types.cpp | 41e50550569485bad0da54594c6c37362d65dfa8 | [] | no_license | estelle0500/process-memory-viewer | a132cd7e363c11b6d7e36beb710b0cd30be4dbba | 23b48f0e83759a866a0b7acf4d94895f7017c430 | refs/heads/master | 2023-01-28T19:34:33.961210 | 2020-12-05T16:18:46 | 2020-12-05T16:19:04 | 301,021,703 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 765 | cpp | #include <iostream>
#include <unistd.h>
/*
This test program will run in an infinite loop.
Our ProcessMemoryViewer should be able to overwrite the `status` variable and break out of the loop.
*/
int main() {
static int l = 1336;
float f1 = 1337.0;
float f2 = 1337.5;
int leet = 1337;
double l33t = 1337.78;
double d1 = 1400.25;
double d2 = 1400.50;
double d3 = 1400.75;
double d4 = 1400.39;
std::cout << "Types started: find 1337!" << std::endl;
std::cout << f1 << "\t\t" << &f1 << "\n";
std::cout << f2 << "\t\t" << &f2 << "\n";
std::cout << leet << "\t\t" << &leet << "\n";
std::cout << l33t << "\t\t" << &l33t << "\n";
while(1){
sleep(10);
}
} | [
"tylervbarton@gmail.com"
] | tylervbarton@gmail.com |
52e50ee988364348fe19e0705bde7ed7efccc187 | a4b723f7f6988b52f6ca51a000829580e943e536 | /Hmwrk/CIS5Assign1/Gaddis_9th_Ch2_Problem18_EnergyDrinkConsumption/main.cpp | bdec9c0ebe270113ae235cc637e715adab37f5f1 | [] | no_license | KevinShih88/CIS5Winter2021 | 338691fb69312b5bf70f162901b1e221722c9fbe | 681f247bec8a436c37b8e88b915d496f29079f5b | refs/heads/master | 2023-02-24T08:00:28.660086 | 2021-01-25T21:50:49 | 2021-01-25T21:50:49 | 332,113,925 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,460 | cpp | /*
* File: main.cpp
* Author: Kevin Shih
* Created on January 5, 2021, 1948
* Purpose: Gaddis 9th Ch2 Problem18 EnergyDrinkConsumption
*/
//System Libraries
#include <iostream> //I/O Library
using namespace std;
//User Libraries
//Global Constants
//Math, Science, Universal, Conversions, High Dimensioned Arrays
//Function Prototypes
//Execution Begins Here
int main(int argc, char** argv) {
//Initialize the Random Number Seed
//Declare Variables
unsigned short int cust, //Customer base
loyals, //Number of loyal customers who buy 1+ per week
citrus; //Number of loyals who prefer citrus
float perLoyl, //Percent of customer base who buy 1+ per week
perCtrs; //Percent of loyal customers who prefer citrus
//Initialize Variables
cust = 16500;
perLoyl = .15f;
perCtrs = .58f;
//Map Inputs to Outputs -> Process
loyals = cust * perLoyl; //Calc # of loyals from customer base
citrus = loyals * perCtrs; //Calc # that prefer citrus from loyals
//Display Inputs/Outputs
cout << "Out of " << cust << " customers:" << endl;
cout << loyals << " of them purchase one or more." << endl;
cout << "Of those who purchase one or more per week:" << endl;
cout << citrus << " of them prefer citrus-flavored drinks" << endl;
//Exit the Program - Cleanup
return 0;
} | [
"kshih1@student.rccd.edu"
] | kshih1@student.rccd.edu |
73f89de1f83e51f66f7e93ddf70a462613c2a7b3 | 6f49cc2d5112a6b97f82e7828f59b201ea7ec7b9 | /wdbecmbd/CrdWdbeMod/PnlWdbeModRec.cpp | 31df7c5c6f6439591fdde0c75eb00e1e261be943 | [
"MIT"
] | permissive | mpsitech/wdbe-WhizniumDBE | d3702800d6e5510e41805d105228d8dd8b251d7a | 89ef36b4c86384429f1e707e5fa635f643e81240 | refs/heads/master | 2022-09-28T10:27:03.683192 | 2022-09-18T22:04:37 | 2022-09-18T22:04:37 | 282,705,449 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22,349 | cpp | /**
* \file PnlWdbeModRec.cpp
* job handler for job PnlWdbeModRec (implementation)
* \copyright (C) 2016-2020 MPSI Technologies GmbH
* \author Alexander Wirthmueller (auto-generation)
* \date created: 28 Nov 2020
*/
// IP header --- ABOVE
#ifdef WDBECMBD
#include <Wdbecmbd.h>
#else
#include <Wdbed.h>
#endif
#include "PnlWdbeModRec.h"
#include "PnlWdbeModRec_blks.cpp"
#include "PnlWdbeModRec_evals.cpp"
using namespace std;
using namespace Sbecore;
using namespace Xmlio;
// IP ns.cust --- INSERT
/******************************************************************************
class PnlWdbeModRec
******************************************************************************/
PnlWdbeModRec::PnlWdbeModRec(
XchgWdbe* xchg
, DbsWdbe* dbswdbe
, const ubigint jrefSup
, const uint ixWdbeVLocale
) :
JobWdbe(xchg, VecWdbeVJob::PNLWDBEMODREC, jrefSup, ixWdbeVLocale)
{
jref = xchg->addJob(dbswdbe, this, jrefSup);
pnlctrmncommand = NULL;
pnlcormnmodule = NULL;
pnlctdmnmodule = NULL;
pnlctrref1ncommand = NULL;
pnlmnperipheral = NULL;
pnlctrref1nerror = NULL;
pnlctrhk1nvector = NULL;
pnlmge1nsignal = NULL;
pnlref1nvariable = NULL;
pnlref1nsensitivity = NULL;
pnlref1nsignal = NULL;
pnlsup1nmodule = NULL;
pnlmdl1nport = NULL;
pnl1nprocess = NULL;
pnlhsm1npipeline = NULL;
pnlmdl1ngeneric = NULL;
pnlapar = NULL;
pnlkhdltype = NULL;
pnldetail = NULL;
// IP constructor.cust1 --- INSERT
// IP constructor.cust2 --- INSERT
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_TYPEQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_TPLEQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_SUPEQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_SUP_INSBS, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_INSBS, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_IMBEQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_HKUEQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_HKU_INSBS, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_CTREQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBEMDL_HKTEQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBECTR_CLREQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBECTR_FWD_INSBS, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBECTR_FWDEQ, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
xchg->addClstn(VecWdbeVCall::CALLWDBECTR_MDL_INSBS, jref, Clstn::VecVJobmask::TREE, 0, false, Arg(), 0, Clstn::VecVJactype::LOCK);
// IP constructor.cust3 --- INSERT
updatePreset(dbswdbe, VecWdbeVPreset::PREWDBEREFMOD, jref);
};
PnlWdbeModRec::~PnlWdbeModRec() {
// IP destructor.spec --- INSERT
// IP destructor.cust --- INSERT
xchg->removeJobByJref(jref);
};
// IP cust --- INSERT
DpchEngWdbe* PnlWdbeModRec::getNewDpchEng(
set<uint> items
) {
DpchEngWdbe* dpcheng = NULL;
if (items.empty()) {
dpcheng = new DpchEngWdbeConfirm(true, jref, "");
} else {
insert(items, DpchEngData::JREF);
dpcheng = new DpchEngData(jref, &continf, &statshr, items);
};
return dpcheng;
};
void PnlWdbeModRec::refresh(
DbsWdbe* dbswdbe
, set<uint>& moditems
, const bool unmute
) {
if (muteRefresh && !unmute) return;
muteRefresh = true;
ContInf oldContinf(continf);
StatShr oldStatshr(statshr);
// IP refresh --- BEGIN
// continf
continf.TxtRef = StubWdbe::getStubModStd(dbswdbe, recMdl.ref, ixWdbeVLocale, Stub::VecVNonetype::FULL);
// statshr
if (recMdl.ref == 0) statshr.ixWdbeVExpstate = VecWdbeVExpstate::MIND;
statshr.pnlctrhk1nvectorAvail = evalPnlctrhk1nvectorAvail(dbswdbe);
statshr.pnlctrref1nerrorAvail = evalPnlctrref1nerrorAvail(dbswdbe);
statshr.pnlctrref1ncommandAvail = evalPnlctrref1ncommandAvail(dbswdbe);
statshr.pnlctrmncommandAvail = evalPnlctrmncommandAvail(dbswdbe);
statshr.ButRegularizeActive = evalButRegularizeActive(dbswdbe);
if (statshr.ixWdbeVExpstate == VecWdbeVExpstate::MIND) {
if (pnldetail) {delete pnldetail; pnldetail = NULL;};
if (pnlkhdltype) {delete pnlkhdltype; pnlkhdltype = NULL;};
if (pnlapar) {delete pnlapar; pnlapar = NULL;};
if (pnlmdl1ngeneric) {delete pnlmdl1ngeneric; pnlmdl1ngeneric = NULL;};
if (pnlhsm1npipeline) {delete pnlhsm1npipeline; pnlhsm1npipeline = NULL;};
if (pnl1nprocess) {delete pnl1nprocess; pnl1nprocess = NULL;};
if (pnlmdl1nport) {delete pnlmdl1nport; pnlmdl1nport = NULL;};
if (pnlsup1nmodule) {delete pnlsup1nmodule; pnlsup1nmodule = NULL;};
if (pnlref1nsignal) {delete pnlref1nsignal; pnlref1nsignal = NULL;};
if (pnlref1nsensitivity) {delete pnlref1nsensitivity; pnlref1nsensitivity = NULL;};
if (pnlref1nvariable) {delete pnlref1nvariable; pnlref1nvariable = NULL;};
if (pnlmge1nsignal) {delete pnlmge1nsignal; pnlmge1nsignal = NULL;};
if (pnlctrhk1nvector) {delete pnlctrhk1nvector; pnlctrhk1nvector = NULL;};
if (pnlctrref1nerror) {delete pnlctrref1nerror; pnlctrref1nerror = NULL;};
if (pnlctrref1ncommand) {delete pnlctrref1ncommand; pnlctrref1ncommand = NULL;};
if (pnlmnperipheral) {delete pnlmnperipheral; pnlmnperipheral = NULL;};
if (pnlctdmnmodule) {delete pnlctdmnmodule; pnlctdmnmodule = NULL;};
if (pnlcormnmodule) {delete pnlcormnmodule; pnlcormnmodule = NULL;};
if (pnlctrmncommand) {delete pnlctrmncommand; pnlctrmncommand = NULL;};
} else {
if (!pnldetail) pnldetail = new PnlWdbeModDetail(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlkhdltype) pnlkhdltype = new PnlWdbeModKHdltype(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlapar) pnlapar = new PnlWdbeModAPar(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlmdl1ngeneric) pnlmdl1ngeneric = new PnlWdbeModMdl1NGeneric(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlhsm1npipeline) pnlhsm1npipeline = new PnlWdbeModHsm1NPipeline(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnl1nprocess) pnl1nprocess = new PnlWdbeMod1NProcess(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlmdl1nport) pnlmdl1nport = new PnlWdbeModMdl1NPort(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlsup1nmodule) pnlsup1nmodule = new PnlWdbeModSup1NModule(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlref1nsignal) pnlref1nsignal = new PnlWdbeModRef1NSignal(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlref1nsensitivity) pnlref1nsensitivity = new PnlWdbeModRef1NSensitivity(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlref1nvariable) pnlref1nvariable = new PnlWdbeModRef1NVariable(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlmge1nsignal) pnlmge1nsignal = new PnlWdbeModMge1NSignal(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlctrhk1nvector) pnlctrhk1nvector = new PnlWdbeModCtrHk1NVector(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlctrref1nerror) pnlctrref1nerror = new PnlWdbeModCtrRef1NError(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlctrref1ncommand) pnlctrref1ncommand = new PnlWdbeModCtrRef1NCommand(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlmnperipheral) pnlmnperipheral = new PnlWdbeModMNPeripheral(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlctdmnmodule) pnlctdmnmodule = new PnlWdbeModCtdMNModule(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlcormnmodule) pnlcormnmodule = new PnlWdbeModCorMNModule(xchg, dbswdbe, jref, ixWdbeVLocale);
if (!pnlctrmncommand) pnlctrmncommand = new PnlWdbeModCtrMNCommand(xchg, dbswdbe, jref, ixWdbeVLocale);
};
statshr.jrefDetail = ((pnldetail) ? pnldetail->jref : 0);
statshr.jrefKHdltype = ((pnlkhdltype) ? pnlkhdltype->jref : 0);
statshr.jrefAPar = ((pnlapar) ? pnlapar->jref : 0);
statshr.jrefMdl1NGeneric = ((pnlmdl1ngeneric) ? pnlmdl1ngeneric->jref : 0);
statshr.jrefHsm1NPipeline = ((pnlhsm1npipeline) ? pnlhsm1npipeline->jref : 0);
statshr.jref1NProcess = ((pnl1nprocess) ? pnl1nprocess->jref : 0);
statshr.jrefMdl1NPort = ((pnlmdl1nport) ? pnlmdl1nport->jref : 0);
statshr.jrefSup1NModule = ((pnlsup1nmodule) ? pnlsup1nmodule->jref : 0);
statshr.jrefRef1NSignal = ((pnlref1nsignal) ? pnlref1nsignal->jref : 0);
statshr.jrefRef1NSensitivity = ((pnlref1nsensitivity) ? pnlref1nsensitivity->jref : 0);
statshr.jrefRef1NVariable = ((pnlref1nvariable) ? pnlref1nvariable->jref : 0);
statshr.jrefMge1NSignal = ((pnlmge1nsignal) ? pnlmge1nsignal->jref : 0);
statshr.jrefCtrHk1NVector = ((pnlctrhk1nvector) ? pnlctrhk1nvector->jref : 0);
statshr.jrefCtrRef1NError = ((pnlctrref1nerror) ? pnlctrref1nerror->jref : 0);
statshr.jrefCtrRef1NCommand = ((pnlctrref1ncommand) ? pnlctrref1ncommand->jref : 0);
statshr.jrefMNPeripheral = ((pnlmnperipheral) ? pnlmnperipheral->jref : 0);
statshr.jrefCtdMNModule = ((pnlctdmnmodule) ? pnlctdmnmodule->jref : 0);
statshr.jrefCorMNModule = ((pnlcormnmodule) ? pnlcormnmodule->jref : 0);
statshr.jrefCtrMNCommand = ((pnlctrmncommand) ? pnlctrmncommand->jref : 0);
// IP refresh --- END
if (continf.diff(&oldContinf).size() != 0) insert(moditems, DpchEngData::CONTINF);
if (statshr.diff(&oldStatshr).size() != 0) insert(moditems, DpchEngData::STATSHR);
muteRefresh = false;
};
void PnlWdbeModRec::updatePreset(
DbsWdbe* dbswdbe
, const uint ixWdbeVPreset
, const ubigint jrefTrig
, const bool notif
) {
// IP updatePreset --- BEGIN
set<uint> moditems;
if (ixWdbeVPreset == VecWdbeVPreset::PREWDBEREFMOD) {
WdbeMModule* _recMdl = NULL;
WdbeMController* _recCtr = NULL;
WdbeMImbuf* _recImb = NULL;
if (dbswdbe->tblwdbemmodule->loadRecByRef(xchg->getRefPreset(VecWdbeVPreset::PREWDBEREFMOD, jref), &_recMdl)) {
recMdl = *_recMdl;
ixWSubsetMdl = dbswdbe->getIxWSubsetByWdbeMModule(_recMdl);
delete _recMdl;
} else {
recMdl = WdbeMModule();
ixWSubsetMdl = 0;
};
if (dbswdbe->tblwdbemcontroller->loadRecByRef(recMdl.refWdbeMController, &_recCtr)) {
recCtr = *_recCtr;
delete _recCtr;
} else recCtr = WdbeMController();
if (dbswdbe->tblwdbemimbuf->loadRecByRef(recMdl.refWdbeMImbuf, &_recImb)) {
recImb = *_recImb;
delete _recImb;
} else recImb = WdbeMImbuf();
if (recMdl.ref != 0) {
if (pnldetail) pnldetail->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlkhdltype) pnlkhdltype->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlapar) pnlapar->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlmdl1ngeneric) pnlmdl1ngeneric->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlhsm1npipeline) pnlhsm1npipeline->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnl1nprocess) pnl1nprocess->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlmdl1nport) pnlmdl1nport->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlsup1nmodule) pnlsup1nmodule->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlref1nsignal) pnlref1nsignal->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlref1nsensitivity) pnlref1nsensitivity->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlref1nvariable) pnlref1nvariable->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlmge1nsignal) pnlmge1nsignal->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlctrhk1nvector) pnlctrhk1nvector->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlctrref1nerror) pnlctrref1nerror->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlctrref1ncommand) pnlctrref1ncommand->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlmnperipheral) pnlmnperipheral->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlctdmnmodule) pnlctdmnmodule->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlcormnmodule) pnlcormnmodule->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
if (pnlctrmncommand) pnlctrmncommand->updatePreset(dbswdbe, ixWdbeVPreset, jrefTrig, notif);
};
refresh(dbswdbe, moditems);
if (notif && !moditems.empty()) xchg->submitDpch(getNewDpchEng(moditems));
};
// IP updatePreset --- END
};
void PnlWdbeModRec::minimize(
DbsWdbe* dbswdbe
, const bool notif
, DpchEngWdbe** dpcheng
) {
set<uint> moditems;
if (statshr.ixWdbeVExpstate != VecWdbeVExpstate::MIND) {
statshr.ixWdbeVExpstate = VecWdbeVExpstate::MIND;
insert(moditems, DpchEngData::STATSHR);
refresh(dbswdbe, moditems);
};
if (notif) {
if (dpcheng) *dpcheng = getNewDpchEng(moditems);
else if (!moditems.empty()) xchg->submitDpch(getNewDpchEng(moditems));
};
};
void PnlWdbeModRec::regularize(
DbsWdbe* dbswdbe
, const bool notif
, DpchEngWdbe** dpcheng
) {
set<uint> moditems;
if (statshr.ixWdbeVExpstate != VecWdbeVExpstate::REGD) {
statshr.ixWdbeVExpstate = VecWdbeVExpstate::REGD;
insert(moditems, DpchEngData::STATSHR);
refresh(dbswdbe, moditems);
};
if (notif) {
if (dpcheng) *dpcheng = getNewDpchEng(moditems);
else if (!moditems.empty()) xchg->submitDpch(getNewDpchEng(moditems));
};
};
void PnlWdbeModRec::handleRequest(
DbsWdbe* dbswdbe
, ReqWdbe* req
) {
if (req->ixVBasetype == ReqWdbe::VecVBasetype::CMD) {
reqCmd = req;
if (req->cmd == "cmdset") {
} else {
cout << "\tinvalid command!" << endl;
};
if (!req->retain) reqCmd = NULL;
} else if (req->ixVBasetype == ReqWdbe::VecVBasetype::DPCHAPP) {
if (req->dpchapp->ixWdbeVDpch == VecWdbeVDpch::DPCHAPPWDBEINIT) {
handleDpchAppWdbeInit(dbswdbe, (DpchAppWdbeInit*) (req->dpchapp), &(req->dpcheng));
} else if (req->dpchapp->ixWdbeVDpch == VecWdbeVDpch::DPCHAPPWDBEMODRECDO) {
DpchAppDo* dpchappdo = (DpchAppDo*) (req->dpchapp);
if (dpchappdo->ixVDo != 0) {
if (dpchappdo->ixVDo == VecVDo::BUTMINIMIZECLICK) {
handleDpchAppDoButMinimizeClick(dbswdbe, &(req->dpcheng));
} else if (dpchappdo->ixVDo == VecVDo::BUTREGULARIZECLICK) {
handleDpchAppDoButRegularizeClick(dbswdbe, &(req->dpcheng));
};
};
};
};
};
void PnlWdbeModRec::handleDpchAppWdbeInit(
DbsWdbe* dbswdbe
, DpchAppWdbeInit* dpchappwdbeinit
, DpchEngWdbe** dpcheng
) {
*dpcheng = getNewDpchEng({DpchEngData::ALL});
};
void PnlWdbeModRec::handleDpchAppDoButMinimizeClick(
DbsWdbe* dbswdbe
, DpchEngWdbe** dpcheng
) {
minimize(dbswdbe, true, dpcheng);
};
void PnlWdbeModRec::handleDpchAppDoButRegularizeClick(
DbsWdbe* dbswdbe
, DpchEngWdbe** dpcheng
) {
regularize(dbswdbe, true, dpcheng);
};
void PnlWdbeModRec::handleCall(
DbsWdbe* dbswdbe
, Call* call
) {
if (call->ixVCall == VecWdbeVCall::CALLWDBEMDLUPD_REFEQ) {
call->abort = handleCallWdbeMdlUpd_refEq(dbswdbe, call->jref);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEIMBUPD_REFEQ) {
call->abort = handleCallWdbeImbUpd_refEq(dbswdbe, call->jref);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBECTRUPD_REFEQ) {
call->abort = handleCallWdbeCtrUpd_refEq(dbswdbe, call->jref);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_TYPEQ) {
call->abort = handleCallWdbeMdl_typEq(dbswdbe, call->jref, call->argInv.ix, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_TPLEQ) {
call->abort = handleCallWdbeMdl_tplEq(dbswdbe, call->jref, call->argInv.ref, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_SUPEQ) {
call->abort = handleCallWdbeMdl_supEq(dbswdbe, call->jref, call->argInv.ref, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_SUP_INSBS) {
call->abort = handleCallWdbeMdl_sup_inSbs(dbswdbe, call->jref, call->argInv.ix, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_INSBS) {
call->abort = handleCallWdbeMdl_inSbs(dbswdbe, call->jref, call->argInv.ix, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_IMBEQ) {
call->abort = handleCallWdbeMdl_imbEq(dbswdbe, call->jref, call->argInv.ref, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_HKUEQ) {
call->abort = handleCallWdbeMdl_hkuEq(dbswdbe, call->jref, call->argInv.ref, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_HKU_INSBS) {
call->abort = handleCallWdbeMdl_hku_inSbs(dbswdbe, call->jref, call->argInv.ix, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_CTREQ) {
call->abort = handleCallWdbeMdl_ctrEq(dbswdbe, call->jref, call->argInv.ref, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBEMDL_HKTEQ) {
call->abort = handleCallWdbeMdl_hktEq(dbswdbe, call->jref, call->argInv.ix, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBECTR_CLREQ) {
call->abort = handleCallWdbeCtr_clrEq(dbswdbe, call->jref, call->argInv.ref, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBECTR_FWD_INSBS) {
call->abort = handleCallWdbeCtr_fwd_inSbs(dbswdbe, call->jref, call->argInv.ix, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBECTR_FWDEQ) {
call->abort = handleCallWdbeCtr_fwdEq(dbswdbe, call->jref, call->argInv.ref, call->argRet.boolval);
} else if (call->ixVCall == VecWdbeVCall::CALLWDBECTR_MDL_INSBS) {
call->abort = handleCallWdbeCtr_mdl_inSbs(dbswdbe, call->jref, call->argInv.ix, call->argRet.boolval);
};
};
bool PnlWdbeModRec::handleCallWdbeMdlUpd_refEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
) {
bool retval = false;
// IP handleCallWdbeMdlUpd_refEq --- INSERT
return retval;
};
bool PnlWdbeModRec::handleCallWdbeImbUpd_refEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
) {
bool retval = false;
// IP handleCallWdbeImbUpd_refEq --- INSERT
return retval;
};
bool PnlWdbeModRec::handleCallWdbeCtrUpd_refEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
) {
bool retval = false;
// IP handleCallWdbeCtrUpd_refEq --- INSERT
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_typEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const uint ixInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recMdl.ixVBasetype == ixInv); // IP handleCallWdbeMdl_typEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_tplEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const ubigint refInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recMdl.tplRefWdbeMModule == refInv); // IP handleCallWdbeMdl_tplEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_supEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const ubigint refInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recMdl.supRefWdbeMModule == refInv); // IP handleCallWdbeMdl_supEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_sup_inSbs(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const uint ixInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = ((dbswdbe->getIxWSubsetByRefWdbeMModule(recMdl.supRefWdbeMModule) & ixInv) != 0); // IP handleCallWdbeMdl_sup_inSbs --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_inSbs(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const uint ixInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = ((ixWSubsetMdl & ixInv) != 0); // IP handleCallWdbeMdl_inSbs --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_imbEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const ubigint refInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recMdl.refWdbeMImbuf == refInv); // IP handleCallWdbeMdl_imbEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_hkuEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const ubigint refInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recMdl.hkUref == refInv); // IP handleCallWdbeMdl_hkuEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_hku_inSbs(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const uint ixInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = ((dbswdbe->getIxWSubsetByRefWdbeMUnit(recMdl.hkUref) & ixInv) != 0); // IP handleCallWdbeMdl_hku_inSbs --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_ctrEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const ubigint refInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recMdl.refWdbeMController == refInv); // IP handleCallWdbeMdl_ctrEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeMdl_hktEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const uint ixInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recMdl.hkIxVTbl == ixInv); // IP handleCallWdbeMdl_hktEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeCtr_clrEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const ubigint refInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recCtr.clrRefWdbeMSignal == refInv); // IP handleCallWdbeCtr_clrEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeCtr_fwd_inSbs(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const uint ixInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = ((dbswdbe->getIxWSubsetByRefWdbeMUnit(recCtr.fwdRefWdbeMUnit) & ixInv) != 0); // IP handleCallWdbeCtr_fwd_inSbs --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeCtr_fwdEq(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const ubigint refInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = (recCtr.fwdRefWdbeMUnit == refInv); // IP handleCallWdbeCtr_fwdEq --- LINE
return retval;
};
bool PnlWdbeModRec::handleCallWdbeCtr_mdl_inSbs(
DbsWdbe* dbswdbe
, const ubigint jrefTrig
, const uint ixInv
, bool& boolvalRet
) {
bool retval = false;
boolvalRet = ((dbswdbe->getIxWSubsetByRefWdbeMModule(recCtr.refWdbeMModule) & ixInv) != 0); // IP handleCallWdbeCtr_mdl_inSbs --- LINE
return retval;
};
| [
"aw@mpsitech.com"
] | aw@mpsitech.com |
10f144bd037a0650a73f332935ef5504e16d296e | e1e43f3e90aa96d758be7b7a8356413a61a2716f | /datacommsserver/networkcontroller/ts_netcon/TestSuiteNetCon.cpp | 03eb09169e0cc7ce61a0e64ca29b197dc6cd3be6 | [] | no_license | SymbianSource/oss.FCL.sf.os.commsfw | 76b450b5f52119f6bf23ae8a5974c9a09018fdfa | bc8ac1a6d5273cbfa7852bbb8ce27d6ddc076984 | refs/heads/master | 2021-01-18T23:55:06.285537 | 2010-10-03T23:21:43 | 2010-10-03T23:21:43 | 72,773,202 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,540 | cpp | // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//
#include "TestSuiteNetCon.h"
#include "TestStepNetCon.h"
EXPORT_C CTestSuiteNetCon* NewTestSuiteNetConL()
//
// NewTestSuiteNetConL is exported at ordinal 1
// this provides the interface to allow schedule test
// to create instances of this test suite
//
{
return new(ELeave) CTestSuiteNetCon();
}
CTestSuiteNetCon::~CTestSuiteNetCon()
//
// D'tor
//
{
}
TPtrC CTestSuiteNetCon::GetVersion()
//
// Make a version string available for test system
//
{
_LIT(KTxtVersion,"1.0");
return KTxtVersion();
}
void CTestSuiteNetCon::AddTestStepL(CTestStepNetCon* aTestStep)
//
// Add a test step into the suite
//
{
// test steps contain a pointer back to the suite which owns them
aTestStep->iTestSuite = this;
// add the step using tyhe base class method
CTestSuite::AddTestStepL(aTestStep);
}
void CTestSuiteNetCon::InitialiseL()
//
// Constructor for NetCon test suite
// this creates the NetCon test step and
// stores it inside CTestSuiteNetCon
//
{
// add test steps
for(TInt i=1; i<43; ++i)
{
AddTestStepL(new(ELeave) CTestStepNetCon(i));
}
}
| [
"kirill.dremov@nokia.com"
] | kirill.dremov@nokia.com |
da18337a2f6bd4ae4a24172cff0b8b81049e3725 | a3b48ee5c335eb4545572c3175cdece4969cdedd | /TestGameProject/src/ECS/ProjectileComponent.h | 33224ffb6973067c1b0ab0e6e58035860fa520e7 | [] | no_license | selestiel/TestGameProject_sol | 16def559fb86db2020a31a7930f2a4b33a4c784f | 9daeb03c70a2fcdb56f2b3e24dacecc13ba42c95 | refs/heads/master | 2022-11-28T05:57:57.679256 | 2020-08-06T11:41:40 | 2020-08-06T11:41:40 | 283,966,685 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 952 | h | #pragma once
#include "ECS.h"
#include "Components.h"
#include "../Vector2D.h"
class ProjectileComponent : public Component
{
public:
ProjectileComponent(int rng, int sp, Vector2D vel) : range(rng), speed(sp), velocity(vel)
{
}
~ProjectileComponent()
{}
void init() override
{
transform = &entity->getComponent<TransformComponent>();
transform->velocity = velocity;
}
void update() override
{
distance += speed;
if (distance > range)
{
std::cout << "Out of Range" << std::endl;
entity->destroy();
}
else if (transform->position.x > Game::camera.x + Game::camera.w ||
transform->position.x < Game::camera.x ||
transform->position.y > Game::camera.y + Game::camera.h ||
transform->position.y < Game::camera.y)
{
std::cout << "Out of bounds!" << std::endl;
entity->destroy();
}
}
private:
TransformComponent* transform;
int range = 0;
int speed = 0;
int distance = 0;
Vector2D velocity;
}; | [
"selarch2018@gmail.com"
] | selarch2018@gmail.com |
5ab014c894506f1cf05111b4ef7c68f613658335 | 31432314f584e6ccb9249d8b5a763d7948cc891f | /src/game/entities/Office.cpp | 59781fadd62205f489f2848ac3e44b2552e79fdf | [] | no_license | Smeshan/Elevator-rush | d6ab917f05a7a7963176164e259fa10e3ded1654 | 2edf42c748ddd235386bd96256ede1ee0349aae9 | refs/heads/master | 2023-09-05T14:59:29.220081 | 2021-11-12T13:43:59 | 2021-11-12T13:43:59 | 427,373,554 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,296 | cpp | /* Corresponding header */
#include "game/entities/Office.h"
/* C system icnludes */
/* C++ system icnludes */
#include <string>
#include <memory>
/* Third-party icnludes */
/* Own icnludes */
#include "common/CommonDefines.h"
#include "game/levels/LevelPos.h"
constexpr auto REQUEST_TEXT_POS_X = 120;
constexpr auto REQUEST_TEXT_POS_Y = 20;
int32_t Office::init(const int32_t floor, const int32_t column) {
LevelPos levelPos(floor, column, TileType::OFFICE);
_floorNumber = levelPos.floor;
_pos = levelPos.pos;
_floorImg.create(TextureId::BLUE_OFFICES, _pos);
_floorImg.setFrame(_floorNumber);
_pos.x += REQUEST_TEXT_POS_X;
_pos.y += REQUEST_TEXT_POS_Y;
const char* requestNumText = std::to_string(_requests).c_str();
_requestsImg.create(requestNumText, FontId::TERMINAL_20, Colors::WHITE, _pos);
return EXIT_SUCCESS;
}
void Office::deinit() {
}
void Office::draw() {
_floorImg.draw();
_requestsImg.draw();
}
void Office::increaseRequests() {
_requests++;
const char* requestNumText = std::to_string(_requests).c_str();
_requestsImg.setText(requestNumText);
}
void Office::decreaseRequests() {
_requests--;
const char* requestNumText = std::to_string(_requests).c_str();
_requestsImg.setText(requestNumText);
} | [
"ilian.pavlov@hotmail.com"
] | ilian.pavlov@hotmail.com |
2db484cad1a1738a6f57d7edaa22533353cb1204 | ee92057a8ebc91ba90d8055a9bece25d24211499 | /kattis/apaxiaaans/apaxiaaans.cpp | 3527bafd9075e1618e3d2540e15d72de1a6f6ddd | [] | no_license | KendrickAng/competitive-programming | ce0a4f44f592f295c2f8cd7e854139f18fb8853a | f9768a2020f801b8e4787cc853398b8258a0bf09 | refs/heads/master | 2022-05-29T07:21:32.607089 | 2022-04-24T16:35:14 | 2022-04-24T16:35:14 | 254,402,307 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 294 | cpp | #include <iostream>
#include <string>
int main() {
char p1;
std::string in;
std::string out = "";
std::cin >> in;
for (char c: in) {
if (c != p1) {
p1 = c;
out.push_back(c);
}
}
std::cout << out << std::endl;
} | [
"kendrick.wh@outlook.com"
] | kendrick.wh@outlook.com |
ccc0fa32d994f7aa0ff8216984786e758cfd5615 | 1a1b98a049063b542c85c5f767e1a8227baa0799 | /359.cpp | 7cc5c3ee2c4d2ae7559c05df888e4a5f4e20d974 | [] | no_license | Bhabaranjan19966/COMPETITIVE-PROGRAMMING--ACCEPTED-CODE | 79fdcf60147a66efbeaf35e159195d9fb2e7695a | 9c8e0ea035e4b5cfd0c77134e54f3fe83b3e55fb | refs/heads/master | 2020-03-28T21:26:39.318002 | 2018-09-17T16:39:03 | 2018-09-17T16:39:03 | 149,156,737 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 364 | cpp | #include<cstdio>
#include<iostream>
#define S scanf
#define P printf
using namespace std;
int main()
{
int n,k;
S("%d%d",&n,&k);
for(int i=0;i<n;i++)
{
if(k)
{
k--;
P("%d %d ",(2*i)+2,(2*i)+1);
}
else
{
P("%d %d ",(2*i)+1,(2*i)+2);
}
}
}
| [
"bhabaranjanpanigrahi@gmail.com"
] | bhabaranjanpanigrahi@gmail.com |
dff2d1261f0a718e2ad5145e2d8e20a8a23311b0 | e322601be596113f64efbeb819b24f714c55c007 | /src/merkleblock.h | d60d1abf8abda3c7a82476762b2f9ea5bb7ed3ae | [
"MIT"
] | permissive | Securypto/Securypto-testv1 | e01439cef654f1fa98def7c327f49e94907d60a5 | 8569bac47c392243604123dcaf2b4aacb229b5f3 | refs/heads/master | 2020-04-05T17:57:27.019866 | 2019-01-18T07:52:11 | 2019-01-18T07:52:11 | 157,082,952 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,506 | h | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2017 The Securypto developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_MERKLEBLOCK_H
#define BITCOIN_MERKLEBLOCK_H
#include "bloom.h"
#include "primitives/block.h"
#include "serialize.h"
#include "uint256.h"
#include <vector>
/** Data structure that represents a partial merkle tree.
*
* It represents a subset of the txid's of a known block, in a way that
* allows recovery of the list of txid's and the merkle root, in an
* authenticated way.
*
* The encoding works as follows: we traverse the tree in depth-first order,
* storing a bit for each traversed node, signifying whether the node is the
* parent of at least one matched leaf txid (or a matched txid itself). In
* case we are at the leaf level, or this bit is 0, its merkle node hash is
* stored, and its children are not explorer further. Otherwise, no hash is
* stored, but we recurse into both (or the only) child branch. During
* decoding, the same depth-first traversal is performed, consuming bits and
* hashes as they written during encoding.
*
* The serialization is fixed and provides a hard guarantee about the
* encoded size:
*
* SIZE <= 10 + ceil(32.25*N)
*
* Where N represents the number of leaf nodes of the partial tree. N itself
* is bounded by:
*
* N <= total_transactions
* N <= 1 + matched_transactions*tree_height
*
* The serialization format:
* - uint32 total_transactions (4 bytes)
* - varint number of hashes (1-3 bytes)
* - uint256[] hashes in depth-first order (<= 32*N bytes)
* - varint number of bytes of flag bits (1-3 bytes)
* - byte[] flag bits, packed per 8 in a byte, least significant bit first (<= 2*N-1 bits)
* The size constraints follow from this.
*/
class CPartialMerkleTree
{
protected:
/** the total number of transactions in the block */
unsigned int nTransactions;
/** node-is-parent-of-matched-txid bits */
std::vector<bool> vBits;
/** txids and internal hashes */
std::vector<uint256> vHash;
/** flag set when encountering invalid data */
bool fBad;
/** helper function to efficiently calculate the number of nodes at given height in the merkle tree */
unsigned int CalcTreeWidth(int height)
{
return (nTransactions + (1 << height) - 1) >> height;
}
/** calculate the hash of a node in the merkle tree (at leaf level: the txid's themselves) */
uint256 CalcHash(int height, unsigned int pos, const std::vector<uint256>& vTxid);
/** recursive function that traverses tree nodes, storing the data as bits and hashes */
void TraverseAndBuild(int height, unsigned int pos, const std::vector<uint256>& vTxid, const std::vector<bool>& vMatch);
/**
* recursive function that traverses tree nodes, consuming the bits and hashes produced by TraverseAndBuild.
* it returns the hash of the respective node.
*/
uint256 TraverseAndExtract(int height, unsigned int pos, unsigned int& nBitsUsed, unsigned int& nHashUsed, std::vector<uint256>& vMatch);
public:
/** serialization implementation */
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
{
READWRITE(nTransactions);
READWRITE(vHash);
std::vector<unsigned char> vBytes;
if (ser_action.ForRead()) {
READWRITE(vBytes);
CPartialMerkleTree& us = *(const_cast<CPartialMerkleTree*>(this));
us.vBits.resize(vBytes.size() * 8);
for (unsigned int p = 0; p < us.vBits.size(); p++)
us.vBits[p] = (vBytes[p / 8] & (1 << (p % 8))) != 0;
us.fBad = false;
} else {
vBytes.resize((vBits.size() + 7) / 8);
for (unsigned int p = 0; p < vBits.size(); p++)
vBytes[p / 8] |= vBits[p] << (p % 8);
READWRITE(vBytes);
}
}
/** Construct a partial merkle tree from a list of transaction id's, and a mask that selects a subset of them */
CPartialMerkleTree(const std::vector<uint256>& vTxid, const std::vector<bool>& vMatch);
CPartialMerkleTree();
/**
* extract the matching txid's represented by this partial merkle tree.
* returns the merkle root, or 0 in case of failure
*/
uint256 ExtractMatches(std::vector<uint256>& vMatch);
};
/**
* Used to relay blocks as header + vector<merkle branch>
* to filtered nodes.
*/
class CMerkleBlock
{
public:
/** Public only for unit testing */
CBlockHeader header;
CPartialMerkleTree txn;
public:
/** Public only for unit testing and relay testing (not relayed) */
std::vector<std::pair<unsigned int, uint256> > vMatchedTxn;
/**
* Create from a CBlock, filtering transactions according to filter
* Note that this will call IsRelevantAndUpdate on the filter for each transaction,
* thus the filter will likely be modified.
*/
CMerkleBlock(const CBlock& block, CBloomFilter& filter);
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
{
READWRITE(header);
READWRITE(txn);
}
};
#endif // BITCOIN_MERKLEBLOCK_H
| [
"root@S004.securypto.io"
] | root@S004.securypto.io |
ef2e3cc3aa4f3b3a79289e7f7d3a116db7cb6ce1 | 5456502f97627278cbd6e16d002d50f1de3da7bb | /chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc | 7ebbcb01e96101292be43eae6eb6abe38582d238 | [
"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 | 1,147 | cc | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/common/extensions/chrome_manifest_url_handlers.h"
#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/permissions/permissions_data.h"
#include "testing/gtest/include/gtest/gtest.h"
class DevToolsPageManifestTest : public ChromeManifestTest {
};
TEST_F(DevToolsPageManifestTest, DevToolsExtensions) {
LoadAndExpectError("devtools_extension_url_invalid_type.json",
extensions::manifest_errors::kInvalidDevToolsPage);
scoped_refptr<extensions::Extension> extension;
extension = LoadAndExpectSuccess("devtools_extension.json");
EXPECT_EQ(extension->url().spec() + "devtools.html",
extensions::chrome_manifest_urls::GetDevToolsPage(extension.get())
.spec());
EXPECT_TRUE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
}
| [
"lixiaodonglove7@aliyun.com"
] | lixiaodonglove7@aliyun.com |
f931289226805449bcbdc4e91718e13a037e8da5 | ae14d7582407bdf04c3cd10900e8f6576fc2fad0 | /advanced_cpp/day5/4_forward3.cpp | 12bcaa6fdad1e90b13863ceaa8b9e0351a081936 | [] | no_license | jingal/Lecture | feebab4283353a79dd410cbead22cd67d652a929 | c1c1709bc3effbc4883970f1439a4c6a24531ae0 | refs/heads/master | 2021-01-19T20:11:18.543858 | 2018-04-27T06:50:39 | 2018-04-27T06:50:39 | 88,491,615 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 598 | cpp | //4_forward2
#include <iostream>
using namespace std;
void hoo(int&& a) {}
void foo(int& a) {}
// main => lockAndCall => 원본함수
// n => t(lvalue), T:int& => foo(int&)
// 10 => t(lvalue), T:int => hoo(int&&)
template<typename F, typename T>
void lockAndCall(F f, T&& t)
{
//f(std::forward<T>(t));
// n일 때 : T => int&, T&& : int&
// 10일 때 : T => int, T&& : int&&
//f(static_cast<T&&>(t));
f(forward<T>(t)); //이 코드가 위와 동일한 캐스팅
}
int main()
{
int n = 10;
lockAndCall(foo, n); // T : int
lockAndCall(hoo, 10); // T : int&&
} | [
"ilovejinjoo@gmail.com"
] | ilovejinjoo@gmail.com |
354e0980bbce88ddffdffe5ffa34f3b1329c8457 | 04bc90b8f69c04eff30c49309c6a941f690e5c87 | /c++/Problems/CommonSubString.cpp | 4e959290b06dca1aa19ec55d4dc96d4948a8dc1f | [] | no_license | pkbehera/BoiledFrogs | c0eddcc47bcee59f3225d80a3b1eec6c5af5c51a | 890f2b7268661178303996b50eee2bcd1d7fa518 | refs/heads/master | 2021-01-20T17:02:40.519715 | 2017-03-21T15:17:54 | 2017-03-21T15:18:04 | 61,060,154 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 891 | cpp | #include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
class Node {
char _c;
Node* _n1;
Node* _n2;
public:
Node(char c) {
_n1 = NULL;
_n2 = NULL;
};
void n1(Node* n) { _n1 = n; };
void n2(Node* n) { _n2 = n; };
Node* n1() { return _n1; };
Node* n2() { return _n2; };
char c() { return _c; };
};
void create(string &s1, string &s2, Node* h1, Node* h2) {
h1 = NULL;
Node* p = NULL;
for (char c : s1) {
cout << c;
Node *n = new Node(c);
if (p != NULL) {
p->n1(n);
}
p = n;
if (h1 == NULL) {
h1 = p;
}
}
}
void print(Node* h) {
Node* p = h;
while (p != NULL) {
cout << p->c();
p = p->n1();
}
cout << endl;
}
int main(int argc, char const *argv[]) {
string s1, s2;
getline(cin, s1);
getline(cin, s2);
Node *h1, *h2;
create(s1, s2, h1, h2);
print(h1);
return 0;
}
| [
"pkbehera@lycos.com"
] | pkbehera@lycos.com |
4a49fbcddd6df3cb503113b1033a8d9bc248925d | 574933565e69f1fadd4982aee98bfe48eaa94191 | /C_С++/OOP/labs/pract4/MDate.h | 66f32c5c9419514f228c7343f5a96d443569cf60 | [] | no_license | andryuha24/CourseBachelorKRSU | 96f831666f9ba57a5ae9fd2a74210aea2258c87d | 542b9ddfd9db8dbf039a03390796e61347c74f22 | refs/heads/master | 2021-01-12T13:32:31.424327 | 2018-02-03T17:30:40 | 2018-02-03T17:30:40 | 69,844,356 | 1 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 923 | h | #ifndef MDATE_H_INCLUDED
#define MDATE_H_INCLUDED
class MDate
{
private:
long fullDate;
long to_LongDate(int y, int m, int d);
void from_LongDate(int &y,int &m,int &d);
public:
MDate(); //Конструктор без парметров
MDate(int y, int m, int d); //Конструктор с параметрами
~MDate(){}; //Деструктор
int getYear();
int getMonth();
int getDay();
void setYear(int);
void setMonth(int);
void setDay(int);
long diffDate( const MDate &, int num); //получить разницу: 1-в днях, 2-в месяцах, 3-в годах
int equals(const MDate &);
int more(const MDate &);
int less(const MDate &);
void showDate(int type); //type: 1-“15.12.2006”, 2- “15 December 2006”
};
#endif // MDATE_H_INCLUDED
| [
"Al-Catraz2023@mail.ru"
] | Al-Catraz2023@mail.ru |
ff71543cd9905b793b4c7c67f74f32c4c8b21f8d | 9103d2fd8002fa57b0a5bab5eea8dbc519236212 | /Project4/Project4/源6.cpp | 20aff42cf65edb128f95811803bc7bc8e574a382 | [] | no_license | guettian/huaweioj | b11d7af31fa4ebe0a84d25d4f7a2ef06d631df58 | cfb28654a61aefaa0288289b8f95b3095f286f65 | refs/heads/master | 2020-04-25T05:29:20.769607 | 2015-09-12T14:04:38 | 2015-09-12T14:04:38 | 41,990,729 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,255 | cpp | /*
名字的漂亮度
测试通过,未能通过OJ
*/
#include <iostream>
#include <string>
using namespace std;
//#define LEN (26);
int calcbeauty(string s) //寻找字符串出现次数最多的字符
{
int len = s.length();
int num[26] = {0};
int index,temp;
int result = 0;
string::iterator iter;
for(iter = s.begin(); iter !=s.end(); ++iter)
{
if((*iter >= 'a')&&(*iter <= 'z'))
{
index = static_cast<int>(*iter - 'a');
num[index]++;
}
if((*iter >= 'A')&&(*iter <= 'Z'))
{
index = static_cast<int>(*iter - 'A');
num[index]++;
}
}
for(int i = 0; i < 26; i++)
{
for(int j = 25; j > i; j--)
{
if(num[j-1] < num[j])
{
temp = num[j];
num[j] = num[j-1];
num[j-1] = temp;
}
}
}
int shu = 26;
for(int k = 0; k <= 25; k++)
{
if(num[k] != 0)
{
result += num[k]*shu;
shu --;
}
}
return result;
}
int main6()
{
string name[3];
int beauty[3];
// cin >> name[0] >> name[1] >> name[2];
getline(cin, name[0]);
getline(cin, name[1]);
getline(cin, name[2]);
for(int i = 0; i <= 2; i++)
{
beauty[i] = calcbeauty(name[i]);
if(beauty[i] != 0)
cout << beauty[i] << '\n';
}
cout << endl;
system("PAUSE");
return 0;
} | [
"guettian@163.com"
] | guettian@163.com |
b4d3de2dc7a01c463da16787f8b72c3ddb86b8e6 | 27321d208c28f6ed96255998dfe5de16d512fdc4 | /Source/TextToSpeechLibrary.cpp | fcb89707e528df015f497d566063ad72ffd3c0e5 | [] | no_license | yar3333/text-to-speech-ue4 | 850adbaaa6321c8f5b17d2213df0cc7c2d81375b | 213aef73a688807e78393402fd67385ab9f2ccc9 | refs/heads/master | 2022-05-04T17:42:29.675561 | 2022-04-12T10:14:34 | 2022-04-12T10:14:34 | 159,508,032 | 37 | 11 | null | 2022-04-12T10:14:35 | 2018-11-28T13:40:08 | C++ | UTF-8 | C++ | false | false | 508 | cpp | #include "TextToSpeechLibrary.h"
#include "TextToSpeechPCH.h"
#include "TextToSpeechSoundWave.h"
UTextToSpeechLibrary::UTextToSpeechLibrary(const class FObjectInitializer& PCIP) : Super(PCIP)
{
}
USoundWave* UTextToSpeechLibrary::TextToWave(FString VoiceRequiredAttributes, FString VoiceOptionalAttributes, int32 Rate, FString Text)
{
auto TTSSoundWave = NewObject<UTextToSpeechSoundWave>();
TTSSoundWave->Initialize(VoiceRequiredAttributes, VoiceOptionalAttributes, Rate, Text);
return TTSSoundWave;
}
| [
"yar3333@gmail.com"
] | yar3333@gmail.com |
fdd956fc13f00654a68acde39d3fd2894802bccd | 98b7701ff6a50768b5ba64510a283fd7796228f7 | /hardwares/flow_control/Pump.cpp | 22b4ef52af73aa91a408e60838d03841dcdaa746 | [] | no_license | asef18766/ESD_farm_node | 9e79679b28839bc088ac791f8faa93ffa0d4e0a7 | c2924975c406d6d91b07e3e083b04e54ba037468 | refs/heads/master | 2023-02-19T06:22:32.408756 | 2020-12-30T19:14:55 | 2020-12-30T19:14:55 | 321,146,521 | 0 | 0 | null | 2020-12-30T11:29:58 | 2020-12-13T19:46:25 | C++ | UTF-8 | C++ | false | false | 821 | cpp | #include "Pump.h"
volatile int flow_frequency; // Measures flow meter pulses
bool PUMP_SWITCH = true;
void flow() // Interrupt function
{
flow_frequency++;
}
void PumpSetUp()
{
pinMode(PUMP_PIN, OUTPUT);
pinMode(FLOWMETER_PIN, INPUT);
attachInterrupt(digitalPinToInterrupt(FLOWMETER_PIN), flow, RISING);
sei();
}
float ReadFlowMeter()
{
// Pulse frequency (Hz) = 7.5Q, Q is flow rate in L/min. (Results in +/- 3% range)
float ml = (( flow_frequency / 7.5 ) * 1000) / 60;
flow_frequency = 0;
return ml;
}
void PumpTick()
{
if(PUMP_SWITCH)
{
analogWrite(PUMP_PIN, 255);
}
else
{
analogWrite(PUMP_PIN, 0);
}
}
void OnPump()
{
PUMP_SWITCH = true;
Serial.println("{turn on}");
}
void OffPump()
{
PUMP_SWITCH = false;
Serial.println("{turn off}");
}
| [
"asef18766@gmail.com"
] | asef18766@gmail.com |
ffca56f8a25f495d83c18dc5fd7126452b4d8d9d | 2424ff321dd70fa210bc525fd3641ff2818ad1b2 | /jctvc_crawler.cpp | 0d3783943ee8f98dfed893bf50c3948ec394becd | [] | no_license | hankrof/jctvc_document_system_fetcher | b4fe4b0c5d5728978f3f0951dc94a0b7be061000 | b7cc049db9db30dcccde10506afdf093e173e9d1 | refs/heads/master | 2020-04-05T11:36:10.738642 | 2018-11-09T09:41:37 | 2018-11-09T09:41:37 | 156,840,918 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 172 | cpp | #include "jctvc_crawler.h"
JCTVCAllMeetingPageCrawler::JCTVCAllMeetingPageCrawler()
: HTMLCrawler("http://phenix.int-evry.fr/jct/doc_end_user/all_meeting.php")
{
}
| [
"hankrof@gmail.com"
] | hankrof@gmail.com |
98c4a72ef83ca0055064e30c5f2a5a6c9315236c | 43e1578e82c17ad4fe3022a6699f4310e563e949 | /LGPOperators/LGPOperator_Exp.cpp | 1a4785999d51ff142caaba78dc83ef477bb2371f | [
"MIT"
] | permissive | chen0040/cpp-mfc-fractal-art-iec-lgp | 1877c864c0be612473876f6a7e5e6c61603a7a9e | 108b6ca40f73accc7959da5da0fdcb963136ad0c | refs/heads/master | 2021-01-23T18:31:36.810457 | 2017-09-08T00:43:11 | 2017-09-08T00:43:11 | 102,797,517 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,897 | cpp | #include "stdafx.h"
#include "LGPOperator_Exp.h"
#include "../LGPConstants/LGPProtectedDefinition.h"
#include <cmath>
#include <sstream>
LGPOperator_Exp::LGPOperator_Exp()
: LGPOperator("exp")
{
m_method_name="lgp_exp";
}
LGPOperator_Exp::~LGPOperator_Exp()
{
}
int LGPOperator_Exp::Execute(const LGPRegister *operand1, const LGPRegister *operand2, LGPRegister *destination_register)
{
// Xianshun says:
// the protected definition in Linear Genetic Programming is used
double x=operand1->ToDouble();
double y=operand2->ToDouble();
if(fabs(x) < 32)
{
if(y != 0)
{
destination_register->SetValue(exp(x / y));
}
else
{
destination_register->SetValue(exp(x));
}
}
else
{
destination_register->SetValue(x+LGP_UNDEFINED);
}
return LGP_EXECUTE_NEXT_INSTRUCTION;
}
std::string LGPOperator_Exp::GetOperatorContent(std::string operand1, std::string operand2, std::string destination_register, std::string line_start, std::string line_end) const
{
std::ostringstream oss;
oss << line_start << "if(fabs(" << operand1 << ") < 32)" << line_end;
oss << line_start << "{" << line_end;
oss << line_start << line_start << "if(" << operand2 << " != 0)" << line_end;
oss << line_start << line_start << line_start << destination_register << "=exp(" << operand1 << "/" << operand2 << ");" << line_end;
oss << line_start << line_start << "else" << line_end;
oss << line_start << line_start << line_start << destination_register << "=exp(" << operand1 << ");" << line_end;
oss << line_start << "}" << line_end;
oss << line_start << "else" << line_end;
oss << line_start << "{" << line_end;
oss << line_start << line_start << destination_register << "=" << operand1 << "+" << LGP_UNDEFINED << ";" << line_end;
oss << line_start << "}" << line_end;
return oss.str();
}
std::string LGPOperator_Exp::GetOperatorRequiredHeaderFiles() const
{
return "#include <cmath>\n";
} | [
"xs0040@gmail.com"
] | xs0040@gmail.com |
464fffda96f2b5e8b4ca7fa254786983007b6f2b | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/squid/hunk_6955.cpp | f390a417ac9dc93fd4e8cbe6de72cb86828b3d1a | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 31,515 | cpp | +/*
+ * Abstract Syntax Notation One, ASN.1
+ * As defined in ISO/IS 8824 and ISO/IS 8825
+ * This implements a subset of the above International Standards that
+ * is sufficient to implement SNMP.
+ *
+ * Encodes abstract data types into a machine independent stream of bytes.
+ *
+ */
+/**********************************************************************
+ Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+******************************************************************/
+#ifdef KINETICS
+#include "gw.h"
+#endif
+
+#ifdef linux
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#endif
+
+#include <sys/types.h>
+#include <netinet/in.h>
+
+#ifdef vms
+#include <in.h>
+#endif
+
+
+#include "asn1.h"
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifdef DEBUG
+#define ERROR(string) printf("%s(%d): %s",__FILE__, __LINE__, string);
+#else
+#define ERROR(string)
+#endif
+
+
+/*
+ * asn_parse_int - pulls a long out of an ASN int type.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the end of this object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_int(data, datalength, type, intp, intsize)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char *type; /* OUT - asn type of object */
+ long *intp; /* IN/OUT - pointer to start of output buffer */
+ int intsize; /* IN - size of output buffer */
+{
+/*
+ * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+ */
+ u_char *bufp = data;
+ u_long asn_length;
+ long value = 0;
+
+ if (intsize != sizeof (long)){
+ ERROR("not long");
+ return NULL;
+ }
+ *type = *bufp++;
+ bufp = asn_parse_length(bufp, &asn_length);
+ if (bufp == NULL){
+ ERROR("bad length");
+ return NULL;
+ }
+ if (asn_length + (bufp - data) > *datalength){
+ ERROR("overflow of message");
+ return NULL;
+ }
+ if (asn_length > intsize){
+ ERROR("I don't support such large integers");
+ return NULL;
+ }
+ *datalength -= (int)asn_length + (bufp - data);
+ if (*bufp & 0x80)
+ value = -1; /* integer is negative */
+ while(asn_length--)
+ value = (value << 8) | *bufp++;
+ *intp = value;
+ return bufp;
+}
+
+
+/*
+ * asn_parse_unsigned_int - pulls an unsigned long out of an ASN int type.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the end of this object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_unsigned_int(data, datalength, type, intp, intsize)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ u_char *type; /* OUT - asn type of object */
+ u_long *intp; /* IN/OUT - pointer to start of output buffer */
+ int intsize; /* IN - size of output buffer */
+{
+/*
+ * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+ */
+ u_char *bufp = data;
+ u_long asn_length;
+ u_long value = 0;
+
+ if (intsize != sizeof (long)){
+ ERROR("not long");
+ return NULL;
+ }
+ *type = *bufp++;
+ bufp = asn_parse_length(bufp, &asn_length);
+ if (bufp == NULL){
+ ERROR("bad length");
+ return NULL;
+ }
+ if (asn_length + (bufp - data) > *datalength){
+ ERROR("overflow of message");
+ return NULL;
+ }
+ if ((asn_length > (intsize + 1)) ||
+ ((asn_length == intsize + 1) && *bufp != 0x00)){
+ ERROR("I don't support such large integers");
+ return NULL;
+ }
+ *datalength -= (int)asn_length + (bufp - data);
+ if (*bufp & 0x80)
+ value = -1; /* integer is negative */
+ while(asn_length--)
+ value = (value << 8) | *bufp++;
+ *intp = value;
+ return bufp;
+}
+
+
+/*
+ * asn_build_int - builds an ASN object containing an integer.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the end of this object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_int(data, datalength, type, intp, intsize)
+ u_char *data; /* IN - pointer to start of output buffer */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - asn type of object */
+ long *intp; /* IN - pointer to start of long integer */
+ int intsize; /* IN - size of *intp */
+{
+/*
+ * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+ */
+
+ long integer;
+ u_long mask;
+
+ if (intsize != sizeof (long)) {
+ ERROR("not long");
+ return NULL;
+ }
+ integer = *intp;
+ /*
+ * Truncate "unnecessary" bytes off of the most significant end of this
+ * 2's complement integer. There should be no sequence of 9
+ * consecutive 1's or 0's at the most significant end of the
+ * integer.
+ */
+ mask = 0x1FF << ((8 * (sizeof(int32) - 1)) - 1);
+ /* mask is 0xFF800000 on a big-endian machine */
+ while((((integer & mask) == 0) || ((integer & mask) == mask))
+ && intsize > 1){
+ intsize--;
+ integer <<= 8;
+ }
+ data = asn_build_header(data, datalength, type, intsize);
+ if (data == NULL)
+ return NULL;
+ if (*datalength < intsize)
+ return NULL;
+ *datalength -= intsize;
+ mask = 0xFF << (8 * (sizeof(int32) - 1));
+ /* mask is 0xFF000000 on a big-endian machine */
+ while(intsize--){
+ *data++ = (u_char)((integer & mask) >> (8 * (sizeof(int32) - 1)));
+ integer <<= 8;
+ }
+ return data;
+}
+
+
+/*
+ * asn_build_unsigned_int - builds an ASN object containing an integer.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the end of this object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_unsigned_int(data, datalength, type, intp, intsize)
+ u_char *data; /* IN - pointer to start of output buffer */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - asn type of object */
+ u_long *intp; /* IN - pointer to start of long integer */
+ int intsize; /* IN - size of *intp */
+{
+/*
+ * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+ */
+
+ u_long integer;
+ u_long mask;
+ int add_null_byte = 0;
+
+ if (intsize != sizeof (long)) {
+ ERROR("not long");
+ return NULL;
+ }
+ integer = *intp;
+ mask = 0xFF << (8 * (sizeof(int32) - 1));
+ /* mask is 0xFF000000 on a big-endian machine */
+ if ((u_char)((integer & mask) >> (8 * (sizeof(int32) - 1))) & 0x80){
+ /* if MSB is set */
+ add_null_byte = 1;
+ intsize++;
+ }
+ /*
+ * Truncate "unnecessary" bytes off of the most significant end of this 2's complement integer.
+ * There should be no sequence of 9 consecutive 1's or 0's at the most significant end of the
+ * integer.
+ */
+ mask = 0x1FF << ((8 * (sizeof(int32) - 1)) - 1);
+ /* mask is 0xFF800000 on a big-endian machine */
+ while((((integer & mask) == 0) || ((integer & mask) == mask)) && intsize > 1){
+ intsize--;
+ integer <<= 8;
+ }
+ data = asn_build_header(data, datalength, type, intsize);
+ if (data == NULL)
+ return NULL;
+ if (*datalength < intsize)
+ return NULL;
+ *datalength -= intsize;
+ if (add_null_byte == 1){
+ *data++ = '\0';
+ intsize--;
+ }
+ mask = 0xFF << (8 * (sizeof(int32) - 1));
+ /* mask is 0xFF000000 on a big-endian machine */
+ while(intsize--){
+ *data++ = (u_char)((integer & mask) >> (8 * (sizeof(int32) - 1)));
+ integer <<= 8;
+ }
+ return data;
+}
+
+
+/*
+ * asn_parse_string - pulls an octet string out of an ASN octet string type.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the beginning of the next object.
+ *
+ * "string" is filled with the octet string.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_string(data, datalength, type, string, strlength)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char *type; /* OUT - asn type of object */
+ u_char *string; /* IN/OUT - pointer to start of output buffer */
+ int *strlength; /* IN/OUT - size of output buffer */
+{
+/*
+ * ASN.1 octet string ::= primstring | cmpdstring
+ * primstring ::= 0x04 asnlength byte {byte}*
+ * cmpdstring ::= 0x24 asnlength string {string}*
+ */
+ u_char *bufp = data;
+ u_long asn_length;
+
+ *type = *bufp++;
+ bufp = asn_parse_length(bufp, &asn_length);
+ if (bufp == NULL)
+ return NULL;
+ if (asn_length + (bufp - data) > *datalength){
+ ERROR("overflow of message");
+ return NULL;
+ }
+ if (asn_length > *strlength){
+ ERROR("I don't support such long strings");
+ return NULL;
+ }
+ bcopy((char *)bufp, (char *)string, (int)asn_length);
+ *strlength = (int)asn_length;
+ *datalength -= (int)asn_length + (bufp - data);
+ return bufp + asn_length;
+}
+
+
+/*
+ * asn_build_string - Builds an ASN octet string object containing the input string.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the beginning of the next object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_string(data, datalength, type, string, strlength)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - ASN type of string */
+ u_char *string; /* IN - pointer to start of input buffer */
+ int strlength; /* IN - size of input buffer */
+{
+/*
+ * ASN.1 octet string ::= primstring | cmpdstring
+ * primstring ::= 0x04 asnlength byte {byte}*
+ * cmpdstring ::= 0x24 asnlength string {string}*
+ * This code will never send a compound string.
+ */
+ data = asn_build_header(data, datalength, type, strlength);
+ if (data == NULL)
+ return NULL;
+ if (*datalength < strlength)
+ return NULL;
+ bcopy((char *)string, (char *)data, strlength);
+ *datalength -= strlength;
+ return data + strlength;
+}
+
+
+/*
+ * asn_parse_header - interprets the ID and length of the current object.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * in this object following the id and length.
+ *
+ * Returns a pointer to the first byte of the contents of this object.
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_header(data, datalength, type)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ u_char *type; /* OUT - ASN type of object */
+{
+ u_char *bufp = data;
+ int header_len;
+ u_long asn_length;
+
+ if (*datalength <= 0) {
+ return NULL;
+ }
+
+ /* this only works on data types < 30, i.e. no extension octets */
+ if (IS_EXTENSION_ID(*bufp)){
+ ERROR("can't process ID >= 30");
+ return NULL;
+ }
+ *type = *bufp;
+ bufp = asn_parse_length(bufp + 1, &asn_length);
+ if (bufp == NULL)
+ return NULL;
+ header_len = bufp - data;
+ if (header_len + asn_length > *datalength){
+ ERROR("asn length too long");
+ return NULL;
+ }
+ *datalength = (int)asn_length;
+ return bufp;
+}
+
+/*
+ * asn_build_header - builds an ASN header for an object with the ID and
+ * length specified.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * in this object following the id and length.
+ *
+ * This only works on data types < 30, i.e. no extension octets.
+ * The maximum length is 0xFFFF;
+ *
+ * Returns a pointer to the first byte of the contents of this object.
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_header(data, datalength, type, length)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - ASN type of object */
+ int length; /* IN - length of object */
+{
+ if (*datalength < 1)
+ return NULL;
+ *data++ = type;
+ (*datalength)--;
+ return asn_build_length(data, datalength, length);
+
+}
+
+/*
+ * asn_build_sequence - builds an ASN header for a sequence with the ID and
+ * length specified.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * in this object following the id and length.
+ *
+ * This only works on data types < 30, i.e. no extension octets.
+ * The maximum length is 0xFFFF;
+ *
+ * Returns a pointer to the first byte of the contents of this object.
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_sequence(data, datalength, type, length)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - ASN type of object */
+ int length; /* IN - length of object */
+{
+ *datalength -= 4;
+ if (*datalength < 0){
+ *datalength += 4; /* fix up before punting */
+ return NULL;
+ }
+ *data++ = type;
+ *data++ = (u_char)(0x02 | ASN_LONG_LEN);
+ *data++ = (u_char)((length >> 8) & 0xFF);
+ *data++ = (u_char)(length & 0xFF);
+ return data;
+}
+
+/*
+ * asn_parse_length - interprets the length of the current object.
+ * On exit, length contains the value of this length field.
+ *
+ * Returns a pointer to the first byte after this length
+ * field (aka: the start of the data field).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_length(data, length)
+ u_char *data; /* IN - pointer to start of length field */
+ u_long *length; /* OUT - value of length field */
+{
+ u_char lengthbyte = *data;
+
+ *length = 0;
+ if (lengthbyte & ASN_LONG_LEN){
+ lengthbyte &= ~ASN_LONG_LEN; /* turn MSb off */
+ if (lengthbyte == 0){
+ ERROR("We don't support indefinite lengths");
+ return NULL;
+ }
+ if (lengthbyte > sizeof(long)){
+ ERROR("we can't support data lengths that long");
+ return NULL;
+ }
+ bcopy((char *)data + 1, (char *)length, (int)lengthbyte);
+ /* XXX: is this useable on a 64bit platform ? */
+ *length = ntohl(*length);
+ *length >>= (8 * ((sizeof (*length)) - lengthbyte));
+ return data + lengthbyte + 1;
+ } else { /* short asnlength */
+ *length = (long)lengthbyte;
+ return data + 1;
+ }
+}
+
+u_char *
+asn_build_length(data, datalength, length)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ int length; /* IN - length of object */
+{
+ u_char *start_data = data;
+
+ /* no indefinite lengths sent */
+ if (length < 0x80){
+ if (*datalength < 1){
+ ERROR("build_length");
+ return NULL;
+ }
+ *data++ = (u_char)length;
+ } else if (length <= 0xFF){
+ if (*datalength < 2){
+ ERROR("build_length");
+ return NULL;
+ }
+ *data++ = (u_char)(0x01 | ASN_LONG_LEN);
+ *data++ = (u_char)length;
+ } else { /* 0xFF < length <= 0xFFFF */
+ if (*datalength < 3){
+ ERROR("build_length");
+ return NULL;
+ }
+ *data++ = (u_char)(0x02 | ASN_LONG_LEN);
+ *data++ = (u_char)((length >> 8) & 0xFF);
+ *data++ = (u_char)(length & 0xFF);
+ }
+ *datalength -= (data - start_data);
+ return data;
+
+}
+
+/*
+ * asn_parse_objid - pulls an object indentifier out of an ASN object identifier type.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the beginning of the next object.
+ *
+ * "objid" is filled with the object identifier.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_objid(data, datalength, type, objid, objidlength)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char *type; /* OUT - ASN type of object */
+ oid *objid; /* IN/OUT - pointer to start of output buffer */
+ int *objidlength; /* IN/OUT - number of sub-id's in objid */
+{
+/*
+ * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
+ * subidentifier ::= {leadingbyte}* lastbyte
+ * leadingbyte ::= 1 7bitvalue
+ * lastbyte ::= 0 7bitvalue
+ */
+ u_char *bufp = data;
+ oid *oidp = objid + 1;
+ u_long subidentifier;
+ long length;
+ u_long asn_length;
+
+ *type = *bufp++;
+ bufp = asn_parse_length(bufp, &asn_length);
+ if (bufp == NULL)
+ return NULL;
+ if (asn_length + (bufp - data) > *datalength){
+ ERROR("overflow of message");
+ return NULL;
+ }
+ *datalength -= (int)asn_length + (bufp - data);
+
+ /* Handle invalid object identifier encodings of the form 06 00 robustly */
+ if (asn_length == 0)
+ objid[0] = objid[1] = 0;
+
+ length = asn_length;
+ (*objidlength)--; /* account for expansion of first byte */
+ while (length > 0 && (*objidlength)-- > 0){
+ subidentifier = 0;
+ do { /* shift and add in low order 7 bits */
+ subidentifier = (subidentifier << 7) + (*(u_char *)bufp & ~ASN_BIT8);
+ length--;
+ } while (*(u_char *)bufp++ & ASN_BIT8); /* last byte has high bit clear */
+ if (subidentifier > (u_long)MAX_SUBID){
+ ERROR("subidentifier too long");
+ return NULL;
+ }
+ *oidp++ = (oid)subidentifier;
+ }
+
+ /*
+ * The first two subidentifiers are encoded into the first component
+ * with the value (X * 40) + Y, where:
+ * X is the value of the first subidentifier.
+ * Y is the value of the second subidentifier.
+ */
+ subidentifier = (u_long)objid[1];
+ if (subidentifier == 0x2B){
+ objid[0] = 1;
+ objid[1] = 3;
+ } else {
+ objid[1] = (u_char)(subidentifier % 40);
+ objid[0] = (u_char)((subidentifier - objid[1]) / 40);
+ }
+
+ *objidlength = (int)(oidp - objid);
+ return bufp;
+}
+
+/*
+ * asn_build_objid - Builds an ASN object identifier object containing the
+ * input string.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the beginning of the next object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_objid(data, datalength, type, objid, objidlength)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - ASN type of object */
+ oid *objid; /* IN - pointer to start of input buffer */
+ int objidlength; /* IN - number of sub-id's in objid */
+{
+/*
+ * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
+ * subidentifier ::= {leadingbyte}* lastbyte
+ * leadingbyte ::= 1 7bitvalue
+ * lastbyte ::= 0 7bitvalue
+ */
+ u_char buf[MAX_OID_LEN];
+ u_char *bp = buf;
+ oid *op = objid;
+ int asnlength;
+ u_long subid, mask, testmask;
+ int bits, testbits;
+
+ if (objidlength < 2){
+ *bp++ = 0;
+ objidlength = 0;
+ } else {
+ *bp++ = op[1] + (op[0] * 40);
+ objidlength -= 2;
+ op += 2;
+ }
+
+ while(objidlength-- > 0){
+ subid = *op++;
+ if (subid < 127){ /* off by one? */
+ *bp++ = subid;
+ } else {
+ mask = 0x7F; /* handle subid == 0 case */
+ bits = 0;
+ /* testmask *MUST* !!!! be of an unsigned type */
+ for(testmask = 0x7F, testbits = 0; testmask != 0;
+ testmask <<= 7, testbits += 7){
+ if (subid & testmask){ /* if any bits set */
+ mask = testmask;
+ bits = testbits;
+ }
+ }
+ /* mask can't be zero here */
+ for(;mask != 0x7F; mask >>= 7, bits -= 7){
+ /* fix a mask that got truncated above */
+ if (mask == 0x1E00000)
+ mask = 0xFE00000;
+ *bp++ = (u_char)(((subid & mask) >> bits) | ASN_BIT8);
+ }
+ *bp++ = (u_char)(subid & mask);
+ }
+ }
+ asnlength = bp - buf;
+ data = asn_build_header(data, datalength, type, asnlength);
+ if (data == NULL)
+ return NULL;
+ if (*datalength < asnlength)
+ return NULL;
+ bcopy((char *)buf, (char *)data, asnlength);
+ *datalength -= asnlength;
+ return data + asnlength;
+}
+
+/*
+ * asn_parse_null - Interprets an ASN null type.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the beginning of the next object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_null(data, datalength, type)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char *type; /* OUT - ASN type of object */
+{
+/*
+ * ASN.1 null ::= 0x05 0x00
+ */
+ u_char *bufp = data;
+ u_long asn_length;
+
+ *type = *bufp++;
+ bufp = asn_parse_length(bufp, &asn_length);
+ if (bufp == NULL)
+ return NULL;
+ if (asn_length != 0){
+ ERROR("Malformed NULL");
+ return NULL;
+ }
+ *datalength -= (bufp - data);
+ return bufp + asn_length;
+}
+
+
+/*
+ * asn_build_null - Builds an ASN null object.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the beginning of the next object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_null(data, datalength, type)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - ASN type of object */
+{
+/*
+ * ASN.1 null ::= 0x05 0x00
+ */
+ return asn_build_header(data, datalength, type, 0);
+}
+
+/*
+ * asn_parse_bitstring - pulls a bitstring out of an ASN bitstring type.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the beginning of the next object.
+ *
+ * "string" is filled with the bit string.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_bitstring(data, datalength, type, string, strlength)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char *type; /* OUT - asn type of object */
+ u_char *string; /* IN/OUT - pointer to start of output buffer */
+ int *strlength; /* IN/OUT - size of output buffer */
+{
+/*
+ * bitstring ::= 0x03 asnlength unused {byte}*
+ */
+ u_char *bufp = data;
+ u_long asn_length;
+
+ *type = *bufp++;
+ bufp = asn_parse_length(bufp, &asn_length);
+ if (bufp == NULL)
+ return NULL;
+ if (asn_length + (bufp - data) > *datalength){
+ ERROR("overflow of message");
+ return NULL;
+ }
+ if (asn_length > *strlength){
+ ERROR("I don't support such long bitstrings");
+ return NULL;
+ }
+ if (asn_length < 1){
+ ERROR("Invalid bitstring");
+ return NULL;
+ }
+ if (/** *bufp < 0 || **/ *bufp > 7){
+ ERROR("Invalid bitstring");
+ return NULL;
+ }
+ bcopy((char *)bufp, (char *)string, (int)asn_length);
+ *strlength = (int)asn_length;
+ *datalength -= (int)asn_length + (bufp - data);
+ return bufp + asn_length;
+}
+
+
+/*
+ * asn_build_bitstring - Builds an ASN bit string object containing the
+ * input string.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the beginning of the next object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_bitstring(data, datalength, type, string, strlength)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength; /* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - ASN type of string */
+ u_char *string; /* IN - pointer to start of input buffer */
+ int strlength; /* IN - size of input buffer */
+{
+/*
+ * ASN.1 bit string ::= 0x03 asnlength unused {byte}*
+ */
+ if (strlength < 1 || /** *string < 0 || **/ *string > 7){
+ ERROR("Building invalid bitstring");
+ return NULL;
+ }
+ data = asn_build_header(data, datalength, type, strlength);
+ if (data == NULL)
+ return NULL;
+ if (*datalength < strlength)
+ return NULL;
+ bcopy((char *)string, (char *)data, strlength);
+ *datalength -= strlength;
+ return data + strlength;
+}
+
+
+/*
+ * asn_parse_unsigned_int64 - pulls a 64 bit unsigned long out of an ASN int
+ * type.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the end of this object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_parse_unsigned_int64(data, datalength, type, cp, countersize)
+ u_char *data; /* IN - pointer to start of object */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ u_char *type; /* OUT - asn type of object */
+ struct counter64 *cp; /* IN/OUT -pointer to counter struct */
+ int countersize;/* IN - size of output buffer */
+{
+/*
+ * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+ */
+ u_char *bufp = data;
+ u_long asn_length;
+ u_long low = 0, high = 0;
+ int intsize = 4;
+
+ if (countersize != sizeof(struct counter64)){
+ ERROR("not counter64 size");
+ return NULL;
+ }
+ *type = *bufp++;
+ bufp = asn_parse_length(bufp, &asn_length);
+ if (bufp == NULL){
+ ERROR("bad length");
+ return NULL;
+ }
+ if (asn_length + (bufp - data) > *datalength){
+ ERROR("overflow of message");
+ return NULL;
+ }
+ if ((asn_length > (intsize * 2 + 1)) ||
+ ((asn_length == (intsize * 2) + 1) && *bufp != 0x00)){
+ ERROR("I don't support such large integers");
+ return NULL;
+ }
+ *datalength -= (int)asn_length + (bufp - data);
+ if (*bufp & 0x80){
+ low = -1; /* integer is negative */
+ high = -1;
+ }
+ while(asn_length--){
+ high = (high << 8) | ((low & 0xFF000000) >> 24);
+ low = (low << 8) | *bufp++;
+ }
+ cp->low = low;
+ cp->high = high;
+ return bufp;
+}
+
+
+/*
+ * asn_build_unsigned_int64 - builds an ASN object containing a 64 bit integer.
+ * On entry, datalength is input as the number of valid bytes following
+ * "data". On exit, it is returned as the number of valid bytes
+ * following the end of this object.
+ *
+ * Returns a pointer to the first byte past the end
+ * of this object (i.e. the start of the next object).
+ * Returns NULL on any error.
+ */
+u_char *
+asn_build_unsigned_int64(data, datalength, type, cp, countersize)
+ u_char *data; /* IN - pointer to start of output buffer */
+ int *datalength;/* IN/OUT - number of valid bytes left in buffer */
+ u_char type; /* IN - asn type of object */
+ struct counter64 *cp; /* IN - pointer to counter struct */
+ int countersize; /* IN - size of *intp */
+{
+/*
+ * ASN.1 integer ::= 0x02 asnlength byte {byte}*
+ */
+
+ u_int32 low, high;
+ u_int32 mask, mask2;
+ int add_null_byte = 0;
+ int intsize;
+
+ if (countersize != sizeof (struct counter64)) {
+ ERROR("not counter64 size");
+ return NULL;
+ }
+ intsize = 8;
+ low = cp->low;
+ high = cp->high;
+ mask = 0xFF << (8 * (sizeof(int32) - 1));
+ /* mask is 0xFF000000 on a big-endian machine */
+ if ((u_char)((high & mask) >> (8 * (sizeof(int32) - 1))) & 0x80) {
+ /* if MSB is set */
+ add_null_byte = 1;
+ intsize++;
+ }
+ /*
+ * Truncate "unnecessary" bytes off of the most significant end of this 2's
+ * complement integer.
+ * There should be no sequence of 9 consecutive 1's or 0's at the most
+ * significant end of the integer.
+ */
+ mask2 = 0x1FF << ((8 * (sizeof(int32) - 1)) - 1);
+ /* mask2 is 0xFF800000 on a big-endian machine */
+ while((((high & mask2) == 0) || ((high & mask2) == mask2))
+ && intsize > 1){
+ intsize--;
+ high = (high << 8)
+ | ((low & mask) >> (8 * (sizeof(int32) - 1)));
+ low <<= 8;
+ }
+ data = asn_build_header(data, datalength, type, intsize);
+ if (data == NULL)
+ return NULL;
+ if (*datalength < intsize)
+ return NULL;
+ *datalength -= intsize;
+ if (add_null_byte == 1){
+ *data++ = '\0';
+ intsize--;
+ }
+ while(intsize--){
+ *data++ = (u_char)((high & mask) >> (8 * (sizeof(int32) - 1)));
+ high = (high << 8)
+ | ((low & mask) >> (8 * (sizeof(int32) - 1)));
+ low <<= 8;
+
+ }
+ return data;
+}
+
+
| [
"993273596@qq.com"
] | 993273596@qq.com |
8026b0cc74eee3f497d8615b79d20d3d6083e44b | a964826c7d71c0b417157c3f56fced2936a17082 | /Attic/ClockworkEditorReference/Source/UI/Modal/UIInfoModule3D.h | 2b74e31888b42fbefb27850af101c73794fc3bd7 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-openssl",
"BSD-3-Clause",
"NTP",
"BSL-1.0",
"LicenseRef-scancode-khronos",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"Zlib"
] | permissive | gitter-badger/Clockwork | c95bcfc2066a11e2fcad0329a79cb69f0e7da4b5 | ec489a090697fc8b0dc692c3466df352ee722a6b | refs/heads/master | 2020-12-28T07:46:24.514590 | 2016-04-11T00:51:14 | 2016-04-11T00:51:14 | 55,931,507 | 0 | 0 | null | 2016-04-11T01:09:48 | 2016-04-11T01:09:48 | null | UTF-8 | C++ | false | false | 673 | h | // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
// Please see LICENSE.md in repository root for license information
// https://github.com/ClockworkGameEngine/ClockworkGameEngine
#pragma once
#include "UIModalOps.h"
#include <TurboBadger/tb_select.h>
#include <TurboBadger/tb_select_item.h>
namespace ClockworkEditor
{
class InfoModule3D : public UIModalOpWindow
{
OBJECT(InfoModule3D);
public:
InfoModule3D(Context* context, const String &exampleFolder, const String &exampleScreenshot);
virtual ~InfoModule3D();
bool OnEvent(const TBWidgetEvent &ev);
private:
String exampleFolder_;
String exampleScreenshot_;
};
}
| [
"dragonCASTjosh@gmail.com"
] | dragonCASTjosh@gmail.com |
bb13818e1103586efb0e76535a56ea86dbaa8c85 | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/chromium/base/threading/simple_thread_unittest.cc | 4014d70a2620855a0adb7c28977dedec9d237daa | [
"MIT",
"BSD-3-Clause"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 4,360 | cc | // Copyright (c) 2010 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/atomic_sequence_num.h"
#include "base/string_number_conversions.h"
#include "base/threading/simple_thread.h"
#include "base/synchronization/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
class SetIntRunner : public DelegateSimpleThread::Delegate {
public:
SetIntRunner(int* ptr, int val) : ptr_(ptr), val_(val) { }
~SetIntRunner() { }
virtual void Run() {
*ptr_ = val_;
}
private:
int* ptr_;
int val_;
};
class WaitEventRunner : public DelegateSimpleThread::Delegate {
public:
explicit WaitEventRunner(WaitableEvent* event) : event_(event) { }
~WaitEventRunner() { }
virtual void Run() {
EXPECT_FALSE(event_->IsSignaled());
event_->Signal();
EXPECT_TRUE(event_->IsSignaled());
}
private:
WaitableEvent* event_;
};
class SeqRunner : public DelegateSimpleThread::Delegate {
public:
explicit SeqRunner(AtomicSequenceNumber* seq) : seq_(seq) { }
virtual void Run() {
seq_->GetNext();
}
private:
AtomicSequenceNumber* seq_;
};
// We count up on a sequence number, firing on the event when we've hit our
// expected amount, otherwise we wait on the event. This will ensure that we
// have all threads outstanding until we hit our expected thread pool size.
class VerifyPoolRunner : public DelegateSimpleThread::Delegate {
public:
VerifyPoolRunner(AtomicSequenceNumber* seq,
int total, WaitableEvent* event)
: seq_(seq), total_(total), event_(event) { }
virtual void Run() {
if (seq_->GetNext() == total_) {
event_->Signal();
} else {
event_->Wait();
}
}
private:
AtomicSequenceNumber* seq_;
int total_;
WaitableEvent* event_;
};
} // namespace
TEST(SimpleThreadTest, CreateAndJoin) {
int stack_int = 0;
SetIntRunner runner(&stack_int, 7);
EXPECT_EQ(0, stack_int);
DelegateSimpleThread thread(&runner, "int_setter");
EXPECT_FALSE(thread.HasBeenStarted());
EXPECT_FALSE(thread.HasBeenJoined());
EXPECT_EQ(0, stack_int);
thread.Start();
EXPECT_TRUE(thread.HasBeenStarted());
EXPECT_FALSE(thread.HasBeenJoined());
thread.Join();
EXPECT_TRUE(thread.HasBeenStarted());
EXPECT_TRUE(thread.HasBeenJoined());
EXPECT_EQ(7, stack_int);
}
TEST(SimpleThreadTest, WaitForEvent) {
// Create a thread, and wait for it to signal us.
WaitableEvent event(true, false);
WaitEventRunner runner(&event);
DelegateSimpleThread thread(&runner, "event_waiter");
EXPECT_FALSE(event.IsSignaled());
thread.Start();
event.Wait();
EXPECT_TRUE(event.IsSignaled());
thread.Join();
}
TEST(SimpleThreadTest, NamedWithOptions) {
WaitableEvent event(true, false);
WaitEventRunner runner(&event);
SimpleThread::Options options;
DelegateSimpleThread thread(&runner, "event_waiter", options);
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_FALSE(event.IsSignaled());
thread.Start();
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_EQ(thread.name(),
std::string("event_waiter/") + IntToString(thread.tid()));
event.Wait();
EXPECT_TRUE(event.IsSignaled());
thread.Join();
// We keep the name and tid, even after the thread is gone.
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_EQ(thread.name(),
std::string("event_waiter/") + IntToString(thread.tid()));
}
TEST(SimpleThreadTest, ThreadPool) {
AtomicSequenceNumber seq;
SeqRunner runner(&seq);
DelegateSimpleThreadPool pool("seq_runner", 10);
// Add work before we're running.
pool.AddWork(&runner, 300);
EXPECT_EQ(seq.GetNext(), 0);
pool.Start();
// Add work while we're running.
pool.AddWork(&runner, 300);
pool.JoinAll();
EXPECT_EQ(seq.GetNext(), 601);
// We can reuse our pool. Verify that all 10 threads can actually run in
// parallel, so this test will only pass if there are actually 10 threads.
AtomicSequenceNumber seq2;
WaitableEvent event(true, false);
// Changing 9 to 10, for example, would cause us JoinAll() to never return.
VerifyPoolRunner verifier(&seq2, 9, &event);
pool.Start();
pool.AddWork(&verifier, 10);
pool.JoinAll();
EXPECT_EQ(seq2.GetNext(), 10);
}
} // namespace base
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
e4b40a0995ba37cb478b9a4db8a93b2bc740181b | f0a361e75219aaaa592b19deeaa4eb00312551b3 | /Heritor/Fax.cpp | 32516d3ea43002228e5643947f195cb3f29f5de4 | [] | no_license | luputona/InHeritor | 0c3d4f9b6ebd4c30fdd3723138a5dc801e66ea07 | e7fc17224bdf98ed50dbeccee892a395b1d89a2f | refs/heads/master | 2021-07-25T21:40:32.546787 | 2017-11-09T06:16:56 | 2017-11-09T06:16:56 | 110,061,416 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 308 | cpp | #include<iostream>
#include<cstring>
class Phone
{
public:
void Switch(int n)
{
m_On = n;
}
private :
int m_On;
};
class Printer
{
public:
void Switch(int n)
{
m_On = n;
}
private:
int m_On;
};
class Fax : public Phone, public Printer
{
};
void main1()
{
Fax myFax;
myFax.Phone::Switch(1);
} | [
"luputona5"
] | luputona5 |
64167294e9762e3c9ca83fff64108d8cf94e224c | 09a20466c1650ab4beb6554ceabc8649a7540c06 | /core/src/jni/jni/AmountListCallback.cpp | 9bd527a32c5a866687792fc69f1168a8ba42c76d | [
"MIT"
] | permissive | LedgerHQ/lib-ledger-core | 2f1153655ed7c116b866d2b21920a8a3017f5d96 | ad1e271b5f61e92f663ff08c337acc8b107fc85f | refs/heads/main | 2023-07-09T18:24:41.408616 | 2023-07-06T13:09:06 | 2023-07-06T13:09:06 | 68,716,694 | 99 | 99 | MIT | 2023-06-30T08:36:20 | 2016-09-20T13:51:06 | C++ | UTF-8 | C++ | false | false | 1,448 | cpp | // AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from callback.djinni
#include "AmountListCallback.hpp" // my header
#include "Amount.hpp"
#include "Error.hpp"
#include "Marshal.hpp"
namespace djinni_generated {
AmountListCallback::AmountListCallback() : ::djinni::JniInterface<::ledger::core::api::AmountListCallback, AmountListCallback>() {}
AmountListCallback::~AmountListCallback() = default;
AmountListCallback::JavaProxy::JavaProxy(JniType j) : Handle(::djinni::jniGetThreadEnv(), j) { }
AmountListCallback::JavaProxy::~JavaProxy() = default;
void AmountListCallback::JavaProxy::onCallback(const std::experimental::optional<std::vector<std::shared_ptr<::ledger::core::api::Amount>>> & c_result, const std::experimental::optional<::ledger::core::api::Error> & c_error) {
auto jniEnv = ::djinni::jniGetThreadEnv();
::djinni::JniLocalScope jscope(jniEnv, 10);
const auto& data = ::djinni::JniClass<::djinni_generated::AmountListCallback>::get();
jniEnv->CallVoidMethod(Handle::get().get(), data.method_onCallback,
::djinni::get(::djinni::Optional<std::experimental::optional, ::djinni::List<::djinni_generated::Amount>>::fromCpp(jniEnv, c_result)),
::djinni::get(::djinni::Optional<std::experimental::optional, ::djinni_generated::Error>::fromCpp(jniEnv, c_error)));
::djinni::jniExceptionCheck(jniEnv);
}
} // namespace djinni_generated
| [
"khalil.bellakrid@ledger.fr"
] | khalil.bellakrid@ledger.fr |
26fb767c7d0e46395c51ea757020d025338a16db | 0400ac52a20058bf13a064b838872473212765ca | /Unity_Code/DinoRun_Final/Temp/il2cppOutput/il2cppOutput/mscorlib_System_Collections_Generic_Dictionary_2_Va223940037.h | 0a20e7dab3dda1d1d024d50ec271514463e9be64 | [
"Apache-2.0"
] | permissive | BPenzar/SuperDinoBros. | b7e6be07bfc4278d85eeb986f4740c9a91e01689 | f46b866c5a1119c6753dbd8e963212f17a4a31d5 | refs/heads/master | 2021-01-20T04:29:24.503356 | 2017-07-25T14:58:12 | 2017-07-25T14:58:12 | 89,697,299 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,505 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_Object2689449295.h"
// System.Collections.Generic.Dictionary`2<System.String,System.Collections.Generic.KeyValuePair`2<System.Type,SimpleJson.Reflection.ReflectionUtils/SetDelegate>>
struct Dictionary_2_t1520880194;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.Dictionary`2/ValueCollection<System.String,System.Collections.Generic.KeyValuePair`2<System.Type,SimpleJson.Reflection.ReflectionUtils/SetDelegate>>
struct ValueCollection_t223940037 : public Il2CppObject
{
public:
// System.Collections.Generic.Dictionary`2<TKey,TValue> System.Collections.Generic.Dictionary`2/ValueCollection::dictionary
Dictionary_2_t1520880194 * ___dictionary_0;
public:
inline static int32_t get_offset_of_dictionary_0() { return static_cast<int32_t>(offsetof(ValueCollection_t223940037, ___dictionary_0)); }
inline Dictionary_2_t1520880194 * get_dictionary_0() const { return ___dictionary_0; }
inline Dictionary_2_t1520880194 ** get_address_of_dictionary_0() { return &___dictionary_0; }
inline void set_dictionary_0(Dictionary_2_t1520880194 * value)
{
___dictionary_0 = value;
Il2CppCodeGenWriteBarrier(&___dictionary_0, value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"bruno.penzar@posteo.de"
] | bruno.penzar@posteo.de |
6b70a193173b9e56345a4578bb17180bb752979b | 1f4da706c731d2bea08e945d7ff8c8a7596298aa | /src/ports/morsesmalecomplexport.cpp | e41e2d0328557d00ce5e9d90c794d0b65fa822bd | [] | no_license | xeTaiz/inviwo-topologytoolkit | c9734d1d59e1a70be7278116d3a6996162bf98b3 | c948be74b34a7e33edb753aee423c9c092881fea | refs/heads/master | 2023-02-13T22:40:29.757973 | 2021-01-14T07:48:04 | 2021-01-14T07:48:04 | 329,543,160 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,686 | cpp | /*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2019 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/
#include <inviwo/topologytoolkit/ports/morsesmalecomplexport.h>
namespace inviwo {} // namespace inviwo
| [
"dominik.engel@mail.de"
] | dominik.engel@mail.de |
083edd2235ef027c823b432c799afaa2f6d6e224 | a40441043e2074a3fb1751876def53d29bea529e | /engine/matrix.cpp | 773645a40c3d9631544cf36cd008498da17df725 | [] | no_license | netguy204/giggle | 1889182949229c1940bda15a78fbf43dd9d42ab0 | 08c1d344e317927c7326388866f39cd13efe9cd6 | refs/heads/master | 2021-01-10T20:30:03.687025 | 2014-03-29T15:21:29 | 2014-03-29T15:21:29 | 10,142,807 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,031 | cpp | /*
* This file is part of GambitGameLib.
*
* GambitGameLib 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.
*
* GambitGameLib 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 GambitGameLib. If not, see <http://www.gnu.org/licenses/>.
*/
#include "matrix.h"
#include "giggle.h"
#include <math.h>
OBJECT_IMPL(Matrix44, Object);
Matrix44::Matrix44(void* _empty) {
if(_empty) {
*this = *(Matrix44*)_empty;
}
}
Matrix44::Matrix44() {
}
Matrix44& Matrix44::operator=(const Matrix44& other) {
memcpy(data, other.data, sizeof(data));
return *this;
}
void Matrix44::identity() {
data[0] = 1.0f;
data[1] = 0.0f;
data[2] = 0.0f;
data[3] = 0.0f;
data[4] = 0.0f;
data[5] = 1.0f;
data[6] = 0.0f;
data[7] = 0.0f;
data[8] = 0.0f;
data[9] = 0.0f;
data[10] = 1.0f;
data[11] = 0.0f;
data[12] = 0.0f;
data[13] = 0.0f;
data[14] = 0.0f;
data[15] = 1.0f;
}
OBJECT_METHOD(Matrix44, identity, void, ());
void Matrix44::rotation(float angle) {
float s = sinf(angle);
float c = cosf(angle);
data[0] = c;
data[1] = s;
data[2] = 0.0f;
data[3] = 0.0f;
data[4] = -s;
data[5] = c;
data[6] = 0.0f;
data[7] = 0.0f;
data[8] = 0.0f;
data[9] = 0.0f;
data[10] = 1.0f;
data[11] = 0.0f;
data[12] = 0.0f;
data[13] = 0.0f;
data[14] = 0.0f;
data[15] = 1.0f;
}
OBJECT_METHOD(Matrix44, rotation, void, (float));
void Matrix44::orthographic_proj(float xmin, float xmax, float ymin, float ymax,
float zmin, float zmax) {
identity();
data[0] = 2.0f / (xmax - xmin);
data[5] = 2.0f / (ymax - ymin);
data[10] = -2.0f / (zmax - zmin);
data[12] = -((xmax + xmin)/(xmax - xmin));
data[13] = -((ymax + ymin)/(ymax - ymin));
data[14] = -((zmax + zmin)/(zmax - zmin));
data[15] = 1.0f;
}
OBJECT_METHOD(Matrix44, orthographic_proj, void, (float, float, float, float, float, float))
Matrix44 Matrix44::operator*(const Matrix44& o) {
Matrix44 result;
for(unsigned ii = 0; ii < 4; ++ii) {
for(unsigned jj = 0; jj < 4; ++jj) {
result.elm(ii,jj) = 0;
for(unsigned kk = 0; kk < 4; ++kk) {
result.elm(ii,jj) += elm(ii,kk) * o.elm(kk,jj);
}
}
}
return result;
}
Matrix44* Matrix44::multiply(Matrix44* o) {
Matrix44 temp = (*this) * (*o);
Matrix44* result = new Matrix44(&temp);
result->reference_count = 0; // disown
return result;
}
OBJECT_METHOD(Matrix44, multiply, Matrix44*, (Matrix44*));
void Matrix44::vmult(Vector_* r, Vector_* v) {
r->x = data[0] * v->x + data[4] * v->y;
r->y = data[1] * v->x + data[5] * v->y;
}
| [
"el.wubo@gmail.com"
] | el.wubo@gmail.com |
2405af614a9ac96a861f66474d2179c7fc9c6fbe | 574cdcc55131068d43fb32d9b53b09d4de654595 | /RideTheFlow/RideTheFlow/src/actor/particle/ParticlePtr.h | 2cb20feebeebed994cd2fcda5536fad21f393fd7 | [] | no_license | Jimendaisuki/RideTheFlow | 58a966ea820fbf270307118189e5ebe435807cab | 5c9a68a085974c8149b14ecdf9ad7e6c3a019ece | refs/heads/master | 2020-04-06T11:56:01.428980 | 2016-07-01T03:36:19 | 2016-07-01T03:36:19 | 55,942,178 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 94 | h | #pragma once
#include <memory>
class Particle;
typedef std::shared_ptr<Particle> ParticlePtr; | [
"taroramen310@gmail.com"
] | taroramen310@gmail.com |
8dd275f21501c82744d2c5b12967f475badb888f | 457934a28c6d8f28b445b7baf69b5792eb71b49e | /example_2_9_2/constant/polyMesh/points | fe676f9cc24b7428e1cef305d8183ebc34e07677 | [] | no_license | rs628/optimalcontrol292 | f45e9612b05096195ffa426fa1ea7d59b44d4a32 | fce11bc2557c8c17d6c242e807c631b82a588543 | refs/heads/master | 2020-07-24T19:20:02.697183 | 2019-09-15T18:49:12 | 2019-09-15T18:49:12 | 208,021,088 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,201 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class vectorField;
location "constant/polyMesh";
object points;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.1)
(1 0 0.1)
(1 1 0.1)
(0 1 0.1)
(0.125 0 0)
(0.25 0 0)
(0.375 0 0)
(0.5 0 0)
(0.625 0 0)
(0.75 0 0)
(0.875 0 0)
(1 0.125 0)
(1 0.25 0)
(1 0.375 0)
(1 0.5 0)
(1 0.625 0)
(1 0.75 0)
(1 0.875 0)
(0.875 1 0)
(0.75 1 0)
(0.625 1 0)
(0.5 1 0)
(0.375 1 0)
(0.25 1 0)
(0.125 1 0)
(0 0.875 0)
(0 0.75 0)
(0 0.625 0)
(0 0.5 0)
(0 0.375 0)
(0 0.25 0)
(0 0.125 0)
(0.125 0 0.1)
(0.25 0 0.1)
(0.375 0 0.1)
(0.5 0 0.1)
(0.625 0 0.1)
(0.75 0 0.1)
(0.875 0 0.1)
(1 0.125 0.1)
(1 0.25 0.1)
(1 0.375 0.1)
(1 0.5 0.1)
(1 0.625 0.1)
(1 0.75 0.1)
(1 0.875 0.1)
(0.875 1 0.1)
(0.75 1 0.1)
(0.625 1 0.1)
(0.5 1 0.1)
(0.375 1 0.1)
(0.25 1 0.1)
(0.125 1 0.1)
(0 0.875 0.1)
(0 0.75 0.1)
(0 0.625 0.1)
(0 0.5 0.1)
(0 0.375 0.1)
(0 0.25 0.1)
(0 0.125 0.1)
(0.125 0.125 0)
(0.125 0.25 0)
(0.125 0.375 0)
(0.125 0.5 0)
(0.125 0.625 0)
(0.125 0.75 0)
(0.125 0.875 0)
(0.25 0.125 0)
(0.25 0.25 0)
(0.25 0.375 0)
(0.25 0.5 0)
(0.25 0.625 0)
(0.25 0.75 0)
(0.25 0.875 0)
(0.375 0.125 0)
(0.375 0.25 0)
(0.375 0.375 0)
(0.375 0.5 0)
(0.375 0.625 0)
(0.375 0.75 0)
(0.375 0.875 0)
(0.5 0.125 0)
(0.5 0.25 0)
(0.5 0.375 0)
(0.5 0.5 0)
(0.5 0.625 0)
(0.5 0.75 0)
(0.5 0.875 0)
(0.625 0.125 0)
(0.625 0.25 0)
(0.625 0.375 0)
(0.625 0.5 0)
(0.625 0.625 0)
(0.625 0.75 0)
(0.625 0.875 0)
(0.75 0.125 0)
(0.75 0.25 0)
(0.75 0.375 0)
(0.75 0.5 0)
(0.75 0.625 0)
(0.75 0.75 0)
(0.75 0.875 0)
(0.875 0.125 0)
(0.875 0.25 0)
(0.875 0.375 0)
(0.875 0.5 0)
(0.875 0.625 0)
(0.875 0.75 0)
(0.875 0.875 0)
(0.125 0.125 0.1)
(0.125 0.25 0.1)
(0.125 0.375 0.1)
(0.125 0.5 0.1)
(0.125 0.625 0.1)
(0.125 0.75 0.1)
(0.125 0.875 0.1)
(0.25 0.125 0.1)
(0.25 0.25 0.1)
(0.25 0.375 0.1)
(0.25 0.5 0.1)
(0.25 0.625 0.1)
(0.25 0.75 0.1)
(0.25 0.875 0.1)
(0.375 0.125 0.1)
(0.375 0.25 0.1)
(0.375 0.375 0.1)
(0.375 0.5 0.1)
(0.375 0.625 0.1)
(0.375 0.75 0.1)
(0.375 0.875 0.1)
(0.5 0.125 0.1)
(0.5 0.25 0.1)
(0.5 0.375 0.1)
(0.5 0.5 0.1)
(0.5 0.625 0.1)
(0.5 0.75 0.1)
(0.5 0.875 0.1)
(0.625 0.125 0.1)
(0.625 0.25 0.1)
(0.625 0.375 0.1)
(0.625 0.5 0.1)
(0.625 0.625 0.1)
(0.625 0.75 0.1)
(0.625 0.875 0.1)
(0.75 0.125 0.1)
(0.75 0.25 0.1)
(0.75 0.375 0.1)
(0.75 0.5 0.1)
(0.75 0.625 0.1)
(0.75 0.75 0.1)
(0.75 0.875 0.1)
(0.875 0.125 0.1)
(0.875 0.25 0.1)
(0.875 0.375 0.1)
(0.875 0.5 0.1)
(0.875 0.625 0.1)
(0.875 0.75 0.1)
(0.875 0.875 0.1)
)
// ************************************************************************* //
| [
"rs628@snu.edu.in"
] | rs628@snu.edu.in | |
086bbbeb40edb9a2a94472142ed674aa03ae5049 | e1d6417b995823e507a1e53ff81504e4bc795c8f | /gbk/server/Server/Server/Obj/Obj.cpp | ed1df11523d94af022bfa1455c91a271f3373608 | [] | no_license | cjmxp/pap_full | f05d9e3f9390c2820a1e51d9ad4b38fe044e05a6 | 1963a8a7bda5156a772ccb3c3e35219a644a1566 | refs/heads/master | 2020-12-02T22:50:41.786682 | 2013-11-15T08:02:30 | 2013-11-15T08:02:30 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 7,117 | cpp | // Obj.cpp
#include "stdafx.h"
#include "Scene.h"
#include "ObjList.h"
#include "GCDelObject.h"
#include "GCObjTeleport.h"
#include "GUIDManager.h"
#include "Obj.h"
Obj::Obj( )
{
__ENTER_FUNCTION
m_ObjID = INVALID_ID;
m_uPoolID = UINT_MAX;
m_uSingleMgrIndex = UINT_MAX;
m_pObjNode = new _OBJ_LIST_NODE( this );
m_bActive = FALSE;
m_Pos.CleanUp();
m_Dir = 0.f;
m_pScene = NULL;
m_ZoneID = INVALID_ID;
m_uLastTime = 0;
m_uNowTime = 0;
m_uCreateTime = 0;
m_nLogicCount = 0;
__LEAVE_FUNCTION
}
Obj::~Obj( )
{
__ENTER_FUNCTION
SAFE_DELETE( m_pObjNode );
__LEAVE_FUNCTION
}
VOID Obj::OnEnterScene(VOID)
{
__ENTER_FUNCTION
m_uLastTime = 0;
m_uNowTime = 0;
m_uCreateTime = 0;
__LEAVE_FUNCTION
}
VOID Obj::OnLeaveScene(VOID)
{
__ENTER_FUNCTION
m_uLastTime = 0;
m_uNowTime = 0;
m_uCreateTime = 0;
__LEAVE_FUNCTION
}
VOID Obj::UpdateTime(UINT uTime)
{
__ENTER_FUNCTION
if(m_uNowTime == 0)
{
m_uCreateTime =uTime;
m_uLastTime =uTime;
}
else
{
m_uLastTime = m_uNowTime;
}
m_uNowTime =uTime;
__LEAVE_FUNCTION
}
VOID Obj::CleanUp( )
{
__ENTER_FUNCTION
m_bActive = FALSE;
Assert( m_pObjNode->m_pNext == NULL );
Assert( m_pObjNode->m_pPrev == NULL );
m_Pos.CleanUp();
m_Dir = 0.f;
//m_pScene = NULL;
m_ZoneID = INVALID_ID;
__LEAVE_FUNCTION
}
BOOL Obj::Init( const _OBJ_INIT *pInit )
{
__ENTER_FUNCTION
if ( pInit == NULL )
return FALSE;
m_Pos = pInit->m_Pos;
m_Dir = pInit->m_Dir;
UpdateZone();
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}
BOOL Obj::HeartBeat(UINT uTime)
{
__ENTER_FUNCTION
UpdateTime(uTime);
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}
// 未被击活的Obj所执行的逻辑
BOOL Obj::HeartBeat_OutZone( UINT uTime )
{
__ENTER_FUNCTION
UpdateTime(uTime);
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}
BOOL Obj::IsInValidRadius(FLOAT fX1, FLOAT fZ1, FLOAT fX2, FLOAT fZ2, FLOAT fRadius)
{
FLOAT fDistX, fDistZ;
fDistX = fX1 - fX2;
fDistZ = fZ1 - fZ2;
return ((fRadius*fRadius) > (fDistX*fDistX + fDistZ*fDistZ));
}
BOOL Obj::IsInValidRadius(const Obj *pOb, FLOAT fRadius)
{
__ENTER_FUNCTION
Assert(pOb != NULL);
return IsInValidRadius(m_Pos.m_fX, m_Pos.m_fZ, pOb->m_Pos.m_fX, pOb->m_Pos.m_fZ, fRadius);
__LEAVE_FUNCTION
return FALSE ;
}
BOOL Obj::IsInValidRadius(const WORLD_POS *pPos, FLOAT fRadius)
{
__ENTER_FUNCTION
Assert(pPos != NULL);
return IsInValidRadius(m_Pos.m_fX, m_Pos.m_fZ, pPos->m_fX, pPos->m_fZ, fRadius);
__LEAVE_FUNCTION
return FALSE ;
}
VOID Obj::SetActiveFlag( BOOL bFlag )
{
__ENTER_FUNCTION
BYTE bNewActive = (BYTE)bFlag;
if ( m_bActive != bNewActive )
{
m_bActive = bNewActive;
// 将对象注册或反注册到相应的Zone中
if ( m_ZoneID != INVALID_ID )
{
if ( m_bActive )
{
BOOL bRet = getScene()->ObjZone_Register( this, m_ZoneID );
if ( !bRet )
{
Assert( bRet && "Obj::SetActiveFlag ObjZone_Register return FALSE" );
}
OnRegisterToZone();
}
else
{
BOOL bRet = getScene()->ObjZone_Unregister( this, m_ZoneID );
if ( !bRet )
{
Assert( bRet && "Obj::SetActiveFlag ObjZone_Unregister return FALSE" );
}
m_ZoneID = -1;
OnUnregisterFromZone();
}
}
}
__LEAVE_FUNCTION
}
BOOL Obj::UpdateZone( VOID )
{
__ENTER_FUNCTION
if ( getScene() == NULL )
return FALSE;
ZoneID_t idNew = getScene()->CalcZoneID( getWorldPos() );
ZoneID_t idOld = m_ZoneID;
if ( idNew != idOld )
{
m_ZoneID = idNew;
if ( IsActiveObj() )
{
if ( idNew != INVALID_ID )
{
if ( idOld != INVALID_ID )
{
BOOL bRet = getScene()->ObjZone_Changed( this, idNew, idOld );
if ( !bRet )
{
Assert( bRet && "Obj::UpdateZone ObjZone_Changed return FALSE" );
}
}
else
{
BOOL bRet = getScene()->ObjZone_Register( this, m_ZoneID );
if ( !bRet )
{
Assert( bRet && "Obj::UpdateZone ObjZone_Register return FALSE" );
}
OnRegisterToZone();
}
}
}
}
return TRUE;
__LEAVE_FUNCTION
return FALSE;
}
VOID Obj::Teleport( const WORLD_POS* pos )
{
__ENTER_FUNCTION
Scene* pScene = getScene();
if (pScene)
{
if ( !pScene->GetMap()->IsCanGo( *const_cast<WORLD_POS*>(pos) ) )
return ;
}
setWorldPos( pos );
UpdateZone();
if ( getScene() == NULL )
{
Assert( getScene() != NULL && "Obj::Teleport" );
return ;
}
// 同步一个Teleport的MSG到客户端
// to be continue...
GCObjTeleport msgTeleport;
msgTeleport.setObjID( GetID() );
msgTeleport.setWorldPos( m_Pos );
HUMANLIST listHuman;
getScene()->ScanHuman( getZoneID(), MAX_REFESH_OBJ_ZONE_RADIUS, &(listHuman) );
BYTE i;
for ( i = 0; i < listHuman.m_Count; i++ )
{
Obj_Human *pTargetHuman = listHuman.m_aHuman[i];
if ( IsCanViewMe( pTargetHuman ) )
{
pTargetHuman->GetPlayer()->SendPacket( &msgTeleport );
}
}
__LEAVE_FUNCTION
}
Packet *Obj::CreateDeleteObjPacket( VOID )
{
__ENTER_FUNCTION
if ( getScene() != NULL )
{
GCDelObject *pPacket = (GCDelObject*)(getScene()->m_pPacket_DelObject);
pPacket->setObjID( GetID() );
pPacket->setSceneID( getScene()->SceneID() );
return pPacket;
}
else
{
return NULL;
}
__LEAVE_FUNCTION
return NULL;
}
VOID Obj::DestroyDeleteObjPacket( Packet *pPacket )
{
}
Obj* Obj::GetSpecificObjInSameSceneByID(ObjID_t nID)
{
__ENTER_FUNCTION
if(NULL==m_pScene)
{
AssertEx(FALSE,"[Obj::GetSpecificObjInSameSceneByID]: m_pScene is NULL!!!");
return NULL;
}
ObjManager* pObjManager = m_pScene->GetObjManager();
if(NULL==pObjManager)
{
AssertEx(FALSE,"[Obj::GetSpecificObjInSameSceneByID]: m_pObjManager is NULL!!!");
return NULL;
}
return pObjManager->GetObj(nID);
__LEAVE_FUNCTION
return NULL;
}
Obj* Obj::GetSpecificHumanInSameSceneByGUID(GUID_t nID)
{
__ENTER_FUNCTION
Obj* pObj = NULL;
if(NULL!=g_pGUIDManager)
{
pObj = static_cast<Obj*>(g_pGUIDManager->Get(nID));
}
return pObj;
__LEAVE_FUNCTION
return NULL;
}
/////////////////////////////////////////////////////////////////////////////////
//obj 公共属性调用接口
UINT Obj::GetUniqueID(VOID) const
{
UINT nValue = __GetSceneID();
nValue = nValue<<16;
nValue += GetID()&0x0000FFFF;
return nValue;
}
const SceneID_t Obj::__GetSceneID( ) const//场景号 obj
{
if( m_pScene ) return m_pScene->SceneID() ;
return INVALID_ID ;
}
Scene* Obj::__GetScene( )//场景指针
{
return m_pScene ;
}
VOID Obj::__SetScene( Scene* scene )
{
m_pScene = scene ;
}
const ZoneID_t Obj::__GetZoneID( ) const//区域号 obj
{
return m_ZoneID ;
}
VOID Obj::__SetZoneID( const ZoneID_t zoneid )
{
m_ZoneID = zoneid ;
}
const ScriptID_t Obj::__GetScriptID( ) const//脚本号 obj
{
return INVALID_ID ;
}
VOID Obj::__SetScriptID( const ScriptID_t scriptid )
{
}
const WORLD_POS* Obj::__GetWorldPos( ) const//位置 obj
{
return &m_Pos ;
}
VOID Obj::__SetWorldPos( const WORLD_POS* worldpos )
{
m_Pos = *worldpos ;
}
const FLOAT Obj::__GetDir( ) const//方向 obj
{
return m_Dir ;
}
VOID Obj::__SetDir( const FLOAT dir )
{
m_Dir = dir ;
}
const ObjID_t Obj::__GetID( ) const//obj号 obj
{
return m_ObjID ;
}
VOID Obj::__SetID( const ObjID_t id )
{
m_ObjID = id ;
}
| [
"viticm@126.com"
] | viticm@126.com |
31bd478e192f3faed7a0f9317a06c8b76ad1e4de | 5e8d200078e64b97e3bbd1e61f83cb5bae99ab6e | /main/source/src/protocols/pack_daemon/MultistateFitnessFunction.cc | b40e4113fd0a84d852a93a1f5312e6eb9723cc46 | [] | no_license | MedicaicloudLink/Rosetta | 3ee2d79d48b31bd8ca898036ad32fe910c9a7a28 | 01affdf77abb773ed375b83cdbbf58439edd8719 | refs/heads/master | 2020-12-07T17:52:01.350906 | 2020-01-10T08:24:09 | 2020-01-10T08:24:09 | 232,757,729 | 2 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 20,335 | cc | // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington CoMotion, email: license@uw.edu.
/// @file protocols/pack_daemon/MultistateFitnessFunction.cc
/// @brief Implementation of the class MultistateFitnessFunction
/// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
// Unit headers
#include <protocols/pack_daemon/MultistateFitnessFunction.hh>
// Package headers
#include <protocols/pack_daemon/MultistateAggregateFunction.hh>
#include <protocols/pack_daemon/PackDaemon.hh>
// Project headers
#include <core/pose/Pose.hh>
#include <basic/Tracer.hh>
// Utility headers
#include <utility/assert.hh>
//#include <utility/heap.hh>
#include <utility/mpi_util.hh>
#include <utility/string_util.hh>
// C++ headers
#include <iostream>
#include <core/import_pose/import_pose.hh>
#include <utility/vector0.hh>
#include <utility/vector1.hh>
static basic::Tracer TR( "protocols.pack_daemon.MultistateFitnessFunction" );
namespace protocols {
namespace pack_daemon {
/// A struct for compairing entities and state energies for use in the
/// STL heap functions
struct EntityHistoryLT
{
public:
using EntityAndScore = TopEntitySet::EntityAndScore;
public:
bool operator () ( EntityAndScore const & a, EntityAndScore const & b ) {
return a.first->fitness() < b.first->fitness();
}
};
TopEntitySet::TopEntitySet() :
desired_entity_history_size_( 0 ),
n_tied_for_worst_( 0 )
{
}
core::Size
TopEntitySet::size() const
{
return top_entities_.size();
}
TopEntitySet::EntityAndScore const &
TopEntitySet::operator[] ( core::Size index ) const {
return top_entities_[ index ];
}
TopEntitySet::EntityAndScore &
TopEntitySet::operator[] ( core::Size index ) {
return top_entities_[ index ];
}
void
TopEntitySet::desired_entity_history_size( core::Size setting )
{
desired_entity_history_size_ = setting;
top_entities_.clear();
top_entities_.reserve( 2 * desired_entity_history_size_ );
n_tied_for_worst_ = 0;
}
void
TopEntitySet::clear()
{
top_entities_.clear();
n_tied_for_worst_ = 0;
}
core::Size
TopEntitySet::desired_entity_history_size() const
{
return desired_entity_history_size_;
}
std::list< TopEntitySet::EntityOP >
TopEntitySet::update_entity_history(
Entity const & ent,
StateEnergiesAndNPDs const & seanpds,
bool & added_new_entity
)
{
added_new_entity = false;
std::list< EntityOP > removed_entities;
if ( top_entities_.size() < desired_entity_history_size_ ) {
// 1. handle the cases when the heap is not yet full
if ( top_entities_.size() == 0 ) {
// a. first element added to the heap
n_tied_for_worst_ = 1;
} else if ( ent.fitness() == top_entities_.front().first->fitness() ) {
// b. tied with the worst element in the heap
++n_tied_for_worst_;
} else if ( ent.fitness() > top_entities_.front().first->fitness() ) {
// c. worse than the worst element in the heap -- a new low!
n_tied_for_worst_ = 1;
}
top_entities_.push_back( std::make_pair( utility::pointer::make_shared< Entity >( ent ), seanpds ) );
std::push_heap( top_entities_.begin(), top_entities_.end(), EntityHistoryLT() );
added_new_entity = true;
} else if ( ent.fitness() <= top_entities_.front().first->fitness() ) {
// 2. handle the cases when the heap is full
if ( top_entities_.front().first->fitness() == ent.fitness() ) {
// a. Tie between the new entity and the worst entity in the heap
++n_tied_for_worst_;
} else {
// b. Not a tie -- maybe we can remove some of the entities that are tied for worst
debug_assert( n_tied_for_worst_ <= top_entities_.size() );
if ( top_entities_.size() + 1 - n_tied_for_worst_ >= desired_entity_history_size_ ) {
// start popping entities from the heap
ASSERT_ONLY( core::Real const old_worst_fitness = top_entities_.front().first->fitness(););
for ( Size ii = 1; ii <= n_tied_for_worst_; ++ii ) {
debug_assert( top_entities_.front().first->fitness() == old_worst_fitness );
removed_entities.push_back( top_entities_.front().first );
std::pop_heap( top_entities_.begin(), top_entities_.end(), EntityHistoryLT() );
top_entities_.pop_back();
}
/// now, if the new entity has the same fitness as the current worst entity, determine how many entities are tied for worst.
if ( top_entities_.size() != 0 && ent.fitness() == top_entities_.front().first->fitness() ) {
utility::vector1< EntityAndScore > worst_entities; worst_entities.reserve( top_entities_.size() );
core::Real const new_worst_fitness = top_entities_.front().first->fitness();
n_tied_for_worst_ = 1; // count from 1, because the entity we're about to add will also be among the set of the worst
while ( top_entities_.size() != 0 && top_entities_.front().first->fitness() == new_worst_fitness ) {
worst_entities.push_back( top_entities_.front() );
std::pop_heap( top_entities_.begin(), top_entities_.end(), EntityHistoryLT() );
top_entities_.pop_back();
++n_tied_for_worst_;
}
/// ok -- we know how many entities are tied for worst. put these entities back
/// into the heap
for ( Size ii = 1; ii <= worst_entities.size(); ++ii ) {
top_entities_.push_back( worst_entities[ ii ] );
std::push_heap( top_entities_.begin(), top_entities_.end(), EntityHistoryLT() );
}
} else {
/// we just emptied out the history; the element we're about to add
/// will be the worst element in the history -- so save the fact that the number
/// of entities tied for last place is now 1.
n_tied_for_worst_ = 1;
}
}
}
top_entities_.push_back( std::make_pair( utility::pointer::make_shared< Entity >( ent ), seanpds ) );
std::push_heap( top_entities_.begin(), top_entities_.end(), EntityHistoryLT() );
added_new_entity = true;
}
return removed_entities;
}
core::Size
TopEntitySet::index_of_entity( Entity const & ent ) const
{
for ( core::Size ii = 1; ii <= top_entities_.size(); ++ii ) {
if ( *top_entities_[ ii ].first == ent ) {
return ii;
}
}
return 0;
}
TopEntitySet::EntityAndScore
TopEntitySet::pop()
{
if ( top_entities_.size() == 0 ) {
EntityAndScore empty;
return empty;
}
EntityAndScore worst = top_entities_.front();
std::pop_heap( top_entities_.begin(), top_entities_.end(), EntityHistoryLT() );
return worst;
}
MultistateFitnessFunction::MultistateFitnessFunction()
{
set_history_size( 1 ); // at the very least, store the optimal solution!
}
MultistateFitnessFunction::~MultistateFitnessFunction() = default;
core::Real MultistateFitnessFunction::evaluate( Entity & entity )
{
clock_t start_time = clock();
std::fill( state_energies_.begin(), state_energies_.end(), 0.0 );
if ( TR.visible( basic::t_debug ) ) {
TR.Debug << "Evaluating entity " << entity << std::endl;
}
compute_state_energies( entity );
core::Real score = compute_aggregate_score( entity );
entity.set_fitness( score );
update_entity_history( entity );
clock_t stop_time = clock();
if ( TR.visible( basic::t_debug ) ) {
TR.Debug << "evaluate() took " << ((double) stop_time - start_time ) / CLOCKS_PER_SEC << " seconds" << std::endl;
}
return score;
}
void MultistateFitnessFunction::daemon_set( DaemonSetOP ds )
{
daemon_set_ = ds;
state_energies_.resize( daemon_set_->ndaemons() );
npd_properties_.resize( daemon_set_->n_npd_properties() );
std::fill( state_energies_.begin(), state_energies_.end(), 0.0 );
std::fill( npd_properties_.begin(), npd_properties_.end(), 0.0 );
}
void MultistateFitnessFunction::aggregate_function( MultistateAggregateFunctionOP func )
{
aggregate_ = func;
}
DaemonSetCOP MultistateFitnessFunction::daemon_set() const
{
return daemon_set_;
}
utility::vector1< core::Real > const & MultistateFitnessFunction::state_energies() const
{
return state_energies_;
}
utility::vector1< core::Real > const & MultistateFitnessFunction::npd_properties() const
{
return npd_properties_;
}
MultistateAggregateFunctionCOP MultistateFitnessFunction::aggregate_function() const
{
return aggregate_;
}
void MultistateFitnessFunction::set_history_size( core::Size history_size )
{
top_entities_.desired_entity_history_size( history_size );
}
void MultistateFitnessFunction::clear_history()
{
top_entities_.clear();
}
std::list< std::pair< MultistateFitnessFunction::Size, MultistateFitnessFunction::PoseOP > >
MultistateFitnessFunction::recover_relevant_poses_for_entity( Entity const & ent )
{
Size entity_index = top_entities_.index_of_entity( ent );
if ( entity_index == 0 ) {
std::cerr << "Failed to find desired top entity: " << ent << std::endl;
std::cerr << "Top entities:" << std::endl;
for ( Size ii = 1; ii <= top_entities_.size(); ++ii ) {
std::cerr << ii << " " << *top_entities_[ ii ].first << std::endl;
}
utility_exit_with_message( "Failed to find desired top entity" );
}
MultistateAggregateFunction::StateIndices relevant_states =
aggregate_->select_relevant_states(
top_entities_[ entity_index ].second.first,
top_entities_[ entity_index ].second.second,
ent );
return recover_poses_from_states( *top_entities_[ entity_index ].first, relevant_states );
}
void MultistateFitnessFunction::compute_state_energies( Entity const & entity )
{
//std::fill( state_energies_.begin(), state_energies_.end(), 1234 );
//std::fill( npd_properties_.begin(), npd_properties_.end(), 1234 );
DaemonSet::StateEsAndNPDs energies =
daemon_set_->compute_energy_for_assignment( entity );
for ( DaemonSet::SizeRealPairs::const_iterator
iter = energies.first.begin(), iter_end = energies.first.end();
iter != iter_end; ++iter ) {
state_energies_[ iter->first ] = iter->second;
}
for ( DaemonSet::SizeRealPairs::const_iterator
iter = energies.second.begin(), iter_end = energies.second.end();
iter != iter_end; ++iter ) {
npd_properties_[ iter->first ] = iter->second;
}
//for ( Size ii = 1; ii <= state_energies_.size(); ++ii ) {
// if ( state_energies_[ ii ] == 1234 ) {
// std::cout << "Weird: state_energies_[ " << ii << " ] was not eevaluated" << std::endl;
// }
//}
//for ( Size ii = 1; ii <= npd_properties_.size(); ++ii ) {
// if ( npd_properties_[ ii ] == 1234 ) {
// std::cout << "Weird: npd_properties_[ " << ii << " ] was not eevaluated" << std::endl;
// }
//}
}
core::Real MultistateFitnessFunction::compute_aggregate_score( Entity const & entity )
{
return aggregate_->evaluate( state_energies_, npd_properties_, entity );
}
void MultistateFitnessFunction::instruct_daemons_to_keep_last_entity()
{
daemon_set_->mark_last_entity_as_important();
}
void MultistateFitnessFunction::instruct_daemons_to_drop_entity( Entity const & entity )
{
daemon_set_->mark_entity_as_unimportant( entity );
}
std::list< std::pair< MultistateFitnessFunction::Size, MultistateFitnessFunction::PoseOP > >
MultistateFitnessFunction::recover_poses_from_states(
Entity const & ent,
utility::vector1< core::Size > const & which_states
)
{
return daemon_set_->retrieve_relevant_poses_for_entity( ent, which_states );
}
utility::vector1< core::Real > &
MultistateFitnessFunction::state_energies() {
return state_energies_;
}
utility::vector1< core::Real > &
MultistateFitnessFunction::npd_properties()
{
return npd_properties_;
}
DaemonSetOP MultistateFitnessFunction::daemon_set()
{
return daemon_set_;
}
MultistateAggregateFunctionOP MultistateFitnessFunction::aggregate_function()
{
return aggregate_;
}
void
MultistateFitnessFunction::update_entity_history( Entity const & ent )
{
StateEnergiesAndNPDs seanpd = make_pair( state_energies_, npd_properties_ );
bool added_entity( false );
std::list< genetic_algorithm::EntityOP > discarded = top_entities_.update_entity_history( ent, seanpd, added_entity );
if ( added_entity ) instruct_daemons_to_keep_last_entity();
for ( auto & iter : discarded ) {
instruct_daemons_to_drop_entity( *iter );
}
}
MPIMultistateFitnessFunction::MPIMultistateFitnessFunction() :
MPI_nprocs_( 0 )
{
#ifdef USEMPI
MPI_nprocs_ = static_cast< Size > ( utility::mpi_nprocs() );
#endif
#ifdef APL_MEASURE_MSD_LOAD_BALANCE
utilization_by_node_.resize( MPI_nprocs_ );
packing_percentage_.resize( MPI_nprocs_ );
npd_percentage_.resize( MPI_nprocs_ );
#endif
}
MPIMultistateFitnessFunction::~MPIMultistateFitnessFunction() = default;
void MPIMultistateFitnessFunction::set_num_pack_daemons( Size n_daemons )
{
state_energies().resize( n_daemons );
}
void MPIMultistateFitnessFunction::set_num_npd_properties( Size n_npd_properties )
{
npd_properties().resize( n_npd_properties );
}
void MPIMultistateFitnessFunction::send_spin_down_signal()
{
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
utility::send_integer_to_node( ii, spin_down );
}
}
#ifdef APL_MEASURE_MSD_LOAD_BALANCE
void MPIMultistateFitnessFunction::print_load_balance_statistics( std::ostream & ostr ) const
{
for ( Size ii = 0; ii < MPI_nprocs_; ++ii ) {
Real ut_sum = 0; Real packing_sum = 0; Real npd_sum = 0; Size count = 0;
for ( std::list< core::Real >::const_iterator
uiter = utilization_by_node_[ ii ].begin(),
uiter_end = utilization_by_node_[ ii ].end(),
piter = packing_percentage_[ ii ].begin(),
//piter_end = packing_percentage_[ ii ].end(),
npditer = npd_percentage_[ ii ].begin() //,
//npditer_end = npd_percentage_[ ii ].end
; uiter != uiter_end; ++uiter, ++piter, ++npditer ) {
++count;
ut_sum += *uiter;
packing_sum += *piter;
npd_sum += *npditer;
}
ut_sum /= count;
packing_sum /= count;
npd_sum /= count;
ostr << "Node " << ii << " average utilization: " << ut_sum << " packing: " << packing_sum << " npd: " << npd_sum << std::endl;
}
}
void MPIMultistateFitnessFunction::reset_load_balance_statistics()
{
for ( Size ii = 0; ii < MPI_nprocs_; ++ii ) {
utilization_by_node_[ ii ].clear();
}
}
#endif
void MPIMultistateFitnessFunction::compute_state_energies( Entity const & entity )
{
using namespace utility;
#ifdef APL_MEASURE_MSD_LOAD_BALANCE
std::clock_t start_time = clock();
utility::vector0< core::Real > times( MPI_nprocs_ );
utility::vector0< core::Real > packing_times( MPI_nprocs_ );
utility::vector0< core::Real > npd_times( MPI_nprocs_ );
#endif
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
send_integer_to_node( ii, evaluate_entity );
}
broadcast_entity_string( entity );
std::fill( state_energies().begin(), state_energies().end(), core::Real( 0.0 ) );
if ( daemon_set() ) {
DaemonSet::StateEsAndNPDs energies = daemon_set()->
compute_energy_for_assignment( entity );
for ( std::list< std::pair< core::Size, core::Real > >::const_iterator
iter = energies.first.begin(), iter_end = energies.first.end();
iter != iter_end; ++iter ) {
state_energies()[ iter->first ] = iter->second;
}
for ( std::list< std::pair< core::Size, core::Real > >::const_iterator
iter = energies.second.begin(), iter_end = energies.second.end();
iter != iter_end; ++iter ) {
npd_properties()[ iter->first ] = iter->second;
}
}
#ifdef APL_MEASURE_MSD_LOAD_BALANCE
std::clock_t node0_stop_time = clock();
times[ 0 ] = ((double) node0_stop_time - start_time ) / CLOCKS_PER_SEC;
packing_times[ 0 ] = daemon_set()->last_packing_runtime();
npd_times[ 0 ] = daemon_set()->last_npd_runtime();
#endif
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
//TR << "receiving n_results from node " << ii << std::endl;
int n_results = receive_integer_from_node( ii );
//TR << "received " << n_results << " from node " << ii << std::endl;
for ( int jj = 1; jj <= n_results; ++jj ) {
int which_pack_daemon = receive_integer_from_node( ii );
Real energy_for_daemon = receive_double_from_node( ii );
//std::cout << "Received energy of " << energy_for_daemon << " for daemon #" << which_pack_daemon << " on node " << ii << " from a total of " << state_energies().size() << " PackDaemons" << std::endl;
state_energies()[ which_pack_daemon ] = energy_for_daemon;
}
//TR << "receiving n npd properties from node " << ii << std::endl;
int n_npd_properties = receive_integer_from_node( ii );
//TR << "received " << n_npd_properties << " n_npd_properties from node " << ii << std::endl;
for ( int jj = 1; jj <= n_npd_properties; ++jj ) {
int which_npd_prop = receive_integer_from_node( ii );
Real npd_property = receive_double_from_node( ii );
npd_properties()[ which_npd_prop ] = npd_property;
//TR << "property " << which_npd_prop << ": " << npd_property << " from node " << ii << std::endl;
}
#ifdef APL_MEASURE_MSD_LOAD_BALANCE
times[ ii ] = utility::receive_double_from_node( ii );
packing_times[ ii ] = utility::receive_double_from_node( ii );
npd_times[ ii ] = utility::receive_double_from_node( ii );
#endif
}
#ifdef APL_MEASURE_MSD_LOAD_BALANCE
std::clock_t final_stop_time = clock();
Real runtime = ((double) final_stop_time - start_time ) / CLOCKS_PER_SEC;
if (runtime != 0.0 ) {
for ( Size ii = 0; ii < MPI_nprocs_; ++ii ) {
utilization_by_node_[ ii ].push_back( times[ ii ] / runtime );
packing_percentage_[ ii ].push_back( packing_times[ ii ] / runtime );
npd_percentage_[ ii ].push_back( npd_times[ ii ] / runtime );
}
} else {
for ( Size ii = 0; ii < MPI_nprocs_; ++ii ) {
utilization_by_node_[ ii ].push_back( 1.0 );
packing_percentage_[ ii ].push_back( 0.0 );
npd_percentage_[ ii ].push_back( 0.0 );
}
}
#endif
//TR << "Finished computing state energies" << std::endl;
}
void MPIMultistateFitnessFunction::instruct_daemons_to_keep_last_entity()
{
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
utility::send_integer_to_node( ii, keep_rotamer_assignment_for_last_entity );
}
if ( daemon_set() ) {
daemon_set()->mark_last_entity_as_important();
}
}
void MPIMultistateFitnessFunction::instruct_daemons_to_drop_entity( Entity const & entity )
{
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
utility::send_integer_to_node( ii, discard_old_entity );
}
broadcast_entity_string( entity );
if ( daemon_set() ) {
daemon_set()->mark_entity_as_unimportant( entity );
}
}
std::list< std::pair< MultistateFitnessFunction::Size, MultistateFitnessFunction::PoseOP > >
MPIMultistateFitnessFunction::recover_poses_from_states(
Entity const & entity,
utility::vector1< core::Size > const & which_states
)
{
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
utility::send_integer_to_node( ii, geneate_pose_from_old_state );
}
broadcast_entity_string( entity );
utility::vector1< int > which_states_ints( which_states );
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
utility::send_integers_to_node( ii, which_states_ints );
}
std::list< std::pair< Size, PoseOP > > return_pose_list;
if ( daemon_set() ) {
std::list< std::pair< Size, PoseOP > > my_poses = daemon_set()->
retrieve_relevant_poses_for_entity( entity, which_states );
return_pose_list.splice( return_pose_list.end(), my_poses );
}
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
int n_poses_from_ii = utility::receive_integer_from_node( ii );
//std::cout << "Ready to receive " << n_poses_from_ii << " pdb strings from node " << ii << std::endl;
std::string pseudo_pdbname = "MPI_pdb_from_node_" + utility::to_string( ii );
for ( int jj = 1; jj <= n_poses_from_ii; ++jj ) {
//std::cout << "Receiving pose " << jj << " of " << n_poses_from_ii << std::flush;
Size pack_daemon_index = utility::receive_integer_from_node( ii );
std::string pdb_string = utility::receive_string_from_node( ii );
PoseOP pose( new Pose );
core::import_pose::pose_from_pdbstring( *pose, pdb_string, pseudo_pdbname );
return_pose_list.emplace_back( pack_daemon_index, pose );
//std::cout << "... done" << std::endl;
}
}
return return_pose_list;
}
void MPIMultistateFitnessFunction::broadcast_entity_string( Entity const & entity )
{
std::ostringstream oss;
entity.write_checkpoint( oss );
std::string entity_string = oss.str();
for ( Size ii = 1; ii < MPI_nprocs_; ++ii ) {
utility::send_string_to_node( ii, entity_string );
}
}
}
}
| [
"36790013+MedicaicloudLink@users.noreply.github.com"
] | 36790013+MedicaicloudLink@users.noreply.github.com |
9c953f1317e3b45bf78161bd79168b6bcd7b221e | a93a9b5bfd0f41ac5b1d599e7bf184ba45ff909e | /GPU/GPUTracking/TPCClusterFinder/CfConsts.h | fbf854789bc570cfee743915cb921591b9be2a60 | [] | permissive | preghenella/AliRoot | ce49b012fd85a7e47c7a868b092406cf32a6eade | 7a1a71f12a47e78e5082253e7a8edf08cd8afff6 | refs/heads/master | 2021-07-24T04:50:05.717754 | 2020-03-29T08:14:34 | 2020-03-29T08:14:34 | 128,885,625 | 0 | 0 | BSD-3-Clause | 2018-04-10T06:38:28 | 2018-04-10T06:38:27 | null | UTF-8 | C++ | false | false | 3,598 | h | //**************************************************************************\
//* This file is property of and copyright by the ALICE Project *\
//* ALICE Experiment at CERN, All rights reserved. *\
//* *\
//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *\
//* for The ALICE HLT Project. *\
//* *\
//* Permission to use, copy, modify and distribute this software and its *\
//* documentation strictly for non-commercial purposes is hereby granted *\
//* without fee, provided that the above copyright notice appears in all *\
//* copies and that both the copyright notice and this permission notice *\
//* appear in the supporting documentation. The authors make no claims *\
//* about the suitability of this software for any purpose. It is *\
//* provided "as is" without express or implied warranty. *\
//**************************************************************************
/// \file CfConsts.h
/// \author Felix Weiglhofer
#ifndef O2_GPU_CF_CONSTS_H
#define O2_GPU_CF_CONSTS_H
#include "clusterFinderDefs.h"
namespace GPUCA_NAMESPACE
{
namespace gpu
{
namespace CfConsts
{
GPUconstexpr() Delta2 InnerNeighbors[8] =
{
{-1, -1},
{-1, 0},
{-1, 1},
{0, -1},
{0, 1},
{1, -1},
{1, 0},
{1, 1}};
GPUconstexpr() bool InnerTestEq[8] =
{
true, true, true, true,
false, false, false, false};
GPUconstexpr() Delta2 OuterNeighbors[16] =
{
{-2, -1},
{-2, -2},
{-1, -2},
{-2, 0},
{-2, 1},
{-2, 2},
{-1, 2},
{0, -2},
{0, 2},
{2, -1},
{2, -2},
{1, -2},
{2, 0},
{2, 1},
{2, 2},
{1, 2}};
GPUconstexpr() uchar OuterToInner[16] =
{
0, 0, 0,
1,
2, 2, 2,
3,
4,
5, 5, 5,
6,
7, 7, 7};
// outer to inner mapping change for the peak counting step,
// as the other position is the position of the peak
GPUconstexpr() uchar OuterToInnerInv[16] =
{
1,
0,
3,
1,
1,
2,
4,
3,
4,
6,
5,
3,
6,
6,
7,
4};
#define NOISE_SUPPRESSION_NEIGHBOR_NUM 34
GPUconstexpr() Delta2 NoiseSuppressionNeighbors[NOISE_SUPPRESSION_NEIGHBOR_NUM] =
{
{-2, -3},
{-2, -2},
{-2, -1},
{-2, 0},
{-2, 1},
{-2, 2},
{-2, 3},
{-1, -3},
{-1, -2},
{-1, -1},
{-1, 0},
{-1, 1},
{-1, 2},
{-1, 3},
{0, -3},
{0, -2},
{0, -1},
{0, 1},
{0, 2},
{0, 3},
{1, -3},
{1, -2},
{1, -1},
{1, 0},
{1, 1},
{1, 2},
{1, 3},
{2, -3},
{2, -2},
{2, -1},
{2, 0},
{2, 1},
{2, 2},
{2, 3}};
GPUconstexpr() uint NoiseSuppressionMinima[NOISE_SUPPRESSION_NEIGHBOR_NUM] =
{
(1 << 8) | (1 << 9),
(1 << 9),
(1 << 9),
(1 << 10),
(1 << 11),
(1 << 11),
(1 << 11) | (1 << 12),
(1 << 8) | (1 << 9),
(1 << 9),
0,
0,
0,
(1 << 11),
(1 << 11) | (1 << 12),
(1 << 15) | (1 << 16),
(1 << 16),
0,
0,
(1 << 17),
(1 << 18) | (1 << 19),
(1 << 21) | (1 << 22),
(1 << 22),
0,
0,
0,
(1 << 24),
(1 << 24) | (1 << 25),
(1 << 21) | (1 << 22),
(1 << 22),
(1 << 22),
(1 << 23),
(1 << 24),
(1 << 24),
(1 << 24) | (1 << 25)};
} // namespace CfConsts
} // namespace gpu
} // namespace GPUCA_NAMESPACE
#endif
| [
"giulio.eulisse@cern.ch"
] | giulio.eulisse@cern.ch |
e08f59502130a954b55dca3560eb37cd4c129ee8 | 162a3db1eb6017a94e9f378d7a20f61e581ecbe9 | /src/content/browser/loader/navigation_url_loader_impl_unittest.cc | 82ebc55f63fc836dd8f1b71c643adae9d55d8111 | [
"BSD-3-Clause"
] | permissive | webosose/chromium84 | 705fbac37c5cfecd36113b41b7a0f4e8adf249d5 | 5decc42bef727dc957683fb5d8fa2fcc78936f15 | refs/heads/master | 2023-05-29T13:53:50.190538 | 2021-06-08T07:56:29 | 2021-06-10T01:19:24 | 330,895,427 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 22,297 | cc | // Copyright 2017 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 "content/browser/loader/navigation_url_loader_impl.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/run_loop.h"
#include "base/task/post_task.h"
#include "base/test/scoped_feature_list.h"
#include "base/unguessable_token.h"
#include "content/browser/frame_host/navigation_request_info.h"
#include "content/browser/loader/navigation_loader_interceptor.h"
#include "content/browser/loader/navigation_url_loader.h"
#include "content/browser/loader/single_request_url_loader_factory.h"
#include "content/browser/web_package/prefetched_signed_exchange_cache.h"
#include "content/common/navigation_params.h"
#include "content/common/navigation_params.mojom.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_ui_data.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/system_connector.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "content/test/test_navigation_url_loader_delegate.h"
#include "ipc/ipc_message.h"
#include "net/base/load_flags.h"
#include "net/base/mock_network_change_notifier.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/network/public/cpp/features.h"
#include "services/network/resource_scheduler/resource_scheduler_client.h"
#include "services/network/url_loader.h"
#include "services/network/url_request_context_owner.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
namespace {
class TestNavigationLoaderInterceptor : public NavigationLoaderInterceptor {
public:
explicit TestNavigationLoaderInterceptor(
base::Optional<network::ResourceRequest>* most_recent_resource_request)
: most_recent_resource_request_(most_recent_resource_request) {
net::URLRequestContextBuilder context_builder;
context_builder.set_proxy_resolution_service(
net::ConfiguredProxyResolutionService::CreateDirect());
context_ = context_builder.Build();
constexpr int child_id = 4;
constexpr int route_id = 8;
resource_scheduler_client_ =
base::MakeRefCounted<network::ResourceSchedulerClient>(
child_id, route_id, &resource_scheduler_,
context_->network_quality_estimator());
}
~TestNavigationLoaderInterceptor() override {
url_loader_ = nullptr;
resource_scheduler_client_ = nullptr;
}
void MaybeCreateLoader(const network::ResourceRequest& resource_request,
BrowserContext* browser_context,
LoaderCallback callback,
FallbackCallback fallback_callback) override {
std::move(callback).Run(base::MakeRefCounted<SingleRequestURLLoaderFactory>(
base::BindOnce(&TestNavigationLoaderInterceptor::StartLoader,
base::Unretained(this))));
}
void StartLoader(
const network::ResourceRequest& resource_request,
mojo::PendingReceiver<network::mojom::URLLoader> receiver,
mojo::PendingRemote<network::mojom::URLLoaderClient> client) {
*most_recent_resource_request_ = resource_request;
static network::mojom::URLLoaderFactoryParams params;
params.process_id = network::mojom::kBrowserProcessId;
params.is_corb_enabled = false;
url_loader_ = std::make_unique<network::URLLoader>(
context_.get(), nullptr /* network_service_client */,
nullptr /* network_context_client */,
base::BindOnce(&TestNavigationLoaderInterceptor::DeleteURLLoader,
base::Unretained(this)),
std::move(receiver), 0 /* options */, resource_request,
std::move(client), TRAFFIC_ANNOTATION_FOR_TESTS, ¶ms,
/*coep_reporter=*/nullptr, 0, /* request_id */
0 /* keepalive_request_size */, resource_scheduler_client_,
nullptr /* keepalive_statistics_recorder */,
nullptr /* network_usage_accumulator */, nullptr /* header_client */,
nullptr /* origin_policy_manager */, nullptr /* trust_token_helper */,
mojo::NullRemote() /* cookie_observer */);
}
bool MaybeCreateLoaderForResponse(
const network::ResourceRequest& request,
network::mojom::URLResponseHeadPtr* response,
mojo::ScopedDataPipeConsumerHandle* response_body,
mojo::PendingRemote<network::mojom::URLLoader>* loader,
mojo::PendingReceiver<network::mojom::URLLoaderClient>* client_receiver,
blink::ThrottlingURLLoader* url_loader,
bool* skip_other_interceptors,
bool* will_return_unsafe_redirect) override {
return false;
}
private:
void DeleteURLLoader(network::mojom::URLLoader* url_loader) {
DCHECK_EQ(url_loader_.get(), url_loader);
url_loader_.reset();
}
base::Optional<network::ResourceRequest>*
most_recent_resource_request_; // NOT OWNED.
network::ResourceScheduler resource_scheduler_;
std::unique_ptr<net::URLRequestContext> context_;
scoped_refptr<network::ResourceSchedulerClient> resource_scheduler_client_;
std::unique_ptr<network::URLLoader> url_loader_;
};
} // namespace
class NavigationURLLoaderImplTest : public testing::Test {
public:
NavigationURLLoaderImplTest()
: network_change_notifier_(
net::test::MockNetworkChangeNotifier::Create()),
task_environment_(BrowserTaskEnvironment::IO_MAINLOOP) {
// Because the network service is enabled we need a system Connector or
// BrowserContext::GetDefaultStoragePartition will segfault when
// ContentBrowserClient::CreateNetworkContext tries to call
// GetNetworkService.
mojo::PendingReceiver<service_manager::mojom::Connector> connector_receiver;
SetSystemConnectorForTesting(
service_manager::Connector::Create(&connector_receiver));
browser_context_.reset(new TestBrowserContext);
http_test_server_.AddDefaultHandlers(
base::FilePath(FILE_PATH_LITERAL("content/test/data")));
#if BUILDFLAG(ENABLE_PLUGINS)
PluginService::GetInstance()->Init();
#endif
}
~NavigationURLLoaderImplTest() override {
browser_context_.reset();
SetSystemConnectorForTesting(nullptr);
}
std::unique_ptr<NavigationURLLoader> CreateTestLoader(
const GURL& url,
const std::string& headers,
const std::string& method,
NavigationURLLoaderDelegate* delegate,
NavigationDownloadPolicy download_policy = NavigationDownloadPolicy(),
bool is_main_frame = true,
bool upgrade_if_insecure = false) {
mojom::BeginNavigationParamsPtr begin_params =
mojom::BeginNavigationParams::New(
MSG_ROUTING_NONE /* initiator_routing_id */, headers,
net::LOAD_NORMAL, false /* skip_service_worker */,
blink::mojom::RequestContextType::LOCATION,
network::mojom::RequestDestination::kDocument,
blink::WebMixedContentContextType::kBlockable,
false /* is_form_submission */,
false /* was_initiated_by_link_click */,
GURL() /* searchable_form_url */,
std::string() /* searchable_form_encoding */,
GURL() /* client_side_redirect_url */,
base::nullopt /* devtools_initiator_info */,
false /* attach_same_site_cookie */,
nullptr /* trust_token_params */, base::nullopt /* impression */);
auto common_params = CreateCommonNavigationParams();
common_params->url = url;
common_params->initiator_origin = url::Origin::Create(url);
common_params->method = method;
common_params->download_policy = download_policy;
url::Origin origin = url::Origin::Create(url);
std::unique_ptr<NavigationRequestInfo> request_info(
new NavigationRequestInfo(
std::move(common_params), std::move(begin_params),
net::IsolationInfo::Create(
net::IsolationInfo::RedirectMode::kUpdateTopFrame, origin,
origin, net::SiteForCookies::FromUrl(url)),
is_main_frame, false /* parent_is_main_frame */,
false /* are_ancestors_secure */, -1 /* frame_tree_node_id */,
false /* is_for_guests_only */, false /* report_raw_headers */,
false /* is_prerenering */,
upgrade_if_insecure /* upgrade_if_insecure */,
nullptr /* blob_url_loader_factory */,
base::UnguessableToken::Create() /* devtools_navigation_token */,
base::UnguessableToken::Create() /* devtools_frame_token */,
false /* obey_origin_policy */, {} /* cors_exempt_headers */));
std::vector<std::unique_ptr<NavigationLoaderInterceptor>> interceptors;
most_recent_resource_request_ = base::nullopt;
interceptors.push_back(std::make_unique<TestNavigationLoaderInterceptor>(
&most_recent_resource_request_));
return std::make_unique<NavigationURLLoaderImpl>(
browser_context_.get(),
BrowserContext::GetDefaultStoragePartition(browser_context_.get()),
std::move(request_info), nullptr /* navigation_ui_data */,
nullptr /* service_worker_handle */, nullptr /* appcache_handle */,
nullptr /* prefetched_signed_exchange_cache */, delegate,
mojo::NullRemote() /* cookie_access_obsever */,
std::move(interceptors));
}
// Requests |redirect_url|, which must return a HTTP 3xx redirect. It's also
// used as the initial origin.
// |request_method| is the method to use for the initial request.
// |expected_redirect_method| is the method that is expected to be used for
// the second request, after redirection.
// |expected_origin_value| is the expected value for the Origin header after
// redirection. If empty, expects that there will be no Origin header.
void HTTPRedirectOriginHeaderTest(const GURL& redirect_url,
const std::string& request_method,
const std::string& expected_redirect_method,
const std::string& expected_origin_value,
bool expect_request_fail = false) {
TestNavigationURLLoaderDelegate delegate;
std::unique_ptr<NavigationURLLoader> loader = CreateTestLoader(
redirect_url,
base::StringPrintf("%s: %s", net::HttpRequestHeaders::kOrigin,
redirect_url.GetOrigin().spec().c_str()),
request_method, &delegate);
delegate.WaitForRequestRedirected();
loader->FollowRedirect({}, {}, {}, PREVIEWS_OFF);
EXPECT_EQ(expected_redirect_method, delegate.redirect_info().new_method);
if (expect_request_fail) {
delegate.WaitForRequestFailed();
} else {
delegate.WaitForResponseStarted();
}
ASSERT_TRUE(most_recent_resource_request_);
// Note that there is no check for request success here because, for
// purposes of testing, the request very well may fail. For example, if the
// test redirects to an HTTPS server from an HTTP origin, thus it is cross
// origin, there is not an HTTPS server in this unit test framework, so the
// request would fail. However, that's fine, as long as the request headers
// are in order and pass the checks below.
if (expected_origin_value.empty()) {
EXPECT_FALSE(most_recent_resource_request_->headers.HasHeader(
net::HttpRequestHeaders::kOrigin));
} else {
std::string origin_header;
EXPECT_TRUE(most_recent_resource_request_->headers.GetHeader(
net::HttpRequestHeaders::kOrigin, &origin_header));
EXPECT_EQ(expected_origin_value, origin_header);
}
}
net::RequestPriority NavigateAndReturnRequestPriority(const GURL& url,
bool is_main_frame) {
TestNavigationURLLoaderDelegate delegate;
base::test::ScopedFeatureList scoped_feature_list_;
scoped_feature_list_.InitAndEnableFeature(features::kLowPriorityIframes);
std::unique_ptr<NavigationURLLoader> loader = CreateTestLoader(
url,
base::StringPrintf("%s: %s", net::HttpRequestHeaders::kOrigin,
url.GetOrigin().spec().c_str()),
"GET", &delegate, NavigationDownloadPolicy(), is_main_frame);
delegate.WaitForRequestRedirected();
loader->FollowRedirect({}, {}, {}, PREVIEWS_OFF);
delegate.WaitForResponseStarted();
return most_recent_resource_request_.value().priority;
}
net::RedirectInfo NavigateAndReturnRedirectInfo(const GURL& url,
bool upgrade_if_insecure,
bool expect_request_fail) {
TestNavigationURLLoaderDelegate delegate;
std::unique_ptr<NavigationURLLoader> loader = CreateTestLoader(
url,
base::StringPrintf("%s: %s", net::HttpRequestHeaders::kOrigin,
url.GetOrigin().spec().c_str()),
"GET", &delegate, NavigationDownloadPolicy(), true /*is_main_frame*/,
upgrade_if_insecure);
delegate.WaitForRequestRedirected();
loader->FollowRedirect({}, {}, {}, PREVIEWS_OFF);
if (expect_request_fail) {
delegate.WaitForRequestFailed();
} else {
delegate.WaitForResponseStarted();
}
return delegate.redirect_info();
}
protected:
std::unique_ptr<net::test::MockNetworkChangeNotifier>
network_change_notifier_;
BrowserTaskEnvironment task_environment_;
std::unique_ptr<TestBrowserContext> browser_context_;
net::EmbeddedTestServer http_test_server_;
base::Optional<network::ResourceRequest> most_recent_resource_request_;
};
TEST_F(NavigationURLLoaderImplTest, RequestPriority) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/redirect301-to-echo");
EXPECT_EQ(net::HIGHEST,
NavigateAndReturnRequestPriority(url, true /* is_main_frame */));
EXPECT_EQ(net::LOWEST,
NavigateAndReturnRequestPriority(url, false /* is_main_frame */));
}
TEST_F(NavigationURLLoaderImplTest, IsolationInfoOfMainFrameNavigation) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/foo");
const url::Origin origin = url::Origin::Create(url);
TestNavigationURLLoaderDelegate delegate;
std::unique_ptr<NavigationURLLoader> loader = CreateTestLoader(
url,
base::StringPrintf("%s: %s", net::HttpRequestHeaders::kOrigin,
url.GetOrigin().spec().c_str()),
"GET", &delegate, NavigationDownloadPolicy(), true /*is_main_frame*/,
false /*upgrade_if_insecure*/);
delegate.WaitForRequestStarted();
ASSERT_TRUE(most_recent_resource_request_);
ASSERT_TRUE(most_recent_resource_request_->trusted_params);
EXPECT_TRUE(
net::IsolationInfo::Create(
net::IsolationInfo::RedirectMode::kUpdateTopFrame, origin, origin,
net::SiteForCookies::FromOrigin(origin))
.IsEqualForTesting(
most_recent_resource_request_->trusted_params->isolation_info));
}
TEST_F(NavigationURLLoaderImplTest,
IsolationInfoOfRedirectedMainFrameNavigation) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/redirect301-to-echo");
const GURL final_url = http_test_server_.GetURL("/echo");
const url::Origin origin = url::Origin::Create(url);
HTTPRedirectOriginHeaderTest(url, "GET", "GET", url.GetOrigin().spec());
ASSERT_TRUE(most_recent_resource_request_->trusted_params);
EXPECT_TRUE(
net::IsolationInfo::Create(
net::IsolationInfo::RedirectMode::kUpdateTopFrame, origin, origin,
net::SiteForCookies::FromOrigin(origin))
.IsEqualForTesting(
most_recent_resource_request_->trusted_params->isolation_info));
}
TEST_F(NavigationURLLoaderImplTest, Redirect301Tests) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/redirect301-to-echo");
const GURL https_redirect_url =
http_test_server_.GetURL("/redirect301-to-https");
HTTPRedirectOriginHeaderTest(url, "GET", "GET", url.GetOrigin().spec());
HTTPRedirectOriginHeaderTest(https_redirect_url, "GET", "GET", "null", true);
HTTPRedirectOriginHeaderTest(url, "POST", "GET", std::string());
HTTPRedirectOriginHeaderTest(https_redirect_url, "POST", "GET", std::string(),
true);
}
TEST_F(NavigationURLLoaderImplTest, Redirect302Tests) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/redirect302-to-echo");
const GURL https_redirect_url =
http_test_server_.GetURL("/redirect302-to-https");
HTTPRedirectOriginHeaderTest(url, "GET", "GET", url.GetOrigin().spec());
HTTPRedirectOriginHeaderTest(https_redirect_url, "GET", "GET", "null", true);
HTTPRedirectOriginHeaderTest(url, "POST", "GET", std::string());
HTTPRedirectOriginHeaderTest(https_redirect_url, "POST", "GET", std::string(),
true);
}
TEST_F(NavigationURLLoaderImplTest, Redirect303Tests) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/redirect303-to-echo");
const GURL https_redirect_url =
http_test_server_.GetURL("/redirect303-to-https");
HTTPRedirectOriginHeaderTest(url, "GET", "GET", url.GetOrigin().spec());
HTTPRedirectOriginHeaderTest(https_redirect_url, "GET", "GET", "null", true);
HTTPRedirectOriginHeaderTest(url, "POST", "GET", std::string());
HTTPRedirectOriginHeaderTest(https_redirect_url, "POST", "GET", std::string(),
true);
}
TEST_F(NavigationURLLoaderImplTest, Redirect307Tests) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/redirect307-to-echo");
const GURL https_redirect_url =
http_test_server_.GetURL("/redirect307-to-https");
HTTPRedirectOriginHeaderTest(url, "GET", "GET", url.GetOrigin().spec());
HTTPRedirectOriginHeaderTest(https_redirect_url, "GET", "GET", "null", true);
HTTPRedirectOriginHeaderTest(url, "POST", "POST", url.GetOrigin().spec());
HTTPRedirectOriginHeaderTest(https_redirect_url, "POST", "POST", "null",
true);
}
TEST_F(NavigationURLLoaderImplTest, Redirect308Tests) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/redirect308-to-echo");
const GURL https_redirect_url =
http_test_server_.GetURL("/redirect308-to-https");
HTTPRedirectOriginHeaderTest(url, "GET", "GET", url.GetOrigin().spec());
HTTPRedirectOriginHeaderTest(https_redirect_url, "GET", "GET", "null", true);
HTTPRedirectOriginHeaderTest(url, "POST", "POST", url.GetOrigin().spec());
HTTPRedirectOriginHeaderTest(https_redirect_url, "POST", "POST", "null",
true);
}
TEST_F(NavigationURLLoaderImplTest, RedirectModifiedHeaders) {
ASSERT_TRUE(http_test_server_.Start());
const GURL redirect_url = http_test_server_.GetURL("/redirect301-to-echo");
TestNavigationURLLoaderDelegate delegate;
std::unique_ptr<NavigationURLLoader> loader = CreateTestLoader(
redirect_url, "Header1: Value1\r\nHeader2: Value2", "GET", &delegate);
delegate.WaitForRequestRedirected();
ASSERT_TRUE(most_recent_resource_request_);
// Initial request should only have initial headers.
std::string header1, header2;
EXPECT_TRUE(
most_recent_resource_request_->headers.GetHeader("Header1", &header1));
EXPECT_EQ("Value1", header1);
EXPECT_TRUE(
most_recent_resource_request_->headers.GetHeader("Header2", &header2));
EXPECT_EQ("Value2", header2);
EXPECT_FALSE(most_recent_resource_request_->headers.HasHeader("Header3"));
// Overwrite Header2 and add Header3.
net::HttpRequestHeaders redirect_headers;
redirect_headers.SetHeader("Header2", "");
redirect_headers.SetHeader("Header3", "Value3");
loader->FollowRedirect({}, redirect_headers, {}, PREVIEWS_OFF);
delegate.WaitForResponseStarted();
// Redirected request should also have modified headers.
EXPECT_TRUE(
most_recent_resource_request_->headers.GetHeader("Header1", &header1));
EXPECT_EQ("Value1", header1);
EXPECT_TRUE(
most_recent_resource_request_->headers.GetHeader("Header2", &header2));
EXPECT_EQ("", header2);
std::string header3;
EXPECT_TRUE(
most_recent_resource_request_->headers.GetHeader("Header3", &header3));
EXPECT_EQ("Value3", header3);
}
// Tests that the Upgrade If Insecure flag is obeyed.
TEST_F(NavigationURLLoaderImplTest, UpgradeIfInsecureTest) {
ASSERT_TRUE(http_test_server_.Start());
const GURL url = http_test_server_.GetURL("/redirect301-to-http");
GURL expected_url = GURL("http://test.test/test");
// We expect the request to fail since there is no server listening at
// test.test, but for the purpose of this test we only need to validate the
// redirect URL was not changed.
net::RedirectInfo redirect_info = NavigateAndReturnRedirectInfo(
url, false /* upgrade_if_insecure */, true /* expect_request_fail */);
EXPECT_FALSE(redirect_info.insecure_scheme_was_upgraded);
EXPECT_EQ(expected_url, redirect_info.new_url);
GURL::Replacements replacements;
replacements.SetSchemeStr("https");
expected_url = expected_url.ReplaceComponents(replacements);
redirect_info = NavigateAndReturnRedirectInfo(
url, true /* upgrade_if_insecure */, true /* expect_request_fail */);
// Same as above, but validating the URL is upgraded to https.
EXPECT_TRUE(redirect_info.insecure_scheme_was_upgraded);
EXPECT_EQ(expected_url, redirect_info.new_url);
}
} // namespace content
| [
"youngsoo.choi@lge.com"
] | youngsoo.choi@lge.com |
5acc71681de7e2bda1fd083a9554a61fd3eb7fcb | 5722258ec3ce781cd5ec13e125d71064a67c41d4 | /javafx/beans/value/ChangeListenerProxyForward.h | cb1ae649f04853fe7502f474e85fd7b2a66101d2 | [] | no_license | ISTE-SQA/HamsterJNIPP | 7312ef3e37c157b8656aa10f122cbdb510d53c2f | b29096d0baa9d93ec0aa21391b5a11b154928940 | refs/heads/master | 2022-03-19T11:27:03.765328 | 2019-10-24T15:06:26 | 2019-10-24T15:06:26 | 216,854,309 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 227 | h | #ifndef __javafx_beans_value_ChangeListenerProxyForward_H
#define __javafx_beans_value_ChangeListenerProxyForward_H
namespace javafx
{
namespace beans
{
namespace value
{
class ChangeListenerProxy;
}
}
}
#endif
| [
"steffen.becker@informatik.uni-stuttgart.de"
] | steffen.becker@informatik.uni-stuttgart.de |
513783677bc9ad03660d642f2803308afd28c896 | c82e95a99ab6c50dc1ed8b17ff3df61cad0d1f0a | /beelzebub/arc/x86/inc/lock_elision.hpp | a24c8dda90b2596b5f33e76fe0c995e82a6a2d13 | [
"NCSA",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | dalalsunil1986/Beelzebub | aa8bc4b6346ae61d866488376177ba3f0446ae28 | 9d0e4790060b313c6681ca7e478d08d3910332b0 | refs/heads/master | 2023-05-14T07:50:26.412632 | 2021-06-06T09:56:39 | 2021-06-06T09:56:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,986 | hpp | /*
Copyright (c) 2016 Alexandru-Mihai Maftei. All rights reserved.
Developed by: Alexandru-Mihai Maftei
aka Vercas
http://vercas.com | https://github.com/vercas/Beelzebub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal with the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of Alexandru-Mihai Maftei, Vercas, nor the names of
its contributors may be used to endorse or promote products derived from
this Software without specific prior written permission.
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
CONTRIBUTORS 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
WITH THE SOFTWARE.
---
You may also find the text of this license in "LICENSE.md", along with a more
thorough explanation regarding other files.
*/
#pragma once
#include <beel/handles.h>
namespace Beelzebub
{
__startup Handle ElideLocks();
}
| [
"contact@vercas.com"
] | contact@vercas.com |
5591af409913ea85060da6af89ec90152f471fb9 | 5df1a677af9379c9a82f1b29359a65ad8cbc385e | /CodeForces/PastContest/336256/G.cpp | 7557ecef6115b578a6a5d4a280c5baa2e36477ac | [] | no_license | heyshb/Competitive-Programming | 92741a4e7234e1ebce685c1b870f1287bee18f1a | 363ef78d950afb53f0e5f1d2329f27dd7b9a44c2 | refs/heads/master | 2021-12-15T03:12:37.676111 | 2021-12-01T14:32:25 | 2021-12-01T14:32:25 | 122,315,094 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,123 | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
int n;
int a[1000010];
int stk[1000010], top;
int nxt[1000010];
int d[1000010];
int main() {
scanf("%d",&n);
for (int i = 1; i <= n; i++) {
scanf("%d",&a[i]);
}
a[n + 1] = 1e9 + 10;
stk[top = 1] = n + 1;
for (int i = n; i >= 1; i--) {
if (a[stk[top]] >= a[i]) {
nxt[i] = i;
} else {
int L = 1, R = top;
while(L < R - 1) {
int mid = (L + R) / 2;
if (a[stk[mid]] < a[i]) {
R = mid;
} else {
L = mid;
}
}
nxt[i] = stk[R];
}
if (a[i] < a[stk[top]]) stk[++top] = i;
}
for (int i = 1; i <= n; i++) {
d[i]++;
d[nxt[i]]--;
}
//for (int i = 1; i <= n; i++) printf("%d ",nxt[i]);puts("");
int s = 0;
int cnt = 0;
for (int i = 1; i <= n - 1; i++) {
s += d[i];
//printf("%d %d\n",i,s);
if (s == 0) cnt++;
}
printf("%d\n",cnt + 1);
} | [
"heyshb123@gmail.com"
] | heyshb123@gmail.com |
a8f348904d3fdd55326b8e33022c58f9e06cc21b | 329c1515fe654d9abc7943c3bc327d9f6f918f97 | /Lagra/widget.h | fdbfc21aedc176e305d24f60de7052073d69a93d | [] | no_license | Kupchinsky/MV | 5a56ead4584a534466ae8dfc080105cb0c5b2a08 | b41f5d43e36722e2ab30940ddb2dc92968e9469a | refs/heads/master | 2021-01-17T15:43:38.017275 | 2016-04-05T05:41:38 | 2016-04-05T05:41:38 | 45,438,359 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 370 | h | #ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
void resizeEvent (QResizeEvent*);
private slots:
void on_pushButtonLagra_clicked();
private:
Ui::Widget *ui;
};
#endif // WIDGET_H
| [
"user@killer666.ru"
] | user@killer666.ru |
9376eb8483d0f892924bd07175d00d7e8efbb6db | 04251e142abab46720229970dab4f7060456d361 | /lib/rosetta/source/src/protocols/nonlocal/TreeBuilder.hh | ddf2826c27dda8f2ddf0fecf418cc86b4d6a766c | [] | no_license | sailfish009/binding_affinity_calculator | 216257449a627d196709f9743ca58d8764043f12 | 7af9ce221519e373aa823dadc2005de7a377670d | refs/heads/master | 2022-12-29T11:15:45.164881 | 2020-10-22T09:35:32 | 2020-10-22T09:35:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,572 | hh | // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington CoMotion, email: license@uw.edu.
/// @file protocols/nonlocal/TreeBuilder.hh
/// @author Christopher Miles (cmiles@uw.edu)
#ifndef INCLUDED_PROTOCOLS_NONLOCAL_TREEBUILDER_HH
#define INCLUDED_PROTOCOLS_NONLOCAL_TREEBUILDER_HH
// Unit headers
#include <protocols/nonlocal/TreeBuilder.fwd.hh>
// Utility headers
#include <utility/VirtualBase.hh>
// Project headers
#include <core/pose/Pose.fwd.hh>
#include <protocols/loops/Loops.fwd.hh>
#include <utility/vector1.hh>
namespace protocols {
namespace nonlocal {
class TreeBuilder : public utility::VirtualBase {
public:
/// @brief Programmatically constructs a FoldTree, updating <pose>.
virtual void set_up(const protocols::loops::Loops& chunks, core::pose::Pose* pose) = 0;
/// @brief Reverts any modifications to <pose> introduced in preceding calls
/// to set_up(). Only subclasses that introduce modifications are responsible
/// for overriding this method.
virtual void tear_down(core::pose::Pose*) {}
};
} // namespace nonlocal
} // namespace protocols
#endif // PROTOCOLS_NONLOCAL_TREEBUILDER_HH_
| [
"lzhangbk@connect.ust.hk"
] | lzhangbk@connect.ust.hk |
f7ecb14cd379828c3fff5dc722029abc0c67c127 | a1fbf16243026331187b6df903ed4f69e5e8c110 | /cs/engine/xrGame/GameTaskDefs.h | fd4caf10ee0e90a73cacb7886ad015736e041062 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | OpenXRay/xray-15 | ca0031cf1893616e0c9795c670d5d9f57ca9beff | 1390dfb08ed20997d7e8c95147ea8e8cb71f5e86 | refs/heads/xd_dev | 2023-07-17T23:42:14.693841 | 2021-09-01T23:25:34 | 2021-09-01T23:25:34 | 23,224,089 | 64 | 23 | NOASSERTION | 2019-04-03T17:50:18 | 2014-08-22T12:09:41 | C++ | UTF-8 | C++ | false | false | 1,327 | h | #pragma once
#include "alife_abstract_registry.h"
enum ETaskState{
eTaskStateFail = 0,
eTaskStateInProgress,
eTaskStateCompleted,
eTaskStateDummy = u16(-1)
};
enum ETaskType{
eTaskTypeStoryline = 0,
eTaskTypeAdditional,
eTaskTypeInsignificant,
eTaskTypeCount,
eTaskTypeDummy = u16(-1)
};
extern shared_str g_active_task_id[eTaskTypeCount];
class CGameTask;
struct SGameTaskKey : public IPureSerializeObject<IReader,IWriter>,public IPureDestroyableObject
{
shared_str task_id;
CGameTask* game_task;
SGameTaskKey (const shared_str& t_id):task_id(t_id),game_task(NULL) {};
SGameTaskKey ():task_id(NULL),game_task(NULL) {};
virtual void save (IWriter &stream);
virtual void load (IReader &stream);
virtual void destroy ();
};
using vGameTasks = xr_vector<SGameTaskKey>;
using vGameTasks_it = vGameTasks::iterator;
struct CGameTaskRegistry : public CALifeAbstractRegistry<u16, vGameTasks>
{
virtual void save(IWriter &stream)
{
CALifeAbstractRegistry<u16, vGameTasks>::save(stream);
for(int i=0; i<eTaskTypeCount; ++i)
save_data (g_active_task_id[i], stream);
};
virtual void load(IReader &stream)
{
CALifeAbstractRegistry<u16, vGameTasks>::load(stream);
for(int i=0; i<eTaskTypeCount; ++i)
load_data (g_active_task_id[i], stream);
};
};
| [
"paul-kv@yandex.ru"
] | paul-kv@yandex.ru |
7531a68f539b3e4540ccbfd34332e143621e3c46 | fe695c687e0458b2b289d5d48a2cd394a8fa96e3 | /Light.h | d9557cd284074c45266887d598aca3a36d09288b | [] | no_license | neropsys/D3DWerkshop | af68cc537b6cf48a636b110453e3dd2dd261a18c | f4187fabc5fa726950652e24d3b97c3cf7b249e6 | refs/heads/master | 2021-09-10T14:12:39.629093 | 2018-03-27T16:11:03 | 2018-03-27T16:11:03 | 117,575,170 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 119 | h | #pragma once
#include <DirectXMath.h>
using namespace DirectX;
struct Light {
XMFLOAT3 position;
XMFLOAT3 color;
}; | [
"neropsys@gmail.com"
] | neropsys@gmail.com |
0b8dd7a2b8b90bfa8292309e65d60710527c8dfb | 5499e8b91353ef910d2514c8a57a80565ba6f05b | /garnet/drivers/gpu/msd-qcom-adreno/src/instructions.h | 6991becf92f0abd44033fd92abfffc33ab72df4b | [
"BSD-3-Clause"
] | permissive | winksaville/fuchsia | 410f451b8dfc671f6372cb3de6ff0165a2ef30ec | a0ec86f1d51ae8d2538ff3404dad46eb302f9b4f | refs/heads/master | 2022-11-01T11:57:38.343655 | 2019-11-01T17:06:19 | 2019-11-01T17:06:19 | 223,695,500 | 3 | 2 | BSD-3-Clause | 2022-10-13T13:47:02 | 2019-11-24T05:08:59 | C++ | UTF-8 | C++ | false | false | 2,023 | h | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef INSTRUCTIONS_H
#define INSTRUCTIONS_H
#include <vector>
#include <magma_util/instruction_writer.h>
#include <magma_util/macros.h>
class Packet {
public:
static uint32_t parity(uint32_t v) {
// Based on http://graphics.stanford.edu/~seander/bithacks.html#ParityParallel
// Modified for odd parity
v ^= v >> 28;
v ^= v >> 24;
v ^= v >> 20;
v ^= v >> 16;
v ^= v >> 12;
v ^= v >> 8;
v ^= v >> 4;
v &= 0xf;
return (0x9669 >> v) & 1;
}
};
// For writing registers
class Packet4 : public Packet {
public:
static constexpr uint32_t kPacketType = 0x40000000;
static void write(magma::InstructionWriter* writer, uint32_t register_index, uint32_t value) {
DASSERT(!(register_index & 0xFFFC0000));
uint8_t count = 1;
uint32_t header = kPacketType;
header |= count;
header |= (parity(count) << 7);
header |= (register_index << 8);
header |= (parity(register_index) << 27);
writer->Write32(header);
writer->Write32(value);
}
};
// For a range of tasks determined by OpCode.
class Packet7 : public Packet {
public:
static constexpr uint32_t kPacketType = 0x70000000;
enum class OpCode {
CpRegisterToMemory = 62,
CpMeInit = 72,
};
static void write(magma::InstructionWriter* writer, OpCode opcode,
const std::vector<uint32_t>& packet) {
uint16_t count = packet.size();
DASSERT(static_cast<uint32_t>(count) == packet.size());
DASSERT(!(count & 0x8000));
uint32_t op = static_cast<uint32_t>(opcode);
DASSERT(!(op & 0x80));
uint32_t header = kPacketType;
header |= count;
header |= (parity(count) << 15);
header |= (op << 16);
header |= (parity(op) << 23);
writer->Write32(header);
for (uint32_t value : packet) {
writer->Write32(value);
}
}
};
#endif // INSTRUCTIONS_H
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
a09d7ac8d74ec4deace03ee1d968177289f04794 | 3bcc383b55e1ac6827dc0a4a2cac46eb9dccfac3 | /GWToolboxdll/Modules/ChatLog.h | 322a84991b6e1d8cfe729bbf5069a96b994a6391 | [
"LicenseRef-scancode-other-permissive"
] | permissive | necropola/GWToolboxpp | a002c88e948e6751e14f1bd9875bb8d40a2d6bad | 36a017dd073b05519213d4f79357f6a771b654d8 | refs/heads/master | 2022-03-07T04:10:21.944112 | 2022-02-25T22:20:21 | 2022-02-25T22:20:21 | 464,126,263 | 0 | 0 | NOASSERTION | 2022-02-27T12:10:32 | 2022-02-27T12:10:32 | null | UTF-8 | C++ | false | false | 4,316 | h | #pragma once
#include <GWCA/Utilities/Hook.h>
#include <GWCA/Packets/StoC.h>
#include <ToolboxModule.h>
class ChatLog : public ToolboxModule {
ChatLog() {};
~ChatLog() {
Reset();
};
private:
struct TBChatMessage {
TBChatMessage* next;
TBChatMessage* prev;
std::wstring msg;
uint32_t channel;
FILETIME timestamp;
TBChatMessage(wchar_t* _message, uint32_t _channel, FILETIME _timestamp) {
msg = _message;
timestamp = _timestamp;
channel = _channel;
}
};
struct TBSentMessage {
TBSentMessage* next;
TBSentMessage* prev;
std::wstring msg;
uint32_t gw_message_address = 0; // Used to ensure that messages aren't logged twice
TBSentMessage(wchar_t* _message, uint32_t addr = 0) {
msg = _message;
gw_message_address = addr ? addr : (uint32_t)_message;
}
};
TBChatMessage* recv_first = 0;
TBChatMessage* recv_last = 0;
TBSentMessage* sent_first = 0;
TBSentMessage* sent_last = 0;
size_t recv_count = 0;
size_t sent_count = 0;
std::wstring account;
bool injecting = false;
bool enabled = true;
bool pending_inject = false;
void SetEnabled(bool _enabled);
void Reset();
// Collect current in-game logs and combine them with the tb logs
void Fetch();
// Remove message from incoming log
void Remove(TBChatMessage* message);
// Add message to incoming log
void Add(GW::Chat::ChatMessage* in);
// Add message to outgoing log
void AddSent(wchar_t* _message, uint32_t addr = 0);
// Remove message from outgoing log
void RemoveSent(TBSentMessage* message);
// Add message to incoming log
void Add(wchar_t* _message, uint32_t _channel, FILETIME _timestamp);
void Save();
// Path to chat log file on disk
std::filesystem::path LogPath(const wchar_t* prefix);
// Load chat log from file via account email address
void Load(const std::wstring& _account);
// Clear current chat log and prefill from tb chat log; chat box will update on map change
void Inject();
void InjectSent();
// Set up chat log, load from file if applicable. Returns true if initialised
bool Init();
// Check outgoing log to see if message has already been added
bool IsAdded(wchar_t* _message, uint32_t addr) {
if (!addr)
addr = (uint32_t)_message;
TBSentMessage* sent = sent_last;
while (sent) {
// NB: GW uses TList in memory which means the only time the address will be nuked is when the log is cleared anyway
if (sent->gw_message_address == addr && wcscmp(sent->msg.c_str(), _message) == 0)
return true;
if (sent == sent_first)
break;
sent = sent->prev;
}
return false;
}
#pragma warning(push)
#pragma warning(disable: 4200)
struct GWSentMessage {
GWSentMessage* prev;
GWSentMessage* next;
wchar_t message[0];
};
#pragma warning(pop)
struct GWSentLog {
size_t count;
GWSentMessage* prev;
};
uintptr_t gw_sent_log_ptr = 0;
GWSentLog* GetSentLog() {
return gw_sent_log_ptr ? (GWSentLog*)(gw_sent_log_ptr - 0x4) : 0;
}
TBChatMessage* timestamp_override_message = 0;
GW::HookEntry PreAddToChatLog_entry;
GW::HookEntry PostAddToChatLog_entry;
GW::HookEntry UIMessage_Entry;
public:
static ChatLog& Instance() {
static ChatLog instance;
return instance;
}
const char* Name() const override { return "Chat Log"; }
const char* SettingsName() const override { return "Chat Settings"; }
void Initialize() override;
void RegisterSettingsContent() override;
void LoadSettings(CSimpleIni* ini) override;
void SaveSettings(CSimpleIni* ini) override;
static void OnAddToSentLog(wchar_t* message);
// On fresh chat log, inject toolbox message history
static void OnPreAddToChatLog(GW::HookStatus*, wchar_t*, uint32_t, GW::Chat::ChatMessage*);
// After adding chat log message, also add it to tb chat log.
static void OnPostAddToChatLog(GW::HookStatus*, wchar_t*, uint32_t, GW::Chat::ChatMessage* logged_message);
};
| [
""
] | |
b7964ddb34c9708897e79214a8cb21b42ea95abd | e1de0dcf47ade95481b5155dc84bd915a9470698 | /mesa.cc | bb24907eed2bcb428774967b7a384b9277aeb623 | [] | no_license | mstemen0010/CC | 5d03d72d54d7b2813b8195700370561bc2da0b06 | d979a235a5b996acd0a33a89e1688897cac3e404 | refs/heads/master | 2021-01-10T06:47:43.540014 | 2016-02-23T20:32:13 | 2016-02-23T20:32:13 | 52,389,881 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,468 | cc | #include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <fstream.h>
#include <strings.h>
#include "mstring.h"
#ifndef TRUE
#define TRUE 1
#define FALSE !TRUE
#endif
int main(int argc, char *argv[])
{
fstream in(fileno(stdin));
char inputs[BUFSIZ] = "";
mstring orig;
int opt, i;
extern char *optarg;
int numIndent = 0;
int numLevels = 0;
int center = FALSE;
mstring cell_type_begin = "<TD>";
mstring cell_type_end = "</TD>";
mstring table_width = "";
int numBuffer = 0;
while ((opt = getopt(argc, argv, "ci:l:w:hb:")) != -1)
{
switch(opt)
{
case 'b':
if (optarg)
numBuffer = atoi(optarg);
break;
case 'i':
if (optarg)
numIndent = atoi(optarg);
break;
case 'l':
if (optarg)
numLevels = atoi(optarg);
break;
case 'c':
center = TRUE;
break;
case 'w':
if (optarg)
{
table_width = "WIDTH=";
table_width += optarg;
}
break;
case 'h':
cell_type_begin = "<TH>";
cell_type_end = "</TH>";
}
}
in.getline(inputs, BUFSIZ - 1);
orig = inputs;
if (inputs)
{
if (center)
cout << "<CENTER>\n";
cout << "<TABLE BORDER=8 " << table_width << " > <!--Begin Raised table level 1-->\n <TR>\n" << cell_type_begin << "\n";
if (numBuffer)
for (i = 1; i < numBuffer; i++)
cout << "<BR>\n";
for (i = 1; i < numLevels; i++)
{
cout << "<TABLE BORDER=8 " << table_width << " > <!--Begin Raised table level 1-->\n <TR>\n" << cell_type_begin << "\n";
}
if (numIndent)
{
cout << "<DL><DD> <!-Begin Indent Level 1-->\n";
for (i = 1; i < numIndent; i++)
cout << "<DL><DD> <!--Continue Indent Level " << i + 1 << "-->\n";
}
cout << orig << "\n";
while ( in.getline(inputs, BUFSIZ - 1))
{
orig = inputs;
cout << orig << "\n";
}
cout.flush();
if (numIndent)
{
for (i = 1; i <= numIndent; i++)
cout << "</DD></DL> <!--End Indent Level " << abs(i - numIndent) + 1 << "-->\n";
}
cout.flush();
for (i = 1; i < numLevels; i++)
{
cout << cell_type_end << "\n</TR>\n" << "</TABLE> <!--End of Raised table level " << abs(i - numLevels) + 1 << "-->\n";
}
if (numBuffer)
for (i = 1; i < numBuffer; i++)
cout << "<BR>\n";
cout << cell_type_end << "\n</TR>\n" << "</TABLE> <!--End Raised table level 1-->\n";
if (center)
cout << "</CENTER>\n";
}
}
| [
"mstemen@gmail.com"
] | mstemen@gmail.com |
be5634805ac80b6e027825cb8598f644e00687d5 | 0023c3cb81491b6b440794c56e2a6714ce8b4e35 | /cpp8.cpp | 94c0e04b494ccf569d05cd6add252f702897bb3e | [] | no_license | mj-ribeiro/Cpp-Course | 199382685f76b08123a9afe72bbdbe2d8fe7142d | 7cbf6a7f2ce5d6d21beec4a7ef13ecf3825d3c04 | refs/heads/main | 2023-02-19T09:33:46.726463 | 2021-01-09T21:17:04 | 2021-01-09T21:17:04 | 325,310,350 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 775 | cpp | /*
Calculator in C++
*/
# include<iostream>
using namespace std;
int main(int argc, char** argv)
{
int num1, num2, res;
float div;
char op;
cout << "Type the first number:";
cin >> num1;
cout << "Type the second number:";
cin >> num2;
cout << "Type operation:";
cin >> op;
switch(op)
{
case '+':
res = num1 + num2;
cout << "sum:" << res << endl;
break;
case '-':
res = num1 - num2;
cout << "subtraction:" << res << endl;
break;
case '*':
res = num1 * num2;
cout << "multiplication:" << res << endl;
break;
case '/':
if(num2!=0){
div = (float)num1 / num2;
cout << "division:" << div << endl;
}else{
cout << "Zero division error!";
}
break;
return 0;
}
}
| [
"mjribeiro@usp.br"
] | mjribeiro@usp.br |
74639011bd774bfe5638ede80acea1175f5672ee | 20d34e31bfebc8b2526be47a1db541ee37e5dcaf | /src/eboks/wrappers/ruby/wrapper.hpp | af8317af27373e4c2eed02024e26b80f9ba79a95 | [] | no_license | martinjlowm/libeboks | a4fe2f39dd8bd3eb8fd82535e12918630bd705f0 | 72c3a0baa3689c6f5dcbaa46fe30de35c62eed41 | refs/heads/master | 2021-01-21T21:29:07.494526 | 2016-02-25T00:29:38 | 2016-02-25T00:29:38 | 29,186,851 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,883 | hpp | // /*
// * Copyright (c) 2015-2016, Martin Jesper Low Madsen
// * 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.
// *
// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// * POSSIBILITY OF SUCH DAMAGE.
// */
// #ifndef EBOKS_WRAPPERS_RUBY_WRAPPER_HPP_
// #define EBOKS_WRAPPERS_RUBY_WRAPPER_HPP_
// #include <ruby.h>
// #include <map>
// namespace eBoks {
// namespace Wrappers {
// namespace Ruby {
// class Wrapper {
// public:
// VALUE eBoks_;
// private:
// };
// } // namespace Ruby
// } // namespace Wrappers
// } // namespace eBoks
// #endif // EBOKS_WRAPPERS_RUBY_WRAPPER_HPP_
| [
"martin@martinjlowm.dk"
] | martin@martinjlowm.dk |
70053fac828d629bbecb93db58ff98c100838959 | 4a46f9d06515e61ef89ef0a5bfa1393cf218e68f | /src/qt/coincontroltreewidget.cpp | 976d4819a660b8cdab5a72c1192e1b8e819779f4 | [
"MIT"
] | permissive | GroinGuy/GroinCoin-GXG | fe886d386fef948c818b4b34c59040791da45f3b | d71c1b200683a77ccf797d8a500e468351da5ee0 | refs/heads/master | 2020-05-21T14:04:39.761147 | 2019-02-02T13:52:52 | 2019-02-02T13:52:52 | 19,191,079 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,164 | cpp | // Copyright (c) 2011-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// Copyright (c) 2014-2018 The Groincoin Core developers
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <qt/coincontroltreewidget.h>
#include <qt/coincontroldialog.h>
CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) :
QTreeWidget(parent)
{
}
void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox
{
event->ignore();
if (this->currentItem()) {
int COLUMN_CHECKBOX = 0;
this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked));
}
}
else if (event->key() == Qt::Key_Escape) // press esc -> close dialog
{
event->ignore();
CoinControlDialog *coinControlDialog = (CoinControlDialog*)this->parentWidget();
coinControlDialog->done(QDialog::Accepted);
}
else
{
this->QTreeWidget::keyPressEvent(event);
}
}
| [
"mendozg@gmx.com"
] | mendozg@gmx.com |
15ab3edc1f8a10e4998a0faec8cf0de0a70ccd56 | 87c8e87ca0064bb2dbe2f0da461d6cdaafe58dc2 | /ComHelpers/CallbackHelper.cpp | 5330d6dde5957ef749f8301392ea410031919f64 | [] | no_license | jamil-g/MapWInGIS5.2.4 | 5392551ef92ca3dbc4ccd37241caf74e8e2b5ac3 | 3b3b10dba0e1c78af8df398544505a48472ed416 | refs/heads/main | 2023-07-29T02:46:01.453327 | 2021-09-03T22:58:03 | 2021-09-03T22:58:03 | 369,660,295 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,862 | cpp | #include "StdAfx.h"
#include "CallbackHelper.h"
// ReSharper disable CppUseAuto
// *****************************************************************
// GDALProgressCallback()
// *****************************************************************
int CPL_STDCALL GDALProgressCallback(const double dfComplete, const char* pszMessage, void *pData)
{
CallbackParams* const params = static_cast<CallbackParams*>(pData);
// No need to check the presence of local callback,
// global application callback can be used as a fallback.
// There is no need to pass it as a parameter from each method.
if (params != nullptr)
{
const long percent = long(dfComplete * 100.0);
CallbackHelper::Progress(params->cBack, percent, params->sMsg);
}
return TRUE;
}
// ********************************************************************
// DisplayProgress()
// ********************************************************************
void CallbackHelper::Progress(ICallback* localCback, int index, int count, const char* message, long& lastPercent)
{
Progress(localCback, index, static_cast<double>(count), message, m_globalSettings.emptyBstr, lastPercent);
}
void CallbackHelper::Progress(ICallback* localCback, int index, int count, const char* message, BSTR& key, long& lastPercent)
{
Progress(localCback, index, static_cast<double>(count), message, key, lastPercent);
}
// ********************************************************************
// GetCurrent()
// ********************************************************************
ICallback* CallbackHelper::GetCurrent(ICallback* localCback)
{
if (m_globalSettings.overrideLocalCallback)
{
return m_globalSettings.callback ? m_globalSettings.callback : localCback;
}
else
{
return localCback ? localCback : m_globalSettings.callback;
}
}
// ********************************************************************
// DisplayProgress()
// ********************************************************************
void CallbackHelper::Progress(ICallback* localCback, int index, double count, const char* message, BSTR& key, long& lastPercent)
{
ICallback* callback = GetCurrent(localCback);
if (!callback) return;
const long newpercent = static_cast<long>(static_cast<double>(index + 1) / count * 100);
if (newpercent > lastPercent)
{
lastPercent = newpercent;
const CComBSTR bstrMsg(message);
callback->Progress(key, newpercent, bstrMsg);
}
}
// ********************************************************************
// DisplayProgress()
// ********************************************************************
void CallbackHelper::Progress(ICallback* localCback, int percent, const char* message, BSTR& key)
{
ICallback* callback = GetCurrent(localCback);
if (!callback) return;
const CComBSTR bstrMsg(message);
callback->Progress(key, percent, bstrMsg);
}
// ********************************************************************
// DisplayProgress()
// ********************************************************************
void CallbackHelper::Progress(ICallback* localCback, int percent, const char* message)
{
ICallback* callback = GetCurrent(localCback);
if (!callback) return;
if (!message) message = "";
const CComBSTR bstrMsg(message);
callback->Progress(m_globalSettings.emptyBstr, percent, bstrMsg);
}
// ********************************************************************
// DisplayProgressCompleted()
// ********************************************************************
void CallbackHelper::ProgressCompleted(ICallback* localCback, BSTR& key)
{
ICallback* callback = GetCurrent(localCback);
if (!callback) return;
const CComBSTR bstrMsg("Completed");
callback->Progress(key, 100, bstrMsg);
callback->Progress(key, 0, m_globalSettings.emptyBstr);
}
// ********************************************************************
// DisplayProgressCompleted()
// ********************************************************************
void CallbackHelper::ProgressCompleted(ICallback* localCback)
{
ProgressCompleted(localCback, m_globalSettings.emptyBstr);
}
// ********************************************************************
// DisplayErrorMsg()
// ********************************************************************
void CallbackHelper::ErrorMsg(const CString className, ICallback* localCback, BSTR& key, const char* message, ...)
{
ICallback* callback = GetCurrent(localCback);
if (callback || Debug::IsDebugMode())
{
if (strcmp(message, "No Error") == 0) return;
TCHAR buffer[1024];
va_list args;
va_start(args, message);
vsprintf(buffer, message, args);
CString s = buffer;
s = className + ": " + s;
const CComBSTR bstr(s);
if (callback) {
callback->Error(key, bstr);
}
else {
Debug::WriteError(s);
}
}
}
void CallbackHelper::ErrorMsg(CString className, ICallback* localCallback, CString key, const char* message, ...)
{
if (localCallback || Debug::IsDebugMode())
{
CComBSTR bstrKey(key);
ErrorMsg(className, localCallback, bstrKey.m_str, message);
}
}
void CallbackHelper::ErrorMsg(const char* message)
{
const CString s = message;
ErrorMsg(s);
}
void CallbackHelper::ErrorMsg(CString message)
{
if (m_globalSettings.callback)
{
const CComBSTR bstr(message);
m_globalSettings.callback->Error(m_globalSettings.emptyBstr, bstr);
}
else {
if (Debug::IsDebugMode())
Debug::WriteError(message);
}
}
// ****************************************************************
// AssertionFailed
// ****************************************************************
void CallbackHelper::AssertionFailed(CString message)
{
message = "Assertion failed: " + message;
if (m_globalSettings.callback)
{
const CComBSTR bstr(message);
m_globalSettings.callback->Error(m_globalSettings.emptyBstr, bstr);
}
else {
if (Debug::IsDebugMode())
Debug::WriteError(message);
}
}
// ReSharper restore CppUseAuto
| [
"jamil.garzuzi@gmail.com"
] | jamil.garzuzi@gmail.com |
67fb9c862bcfb537a0911a79d0c98333333f1507 | 41b4adb10cc86338d85db6636900168f55e7ff18 | /aws-cpp-sdk-elasticbeanstalk/source/model/DescribeApplicationsRequest.cpp | 619bb60391795199875e3967042390d0fdf113ce | [
"JSON",
"MIT",
"Apache-2.0"
] | permissive | totalkyos/AWS | 1c9ac30206ef6cf8ca38d2c3d1496fa9c15e5e80 | 7cb444814e938f3df59530ea4ebe8e19b9418793 | refs/heads/master | 2021-01-20T20:42:09.978428 | 2016-07-16T00:03:49 | 2016-07-16T00:03:49 | 63,465,708 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,399 | cpp | /*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <aws/elasticbeanstalk/model/DescribeApplicationsRequest.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
using namespace Aws::ElasticBeanstalk::Model;
using namespace Aws::Utils;
DescribeApplicationsRequest::DescribeApplicationsRequest() :
m_applicationNamesHasBeenSet(false)
{
}
Aws::String DescribeApplicationsRequest::SerializePayload() const
{
Aws::StringStream ss;
ss << "Action=DescribeApplications&";
if(m_applicationNamesHasBeenSet)
{
unsigned applicationNamesCount = 1;
for(auto& item : m_applicationNames)
{
ss << "ApplicationNames.member." << applicationNamesCount << "="
<< StringUtils::URLEncode(item.c_str()) << "&";
applicationNamesCount++;
}
}
ss << "Version=2010-12-01";
return ss.str();
}
| [
"henso@amazon.com"
] | henso@amazon.com |
4efe37b9134a67a9ed2bf036aaedf5395dc4f887 | fe2bc85d1dacb4a48d78015668621d6767e0fdc9 | /src/EnergyPlus/HVACCooledBeam.cc | 326ff633dbe93c2db7c521c1dfa8a04d1d48dc8a | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | EnergyArchmage/EplusFanDev | 75bb3e2616d86a6cef27be2b2c94559a45ad1d44 | 622daef164d653a241fba7d924bc1e536a089006 | refs/heads/master | 2016-08-12T23:49:08.124188 | 2016-03-30T13:18:24 | 2016-03-30T13:18:24 | 46,808,964 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 53,231 | cc | // EnergyPlus, Copyright (c) 1996-2016, The Board of Trustees of the University of Illinois and
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights
// reserved.
//
// If you have questions about your rights to use or distribute this software, please contact
// Berkeley Lab's Innovation & Partnerships Office at IPO@lbl.gov.
//
// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
// U.S. Government consequently retains certain rights. As such, the U.S. Government has been
// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
// worldwide license in the Software to reproduce, distribute copies to the public, prepare
// derivative works, and perform publicly and display publicly, and to permit others to do so.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted
// provided that the following conditions are met:
//
// (1) Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// (2) Redistributions in binary form must reproduce the above copyright notice, this list of
// conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific prior
// written permission.
//
// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
// without changes from the version obtained under this License, or (ii) Licensee makes a
// reference solely to the software portion of its product, Licensee must refer to the
// software as "EnergyPlus version X" software, where "X" is the version number Licensee
// obtained under this License and may not use a different name for the software. Except as
// specifically required in this Section (4), Licensee shall not use in a company name, a
// product name, in advertising, publicity, or other promotional activities any name, trade
// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
// similar designation, without Lawrence Berkeley National Laboratory's prior written consent.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// You are under no obligation whatsoever to provide any bug fixes, patches, or upgrades to the
// features, functionality or performance of the source code ("Enhancements") to anyone; however,
// if you choose to make your Enhancements available either publicly, or directly to Lawrence
// Berkeley National Laboratory, without imposing a separate written license agreement for such
// Enhancements, then you hereby grant the following license: a non-exclusive, royalty-free
// perpetual license to install, use, modify, prepare derivative works, incorporate into other
// computer software, distribute, and sublicense such enhancements or derivative works thereof,
// in binary and source code form.
// C++ Headers
#include <cmath>
// ObjexxFCL Headers
#include <ObjexxFCL/Array.functions.hh>
#include <ObjexxFCL/Fmath.hh>
// EnergyPlus Headers
#include <HVACCooledBeam.hh>
#include <BranchNodeConnections.hh>
#include <DataContaminantBalance.hh>
#include <DataDefineEquip.hh>
#include <DataEnvironment.hh>
#include <DataHVACGlobals.hh>
#include <DataIPShortCuts.hh>
#include <DataLoopNode.hh>
#include <DataPlant.hh>
#include <DataPrecisionGlobals.hh>
#include <DataSizing.hh>
#include <DataZoneEnergyDemands.hh>
#include <DataZoneEquipment.hh>
#include <FluidProperties.hh>
#include <General.hh>
#include <GeneralRoutines.hh>
#include <InputProcessor.hh>
#include <NodeInputManager.hh>
#include <OutputProcessor.hh>
#include <PlantUtilities.hh>
#include <Psychrometrics.hh>
#include <ReportSizingManager.hh>
#include <ScheduleManager.hh>
#include <UtilityRoutines.hh>
#include <WaterCoils.hh>
namespace EnergyPlus {
namespace HVACCooledBeam {
// Module containing routines dealing with cooled beam units
// MODULE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN February 2, 2008
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS MODULE:
// To encapsulate the data and algorithms needed to simulate cooled beam units
// METHODOLOGY EMPLOYED:
// Cooled beam units are treated as terminal units. There is a fixed amount of supply air delivered
// either directly through a diffuser or through the cooled beam units. Thermodynamically the
// situation is similar to 4 pipe induction terminal units. The detailed methodology follows the
// method in DOE-2.1E.
// REFERENCES:
// na
// OTHER NOTES:
// na
// Using/Aliasing
using namespace DataPrecisionGlobals;
using namespace DataLoopNode;
using DataGlobals::BeginEnvrnFlag;
using DataGlobals::NumOfZones;
using DataGlobals::InitConvTemp;
using DataGlobals::SysSizingCalc;
using DataGlobals::Pi;
using DataGlobals::SecInHour;
using DataGlobals::ScheduleAlwaysOn;
using DataEnvironment::StdBaroPress;
using DataEnvironment::StdRhoAir;
// Use statements for access to subroutines in other modules
using namespace ScheduleManager;
using Psychrometrics::PsyRhoAirFnPbTdbW;
using Psychrometrics::PsyCpAirFnWTdb;
using Psychrometrics::PsyHFnTdbW;
using DataHVACGlobals::SmallMassFlow;
using DataHVACGlobals::SmallLoad;
using DataHVACGlobals::SmallAirVolFlow;
using DataHVACGlobals::TimeStepSys;
using DataHVACGlobals::SmallWaterVolFlow;
// Data
// MODULE PARAMETER DEFINITIONS:
int const Passive_Cooled_Beam( 1 );
int const Active_Cooled_Beam( 2 );
Real64 const NomMassFlowPerBeam( 0.07 ); // nominal water mass flow rate per beam [kg/s]
Real64 const MinWaterVel( 0.2 ); // minimum water velocity [m/s]
Real64 const Coeff2( 10000.0 );
// DERIVED TYPE DEFINITIONS:
// MODULE VARIABLE DECLARATIONS:
Array1D_bool CheckEquipName;
// INTEGER :: NumPassiveCB = 0
// INTEGER :: NumActiveCB = 0
int NumCB( 0 );
// SUBROUTINE SPECIFICATIONS FOR MODULE HVACCooledBeam:
// Object Data
Array1D< CoolBeamData > CoolBeam;
// Functions
void
SimCoolBeam(
std::string const & CompName, // name of the cooled beam unit
bool const FirstHVACIteration, // TRUE if first HVAC iteration in time step
int const ZoneNum, // index of zone served by the unit
int const ZoneNodeNum, // zone node number of zone served by the unit
int & CompIndex, // which cooled beam unit in data structure
Real64 & NonAirSysOutput // convective cooling by the beam system [W]
)
{
// SUBROUTINE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN Feb 3, 2009
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// Manages the simulation of a cooled beam unit.
// Called from SimZoneAirLoopEquipment in module ZoneAirLoopEquipmentManager.
// METHODOLOGY EMPLOYED:
// na
// REFERENCES:
// na
// Using/Aliasing
using InputProcessor::FindItemInList;
using General::TrimSigDigits;
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// SUBROUTINE PARAMETER DEFINITIONS:
// na
// INTERFACE BLOCK SPECIFICATIONS:
// na
// DERIVED TYPE DEFINITIONS:
// na
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int CBNum; // index of cooled beam unit being simulated
static bool GetInputFlag( true ); // First time, input is "gotten"
// First time SimIndUnit is called, get the input for all the cooled beam units
if ( GetInputFlag ) {
GetCoolBeams();
GetInputFlag = false;
}
// Get the unit index
if ( CompIndex == 0 ) {
CBNum = FindItemInList( CompName, CoolBeam );
if ( CBNum == 0 ) {
ShowFatalError( "SimCoolBeam: Cool Beam Unit not found=" + CompName );
}
CompIndex = CBNum;
} else {
CBNum = CompIndex;
if ( CBNum > NumCB || CBNum < 1 ) {
ShowFatalError( "SimCoolBeam: Invalid CompIndex passed=" + TrimSigDigits( CompIndex ) + ", Number of Cool Beam Units=" + TrimSigDigits( NumCB ) + ", System name=" + CompName );
}
if ( CheckEquipName( CBNum ) ) {
if ( CompName != CoolBeam( CBNum ).Name ) {
ShowFatalError( "SimCoolBeam: Invalid CompIndex passed=" + TrimSigDigits( CompIndex ) + ", Cool Beam Unit name=" + CompName + ", stored Cool Beam Unit for that index=" + CoolBeam( CBNum ).Name );
}
CheckEquipName( CBNum ) = false;
}
}
if ( CBNum == 0 ) {
ShowFatalError( "Cool Beam Unit not found = " + CompName );
}
// initialize the unit
InitCoolBeam( CBNum, FirstHVACIteration );
ControlCoolBeam( CBNum, ZoneNum, ZoneNodeNum, FirstHVACIteration, NonAirSysOutput );
// Update the current unit's outlet nodes. No update needed
UpdateCoolBeam( CBNum );
// Fill the report variables. There are no report variables
ReportCoolBeam( CBNum );
}
void
GetCoolBeams()
{
// SUBROUTINE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN Feb 3, 2009
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// Obtains input data for cool beam units and stores it in the
// cool beam unit data structures
// METHODOLOGY EMPLOYED:
// Uses "Get" routines to read in data.
// REFERENCES:
// na
// Using/Aliasing
using InputProcessor::GetNumObjectsFound;
using InputProcessor::GetObjectItem;
using InputProcessor::VerifyName;
using InputProcessor::SameString;
using InputProcessor::GetObjectDefMaxArgs;
using NodeInputManager::GetOnlySingleNode;
using BranchNodeConnections::TestCompSet;
using BranchNodeConnections::SetUpCompSets;
using DataZoneEquipment::ZoneEquipConfig;
using namespace DataSizing;
using DataDefineEquip::AirDistUnit;
using DataDefineEquip::NumAirDistUnits;
using WaterCoils::GetCoilWaterInletNode;
using namespace DataIPShortCuts;
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// na
// SUBROUTINE PARAMETER DEFINITIONS:
static std::string const RoutineName( "GetCoolBeams " ); // include trailing blank space
// INTERFACE BLOCK SPECIFICATIONS:
// na
// DERIVED TYPE DEFINITIONS:
// na
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
// na
int CBIndex; // loop index
int CBNum; // current fan coil number
std::string CurrentModuleObject; // for ease in getting objects
Array1D_string Alphas; // Alpha input items for object
Array1D_string cAlphaFields; // Alpha field names
Array1D_string cNumericFields; // Numeric field names
Array1D< Real64 > Numbers; // Numeric input items for object
Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE.
Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE.
static int NumAlphas( 0 ); // Number of Alphas for each GetObjectItem call
static int NumNumbers( 0 ); // Number of Numbers for each GetObjectItem call
static int TotalArgs( 0 ); // Total number of alpha and numeric arguments (max) for a
// certain object in the input file
int IOStatus; // Used in GetObjectItem
static bool ErrorsFound( false ); // Set to true if errors in input, fatal at end of routine
bool IsNotOK; // Flag to verify name
bool IsBlank; // Flag for blank name
int CtrlZone; // controlled zome do loop index
int SupAirIn; // controlled zone supply air inlet index
bool AirNodeFound;
int ADUNum;
// find the number of cooled beam units
CurrentModuleObject = "AirTerminal:SingleDuct:ConstantVolume:CooledBeam";
NumCB = GetNumObjectsFound( CurrentModuleObject );
// allocate the data structures
CoolBeam.allocate( NumCB );
CheckEquipName.dimension( NumCB, true );
GetObjectDefMaxArgs( CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers );
NumAlphas = 7;
NumNumbers = 16;
TotalArgs = 23;
Alphas.allocate( NumAlphas );
cAlphaFields.allocate( NumAlphas );
cNumericFields.allocate( NumNumbers );
Numbers.dimension( NumNumbers, 0.0 );
lAlphaBlanks.dimension( NumAlphas, true );
lNumericBlanks.dimension( NumNumbers, true );
// loop over cooled beam units; get and load the input data
for ( CBIndex = 1; CBIndex <= NumCB; ++CBIndex ) {
GetObjectItem( CurrentModuleObject, CBIndex, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields );
CBNum = CBIndex;
IsNotOK = false;
IsBlank = false;
VerifyName( Alphas( 1 ), CoolBeam, CBNum - 1, IsNotOK, IsBlank, CurrentModuleObject + " Name" );
if ( IsNotOK ) {
ErrorsFound = true;
if ( IsBlank ) Alphas( 1 ) = "xxxxx";
}
CoolBeam( CBNum ).Name = Alphas( 1 );
CoolBeam( CBNum ).UnitType = CurrentModuleObject;
CoolBeam( CBNum ).UnitType_Num = 1;
CoolBeam( CBNum ).CBType = Alphas( 3 );
if ( SameString( CoolBeam( CBNum ).CBType, "Passive" ) ) {
CoolBeam( CBNum ).CBType_Num = Passive_Cooled_Beam;
} else if ( SameString( CoolBeam( CBNum ).CBType, "Active" ) ) {
CoolBeam( CBNum ).CBType_Num = Active_Cooled_Beam;
} else {
ShowSevereError( "Illegal " + cAlphaFields( 3 ) + " = " + CoolBeam( CBNum ).CBType + '.' );
ShowContinueError( "Occurs in " + CurrentModuleObject + " = " + CoolBeam( CBNum ).Name );
ErrorsFound = true;
}
CoolBeam( CBNum ).Sched = Alphas( 2 );
if ( lAlphaBlanks( 2 ) ) {
CoolBeam( CBNum ).SchedPtr = ScheduleAlwaysOn;
} else {
CoolBeam( CBNum ).SchedPtr = GetScheduleIndex( Alphas( 2 ) ); // convert schedule name to pointer
if ( CoolBeam( CBNum ).SchedPtr == 0 ) {
ShowSevereError( RoutineName + CurrentModuleObject + ": invalid " + cAlphaFields( 2 ) + " entered =" + Alphas( 2 ) + " for " + cAlphaFields( 1 ) + '=' + Alphas( 1 ) );
ErrorsFound = true;
}
}
CoolBeam( CBNum ).AirInNode = GetOnlySingleNode( Alphas( 4 ), ErrorsFound, CurrentModuleObject, Alphas( 1 ), NodeType_Air, NodeConnectionType_Inlet, 1, ObjectIsNotParent, cAlphaFields( 4 ) );
CoolBeam( CBNum ).AirOutNode = GetOnlySingleNode( Alphas( 5 ), ErrorsFound, CurrentModuleObject, Alphas( 1 ), NodeType_Air, NodeConnectionType_Outlet, 1, ObjectIsNotParent, cAlphaFields( 5 ) );
CoolBeam( CBNum ).CWInNode = GetOnlySingleNode( Alphas( 6 ), ErrorsFound, CurrentModuleObject, Alphas( 1 ), NodeType_Water, NodeConnectionType_Inlet, 2, ObjectIsNotParent, cAlphaFields( 6 ) );
CoolBeam( CBNum ).CWOutNode = GetOnlySingleNode( Alphas( 7 ), ErrorsFound, CurrentModuleObject, Alphas( 1 ), NodeType_Water, NodeConnectionType_Outlet, 2, ObjectIsNotParent, cAlphaFields( 7 ) );
CoolBeam( CBNum ).MaxAirVolFlow = Numbers( 1 );
CoolBeam( CBNum ).MaxCoolWaterVolFlow = Numbers( 2 );
CoolBeam( CBNum ).NumBeams = Numbers( 3 );
CoolBeam( CBNum ).BeamLength = Numbers( 4 );
CoolBeam( CBNum ).DesInletWaterTemp = Numbers( 5 );
CoolBeam( CBNum ).DesOutletWaterTemp = Numbers( 6 );
CoolBeam( CBNum ).CoilArea = Numbers( 7 );
CoolBeam( CBNum ).a = Numbers( 8 );
CoolBeam( CBNum ).n1 = Numbers( 9 );
CoolBeam( CBNum ).n2 = Numbers( 10 );
CoolBeam( CBNum ).n3 = Numbers( 11 );
CoolBeam( CBNum ).a0 = Numbers( 12 );
CoolBeam( CBNum ).K1 = Numbers( 13 );
CoolBeam( CBNum ).n = Numbers( 14 );
CoolBeam( CBNum ).Kin = Numbers( 15 );
CoolBeam( CBNum ).InDiam = Numbers( 16 );
// Register component set data
TestCompSet( CurrentModuleObject, CoolBeam( CBNum ).Name, NodeID( CoolBeam( CBNum ).AirInNode ), NodeID( CoolBeam( CBNum ).AirOutNode ), "Air Nodes" );
TestCompSet( CurrentModuleObject, CoolBeam( CBNum ).Name, NodeID( CoolBeam( CBNum ).CWInNode ), NodeID( CoolBeam( CBNum ).CWOutNode ), "Water Nodes" );
//Setup the Cooled Beam reporting variables
//CurrentModuleObject = "AirTerminal:SingleDuct:ConstantVolume:CooledBeam"
SetupOutputVariable( "Zone Air Terminal Beam Sensible Cooling Energy [J]", CoolBeam( CBNum ).BeamCoolingEnergy, "System", "Sum", CoolBeam( CBNum ).Name, _, "ENERGYTRANSFER", "COOLINGCOILS", _, "System" );
SetupOutputVariable( "Zone Air Terminal Beam Chilled Water Energy [J]", CoolBeam( CBNum ).BeamCoolingEnergy, "System", "Sum", CoolBeam( CBNum ).Name, _, "PLANTLOOPCOOLINGDEMAND", "COOLINGCOILS", _, "System" );
SetupOutputVariable( "Zone Air Terminal Beam Sensible Cooling Rate [W]", CoolBeam( CBNum ).BeamCoolingRate, "System", "Average", CoolBeam( CBNum ).Name );
SetupOutputVariable( "Zone Air Terminal Supply Air Sensible Cooling Energy [J]", CoolBeam( CBNum ).SupAirCoolingEnergy, "System", "Sum", CoolBeam( CBNum ).Name );
SetupOutputVariable( "Zone Air Terminal Supply Air Sensible Cooling Rate [W]", CoolBeam( CBNum ).SupAirCoolingRate, "System", "Average", CoolBeam( CBNum ).Name );
SetupOutputVariable( "Zone Air Terminal Supply Air Sensible Heating Energy [J]", CoolBeam( CBNum ).SupAirHeatingEnergy, "System", "Sum", CoolBeam( CBNum ).Name );
SetupOutputVariable( "Zone Air Terminal Supply Air Sensible Heating Rate [W]", CoolBeam( CBNum ).SupAirHeatingRate, "System", "Average", CoolBeam( CBNum ).Name );
// Fill the Zone Equipment data with the supply air inlet node number of this unit.
AirNodeFound = false;
for ( CtrlZone = 1; CtrlZone <= NumOfZones; ++CtrlZone ) {
if ( ! ZoneEquipConfig( CtrlZone ).IsControlled ) continue;
for ( SupAirIn = 1; SupAirIn <= ZoneEquipConfig( CtrlZone ).NumInletNodes; ++SupAirIn ) {
if ( CoolBeam( CBNum ).AirOutNode == ZoneEquipConfig( CtrlZone ).InletNode( SupAirIn ) ) {
ZoneEquipConfig( CtrlZone ).AirDistUnitCool( SupAirIn ).InNode = CoolBeam( CBNum ).AirInNode;
ZoneEquipConfig( CtrlZone ).AirDistUnitCool( SupAirIn ).OutNode = CoolBeam( CBNum ).AirOutNode;
AirNodeFound = true;
break;
}
}
}
if ( ! AirNodeFound ) {
ShowSevereError( "The outlet air node from the " + CurrentModuleObject + " = " + CoolBeam( CBNum ).Name );
ShowContinueError( "did not have a matching Zone Equipment Inlet Node, Node =" + Alphas( 5 ) );
ErrorsFound = true;
}
}
for ( CBNum = 1; CBNum <= NumCB; ++CBNum ) {
for ( ADUNum = 1; ADUNum <= NumAirDistUnits; ++ADUNum ) {
if ( CoolBeam( CBNum ).AirOutNode == AirDistUnit( ADUNum ).OutletNodeNum ) {
CoolBeam( CBNum ).ADUNum = ADUNum;
}
}
// one assumes if there isn't one assigned, it's an error?
if ( CoolBeam( CBNum ).ADUNum == 0 ) {
ShowSevereError( RoutineName + "No matching Air Distribution Unit, for Unit = [" + CurrentModuleObject + ',' + CoolBeam( CBNum ).Name + "]." );
ShowContinueError( "...should have outlet node=" + NodeID( CoolBeam( CBNum ).AirOutNode ) );
// ErrorsFound=.TRUE.
}
}
Alphas.deallocate();
cAlphaFields.deallocate();
cNumericFields.deallocate();
Numbers.deallocate();
lAlphaBlanks.deallocate();
lNumericBlanks.deallocate();
if ( ErrorsFound ) {
ShowFatalError( RoutineName + "Errors found in getting input. Preceding conditions cause termination." );
}
}
void
InitCoolBeam(
int const CBNum, // number of the current cooled beam unit being simulated
bool const FirstHVACIteration // TRUE if first air loop solution this HVAC step
)
{
// SUBROUTINE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN February 6, 2009
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// This subroutine is for initialization of the cooled beam units
// METHODOLOGY EMPLOYED:
// Uses the status flags to trigger initializations.
// REFERENCES:
// na
// Using/Aliasing
using DataZoneEquipment::ZoneEquipInputsFilled;
using DataZoneEquipment::CheckZoneEquipmentList;
using DataDefineEquip::AirDistUnit;
using InputProcessor::SameString;
using DataPlant::PlantLoop;
using DataPlant::ScanPlantLoopsForObject;
using DataPlant::TypeOf_CooledBeamAirTerminal;
using FluidProperties::GetDensityGlycol;
using PlantUtilities::InitComponentNodes;
using PlantUtilities::SetComponentFlowRate;
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// SUBROUTINE PARAMETER DEFINITIONS:
static std::string const RoutineName( "InitCoolBeam" );
// INTERFACE BLOCK SPECIFICATIONS:
// na
// DERIVED TYPE DEFINITIONS:
// na
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int InAirNode; // supply air inlet node number
int OutAirNode; // unit air outlet node
int InWaterNode; // unit inlet chilled water node
int OutWaterNode; // unit outlet chilled water node
Real64 RhoAir; // air density at outside pressure and standard temperature and humidity
static bool MyOneTimeFlag( true );
static Array1D_bool MyEnvrnFlag;
static Array1D_bool MySizeFlag;
static Array1D_bool PlantLoopScanFlag;
Real64 rho; // local fluid density
static bool ZoneEquipmentListChecked( false ); // True after the Zone Equipment List has been checked for items
int Loop; // Loop checking control variable
std::string CurrentModuleObject;
bool errFlag;
CurrentModuleObject = "AirTerminal:SingleDuct:ConstantVolume:CooledBeam";
// Do the one time initializations
if ( MyOneTimeFlag ) {
MyEnvrnFlag.allocate( NumCB );
MySizeFlag.allocate( NumCB );
PlantLoopScanFlag.allocate( NumCB );
MyEnvrnFlag = true;
MySizeFlag = true;
PlantLoopScanFlag = true;
MyOneTimeFlag = false;
}
if ( PlantLoopScanFlag( CBNum ) && allocated( PlantLoop ) ) {
errFlag = false;
ScanPlantLoopsForObject( CoolBeam( CBNum ).Name, TypeOf_CooledBeamAirTerminal, CoolBeam( CBNum ).CWLoopNum, CoolBeam( CBNum ).CWLoopSideNum, CoolBeam( CBNum ).CWBranchNum, CoolBeam( CBNum ).CWCompNum, _, _, _, _, _, errFlag );
if ( errFlag ) {
ShowFatalError( "InitCoolBeam: Program terminated for previous conditions." );
}
PlantLoopScanFlag( CBNum ) = false;
}
if ( ! ZoneEquipmentListChecked && ZoneEquipInputsFilled ) {
ZoneEquipmentListChecked = true;
// Check to see if there is a Air Distribution Unit on the Zone Equipment List
for ( Loop = 1; Loop <= NumCB; ++Loop ) {
if ( CoolBeam( Loop ).ADUNum == 0 ) continue;
if ( CheckZoneEquipmentList( "ZONEHVAC:AIRDISTRIBUTIONUNIT", AirDistUnit( CoolBeam( Loop ).ADUNum ).Name ) ) continue;
ShowSevereError( "InitCoolBeam: ADU=[Air Distribution Unit," + AirDistUnit( CoolBeam( Loop ).ADUNum ).Name + "] is not on any ZoneHVAC:EquipmentList." );
ShowContinueError( "...Unit=[" + CurrentModuleObject + ',' + CoolBeam( Loop ).Name + "] will not be simulated." );
}
}
if ( ! SysSizingCalc && MySizeFlag( CBNum ) && ! PlantLoopScanFlag( CBNum ) ) {
SizeCoolBeam( CBNum );
InWaterNode = CoolBeam( CBNum ).CWInNode;
OutWaterNode = CoolBeam( CBNum ).CWOutNode;
rho = GetDensityGlycol( PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidName, InitConvTemp, PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidIndex, RoutineName );
CoolBeam( CBNum ).MaxCoolWaterMassFlow = rho * CoolBeam( CBNum ).MaxCoolWaterVolFlow;
InitComponentNodes( 0.0, CoolBeam( CBNum ).MaxCoolWaterMassFlow, InWaterNode, OutWaterNode, CoolBeam( CBNum ).CWLoopNum, CoolBeam( CBNum ).CWLoopSideNum, CoolBeam( CBNum ).CWBranchNum, CoolBeam( CBNum ).CWCompNum );
MySizeFlag( CBNum ) = false;
}
// Do the Begin Environment initializations
if ( BeginEnvrnFlag && MyEnvrnFlag( CBNum ) ) {
RhoAir = StdRhoAir;
InAirNode = CoolBeam( CBNum ).AirInNode;
OutAirNode = CoolBeam( CBNum ).AirOutNode;
// set the mass flow rates from the input volume flow rates
CoolBeam( CBNum ).MaxAirMassFlow = RhoAir * CoolBeam( CBNum ).MaxAirVolFlow;
Node( InAirNode ).MassFlowRateMax = CoolBeam( CBNum ).MaxAirMassFlow;
Node( OutAirNode ).MassFlowRateMax = CoolBeam( CBNum ).MaxAirMassFlow;
Node( InAirNode ).MassFlowRateMin = 0.0;
Node( OutAirNode ).MassFlowRateMin = 0.0;
InWaterNode = CoolBeam( CBNum ).CWInNode;
OutWaterNode = CoolBeam( CBNum ).CWOutNode;
InitComponentNodes( 0.0, CoolBeam( CBNum ).MaxCoolWaterMassFlow, InWaterNode, OutWaterNode, CoolBeam( CBNum ).CWLoopNum, CoolBeam( CBNum ).CWLoopSideNum, CoolBeam( CBNum ).CWBranchNum, CoolBeam( CBNum ).CWCompNum );
MyEnvrnFlag( CBNum ) = false;
} // end one time inits
if ( ! BeginEnvrnFlag ) {
MyEnvrnFlag( CBNum ) = true;
}
InAirNode = CoolBeam( CBNum ).AirInNode;
OutAirNode = CoolBeam( CBNum ).AirOutNode;
// Do the start of HVAC time step initializations
if ( FirstHVACIteration ) {
// check for upstream zero flow. If nonzero and schedule ON, set primary flow to max
if ( GetCurrentScheduleValue( CoolBeam( CBNum ).SchedPtr ) > 0.0 && Node( InAirNode ).MassFlowRate > 0.0 ) {
Node( InAirNode ).MassFlowRate = CoolBeam( CBNum ).MaxAirMassFlow;
} else {
Node( InAirNode ).MassFlowRate = 0.0;
}
// reset the max and min avail flows
if ( GetCurrentScheduleValue( CoolBeam( CBNum ).SchedPtr ) > 0.0 && Node( InAirNode ).MassFlowRateMaxAvail > 0.0 ) {
Node( InAirNode ).MassFlowRateMaxAvail = CoolBeam( CBNum ).MaxAirMassFlow;
Node( InAirNode ).MassFlowRateMinAvail = CoolBeam( CBNum ).MaxAirMassFlow;
} else {
Node( InAirNode ).MassFlowRateMaxAvail = 0.0;
Node( InAirNode ).MassFlowRateMinAvail = 0.0;
}
//Plant should do this InWaterNode = CoolBeam(CBNum)%CWInNode
// Node(InWaterNode)%MassFlowRateMaxAvail = CoolBeam(CBNum)%MaxCoolWaterMassFlow
// Node(InWaterNode)%MassFlowRateMinAvail = 0.0
}
// do these initializations every time step
InWaterNode = CoolBeam( CBNum ).CWInNode;
CoolBeam( CBNum ).TWIn = Node( InWaterNode ).Temp;
CoolBeam( CBNum ).SupAirCoolingRate = 0.0;
CoolBeam( CBNum ).SupAirHeatingRate = 0.0;
// CoolBeam(CBNum)%BeamFlow = Node(InAirNode)%MassFlowRate / (StdRhoAir*CoolBeam(CBNum)%NumBeams)
}
void
SizeCoolBeam( int const CBNum )
{
// SUBROUTINE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN February 10, 2009
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// This subroutine is for sizing cooled beam units for which flow rates have not been
// specified in the input
// METHODOLOGY EMPLOYED:
// Accesses zone sizing array for air flow rates and zone and plant sizing arrays to
// calculate coil water flow rates.
// REFERENCES:
// na
// Using/Aliasing
using namespace DataSizing;
using namespace InputProcessor;
using DataGlobals::AutoCalculate;
using PlantUtilities::RegisterPlantCompDesignFlow;
using ReportSizingManager::ReportSizingOutput;
// USE BranchInputManager, ONLY: MyPlantSizingIndex
using FluidProperties::GetDensityGlycol;
using FluidProperties::GetSpecificHeatGlycol;
using DataPlant::PlantLoop;
using DataPlant::MyPlantSizingIndex;
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// SUBROUTINE PARAMETER DEFINITIONS:
// na
// INTERFACE BLOCK SPECIFICATIONS:
// na
// DERIVED TYPE DEFINITIONS:
// na
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
static std::string const RoutineName( "SizeCoolBeam" );
static int PltSizCoolNum( 0 ); // index of plant sizing object for the cooling loop
static int NumBeams( 0 ); // number of beams in the zone
static int Iter( 0 ); // beam length iteration index
static Real64 DesCoilLoad( 0.0 ); // total cooling capacity of the beams in the zone [W]
static Real64 DesLoadPerBeam( 0.0 ); // cooling capacity per individual beam [W]
static Real64 DesAirVolFlow( 0.0 ); // design total supply air flow rate [m3/s]
static Real64 DesAirFlowPerBeam( 0.0 ); // design supply air volumetric flow per beam [m3/s]
static Real64 RhoAir( 0.0 );
static Real64 CpAir( 0.0 );
static Real64 WaterVel( 0.0 ); // design water velocity in beam
static Real64 IndAirFlowPerBeamL( 0.0 ); // induced volumetric air flow rate per beam length [m3/s-m]
static Real64 DT( 0.0 ); // air - water delta T [C]
static Real64 LengthX( 0.0 ); // test value for beam length [m]
static Real64 Length( 0.0 ); // beam length [m]
static Real64 ConvFlow( 0.0 ); // convective and induced air mass flow rate across beam per beam plan area [kg/s-m2]
static Real64 K( 0.0 ); // coil (beam) heat transfer coefficient [W/m2-K]
static Real64 WaterVolFlowPerBeam( 0.0 ); // Cooling water volumetric flow per beam [m3]
bool ErrorsFound;
Real64 rho; // local fluid density
Real64 Cp; // local fluid specific heat
PltSizCoolNum = 0;
DesAirVolFlow = 0.0;
CpAir = 0.0;
RhoAir = StdRhoAir;
ErrorsFound = false;
// find the appropriate Plant Sizing object
if ( CoolBeam( CBNum ).MaxAirVolFlow == AutoSize || CoolBeam( CBNum ).BeamLength == AutoSize ) {
PltSizCoolNum = MyPlantSizingIndex( "cooled beam unit", CoolBeam( CBNum ).Name, CoolBeam( CBNum ).CWInNode, CoolBeam( CBNum ).CWOutNode, ErrorsFound );
}
if ( CoolBeam( CBNum ).Kin == AutoCalculate ) {
if ( CoolBeam( CBNum ).CBType_Num == Passive_Cooled_Beam ) {
CoolBeam( CBNum ).Kin = 0.0;
} else {
CoolBeam( CBNum ).Kin = 2.0;
}
ReportSizingOutput( CoolBeam( CBNum ).UnitType, CoolBeam( CBNum ).Name, "Coefficient of Induction Kin", CoolBeam( CBNum ).Kin );
}
if ( CoolBeam( CBNum ).MaxAirVolFlow == AutoSize ) {
if ( CurZoneEqNum > 0 ) {
CheckZoneSizing( CoolBeam( CBNum ).UnitType, CoolBeam( CBNum ).Name );
CoolBeam( CBNum ).MaxAirVolFlow = max( TermUnitFinalZoneSizing( CurZoneEqNum ).DesCoolVolFlow, TermUnitFinalZoneSizing( CurZoneEqNum ).DesHeatVolFlow );
if ( CoolBeam( CBNum ).MaxAirVolFlow < SmallAirVolFlow ) {
CoolBeam( CBNum ).MaxAirVolFlow = 0.0;
}
ReportSizingOutput( CoolBeam( CBNum ).UnitType, CoolBeam( CBNum ).Name, "Supply Air Flow Rate [m3/s]", CoolBeam( CBNum ).MaxAirVolFlow );
}
}
if ( CoolBeam( CBNum ).MaxCoolWaterVolFlow == AutoSize ) {
if ( CurZoneEqNum > 0 ) {
CheckZoneSizing( CoolBeam( CBNum ).UnitType, CoolBeam( CBNum ).Name );
if ( PltSizCoolNum > 0 ) {
if ( FinalZoneSizing( CurZoneEqNum ).DesCoolMassFlow >= SmallAirVolFlow ) {
DesAirVolFlow = CoolBeam( CBNum ).MaxAirVolFlow;
CpAir = PsyCpAirFnWTdb( FinalZoneSizing( CurZoneEqNum ).CoolDesHumRat, FinalZoneSizing( CurZoneEqNum ).CoolDesTemp );
// the design cooling coil load is the zone load minus whatever the central system does. Note that
// DesCoolCoilInTempTU is really the primary air inlet temperature for the unit.
if ( FinalZoneSizing( CurZoneEqNum ).ZoneTempAtCoolPeak > 0.0 ) {
DesCoilLoad = FinalZoneSizing( CurZoneEqNum ).DesCoolLoad - CpAir * RhoAir * DesAirVolFlow * ( FinalZoneSizing( CurZoneEqNum ).ZoneTempAtCoolPeak - FinalZoneSizing( CurZoneEqNum ).DesCoolCoilInTempTU );
} else {
DesCoilLoad = CpAir * RhoAir * DesAirVolFlow * ( FinalZoneSizing( CurZoneEqNum ).DesCoolCoilInTempTU - ZoneSizThermSetPtHi( CurZoneEqNum ) );
}
rho = GetDensityGlycol( PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidName, InitConvTemp, PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidIndex, RoutineName );
Cp = GetSpecificHeatGlycol( PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidName, InitConvTemp, PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidIndex, RoutineName );
CoolBeam( CBNum ).MaxCoolWaterVolFlow = DesCoilLoad / ( ( CoolBeam( CBNum ).DesOutletWaterTemp - CoolBeam( CBNum ).DesInletWaterTemp ) * Cp * rho );
CoolBeam( CBNum ).MaxCoolWaterVolFlow = max( CoolBeam( CBNum ).MaxCoolWaterVolFlow, 0.0 );
if ( CoolBeam( CBNum ).MaxCoolWaterVolFlow < SmallWaterVolFlow ) {
CoolBeam( CBNum ).MaxCoolWaterVolFlow = 0.0;
}
} else {
CoolBeam( CBNum ).MaxCoolWaterVolFlow = 0.0;
}
ReportSizingOutput( CoolBeam( CBNum ).UnitType, CoolBeam( CBNum ).Name, "Maximum Total Chilled Water Flow Rate [m3/s]", CoolBeam( CBNum ).MaxCoolWaterVolFlow );
} else {
ShowSevereError( "Autosizing of water flow requires a cooling loop Sizing:Plant object" );
ShowContinueError( "Occurs in" + CoolBeam( CBNum ).UnitType + " Object=" + CoolBeam( CBNum ).Name );
ErrorsFound = true;
}
}
}
if ( CoolBeam( CBNum ).NumBeams == AutoSize ) {
rho = GetDensityGlycol( PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidName, InitConvTemp, PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidIndex, RoutineName );
NumBeams = int( CoolBeam( CBNum ).MaxCoolWaterVolFlow * rho / NomMassFlowPerBeam ) + 1;
CoolBeam( CBNum ).NumBeams = double( NumBeams );
ReportSizingOutput( CoolBeam( CBNum ).UnitType, CoolBeam( CBNum ).Name, "Number of Beams", CoolBeam( CBNum ).NumBeams );
}
if ( CoolBeam( CBNum ).BeamLength == AutoSize ) {
if ( CurZoneEqNum > 0 ) {
CheckZoneSizing( CoolBeam( CBNum ).UnitType, CoolBeam( CBNum ).Name );
if ( PltSizCoolNum > 0 ) {
rho = GetDensityGlycol( PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidName, InitConvTemp, PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidIndex, RoutineName );
Cp = GetSpecificHeatGlycol( PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidName, InitConvTemp, PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidIndex, RoutineName );
DesCoilLoad = CoolBeam( CBNum ).MaxCoolWaterVolFlow * ( CoolBeam( CBNum ).DesOutletWaterTemp - CoolBeam( CBNum ).DesInletWaterTemp ) * Cp * rho;
if ( DesCoilLoad > 0.0 ) {
DesLoadPerBeam = DesCoilLoad / NumBeams;
DesAirFlowPerBeam = CoolBeam( CBNum ).MaxAirVolFlow / NumBeams;
WaterVolFlowPerBeam = CoolBeam( CBNum ).MaxCoolWaterVolFlow / NumBeams;
WaterVel = WaterVolFlowPerBeam / ( Pi * pow_2( CoolBeam( CBNum ).InDiam ) / 4.0 );
if ( FinalZoneSizing( CurZoneEqNum ).ZoneTempAtCoolPeak > 0.0 ) {
DT = FinalZoneSizing( CurZoneEqNum ).ZoneTempAtCoolPeak - 0.5 * ( CoolBeam( CBNum ).DesInletWaterTemp + CoolBeam( CBNum ).DesOutletWaterTemp );
if ( DT <= 0.0 ) {
DT = 7.8;
}
} else {
DT = 7.8;
}
LengthX = 1.0;
for ( Iter = 1; Iter <= 100; ++Iter ) {
IndAirFlowPerBeamL = CoolBeam( CBNum ).K1 * std::pow( DT, CoolBeam( CBNum ).n ) + CoolBeam( CBNum ).Kin * DesAirFlowPerBeam / LengthX;
ConvFlow = ( IndAirFlowPerBeamL / CoolBeam( CBNum ).a0 ) * RhoAir;
if ( WaterVel > MinWaterVel ) {
K = CoolBeam( CBNum ).a * std::pow( DT, CoolBeam( CBNum ).n1 ) * std::pow( ConvFlow, CoolBeam( CBNum ).n2 ) * std::pow( WaterVel, CoolBeam( CBNum ).n3 );
} else {
K = CoolBeam( CBNum ).a * std::pow( DT, CoolBeam( CBNum ).n1 ) * std::pow( ConvFlow, CoolBeam( CBNum ).n2 ) * std::pow( MinWaterVel, CoolBeam( CBNum ).n3 ) * ( WaterVel / MinWaterVel );
}
Length = DesLoadPerBeam / ( K * CoolBeam( CBNum ).CoilArea * DT );
if ( CoolBeam( CBNum ).Kin <= 0.0 ) break;
// Check for convergence
if ( std::abs( Length - LengthX ) > 0.01 ) {
// New guess for length
LengthX += 0.5 * ( Length - LengthX );
} else {
break; // convergence achieved
}
}
} else {
Length = 0.0;
}
CoolBeam( CBNum ).BeamLength = Length;
CoolBeam( CBNum ).BeamLength = max( CoolBeam( CBNum ).BeamLength, 1.0 );
ReportSizingOutput( CoolBeam( CBNum ).UnitType, CoolBeam( CBNum ).Name, "Beam Length [m]", CoolBeam( CBNum ).BeamLength );
} else {
ShowSevereError( "Autosizing of cooled beam length requires a cooling loop Sizing:Plant object" );
ShowContinueError( "Occurs in" + CoolBeam( CBNum ).UnitType + " Object=" + CoolBeam( CBNum ).Name );
ErrorsFound = true;
}
}
}
// save the design water volumetric flow rate for use by the water loop sizing algorithms
if ( CoolBeam( CBNum ).MaxCoolWaterVolFlow > 0.0 ) {
RegisterPlantCompDesignFlow( CoolBeam( CBNum ).CWInNode, CoolBeam( CBNum ).MaxCoolWaterVolFlow );
}
if ( ErrorsFound ) {
ShowFatalError( "Preceding cooled beam sizing errors cause program termination" );
}
}
void
ControlCoolBeam(
int const CBNum, // number of the current unit being simulated
int const ZoneNum, // number of zone being served
int const ZoneNodeNum, // zone node number
bool const EP_UNUSED( FirstHVACIteration ), // TRUE if 1st HVAC simulation of system timestep
Real64 & NonAirSysOutput // convective cooling by the beam system [W]
)
{
// SUBROUTINE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN Feb 12, 2009
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// Simulate a cooled beam unit;
// METHODOLOGY EMPLOYED:
// (1) From the zone load and the Supply air inlet conditions calculate the beam load
// (2) If there is a beam load, vary the water flow rate to match the beam load
// REFERENCES:
// na
// Using/Aliasing
using namespace DataZoneEnergyDemands;
using General::SolveRegulaFalsi;
using PlantUtilities::SetComponentFlowRate;
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// SUBROUTINE PARAMETER DEFINITIONS:
// na
// INTERFACE BLOCK SPECIFICATIONS:
// na
// DERIVED TYPE DEFINITIONS:
// na
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 QZnReq; // heating or cooling needed by zone [Watts]
Real64 QToHeatSetPt; // [W] remaining load to heating setpoint
Real64 QToCoolSetPt; // [W] remaining load to cooling setpoint
static Real64 QMin( 0.0 ); // cooled beam output at minimum water flow [W]
static Real64 QMax( 0.0 ); // cooled beam output at maximum water flow [W]
static Real64 QSup( 0.0 ); // heating or cooling by supply air [W]
static Real64 PowerMet( 0.0 ); // power supplied
static Real64 CWFlow( 0.0 ); // cold water flow [kg/s]
static Real64 AirMassFlow( 0.0 ); // air mass flow rate for the cooled beam system [kg/s]
static Real64 MaxColdWaterFlow( 0.0 ); // max water mass flow rate for the cooled beam system [kg/s]
static Real64 MinColdWaterFlow( 0.0 ); // min water mass flow rate for the cooled beam system [kg/s]
static Real64 CpAirZn( 0.0 ); // specific heat of air at zone conditions [J/kg-C]
static Real64 CpAirSys( 0.0 ); // specific heat of air at supply air conditions [J/kg-C]
static Real64 TWOut( 0.0 ); // outlet water tamperature [C]
int ControlNode; // the water inlet node
int InAirNode; // the air inlet node
bool UnitOn; // TRUE if unit is on
Array1D< Real64 > Par( 5 );
int SolFlag;
Real64 ErrTolerance;
UnitOn = true;
PowerMet = 0.0;
InAirNode = CoolBeam( CBNum ).AirInNode;
ControlNode = CoolBeam( CBNum ).CWInNode;
AirMassFlow = Node( InAirNode ).MassFlowRateMaxAvail;
QZnReq = ZoneSysEnergyDemand( ZoneNum ).RemainingOutputRequired;
QToHeatSetPt = ZoneSysEnergyDemand( ZoneNum ).RemainingOutputReqToHeatSP;
QToCoolSetPt = ZoneSysEnergyDemand( ZoneNum ).RemainingOutputReqToCoolSP;
CpAirZn = PsyCpAirFnWTdb( Node( ZoneNodeNum ).HumRat, Node( ZoneNodeNum ).Temp );
CpAirSys = PsyCpAirFnWTdb( Node( InAirNode ).HumRat, Node( InAirNode ).Temp );
MaxColdWaterFlow = CoolBeam( CBNum ).MaxCoolWaterMassFlow;
SetComponentFlowRate( MaxColdWaterFlow, CoolBeam( CBNum ).CWInNode, CoolBeam( CBNum ).CWOutNode, CoolBeam( CBNum ).CWLoopNum, CoolBeam( CBNum ).CWLoopSideNum, CoolBeam( CBNum ).CWBranchNum, CoolBeam( CBNum ).CWCompNum );
MinColdWaterFlow = 0.0;
SetComponentFlowRate( MinColdWaterFlow, CoolBeam( CBNum ).CWInNode, CoolBeam( CBNum ).CWOutNode, CoolBeam( CBNum ).CWLoopNum, CoolBeam( CBNum ).CWLoopSideNum, CoolBeam( CBNum ).CWBranchNum, CoolBeam( CBNum ).CWCompNum );
if ( GetCurrentScheduleValue( CoolBeam( CBNum ).SchedPtr ) <= 0.0 ) UnitOn = false;
if ( MaxColdWaterFlow <= SmallMassFlow ) UnitOn = false;
// Set the unit's air inlet nodes mass flow rates
Node( InAirNode ).MassFlowRate = AirMassFlow;
// set the air volumetric flow rate per beam
CoolBeam( CBNum ).BeamFlow = Node( InAirNode ).MassFlowRate / ( StdRhoAir * CoolBeam( CBNum ).NumBeams );
// fire the unit at min water flow
CalcCoolBeam( CBNum, ZoneNodeNum, MinColdWaterFlow, QMin, TWOut );
// cooling by supply air
QSup = AirMassFlow * ( CpAirSys * Node( InAirNode ).Temp - CpAirZn * Node( ZoneNodeNum ).Temp );
// load on the beams is QToCoolSetPt-QSup
if ( UnitOn ) {
if ( ( QToCoolSetPt - QSup ) < -SmallLoad ) {
// There is a cooling demand on the cooled beam system.
// First, see if the system can meet the load
CalcCoolBeam( CBNum, ZoneNodeNum, MaxColdWaterFlow, QMax, TWOut );
if ( ( QMax < QToCoolSetPt - QSup - SmallLoad ) && ( QMax != QMin ) ) {
// The cooled beam system can meet the demand.
// Set up the iterative calculation of chilled water flow rate
Par( 1 ) = double( CBNum );
Par( 2 ) = double( ZoneNodeNum );
Par( 3 ) = QToCoolSetPt - QSup; // load to be met by the beams
Par( 4 ) = QMin;
Par( 5 ) = QMax;
ErrTolerance = 0.01;
SolveRegulaFalsi( ErrTolerance, 50, SolFlag, CWFlow, CoolBeamResidual, MinColdWaterFlow, MaxColdWaterFlow, Par );
if ( SolFlag == -1 ) {
ShowWarningError( "Cold water control failed in cooled beam unit " + CoolBeam( CBNum ).Name );
ShowContinueError( " Iteration limit exceeded in calculating cold water mass flow rate" );
} else if ( SolFlag == -2 ) {
ShowWarningError( "Cold water control failed in cooled beam unit " + CoolBeam( CBNum ).Name );
ShowContinueError( " Bad cold water flow limits" );
}
} else {
// unit maxed out
CWFlow = MaxColdWaterFlow;
}
} else {
// unit has no load
CWFlow = MinColdWaterFlow;
}
} else {
// unit Off
CWFlow = MinColdWaterFlow;
}
// Get the cooling output at the chosen water flow rate
CalcCoolBeam( CBNum, ZoneNodeNum, CWFlow, PowerMet, TWOut );
CoolBeam( CBNum ).BeamCoolingRate = -PowerMet;
if ( QSup < 0.0 ) {
CoolBeam( CBNum ).SupAirCoolingRate = std::abs( QSup );
} else {
CoolBeam( CBNum ).SupAirHeatingRate = QSup;
}
CoolBeam( CBNum ).CoolWaterMassFlow = Node( ControlNode ).MassFlowRate;
CoolBeam( CBNum ).TWOut = TWOut;
CoolBeam( CBNum ).EnthWaterOut = Node( ControlNode ).Enthalpy + CoolBeam( CBNum ).BeamCoolingRate;
// Node(ControlNode)%MassFlowRate = CWFlow
NonAirSysOutput = PowerMet;
}
void
CalcCoolBeam(
int const CBNum, // Unit index
int const ZoneNode, // zone node number
Real64 const CWFlow, // cold water flow [kg/s]
Real64 & LoadMet, // load met by unit [W]
Real64 & TWOut // chilled water outlet temperature [C]
)
{
// SUBROUTINE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN Feb 2009
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// Simulate a cooled beam given the chilled water flow rate
// METHODOLOGY EMPLOYED:
// Uses the cooled beam equations; iteratively varies water outlet temperature
// until air-side and water-side cooling outputs match.
// REFERENCES:
// na
// Using/Aliasing
using PlantUtilities::SetComponentFlowRate;
using FluidProperties::GetSpecificHeatGlycol;
using FluidProperties::GetDensityGlycol;
using DataPlant::PlantLoop;
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// SUBROUTINE PARAMETER DEFINITIONS:
static std::string const RoutineName( "CalcCoolBeam" );
// INTERFACE BLOCK SPECIFICATIONS
// na
// DERIVED TYPE DEFINITIONS
// na
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
static int Iter( 0 ); // TWOut iteration index
static Real64 TWIn( 0.0 ); // Inlet water temperature [C]
static Real64 ZTemp( 0.0 ); // zone air temperature [C]
static Real64 WaterCoolPower( 0.0 ); // cooling power from water side [W]
static Real64 DT( 0.0 ); // approximate air - water delta T [C]
static Real64 IndFlow( 0.0 ); // induced air flow rate per beam length [m3/s-m]
static Real64 CoilFlow( 0.0 ); // mass air flow rate of air passing through "coil" [kg/m2-s]
static Real64 WaterVel( 0.0 ); // water velocity [m/s]
static Real64 K( 0.0 ); // coil heat transfer coefficient [W/m2-K]
static Real64 AirCoolPower( 0.0 ); // cooling power from the air side [W]
Real64 Diff; // difference between water side cooling power and air side cooling power [W]
static Real64 CWFlowPerBeam( 0.0 ); // water mass flow rate per beam
static Real64 Coeff( 0.0 ); // iteration parameter
static Real64 Delta( 0.0 );
static Real64 mdot( 0.0 );
Real64 Cp; // local fluid specific heat
Real64 rho; // local fluid density
//test CWFlow against plant
mdot = CWFlow;
SetComponentFlowRate( mdot, CoolBeam( CBNum ).CWInNode, CoolBeam( CBNum ).CWOutNode, CoolBeam( CBNum ).CWLoopNum, CoolBeam( CBNum ).CWLoopSideNum, CoolBeam( CBNum ).CWBranchNum, CoolBeam( CBNum ).CWCompNum );
CWFlowPerBeam = mdot / CoolBeam( CBNum ).NumBeams;
TWIn = CoolBeam( CBNum ).TWIn;
Cp = GetSpecificHeatGlycol( PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidName, TWIn, PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidIndex, RoutineName );
rho = GetDensityGlycol( PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidName, TWIn, PlantLoop( CoolBeam( CBNum ).CWLoopNum ).FluidIndex, RoutineName );
TWOut = TWIn + 2.0;
ZTemp = Node( ZoneNode ).Temp;
if ( mdot <= 0.0 || TWIn <= 0.0 ) {
LoadMet = 0.0;
TWOut = TWIn;
return;
}
for ( Iter = 1; Iter <= 200; ++Iter ) {
if ( Iter > 50 && Iter < 100 ) {
Coeff = 0.1 * Coeff2;
} else if ( Iter > 100 ) {
Coeff = 0.01 * Coeff2;
} else {
Coeff = Coeff2;
}
WaterCoolPower = CWFlowPerBeam * Cp * ( TWOut - TWIn );
DT = max( ZTemp - 0.5 * ( TWIn + TWOut ), 0.0 );
IndFlow = CoolBeam( CBNum ).K1 * std::pow( DT, CoolBeam( CBNum ).n ) + CoolBeam( CBNum ).Kin * CoolBeam( CBNum ).BeamFlow / CoolBeam( CBNum ).BeamLength;
CoilFlow = ( IndFlow / CoolBeam( CBNum ).a0 ) * StdRhoAir;
WaterVel = CWFlowPerBeam / ( rho * Pi * pow_2( CoolBeam( CBNum ).InDiam ) / 4.0 );
if ( WaterVel > MinWaterVel ) {
K = CoolBeam( CBNum ).a * std::pow( DT, CoolBeam( CBNum ).n1 ) * std::pow( CoilFlow, CoolBeam( CBNum ).n2 ) * std::pow( WaterVel, CoolBeam( CBNum ).n3 );
} else {
K = CoolBeam( CBNum ).a * std::pow( DT, CoolBeam( CBNum ).n1 ) * std::pow( CoilFlow, CoolBeam( CBNum ).n2 ) * std::pow( MinWaterVel, CoolBeam( CBNum ).n3 ) * ( WaterVel / MinWaterVel );
}
AirCoolPower = K * CoolBeam( CBNum ).CoilArea * DT * CoolBeam( CBNum ).BeamLength;
Diff = WaterCoolPower - AirCoolPower;
Delta = TWOut * ( std::abs( Diff ) / Coeff );
if ( std::abs( Diff ) > 0.1 ) {
if ( Diff < 0.0 ) {
TWOut += Delta; // increase TWout
if ( TWOut > ZTemp ) { // check that water outlet temperature is less than zone temperature
WaterCoolPower = 0.0;
TWOut = ZTemp;
break;
}
} else {
TWOut -= Delta; // Decrease TWout
if ( TWOut < TWIn ) {
TWOut = TWIn;
}
}
} else {
// water and air side outputs have converged
break;
}
}
LoadMet = -WaterCoolPower * CoolBeam( CBNum ).NumBeams;
}
Real64
CoolBeamResidual(
Real64 const CWFlow, // cold water flow rate in kg/s
Array1< Real64 > const & Par
)
{
// FUNCTION INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN February 2009
// MODIFIED
// RE-ENGINEERED
// PURPOSE OF THIS FUNCTION:
// Calculates residual function (Requested Unit Load - Unit Output) / Max Unit Output
// Unit Output depends on the cold water flow rate which is being varied to zero the residual.
// METHODOLOGY EMPLOYED:
// Calls CalcCoolBeam, and calculates the residual as defined above.
// REFERENCES:
// USE STATEMENTS:
// na
// Return value
Real64 Residuum; // residual to be minimized to zero
// Argument array dimensioning
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// FUNCTION PARAMETER DEFINITIONS:
// na
// INTERFACE BLOCK SPECIFICATIONS
// na
// DERIVED TYPE DEFINITIONS
// na
// FUNCTION LOCAL VARIABLE DECLARATIONS:
int CBIndex;
int ZoneNodeIndex;
static Real64 UnitOutput( 0.0 );
static Real64 TWOut( 0.0 );
CBIndex = int( Par( 1 ) );
ZoneNodeIndex = int( Par( 2 ) );
CalcCoolBeam( CBIndex, ZoneNodeIndex, CWFlow, UnitOutput, TWOut );
Residuum = ( Par( 3 ) - UnitOutput ) / ( Par( 5 ) - Par( 4 ) );
return Residuum;
}
void
UpdateCoolBeam( int const CBNum )
{
// SUBROUTINE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN Feb 2009
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// This subroutine updates the cooled beam unit outlet nodes
// METHODOLOGY EMPLOYED:
// Data is moved from the cooled beam unit data structure to the unit outlet nodes.
// REFERENCES:
// na
// Using/Aliasing
using DataContaminantBalance::Contaminant;
using PlantUtilities::SafeCopyPlantNode;
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// SUBROUTINE PARAMETER DEFINITIONS:
// na
// INTERFACE BLOCK SPECIFICATIONS
// na
// DERIVED TYPE DEFINITIONS
// na
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int AirInletNode;
int WaterInletNode;
int AirOutletNode;
int WaterOutletNode;
AirInletNode = CoolBeam( CBNum ).AirInNode;
WaterInletNode = CoolBeam( CBNum ).CWInNode;
AirOutletNode = CoolBeam( CBNum ).AirOutNode;
WaterOutletNode = CoolBeam( CBNum ).CWOutNode;
// Set the outlet air nodes of the unit; note that all quantities are unchanged
Node( AirOutletNode ).MassFlowRate = Node( AirInletNode ).MassFlowRate;
Node( AirOutletNode ).Temp = Node( AirInletNode ).Temp;
Node( AirOutletNode ).HumRat = Node( AirInletNode ).HumRat;
Node( AirOutletNode ).Enthalpy = Node( AirInletNode ).Enthalpy;
// Set the outlet water nodes for the unit
// Node(WaterOutletNode)%MassFlowRate = CoolBeam(CBNum)%CoolWaterMassFlow
SafeCopyPlantNode( WaterInletNode, WaterOutletNode );
Node( WaterOutletNode ).Temp = CoolBeam( CBNum ).TWOut;
Node( WaterOutletNode ).Enthalpy = CoolBeam( CBNum ).EnthWaterOut;
// Set the air outlet nodes for properties that just pass through & not used
Node( AirOutletNode ).Quality = Node( AirInletNode ).Quality;
Node( AirOutletNode ).Press = Node( AirInletNode ).Press;
Node( AirOutletNode ).MassFlowRateMin = Node( AirInletNode ).MassFlowRateMin;
Node( AirOutletNode ).MassFlowRateMax = Node( AirInletNode ).MassFlowRateMax;
Node( AirOutletNode ).MassFlowRateMinAvail = Node( AirInletNode ).MassFlowRateMinAvail;
Node( AirOutletNode ).MassFlowRateMaxAvail = Node( AirInletNode ).MassFlowRateMaxAvail;
// Set the outlet nodes for properties that just pass through & not used
// Node(WaterOutletNode)%Quality = Node(WaterInletNode)%Quality
// Node(WaterOutletNode)%Press = Node(WaterInletNode)%Press
// Node(WaterOutletNode)%HumRat = Node(WaterInletNode)%HumRat
// Node(WaterOutletNode)%MassFlowRateMin = Node(WaterInletNode)%MassFlowRateMin
// Node(WaterOutletNode)%MassFlowRateMax = Node(WaterInletNode)%MassFlowRateMax
// Node(WaterOutletNode)%MassFlowRateMinAvail= Node(WaterInletNode)%MassFlowRateMinAvail
// Node(WaterOutletNode)%MassFlowRateMaxAvail= Node(WaterInletNode)%MassFlowRateMaxAvail
// IF (CoolBeam(CBNum)%CoolWaterMassFlow.EQ.0.0) THEN
// Node(WaterInletNode)%MassFlowRateMinAvail= 0.0
// Node(WaterOutletNode)%MassFlowRateMinAvail= 0.0
// END IF
if ( Contaminant.CO2Simulation ) {
Node( AirOutletNode ).CO2 = Node( AirInletNode ).CO2;
}
if ( Contaminant.GenericContamSimulation ) {
Node( AirOutletNode ).GenContam = Node( AirInletNode ).GenContam;
}
}
void
ReportCoolBeam( int const CBNum )
{
// SUBROUTINE INFORMATION:
// AUTHOR Fred Buhl
// DATE WRITTEN Feb 2009
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// This subroutine updates the report variable for the cooled beam units
// METHODOLOGY EMPLOYED:
// NA
// REFERENCES:
// na
// USE STATEMENTS:
// Locals
// SUBROUTINE ARGUMENT DEFINITIONS:
// SUBROUTINE PARAMETER DEFINITIONS:
// na
// INTERFACE BLOCK SPECIFICATIONS
// na
// DERIVED TYPE DEFINITIONS
// na
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Real64 ReportingConstant;
ReportingConstant = TimeStepSys * SecInHour;
// report the WaterCoil energy from this component
CoolBeam( CBNum ).BeamCoolingEnergy = CoolBeam( CBNum ).BeamCoolingRate * ReportingConstant;
CoolBeam( CBNum ).SupAirCoolingEnergy = CoolBeam( CBNum ).SupAirCoolingRate * ReportingConstant;
CoolBeam( CBNum ).SupAirHeatingEnergy = CoolBeam( CBNum ).SupAirHeatingRate * ReportingConstant;
}
} // HVACCooledBeam
} // EnergyPlus
| [
"Brent.Griffith@EnergyArchmage.com"
] | Brent.Griffith@EnergyArchmage.com |
cc4f4e3a70b03c87166863c4ccb3ddfc4c5d9b02 | 9aaf6e9a28a521e87285a70ebbfbf2fcf2f202a6 | /src/comparison_plots.cpp | d3e83d77ee83260971465403b4e3c54d579feead | [] | no_license | pawelswoboda/LP_MP-Cell-tracking | 69971bbb467f790d05ae4627784dda9776459f07 | cb5e2b2625d77c867facefc218a369dd4ce77740 | refs/heads/master | 2021-09-19T18:36:10.783790 | 2018-07-30T14:13:01 | 2018-07-30T14:13:01 | 111,903,270 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,701 | cpp | #include "cell_tracking.h"
#include "solver.hxx"
#include "visitors/sqlite_visitor.hxx"
using namespace LP_MP;
int main(int argc, char** argv)
{
using solver_type = Solver<FMC_CELL_TRACKING,LP<FMC_CELL_TRACKING>,SqliteVisitor<StandardVisitor>>;
std::vector<std::string> options =
{
{""},
{"-i"}, {"/BS/discrete_opt/work/datasets/cell-tracking/20170607_Berkeley_FullDataset_GarciaLab_MULTI.5.7.85/tr2d_problem.jug"},
{"--primalComputationStart"}, {"10000"},
{"--maxIter"}, {"2000"},
{"--lowerBoundComputationInterval"}, {"10"},
{"--databaseFile"},{"cell_tracking_plots.db"},
{"--datasetName"},{"Garcia"},
{"--algorithmFMC"},{"CELL_TRACKING"}
};
{
auto srmp_options = options;
srmp_options.push_back("--algorithmName");
srmp_options.push_back("srmp");
solver_type solver(srmp_options);
solver.ReadProblem(cell_tracking_parser_2d::ParseProblem<solver_type>);
solver.Solve();
}
{
auto damped_uniform_options = options;
damped_uniform_options[6] = "100";
damped_uniform_options.push_back("--standardReparametrization");
damped_uniform_options.push_back("damped_uniform");
damped_uniform_options.push_back("--algorithmName");
damped_uniform_options.push_back("mcf");
Solver<FMC_CELL_TRACKING_FLOW,LP<FMC_CELL_TRACKING_FLOW>, SqliteVisitor<StandardVisitor>> solver(damped_uniform_options);
solver.Solve();
}
exit(0);
{
auto partition_options = options;
partition_options.push_back("--reparametrizationType");
partition_options.push_back("partition");
partition_options.push_back("--innerIteration");
partition_options.push_back("5");
partition_options.push_back("--algorithmName");
partition_options.push_back("partition,5");
solver_type solver(partition_options);
solver.ReadProblem(cell_tracking_parser_2d::ParseProblem<solver_type>);
solver.Solve();
}
{
auto partition_options = options;
partition_options.push_back("--reparametrizationType");
partition_options.push_back("partition");
partition_options.push_back("--innerIteration");
partition_options.push_back("10");
partition_options.push_back("--algorithmName");
partition_options.push_back("partition,10");
solver_type solver(partition_options);
solver.ReadProblem(cell_tracking_parser_2d::ParseProblem<solver_type>);
solver.Solve();
}
{
auto partition_options = options;
partition_options.push_back("--reparametrizationType");
partition_options.push_back("overlapping_partition");
partition_options.push_back("--innerIteration");
partition_options.push_back("5");
partition_options.push_back("--algorithmName");
partition_options.push_back("overlapping partition,5");
solver_type solver(partition_options);
solver.ReadProblem(cell_tracking_parser_2d::ParseProblem<solver_type>);
solver.Solve();
}
{
auto partition_options = options;
partition_options.push_back("--reparametrizationType");
partition_options.push_back("overlapping_partition");
partition_options.push_back("--innerIteration");
partition_options.push_back("10");
partition_options.push_back("--algorithmName");
partition_options.push_back("overlapping partition,10");
solver_type solver(partition_options);
solver.ReadProblem(cell_tracking_parser_2d::ParseProblem<solver_type>);
solver.Solve();
}
}
| [
"pswoboda@mpi-inf.mpg.de"
] | pswoboda@mpi-inf.mpg.de |
ce5731f889b1efd5c0f62f42877433757e78a688 | 56a77194fc0cd6087b0c2ca1fb6dc0de64b8a58a | /applications/ShallowWaterApplication/custom_friction_laws/manning_law.h | e462af23c66beeffba75d9bb28bfc2f724728b84 | [
"BSD-3-Clause"
] | permissive | KratosMultiphysics/Kratos | 82b902a2266625b25f17239b42da958611a4b9c5 | 366949ec4e3651702edc6ac3061d2988f10dd271 | refs/heads/master | 2023-08-30T20:31:37.818693 | 2023-08-30T18:01:01 | 2023-08-30T18:01:01 | 81,815,495 | 994 | 285 | NOASSERTION | 2023-09-14T13:22:43 | 2017-02-13T10:58:24 | C++ | UTF-8 | C++ | false | false | 3,600 | h | // | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Miguel Maso Sotomayor
//
#ifndef KRATOS_MANNING_LAW_H_INCLUDED
#define KRATOS_MANNING_LAW_H_INCLUDED
// System includes
// External includes
// Project includes
#include "friction_law.h"
namespace Kratos
{
///@addtogroup ShallowWaterApplication
///@{
///@name Kratos Globals
///@{
///@}
///@name Type Definitions
///@{
///@}
///@name Enum's
///@{
///@}
///@name Functions
///@{
///@}
///@name Kratos Classes
///@{
/**
* @class ManningLaw
* @ingroup ShallowWaterApplication
* @brief The base class for the bottom and surface friction laws
* @details This class computes the bottom friction according to the Manning law
* @author Miguel Maso Sotomayor
*/
class ManningLaw : public FrictionLaw
{
public:
///@name Type Definitions
///@{
KRATOS_CLASS_POINTER_DEFINITION(ManningLaw);
///@}
///@name Life Cycle
///@{
/**
* @brief Default Constructor
*/
ManningLaw() {}
/**
* @brief Constructor with data
*/
ManningLaw(
const GeometryType& rGeometry,
const Properties& rProperty,
const ProcessInfo& rProcessInfo);
/**
* @brief Initialize the friction law variables
*/
virtual ~ManningLaw() {}
///@}
///@name Operators
///@{
///@}
///@name Operations
///@{
/**
* @brief Initialize the friction law variables
*/
void Initialize(
const GeometryType& rGeometry,
const Properties& rProperty,
const ProcessInfo& rProcessInfo) override;
/**
* @brief Calculate the LHS coefficient for the given data
* @param rHeight The layer depth
* @param rVector The layer velocity or momentum
* @return The LHS coefficient
*/
double CalculateLHS(const double& rHeight, const array_1d<double,3>& rVelocity) override;
/**
* @brief Calculate the RHS coefficient for the given data
* @param rHeight The layer depth
* @param rVector The layer velocity or momentum
* @return The components of the RHS coefficients
*/
array_1d<double,3> CalculateRHS(const double& rHeight, const array_1d<double,3>& rVelocity) override;
///@}
///@name Access
///@{
///@}
///@name Inquiry
///@{
///@}
///@name Input and output
///@{
/**
* @brief Turn back information as a string.
*/
std::string Info() const override
{
std::stringstream buffer;
buffer << "ManningLaw";
return buffer.str();
}
///@}
protected:
///@name Member variables
///@{
double mManning2;
double mEpsilon;
///@}
private:
///@name Un accessible methods
///@{
/// Assignment operator.
ManningLaw& operator=(ManningLaw const& rOther)
{
return *this;
}
/// Copy constructor.
ManningLaw(ManningLaw const& rOther) {}
///@}
}; // Class ManningLaw
///@}
///@name Type Definitions
///@{
///@}
///@name Input and output
///@{
/// output stream function
inline std::ostream& operator << (std::ostream& rOStream,
const ManningLaw& rThis)
{
rThis.PrintInfo(rOStream);
rOStream << std::endl;
rThis.PrintData(rOStream);
return rOStream;
}
///@}
///@} addtogroup block
} // namespace Kratos.
#endif // KRATOS_MANNING_LAW_H_INCLUDED defined
| [
"mmaso@cimne.upc.edu"
] | mmaso@cimne.upc.edu |
9f71c99997193f959e9b7bde850b4a42a7c27dd6 | 70441dcb7a8917a5574dd74c5afdeeaed3672a7a | /M-SOLUTIONS プロコンオープン/B - Sumo/main.cpp | a6a1684078022c58996b598b30925ee2a8d61933 | [] | no_license | tmyksj/atcoder | f12ecf6255b668792d83621369194195f06c10f6 | 419165e85d8a9a0614e5544232da371d8a2f2f85 | refs/heads/master | 2023-03-05T12:14:14.945257 | 2023-02-26T10:10:20 | 2023-02-26T10:10:20 | 195,034,198 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 316 | cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
int k = static_cast<int>(s.size());
int cnt = 0;
for (int i = 0; i < k; i++) {
if (s[i] == 'o') {
cnt++;
}
}
cout << (15 - k >= 8 - cnt ? "YES" : "NO") << endl;
}
| [
"33417830+tmyksj@users.noreply.github.com"
] | 33417830+tmyksj@users.noreply.github.com |
232ca213c26888bc327ee67e1be689da4c65107c | 72cfed90103e76116518df289dc4d8b139672dee | /HelloSDL/BasicRocketLauncher.h | 92dd76e05e90bb61431c8df356b9e44f41e7419d | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | gentlecolts/trippy-procedurally-generated-star-fox-clone-for-school | 8ad8ea51f09e79775b60c65ee3d5b0855e83b5c9 | a98df82d54fdd9a2d8c6ed4945bd14102067b1a0 | refs/heads/master | 2021-01-22T05:24:03.642376 | 2013-06-24T14:17:45 | 2013-06-24T14:17:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 550 | h | //
// BasicRocketLauncher.h
// HelloSDL
//
// Created by Jonah Chazan on 5/14/13.
// Copyright (c) 2013 Student. All rights reserved.
//
#ifndef __HelloSDL__BasicRocketLauncher__
#define __HelloSDL__BasicRocketLauncher__
#include <iostream>
#include "BasicGun.h"
class Grenade;
class BasicRocketLauncher : public BasicGun {
public:
BasicRocketLauncher(GameObject *p);
void init();
void doDoFire();
void fireRocket(Grenade *g);
};
void fireCallback(GameObject *me, GameObject *o);
#endif /* defined(__HelloSDL__BasicRocketLauncher__) */
| [
"person.1123.loztp@gmail.com"
] | person.1123.loztp@gmail.com |
cb52f29d82bf677860a6679350b8ee990ad358a0 | cdef186cbd607097ad34c334d4f0b21dbc779ba2 | /Img/傅里叶变换/IFFT2.cpp | a668313b86cbe705bad58b8ba66746195771e41a | [] | no_license | jiangzhiping/ImageProcess | 27ea028ea24a09caa4de5555da54d5b7452dd144 | c38845d7bb444143a406e68f33af8df929d97f62 | refs/heads/master | 2021-08-22T20:05:40.373595 | 2017-12-01T06:02:05 | 2017-12-01T06:02:05 | 111,394,781 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,613 | cpp | /************************************
void CImgProcess::IFFT2(CImgProcess *pTo,complex<double> *pInput,long lWidth,long lHeight,
long lOutW,long lOutH)
功能: 二维快速反傅里叶变换
参数: CImgProcess *pTo:指向输出图像的指针
complex<double> *pInput:指向输入数组的指针
long lWidth:输入数组中需要进行反傅里叶变换的高度
long lHeight:输入数组中需要进行反傅里叶变换的高度
long lOutW:指定输出图像的宽度,可以省略,默认与输入数组宽度相同
long lOutH:指定输出图像的高度,可以省略,默认与输入数组高度相同
返回值: 无
*************************************/
void CImgProcess::IFFT2(CImgProcess *pTo,complex<double> *pInput,long lWidth,long lHeight,
long lOutW,long lOutH)
{
double dTemp;
LONG i,j;
//IFFT2的宽度和高度(2的整数次方)
LONG w,h;
int wp,hp;
w=1,h=1;
wp=0,hp=0;
//输出图像的高宽
if(lOutH==0)
lOutH=lHeight;
if(lOutW==0)
lOutW=lWidth;
//计算进行反傅里叶变换的宽度和高度(2的整数次方)
while(w*2<=lWidth)
{
w*=2;
wp++;
}
while(h*2<=lHeight)
{
h*=2;
hp++;
}
//分配内存
complex<double> *TD=new complex<double>[w*h];
complex<double> *FD=new complex<double>[w*h];
//设定输出图像大小
pTo->ImResize(lOutH,lOutW);
//垂直方向
for(i=0;i<h;i++)
{
//水平方向
for(j=0;j<w;j++)
{
//给频域赋值
FD[j+w*i]=pInput[j+w*i];
}
}
for(i=0;i<h;i++)
{
//对y方向进行快速反傅里叶变换
IFFT(&FD[w*i],&TD[w*i],wp);
}
//保存变换结果
//垂直方向
for(i=0;i<h;i++)
{
//水平方向
for(j=0;j<w;j++)
FD[i+h*j]=TD[j+w*i];
}
for(i=0;i<w;i++)
{
//对x方向进行快速反傅里叶变换
IFFT(&FD[i*h],&TD[i*h],hp);
}
//寻找反变换结果对数变换的最大值与最小值,为优化显示输出做准备
//对最大值和最小值分别定义如下
double dMax=0,dMin=1E+006;
for(i=0;i<lOutH;i++)
{
for(j=0;j<lOutW;j++)
{
//计算模值
dTemp=sqrt(TD[j*h+i].real()*TD[j*h+i].real()+TD[j*h+i].imag()*TD[j*h+i].imag());
//寻找最大和最小值
dMax=max(dMax,dTemp);
dMin=min(dMin,dTemp)
}
}
//行
for (i = 0; i < lOutH; ++i)
{
//列
for(j=0;j<lOutW;j++)
{
//计算模值
dTemp=sqrt(TD[j*h+i].real()*TD[j*h+i].real()+TD[j*h+i].imag()*TD[j*h+i].imag());
//改变动态范围并归一化到0~255
dTemp=(dTemp-dMin)/(dMax-dMin)*255;
//更新目标图像
pTo->SetPixel(j,i,RGB(dTemp,dTemp,dTemp));
}
}
//删除临时变量
delete TD;
delete FD;
}
| [
"mrzhiping@gmail.com"
] | mrzhiping@gmail.com |
3c7db3ba944712f2055381cac6c7b6339deff683 | c2bbb8b5499a69fd4c8bd6e18c21dda7f6311983 | /Sofa placement/no_cpp_pthread_stupid.cpp | 62f6313f06f856338d6be0cf070ac70555f1d813 | [] | no_license | haakonbaa/cmb-challenge | aa95a474e38a8add92bbe4d4c1cd4036f09f4201 | 41087ef91001b89bbfae6c0944903a5c3e6506d3 | refs/heads/main | 2023-04-18T12:06:07.468539 | 2021-04-30T13:04:49 | 2021-04-30T13:04:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,051 | cpp | #include <stdio.h>
#include <pthread.h>
// For lagged fib-generator
constexpr unsigned int word_size = 24;
constexpr unsigned int short_lag = 10;
constexpr unsigned int long_lag = 24;
constexpr unsigned int MOD24 = 16777216;
constexpr unsigned int MOD24AND = MOD24-1;
constexpr unsigned long __n = (word_size + 31) / 32;
// For linear-congruential-generator
unsigned int* rand_array[long_lag];
constexpr unsigned int lcg_a = 40014u;
constexpr unsigned int lcg_m = 2147483563u;
constexpr unsigned int default_seed = 19780503U;
unsigned int _M_x[long_lag];
unsigned int _M_carry; ///< The carry
unsigned long _M_p; ///< Current index of x(i - r).
unsigned long long int lcg_value = default_seed; // må ha minst 8 bytes! (for en eller annen grunn)
inline unsigned int LCG() {
lcg_value = (lcg_a*lcg_value)%lcg_m;
return (unsigned int)lcg_value;
}
inline void seed(unsigned int val) {
lcg_value = val;
for (unsigned long __i = 0; __i < long_lag; ++__i) {
_M_x[__i] = LCG() & MOD24AND;
}
_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
_M_p = 0;
}
inline unsigned int get_random() {
// Derive short lag index from current index.
long __ps = _M_p - short_lag;
if (__ps < 0)
__ps += long_lag;
// Calculate new x(i) without overflow or division.
// NB: Thanks to the requirements for _unsigned intType, _M_x[_M_p] + _M_carry
// cannot overflow.
unsigned int __xi; // MOD2^24
if (_M_x[__ps] >= _M_x[_M_p] + _M_carry) {
__xi = _M_x[__ps] - _M_x[_M_p] - _M_carry;
_M_carry = 0;
} else {
__xi = (MOD24 - _M_x[_M_p] - _M_carry + _M_x[__ps]);
_M_carry = 1;
}
_M_x[_M_p] = __xi & MOD24AND;
// Adjust current index to loop around in ring buffer.
if (++_M_p >= long_lag) _M_p = 0;
return __xi;
}
constexpr unsigned int range = 16777216U;
inline unsigned int random(unsigned int from, unsigned int to) {
float fTmp = static_cast<float>(get_random()) / range;
return (fTmp * (to - from + 1)) + from;
}
constexpr unsigned int BASE10[10] = {
0x00000001, 0x0000000a,
0x00000064, 0x000003e8,
0x00002710, 0x000186a0,
0x000f4240, 0x00989680,
0x05f5e100, 0x3b9aca00
};
constexpr unsigned char ZERO = '0';
constexpr unsigned char NINE = '9';
constexpr unsigned char TONUM = 0x0f;
inline void getint(unsigned int& num) {
num = 0;
unsigned char* number = new unsigned char[10];
unsigned int radix = 0;
unsigned char c = getchar();
while (c < ZERO || c > NINE ) c = getchar();
while (c >= ZERO && c <= NINE) {
number[radix] = (c-ZERO);
radix++;
c = getchar();
}
for (unsigned int i = 0; i < radix; i++) {
num += (number[i])*BASE10[radix-i-1];
}
delete[] number;
}
inline void getint(unsigned long long& num) {
num = 0;
unsigned char* number = new unsigned char[10];
unsigned int radix = 0;
unsigned char c = getchar();
while (c < ZERO || c > NINE ) c = getchar();
while (c >= ZERO && c <= NINE) {
number[radix] = (c-ZERO);
radix++;
c = getchar();
}
for (unsigned int i = 0; i < radix; i++) {
num += (number[i])*BASE10[radix-i-1];
}
delete[] number;
}
void* magic(void* args) {
// Get arguments of chase
unsigned long long* ARGS = (unsigned long long*)args;
const unsigned int N = (unsigned int)ARGS[0];
const unsigned int MIN = (unsigned int)ARGS[1];
const unsigned int MAX = (unsigned int)ARGS[2];
unsigned int* const array = (unsigned int*)ARGS[3];
unsigned long long& RESULT = ARGS[4];
unsigned int max_size = N*MIN;
unsigned int reps;
unsigned int height;
unsigned int max_reps;
for (unsigned int h = 0; h < N; h++) {
reps = 0;
max_reps = 0;
height = array[h];
for (unsigned int i = 0; i < N; i++) {
++reps;
if (array[i] >= height) continue;
if (--reps > max_reps) max_reps = reps;
reps = 0;
}
if (height*max_reps > max_size) {
max_size = height*max_reps;
}
}
RESULT = (unsigned long long)max_size;
delete[] array;
pthread_exit(NULL);
}
int main() {
unsigned int C, S;
getint(C);
getint(S);
seed(S);
pthread_t* threads = new pthread_t[C];
unsigned long long args[C][5]; // N, MIN , MAX, &ARRAY, SAVE
for (unsigned int i = 0; i < C; i++) {
unsigned int N,MIN,MAX;
getint(args[i][0]); // N
getint(args[i][1]); // MIN
getint(args[i][2]); // MAX
N = args[i][0];
MIN = args[i][1];
MAX = args[i][2];
unsigned int* array = new unsigned int[N];
for (unsigned int j = 0; j < N; j++) {
array[j] = random(MIN,MAX);
}
args[i][3] = (unsigned long long)array;
pthread_create(&threads[i],NULL,magic,(void *)args[i]);
}
for (unsigned int i = 0; i < C; i++) {
pthread_join(threads[i],NULL);
printf("%llu\n",args[i][4]);
}
}
| [
"haakbaa@gmail.com"
] | haakbaa@gmail.com |
452736f6b49e2f7faeede50ebd6281636115b7af | b22588340d7925b614a735bbbde1b351ad657ffc | /athena/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/RpcRoadDefiner.h | b278616fcebd7a8aef760bee1802f2c725e5b5e6 | [] | no_license | rushioda/PIXELVALID_athena | 90befe12042c1249cbb3655dde1428bb9b9a42ce | 22df23187ef85e9c3120122c8375ea0e7d8ea440 | refs/heads/master | 2020-12-14T22:01:15.365949 | 2020-01-19T03:59:35 | 2020-01-19T03:59:35 | 234,836,993 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,035 | h | /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGL2MUONSA_RPCROADDEFINER_H
#define TRIGL2MUONSA_RPCROADDEFINER_H
#include <string>
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrigMuonBackExtrapolator/ITrigMuonBackExtrapolator.h"
#include "MuonIdHelpers/MdtIdHelper.h"
#include "TrigL2MuonSA/RpcData.h"
#include "TrigL2MuonSA/RpcPatFinder.h"
#include "TrigL2MuonSA/MuonRoad.h"
#include "TrigL2MuonSA/MdtRegion.h"
#include "TrigL2MuonSA/RpcFitResult.h"
#include "TrigL2MuonSA/BarrelRoadData.h"
#include "TrigT1Interfaces/RecMuonRoI.h"
#include "RegionSelector/IRegSelSvc.h"
class StoreGateSvc;
namespace TrigL2MuonSA {
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
class RpcRoadDefiner: public AthAlgTool
{
public:
static const InterfaceID& interfaceID();
RpcRoadDefiner(const std::string& type,
const std::string& name,
const IInterface* parent);
~RpcRoadDefiner(void);
virtual StatusCode initialize();
virtual StatusCode finalize ();
public:
StatusCode defineRoad(const LVL1::RecMuonRoI* p_roi,
TrigL2MuonSA::MuonRoad& muonRoad,
TrigL2MuonSA::RpcHits& rpcHits,
ToolHandle<RpcPatFinder>* rpcPatFinder,
TrigL2MuonSA::RpcFitResult& rpcFitResult,
double roiEtaMinLow,
double roiEtaMaxLow,
double roiEtaMinHigh,
double roiEtaMaxHigh);
void setMdtGeometry(IRegSelSvc* regionSelector, const MdtIdHelper* mdtIdHelper);
void setRoadWidthForFailure(double rWidth_RPC_Failed);
void setRpcGeometry(bool use_rpc);
protected:
float f(float x, float c0, float c1, float c2, float c3) const;
float fp(float x, float c33, float c22, float c1) const;
private:
const BarrelRoadData* m_roadData;
double m_rWidth_RPC_Failed;
bool m_use_rpc;
IRegSelSvc* m_regionSelector;
const MdtIdHelper* m_mdtIdHelper;
};
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
inline float TrigL2MuonSA::RpcRoadDefiner::f(float x, float c0, float c1, float c2, float c3) const
{
return c0 + x * (c1 + x * (c2 + x * c3)); // faster
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
inline float TrigL2MuonSA::RpcRoadDefiner::fp(float x, float c33, float c22, float c1) const
{
return c1 + x * (c22 + x * c33); // faster
}
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
}
#endif // TRIGL2MUONSA_RPCROADDEFINER_H
| [
"rushioda@lxplus754.cern.ch"
] | rushioda@lxplus754.cern.ch |
cf3ad16f0bf2e9df25673cc7186e2ac363930863 | 52ad601a144441b35ea6545a6022e9a35ecec28c | /Source/LidarRays/Vehicle/VehicleModel.cpp | 3d6d0d2751c0992adc12f77387f423644d3ba442 | [] | no_license | federicomassa/LidarRays | 4e59549457b6848b57eb1cb141112cf0e5a27003 | e1167a29aba028e9b85afc0f1043c9bcd0000d91 | refs/heads/master | 2020-04-02T09:28:15.685901 | 2019-02-28T14:43:10 | 2019-02-28T14:43:10 | 154,294,132 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,554 | cpp | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#include "VehicleModel.h"
#include "VehicleModels.h"
VehicleModel* VehicleModel::generateVehicleModel(EVehicleModelEnum modelType)
{
if (modelType == EVehicleModelEnum::VM_PhysX)
return nullptr;
else if (modelType == EVehicleModelEnum::VM_Unicycle)
{
return new UnicycleModel();
}
else if (modelType == EVehicleModelEnum::VM_SingleTrack)
{
return new SingleTrackModel();
}
else
{
UE_LOG(LogTemp, Error, TEXT("VehicleModel::generateVehicleModel --- unrecognized vehicle model type! Have you updated this function with the new model?"));
}
return nullptr;
}
void VehicleModel::setState(std::map<std::string, double> state)
{
currentState = statesToModel(state);
if (!isStateCompatible(currentState))
UE_LOG(LogTemp, Error, TEXT("VehicleModel::setState --- currentState is incompatible with model. Something is wrong in the model or in the input"));
}
void VehicleModel::run(std::map<std::string, double> worldControlRequest, double DeltaTime)
{
// Convert controls to model variables
std::map<std::string, double> controlRequest = controlsToModel(worldControlRequest);
if (!isControlCompatible(controlRequest))
UE_LOG(LogTemp, Error, TEXT("VehicleModel::run --- could not convert control request to model variables. Something is wrong either in the input or in the model"));
requestControl(controlRequest);
if (!isControlCompatible(lastControlsApplied))
UE_LOG(LogTemp, Error, TEXT("VehicleModel::run --- could not apply controls. Did you set lastControlsApplied inside requestControl method?"));
executeModel(DeltaTime);
if (!isStateCompatible(currentState))
UE_LOG(LogTemp, Error, TEXT("VehicleModel::run --- currentState is not compatible with model. Did you set the initial state with setState? Did you update it in the update() method?"));
}
bool VehicleModel::isStateCompatible(std::map<std::string, double> map)
{
// Check size
if (map.size() != stateVars.size())
return false;
for (auto itr = map.begin(); itr != map.end(); itr++)
{
if (stateVars.find(itr->first) == stateVars.end())
return false;
}
return true;
}
bool VehicleModel::isControlCompatible(std::map<std::string, double> map)
{
// Check size
if (map.size() != controlVars.size())
return false;
for (auto itr = map.begin(); itr != map.end(); itr++)
{
if (controlVars.find(itr->first) == controlVars.end())
return false;
}
return true;
}
std::map<std::string, double> VehicleModel::getWorldState() const
{
return statesToWorld(currentState);
} | [
"fedemassa91@gmail.com"
] | fedemassa91@gmail.com |
9b7e9680ea60da684c8da1d4707994d6e0fdf3f9 | 6697cd726d4cd3744ae52a7d5618f4ad107befba | /CP/308B.cpp | d59ff9cfe730a782a298f12850135748fc8257bd | [] | no_license | Saifu0/Competitive-Programming | 4385777115d5d83ba5140324c309db1e6c16f4af | ecc1c05f1a85636c57f7f6609dd6a002f220c0b0 | refs/heads/master | 2022-12-15T09:11:53.907652 | 2020-09-08T08:20:44 | 2020-09-08T08:20:44 | 293,743,953 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 627 | cpp | #include<bits/stdc++.h>
using namespace std;
#define sc(x) scanf("%d",&x)
#define pf(c) scanf("%d",x);
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>
int main(){
int a,b;
cin >> a >> b;
int k,m; cin >> k >> m;
vi x(a),y(b);
fo(i,a) cin >> x[i];
fo(i,b) cin >> y[i];
reverse(y.begin(),y.end());
if(x[k-1] < y[m-1]) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}
| [
"43892879+Saifu0@users.noreply.github.com"
] | 43892879+Saifu0@users.noreply.github.com |
109ec7dbb0b58f83f4204c3902926e057bda35fe | 6a4333f806591e41a0e39e45bad943367554d4c1 | /src/slim/log/SinkFilter.cpp | a127039cb3890608ff86d75e9040ae5f55572766 | [
"LicenseRef-scancode-free-unknown",
"Unlicense"
] | permissive | gimesketvirtadieni/slimstreamer | 0cde994d1dbace9cd61a430d49c177732cda9521 | d68dc863e7bf9411576672e56003bc2202f83484 | refs/heads/master | 2021-06-02T07:42:43.246778 | 2020-01-18T22:11:33 | 2020-01-18T22:11:33 | 105,690,670 | 69 | 5 | Unlicense | 2018-02-24T20:26:52 | 2017-10-03T18:55:29 | C++ | UTF-8 | C++ | false | false | 878 | cpp | /*
* Copyright 2017, Andrej Kislovskij
*
* This is PUBLIC DOMAIN software so use at your own risk as it comes
* with no warranties. This code is yours to share, use and modify without
* any restrictions or obligations.
*
* For more information see conwrap/LICENSE or refer refer to http://unlicense.org
*
* Author: gimesketvirtadieni at gmail dot com (Andrej Kislovskij)
*/
#include <slim/log/SinkFilter.hpp>
#include <algorithm>
// TODO: use from Message
std::string rightTrim(const std::string &s) {
auto r = std::find_if_not(s.rbegin(), s.rend(), [](int c) {
return std::isspace(c);
}).base();
return std::string(s.begin(), r);
}
SinkFilter::SinkFilter(std::function<bool(g3::LogMessage&)> filter) :
_filter(filter) {
}
SinkFilter::~SinkFilter() {
}
bool SinkFilter::filter(g3::LogMessage& logMessage) {
return (_filter && _filter(logMessage));
}
| [
"gimesketvirtadieni@gmail.com"
] | gimesketvirtadieni@gmail.com |
dd2b98adade4c8641094b73496ca2f41ca9b2b0e | 4f8e66ebd1bc845ba011907c9fc7c6400dd7a6be | /SDL_Core/src/components/JSONHandler/src/RPC2ObjectsImpl/NsRPC2Communication/UI/SetMediaClockTimerResponseMarshaller.h | 16a912e29f95878ae2df645b0e524d64eb05a1c7 | [] | no_license | zhanzhengxiang/smartdevicelink | 0145c304f28fdcebb67d36138a3a34249723ae28 | fbf304e5c3b0b269cf37d3ab22ee14166e7a110b | refs/heads/master | 2020-05-18T11:54:10.005784 | 2014-05-18T09:46:33 | 2014-05-18T09:46:33 | 20,008,961 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,460 | h | //
// Copyright (c) 2013, Ford Motor Company
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following
// disclaimer in the documentation and/or other materials provided with the
// distribution.
//
// Neither the name of the Ford Motor Company nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef NSRPC2COMMUNICATION_UI_SETMEDIACLOCKTIMERRESPONSEMARSHALLER_INCLUDE
#define NSRPC2COMMUNICATION_UI_SETMEDIACLOCKTIMERRESPONSEMARSHALLER_INCLUDE
#include <string>
#include <json/json.h>
#include "../src/../include/JSONHandler/RPC2Objects/NsRPC2Communication/UI/SetMediaClockTimerResponse.h"
namespace NsRPC2Communication
{
namespace UI
{
struct SetMediaClockTimerResponseMarshaller
{
static bool checkIntegrity(SetMediaClockTimerResponse& e);
static bool checkIntegrityConst(const SetMediaClockTimerResponse& e);
static bool fromString(const std::string& s,SetMediaClockTimerResponse& e);
static const std::string toString(const SetMediaClockTimerResponse& e);
static bool fromJSON(const Json::Value& s,SetMediaClockTimerResponse& e);
static Json::Value toJSON(const SetMediaClockTimerResponse& e);
};
}
}
#endif
| [
"kburdet1@ford.com"
] | kburdet1@ford.com |
15c9a773442931bc063b9e700ae600385efb0317 | 28660013cdff77e46e4a913519f83e325c24654b | /netijen/Battle/upgrader.h | 8d5e765810c044ff9b4e3b20b028ae9db5749708 | [
"WTFPL"
] | permissive | AnggaR96s/HacktoberFest2019 | fcb2670d96f3798a9ddd34df9248d9df3525ab4b | 3a9820969341f32a1859df6392dedc21c1412ff2 | refs/heads/master | 2020-08-04T15:09:38.740727 | 2019-10-27T18:04:18 | 2019-10-27T18:04:18 | 212,179,547 | 0 | 7 | WTFPL | 2019-10-27T18:04:19 | 2019-10-01T19:14:22 | C++ | UTF-8 | C++ | false | false | 227 | h | #ifndef upgrader_h
#define upgrader_h
#include "karakter.h"
using namespace std;
int selectMainMenu();
int selectUpgradeMenu();
void processMainMenu(int pi);
void processUpgradeMenu(int pi, Karakter& k);
#endif // upgrader_h
| [
"ojimdian@gmail.com"
] | ojimdian@gmail.com |
ba661aaadd46608386108bc495d3b5d0970a1d17 | c2203f55980751f56d9e232cab95bd3dc1e65b63 | /Session_01/04_Looping_Mapping/src/main.cpp | 4000a00318710903db290c4ffe3e6da108f5d663 | [] | no_license | SAIC-ATS/ARTTECH-3039 | 0ad2c7a1855688023895104d157986e390abe590 | 3e8ee63fe7e0b90b81e0ed4272eaec1aa90ab787 | refs/heads/master | 2021-01-19T00:49:09.690735 | 2019-08-14T21:30:25 | 2019-08-14T21:30:25 | 73,821,384 | 14 | 4 | null | 2017-03-28T20:49:21 | 2016-11-15T14:28:55 | C++ | UTF-8 | C++ | false | false | 125 | cpp | #include "ofApp.h"
int main()
{
ofSetupOpenGL(1024, 768, OF_WINDOW);
return ofRunApp(std::make_shared<ofApp>());
}
| [
"me@christopherbaker.net"
] | me@christopherbaker.net |
b3c33930d6bb01f3cb080b8cda5ca4bed0c31059 | f126ec70d4f66984811b867e1ede1b05ae92bf47 | /Source/PathTracerDemo/RealTimeRenderModule.cpp | a7bd660cffed6e31ecb3cf4d5dfe77c18a54e321 | [] | no_license | CHINA-JIGE/Noise3D-DirectX11 | b5c6903701307de0d8cd5e8c08996806aaecc13c | 10da69a351fa11b6407107ca9fe4f8cdcd8dc254 | refs/heads/master | 2020-12-13T09:03:45.352600 | 2020-05-25T12:21:22 | 2020-05-25T12:21:22 | 39,424,899 | 26 | 11 | null | 2019-07-15T03:06:38 | 2015-07-21T04:57:42 | C++ | UTF-8 | C++ | false | false | 4,700 | cpp | #include "Noise3D.h"
#include "RealTimeRenderModule.h"
RealTimeRenderModule::RealTimeRenderModule():
mTimer(Ut::NOISE_TIMER_TIMEUNIT_MILLISECOND)
{
}
RealTimeRenderModule::~RealTimeRenderModule()
{
}
void RealTimeRenderModule::Init(HINSTANCE hInstance)
{
//get Root interface
m_pRoot = GetRoot();
//create a window (using default window creation function)
HWND windowHWND;
windowHWND = m_pRoot->CreateRenderWindow(1080, 720, L"Hahaha Render Window", hInstance);
//initialize input engine (detection for keyboard and mouse input)
mInputE.Initialize(hInstance, windowHWND);
//D3D and scene object init
RealTimeRenderModule::_InitRealTime3D(windowHWND);
//register main loop function
m_pRoot->SetMainloopFunction((IMainloop*)this);
}
void RealTimeRenderModule::RunMainloop()
{
//enter main loop
m_pRoot->Mainloop();
}
void RealTimeRenderModule::_InitRealTime3D(HWND hwnd)
{
if (!m_pRoot->Init())return;
SceneLoader::Init(m_pRoot->GetSceneMgrPtr());//m_pScene will be init inside
RealTimeRenderModule::_InitMgrsAndRenderers(hwnd);
RealTimeRenderModule::_InitScene();
RealTimeRenderModule::_InitAtmos();
RealTimeRenderModule::_InitGraphicObjects();
RealTimeRenderModule::_InitText();
RealTimeRenderModule::_InitLight_RealTime();
}
void RealTimeRenderModule::_InitMgrsAndRenderers(HWND hwnd)
{
//query pointer to IScene
const UINT bufferWidth = 1080;
const UINT bufferHeight = 720;
m_pRenderer = m_pScene->CreateRenderer(bufferWidth, bufferHeight, hwnd);
m_pCamera = m_pScene->GetCamera();
m_pMatMgr = m_pScene->GetMaterialMgr();
m_pTexMgr = m_pScene->GetTextureMgr();
m_pAtmos = m_pScene->GetAtmosphere();
m_pGraphicObjMgr = m_pScene->GetGraphicObjMgr();
m_pShapeMgr = m_pScene->GetLogicalShapeMgr();
m_pLightMgr = m_pScene->GetLightMgr();
}
void RealTimeRenderModule::_InitScene()
{
//SceneLoader::LoadScene_DiffuseDemo(m_pCamera);
//SceneLoader::LoadScene_DiffuseDemoOrenNayar(m_pCamera);
//SceneLoader::LoadScene_RefractionDemo(m_pCamera);
//SceneLoader::LoadScene_AreaLightingDemo(m_pCamera);
//SceneLoader::LoadScene_StandardShader(m_pCamera);
//SceneLoader::LoadScene_Mesh(m_pCamera);
//SceneLoader::LoadScene_GoldenPorsche(m_pCamera);
//SceneLoader::LoadScene_Buddha(m_pCamera);
//SceneLoader::LoadScene_Ironman(m_pCamera);
//SceneLoader::LoadScene_IronmanAndAvenger(m_pCamera);
//SceneLoader::LoadScene_IronmanCloseUp(m_pCamera);
//SceneLoader::LoadScene_ShieldAndAvenger(m_pCamera);
//SceneLoader::LoadScene_Boxes(m_pCamera);
//SceneLoader::LoadScene_M4A1(m_pCamera);
//SceneLoader::LoadScene_Dragon(m_pCamera);
//SceneLoader::LoadScene_MicrofacetTransmissionTest(m_pCamera);
//SceneLoader::LoadScene_SHDiffuseExperiment(m_pCamera);
//SceneLoader::LoadScene_PaperExpr6_3_2(m_pCamera);
SceneLoader::LoadScene_Dragon(m_pCamera);
}
void RealTimeRenderModule::_InitAtmos()
{
m_pModelLoader->LoadSkyDome(m_pAtmos, "Universe", 4.0f, 2.0f);
//pModelLoader->LoadSkyBox(pAtmos, "Universe", 1000.0f, 1000.0f, 1000.0f);
m_pAtmos->SetFogEnabled(false);
m_pAtmos->SetFogParameter(50.0f, 100.0f, Vec3(0, 0, 1.0f));
}
void RealTimeRenderModule::_InitGraphicObjects()
{
m_pGraphicObjBuffer = m_pGraphicObjMgr->CreateGraphicObject("GO");
m_pGraphicObjBuffer->AddLine3D({ 0,0,0 }, { 50.0f,0,0 }, { 1.0f,0,0,1.0f }, { 1.0f,0,0,1.0f });
m_pGraphicObjBuffer->AddLine3D({ 0,0,0 }, { 0,50.0f,0 }, { 0,1.0f,0,1.0f }, { 0,1.0f,0,1.0f });
m_pGraphicObjBuffer->AddLine3D({ 0,0,0 }, { 0,0,50.0f }, { 0,0,1.0f,1.0f }, { 0,0,1.0f,1.0f });
m_pGraphicObjBuffer->AddRectangle(Vec2(870.0f, 680.0f), Vec2(1080.0f, 720.0f), Vec4(0.3f, 0.3f, 1.0f, 1.0f), "BottomRightTitle");
m_pGraphicObjBuffer->SetBlendMode(NOISE_BLENDMODE_ALPHA);
}
void RealTimeRenderModule::_InitText()
{
//create font texture
m_pTextMgr = m_pScene->GetTextMgr();
m_pTextMgr->CreateFontFromFile("../media/calibri.ttf", "myFont", 24);
m_pMyText_fps = m_pTextMgr->CreateDynamicTextA("myFont", "fpsLabel", "fps:000", 300, 100, Vec4(0, 0, 0, 1.0f), 0, 0);
m_pMyText_fps->SetTextColor(Vec4(0, 0.3f, 1.0f, 0.5f));
m_pMyText_fps->SetDiagonal(Vec2(20, 20), Vec2(170, 60));
m_pMyText_fps->SetFont("myFont");
m_pMyText_fps->SetBlendMode(NOISE_BLENDMODE_ALPHA);
}
void RealTimeRenderModule::_InitLight_RealTime()
{
DirLight* pDirLight1 = m_pLightMgr->CreateDynamicDirLight(m_pScene->GetSceneGraph().GetRoot(), "myDirLight1");
N_DirLightDesc dirLightDesc;
dirLightDesc.ambientColor = Vec3(0.1f, 0.1f, 0.1f);
dirLightDesc.diffuseColor = Vec3(1.0f, 1.0f, 1.0f);
dirLightDesc.specularColor = Vec3(1.0f, 1.0f, 1.0f);
dirLightDesc.direction = Vec3(1.0f, -0.5f, 0);
dirLightDesc.specularIntensity = 1.0f;
dirLightDesc.diffuseIntensity = 1.0f;
pDirLight1->SetDesc(dirLightDesc);
}
| [
"836613859@qq.com"
] | 836613859@qq.com |
406eae95f66ee24db6ec53aaf1d9f10e4fe3f8c8 | 9afed2fc60934e2eba6b0d08a570624e425ddfe2 | /proj.winrt/App.xaml.h | 412ea01f69b58670f5ff04455accae1221704861 | [] | no_license | Eason-Xi/Cat-And-Dog-s-Battle | 0062e7b9a9e1ab6aab525ac4180b63f76c92a24b | 1038804a8830365ad6801832ef142a84056a89e4 | refs/heads/master | 2020-04-07T15:39:14.003991 | 2014-06-05T08:27:29 | 2014-06-05T08:27:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,844 | h | /****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
//
// App.xaml.h
// Declaration of the App class.
//
#pragma once
#include "App.g.h"
#include "MainPage.xaml.h"
namespace CadBattle
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
ref class App sealed
{
public:
App();
virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args) override;
private:
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
MainPage^ m_mainPage;
};
}
| [
"xccxcc1221@qq.com"
] | xccxcc1221@qq.com |
5b730c663dd2bd2cc436c8c23923bdb6e8115663 | c2dc04bcc6a80c5d266d9cce1c51f49873b7bb12 | /include/ImageStone/include/imagefile/ImageFactory_Mini.h | 7e5cf034bd6cbf6f5ae6c1012662039dd3fc5c8f | [] | no_license | bote-reginald/BotE-Rainer | 74badfe2b111636c49662fe1a54c77d977ace0c8 | d7e44cd2114821bd5cfe0420d913a57f35b1d2f2 | refs/heads/master | 2020-06-05T14:20:49.949995 | 2013-08-03T10:25:06 | 2013-08-03T10:25:06 | 11,406,759 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,142 | h | /*
* Copyright (C) =USTC= Fu Li
*
* Author : Fu Li
* Create : 2005-7-29
* Home : http://www.crazy-bit.com/
* Mail : crazybitwps@hotmail.com
* History :
*/
#ifndef __FOO_IMAGEFACTORY_MINI__2005_07_29__H__
#define __FOO_IMAGEFACTORY_MINI__2005_07_29__H__
#include "Interface_ImageHandleFactory.h"
#include "ImageHandle_Bmp.h"
#include "ImageHandle_Tga.h"
//class FCImageHandleFactory ;
class FCImageHandleFactory_Mini ;
//=============================================================================
/**
* Read/Write image depend on nothing (<B>All OS</B>).
@verbatim
BMP TGA
Read O O
Write O O
@endverbatim
*/
class FCImageHandleFactory_Mini : public FCImageHandleFactory
{
protected:
virtual FCImageHandleBase* CreateImageHandle (IMAGE_TYPE imgType)
{
switch (imgType)
{
case IMG_BMP : return new FCImageHandle_Bmp ;
case IMG_TGA : return new FCImageHandle_Tga ;
}
return 0 ;
}
virtual ~FCImageHandleFactory_Mini() {}
};
#endif
| [
"wiki-birth-of-the-empires@gmx-topmail.de"
] | wiki-birth-of-the-empires@gmx-topmail.de |
62a1f2e13a772c886ce509478e07ab97bdbaf559 | 6a0633b246f58522f376cf0d9608fccdafc47da4 | /findTheKthSmallestSumOfaMatrixWithSortedRows1439.cpp | 145f6c53ab140cbc0703924444dd27bbddf3f917 | [] | no_license | studentBC/justExercise | 9ec10dbea9b2fe62d5d673fc39a91d08c9723bf7 | c5a022a6b46f56598234fb410b5d317f08dcda9c | refs/heads/master | 2023-06-26T12:28:18.144489 | 2023-06-11T15:27:36 | 2023-06-11T15:27:36 | 130,351,745 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,524 | cpp | class Solution {
public:
int kthSmallest(vector<vector<int>>& mat, int k) {
vector<int>row = mat[0];
int len;
for (int i = 1; i < mat.size(); i++) {
vector<int>temp;
for (int j = 0; j < mat[i].size(); j++) {
for (int n: row) {
temp.push_back(mat[i][j]+n);
}
}
sort(temp.begin(), temp.end());
len = min (k, int(temp.size()));
row.resize(len);
for (int j = 0; j < len; j++) row[j] = temp[j];
}
return row.back();
}
};
/*because k is small, we can come up with an easy solution, we calculate all the possible results row by row, sort the result array, trim the result array to k size, the answer is the k-1 element.*/
class Solution {
public:
int kthSmallest(vector<vector<int>>& mat, int k) {
vector<int> row = mat[0];
for(int i = 1; i < mat.size(); ++i) {
vector<int> nr;
for(int j = 0; j < mat[i].size(); ++j) {
for(auto n : row) {
nr.push_back(mat[i][j] + n);
}
}
sort(nr.begin(), nr.end());
row.resize(min(k, int(nr.size())));
for(int x = 0; x <min(k, int(nr.size())) ;++x) {
row[x] = nr[x];
}
}
return row[k-1];
}
};
//44ms solution
class Solution {
public:
void DFS(int p, int cur, int sum, int &n, int k, vector<vector<int>> &mat) {
if (p == mat.size()) {
++n;
return;
}
if (n >= k) {
return;
}
for (int m : mat[p]) {
if (cur + m <= sum) {
DFS(p + 1, cur + m, sum, n, k, mat);
} else {
return;
}
}
return;
}
bool check(int sum, int k, vector<vector<int>> &mat) {
int n = 0;
DFS(0, 0, sum, n, k, mat);
if (n >= k) {
return true;
} else {
return false;
}
}
int kthSmallest(vector<vector<int>>& mat, int k) {
int min_sum = 0;
for (int i = 0; i < mat.size(); ++i) {
min_sum += mat[i][0];
for (int j = 1; j < mat[i].size(); ++j) {
mat[i][j] -= mat[i][0];
}
mat[i][0] = 0;
}
int L = 1, R = 1E6;
while (L < R) {
int M = (L + R) / 2;
if (check(M, k, mat)) {
R = M;
} else {
L = M + 1;
}
}
return L + min_sum;
}
};
| [
"ben.chin@quantatw.com"
] | ben.chin@quantatw.com |
d1998bbd9038944cd4c2f471e5d2aa33de08c319 | 849ba0d4d0cc316ba1568f19632cd0c48b64b701 | /include/Display/Gui.h | 51ad59f4e41d696fcbcb30c6b46049f10c38d865 | [] | no_license | lanquemar/Murakami | 146c7ddc47a9549f873935acbdc641fc52b8b401 | d7775f5632ee0ef2eeedf1a3a3199a7c317ce66d | refs/heads/master | 2021-01-20T05:08:22.988048 | 2015-07-02T21:53:06 | 2015-07-02T21:53:06 | 37,971,376 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 617 | h | /*
** Gui.h for Murakami in /home/vasseu_g/github/Murakami
**
** Made by Adrien Vasseur
** Login <vasseu_g@epitech.net>
**
** Started on Mon Jun 29 23:26:25 2015 Adrien Vasseur
** Last update Thu Jul 2 23:25:57 2015 Adrien Vasseur
*/
#ifndef GUI_H_
# define GUI_H_
# include <iostream>
# include <SFML/Graphics.hpp>
namespace Display
{
class Gui
{
public:
Gui();
~Gui();
bool init();
void draw(sf::RenderWindow *);
private:
sf::Font *m_font;
sf::Text *m_name;
sf::Text *m_fps;
sf::Clock m_clock;
unsigned int fps;
};
};
#endif /* !GUI_H_ */
| [
"adrien.vasseur@epitech.eu"
] | adrien.vasseur@epitech.eu |
93576421232c3955b4fc22b65db2e61799530f8d | 302ee54be50d62d3af2b73ac0ee829a5a269ba16 | /src/disk.h | 1371571603ec8a9ad8c51ef02b90d25e8833da37 | [] | no_license | annguyens/PeripheralParadise | 3a57647e0913d2386e63c565264e7c6f507578d6 | 7605dda9ad236947934c70cbe6ab450dcf9a0282 | refs/heads/master | 2023-04-20T09:36:02.123970 | 2021-05-07T08:13:39 | 2021-05-07T08:13:39 | 297,776,978 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 324 | h | #ifndef __DISK_H
#define __DISK_H
#include "options.h"
class Disk: public Options
{
public:
Disk(int tb, std::string name, double cost);
Disk(std::istream& ist);
virtual ~Disk();
std::string to_string() const override;
void save(std::ostream& ost) override;
virtual Options* clone();
protected:
int _tb;
};
#endif
| [
"an.nguyen8@mavs.uta.edu"
] | an.nguyen8@mavs.uta.edu |
1d57ce7f36e1a25978c1a10b22e73868f647334a | fafdf1e62cf622035ee82666ba6ae7108127d140 | /kynapse7/include/kypdg/pointgraph/simplification/coverageinfo.h | 9eaa099fb820d91f7e7a87502adcee8a6dceb040 | [] | no_license | saerich/RaiderZ-Evolved-SDK | 7f18942ddc6c566d47c3a6222c03fad7543738a4 | b576e6757b6a781a656be7ba31eb0cf5e8a23391 | refs/heads/master | 2023-02-12T03:21:26.442348 | 2020-08-30T15:39:54 | 2020-08-30T15:39:54 | 281,213,173 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,418 | h | /*
* Copyright 2010 Autodesk, Inc. All rights reserved.
* This computer source code and related instructions and comments are the
* unpublished confidential and proprietary information of Autodesk, Inc. and
* are protected under applicable copyright and trade secret law. They may
* not be disclosed to, copied or used by any third party without
* the prior written consent of Autodesk, Inc.
*/
// primary contact: JODA - secondary contact: NOBODY
#ifndef KyPdg_CoverageInfo_H
#define KyPdg_CoverageInfo_H
#include "kypdg/pointgraph/simplification/obstaclesinfo.h"
#include "kypathdata/math/vec2f.h"
#include "kypathdata/containers/array.h"
namespace Kaim
{
class DynamicNavFloor;
class PdgPointGraph;
class PdgGraphVertex;
class EdgeToCover
{
public:
EdgeToCover() : m_halfEdge(KY_NULL), m_visiblePointCount(0) {} // To be compatible with Array
EdgeToCover(const Vec2f& v1, const Vec2f& v2, const DynamicNavHalfEdge* halfEdge) :
m_edge(v1, v2), m_halfEdge(halfEdge), m_visiblePointCount(0)
{}
const Vec2f& GetV1() const { return m_edge.GetV1(); }
const Vec2f& GetV2() const { return m_edge.GetV2(); }
const DynamicNavHalfEdge* GetHalfEdge() const { return m_halfEdge; }
bool IsCovered() const { return 0 < m_visiblePointCount; }
bool IsLastVisible() const { return m_visiblePointCount == 1; }
void IncreaseVisible(PdgGraphVertex& /*vertex*/) { ++m_visiblePointCount; }
void DecreaseVisible(PdgGraphVertex& /*vertex*/) { /* assert(m_visiblePointCount); */ --m_visiblePointCount; }
private:
Edge2d m_edge;
const DynamicNavHalfEdge* m_halfEdge;
KyUInt32 m_visiblePointCount;
};
class CoverageInfo
{
public:
CoverageInfo() : m_maxCoverageDistance(KyFloat32MAXVAL) {}
void InitCoverage(PdgPointGraph& graph, const DynamicNavFloor& navFloor);
bool IsLastCoverer(const PdgGraphVertex& vertex) const;
void RemoveCoverage(PdgGraphVertex& vertex);
void SetCoverageDistance(KyFloat32 dist) { m_maxCoverageDistance = dist; }
KyFloat32 GetCoverageDistance() const { return m_maxCoverageDistance; }
bool CheckValidity() const;
private:
void InitSegment(const DynamicNavFloor& navFloor);
void Compute(const DynamicNavFloor& navFloor, PdgPointGraph& graph);
void ComputeForSingleVertex(PdgGraphVertex& vertex);
private:
typedef Array<EdgeToCover> EdgesToCover;
private:
EdgesToCover m_coverageEdges;
KyFloat32 m_maxCoverageDistance;
};
} // namespace Kaim
#endif // KyPdg_CoverageInfo_H
| [
"fabs1996@live.co.uk"
] | fabs1996@live.co.uk |
53bb6e3b2c9324b97c63a0d3cb83c7d8e8484796 | bbb56d99ccc740d2cfb87d14e5a782809b6e5979 | /11_lesson/Classes/Classes/Worker.h | 5c7d1295dd27a13ff4f88a43986b2b0bbe4cb308 | [
"MIT"
] | permissive | NakonechnyiMykhail/system_prog | bac7c81c6e5dba60769ab2f399b553c7d3e8eb0c | d92d4b76a88761b52f522e8b185db1e58ec19227 | refs/heads/master | 2022-12-26T07:44:04.022942 | 2020-08-13T20:25:31 | 2020-08-13T20:25:31 | 273,444,351 | 1 | 0 | MIT | 2020-09-08T14:24:57 | 2020-06-19T08:29:58 | C++ | UTF-8 | C++ | false | false | 769 | h | #pragma once
#include <string>
class Worker {
// all fields and methods are PRIVATE (default)
// good rules:
// public -> protected -> private (in the end)
// don't public members
public:
Worker();
Worker(
const std::string& firstname,
const std::string& secondname,
const std::string& position);
std::string GetFullName() const;
void GetFullName(std::string& fullName) const;
std::string GetFirstName() const;
void SetFirstName(const std::string& name);
void SetFirstName(const char* name);
//std::string m_firstname;
private:
Worker(const std::string& firstname, const std::string& secondname);
private:
std::string m_firstname;
std::string m_secondname;
std::string m_position;
};
| [
"mykhail.nakonechnyi@gmail.com"
] | mykhail.nakonechnyi@gmail.com |
99a0ed7e3765691e4ac6f3973a66efd91bdc5595 | 5470644b5f0834b9646649da365c96101a2f9b2a | /Sources/Elastos/Frameworks/Droid/Base/Core/inc/widget/GridView.h | 38005e43618ef97ce07781298dcff15854a65ceb | [] | no_license | dothithuy/ElastosRDK5_0 | 42372da3c749170581b5ee9b3884f4a27ae81608 | 2cf231e9f09f8b3b8bcacb11080b4a87d047833f | refs/heads/master | 2021-05-13T15:02:22.363934 | 2015-05-25T01:54:38 | 2015-05-25T01:54:38 | 116,755,452 | 1 | 0 | null | 2018-01-09T02:33:06 | 2018-01-09T02:33:06 | null | UTF-8 | C++ | false | false | 7,762 | h |
#ifndef __GRIDVIEW_H__
#define __GRIDVIEW_H__
#include "ext/frameworkext.h"
#include "widget/AbsListView.h"
namespace Elastos {
namespace Droid {
namespace Widget {
/**
* A view that shows items in two-dimensional scrolling grid. The items in the
* grid come from the {@link ListAdapter} associated with this view.
*
* <p>See the <a href="{@docRoot}resources/tutorials/views/hello-gridview.html">Grid
* View tutorial</a>.</p>
*/
class GridView : public AbsListView
{
public:
virtual CARAPI SetRemoteViewsAdapter(
/* [in] */ IIntent* intent);
virtual CARAPI_(AutoPtr<IAdapter>) GetAdapter();
virtual CARAPI SetAdapter(
/* [in] */ IAdapter* adapter);
virtual CARAPI_(Int32) LookForSelectablePosition(
/* [in] */ Int32 position,
/* [in] */ Boolean lookDown);
virtual CARAPI FillGap(
/* [in] */ Boolean down);
virtual CARAPI_(Int32) FindMotionRow(
/* [in] */ Int32 y);
virtual CARAPI SmoothScrollToPosition(
/* [in] */ Int32 position);
using AbsListView::SmoothScrollToPosition;
virtual CARAPI SmoothScrollByOffset(
/* [in] */ Int32 offset);
virtual CARAPI_(Int32) GetGravity();
virtual CARAPI_(Int32) GetHorizontalSpacing();
virtual CARAPI_(Int32) GetRequestedHorizontalSpacing();
CARAPI_(Int32) GetVerticalSpacing();
CARAPI_(Int32) GetColumnWidth();
CARAPI_(Int32) GetRequestedColumnWidth();
CARAPI_(Int32) GetNumColumns();
CARAPI OnInitializeAccessibilityEvent(
/* [in] */ IAccessibilityEvent* event);
CARAPI OnInitializeAccessibilityNodeInfo(
/* [in] */ IAccessibilityNodeInfo* info);
virtual CARAPI SetSelection(
/* [in] */ Int32 position);
virtual CARAPI_(Boolean) OnKeyDown(
/* [in] */ Int32 keyCode,
/* [in] */ IKeyEvent* event);
virtual CARAPI_(Boolean) OnKeyMultiple(
/* [in] */ Int32 keyCode,
/* [in] */ Int32 repeatCount,
/* [in] */ IKeyEvent* event);
virtual CARAPI_(Boolean) OnKeyUp(
/* [in] */ Int32 keyCode,
/* [in] */ IKeyEvent* event);
virtual CARAPI SetGravity(
/* [in] */ Int32 gravity);
virtual CARAPI SetHorizontalSpacing(
/* [in] */ Int32 horizontalSpacing);
virtual CARAPI SetVerticalSpacing(
/* [in] */ Int32 verticalSpacing);
virtual CARAPI SetStretchMode(
/* [in] */ Int32 stretchMode);
virtual CARAPI_(Int32) GetStretchMode();
virtual CARAPI SetColumnWidth(
/* [in] */ Int32 columnWidth);
virtual CARAPI SetNumColumns(
/* [in] */ Int32 numColumns);
private:
CARAPI_(AutoPtr<IView>) FillDown(
/* [in] */ Int32 pos,
/* [in] */ Int32 nextTop);
CARAPI_(AutoPtr<IView>) MakeRow(
/* [in] */ Int32 startPos,
/* [in] */ Int32 y,
/* [in] */ Boolean flow);
CARAPI_(AutoPtr<IView>) FillUp(
/* [in] */ Int32 pos,
/* [in] */ Int32 nextBottom);
CARAPI_(AutoPtr<IView>) FillFromTop(
/* [in] */ Int32 nextTop);
CARAPI_(AutoPtr<IView>) FillFromBottom(
/* [in] */ Int32 lastPosition,
/* [in] */ Int32 nextBottom);
CARAPI_(AutoPtr<IView>) FillSelection(
/* [in] */ Int32 childrenTop,
/* [in] */ Int32 childrenBottom);
CARAPI_(void) PinToTop(
/* [in] */ Int32 childrenTop);
CARAPI_(void) PinToBottom(
/* [in] */ Int32 childrenBottom);
CARAPI_(AutoPtr<IView>) FillSpecific(
/* [in] */ Int32 position,
/* [in] */ Int32 top);
CARAPI_(void) CorrectTooHigh(
/* [in] */ Int32 numColumns,
/* [in] */ Int32 verticalSpacing,
/* [in] */ Int32 childCount);
CARAPI_(void) CorrectTooLow(
/* [in] */ Int32 numColumns,
/* [in] */ Int32 verticalSpacing,
/* [in] */ Int32 childCount);
CARAPI_(AutoPtr<IView>) FillFromSelection(
/* [in] */ Int32 selectedTop,
/* [in] */ Int32 childrenTop,
/* [in] */ Int32 childrenBottom);
CARAPI_(Int32) GetBottomSelectionPixel(
/* [in] */ Int32 childrenBottom,
/* [in] */ Int32 fadingEdgeLength,
/* [in] */ Int32 numColumns,
/* [in] */ Int32 rowStart);
CARAPI_(Int32) GetTopSelectionPixel(
/* [in] */ Int32 childrenTop,
/* [in] */ Int32 fadingEdgeLength,
/* [in] */ Int32 rowStart);
CARAPI_(void) AdjustForBottomFadingEdge(
/* [in] */ IView* childInSelectedRow,
/* [in] */ Int32 topSelectionPixel,
/* [in] */ Int32 bottomSelectionPixel);
CARAPI_(void) AdjustForTopFadingEdge(
/* [in] */ IView* childInSelectedRow,
/* [in] */ Int32 topSelectionPixel,
/* [in] */ Int32 bottomSelectionPixel);
CARAPI_(AutoPtr<IView>) MoveSelection(
/* [in] */ Int32 delta,
/* [in] */ Int32 childrenTop,
/* [in] */ Int32 childrenBottom);
CARAPI_(Boolean) DetermineColumns(
/* [in] */ Int32 availableSpace);
CARAPI_(AutoPtr<IView>) MakeAndAddView(
/* [in] */ Int32 position,
/* [in] */ Int32 y,
/* [in] */ Boolean flow,
/* [in] */ Int32 childrenLeft,
/* [in] */ Boolean selected,
/* [in] */ Int32 where);
CARAPI_(void) SetupChild(
/* [in] */ IView* child,
/* [in] */ Int32 position,
/* [in] */ Int32 y,
/* [in] */ Boolean flow,
/* [in] */ Int32 childrenLeft,
/* [in] */ Boolean selected,
/* [in] */ Boolean recycled,
/* [in] */ Int32 where);
CARAPI_(Boolean) SequenceScroll(
/* [in] */ Int32 direction);
CARAPI_(Boolean) CommonKey(
/* [in] */ Int32 keyCode,
/* [in] */ Int32 count,
/* [in] */ IKeyEvent* event);
CARAPI_(Boolean) IsCandidateSelection(
/* [in] */ Int32 childIndex,
/* [in] */ Int32 direction);
CARAPI AdjustViewsUpOrDown();
protected:
GridView();
CARAPI Init(
/* [in] */ IContext* context,
/* [in] */ IAttributeSet* attrs = NULL,
/* [in] */ Int32 defStyle = R::attr::gridViewStyle);
CARAPI_(void) OnMeasure(
/* [in] */ Int32 widthMeasureSpec,
/* [in] */ Int32 heightMeasureSpec);
CARAPI AttachLayoutAnimationParameters(
/* [in] */ IView* child,
/* [in] */ IViewGroupLayoutParams* params,
/* [in] */ Int32 index,
/* [in] */ Int32 count);
CARAPI_(void) LayoutChildren();
CARAPI SetSelectionInt(
/* [in] */ Int32 position);
CARAPI_(Boolean) PageScroll(
/* [in] */ Int32 direction);
CARAPI_(Boolean) FullScroll(
/* [in] */ Int32 direction);
CARAPI_(Boolean) ArrowScroll(
/* [in] */ Int32 direction);
CARAPI_(void) OnFocusChanged(
/* [in] */ Boolean gainFocus,
/* [in] */ Int32 direction,
/* [in] */ IRect* previouslyFocusedRect);
CARAPI_(Int32) ComputeVerticalScrollExtent();
CARAPI_(Int32) ComputeVerticalScrollOffset();
CARAPI_(Int32) ComputeVerticalScrollRange();
public:
static const String GRIDVIEW_NAME;
static const Int32 NO_STRETCH = 0;
static const Int32 STRETCH_SPACING = 1;
static const Int32 STRETCH_COLUMN_WIDTH = 2;
static const Int32 STRETCH_SPACING_UNIFORM = 3;
static const Int32 AUTO_FIT = -1;
private:
Int32 mNumColumns;
Int32 mHorizontalSpacing;
Int32 mRequestedHorizontalSpacing;
Int32 mVerticalSpacing;
Int32 mStretchMode;
Int32 mColumnWidth;
Int32 mRequestedColumnWidth;
Int32 mRequestedNumColumns;
AutoPtr<IView> mReferenceView;
AutoPtr<IView> mReferenceViewInSelectedRow;
Int32 mGravity;
AutoPtr<CRect> mTempRect;
};
} // namespace Widget
} // namespace Droid
} // namespace Elastos
#endif
| [
"chen.yunzhi@kortide.com"
] | chen.yunzhi@kortide.com |
95851a011465e3f8a204da343e25d8f323bb5c15 | 506bf12e2992e72a7ce9b067ca6bfbd783cd1f67 | /Matrix.h | 8f255c3f826a6b1cf4ae095570c83b40ac47d4b9 | [] | no_license | sxmwht/MatrixLibrary | 87be52f06d5bfd35fb30a3557fe9d1f6c7cd53de | 2dc4108f2f07dc8046bb9f56af136ccd4e77a0aa | refs/heads/master | 2021-05-28T12:06:26.432864 | 2014-04-05T01:10:15 | 2014-04-05T01:10:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 500 | h | /* A library for driving an 8x8 LED matrix
* Created by Sam White (@samwhiteUK) */
#ifndef Matrix_h
#define Matrix_h
#define RED 'r'
#define GREEN 'g'
#define ORANGE 'o'
#define OFF 0
#include "Arduino.h"
class Matrix {
public:
Matrix();
void scrollText(char message[], int scrollSpeed, char colour);
void updateDisplay(int displayLength);
void clearDisplay();
void draw(byte x, byte y, char colour);
private:
boolean checkNextCharacter(char character);
};
#endif
| [
"sam94white@gmail.com"
] | sam94white@gmail.com |
13a4a565347a6feff7eadb82594f0b246d162c13 | 35cebf36df81a9a2994160fb47e5426d9ecf5154 | /common/Pdf.h | 65d68ad452608484f454a2b4a69a7ebad47390d8 | [] | no_license | TheSableCZ/Raytracer | d80254b210fdf3145f0651a0bc1ecc7c162f5413 | 9c429b23c698966f3f371755abf19e4671fcac36 | refs/heads/master | 2023-04-22T15:39:39.578570 | 2020-12-12T21:41:34 | 2020-12-12T21:41:34 | 316,797,974 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,515 | h | //
// Created by Jan Sobol on 10/12/2020.
//
#ifndef RAYTRACER_PDF_H
#define RAYTRACER_PDF_H
#include <glm/glm.hpp>
#include "../common/Random.h"
class Pdf {
public:
virtual float value(const glm::vec3 &direction) const = 0;
virtual glm::vec3 generate() const = 0;
};
class CosinePdf : public Pdf {
public:
explicit CosinePdf(const glm::vec3 &n) : normal(n) {}
float value(const glm::vec3 &direction) const override {
auto cosine = dot(normalize(direction), normal);
return (cosine <= 0) ? 0 : cosine/static_cast<float>(M_PI);
}
glm::vec3 generate() const override {
return calculateRandomDirectionInHemisphere(normal);
}
glm::vec3 normal;
};
class MinusCosinePdf : public Pdf {
public:
explicit MinusCosinePdf(const glm::vec3 &n) : normal(n) {}
float value(const glm::vec3 &direction) const override {
auto cosine = dot(-normalize(direction), normal);
return (cosine <= 0) ? 0 : cosine/static_cast<float>(M_PI);
}
glm::vec3 generate() const override {
return -calculateRandomDirectionInHemisphere(normal);
}
glm::vec3 normal;
};
class SceneObjsPdf : public Pdf {
public:
SceneObjsPdf(const std::vector<std::shared_ptr<SceneObject>> &objects, const glm::vec3 &origin)
: objects(objects), origin(origin) {}
float value(const glm::vec3 &direction) const override {
auto weight = 1.0/objects.size();
auto sum = 0.0;
for (const auto &polygon : objects)
sum += weight * polygon->pdfValue(origin, direction);
return sum;
}
glm::vec3 generate() const override {
auto int_size = static_cast<int>(objects.size());
if (int_size > 0) {
auto randIdx = randomInt(0, int_size - 1);
return objects[randIdx]->randomDirection(origin);
}
return glm::vec3 (0.f);
}
const std::vector<std::shared_ptr<SceneObject>> &objects;
glm::vec3 origin;
};
class MixturePdf : public Pdf {
public:
MixturePdf(std::shared_ptr<Pdf> p0, std::shared_ptr<Pdf> p1) {
p[0] = p0;
p[1] = p1;
}
float value(const glm::vec3 &direction) const override {
return 0.5 * p[0]->value(direction) + 0.5 *p[1]->value(direction);
}
glm::vec3 generate() const override {
if (randomFloat() < 0.5)
return p[0]->generate();
else
return p[1]->generate();
}
public:
std::shared_ptr<Pdf> p[2];
};
#endif //RAYTRACER_PDF_H
| [
"hsobol@seznam.cz"
] | hsobol@seznam.cz |
97a7580adef7298730bf0e6204237182534e7b9f | 3c3023002f8442f5ff7c1aeb8837b9ef1b4106b0 | /2S/07/1/bag.cpp | 0a6dd0a75b11296eca6d5e56b0734567ee28e504 | [] | no_license | kivi239/Homeworks | 410b892b8af3e2be656474988628356463ce4726 | 886a4d77ac5aa774e481f7e6f58f6b7d7f186d96 | refs/heads/master | 2021-01-22T13:41:44.076563 | 2015-05-28T15:08:21 | 2015-05-28T15:08:21 | 15,022,533 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 630 | cpp | #include <cstdio>
#include "bag.h"
#include <iostream>
using std::max;
Bag::Bag() {}
Bag::~Bag() {}
bool Bag::find(int value)
{
return AVLTree::find(root, value);
}
bool Bag::add(int value)
{
bool isFind = find(value);
AVLTree::add(root, value);
return isFind;
}
bool Bag::remove(int value)
{
if (!find(value))
return false;
AVLTree::remove(root, value);
return true;
}
void Bag::printAscending()
{
AVLTree::printAscending(root);
printf("\n");
}
void Bag::printDescending()
{
AVLTree::printDescending(root);
printf("\n");
}
void Bag::printTree()
{
AVLTree::printTree(root);
printf("\n");
}
| [
"ilya.kuzmina@yandex.ru"
] | ilya.kuzmina@yandex.ru |
4fb47edfdf90c2241a910064462925242856f859 | ccc5c73520260d42a43cf432b31f5bebfd9ba9f5 | /CubeApp/CubeApp/CubeApp.cpp | aac646b5725e219e9d7a0b0adf04d5955272ee5d | [] | no_license | Henipiter/Cube_solver | be72e2debefcf3bddb17208c326c7a26b9306e56 | be2daf03f38aa2c110a349e36a3605cda9cc3a9e | refs/heads/main | 2023-02-26T09:41:14.026353 | 2021-02-02T17:11:05 | 2021-02-02T17:11:05 | 334,962,940 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 318 | cpp |
#include "MethodOldPochmann.h"
#include <iostream>
using namespace std;
int main() {
char up, front;
up = 'y';
front = 'r';
string scramble = "U R";
MethodOldPochmann a(up, front, scramble);
cubeSolver* b = &a;
b->method();
b->solveCube();
b->showInfo();
//cubeSolver a(up, front, scramble);
}
| [
"henipiter@wp.pl"
] | henipiter@wp.pl |
6aa10115e9c5007f9b3c8d94c5365fa014d45128 | c115676143c7f7416ddc4b57330fad4b2d1d6dca | /Searching and Sorting/32-subset sum.cpp | 0f04b5dcd5d2b8f31e1ec1c1fd10133091a85fd4 | [] | no_license | ThyPandaKing/Final-450 | 3250f313cde3648e2c193acfc88b2377b6cb4d26 | 515d9eb2ecdb9cdffd612999eaec63ace27c0c4f | refs/heads/main | 2023-08-10T23:42:30.354867 | 2021-09-07T03:27:50 | 2021-09-07T03:27:50 | 365,024,114 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,321 | cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
class Solution {
public:
static void Solve() {
int n, a, b;
cin >> n >> a >> b;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
ll int subSet = 1 << (n / 2);
vector<ll int> sum1, sum2;
for (ll int j = 0; j < subSet; j++) {
ll int sumA = 0;
for (int k = 0; k < n / 2; k++) {
if ((1 << k) & j) {
sumA += arr[k];
}
}
sum1.push_back(sumA);
}
subSet = 1 << (n / 2 + n % 2);
for (ll int j = 0; j < subSet; j++) {
ll int sumA = 0;
for (int k = 0; k < n / 2 + n % 2; k++) {
if ((1 << k) & j) {
sumA += arr[k + n / 2];
}
}
sum2.push_back(sumA);
}
sort(sum1.begin(), sum1.end());
ll int ans = 0;
for (int i = 0; i < sum2.size(); i++) {
auto low = lower_bound(sum1.begin(), sum1.end(), a - sum2[i]);
auto high = upper_bound(sum1.begin(), sum1.end(), b - sum2[i]);
ans += (high - low);
}
cout << ans;
}
};
int main() { Solution::Solve(); } | [
"aditya9660sharma@gmail.com"
] | aditya9660sharma@gmail.com |
767e8f456dff048a9702d0e5e998076a7d8fcd15 | 1bdbeb4424cd8b7f02ae3aa3692c88c19abc62c6 | /src/SimpleColoringStage.cpp | 6ddca277f1eac41e7b49aa0d6c0d190c68f1c009 | [
"MIT"
] | permissive | rharel/cpp-mandelbrot | 55b607a4fc629b171f56d2ed03c4c3edef39a557 | 8b478a08358dcff6b1f5d7da78d0b48a35facea9 | refs/heads/master | 2021-01-20T19:05:11.116839 | 2016-07-31T14:45:35 | 2016-07-31T14:45:35 | 64,593,925 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,683 | cpp | #include <mandelbrot/SimpleColoringStage.h>
#include <mandelbrot/ComputationStage.h>
using namespace mandelbrot;
using namespace oogl;
const char* SimpleColoringStage::VERTEX_SHADER_SOURCE_PATH =
"../src/shaders/simpleColoringVertexShader.glsl";
const char* SimpleColoringStage::FRAGMENT_SHADER_SOURCE_PATH =
"../src/shaders/simpleColoringFragmentShader.glsl";
const GLint SimpleColoringStage::LIFETIME_TEXTURE_UNIT_INDEX = 0;
const GLint SimpleColoringStage::LIFETIME_COLOR_MAP_TEXTURE_UNIT_INDEX = 1;
const unsigned char SimpleColoringStage::DEFAULT_COLOR_MAP_DATA[3 * 8] =
{
0 * 32, 0 * 32, 0 * 32,
1 * 32, 1 * 32, 1 * 32,
2 * 32, 2 * 32, 2 * 32,
3 * 32, 3 * 32, 3 * 32,
4 * 32, 4 * 32, 4 * 32,
5 * 32, 5 * 32, 5 * 32,
6 * 32, 6 * 32, 6 * 32,
7 * 32, 7 * 32, 7 * 32
};
SimpleColoringStage::SimpleColoringStage()
: ProcessingStage
(
VERTEX_SHADER_SOURCE_PATH,
FRAGMENT_SHADER_SOURCE_PATH
),
color_map_(8, 3, DEFAULT_COLOR_MAP_DATA) {}
bool SimpleColoringStage::Initialize()
{
return ProcessingStage::Initialize() &&
InitializeTextures() &&
InitializeBuffers() &&
InitializeUniforms();
}
bool SimpleColoringStage::InitializeTextures()
{
in_lifetime_color_map_texture_ = std::make_unique<Texture>
(
Texture::Binding::Texture1D,
GL_RGB, color_map_.size(), 1
);
in_lifetime_color_map_texture_->Bind();
in_lifetime_color_map_texture_->Resize(color_map_.size(), 1);
in_lifetime_color_map_texture_->UploadData
(
0,
GL_RGB, GL_UNSIGNED_BYTE,
color_map_.data()
);
in_lifetime_color_map_texture_->set_filters(Texture::Filter::Nearest);
out_colored_texture_ = std::make_unique<Texture>
(
Texture::Binding::Texture2D,
GL_RGB, 1, 1
);
out_colored_texture_->Bind();
out_colored_texture_->UploadData
(
0,
GL_RGB, GL_UNSIGNED_BYTE,
nullptr
);
out_colored_texture_->set_filters(Texture::Filter::Nearest);
return true;
}
bool SimpleColoringStage::InitializeBuffers()
{
frame_buffer_ = std::make_unique<FrameBuffer>();
frame_buffer_->Bind();
depth_render_buffer_ = std::make_unique<RenderBuffer>();
depth_render_buffer_->Bind();
RenderBuffer::DefineStorage
(
GL_DEPTH_COMPONENT,
out_colored_texture_->width(),
out_colored_texture_->height()
);
frame_buffer_->AttachRenderBuffer
(
*depth_render_buffer_,
GL_DEPTH_ATTACHMENT
);
frame_buffer_->AttachTexture
(
*out_colored_texture_,
GL_COLOR_ATTACHMENT0
);
std::string message;
if (!frame_buffer_->is_complete(message))
{
status_message_ = "Frame buffer incomplete: " + message;
return false;
}
return true;
}
bool SimpleColoringStage::InitializeUniforms()
{
program_->Use();
uniform_lifetime_texture_ =
program_->GetVectorUniform<GLint, 1>("lifetime_texture");
uniform_lifetime_texture_
.set(LIFETIME_TEXTURE_UNIT_INDEX);
uniform_lifetime_color_map_texture_ =
program_->GetVectorUniform<GLint, 1>("lifetime_color_map_texture");
uniform_lifetime_color_map_texture_
.set(LIFETIME_COLOR_MAP_TEXTURE_UNIT_INDEX);
return uniform_lifetime_texture_.is_valid() &&
uniform_lifetime_color_map_texture_.is_valid();
}
void SimpleColoringStage::Execute()
{
program_->Use();
frame_buffer_->Bind();
GLenum draw_buffers[1] = {GL_COLOR_ATTACHMENT0};
glDrawBuffers(1, draw_buffers);
in_lifetime_texture_
->BindToUnit(LIFETIME_TEXTURE_UNIT_INDEX);
in_lifetime_color_map_texture_
->BindToUnit(LIFETIME_COLOR_MAP_TEXTURE_UNIT_INDEX);
glViewport
(
0, 0,
out_colored_texture_->width(),
out_colored_texture_->height()
);
DrawScreenQuad();
}
void SimpleColoringStage::set_texture_size
(
const GLint width,
const GLint height
)
{
out_colored_texture_->Bind();
out_colored_texture_->Resize(width, height);
depth_render_buffer_->Bind();
RenderBuffer::DefineStorage
(
GL_DEPTH_COMPONENT,
width, height
);
}
void SimpleColoringStage::set_lifetime_texture(Texture& value)
{
in_lifetime_texture_ = &value;
}
const ColorArray& SimpleColoringStage::color_map() const
{
return color_map_;
}
void SimpleColoringStage::set_color_map(const ColorArray& value)
{
if (value.is_empty()) { return; }
color_map_ = value;
}
const Texture& SimpleColoringStage::colored_texture() const
{
return *out_colored_texture_;
}
| [
"raoul.harel@gmail.com"
] | raoul.harel@gmail.com |
28518740cf2d447596f300c9cabe5bbf01c74e8f | 4352b5c9e6719d762e6a80e7a7799630d819bca3 | /tutorials/eulerVortex.twitch/eulerVortex.cyclic.twitch.test.test/processor3/3.83/rho | abf84174f0bfdd159cfeca5958171163137737d5 | [] | no_license | dashqua/epicProject | d6214b57c545110d08ad053e68bc095f1d4dc725 | 54afca50a61c20c541ef43e3d96408ef72f0bcbc | refs/heads/master | 2022-02-28T17:20:20.291864 | 2019-10-28T13:33:16 | 2019-10-28T13:33:16 | 184,294,390 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 47,659 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "3.83";
object rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -3 0 0 0 0 0];
internalField nonuniform List<scalar>
5625
(
1.39998
1.39998
1.39997
1.39997
1.39996
1.39996
1.39995
1.39995
1.39996
1.39996
1.39997
1.39999
1.40001
1.40004
1.40007
1.4001
1.40014
1.40018
1.40022
1.40027
1.40031
1.40035
1.40039
1.40042
1.40045
1.40047
1.40048
1.40049
1.40049
1.40048
1.40047
1.40045
1.40043
1.40041
1.40038
1.40035
1.40032
1.40029
1.40026
1.40023
1.40021
1.40018
1.40016
1.40013
1.40011
1.4001
1.40008
1.40007
1.40005
1.40004
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.39998
1.39997
1.39997
1.39996
1.39996
1.39996
1.39996
1.39996
1.39997
1.39999
1.40001
1.40003
1.40007
1.40011
1.40015
1.40021
1.40026
1.40032
1.40038
1.40044
1.4005
1.40056
1.40061
1.40065
1.40068
1.40071
1.40072
1.40072
1.40072
1.4007
1.40068
1.40065
1.40061
1.40057
1.40053
1.40049
1.40044
1.4004
1.40035
1.40031
1.40027
1.40024
1.4002
1.40017
1.40015
1.40012
1.4001
1.40008
1.40007
1.40005
1.40004
1.40003
1.40003
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.39998
1.39997
1.39997
1.39996
1.39996
1.39996
1.39997
1.39998
1.4
1.40003
1.40006
1.40011
1.40016
1.40022
1.40029
1.40037
1.40045
1.40054
1.40063
1.40071
1.40079
1.40087
1.40093
1.40098
1.40103
1.40105
1.40107
1.40106
1.40105
1.40102
1.40098
1.40093
1.40088
1.40081
1.40075
1.40068
1.40061
1.40054
1.40048
1.40042
1.40036
1.40031
1.40027
1.40022
1.40019
1.40016
1.40013
1.4001
1.40008
1.40006
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.39998
1.39997
1.39997
1.39997
1.39997
1.39998
1.39999
1.40002
1.40005
1.4001
1.40015
1.40022
1.40031
1.4004
1.4005
1.40062
1.40074
1.40086
1.40098
1.4011
1.40121
1.40131
1.4014
1.40147
1.40152
1.40155
1.40156
1.40155
1.40152
1.40147
1.40141
1.40133
1.40125
1.40115
1.40105
1.40095
1.40085
1.40075
1.40066
1.40057
1.40049
1.40042
1.40035
1.40029
1.40024
1.4002
1.40016
1.40013
1.4001
1.40008
1.40006
1.40005
1.40004
1.40003
1.40002
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.39998
1.39998
1.39998
1.39998
1.39999
1.40001
1.40004
1.40008
1.40014
1.40021
1.4003
1.40041
1.40053
1.40067
1.40082
1.40098
1.40115
1.40133
1.4015
1.40166
1.40181
1.40195
1.40206
1.40215
1.40222
1.40225
1.40226
1.40224
1.40219
1.40211
1.40201
1.4019
1.40177
1.40163
1.40148
1.40133
1.40119
1.40104
1.40091
1.40078
1.40067
1.40056
1.40047
1.40039
1.40032
1.40026
1.40021
1.40017
1.40013
1.4001
1.40008
1.40006
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.40001
1.40003
1.40006
1.40011
1.40018
1.40027
1.40038
1.40052
1.40068
1.40086
1.40106
1.40127
1.40151
1.40174
1.40198
1.40222
1.40244
1.40265
1.40283
1.40298
1.4031
1.40318
1.40322
1.40322
1.40318
1.40311
1.40299
1.40285
1.40268
1.40249
1.40229
1.40208
1.40186
1.40165
1.40145
1.40126
1.40108
1.40091
1.40077
1.40064
1.40052
1.40043
1.40034
1.40027
1.40022
1.40017
1.40013
1.4001
1.40007
1.40005
1.40004
1.40003
1.40002
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40002
1.40005
1.40009
1.40015
1.40023
1.40034
1.40048
1.40064
1.40084
1.40107
1.40133
1.40161
1.40192
1.40224
1.40257
1.4029
1.40322
1.40352
1.4038
1.40404
1.40424
1.4044
1.4045
1.40454
1.40454
1.40447
1.40436
1.4042
1.40399
1.40375
1.40348
1.4032
1.4029
1.4026
1.4023
1.40201
1.40174
1.40149
1.40126
1.40105
1.40087
1.40071
1.40057
1.40046
1.40036
1.40028
1.40022
1.40016
1.40012
1.40009
1.40006
1.40004
1.40003
1.40002
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40002
1.40004
1.40007
1.40012
1.40018
1.40028
1.40041
1.40057
1.40077
1.40101
1.4013
1.40163
1.40199
1.40239
1.40281
1.40325
1.4037
1.40415
1.40458
1.40498
1.40535
1.40567
1.40593
1.40613
1.40625
1.40631
1.40629
1.4062
1.40604
1.40581
1.40553
1.40519
1.40482
1.40443
1.40401
1.40359
1.40318
1.40278
1.4024
1.40205
1.40173
1.40144
1.40118
1.40096
1.40078
1.40062
1.40048
1.40037
1.40029
1.40021
1.40016
1.40011
1.40008
1.40005
1.40004
1.40002
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40005
1.40009
1.40014
1.40022
1.40033
1.40047
1.40066
1.4009
1.40119
1.40154
1.40194
1.4024
1.4029
1.40345
1.40402
1.40462
1.40522
1.40581
1.40638
1.40691
1.40739
1.4078
1.40814
1.40839
1.40855
1.40862
1.40859
1.40846
1.40824
1.40793
1.40755
1.4071
1.4066
1.40607
1.40551
1.40493
1.40437
1.40382
1.4033
1.40281
1.40237
1.40197
1.40162
1.40131
1.40105
1.40083
1.40065
1.4005
1.40038
1.40028
1.40021
1.40015
1.4001
1.40007
1.40004
1.40003
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40011
1.40016
1.40025
1.40037
1.40054
1.40075
1.40103
1.40137
1.40179
1.40227
1.40283
1.40345
1.40413
1.40487
1.40564
1.40643
1.40722
1.40799
1.40873
1.40941
1.41003
1.41056
1.41098
1.4113
1.4115
1.41158
1.41153
1.41136
1.41107
1.41067
1.41017
1.40958
1.40892
1.40821
1.40747
1.40671
1.40595
1.40521
1.4045
1.40384
1.40324
1.40269
1.40221
1.40179
1.40143
1.40113
1.40088
1.40067
1.40051
1.40038
1.40027
1.40019
1.40013
1.40009
1.40006
1.40003
1.40002
1.40001
1.4
1.4
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40019
1.40028
1.40041
1.40059
1.40083
1.40115
1.40154
1.40202
1.40259
1.40326
1.40402
1.40486
1.40577
1.40674
1.40774
1.40877
1.40979
1.41078
1.41172
1.41258
1.41335
1.41401
1.41454
1.41493
1.41518
1.41527
1.41521
1.41499
1.41462
1.41411
1.41348
1.41273
1.41189
1.41097
1.41
1.40901
1.40801
1.40703
1.40609
1.40521
1.4044
1.40366
1.40301
1.40244
1.40195
1.40153
1.40119
1.40091
1.40069
1.40051
1.40037
1.40026
1.40018
1.40012
1.40007
1.40004
1.40002
1.40001
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4003
1.40044
1.40064
1.4009
1.40125
1.40169
1.40224
1.4029
1.40368
1.40457
1.40558
1.40669
1.40789
1.40914
1.41043
1.41174
1.41302
1.41426
1.41543
1.41649
1.41743
1.41823
1.41888
1.41935
1.41964
1.41975
1.41967
1.4194
1.41896
1.41834
1.41756
1.41663
1.41558
1.41443
1.41321
1.41194
1.41065
1.40938
1.40816
1.407
1.40592
1.40494
1.40406
1.4033
1.40264
1.40208
1.40161
1.40123
1.40093
1.40069
1.4005
1.40035
1.40024
1.40016
1.4001
1.40006
1.40003
1.40001
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40046
1.40067
1.40095
1.40133
1.40181
1.40242
1.40317
1.40407
1.40511
1.40629
1.40761
1.40905
1.41058
1.41217
1.41379
1.41541
1.41699
1.4185
1.4199
1.42117
1.42229
1.42323
1.42398
1.42453
1.42487
1.425
1.4249
1.4246
1.42408
1.42335
1.42243
1.42132
1.42006
1.41866
1.41716
1.41558
1.41397
1.41236
1.41079
1.40929
1.40789
1.40661
1.40545
1.40443
1.40355
1.40281
1.40218
1.40167
1.40126
1.40093
1.40067
1.40047
1.40033
1.40022
1.40014
1.40008
1.40004
1.40001
1.4
1.39999
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40069
1.40098
1.40138
1.40191
1.40257
1.4034
1.40441
1.40559
1.40696
1.4085
1.41019
1.41201
1.41392
1.41589
1.41787
1.41983
1.42171
1.42348
1.42511
1.42657
1.42785
1.42891
1.42975
1.43036
1.43074
1.43089
1.43079
1.43045
1.42987
1.42906
1.42802
1.42676
1.4253
1.42367
1.42188
1.41999
1.41803
1.41604
1.41408
1.41219
1.4104
1.40874
1.40724
1.40591
1.40475
1.40376
1.40293
1.40225
1.4017
1.40125
1.40091
1.40064
1.40044
1.40029
1.40019
1.40011
1.40006
1.40002
1.4
1.39999
1.39998
1.39998
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.401
1.40141
1.40196
1.40268
1.40358
1.40468
1.406
1.40755
1.40931
1.41127
1.41339
1.41564
1.41798
1.42034
1.42269
1.42496
1.42712
1.42913
1.43094
1.43255
1.43392
1.43506
1.43595
1.4366
1.437
1.43715
1.43706
1.43671
1.43611
1.43526
1.43415
1.43279
1.43119
1.42937
1.42734
1.42515
1.42285
1.42047
1.41809
1.41575
1.41352
1.41143
1.40952
1.4078
1.4063
1.40501
1.40392
1.40301
1.40228
1.40169
1.40123
1.40087
1.4006
1.4004
1.40026
1.40015
1.40008
1.40004
1.40001
1.39999
1.39998
1.39997
1.39997
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.40141
1.40198
1.40273
1.40369
1.40488
1.40633
1.40804
1.41002
1.41223
1.41467
1.41727
1.41998
1.42274
1.42549
1.42817
1.43071
1.43308
1.43523
1.43714
1.43879
1.44019
1.44132
1.4422
1.44283
1.44321
1.44336
1.44328
1.44295
1.44238
1.44156
1.44047
1.43911
1.43747
1.43555
1.43338
1.43097
1.42837
1.42563
1.42284
1.42004
1.41732
1.41474
1.41235
1.41019
1.40827
1.4066
1.40518
1.40401
1.40304
1.40226
1.40165
1.40118
1.40082
1.40055
1.40036
1.40022
1.40012
1.40006
1.40001
1.39999
1.39998
1.39997
1.39997
1.39997
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.40196
1.40273
1.40372
1.40499
1.40654
1.40841
1.41058
1.41306
1.41579
1.41874
1.42184
1.425
1.42815
1.43122
1.43413
1.43683
1.43927
1.44143
1.44329
1.44486
1.44614
1.44716
1.44793
1.44847
1.4488
1.44893
1.44886
1.4486
1.44812
1.44741
1.44646
1.44523
1.4437
1.44185
1.43967
1.43718
1.43441
1.43142
1.42826
1.42504
1.42183
1.41873
1.41581
1.41313
1.41072
1.40861
1.4068
1.40528
1.40402
1.40301
1.40221
1.40159
1.40111
1.40076
1.40049
1.40031
1.40018
1.40009
1.40003
1.4
1.39998
1.39997
1.39996
1.39997
1.39997
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.40267
1.40369
1.405
1.40664
1.40863
1.41099
1.4137
1.41673
1.42001
1.42348
1.42704
1.43059
1.43403
1.43728
1.44027
1.44293
1.44526
1.44723
1.44886
1.45017
1.45119
1.45195
1.4525
1.45287
1.45309
1.45317
1.45313
1.45296
1.45264
1.45216
1.45146
1.45052
1.44929
1.44771
1.44575
1.4434
1.44067
1.43758
1.43421
1.43065
1.42701
1.4234
1.41993
1.41668
1.41372
1.41109
1.40881
1.40688
1.40527
1.40397
1.40293
1.40212
1.40149
1.40102
1.40068
1.40043
1.40025
1.40013
1.40006
1.40001
1.39998
1.39996
1.39996
1.39996
1.39996
1.39997
1.39997
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.40359
1.40492
1.40662
1.4087
1.41121
1.41413
1.41743
1.42104
1.42487
1.42882
1.43275
1.43654
1.44009
1.44331
1.44613
1.44853
1.45049
1.45204
1.45322
1.45407
1.45465
1.45503
1.45525
1.45536
1.45541
1.45542
1.4554
1.45535
1.45526
1.45509
1.45479
1.4543
1.45356
1.45249
1.45102
1.44908
1.44665
1.44374
1.44038
1.43667
1.43273
1.42868
1.42469
1.42086
1.41731
1.4141
1.41128
1.40887
1.40684
1.40518
1.40385
1.4028
1.40199
1.40137
1.40092
1.40059
1.40036
1.4002
1.40009
1.40003
1.39999
1.39996
1.39995
1.39995
1.39996
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.40475
1.40647
1.40862
1.41124
1.41433
1.41787
1.42178
1.42596
1.43028
1.43457
1.43869
1.44251
1.44591
1.44881
1.45118
1.45301
1.45435
1.45524
1.45575
1.45596
1.45596
1.45583
1.45563
1.45542
1.45525
1.45516
1.45516
1.45525
1.45541
1.45562
1.45581
1.45592
1.45585
1.4555
1.45477
1.45356
1.45177
1.44936
1.44634
1.44276
1.43874
1.43443
1.43001
1.42565
1.4215
1.41768
1.41426
1.41129
1.40877
1.40669
1.405
1.40366
1.40262
1.40183
1.40124
1.40081
1.4005
1.40029
1.40015
1.40005
1.4
1.39997
1.39995
1.39995
1.39995
1.39996
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.4
1.40621
1.40838
1.41107
1.41429
1.41803
1.42221
1.42671
1.43138
1.43602
1.44045
1.44451
1.44804
1.45096
1.45322
1.45482
1.45582
1.45627
1.45629
1.45597
1.45541
1.45473
1.45401
1.45333
1.45276
1.45235
1.45214
1.45215
1.45238
1.45281
1.45342
1.45415
1.45492
1.45563
1.45618
1.45641
1.45619
1.45536
1.45383
1.45152
1.44844
1.44467
1.44036
1.43572
1.43094
1.42625
1.42182
1.41777
1.41419
1.41112
1.40854
1.40642
1.40474
1.40341
1.4024
1.40164
1.40109
1.40069
1.40041
1.40022
1.4001
1.40002
1.39997
1.39995
1.39994
1.39994
1.39995
1.39996
1.39996
1.39997
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.408
1.41071
1.41401
1.4179
1.4223
1.42709
1.43209
1.43707
1.44181
1.44608
1.44972
1.45261
1.4547
1.45599
1.45655
1.45647
1.45587
1.45488
1.45363
1.45225
1.45086
1.44954
1.44838
1.44745
1.4468
1.44647
1.44648
1.44682
1.4475
1.44849
1.44973
1.45116
1.45269
1.45418
1.4555
1.45645
1.45686
1.45653
1.45533
1.45316
1.45005
1.44611
1.44153
1.43656
1.43146
1.42648
1.42181
1.41759
1.4139
1.41076
1.40816
1.40606
1.40441
1.40313
1.40216
1.40145
1.40093
1.40057
1.40032
1.40015
1.40005
1.39999
1.39996
1.39994
1.39994
1.39994
1.39995
1.39996
1.39997
1.39997
1.39998
1.39999
1.39999
1.4
1.4
1.41017
1.41349
1.41747
1.42205
1.42709
1.4324
1.43771
1.44274
1.44723
1.45097
1.45382
1.4557
1.45664
1.4567
1.45601
1.45472
1.45299
1.45096
1.4488
1.44663
1.44456
1.4427
1.44111
1.43986
1.439
1.43855
1.43854
1.43898
1.43986
1.44116
1.44284
1.44486
1.44712
1.44952
1.45191
1.4541
1.45588
1.45699
1.45721
1.45635
1.45434
1.4512
1.44707
1.44222
1.43695
1.43156
1.42633
1.42148
1.41714
1.41339
1.41024
1.40767
1.40562
1.40402
1.4028
1.4019
1.40124
1.40077
1.40045
1.40023
1.4001
1.40001
1.39996
1.39994
1.39993
1.39994
1.39994
1.39995
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.41277
1.41677
1.42146
1.4267
1.43228
1.43791
1.44325
1.44798
1.45184
1.45465
1.45634
1.45691
1.45646
1.45514
1.45313
1.45061
1.44777
1.44479
1.4418
1.43894
1.43632
1.434
1.43207
1.43057
1.42953
1.42899
1.42896
1.42946
1.43048
1.43201
1.43403
1.4365
1.43936
1.44253
1.44586
1.4492
1.45232
1.45495
1.45678
1.45754
1.45702
1.45512
1.4519
1.44757
1.44244
1.43687
1.43123
1.4258
1.42083
1.41644
1.41269
1.40958
1.40708
1.40511
1.4036
1.40246
1.40163
1.40104
1.40062
1.40034
1.40016
1.40004
1.39998
1.39995
1.39993
1.39993
1.39994
1.39995
1.39996
1.39996
1.39997
1.39998
1.39999
1.39999
1.4
1.41581
1.42053
1.42592
1.43174
1.43767
1.44333
1.44833
1.45236
1.45518
1.4567
1.45694
1.456
1.45406
1.45133
1.44804
1.4444
1.4406
1.43681
1.43317
1.42978
1.42674
1.4241
1.42193
1.42025
1.4191
1.41849
1.41844
1.41896
1.42006
1.42173
1.42397
1.42675
1.43003
1.43376
1.43784
1.44213
1.44643
1.45048
1.45394
1.45645
1.45769
1.45742
1.45555
1.45218
1.4476
1.44218
1.43634
1.43048
1.42492
1.41989
1.41551
1.41182
1.40881
1.40642
1.40456
1.40315
1.40212
1.40137
1.40084
1.40048
1.40024
1.40009
1.4
1.39995
1.39993
1.39993
1.39993
1.39994
1.39995
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.41931
1.42475
1.43076
1.43697
1.44297
1.44829
1.45254
1.45545
1.45688
1.45685
1.45548
1.45297
1.44958
1.44556
1.44115
1.43657
1.43201
1.42761
1.4235
1.41976
1.41645
1.41363
1.41133
1.40956
1.40834
1.40769
1.40761
1.40813
1.40925
1.41098
1.41332
1.41626
1.4198
1.42388
1.42846
1.43344
1.43867
1.4439
1.44883
1.45306
1.45617
1.45777
1.45762
1.45566
1.45206
1.44717
1.44144
1.43536
1.42934
1.42372
1.41871
1.4144
1.41083
1.40796
1.40571
1.40399
1.40271
1.40177
1.40111
1.40066
1.40035
1.40016
1.40004
1.39997
1.39994
1.39992
1.39993
1.39993
1.39994
1.39995
1.39996
1.39997
1.39998
1.39999
1.39999
1.42325
1.42936
1.43581
1.44215
1.44784
1.4524
1.4555
1.45694
1.45674
1.45503
1.45204
1.44805
1.44336
1.43824
1.43294
1.42766
1.42256
1.41777
1.41338
1.40946
1.40604
1.40315
1.40081
1.39901
1.39778
1.39711
1.39701
1.39749
1.39858
1.40029
1.40263
1.40562
1.40925
1.41351
1.41837
1.42378
1.42963
1.43576
1.44187
1.44761
1.45249
1.45604
1.45784
1.45765
1.45546
1.45153
1.44628
1.44025
1.43396
1.42785
1.42224
1.41731
1.41315
1.40975
1.40706
1.40498
1.40342
1.40227
1.40145
1.40088
1.40049
1.40024
1.40008
1.39999
1.39995
1.39992
1.39992
1.39993
1.39994
1.39995
1.39996
1.39997
1.39998
1.39999
1.39999
1.42756
1.4342
1.44086
1.44696
1.45193
1.45532
1.45692
1.45667
1.45474
1.45137
1.44688
1.4416
1.43584
1.42988
1.42393
1.41818
1.41277
1.40779
1.40331
1.39936
1.39595
1.3931
1.39079
1.38903
1.38781
1.38713
1.387
1.38743
1.38844
1.39006
1.39232
1.39524
1.39884
1.40312
1.40808
1.4137
1.41991
1.42661
1.43358
1.44051
1.44694
1.45233
1.45613
1.45792
1.4575
1.45493
1.45056
1.44493
1.43862
1.43218
1.42605
1.42052
1.41576
1.4118
1.40863
1.40614
1.40426
1.40286
1.40186
1.40115
1.40067
1.40035
1.40015
1.40003
1.39996
1.39993
1.39992
1.39992
1.39993
1.39994
1.39995
1.39997
1.39997
1.39998
1.39999
1.43214
1.43909
1.44562
1.45108
1.45491
1.4568
1.45668
1.45467
1.45105
1.44617
1.44039
1.43407
1.4275
1.42094
1.41459
1.4086
1.40308
1.39808
1.39365
1.3898
1.38652
1.38378
1.38158
1.3799
1.37871
1.37803
1.37785
1.3782
1.37909
1.38056
1.38266
1.38542
1.38888
1.39305
1.39797
1.40362
1.40998
1.41698
1.42449
1.43227
1.43992
1.4469
1.45259
1.45643
1.45798
1.45711
1.45402
1.44915
1.44312
1.43657
1.43006
1.424
1.41864
1.41411
1.41041
1.40749
1.40524
1.40356
1.40234
1.40148
1.40088
1.40048
1.40023
1.40007
1.39998
1.39994
1.39992
1.39992
1.39993
1.39994
1.39995
1.39996
1.39997
1.39998
1.39999
1.43682
1.44378
1.4498
1.4542
1.45656
1.45673
1.45482
1.4511
1.44596
1.43979
1.43298
1.42587
1.41875
1.41183
1.4053
1.39927
1.39381
1.38895
1.38471
1.38106
1.37798
1.37544
1.37339
1.37182
1.37069
1.37
1.36977
1.37
1.37072
1.37199
1.37385
1.37637
1.37958
1.38354
1.38829
1.39383
1.40017
1.40727
1.41506
1.42337
1.43188
1.44013
1.44748
1.45326
1.45686
1.45792
1.45643
1.45269
1.44728
1.44088
1.43416
1.42767
1.42176
1.41665
1.41241
1.40901
1.40637
1.40438
1.40292
1.40187
1.40114
1.40065
1.40033
1.40013
1.40001
1.39995
1.39992
1.39992
1.39992
1.39993
1.39994
1.39996
1.39997
1.39998
1.39998
1.44142
1.44802
1.45311
1.45612
1.45678
1.45516
1.45152
1.44626
1.43982
1.43261
1.42503
1.41738
1.40994
1.40288
1.39636
1.39045
1.3852
1.38061
1.37667
1.37332
1.37052
1.36823
1.36638
1.36495
1.36389
1.36321
1.3629
1.36299
1.36352
1.36452
1.36608
1.36826
1.37113
1.37477
1.37922
1.38453
1.39071
1.39775
1.40562
1.4142
1.42327
1.43244
1.44113
1.44863
1.45421
1.45729
1.45763
1.45534
1.45088
1.44493
1.43824
1.43145
1.42507
1.41941
1.41462
1.41072
1.40766
1.40532
1.40358
1.40233
1.40145
1.40085
1.40045
1.4002
1.40005
1.39997
1.39993
1.39992
1.39992
1.39993
1.39994
1.39995
1.39996
1.39997
1.39998
1.44569
1.45155
1.45537
1.45674
1.45562
1.45226
1.44705
1.44047
1.43297
1.42498
1.41686
1.40891
1.40135
1.39434
1.38799
1.38236
1.37745
1.37324
1.36969
1.36672
1.36428
1.36228
1.36067
1.35941
1.35845
1.35777
1.35739
1.35733
1.35762
1.35832
1.35951
1.36127
1.3637
1.36689
1.37093
1.37587
1.38176
1.38861
1.39639
1.40504
1.41442
1.4242
1.43391
1.44284
1.45021
1.45529
1.45758
1.45698
1.45377
1.44857
1.44214
1.43525
1.4285
1.42234
1.41702
1.41261
1.40909
1.40638
1.40434
1.40286
1.40181
1.40109
1.4006
1.4003
1.40011
1.4
1.39994
1.39992
1.39992
1.39992
1.39994
1.39995
1.39996
1.39997
1.39998
1.44942
1.45418
1.45646
1.45608
1.45322
1.44826
1.4417
1.43403
1.42572
1.41718
1.40874
1.40068
1.39318
1.38638
1.38036
1.37514
1.37069
1.36696
1.36389
1.36137
1.35933
1.35768
1.35635
1.35527
1.35442
1.35377
1.35332
1.3531
1.35315
1.35352
1.3543
1.35558
1.35748
1.36012
1.3636
1.36804
1.37349
1.38
1.38755
1.39611
1.40557
1.41572
1.42613
1.4362
1.44511
1.45204
1.4563
1.45753
1.45583
1.45165
1.44575
1.43895
1.43198
1.42541
1.41958
1.41466
1.41067
1.40756
1.4052
1.40346
1.40222
1.40136
1.40078
1.40041
1.40017
1.40004
1.39996
1.39993
1.39992
1.39992
1.39993
1.39994
1.39996
1.39997
1.39998
1.45241
1.45579
1.45639
1.45428
1.4498
1.44344
1.43575
1.42722
1.41832
1.40943
1.40087
1.39287
1.38561
1.37917
1.37361
1.36891
1.36502
1.36186
1.35933
1.35732
1.35573
1.35445
1.35341
1.35254
1.3518
1.35118
1.35068
1.35031
1.35012
1.35017
1.35053
1.35131
1.35262
1.35461
1.35743
1.36122
1.36608
1.37208
1.37924
1.38756
1.39694
1.40723
1.41809
1.42899
1.43917
1.44774
1.45388
1.45701
1.45697
1.45407
1.44895
1.44246
1.43543
1.42854
1.42226
1.41685
1.41239
1.40886
1.40615
1.40414
1.4027
1.40168
1.40099
1.40054
1.40025
1.40008
1.39999
1.39994
1.39992
1.39992
1.39993
1.39994
1.39995
1.39997
1.39998
1.45454
1.45636
1.45527
1.45151
1.44559
1.43804
1.42943
1.42026
1.41097
1.40192
1.3934
1.38563
1.37874
1.3728
1.36781
1.36374
1.3605
1.35797
1.35604
1.35456
1.35341
1.35249
1.35171
1.35102
1.35038
1.34979
1.34924
1.34877
1.34839
1.34816
1.34815
1.34844
1.34917
1.35049
1.35257
1.35559
1.35971
1.36504
1.37165
1.37954
1.38867
1.39891
1.41
1.42147
1.43263
1.44261
1.45048
1.45547
1.4572
1.45575
1.45164
1.44569
1.43877
1.43169
1.42503
1.41915
1.41423
1.41027
1.4072
1.4049
1.40323
1.40204
1.40123
1.40069
1.40035
1.40014
1.40002
1.39995
1.39993
1.39992
1.39993
1.39994
1.39995
1.39996
1.39997
1.45577
1.45596
1.45322
1.44798
1.4408
1.43227
1.42295
1.41332
1.40382
1.39478
1.38647
1.37907
1.37269
1.36735
1.36305
1.35968
1.35714
1.35528
1.35393
1.35295
1.35218
1.35153
1.35093
1.35033
1.34973
1.34913
1.34856
1.34802
1.34754
1.34715
1.34688
1.34681
1.34704
1.34772
1.34905
1.35125
1.35452
1.35903
1.36492
1.37222
1.38093
1.39094
1.40204
1.41385
1.42574
1.43687
1.44626
1.45302
1.45653
1.45666
1.45375
1.44854
1.44192
1.43478
1.42783
1.42154
1.41617
1.41178
1.40834
1.40573
1.40381
1.40245
1.4015
1.40087
1.40046
1.4002
1.40005
1.39997
1.39994
1.39993
1.39993
1.39994
1.39995
1.39996
1.39997
1.45613
1.4547
1.45044
1.44388
1.43564
1.42632
1.41646
1.40655
1.397
1.38812
1.38016
1.37326
1.3675
1.36287
1.35932
1.35672
1.35489
1.35366
1.35283
1.3522
1.35165
1.35108
1.35046
1.3498
1.34911
1.34846
1.34787
1.34735
1.34691
1.34653
1.34622
1.34599
1.34591
1.34611
1.3468
1.34819
1.35057
1.35418
1.3592
1.36575
1.37385
1.38345
1.39437
1.4063
1.41868
1.43071
1.44141
1.44978
1.45504
1.45681
1.45524
1.45095
1.44481
1.43776
1.43063
1.42398
1.41819
1.41338
1.40956
1.40663
1.40446
1.40289
1.4018
1.40106
1.40058
1.40028
1.4001
1.4
1.39995
1.39993
1.39993
1.39994
1.39995
1.39996
1.39997
1.45569
1.45273
1.4471
1.4394
1.43027
1.42032
1.4101
1.40006
1.39061
1.38203
1.37454
1.36825
1.36321
1.35937
1.35662
1.35477
1.35361
1.35288
1.35235
1.35183
1.35119
1.35038
1.34945
1.34846
1.34753
1.34674
1.34615
1.34578
1.34558
1.34549
1.34543
1.34537
1.34529
1.34529
1.34554
1.34628
1.34783
1.3505
1.35457
1.36022
1.36756
1.37658
1.38714
1.39899
1.41163
1.42432
1.4361
1.44592
1.45282
1.45624
1.45611
1.45289
1.44739
1.44058
1.43336
1.42644
1.42026
1.41505
1.41085
1.40759
1.40515
1.40338
1.40214
1.40129
1.40072
1.40037
1.40015
1.40003
1.39997
1.39994
1.39993
1.39994
1.39995
1.39996
1.39997
1.45456
1.45019
1.44334
1.43467
1.42482
1.41441
1.40397
1.39395
1.38473
1.37657
1.36965
1.36407
1.35982
1.35681
1.35484
1.35368
1.35302
1.35254
1.35197
1.35113
1.34993
1.34843
1.34677
1.34515
1.34375
1.34274
1.34221
1.34215
1.34248
1.34305
1.34367
1.34421
1.34457
1.34476
1.3449
1.34524
1.34613
1.34794
1.35103
1.35572
1.36216
1.37044
1.38047
1.39205
1.40474
1.41787
1.43051
1.44156
1.44999
1.45501
1.45637
1.45432
1.4496
1.44317
1.43599
1.42887
1.42236
1.41676
1.41219
1.40861
1.40589
1.40391
1.4025
1.40153
1.40088
1.40047
1.40021
1.40006
1.39999
1.39995
1.39994
1.39994
1.39995
1.39996
1.39997
1.45288
1.44723
1.43931
1.42982
1.41941
1.40868
1.39816
1.38828
1.3794
1.37176
1.36552
1.36071
1.35729
1.35509
1.35384
1.35319
1.35273
1.35208
1.35095
1.3492
1.34684
1.34407
1.34119
1.33853
1.33643
1.33513
1.33473
1.33523
1.33646
1.33814
1.33998
1.34168
1.34302
1.34392
1.34441
1.34473
1.34522
1.34633
1.34853
1.35222
1.35769
1.3651
1.37445
1.38559
1.39814
1.4115
1.42477
1.43687
1.44666
1.45321
1.45606
1.45527
1.45144
1.44551
1.43848
1.43124
1.42445
1.41851
1.41358
1.40966
1.40667
1.40447
1.40289
1.40179
1.40106
1.40058
1.40028
1.40011
1.40001
1.39996
1.39994
1.39994
1.39995
1.39996
1.39997
1.45075
1.44396
1.43513
1.42497
1.41413
1.40321
1.39273
1.3831
1.37465
1.36762
1.36212
1.35814
1.35554
1.35409
1.35338
1.35293
1.35223
1.35082
1.34844
1.34503
1.34077
1.33605
1.33136
1.32725
1.32417
1.32249
1.32234
1.32369
1.32627
1.32966
1.33337
1.33691
1.33991
1.34214
1.34356
1.34433
1.34481
1.34548
1.34693
1.34968
1.35415
1.3606
1.36915
1.37969
1.39193
1.40532
1.41903
1.43197
1.44295
1.45093
1.45523
1.45573
1.45289
1.44757
1.44079
1.43353
1.42652
1.42026
1.41499
1.41076
1.40749
1.40506
1.4033
1.40207
1.40124
1.4007
1.40036
1.40015
1.40004
1.39998
1.39995
1.39994
1.39995
1.39996
1.39997
1.4483
1.44051
1.4309
1.42019
1.40905
1.39806
1.38771
1.37842
1.3705
1.36415
1.35943
1.35627
1.35445
1.35359
1.35313
1.35244
1.35089
1.34799
1.34353
1.3376
1.33059
1.32313
1.31599
1.30992
1.30557
1.30341
1.30365
1.30619
1.31067
1.31646
1.32283
1.32903
1.33448
1.33878
1.34179
1.3436
1.34454
1.34514
1.34607
1.348
1.35149
1.35695
1.36459
1.37441
1.3862
1.39945
1.4134
1.42699
1.439
1.44826
1.45395
1.45575
1.45396
1.44934
1.44291
1.43569
1.42853
1.422
1.41641
1.41187
1.40833
1.40567
1.40373
1.40237
1.40145
1.40083
1.40044
1.4002
1.40007
1.39999
1.39996
1.39995
1.39995
1.39996
1.39997
1.44563
1.43696
1.4267
1.41557
1.40423
1.39326
1.38314
1.37427
1.36693
1.3613
1.35738
1.35501
1.35384
1.35332
1.35272
1.35122
1.34808
1.34283
1.33534
1.32591
1.3152
1.30415
1.29383
1.28527
1.27933
1.2766
1.27734
1.28146
1.28844
1.29743
1.30738
1.31721
1.32603
1.33324
1.33859
1.34208
1.34404
1.34501
1.34574
1.34704
1.34964
1.3541
1.36079
1.3698
1.38099
1.39396
1.40798
1.42204
1.43489
1.44531
1.4523
1.45537
1.45466
1.45081
1.44481
1.43772
1.43047
1.42371
1.41783
1.41299
1.40918
1.4063
1.40418
1.40269
1.40166
1.40097
1.40053
1.40026
1.4001
1.40002
1.39997
1.39996
1.39995
1.39996
1.39997
1.44282
1.4334
1.42261
1.41116
1.39972
1.38885
1.37903
1.37064
1.36393
1.35903
1.35589
1.35423
1.35352
1.35301
1.35174
1.34875
1.3432
1.33464
1.32309
1.30911
1.29368
1.27813
1.2639
1.2523
1.24442
1.241
1.24236
1.24839
1.25849
1.27155
1.28612
1.30068
1.31393
1.32501
1.3335
1.33938
1.34295
1.3448
1.34572
1.34665
1.3485
1.35202
1.35772
1.36585
1.37636
1.38891
1.40285
1.4172
1.43074
1.44216
1.45035
1.45465
1.45502
1.45198
1.44648
1.43959
1.4323
1.42536
1.41923
1.41411
1.41004
1.40693
1.40464
1.40301
1.40188
1.40112
1.40063
1.40032
1.40014
1.40004
1.39999
1.39996
1.39996
1.39996
1.39997
1.43995
1.42989
1.41867
1.407
1.39553
1.38483
1.37537
1.3675
1.36144
1.35728
1.35487
1.35377
1.35326
1.35233
1.34982
1.34459
1.33574
1.32287
1.30618
1.28654
1.26537
1.24445
1.22561
1.21048
1.20035
1.19608
1.1981
1.20632
1.22007
1.23801
1.25827
1.27878
1.29767
1.31368
1.32621
1.3352
1.34099
1.34422
1.34575
1.34663
1.34794
1.35062
1.35536
1.36256
1.3723
1.38433
1.39806
1.41257
1.42663
1.43891
1.44818
1.45364
1.45507
1.45287
1.44792
1.44129
1.43403
1.42695
1.42058
1.41521
1.4109
1.40757
1.40511
1.40334
1.4021
1.40127
1.40073
1.40039
1.40018
1.40006
1.4
1.39997
1.39996
1.39996
1.39997
1.4371
1.42649
1.41494
1.40313
1.39169
1.38121
1.37215
1.36482
1.35942
1.35596
1.35419
1.35347
1.35283
1.35102
1.34664
1.3384
1.32535
1.30715
1.28424
1.25791
1.23007
1.20304
1.17903
1.15997
1.14731
1.14203
1.14467
1.15522
1.17297
1.19644
1.22333
1.25096
1.27678
1.29892
1.31648
1.32935
1.33797
1.34307
1.34563
1.3468
1.34781
1.34979
1.35363
1.3599
1.36882
1.38024
1.39365
1.40818
1.42263
1.43563
1.44587
1.45241
1.45487
1.45351
1.44914
1.44282
1.43562
1.42844
1.42189
1.41628
1.41174
1.40821
1.40557
1.40367
1.40233
1.40143
1.40083
1.40045
1.40022
1.40009
1.40002
1.39998
1.39997
1.39997
1.39997
1.43432
1.42325
1.41144
1.39956
1.38821
1.37798
1.36934
1.36257
1.3578
1.35499
1.35373
1.35317
1.35205
1.34885
1.34199
1.32999
1.31187
1.28739
1.25729
1.22337
1.18816
1.15449
1.12495
1.10169
1.08631
1.07991
1.0831
1.09598
1.11788
1.14721
1.18138
1.21708
1.25098
1.28047
1.30413
1.32171
1.33377
1.34122
1.34521
1.347
1.34797
1.34942
1.35245
1.35782
1.3659
1.37665
1.38966
1.4041
1.41881
1.4324
1.44349
1.45101
1.45444
1.45392
1.45015
1.44417
1.43708
1.42985
1.42313
1.41731
1.41255
1.40883
1.40603
1.404
1.40256
1.40158
1.40094
1.40052
1.40027
1.40012
1.40004
1.4
1.39998
1.39997
1.39997
1.43166
1.42021
1.40821
1.3963
1.38508
1.37513
1.36692
1.3607
1.35653
1.35428
1.35339
1.35273
1.35076
1.3457
1.33576
1.31935
1.2954
1.26383
1.22578
1.18367
1.14067
1.1001
1.06488
1.03736
1.01924
1.01168
1.01539
1.03053
1.05651
1.09171
1.13333
1.17761
1.22042
1.25829
1.28908
1.31223
1.32836
1.33862
1.34438
1.3471
1.34828
1.3494
1.35174
1.35626
1.3635
1.37355
1.38609
1.40035
1.41521
1.42926
1.44109
1.4495
1.45385
1.45413
1.45096
1.44534
1.4384
1.43114
1.42429
1.41829
1.41334
1.40943
1.40648
1.40432
1.40279
1.40174
1.40104
1.4006
1.40032
1.40015
1.40006
1.40001
1.39999
1.39998
1.39998
1.42915
1.41738
1.40524
1.39336
1.3823
1.37263
1.36485
1.35916
1.35553
1.35374
1.35304
1.35205
1.34889
1.34154
1.32803
1.30664
1.27629
1.23708
1.19064
1.14008
1.0892
1.04177
1.00099
0.969371
0.94868
0.9401
0.944355
0.961664
0.991496
1.03225
1.08105
1.13382
1.18584
1.23271
1.27145
1.30095
1.32175
1.33524
1.34311
1.34701
1.34864
1.34961
1.35141
1.35516
1.36159
1.37093
1.38294
1.39695
1.41186
1.42628
1.43873
1.44794
1.45313
1.45417
1.45159
1.44635
1.43958
1.43232
1.42537
1.41921
1.41408
1.41001
1.40691
1.40463
1.40301
1.4019
1.40115
1.40067
1.40036
1.40018
1.40008
1.40002
1.39999
1.39998
1.39998
1.42684
1.41481
1.40256
1.39075
1.37985
1.37046
1.36308
1.35789
1.35475
1.35329
1.35262
1.35108
1.34644
1.33645
1.31898
1.29226
1.25518
1.2081
1.15322
1.09433
1.03582
0.981842
0.935872
0.900559
0.877699
0.868397
0.873319
0.892678
0.925991
0.971719
1.027
1.08767
1.14858
1.20455
1.25165
1.28806
1.31404
1.33115
1.34137
1.34669
1.34896
1.34997
1.35136
1.35444
1.36011
1.36874
1.38021
1.39392
1.40881
1.4235
1.43647
1.44637
1.45232
1.45407
1.45206
1.4472
1.44061
1.43338
1.42635
1.42006
1.41477
1.41054
1.40731
1.40493
1.40322
1.40204
1.40125
1.40074
1.40041
1.40021
1.4001
1.40004
1.4
1.39999
1.39999
1.42474
1.4125
1.40016
1.38844
1.37774
1.36859
1.36158
1.35685
1.35412
1.35287
1.35208
1.34981
1.34348
1.33059
1.30895
1.27674
1.23293
1.17814
1.11517
1.04843
0.982824
0.922866
0.872312
0.833956
0.809531
0.799945
0.805697
0.826944
0.863241
0.913154
0.973945
1.04148
1.11041
1.175
1.23042
1.27398
1.30546
1.32645
1.33923
1.34611
1.34918
1.35039
1.35151
1.35403
1.359
1.36695
1.37788
1.39125
1.40606
1.42094
1.43434
1.44484
1.45147
1.45387
1.45239
1.44789
1.4415
1.43432
1.42723
1.42082
1.4154
1.41104
1.40769
1.4052
1.40342
1.40219
1.40135
1.40081
1.40046
1.40025
1.40012
1.40005
1.40001
1.4
1.39999
1.42286
1.41047
1.39806
1.38643
1.37595
1.36702
1.3603
1.35599
1.35361
1.35245
1.35139
1.34826
1.34015
1.32425
1.29837
1.26076
1.21053
1.14859
1.07826
1.00448
0.932565
0.867414
0.8131
0.772529
0.747257
0.737866
0.744585
0.767466
0.806125
0.859294
0.92443
0.997543
1.07328
1.14552
1.20872
1.25927
1.29633
1.32133
1.33678
1.34531
1.34928
1.3508
1.35178
1.35385
1.3582
1.36552
1.37592
1.38894
1.40363
1.41863
1.43237
1.44339
1.45062
1.4536
1.45261
1.44846
1.44226
1.43514
1.42801
1.42151
1.41597
1.41149
1.40803
1.40546
1.40361
1.40232
1.40144
1.40087
1.4005
1.40028
1.40014
1.40007
1.40002
1.4
1.4
1.42122
1.40873
1.39626
1.3847
1.37444
1.36573
1.35922
1.35524
1.35317
1.35202
1.35056
1.34652
1.33662
1.31778
1.28777
1.24506
1.189
1.12081
1.04418
0.96444
0.887235
0.817854
0.760727
0.718815
0.693375
0.684555
0.692252
0.716401
0.75672
0.812173
0.880472
0.957831
1.03897
1.11761
1.18764
1.24465
1.28707
1.31602
1.33413
1.34433
1.34925
1.35118
1.35212
1.35384
1.35766
1.36442
1.37431
1.38698
1.40152
1.41658
1.4306
1.44205
1.44979
1.45329
1.45273
1.4489
1.44289
1.43583
1.42868
1.42211
1.41647
1.41189
1.40834
1.40569
1.40378
1.40244
1.40153
1.40093
1.40055
1.40031
1.40016
1.40008
1.40004
1.40001
1.4
1.41981
1.40729
1.39477
1.38323
1.37318
1.36469
1.35833
1.35458
1.35278
1.35158
1.34962
1.34465
1.33313
1.31155
1.27769
1.23035
1.16926
1.09597
1.01438
0.929972
0.848652
0.776107
0.717096
0.674555
0.649373
0.641243
0.649747
0.674743
0.716066
0.772934
0.84334
0.923718
1.00891
1.09258
1.16827
1.2309
1.27818
1.31082
1.33145
1.34326
1.34912
1.35148
1.35247
1.35394
1.35733
1.36358
1.37302
1.38536
1.39973
1.41482
1.42905
1.44085
1.44902
1.45296
1.45278
1.44923
1.44339
1.4364
1.42924
1.42261
1.41689
1.41223
1.4086
1.40589
1.40392
1.40255
1.40161
1.40099
1.40059
1.40034
1.40018
1.4001
1.40005
1.40002
1.40001
1.41864
1.40613
1.39361
1.38204
1.37215
1.36391
1.35762
1.35397
1.35239
1.35117
1.34866
1.34277
1.32985
1.30597
1.26871
1.21731
1.15208
1.07492
0.989818
0.902181
0.818039
0.743399
0.683266
0.640496
0.615637
0.608024
0.617038
0.642498
0.684337
0.741981
0.813672
0.896045
0.984071
1.07145
1.15152
1.21873
1.27015
1.30603
1.32892
1.34217
1.34889
1.3517
1.3528
1.3541
1.35715
1.36299
1.37202
1.38405
1.39826
1.41335
1.42773
1.43981
1.44833
1.45263
1.45278
1.44947
1.44377
1.43685
1.42969
1.42301
1.41724
1.41251
1.40882
1.40606
1.40405
1.40264
1.40168
1.40104
1.40062
1.40036
1.4002
1.40011
1.40006
1.40003
1.40001
1.41771
1.40522
1.39276
1.38115
1.37132
1.36332
1.35712
1.35341
1.35196
1.35079
1.34778
1.34097
1.32695
1.30135
1.26138
1.20657
1.13802
1.05814
0.970906
0.881489
0.795841
0.720111
0.659423
0.616543
0.591812
0.58439
0.593589
0.619234
0.661308
0.719342
0.791739
0.875296
0.965108
1.05495
1.13812
1.20876
1.26342
1.30194
1.3267
1.34116
1.34863
1.35184
1.35308
1.35429
1.35709
1.36259
1.37129
1.38306
1.39711
1.41218
1.42666
1.43895
1.44774
1.45233
1.45273
1.44961
1.44404
1.43717
1.43002
1.42332
1.4175
1.41273
1.409
1.40619
1.40415
1.40272
1.40174
1.40108
1.40066
1.40039
1.40022
1.40012
1.40007
1.40004
1.40002
1.41707
1.40455
1.39221
1.38058
1.37069
1.36287
1.35682
1.35295
1.35145
1.35041
1.34709
1.33943
1.32453
1.29792
1.25615
1.19877
1.12761
1.04586
0.957584
0.867643
0.781711
0.705833
0.64508
0.602154
0.577346
0.569824
0.578948
0.604588
0.646736
0.704926
0.777626
0.861724
0.952419
1.0436
1.12861
1.20147
1.25839
1.29881
1.32496
1.34032
1.34836
1.35191
1.3533
1.35449
1.35712
1.36236
1.3708
1.38235
1.39627
1.4113
1.42585
1.43829
1.44727
1.45206
1.45265
1.44968
1.4442
1.43738
1.43024
1.42353
1.41768
1.41288
1.40912
1.40629
1.40423
1.40278
1.40178
1.40112
1.40068
1.40041
1.40024
1.40014
1.40008
1.40004
1.40002
1.41675
1.40413
1.3919
1.38034
1.37031
1.36254
1.35668
1.35265
1.3509
1.34998
1.34664
1.33833
1.3227
1.2957
1.25328
1.19442
1.12143
1.03835
0.949657
0.860041
0.774805
0.699662
0.639434
0.59673
0.571864
0.564121
0.573004
0.598488
0.640559
0.698696
0.77134
0.855412
0.946179
1.03765
1.12332
1.1972
1.25532
1.29684
1.32381
1.33972
1.34812
1.35193
1.35345
1.35467
1.35721
1.36229
1.37054
1.38192
1.39574
1.41073
1.42531
1.43783
1.44693
1.45185
1.45256
1.44968
1.44426
1.43748
1.43035
1.42364
1.41778
1.41297
1.40919
1.40635
1.40428
1.40282
1.40182
1.40115
1.40071
1.40043
1.40026
1.40015
1.40009
1.40005
1.40003
1.41675
1.40399
1.3918
1.38039
1.37025
1.36232
1.35661
1.35257
1.35041
1.34942
1.34637
1.33786
1.32168
1.29468
1.25269
1.1938
1.12006
1.03617
0.947318
0.85839
0.774461
0.700809
0.641841
0.599908
0.57529
0.56741
0.575989
0.601167
0.64295
0.700739
0.772907
0.856364
0.946419
1.0372
1.12238
1.19611
1.25437
1.29616
1.32334
1.33942
1.34796
1.3519
1.35355
1.35482
1.35735
1.36235
1.37049
1.38177
1.39551
1.41046
1.42504
1.43759
1.44673
1.4517
1.45245
1.44961
1.44422
1.43746
1.43035
1.42364
1.41779
1.41298
1.40921
1.40637
1.4043
1.40284
1.40184
1.40117
1.40073
1.40045
1.40027
1.40016
1.4001
1.40006
1.40003
1.41705
1.40421
1.39193
1.38065
1.37052
1.36232
1.35656
1.35262
1.35014
1.34881
1.34611
1.33802
1.32172
1.2949
1.25411
1.19671
1.12379
1.04007
0.951402
0.863278
0.780921
0.709302
0.652297
0.611768
0.587808
0.579979
0.588256
0.612956
0.654134
0.711139
0.782289
0.864477
0.953028
1.04217
1.12578
1.19823
1.2556
1.2968
1.3236
1.33943
1.34788
1.35185
1.35359
1.35496
1.35753
1.36254
1.37065
1.38188
1.39558
1.4105
1.42505
1.43756
1.44667
1.4516
1.45233
1.44947
1.44408
1.43733
1.43023
1.42355
1.41772
1.41293
1.40918
1.40636
1.4043
1.40285
1.40185
1.40118
1.40074
1.40046
1.40028
1.40017
1.4001
1.40006
1.40004
1.4176
1.40477
1.39234
1.38107
1.37106
1.36264
1.35657
1.35269
1.35012
1.34833
1.34576
1.33856
1.32295
1.29665
1.25732
1.20251
1.13224
1.05035
0.96286
0.875966
0.795423
0.726182
0.671569
0.632782
0.609667
0.601976
0.60993
0.633954
0.674122
0.729787
0.799272
0.879469
0.965708
1.0523
1.13333
1.20344
1.25892
1.29872
1.32455
1.33976
1.34789
1.35178
1.35359
1.35508
1.35778
1.36286
1.37102
1.38227
1.39595
1.41084
1.42532
1.43775
1.44675
1.45157
1.4522
1.44927
1.44384
1.43708
1.43
1.42335
1.41757
1.41282
1.4091
1.40631
1.40427
1.40284
1.40185
1.40118
1.40075
1.40047
1.40029
1.40018
1.40011
1.40007
1.40004
1.41839
1.40564
1.39311
1.3817
1.37177
1.3633
1.35681
1.35272
1.35023
1.3482
1.34546
1.33916
1.32508
1.30013
1.26251
1.2107
1.14437
1.06625
0.981704
0.897235
0.819187
0.752685
0.700534
0.663322
0.640836
0.633157
0.640709
0.663866
0.702626
0.756374
0.823508
0.900955
0.984053
1.06719
1.14468
1.21149
1.26418
1.30182
1.32613
1.34038
1.34799
1.35171
1.35357
1.35521
1.35809
1.36333
1.37161
1.38293
1.39663
1.41148
1.42587
1.43815
1.44697
1.4516
1.45206
1.44901
1.44351
1.43672
1.42966
1.42306
1.41733
1.41264
1.40897
1.40622
1.40422
1.40281
1.40183
1.40118
1.40075
1.40047
1.4003
1.40019
1.40012
1.40007
1.40005
1.41943
1.40678
1.39424
1.38263
1.3726
1.36418
1.35741
1.35283
1.35028
1.34834
1.3455
1.33977
1.32755
1.30502
1.26991
1.22132
1.15942
1.08636
1.0066
0.9263
0.852008
0.788819
0.739032
0.702946
0.680696
0.672854
0.679938
0.702091
0.739132
0.790463
0.854594
0.928525
1.00763
1.08639
1.15939
1.22199
1.27108
1.30592
1.32824
1.34122
1.34817
1.35164
1.35354
1.35537
1.35848
1.36396
1.37242
1.38387
1.39762
1.41243
1.42669
1.43876
1.44731
1.45168
1.45189
1.44867
1.44307
1.43625
1.42922
1.42267
1.41701
1.4124
1.4088
1.4061
1.40414
1.40276
1.40181
1.40117
1.40075
1.40048
1.4003
1.40019
1.40012
1.40008
1.40005
1.42075
1.40815
1.39566
1.38393
1.37366
1.36518
1.35833
1.35328
1.3503
1.3485
1.34594
1.34067
1.33005
1.31051
1.27907
1.2345
1.17732
1.10977
1.03585
0.961209
0.892019
0.832827
0.785409
0.750221
0.728095
0.720115
0.726758
0.747831
0.782921
0.831426
0.891967
0.961631
1.03587
1.10935
1.17697
1.23451
1.27928
1.31076
1.33072
1.34223
1.34839
1.3516
1.35354
1.3556
1.359
1.36477
1.37348
1.3851
1.39893
1.41369
1.42777
1.43956
1.44777
1.45178
1.4517
1.44825
1.44252
1.43567
1.42866
1.42219
1.41662
1.41209
1.40858
1.40595
1.40404
1.4027
1.40177
1.40115
1.40074
1.40048
1.4003
1.4002
1.40013
1.40008
1.40006
1.42236
1.40983
1.39734
1.38556
1.37505
1.36632
1.3594
1.3541
1.35057
1.34856
1.34647
1.34199
1.33278
1.31607
1.28895
1.24951
1.19788
1.13628
1.06869
1.0005
0.937196
0.882413
0.837547
0.803501
0.781824
0.773952
0.780217
0.800095
0.832984
0.878295
0.934727
0.999429
1.06797
1.13529
1.19672
1.2485
1.28837
1.31607
1.3334
1.34331
1.34865
1.35158
1.3536
1.35591
1.35967
1.36579
1.37481
1.38664
1.40055
1.41524
1.4291
1.44054
1.44833
1.45191
1.45146
1.44774
1.44187
1.43497
1.42801
1.42162
1.41616
1.41174
1.40831
1.40576
1.40392
1.40262
1.40173
1.40113
1.40073
1.40047
1.40031
1.4002
1.40013
1.40009
1.40006
1.42422
1.41182
1.39931
1.38745
1.37679
1.36775
1.36059
1.35515
1.35126
1.34877
1.34685
1.3434
1.33585
1.32177
1.29881
1.26503
1.21989
1.16515
1.10466
1.04349
0.986329
0.936064
0.894047
0.861637
0.840848
0.833291
0.839135
0.857592
0.887967
0.929715
0.981575
1.04072
1.10285
1.16326
1.21781
1.2633
1.29789
1.32156
1.33613
1.34439
1.34892
1.35161
1.35374
1.35637
1.36053
1.36706
1.37643
1.38851
1.40249
1.41709
1.43067
1.44167
1.44896
1.45203
1.45115
1.44713
1.44109
1.43416
1.42725
1.42096
1.41562
1.41133
1.40801
1.40555
1.40377
1.40253
1.40167
1.40109
1.40071
1.40046
1.4003
1.4002
1.40013
1.40009
1.40006
1.42627
1.41411
1.40162
1.38964
1.37882
1.36953
1.362
1.35632
1.35223
1.34938
1.34728
1.34456
1.33883
1.32756
1.30857
1.28021
1.24183
1.19477
1.14236
1.08885
1.03802
0.992447
0.953688
0.923387
0.903794
0.896628
0.901907
0.918659
0.946194
0.984047
1.03093
1.08401
1.13916
1.19212
1.23934
1.27821
1.30733
1.3269
1.33874
1.34541
1.34921
1.35172
1.35401
1.35701
1.36162
1.36862
1.37838
1.3907
1.40476
1.41921
1.43244
1.44294
1.44963
1.45213
1.45076
1.44641
1.4402
1.43324
1.42639
1.42022
1.41503
1.41087
1.40768
1.40532
1.40362
1.40242
1.40161
1.40106
1.40069
1.40046
1.4003
1.4002
1.40013
1.40009
1.40006
1.42851
1.41662
1.40427
1.39219
1.38114
1.3716
1.36375
1.35769
1.35334
1.35031
1.34803
1.34563
1.34135
1.33287
1.31789
1.29476
1.26297
1.22377
1.1798
1.13413
1.08978
1.04928
1.01432
0.986593
0.968534
0.961906
0.966518
0.98131
1.00574
1.03945
1.08106
1.12766
1.17542
1.22062
1.26034
1.29254
1.31623
1.33183
1.34109
1.34632
1.34951
1.35194
1.35447
1.35788
1.36299
1.37049
1.38066
1.39325
1.40736
1.42161
1.43441
1.44431
1.45032
1.45216
1.45027
1.44557
1.43919
1.4322
1.42544
1.41941
1.41438
1.41037
1.40731
1.40506
1.40344
1.40231
1.40154
1.40102
1.40067
1.40044
1.40029
1.4002
1.40013
1.40009
1.40006
1.43095
1.41933
1.40718
1.39512
1.38384
1.37396
1.36579
1.35938
1.35466
1.35139
1.34905
1.34686
1.34355
1.33731
1.32606
1.3081
1.28287
1.25138
1.21541
1.17708
1.13914
1.10412
1.07344
1.04878
1.03274
1.0269
1.03078
1.04342
1.06459
1.094
1.13012
1.17002
1.21019
1.24756
1.27989
1.30566
1.32421
1.33613
1.34309
1.34712
1.34986
1.35231
1.35516
1.35904
1.36469
1.37271
1.38331
1.39615
1.41026
1.42425
1.43654
1.44573
1.45098
1.45211
1.44966
1.44459
1.43805
1.43106
1.42439
1.41853
1.41368
1.40984
1.40693
1.40479
1.40326
1.40219
1.40146
1.40097
1.40064
1.40043
1.40029
1.4002
1.40013
1.40009
1.40007
1.43356
1.42227
1.41033
1.39836
1.38696
1.37672
1.36813
1.36135
1.35627
1.35267
1.35019
1.34819
1.3456
1.34104
1.33287
1.31962
1.30068
1.27645
1.24776
1.21627
1.18476
1.15544
1.1293
1.10809
1.09445
1.08947
1.09246
1.10287
1.12079
1.14587
1.17638
1.20948
1.24212
1.27191
1.29725
1.31707
1.33099
1.33969
1.34472
1.34783
1.35031
1.35291
1.35613
1.36053
1.36676
1.37532
1.38635
1.39941
1.41347
1.42711
1.43878
1.44717
1.45157
1.45194
1.4489
1.44347
1.43678
1.42981
1.42327
1.41759
1.41293
1.40928
1.40652
1.4045
1.40306
1.40206
1.40138
1.40092
1.40062
1.40041
1.40028
1.40019
1.40013
1.40009
1.40007
1.4363
1.42541
1.41372
1.40187
1.39044
1.37993
1.37088
1.3636
1.35813
1.3542
1.3515
1.34953
1.34749
1.34425
1.33854
1.32921
1.31567
1.2977
1.27552
1.25068
1.22571
1.20208
1.18047
1.16291
1.15173
1.14742
1.14939
1.15768
1.17259
1.19344
1.21833
1.24471
1.27015
1.29293
1.31195
1.32651
1.33645
1.34248
1.34602
1.34851
1.35093
1.35379
1.35746
1.36242
1.36924
1.37835
1.38979
1.40302
1.41696
1.43014
1.44108
1.44858
1.45205
1.45161
1.44797
1.44219
1.43537
1.42845
1.42208
1.41661
1.41216
1.40869
1.4061
1.40421
1.40286
1.40193
1.4013
1.40087
1.40059
1.4004
1.40027
1.40019
1.40013
1.40009
1.40007
1.43913
1.42872
1.41734
1.40564
1.39423
1.38357
1.37412
1.36629
1.36027
1.35594
1.35298
1.35096
1.34924
1.34697
1.34315
1.33693
1.32766
1.31478
1.29833
1.2798
1.26103
1.24262
1.22533
1.2114
1.20256
1.19875
1.19984
1.2064
1.2186
1.23536
1.25477
1.27476
1.29359
1.31016
1.32376
1.33391
1.3406
1.34458
1.34708
1.34926
1.35181
1.35503
1.3592
1.36474
1.37217
1.38183
1.39364
1.40698
1.42068
1.4333
1.44339
1.44989
1.45237
1.45109
1.44686
1.44075
1.43384
1.42701
1.42082
1.41558
1.41136
1.4081
1.40567
1.40391
1.40266
1.4018
1.40121
1.40082
1.40055
1.40038
1.40026
1.40018
1.40013
1.40009
1.40007
1.442
1.43216
1.42116
1.40968
1.39832
1.38756
1.37782
1.3695
1.36286
1.35796
1.35462
1.35248
1.35091
1.34924
1.34678
1.3429
1.3369
1.3281
1.3166
1.30364
1.29009
1.27612
1.26288
1.25244
1.24565
1.24234
1.24294
1.2482
1.25785
1.27059
1.28483
1.29906
1.31218
1.32354
1.33271
1.33937
1.34361
1.34614
1.34804
1.35019
1.35302
1.35669
1.3614
1.36754
1.37558
1.38576
1.39789
1.41125
1.42461
1.43653
1.44564
1.45105
1.45248
1.45035
1.44554
1.43915
1.4322
1.42548
1.41951
1.41452
1.41054
1.40749
1.40523
1.4036
1.40246
1.40167
1.40113
1.40076
1.40052
1.40036
1.40025
1.40018
1.40012
1.40009
1.40006
1.44482
1.43568
1.42514
1.41395
1.40271
1.3919
1.38194
1.37322
1.366
1.36044
1.35654
1.35404
1.35241
1.35111
1.34964
1.34745
1.34381
1.33816
1.33073
1.32223
1.31279
1.30264
1.2932
1.28585
1.28073
1.27798
1.27848
1.28263
1.28972
1.2986
1.3082
1.31758
1.32609
1.33336
1.33914
1.34321
1.34573
1.3474
1.34909
1.35143
1.35466
1.35883
1.36411
1.37087
1.3795
1.39015
1.40253
1.41579
1.42867
1.43974
1.44777
1.45199
1.45234
1.44936
1.44401
1.43738
1.43044
1.42389
1.41817
1.41344
1.40972
1.40688
1.4048
1.4033
1.40226
1.40153
1.40104
1.40071
1.40049
1.40034
1.40024
1.40017
1.40012
1.40009
1.40006
1.44751
1.4392
1.42925
1.41842
1.40737
1.39657
1.38646
1.37741
1.36969
1.3635
1.35892
1.35582
1.35387
1.35271
1.35189
1.35077
1.34871
1.34541
1.34111
1.33592
1.32966
1.32287
1.31674
1.31177
1.30794
1.30589
1.30643
1.30939
1.31396
1.31942
1.32522
1.33083
1.33587
1.34016
1.34352
1.34582
1.34729
1.34857
1.35038
1.3531
1.35681
1.36152
1.36738
1.37474
1.38393
1.395
1.40752
1.42055
1.43279
1.44287
1.44968
1.45265
1.45189
1.4481
1.44227
1.43546
1.42858
1.42224
1.4168
1.41236
1.40889
1.40628
1.40437
1.40301
1.40206
1.4014
1.40096
1.40066
1.40046
1.40032
1.40022
1.40016
1.40012
1.40008
1.40006
)
;
boundaryField
{
emptyPatches_empt
{
type empty;
}
top_cyc
{
type cyclic;
}
bottom_cyc
{
type cyclic;
}
inlet_cyc
{
type cyclic;
}
outlet_cyc
{
type cyclic;
}
procBoundary3to1
{
type processor;
value nonuniform List<scalar>
75
(
1.45001
1.44264
1.43341
1.42306
1.41226
1.40154
1.39136
1.38207
1.37392
1.36715
1.36189
1.35809
1.35564
1.35428
1.35356
1.35291
1.3519
1.35039
1.34831
1.3454
1.34162
1.33761
1.33393
1.33059
1.32787
1.32657
1.32699
1.32862
1.33095
1.33375
1.33678
1.33971
1.34235
1.34463
1.34641
1.34764
1.34862
1.34992
1.35208
1.3553
1.35955
1.3648
1.37123
1.37917
1.38888
1.40027
1.41281
1.42545
1.43688
1.44581
1.45129
1.45296
1.45111
1.44655
1.44031
1.4334
1.42664
1.42056
1.41542
1.41128
1.40809
1.4057
1.40396
1.40273
1.40187
1.40128
1.40088
1.40061
1.40042
1.4003
1.40021
1.40015
1.40011
1.40008
1.40006
)
;
}
procBoundary3to1throughtop_cyc
{
type processorCyclic;
value nonuniform List<scalar>
75
(
1.39999
1.39998
1.39998
1.39997
1.39996
1.39996
1.39996
1.39995
1.39995
1.39995
1.39996
1.39997
1.39998
1.4
1.40001
1.40004
1.40006
1.40009
1.40012
1.40015
1.40018
1.40021
1.40024
1.40027
1.40029
1.40031
1.40032
1.40033
1.40033
1.40033
1.40033
1.40032
1.40031
1.40029
1.40027
1.40026
1.40024
1.40022
1.4002
1.40018
1.40016
1.40014
1.40012
1.40011
1.40009
1.40008
1.40006
1.40005
1.40004
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
)
;
}
procBoundary3to2
{
type processor;
value nonuniform List<scalar>
75
(
1.39999
1.39999
1.39998
1.39998
1.39998
1.39999
1.4
1.40001
1.40003
1.40007
1.40012
1.4002
1.40032
1.40048
1.4007
1.40099
1.40138
1.4019
1.40257
1.40343
1.4045
1.40585
1.40749
1.40948
1.41185
1.41463
1.41783
1.42144
1.42541
1.42967
1.4341
1.43852
1.44276
1.44662
1.44992
1.45253
1.45439
1.45549
1.45587
1.4556
1.4548
1.45355
1.45195
1.45011
1.44809
1.44598
1.44384
1.44172
1.43968
1.43774
1.43594
1.4343
1.43284
1.43159
1.43058
1.42983
1.42935
1.42914
1.42916
1.42938
1.42982
1.43051
1.43147
1.43267
1.43407
1.43563
1.43736
1.43926
1.44131
1.44343
1.44559
1.44773
1.44979
1.45169
1.45336
)
;
}
procBoundary3to2throughoutlet_cyc
{
type processorCyclic;
value nonuniform List<scalar>
75
(
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39997
1.39997
1.39997
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.40001
1.40001
1.40001
1.40002
1.40002
1.40003
1.40003
1.40003
1.40004
1.40004
1.40004
1.40004
1.40004
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40004
)
;
}
}
// ************************************************************************* //
| [
"tdg@debian"
] | tdg@debian | |
1247a29b51b430818c46df966e0cc6da9168a796 | 753a70bc416e8dced2853f278b08ef60cdb3c768 | /include/tensorflow/lite/tools/evaluation/stages/image_preprocessing_stage.h | 45a3e3838522a6567650b4b788b5191e6aa2735d | [
"MIT"
] | permissive | finnickniu/tensorflow_object_detection_tflite | ef94158e5350613590641880cb3c1062f7dd0efb | a115d918f6894a69586174653172be0b5d1de952 | refs/heads/master | 2023-04-06T04:59:24.985923 | 2022-09-20T16:29:08 | 2022-09-20T16:29:08 | 230,891,552 | 60 | 19 | MIT | 2023-03-25T00:31:18 | 2019-12-30T09:58:41 | C++ | UTF-8 | C++ | false | false | 2,359 | h | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_LITE_TOOLS_EVALUATION_STAGES_IMAGE_PREPROCESSING_STAGE_H_
#define TENSORFLOW_LITE_TOOLS_EVALUATION_STAGES_IMAGE_PREPROCESSING_STAGE_H_
#include <stdint.h>
#include <vector>
#include "tensorflow/core/util/stats_calculator.h"
#include "tensorflow/lite/tools/evaluation/evaluation_stage.h"
#include "tensorflow/lite/tools/evaluation/proto/evaluation_config.pb.h"
namespace tflite {
namespace evaluation {
// EvaluationStage to read contents of an image and preprocess it for inference.
// Currently only supports JPEGs.
class ImagePreprocessingStage : public EvaluationStage {
public:
explicit ImagePreprocessingStage(const EvaluationStageConfig& config)
: EvaluationStage(config) {}
TfLiteStatus Init() override;
TfLiteStatus Run() override;
EvaluationStageMetrics LatestMetrics() override;
~ImagePreprocessingStage() override {}
// Call before Run().
void SetImagePath(std::string* image_path) { image_path_ = image_path; }
// Provides preprocessing output.
void* GetPreprocessedImageData();
// Get total size of data.
int GetTotalSize() { return total_size_; }
private:
std::string* image_path_ = nullptr;
float cropping_fraction_;
float input_mean_value_;
float scale_;
int total_size_;
TfLiteType output_type_;
tensorflow::Stat<int64_t> latency_stats_;
// One of the following 3 vectors will be populated based on output_type_.
std::vector<float> float_preprocessed_image_;
std::vector<int8_t> int8_preprocessed_image_;
std::vector<uint8_t> uint8_preprocessed_image_;
};
} // namespace evaluation
} // namespace tflite
#endif // TENSORFLOW_LITE_TOOLS_EVALUATION_STAGES_IMAGE_PREPROCESSING_STAGE_H_
| [
"finn.niu@apptech.com.hk"
] | finn.niu@apptech.com.hk |
92a0d737cf77d6ead4e3750e34e3968a5f39927a | ad2d392f73f6e26b4f082fb0251b241a7ebf85a8 | /code_festival/2017_final/b.cpp | ca56a0d88731e385f203231cd1f5040a81ac794f | [] | no_license | miyamotononno/atcoder | b293ac3b25397567aa93a179d1af34add492518b | cf29d48c7448464d33a9d7ad69affd771319fe3c | refs/heads/master | 2022-01-09T23:03:07.022772 | 2022-01-08T14:12:13 | 2022-01-08T14:12:13 | 187,175,157 | 0 | 0 | null | 2019-06-12T16:03:24 | 2019-05-17T08:11:58 | Python | UTF-8 | C++ | false | false | 1,030 | cpp | #include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N;
string S;
bool dfs(int idx, int pre, int prepre, vector<int> C) {
if (idx==N) return true;
rep(i,3) {
if (i==pre || i==prepre) continue;
if (C[i]==0) continue;
C[i]--;
bool flag = dfs(idx+1, i, pre, C);
if (flag) return true;
C[i]++;
}
return false;
}
int main() {
INCANT;
cin >> S;
N = S.size();
vector<int> C(3);
for (auto p: S) C[p-'a']++;
string ans = dfs(0,'-', '-', C)? "YES":"NO";
cout << ans << endl;
return 0;
} | [
"miyamoto-nozomu@g.ecc.u-tokyo.ac.jp"
] | miyamoto-nozomu@g.ecc.u-tokyo.ac.jp |
8fd0464e36137f9d722a702c7ac47c089a3f7d6e | b252fe30f5378a5347842a6df247919f8de01321 | /utility/GLResource.cpp | bb7747940d0f2c119850f293065d357038711f5b | [] | no_license | christophzeller/GLoom | df47517539f9c4563094f567efe365c88d8f07b3 | 7414f099d1c93edd4c8194d9b0f3f53d7bba3eeb | refs/heads/master | 2020-06-02T15:12:30.203421 | 2015-03-02T19:15:27 | 2015-03-02T19:15:27 | 31,319,405 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 250 | cpp | /*
* GLResource.cpp
*
* Created on: 27.02.2015
* Author: Christoph
*/
#include "GLResource.h"
GLResource::GLResource()
{
// TODO Auto-generated constructor stub
}
GLResource::~GLResource()
{
// TODO Auto-generated destructor stub
}
| [
"christophzeller@users.noreply.github.com"
] | christophzeller@users.noreply.github.com |
ae552741553ce8a8fc4b213a7df8c4a924f2a85b | cf02bc4adce15232d6a45f67339bdd921f4be3aa | /580A.cpp | c028a1e8015511a21f7f3db4b468f4664dcc4e7b | [] | no_license | shubhamivane/CodeForces | e9dfcb25bbe4c4dd185227a1112f93aead5d7b5a | 2ca8cd9d25e7c608b2bd403e9cd7e4665554365c | refs/heads/master | 2022-02-24T21:15:01.139991 | 2019-10-07T19:58:40 | 2019-10-07T19:58:40 | 89,680,154 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 361 | cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, s = 0, mx = 1, i;
cin >> n;
vector<int> v(n);
for(int i = 0 ; i < n ; i++){
cin >> v[i];
}
for(i = 1 ; i < n ; i++){
if(v[i] < v[i-1]){
mx = max(mx, i - s);
s = i;
}
}
cout << max(mx, i - s) << endl;
return 0;
}
| [
"shubham@dailyrounds.org"
] | shubham@dailyrounds.org |
2140e4a8678eb9c177254195572bde0cdc12d310 | 30b3a69a1a494418d8815497027d66a542a95618 | /Simple/ReverseDigits.cpp | 96b0d8458393429b24bcd2426da9df34d46a569b | [] | no_license | HarikumarG/Algorithms | 22df671a4c42b76bbd593eb7ddd15ca8501fdb70 | 1a96ce79593168428bcaad1e5cc50b77bfe946b7 | refs/heads/master | 2023-05-25T05:42:39.911822 | 2023-05-14T17:11:27 | 2023-05-14T17:11:27 | 108,449,308 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,273 | cpp | // C++ program to reverse digits
// of a number
#include <bits/stdc++.h>
using namespace std;
/* Iterative function to reverse
digits of num*/
int reversDigits(int num)
{
// Handling negative numbers
bool negativeFlag = false;
if (num < 0)
{
negativeFlag = true;
num = -num ;
}
int prev_rev_num = 0, rev_num = 0;
while (num != 0)
{
int curr_digit = num % 10;
rev_num = (rev_num * 10) + curr_digit;
// checking if the reverse overflowed or not.
// The values of (rev_num - curr_digit)/10 and
// prev_rev_num must be same if there was no
// problem.
if ((rev_num - curr_digit) /
10 != prev_rev_num)
{
cout << "WARNING OVERFLOWED!!!"
<< endl;
return 0;
}
prev_rev_num = rev_num;
num = num / 10;
}
return (negativeFlag == true) ?
-rev_num : rev_num;
/*long long res=0;
while(n){
res=res*10+n%10;
if(res>INT_MAX||res<INT_MIN) return 0;
n=n/10;
}
return res;*/
}
// Driver Code
int main()
{
int num = 12345;
cout << "Reverse of no. is "
<< reversDigits(num) << endl;
num = 1000000045;
cout << "Reverse of no. is "
<< reversDigits(num) << endl;
return 0;
}
// This code is contributed
// by Akanksha Rai(Abby_akku)
| [
"harikumarmgp@gmail.com"
] | harikumarmgp@gmail.com |
c3c157f356a34d204224846963288f26369dbd70 | f6c730159ab82281c6d03f4fc75c2fb177ece8f9 | /util/filesystem.cc | 66ba182134887846d022f894e2d9bee5e35b5b99 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | chcunningham01/binexport | 12dc4c9c2d282269404e24ef20f0c052777edbf7 | 050b22ea713bc4890cb1e78662d14f43bd4ed3e3 | refs/heads/master | 2022-10-02T17:27:38.175165 | 2020-06-08T12:12:00 | 2020-06-08T12:12:00 | 271,583,383 | 0 | 0 | Apache-2.0 | 2020-06-11T15:35:05 | 2020-06-11T15:35:05 | null | UTF-8 | C++ | false | false | 10,778 | cc | // Copyright 2011-2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "third_party/zynamics/binexport/util/filesystem.h"
#ifdef _WIN32
// clang-format off
#include <windows.h>
#include <shellapi.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <stdlib.h>
// clang-format on
#include <filesystem>
#include <system_error> // NOLINT(build/c++11)
#undef CopyFile // winbase.h
#undef GetCurrentDirectory // processenv.h
#undef GetFullPathName // fileapi.h
#undef StrCat // shlwapi.h
#else
#include <dirent.h>
#include <libgen.h> // POSIX basename()
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#ifdef __APPLE__
#include <cerrno>
#include <cstring>
#endif
#include <algorithm>
#include <fstream>
#include <string>
#include "third_party/absl/strings/ascii.h"
#include "third_party/absl/strings/str_cat.h"
#include "third_party/absl/strings/str_replace.h"
#include "third_party/absl/strings/string_view.h"
#include "third_party/absl/strings/strip.h"
#include "third_party/zynamics/binexport/util/status_macros.h"
#ifdef _WIN32
const char kPathSeparator[] = "\\";
const char kAllFilesFilter[] = "*.*";
#else
const char kPathSeparator[] = "/";
const char kAllFilesFilter[] = "*";
#endif
namespace internal {
std::string JoinPathImpl(std::initializer_list<absl::string_view> paths) {
std::string result;
for (auto& path : paths) {
if (path.empty()) {
continue;
}
if (result.empty() || result[result.size() - 1] == kPathSeparator[0]) {
absl::StrAppend(&result, path);
} else {
absl::StrAppend(&result, kPathSeparator, path);
}
}
return result;
}
} // namespace internal
std::string GetCurrentDirectory() {
enum { kMaxPath = 260 };
char buffer[kMaxPath] = {0};
#ifdef _WIN32
if (GetCurrentDirectoryA(kMaxPath, buffer) == 0) {
return "";
}
#else
if (!getcwd(buffer, kMaxPath)) {
return "";
}
#endif
return std::string(buffer);
}
std::string GetFullPathName(absl::string_view path) {
#ifdef _WIN32
if (!PathIsRelativeA(std::string(path).c_str())) {
return std::string(path);
}
#else
if (absl::StartsWith(path, kPathSeparator)) {
return std::string(path);
}
#endif
return JoinPath(GetCurrentDirectory(), path);
}
absl::Status CreateDirectories(absl::string_view path) {
if (path.empty()) {
return absl::OkStatus();
}
#ifdef _WIN32
std::string real_path = absl::StrReplaceAll(path, {{"/", "\\"}});
const int result = SHCreateDirectoryEx(
/*hwnd=*/nullptr, real_path.c_str(), /*psa=*/nullptr);
if (result != ERROR_SUCCESS && result != ERROR_ALREADY_EXISTS &&
result != ERROR_FILE_EXISTS) {
return absl::UnknownError(
absl::StrCat("cannot create directory \"", path, "\""));
}
#else
auto slash = path.rfind('/');
if (slash != absl::string_view::npos) {
// Create parent directory recursively.
NA_RETURN_IF_ERROR(CreateDirectories(path.substr(0, slash)));
}
std::string path_copy(path);
if (mkdir(path_copy.c_str(), 0775) == -1) {
// Ignore existing directories.
if (errno != EEXIST) {
return absl::UnknownError(absl::StrCat("cannot create directory \"", path,
"\": ", strerror(errno)));
}
}
#endif
return absl::OkStatus();
}
namespace {
not_absl::StatusOr<std::string> DoGetOrCreateTempDirectory(
absl::string_view product_name, bool create) {
std::string path;
#ifdef _WIN32
char buffer[MAX_PATH] = {0};
if (GetTempPath(MAX_PATH, buffer) == 0) {
return absl::UnknownError("error getting temp directory");
}
path = JoinPath(buffer, product_name);
#else
path = JoinPath("/tmp", absl::AsciiStrToLower(product_name));
#endif
if (create) {
NA_RETURN_IF_ERROR(CreateDirectories(path));
}
return path;
}
} // namespace
not_absl::StatusOr<std::string> GetTempDirectory(
absl::string_view product_name) {
return DoGetOrCreateTempDirectory(product_name, /*create=*/false);
}
not_absl::StatusOr<std::string> GetOrCreateTempDirectory(
absl::string_view product_name) {
return DoGetOrCreateTempDirectory(product_name, /*create=*/true);
}
std::string Basename(absl::string_view path) {
const auto last_slash = path.find_last_of(kPathSeparator[0]);
return std::string(last_slash == absl::string_view::npos
? path
: absl::ClippedSubstr(path, last_slash + 1));
}
std::string Dirname(absl::string_view path) {
std::string path_copy(path);
#ifdef _WIN32
char drive[_MAX_DRIVE] = {0};
char dirname[_MAX_DIR] = {0};
if (_splitpath_s(path_copy.c_str(), drive, _MAX_DRIVE,
dirname /* Directory */, _MAX_FNAME, nullptr /* Filename */,
0 /* Filename length */, nullptr /* Extension */,
0 /* Extension length */) != 0) {
return "."; // Safe default in case this ever happens.
}
return absl::StrCat(drive, absl::StripSuffix(dirname, kPathSeparator));
#else
return std::string(dirname(&path_copy[0]));
#endif
}
std::string GetFileExtension(absl::string_view path) {
std::string extension = Basename(path);
auto pos = extension.rfind(".");
return pos != absl::string_view::npos ? extension.substr(pos) : "";
}
std::string ReplaceFileExtension(absl::string_view path,
absl::string_view new_extension) {
auto last_slash = path.find_last_of(kPathSeparator[0]);
if (last_slash == absl::string_view::npos) {
last_slash = 0;
}
auto pos = path.substr(last_slash).find_last_of(".");
if (pos != absl::string_view::npos) {
pos += last_slash;
}
return absl::StrCat(path.substr(0, pos), new_extension);
}
#ifndef _WIN32
namespace {
not_absl::StatusOr<mode_t> GetFileMode(absl::string_view path) {
struct stat file_info;
std::string path_copy(path);
if (stat(path_copy.c_str(), &file_info) == -1) {
switch (errno) {
case EACCES:
case ENOENT:
case ENOTDIR:
return 0;
default:
return absl::UnknownError(absl::StrCat("stat() failed for \"", path,
"\": ", strerror(errno)));
}
}
return file_info.st_mode;
}
} // namespace
#endif
not_absl::StatusOr<int64_t> GetFileSize(absl::string_view path) {
std::ifstream stream(std::string(path), std::ifstream::ate);
auto size = static_cast<int64_t>(stream.tellg());
if (stream) {
return size;
}
return absl::UnknownError(absl::StrCat("cannot get file size for: ", path));
}
bool FileExists(absl::string_view path) {
#ifdef _WIN32
std::string path_copy(path);
return PathFileExists(path_copy.c_str()) == TRUE;
#else
auto mode_or = GetFileMode(path);
return mode_or.ok() ? S_ISREG(mode_or.value()) : false;
#endif
}
bool IsDirectory(absl::string_view path) {
#ifdef _WIN32
std::string path_copy(path);
return PathIsDirectory(path_copy.c_str()) == FILE_ATTRIBUTE_DIRECTORY;
#else
auto mode_or = GetFileMode(path);
return mode_or.ok() ? S_ISDIR(mode_or.value()) : false;
#endif
}
absl::Status GetDirectoryEntries(absl::string_view path,
std::vector<std::string>* result) {
#ifdef _WIN32
std::string path_copy(JoinPath(path, "*")); // Assume path is a directory
WIN32_FIND_DATA entry;
HANDLE directory = FindFirstFile(path_copy.c_str(), &entry);
bool error = directory == INVALID_HANDLE_VALUE;
if (!error) {
do {
result->push_back(entry.cFileName);
} while (FindNextFile(directory, &entry) != 0);
error = GetLastError() != ERROR_NO_MORE_FILES;
FindClose(directory);
}
if (error) {
return absl::UnknownError(
absl::StrCat("FindFirstFile() failed for: ", path));
}
#else
std::string path_copy(path);
errno = 0;
DIR* directory = opendir(path_copy.c_str());
if (!directory) {
return absl::UnknownError(
absl::StrCat("opendir() failed for \"", path, "\": ", strerror(errno)));
}
struct dirent* entry;
while ((entry = readdir(directory))) {
const std::string name(entry->d_name);
if (name != "." && name != "..") {
result->push_back(name);
}
}
if (errno != 0) {
return absl::UnknownError(
absl::StrCat("readdir() failed: ", strerror(errno)));
}
closedir(directory);
#endif
return absl::OkStatus();
}
absl::Status RemoveAll(absl::string_view path) {
std::string path_copy(path);
#ifdef _WIN32
// Linking against filesystem is difficult on Linux and macOS' XCode does not
// have it. Visual Studio's standard library has it integrated.
// TODO(cblichmann): Use filesystem once libstdc++ is >= 8.3 everywhere.
namespace fs = std::filesystem;
if (std::error_code ec;
fs::remove_all(path_copy, ec) == static_cast<std::uintmax_t>(-1)) {
return absl::UnknownError(
absl::StrCat("remove_all() failed for \"", path, "\": ", ec.message()));
}
#else
errno = 0;
if (!IsDirectory(path)) {
return absl::UnknownError(absl::StrCat("Not a directory: ", path));
}
DIR* directory = opendir(path_copy.c_str());
if (!directory) {
return absl::UnknownError(
absl::StrCat("opendir() failed for \"", path, "\": ", strerror(errno)));
}
struct dirent* entry;
while ((entry = readdir(directory))) {
const std::string name(entry->d_name);
if (name == "." || name == "..") {
continue;
}
const std::string full_path(JoinPath(path, name));
if (IsDirectory(full_path)) {
NA_RETURN_IF_ERROR(RemoveAll(full_path));
} else {
std::remove(full_path.c_str());
}
}
if (errno != 0) {
return absl::UnknownError(
absl::StrCat("readdir() failed: ", strerror(errno)));
}
closedir(directory);
if (rmdir(path_copy.c_str()) == -1) {
return absl::UnknownError(
absl::StrCat("rmdir() failed: ", strerror(errno)));
}
#endif
return absl::OkStatus();
}
absl::Status CopyFile(absl::string_view from, absl::string_view to) {
std::ifstream input(std::string(from), std::ios::in | std::ios::binary);
std::ofstream output(std::string(to),
std::ios::out | std::ios::trunc | std::ios::binary);
output << input.rdbuf();
if (!input || !output) {
return absl::UnknownError("error copying file");
}
return absl::OkStatus();
}
| [
"cblichmann@google.com"
] | cblichmann@google.com |
02961d13b88388ba45453f05ae9d3ba24a29f1f8 | 4178f7bf3a27d71aea1f9861287f567e18278675 | /Olympick_HaNam/Code_Forces.com/read_code/938G_contest464_div2/main.cpp | 0b46fe35d1a7ee2b064df3488980e86d12433a6b | [] | no_license | Minglee2018/Olympick-K12 | a0fc89c1c94252227251364584fc6365f2e2b097 | 1e027a08a7b6385af51635773dc8b1c8e9e2b7f8 | refs/heads/master | 2020-03-29T20:34:07.603638 | 2019-01-10T19:52:55 | 2019-01-10T19:52:55 | 150,318,176 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,556 | cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
const int N = 1 << 18;
int uf[N];
int cost[N];
vector<pair<int, int>> h_uf;
vector<pair<int, int>> h_cost;
pair<int, int> query[N];
int ans[N];
bool sample;
struct edge {
int u, v, w;
edge(int u, int v, int w) : u(u), v(v), w(w) {}
};
vector<edge> seg[N * 2];
int find(int u) {
while (uf[u] >= 0) {
u = uf[u];
}
return u;
}
int find_cost(int u) {
int res = 0;
while (uf[u] >= 0) {
res ^= cost[u];
u = uf[u];
}
return res;
}
bool unite(int u, int v, int w) {
int pu = find(u);
int pv = find(v);
if (pu == pv) return false;
w ^= find_cost(u);
w ^= find_cost(v);
u = pu;
v = pv;
if (-uf[u] < -uf[v]) swap(u, v);
h_uf.emplace_back(u, uf[u]);
h_uf.emplace_back(v, uf[v]);
h_cost.emplace_back(v, cost[v]);
uf[u] += uf[v];
uf[v] = u;
cost[v] = w;
return true;
}
void undo() {
auto p = h_uf.back(); h_uf.pop_back();
auto q = h_uf.back(); h_uf.pop_back();
auto r = h_cost.back(); h_cost.pop_back();
uf[p.first] = p.second;
uf[q.first] = q.second;
cost[r.first] = r.second;
}
int find_cost(int u, int v) {
return find_cost(u) ^ find_cost(v);
}
void init_uf(int n) {
for (int i = 0; i < n; i++) {
uf[i] = -1;
}
}
void insert(int l, int r, edge e, int k = 1, int ll = 0, int rr = N) {
if (rr <= l || r <= ll) return;
if (l <= ll && rr <= r) {
seg[k].emplace_back(e);
return;
}
insert(l, r, e, k * 2 + 0, ll, ll + rr >> 1);
insert(l, r, e, k * 2 + 1, ll + rr >> 1, rr);
}
vector<int> normalize(vector<int> a) {
int r = 0;
for (int j = 29; j >= 0; j--) {
int p = -1;
for (int i = r; i < a.size(); i++) {
if (a[i] >> j & 1) {
p = i;
break;
}
}
if (p == -1) continue;
swap(a[r], a[p]);
for (int i = r + 1; i < a.size(); i++) {
if (a[i] >> j & 1) {
a[i] ^= a[r];
}
}
r++;
}
a.resize(r);
return a;
}
int find_min(int x, vector<int> &a) {
for (int y : a) x = min(x, x ^ y);
return x;
}
void dfs(vector<int> a, int k = 1, int l = 0, int r = N) {
int cnt = 0;
for (edge e : seg[k]) {
if (unite(e.u, e.v, e.w)) {
cnt++;
} else {
a.push_back(e.w ^ find_cost(e.u, e.v));
}
}
a = normalize(a);
if (r - l == 1) {
if (query[l].second != 0) {
ans[l] = find_min(find_cost(query[l].first, query[l].second), a);
}
return;
}
dfs(a, k * 2 + 0, l, l + r >> 1);
dfs(a, k * 2 + 1, l + r >> 1, r);
while (cnt--) undo();
}
int input() {
int n;
scanf("%d", &n);
return n;
}
int main() {
int n, m;
cin >> n >> m;
init_uf(n);
map<pair<int, int>, pair<int, int>> mp;
for (int i = 0; i < m; i++) {
int u = input() - 1;
int v = input() - 1;
int w = input();
mp[{u, v}] = { w, 0 };
}
int q = input();
for (int i = 1; i <= q; i++) {
int type = input();
int u = input() - 1;
int v = input() - 1;
if (type == 1) {
int w = input();
mp[{u, v}] = { w, i };
} else if (type == 2) {
auto it = mp.find({ u, v });
insert(it->second.second, i, edge(u, v, it->second.first));
mp.erase(it);
} else {
query[i] = { u, v };
}
}
for (auto p : mp) {
int u = p.first.first;
int v = p.first.second;
int w = p.second.first;
int s = p.second.second;
insert(s, q + 1, edge(u, v, w));
}
sample = n <= 10;
dfs({});
for (int i = 1; i <= q; i++) {
if (query[i].second != 0) {
printf("%d\n", ans[i]);
}
}
}
| [
"doannguyenhongle@gmail.com"
] | doannguyenhongle@gmail.com |
44d634da2b2bb511ce6c1d5f46a456386d4541cd | 386243a5d935f26d8fbe45807de1ec265f0733db | /qt_src_code/ui_notepad_mainwindow.h | cfbf8774649f9f03b25c1a21bd72cae2e842cf3e | [] | no_license | I-Abdullah-I/XML_editor | 4ee4c863278628e5c49678a5d6e9b8277d54ce8a | bddd455d3daab802af809be8480b78e152b10eb3 | refs/heads/master | 2023-06-22T05:06:06.328371 | 2021-07-18T22:09:10 | 2021-07-18T22:09:10 | 387,016,641 | 0 | 1 | null | 2021-07-18T21:29:55 | 2021-07-17T18:53:13 | C++ | UTF-8 | C++ | false | false | 11,625 | h | /********************************************************************************
** Form generated from reading UI file 'notepad_mainwindow.ui'
**
** Created by: Qt User Interface Compiler version 6.1.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_NOTEPAD_MAINWINDOW_H
#define UI_NOTEPAD_MAINWINDOW_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QPlainTextEdit>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QTextEdit>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_Notepad_MainWindow
{
public:
QAction *actionNew;
QAction *actionOpen;
QAction *actionSave_As;
QAction *actionPrint;
QAction *actionExist;
QAction *actionCopy;
QAction *actionCut;
QAction *actionPaste;
QAction *actionUndo;
QAction *actionRedo;
QAction *actionSave;
QAction *actionConvert_to_jason;
QAction *actionDetect_Errors;
QAction *actionFix;
QAction *actionMinfy;
QWidget *centralwidget;
QVBoxLayout *verticalLayout;
QPlainTextEdit *plainTextEdit1;
QTextEdit *textEdit_errors;
QMenuBar *menubar;
QMenu *menuFile;
QMenu *menuEdit;
QMenu *menuActions;
QToolBar *toolBar;
QStatusBar *statusbar;
void setupUi(QMainWindow *Notepad_MainWindow)
{
if (Notepad_MainWindow->objectName().isEmpty())
Notepad_MainWindow->setObjectName(QString::fromUtf8("Notepad_MainWindow"));
Notepad_MainWindow->resize(739, 583);
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(Notepad_MainWindow->sizePolicy().hasHeightForWidth());
Notepad_MainWindow->setSizePolicy(sizePolicy);
actionNew = new QAction(Notepad_MainWindow);
actionNew->setObjectName(QString::fromUtf8("actionNew"));
QIcon icon;
icon.addFile(QString::fromUtf8(":/images/add-file.png"), QSize(), QIcon::Normal, QIcon::Off);
actionNew->setIcon(icon);
actionOpen = new QAction(Notepad_MainWindow);
actionOpen->setObjectName(QString::fromUtf8("actionOpen"));
QIcon icon1;
icon1.addFile(QString::fromUtf8(":/images/Icons/google/2x/outline_open_in_new_black_24dp.png"), QSize(), QIcon::Normal, QIcon::Off);
actionOpen->setIcon(icon1);
actionSave_As = new QAction(Notepad_MainWindow);
actionSave_As->setObjectName(QString::fromUtf8("actionSave_As"));
QIcon icon2;
icon2.addFile(QString::fromUtf8(":/images/Icons/google/2x/outline_save_black_24dp.png"), QSize(), QIcon::Normal, QIcon::Off);
actionSave_As->setIcon(icon2);
actionPrint = new QAction(Notepad_MainWindow);
actionPrint->setObjectName(QString::fromUtf8("actionPrint"));
QIcon icon3;
icon3.addFile(QString::fromUtf8(":/images/Icons/icons8-print-50.png"), QSize(), QIcon::Normal, QIcon::Off);
actionPrint->setIcon(icon3);
actionExist = new QAction(Notepad_MainWindow);
actionExist->setObjectName(QString::fromUtf8("actionExist"));
actionCopy = new QAction(Notepad_MainWindow);
actionCopy->setObjectName(QString::fromUtf8("actionCopy"));
QIcon icon4;
icon4.addFile(QString::fromUtf8(":/images/Icons/google/2x/outline_content_copy_black_24dp.png"), QSize(), QIcon::Normal, QIcon::Off);
actionCopy->setIcon(icon4);
actionCut = new QAction(Notepad_MainWindow);
actionCut->setObjectName(QString::fromUtf8("actionCut"));
QIcon icon5;
icon5.addFile(QString::fromUtf8(":/images/Icons/google/2x/outline_content_cut_black_24dp.png"), QSize(), QIcon::Normal, QIcon::Off);
actionCut->setIcon(icon5);
actionPaste = new QAction(Notepad_MainWindow);
actionPaste->setObjectName(QString::fromUtf8("actionPaste"));
QIcon icon6;
icon6.addFile(QString::fromUtf8(":/images/paste-131964784935783245_256.ico"), QSize(), QIcon::Normal, QIcon::Off);
actionPaste->setIcon(icon6);
actionUndo = new QAction(Notepad_MainWindow);
actionUndo->setObjectName(QString::fromUtf8("actionUndo"));
QIcon icon7;
icon7.addFile(QString::fromUtf8(":/images/Icons/undo-1325051879300270680_256.ico"), QSize(), QIcon::Normal, QIcon::Off);
actionUndo->setIcon(icon7);
actionRedo = new QAction(Notepad_MainWindow);
actionRedo->setObjectName(QString::fromUtf8("actionRedo"));
QIcon icon8;
icon8.addFile(QString::fromUtf8(":/images/Icons/redo-1324760616182504055_256.ico"), QSize(), QIcon::Normal, QIcon::Off);
actionRedo->setIcon(icon8);
actionSave = new QAction(Notepad_MainWindow);
actionSave->setObjectName(QString::fromUtf8("actionSave"));
actionSave->setIcon(icon2);
actionConvert_to_jason = new QAction(Notepad_MainWindow);
actionConvert_to_jason->setObjectName(QString::fromUtf8("actionConvert_to_jason"));
QIcon icon9;
icon9.addFile(QString::fromUtf8(":/images/Icons/Jason.ico"), QSize(), QIcon::Normal, QIcon::Off);
actionConvert_to_jason->setIcon(icon9);
actionDetect_Errors = new QAction(Notepad_MainWindow);
actionDetect_Errors->setObjectName(QString::fromUtf8("actionDetect_Errors"));
actionFix = new QAction(Notepad_MainWindow);
actionFix->setObjectName(QString::fromUtf8("actionFix"));
QIcon icon10;
icon10.addFile(QString::fromUtf8(":/images/Icons/icon-hammer-10.jpg"), QSize(), QIcon::Normal, QIcon::Off);
actionFix->setIcon(icon10);
actionMinfy = new QAction(Notepad_MainWindow);
actionMinfy->setObjectName(QString::fromUtf8("actionMinfy"));
centralwidget = new QWidget(Notepad_MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
verticalLayout = new QVBoxLayout(centralwidget);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
plainTextEdit1 = new QPlainTextEdit(centralwidget);
plainTextEdit1->setObjectName(QString::fromUtf8("plainTextEdit1"));
plainTextEdit1->setMinimumSize(QSize(720, 0));
verticalLayout->addWidget(plainTextEdit1);
textEdit_errors = new QTextEdit(centralwidget);
textEdit_errors->setObjectName(QString::fromUtf8("textEdit_errors"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Fixed);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(textEdit_errors->sizePolicy().hasHeightForWidth());
textEdit_errors->setSizePolicy(sizePolicy1);
textEdit_errors->setMinimumSize(QSize(720, 100));
textEdit_errors->setMaximumSize(QSize(3840, 100));
textEdit_errors->setAcceptDrops(false);
textEdit_errors->setReadOnly(true);
verticalLayout->addWidget(textEdit_errors);
Notepad_MainWindow->setCentralWidget(centralwidget);
menubar = new QMenuBar(Notepad_MainWindow);
menubar->setObjectName(QString::fromUtf8("menubar"));
menubar->setGeometry(QRect(0, 0, 739, 20));
menuFile = new QMenu(menubar);
menuFile->setObjectName(QString::fromUtf8("menuFile"));
menuEdit = new QMenu(menubar);
menuEdit->setObjectName(QString::fromUtf8("menuEdit"));
menuActions = new QMenu(menubar);
menuActions->setObjectName(QString::fromUtf8("menuActions"));
Notepad_MainWindow->setMenuBar(menubar);
toolBar = new QToolBar(Notepad_MainWindow);
toolBar->setObjectName(QString::fromUtf8("toolBar"));
Notepad_MainWindow->addToolBar(Qt::TopToolBarArea, toolBar);
statusbar = new QStatusBar(Notepad_MainWindow);
statusbar->setObjectName(QString::fromUtf8("statusbar"));
Notepad_MainWindow->setStatusBar(statusbar);
menubar->addAction(menuFile->menuAction());
menubar->addAction(menuEdit->menuAction());
menubar->addAction(menuActions->menuAction());
menuFile->addAction(actionNew);
menuFile->addAction(actionOpen);
menuFile->addAction(actionSave);
menuFile->addAction(actionSave_As);
menuFile->addAction(actionPrint);
menuFile->addAction(actionExist);
menuEdit->addAction(actionCopy);
menuEdit->addAction(actionPaste);
menuEdit->addAction(actionCut);
menuEdit->addAction(actionUndo);
menuEdit->addAction(actionRedo);
menuActions->addAction(actionDetect_Errors);
menuActions->addAction(actionFix);
menuActions->addAction(actionMinfy);
menuActions->addAction(actionConvert_to_jason);
toolBar->addSeparator();
toolBar->addAction(actionDetect_Errors);
toolBar->addAction(actionFix);
toolBar->addAction(actionMinfy);
toolBar->addAction(actionConvert_to_jason);
retranslateUi(Notepad_MainWindow);
QMetaObject::connectSlotsByName(Notepad_MainWindow);
} // setupUi
void retranslateUi(QMainWindow *Notepad_MainWindow)
{
Notepad_MainWindow->setWindowTitle(QCoreApplication::translate("Notepad_MainWindow", "Notepad_MainWindow", nullptr));
actionNew->setText(QCoreApplication::translate("Notepad_MainWindow", "New", nullptr));
actionOpen->setText(QCoreApplication::translate("Notepad_MainWindow", "Open", nullptr));
actionSave_As->setText(QCoreApplication::translate("Notepad_MainWindow", "Save as", nullptr));
actionPrint->setText(QCoreApplication::translate("Notepad_MainWindow", "Print", nullptr));
actionExist->setText(QCoreApplication::translate("Notepad_MainWindow", "Exist", nullptr));
actionCopy->setText(QCoreApplication::translate("Notepad_MainWindow", "Copy", nullptr));
actionCut->setText(QCoreApplication::translate("Notepad_MainWindow", "Cut", nullptr));
actionPaste->setText(QCoreApplication::translate("Notepad_MainWindow", "Paste", nullptr));
actionUndo->setText(QCoreApplication::translate("Notepad_MainWindow", "Undo", nullptr));
actionRedo->setText(QCoreApplication::translate("Notepad_MainWindow", "Redo", nullptr));
actionSave->setText(QCoreApplication::translate("Notepad_MainWindow", "Save", nullptr));
actionConvert_to_jason->setText(QCoreApplication::translate("Notepad_MainWindow", "Convert to .jason", nullptr));
actionDetect_Errors->setText(QCoreApplication::translate("Notepad_MainWindow", "Detect Errors", nullptr));
actionFix->setText(QCoreApplication::translate("Notepad_MainWindow", "Fix", nullptr));
actionMinfy->setText(QCoreApplication::translate("Notepad_MainWindow", "Minfy", nullptr));
menuFile->setTitle(QCoreApplication::translate("Notepad_MainWindow", "File", nullptr));
menuEdit->setTitle(QCoreApplication::translate("Notepad_MainWindow", "Edit", nullptr));
menuActions->setTitle(QCoreApplication::translate("Notepad_MainWindow", "Actions", nullptr));
toolBar->setWindowTitle(QCoreApplication::translate("Notepad_MainWindow", "toolBar", nullptr));
} // retranslateUi
};
namespace Ui {
class Notepad_MainWindow: public Ui_Notepad_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_NOTEPAD_MAINWINDOW_H
| [
"abdohaks@gmail.com"
] | abdohaks@gmail.com |
fca7650a5fd0914b6eb812638f2f0a02e553a154 | 4381b23f1bfd7a0fa1a038cb62ed5e73e27be01f | /add-nbo.cpp | 71903baebd7088867903aa7f2121a92f83a4c144 | [] | no_license | endley11/add-nbo1 | 31dffc1d486138b7eaf83edf6db259c2d6ae67ea | 3f2e7598750300a50e420820e81ee14bf41f7911 | refs/heads/master | 2022-11-19T14:01:02.771269 | 2020-07-20T15:08:00 | 2020-07-20T15:08:00 | 281,127,656 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 467 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <netinet/in.h>
int main(int argc, char *argv[]){
FILE *in1;
FILE *in2;
uint32_t n1;
uint32_t n2;
in1 = fopen(argv[1],"rb");
in2 = fopen(argv[2],"rb");
fread(&n2, sizeof(n2),1,in2);
fread(&n1, sizeof(n1),1,in1);
int n_1 = ntohl(n1);
int n_2 = ntohl(n2);
int sum = n_1+n_2;
printf("%d(0x%x) + %d(0x%x) = %d(0x%x)\n",n_1,n_1,n_2,n_2,sum,sum);
fclose(in1);
fclose(in2);
}
| [
"endley@naver.com"
] | endley@naver.com |
9b61699b074d2838d3855d122aa7812a2cd5a981 | 51fe3e3c4bbea0112ef9d1bee3424718118c4a43 | /Practice/PipingPrepSolution/PipingPrep/PrvkyPotrubi.cpp | 9b14d0f74055db942d437823d34f3728b9627c1f | [] | no_license | KubikJan7/ICPP | 0957b937e0d421737a7132e4efefaef117c42373 | b01aa635b61787c2b167fd28d7a0d365ef537fc2 | refs/heads/master | 2021-07-10T13:22:22.334583 | 2020-07-08T12:01:16 | 2020-07-08T12:01:16 | 163,119,019 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 932 | cpp | #include "PrvkyPotrubi.h"
#include <iostream>
bool PrvekMinus::JeKorektneZapojen(const IPotrubi* potrubi) const
{
return (potrubi->DejPrvek(_x - 1, _y) != nullptr
&& potrubi->DejPrvek(_x + 1, _y) != nullptr);
}
bool PrvekI::JeKorektneZapojen(const IPotrubi* potrubi) const
{
return (potrubi->DejPrvek(_x, _y - 1) != nullptr
&& potrubi->DejPrvek(_x, _y + 1) != nullptr);
}
bool PrvekPlus::JeKorektneZapojen(const IPotrubi* potrubi) const
{
return (potrubi->DejPrvek(_x - 1, _y) != nullptr
&& potrubi->DejPrvek(_x + 1, _y) != nullptr
&& potrubi->DejPrvek(_x, _y - 1) != nullptr
&& potrubi->DejPrvek(_x, _y + 1) != nullptr);
}
bool PrvekO::JeKorektneZapojen(const IPotrubi* potrubi) const
{
return true;
}
bool PrvekT::JeKorektneZapojen(const IPotrubi* potrubi) const
{
return (potrubi->DejPrvek(_x - 1, _y) != nullptr
&& potrubi->DejPrvek(_x + 1, _y) != nullptr
&& potrubi->DejPrvek(_x, _y + 1) != nullptr);
}
| [
"43739550+st52531@users.noreply.github.com"
] | 43739550+st52531@users.noreply.github.com |
9c0832b905f884a9b44e78ed2ffabac77656d657 | 2ed22fcd1a813da0848e016ae6f92a3237961fe7 | /whisperlib/base/scoped_ptr.h | 65a3c86a7cc39ead99b448db49d061807367ccef | [] | no_license | ovidiucp/whisperlib | 183e7335e5220c1339c182415dae4520e8673a83 | 9882729ba33b99af03d24b854741f80df7d32a70 | refs/heads/master | 2021-01-09T06:41:23.622625 | 2014-04-23T02:13:47 | 2014-04-23T02:13:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,119 | h | // Copyright 2010 Google
// 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 __WHISPERLIB_BASE_SCOPED_PTR_H
#define __WHISPERLIB_BASE_SCOPED_PTR_H
// This is an implementation designed to match the anticipated future TR2
// implementation of the scoped_ptr class, and its closely-related brethren,
// scoped_array, scoped_ptr_malloc, and make_scoped_ptr.
#include <assert.h>
#include <stdlib.h>
#include <algorithm>
#include <cstddef>
#include <whisperlib/base/types.h>
template <class C> class scoped_ptr;
template <class C, class Free> class scoped_ptr_malloc;
template <class C> class scoped_array;
template <class C>
scoped_ptr<C> make_scoped_ptr(C * param);
// A scoped_ptr<T> is like a T*, except that the destructor of scoped_ptr<T>
// automatically deletes the pointer it holds (if any).
// That is, scoped_ptr<T> owns the T object that it points to.
// Like a T*, a scoped_ptr<T> may hold either NULL or a pointer to a T object.
//
// The size of a scoped_ptr is small:
// sizeof(scoped_ptr<C>) == sizeof(C*)
template <class C>
class scoped_ptr {
public:
// The element type
typedef C element_type;
// Constructor. Defaults to intializing with NULL.
// There is no way to create an uninitialized scoped_ptr.
// The input parameter must be allocated with new.
explicit scoped_ptr(C* p = NULL) : ptr_(p) { }
// Destructor. If there is a C object, delete it.
// We don't need to test ptr_ == NULL because C++ does that for us.
~scoped_ptr() {
enum { type_must_be_complete = sizeof(C) };
delete ptr_;
}
// Reset. Deletes the current owned object, if any.
// Then takes ownership of a new object, if given.
// this->reset(this->get()) works.
void reset(C* p = NULL) {
if (p != ptr_) {
enum { type_must_be_complete = sizeof(C) };
delete ptr_;
ptr_ = p;
}
}
// Accessors to get the owned object.
// operator* and operator-> will assert() if there is no current object.
C& operator*() const {
assert(ptr_ != NULL);
return *ptr_;
}
C* operator->() const {
assert(ptr_ != NULL);
return ptr_;
}
C* get() const { return ptr_; }
// Comparison operators.
// These return whether two scoped_ptr refer to the same object, not just to
// two different but equal objects.
bool operator==(C* p) const { return ptr_ == p; }
bool operator!=(C* p) const { return ptr_ != p; }
// Swap two scoped pointers.
void swap(scoped_ptr& p2) {
C* tmp = ptr_;
ptr_ = p2.ptr_;
p2.ptr_ = tmp;
}
// Release a pointer.
// The return value is the current pointer held by this object.
// If this object holds a NULL pointer, the return value is NULL.
// After this operation, this object will hold a NULL pointer,
// and will not own the object any more.
C* release() {
C* retVal = ptr_;
ptr_ = NULL;
return retVal;
}
private:
C* ptr_;
// friend class that can access copy ctor (although if it actually
// calls a copy ctor, there will be a problem) see below
friend scoped_ptr<C> make_scoped_ptr<C>(C *p);
// Forbid comparison of scoped_ptr types. If C2 != C, it totally doesn't
// make sense, and if C2 == C, it still doesn't make sense because you should
// never have the same object owned by two different scoped_ptrs.
template <class C2> bool operator==(scoped_ptr<C2> const& p2) const;
template <class C2> bool operator!=(scoped_ptr<C2> const& p2) const;
DISALLOW_COPY_AND_ASSIGN(scoped_ptr);
};
// Free functions
template <class C>
void swap(scoped_ptr<C>& p1, scoped_ptr<C>& p2) {
p1.swap(p2);
}
template <class C>
bool operator==(C* p1, const scoped_ptr<C>& p2) {
return p1 == p2.get();
}
template <class C>
bool operator!=(C* p1, const scoped_ptr<C>& p2) {
return p1 != p2.get();
}
template <class C>
scoped_ptr<C> make_scoped_ptr(C *p) {
// This does nothing but to return a scoped_ptr of the type that the passed
// pointer is of. (This eliminates the need to specify the name of T when
// making a scoped_ptr that is used anonymously/temporarily.) From an
// access control point of view, we construct an unnamed scoped_ptr here
// which we return and thus copy-construct. Hence, we need to have access
// to scoped_ptr::scoped_ptr(scoped_ptr const &). However, it is guaranteed
// that we never actually call the copy constructor, which is a good thing
// as we would call the temporary's object destructor (and thus delete p)
// if we actually did copy some object, here.
return scoped_ptr<C>(p);
}
// scoped_array<C> is like scoped_ptr<C>, except that the caller must allocate
// with new [] and the destructor deletes objects with delete [].
//
// As with scoped_ptr<C>, a scoped_array<C> either points to an object
// or is NULL. A scoped_array<C> owns the object that it points to.
//
// Size: sizeof(scoped_array<C>) == sizeof(C*)
template <class C>
class scoped_array {
public:
// The element type
typedef C element_type;
// Constructor. Defaults to intializing with NULL.
// There is no way to create an uninitialized scoped_array.
// The input parameter must be allocated with new [].
explicit scoped_array(C* p = NULL) : array_(p) { }
// Destructor. If there is a C object, delete it.
// We don't need to test ptr_ == NULL because C++ does that for us.
~scoped_array() {
enum { type_must_be_complete = sizeof(C) };
delete[] array_;
}
// Reset. Deletes the current owned object, if any.
// Then takes ownership of a new object, if given.
// this->reset(this->get()) works.
void reset(C* p = NULL) {
if (p != array_) {
enum { type_must_be_complete = sizeof(C) };
delete[] array_;
array_ = p;
}
}
// Get one element of the current object.
// Will assert() if there is no current object, or index i is negative.
C& operator[](std::ptrdiff_t i) const {
assert(i >= 0);
assert(array_ != NULL);
return array_[i];
}
// Get a pointer to the zeroth element of the current object.
// If there is no current object, return NULL.
C* get() const {
return array_;
}
// Comparison operators.
// These return whether two scoped_array refer to the same object, not just to
// two different but equal objects.
bool operator==(C* p) const { return array_ == p; }
bool operator!=(C* p) const { return array_ != p; }
// Swap two scoped arrays.
void swap(scoped_array& p2) {
C* tmp = array_;
array_ = p2.array_;
p2.array_ = tmp;
}
// Release an array.
// The return value is the current pointer held by this object.
// If this object holds a NULL pointer, the return value is NULL.
// After this operation, this object will hold a NULL pointer,
// and will not own the object any more.
C* release() {
C* retVal = array_;
array_ = NULL;
return retVal;
}
private:
C* array_;
// Forbid comparison of different scoped_array types.
template <class C2> bool operator==(scoped_array<C2> const& p2) const;
template <class C2> bool operator!=(scoped_array<C2> const& p2) const;
DISALLOW_COPY_AND_ASSIGN(scoped_array);
};
// Free functions
template <class C>
void swap(scoped_array<C>& p1, scoped_array<C>& p2) {
p1.swap(p2);
}
template <class C>
bool operator==(C* p1, const scoped_array<C>& p2) {
return p1 == p2.get();
}
template <class C>
bool operator!=(C* p1, const scoped_array<C>& p2) {
return p1 != p2.get();
}
// This class wraps the c library function free() in a class that can be
// passed as a template argument to scoped_ptr_malloc below.
class ScopedPtrMallocFree {
public:
inline void operator()(void* x) const {
free(x);
}
};
// scoped_ptr_malloc<> is similar to scoped_ptr<>, but it accepts a
// second template argument, the functor used to free the object.
template<class C, class FreeProc = ScopedPtrMallocFree>
class scoped_ptr_malloc {
public:
// The element type
typedef C element_type;
// Constructor. Defaults to intializing with NULL.
// There is no way to create an uninitialized scoped_ptr.
// The input parameter must be allocated with an allocator that matches the
// Free functor. For the default Free functor, this is malloc, calloc, or
// realloc.
explicit scoped_ptr_malloc(C* p = NULL): ptr_(p) {}
// Destructor. If there is a C object, call the Free functor.
~scoped_ptr_malloc() {
free_(ptr_);
}
// Reset. Calls the Free functor on the current owned object, if any.
// Then takes ownership of a new object, if given.
// this->reset(this->get()) works.
void reset(C* p = NULL) {
if (ptr_ != p) {
free_(ptr_);
ptr_ = p;
}
}
// Get the current object.
// operator* and operator-> will cause an assert() failure if there is
// no current object.
C& operator*() const {
assert(ptr_ != NULL);
return *ptr_;
}
C* operator->() const {
assert(ptr_ != NULL);
return ptr_;
}
C* get() const {
return ptr_;
}
// Comparison operators.
// These return whether a scoped_ptr_malloc and a plain pointer refer
// to the same object, not just to two different but equal objects.
// For compatibility wwith the boost-derived implementation, these
// take non-const arguments.
bool operator==(C* p) const {
return ptr_ == p;
}
bool operator!=(C* p) const {
return ptr_ != p;
}
// Swap two scoped pointers.
void swap(scoped_ptr_malloc & b) {
C* tmp = b.ptr_;
b.ptr_ = ptr_;
ptr_ = tmp;
}
// Release a pointer.
// The return value is the current pointer held by this object.
// If this object holds a NULL pointer, the return value is NULL.
// After this operation, this object will hold a NULL pointer,
// and will not own the object any more.
C* release() {
C* tmp = ptr_;
ptr_ = NULL;
return tmp;
}
private:
C* ptr_;
// no reason to use these: each scoped_ptr_malloc should have its own object
template <class C2, class GP>
bool operator==(scoped_ptr_malloc<C2, GP> const& p) const;
template <class C2, class GP>
bool operator!=(scoped_ptr_malloc<C2, GP> const& p) const;
static FreeProc const free_;
DISALLOW_COPY_AND_ASSIGN(scoped_ptr_malloc);
};
template<class C, class FP>
FP const scoped_ptr_malloc<C, FP>::free_ = FP();
template<class C, class FP> inline
void swap(scoped_ptr_malloc<C, FP>& a, scoped_ptr_malloc<C, FP>& b) {
a.swap(b);
}
template<class C, class FP> inline
bool operator==(C* p, const scoped_ptr_malloc<C, FP>& b) {
return p == b.get();
}
template<class C, class FP> inline
bool operator!=(C* p, const scoped_ptr_malloc<C, FP>& b) {
return p != b.get();
}
#endif
| [
"catalin@gmail.com"
] | catalin@gmail.com |
98f4ed151b9ee155afd8b4a18523a9c7dbef94f8 | 75007a01372c3a38096298d2c8c9c4cef1bd8357 | /src/examples/layer1/physics/physics_app.h | d1a5a17545e3427d9a8d750005e236ffd35351a1 | [] | no_license | M-Berkaliyeva/L-System_Plants | 2caff4d94d7fcae8c7fb86bfa8b938d5be0b31d8 | a5a0059840bd78afcb5bfd90460784bc0610247c | refs/heads/master | 2016-09-06T03:33:20.364922 | 2014-01-28T21:42:47 | 2014-01-28T21:42:47 | 16,326,899 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,951 | h | ////////////////////////////////////////////////////////////////////////////////
//
// (C) Andy Thomason 2012, 2013
//
// Modular Framework for OpenGLES2 rendering on multiple platforms.
//
// Physics example: How to use the basics of Bullet physics
//
// Level: 2
//
// Demonstrates:
// Basic framework app
// Shaders
// Basic Matrices
// Stock meshes
// Phong shader
//
namespace octet {
class physics_box {
material *mat;
mesh *box_mesh;
int physics_index;
public:
physics_box() {
}
void init(material *_material, mesh *_box_mesh, int _physics_index) {
mat = _material;
box_mesh = _box_mesh;
physics_index = _physics_index;
}
void render(physics_world &world, bump_shader &shader, const mat4t &worldToCamera, const mat4t &cameraToProjection, vec4 *light_uniforms, int num_light_uniforms, int num_lights) {
mat4t modelToWorld;
world.get_modelToWorld(modelToWorld, physics_index);
mat4t modelToCamera = modelToWorld * worldToCamera;
mat4t modelToProjection = modelToCamera * cameraToProjection;
mat->render(shader, modelToProjection, modelToCamera, light_uniforms, num_light_uniforms, num_lights);
box_mesh->render();
}
void accelerate(physics_world &world, float amount) {
mat4t modelToWorld;
world.get_modelToWorld(modelToWorld, physics_index);
world.apply_impulse(physics_index, modelToWorld[2] * amount);
}
void turn(physics_world &world, float amount) {
mat4t modelToWorld;
world.get_modelToWorld(modelToWorld, physics_index);
world.apply_torque_impulse(physics_index, modelToWorld[1] * amount);
}
void get_modelToWorld(physics_world &world, mat4t &modelToWorld) {
world.get_modelToWorld(modelToWorld, physics_index);
}
};
class physics_app : public octet::app {
// physics world contains matrices and motion state for all objects
physics_world world;
// Matrix to transform points in our camera space to the world.
// This lets us move our camera
mat4t cameraToWorld;
// shader to draw a bump mapped shaded, textured triangle
bump_shader bump_shader_;
// material for boxes
material box_mat;
// mesh for boxes
mesh box_mesh;
// material for boxes
material floor_mat;
// mesh for boxes
mesh floor_mesh;
// storage for boxes
dynarray<physics_box> boxes;
public:
// this is called when we construct the class
physics_app(int argc, char **argv) : app(argc, argv) {
}
// this is called once OpenGL is initialized
void app_init() {
// set up the shader
bump_shader_.init();
// make a mesh to share amoungst all boxes
box_mesh.make_cube(0.5f);
box_mat.make_color(vec4(1, 0, 0, 1), false, false);
float floor_size = 50.0f;
floor_mesh.make_aa_box(floor_size, 0.5f, floor_size);
floor_mat.make_color(vec4(0.3f, 1, 0.1f, 1), true, false);
// make some boxes in the physics world with meshes for drawing.
int num_boxes = 10;
float box_spacing = 1.5f;
boxes.resize(num_boxes+1);
mat4t modelToWorld;
modelToWorld.loadIdentity();
modelToWorld.translate(-0.5f * box_spacing * (num_boxes-1), 4.0f, 0);
for (int i = 0; i != num_boxes; ++i) {
int body = world.add_rigid_body(modelToWorld, vec4(0.5f, 0.5f, 0.5f, 0), true, physics_world::body_box);
boxes[i].init(&box_mat, &box_mesh, body);
modelToWorld.translate(box_spacing, 0, 0);
}
{
modelToWorld.loadIdentity();
modelToWorld.translate(0, -2.0f, 0);
int body = world.add_rigid_body(modelToWorld, vec4(floor_size, 0.5f, floor_size, 0), false, physics_world::body_box);
boxes[num_boxes].init(&floor_mat, &floor_mesh, body);
}
//lights.add_light(vec4(10, 10, 10, 1), vec4(0, 0, 1, 0).normalize(), vec4(0.3f, 0.3f, 0.3f, 1), vec4(1, 1, 1, 1), vec4(1, 1, 1, 1));
}
// this is called to draw the world
void draw_world(int x, int y, int w, int h) {
// set a viewport - includes whole window area
glViewport(x, y, w, h);
// clear the background to gray
glClearColor(0.5f, 0.5f, 0.5f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// allow Z buffer depth testing (closer objects are always drawn in front of far ones)
glEnable(GL_DEPTH_TEST);
// improve draw speed by culling back faces - and avoid flickering edges
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CW);
// set up the matrices with a camera 5 units from the origin
boxes[0].get_modelToWorld(world, cameraToWorld);
cameraToWorld.translate(0, 2, 5);
// flip cameraToWorld around to transform from world to camera
mat4t worldToCamera;
cameraToWorld.invertQuick(worldToCamera);
// build a projection matrix to add perspective
mat4t cameraToProjection;
cameraToProjection.loadIdentity();
float n = 0.125f, f = 256.0f;
cameraToProjection.frustum(-n, n, -n, n, n, f);
// the lights are in camera space
//lights.compute(worldToCamera);
vec4 lights[5];
memset(lights, 0, sizeof(lights));
lights[0] = vec4(0.3f, 0.3f, 0.3f, 50);
lights[2] = vec4(0.707f, 0, 0.707f, 0) * worldToCamera;
lights[3] = vec4(1, 1, 1, 1);
lights[4] = vec4(1, 0, 0, 1);
for (unsigned i = 0; i != boxes.size(); ++i) {
boxes[i].render(world, bump_shader_, worldToCamera, cameraToProjection, lights, 5, 1);
}
if (is_key_down('W')) {
boxes[0].accelerate(world, -0.1f);
}
if (is_key_down('S')) {
boxes[0].accelerate(world, 0.1f);
}
if (is_key_down(key_left)) {
boxes[0].turn(world, 0.01f);
}
if (is_key_down(key_right)) {
boxes[0].turn(world, -0.01f);
}
world.step(0.016f);
}
};
}
| [
"oopsiloverichn@myself.com"
] | oopsiloverichn@myself.com |
0f6d2078eadf9b74604b6303a4c6f3d56d2aef4c | 3de2a746243ad1cb000994a06a0f9699db9a901f | /abc150e.cpp | 3ec0a04ba1446118668593e4434ef3c3cb9c2e5e | [] | no_license | takumi152/atcoder | 71d726ffdf2542d8abac0d9817afaff911db7c6c | ebac94f1227974aa2e6bf372e18605518de46441 | refs/heads/master | 2022-10-30T12:14:41.742596 | 2022-09-29T19:49:32 | 2022-09-29T19:49:32 | 181,502,518 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 855 | cpp | // WIP
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;
typedef pair<int, int> Pii;
const ll mod = 1000000007;
ll modpow(ll a, ll b, ll m = mod) {
ll r = 1;
while (b > 0) {
if (b & 1) r = (r * a) % m;
a = (a * a) % m;
b >>= 1;
}
return r;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<ll> c(n);
for (auto &x: c) cin >> x;
sort(c.begin(), c.end());
ll ans = 0;
for (int i = 0; i < n; i++) {
ans = ((modpow(2, (n-i)-1) * (n + 2)) % mod * c[i]) % mod;
}
ans = (ans + c[n-1]) % mod;
ans = ((ans * modpow(2, n)) % mod * (modpow(2, n) - 1) % mod) % mod;
cout << ans << endl;
return 0;
}
| [
"takumi152@hotmail.com"
] | takumi152@hotmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.