blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 5
140
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 905
values | visit_date
timestamp[us]date 2015-08-09 11:21:18
2023-09-06 10:45:07
| revision_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-17 19:19:19
| committer_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-06 06:22:19
| github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-07 00:51:45
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-03-27 23:40:48
2023-08-21 23:17:38
⌀ | gha_language
stringclasses 141
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
10.4M
| extension
stringclasses 115
values | content
stringlengths 3
10.4M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
158
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fce6e3110223c4db03b5cb78b8b74da934ede1aa | f0c4ebbf54d5aed19df22b760c5b0ce5257829c5 | /shared/platform/iresource.h | 893b6d1c0bd42f6d9ab66e2e4445bcc46c8c18ca | [
"MIT"
] | permissive | proydakov/zeptobird | e85f3c5a2e3eca9b2bb63624d898c83e05f50318 | c9e64aa8bd11e4ed9254bea222b03c6d027b6145 | refs/heads/master | 2021-06-16T02:16:05.766348 | 2021-04-18T12:51:43 | 2021-04-18T12:51:43 | 67,238,634 | 6 | 1 | MIT | 2019-06-16T17:08:31 | 2016-09-02T16:34:38 | C++ | UTF-8 | C++ | false | false | 329 | h | #pragma once
#include <string>
class iresource
{
public:
virtual ~iresource();
virtual std::string get_text_resource(const std::string& name) const = 0;
virtual void save_text_data(const std::string& name, const std::string& data) = 0;
virtual std::string load_text_data(const std::string& name) const = 0;
};
| [
"[email protected]"
] | |
c11c4c22ae4635b804a1277a17dc988e65070eae | 987b43cb95103fe3af35e8756c29aee7f3c7a07c | /include/RE/G/GFxLoadUpdateSync.h | b7f30ba0771192b0d940beab7ca5ae5a44deb951 | [
"MIT"
] | permissive | powerof3/CommonLibSSE | 29e6017c8bae90665db4d30318ee66fd19e6c139 | ff2afeaf5d6f6cac4c5b7cb1caaa2e0d89713393 | refs/heads/dev | 2023-08-31T05:15:02.732037 | 2023-08-21T09:52:55 | 2023-08-21T09:52:55 | 374,565,412 | 38 | 26 | MIT | 2023-09-10T13:09:57 | 2021-06-07T06:55:35 | C++ | UTF-8 | C++ | false | false | 419 | h | #pragma once
#include "RE/G/GFxPlayerStats.h"
#include "RE/G/GMutex.h"
#include "RE/G/GRefCountBase.h"
namespace RE
{
class GFxLoadUpdateSync : public GRefCountBase<GFxLoadUpdateSync, GFxStatMovieData::kGFxStatMD_Other_Mem>
{
public:
~GFxLoadUpdateSync() override; // 00
// members
GMutex mutex; // 10
void* unk38; // 38
void* unk40; // 40
};
static_assert(sizeof(GFxLoadUpdateSync) == 0x48);
}
| [
"Fuzzles"
] | Fuzzles |
2a9c81ed63bb9dce906b2068eca533838b6103c5 | a3cb7bcf1c1bb1faa41b85b90227833dadc95600 | /Base/Application/Game.cpp | bab92b54f30306e937ed8ec1194464e8d44a4feb | [] | no_license | aldafor/TapEngine | 174ff9d62a9575cc266f9c60f0db7e54a0bbd0f3 | 802e5efb964a17c505f0cee9000b2346b3de309b | refs/heads/master | 2020-06-04T03:30:26.929431 | 2013-09-29T20:12:57 | 2013-09-29T20:12:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 530 | cpp | /*
* Game.cpp
*
* Created on: 06/10/2010
* Author: Daniel Conde Linares
*/
#include "Game.h"
namespace BadaGameLib {
Game::Game()
{
// TODO Auto-generated constructor stub
}
Game::~Game()
{
// TODO Auto-generated destructor stub
}
void Game::process(void)
{
// TODO Add physics and interaction code here
}
void Game::render(Graphics::Canvas* currentCanvas)
{
// TODO Add drawing code here
}
Scene* getCurrentScene() {
}
void Game::removeScene()
{
}
void Game::addScene()
{
}
void Game::setScene()
{
}
}
| [
"[email protected]"
] | |
38d5477581181b25e6493971271c6342cac1d78b | 16bb6142d8ec402b8b02315b405ed5786fc627f0 | /src/masternode-sync.h | 08639907d47c463ca107caa711cb622773b759e5 | [
"MIT"
] | permissive | kadilakprv/charycoin | c7fc2c134adfa32ccef375a7bdf499335efd31b0 | b857a4ce7a600b11cf6f7b1888446767548d2c96 | refs/heads/master | 2020-05-04T10:37:38.666309 | 2018-08-21T18:34:49 | 2018-08-21T18:39:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,116 | h | // Copyright (c) 2014-2017 The Dash Core developers
// Copyright (c) 2018 The CharyCoin Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef MASTERNODE_SYNC_H
#define MASTERNODE_SYNC_H
#include "chain.h"
#include "net.h"
#include <univalue.h>
class CMasternodeSync;
static const int MASTERNODE_SYNC_FAILED = -1;
static const int MASTERNODE_SYNC_INITIAL = 0; // sync just started, was reset recently or still in IDB
static const int MASTERNODE_SYNC_WAITING = 1; // waiting after initial to see if we can get more headers/blocks
static const int MASTERNODE_SYNC_LIST = 2;
static const int MASTERNODE_SYNC_MNW = 3;
static const int MASTERNODE_SYNC_GOVERNANCE = 4;
static const int MASTERNODE_SYNC_GOVOBJ = 10;
static const int MASTERNODE_SYNC_GOVOBJ_VOTE = 11;
static const int MASTERNODE_SYNC_FINISHED = 999;
static const int MASTERNODE_SYNC_TICK_SECONDS = 6;
static const int MASTERNODE_SYNC_TIMEOUT_SECONDS = 30; // our blocks are 2.5 minutes so 30 seconds should be fine
static const int MASTERNODE_SYNC_ENOUGH_PEERS = 6;
extern CMasternodeSync masternodeSync;
//
// CMasternodeSync : Sync masternode assets in stages
//
class CMasternodeSync
{
private:
// Keep track of current asset
int nRequestedMasternodeAssets;
// Count peers we've requested the asset from
int nRequestedMasternodeAttempt;
// Time when current masternode asset sync started
int64_t nTimeAssetSyncStarted;
// ... last bumped
int64_t nTimeLastBumped;
// ... or failed
int64_t nTimeLastFailure;
void Fail();
void ClearFulfilledRequests(CConnman& connman);
public:
CMasternodeSync() { Reset(); }
void SendGovernanceSyncRequest(CNode* pnode, CConnman& connman);
bool IsFailed() { return nRequestedMasternodeAssets == MASTERNODE_SYNC_FAILED; }
bool IsBlockchainSynced() { return nRequestedMasternodeAssets > MASTERNODE_SYNC_WAITING; }
bool IsMasternodeListSynced() { return nRequestedMasternodeAssets > MASTERNODE_SYNC_LIST; }
bool IsWinnersListSynced() { return nRequestedMasternodeAssets > MASTERNODE_SYNC_MNW; }
bool IsSynced() { return nRequestedMasternodeAssets == MASTERNODE_SYNC_FINISHED; }
int GetAssetID() { return nRequestedMasternodeAssets; }
int GetAttempt() { return nRequestedMasternodeAttempt; }
void BumpAssetLastTime(std::string strFuncName);
int64_t GetAssetStartTime() { return nTimeAssetSyncStarted; }
std::string GetAssetName();
std::string GetSyncStatus();
void Reset();
void SwitchToNextAsset(CConnman& connman);
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
void ProcessTick(CConnman& connman);
void AcceptedBlockHeader(const CBlockIndex *pindexNew);
void NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman& connman);
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman& connman);
};
#endif
| [
"[email protected]"
] | |
ad6013568d62c63f6800de2b6824160101fed8b2 | 63c5306b91db445016059a7f0c7ac167bf231d3c | /caffe2/operators/sinusoid_position_encoding_op.h | e20ad045468472ee61b77a50d33157a37d6a6d36 | [
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | Fletcher3003/caffe2 | b57ad712993b7c50d16b8f0eedc2e5587bc89e0e | 731096902a090b49612b02cc5a1301c81bf93943 | refs/heads/master | 2020-04-15T18:10:11.514190 | 2019-01-09T17:10:14 | 2019-01-09T17:10:14 | 164,903,847 | 0 | 0 | Apache-2.0 | 2019-01-09T17:02:59 | 2019-01-09T17:02:53 | Shell | UTF-8 | C++ | false | false | 1,837 | h | #ifndef CAFFE2_OPERATORS_SINUSOID_POSITION_ENCODING_OP_H_
#define CAFFE2_OPERATORS_SINUSOID_POSITION_ENCODING_OP_H_
#include "caffe2/core/operator.h"
namespace caffe2 {
template <class Context>
class SinusoidPositionEncodingOp : public Operator<Context> {
public:
SinusoidPositionEncodingOp(const OperatorDef& operator_def, Workspace* ws)
: Operator<Context>(operator_def, ws),
embedding_size_(OperatorBase::template GetSingleArgument<int>(
"embedding_size",
100)),
alpha_(
OperatorBase::template GetSingleArgument<float>("alpha", 10000)) {}
USE_OPERATOR_CONTEXT_FUNCTIONS;
bool RunOnDevice() override {
return DispatchHelper<TensorTypes<int32_t, int64_t>>::call(
this, OperatorBase::Input<TensorCPU>(0));
}
template <typename Index>
bool DoRunWithType() {
auto& positions = Input(0);
auto* output = Output(0);
CAFFE_ENFORCE_EQ(positions.ndim(), 2, "POSITIONS should be a 2-D tensor");
auto shape = positions.dims();
shape.push_back(embedding_size_);
output->Resize(shape);
int N = positions.size();
const Index* idxs = positions.template data<Index>();
float* out = output->template mutable_data<float>();
for (int i = 0; i < N; ++i) {
float pos = (float)idxs[i];
for (int j = 0; j < embedding_size_; ++j) {
float exponent = (float)j / ((float)embedding_size_);
float dim_scale = std::pow(alpha_, exponent);
int loc = i * embedding_size_ + j;
if (j % 2 == 0) {
out[loc] = std::sin(pos / dim_scale);
} else {
out[loc] = std::cos(pos / dim_scale);
}
}
}
return true;
}
protected:
int embedding_size_;
float alpha_;
};
} // namespace caffe2
#endif // CAFFE2_OPERATORS_SINUSOID_POSITION_ENCODING_OP_H_
| [
"[email protected]"
] | |
f0de2a574922dda249d2f7269b19a8478d09c086 | 2b2da3c294d188fa7c2795364ab26859e29ffb87 | /OFSample-Windows/depends/dwinternal/framework2015/dwutility/xml/dwxmlelement.cpp | 97c7c94faa354071835ccccf9aaf37f6c81a0793 | [] | no_license | JocloudSDK/OFSample | 1de97d416402b91276f9992197bc0c64961fb9bd | fa678d674b3886fa8e6a1c4a0ba6b712124e671a | refs/heads/master | 2022-12-28T05:03:05.563734 | 2020-10-19T07:11:55 | 2020-10-19T07:11:55 | 294,078,053 | 4 | 2 | null | null | null | null | GB18030 | C++ | false | false | 10,183 | cpp | #include "stable.h"
#include "dwxmlelement.h"
#include "dwutility.h"
#include "pugixml/pugixml.hpp"
using namespace pugi;
#pragma warning(disable:4355)//关闭在构造函数是使用this的警告
//////////////////////////////////////////////////////////////////////////
class DWXmlElementPrivate
{
public:
DWXmlElementPrivate(xml_node _xmlNode):xmlNode(_xmlNode),bManagered(true){}
DWXmlElementPrivate(const std::wstring &strName,DWXmlElement *pEle):bManagered(false)
{
xmlNode=xmlDoc.append_child(strName.c_str());
DWXmlElement *pEle2=(DWXmlElement *)xmlNode.get_user_data();
delete pEle2;
xmlNode.set_user_data(pEle);
}
~DWXmlElementPrivate(){}
xml_node xmlNode;
xml_document xmlDoc;
std::vector<DWXmlElement *> m_childs; //子节点指针列表
std::vector<DWXmlAttribute> m_attrs; //节点属性列表,用于原有接口提供属性的随机索引
bool bManagered; //结点是由调用都创建的。
};
class DWXmlAttributePrivate
{
public:
DWXmlAttributePrivate(xml_attribute attr):xmlAttr(attr)
{
}
DWXmlAttributePrivate(){}
xml_attribute xmlAttr;
};
class CXmlNodeHook : public xml_node_hook
{
public:
CXmlNodeHook()
{
}
void onNodeCreate(xml_node node)
{
DWXmlElement *pEle=new DWXmlElement(node);
node.set_user_data(pEle);
xml_node parent=node.parent();
if(parent && (parent.type() == node_element))
{
DWXmlElement *pParent=(DWXmlElement*)parent.get_user_data();
pParent->d_ptr->m_childs.push_back(pEle);
}
}
void onNodeDestory(xml_node node)
{
DWXmlElement *pEle = (DWXmlElement *)node.get_user_data();
xml_node parent=node.parent();
if(parent && (parent.type() == node_element))
{
DWXmlElement *pParent=(DWXmlElement*)parent.get_user_data();
std::vector<DWXmlElement*>::iterator it=pParent->d_ptr->m_childs.begin();
while(it!=pParent->d_ptr->m_childs.end())
{
if(*it == pEle)
{
pParent->d_ptr->m_childs.erase(it);
break;
}
it++;
}
}
if(pEle->d_ptr->bManagered)
delete pEle;//内部分配的节点才能自己删除
}
virtual void onFreeUserData(xml_node node) //document destroy释放时调用
{
DWXmlElement *pEle = (DWXmlElement *)node.get_user_data();
if(pEle && pEle->d_ptr->bManagered) delete pEle;
}
void onAttrCreate(xml_node node,xml_attribute attr)
{
DWXmlElement *pEle = (DWXmlElement *)node.get_user_data();
pEle->d_ptr->m_attrs.push_back(DWXmlAttribute(attr));
}
void onAttrDestroy(xml_node node,xml_attribute attr)
{
DWXmlElement *pEle = (DWXmlElement *)node.get_user_data();
std::vector<DWXmlAttribute>::iterator it=pEle->d_ptr->m_attrs.begin();
while(it!=pEle->d_ptr->m_attrs.end())
{
if(it->d_ptr->xmlAttr == attr)
{
pEle->d_ptr->m_attrs.erase(it);
break;
}
it++;
}
}
}xmlHook;
namespace pugi
{
xml_node_hook * g_pNodeHook=&xmlHook;
}
//////////////////////////////////////////////////////////////////////////
DWXmlElement::DWXmlElement(const pugi::xml_node &xmlNode ): d_ptr(new DWXmlElementPrivate(xmlNode))
{
}
DWXmlElement::DWXmlElement( const std::wstring &name ) : d_ptr(new DWXmlElementPrivate(name,this))
{
}
DWXmlElement::~DWXmlElement()
{
DW_SAFE_DELETE(d_ptr);
}
std::wstring DWXmlElement::tag() const
{
Q_D(DWXmlElement);
return d->xmlNode.name();
}
std::wstring DWXmlElement::text() const
{
Q_D(DWXmlElement);
return d->xmlNode.text().get();
}
void DWXmlElement::setText( const std::wstring& text )
{
Q_D(DWXmlElement);
d->xmlNode.text().set(text.c_str());
}
int DWXmlElement::childCount() const
{
Q_D(DWXmlElement);
return d->m_childs.size();
}
const DWXmlElement* DWXmlElement::child( int index ) const
{
Q_D(DWXmlElement);
if(index<0 || index>=(int)d->m_childs.size())
return NULL;
return d->m_childs[index];
}
DWXmlElement * DWXmlElement::addChild(const std::wstring & str)
{
Q_D(DWXmlElement);
xml_node added=d->xmlNode.append_child(str.c_str());
if(added)
{
return (DWXmlElement *)added.get_user_data();
}else
{
return NULL;
}
}
//
void DWXmlElement::addChild( DWXmlElement *child )
{
Q_D(DWXmlElement);
DW_ASSERT(child != NULL);
xml_node source = child->d_ptr->xmlNode;
xml_node dest=d->xmlNode.append_child(source.name());
DW_ASSERT(!!dest);
DWXmlElement * pXmlDest = (DWXmlElement *)dest.get_user_data();
d->m_childs.pop_back();
d->m_childs.push_back(child);
//copy value
dest.text().set(source.text().get());
//copy attributes
for (xml_attribute a = source.first_attribute(); a; a = a.next_attribute())
dest.append_attribute(a.name()).set_value(a.value());
dest.set_user_data(child);
child->d_ptr->xmlNode = dest;
child->d_ptr->m_attrs = pXmlDest->d_ptr->m_attrs;
child->d_ptr->bManagered = true;//将结点的属性设置为接受doc管理
delete pXmlDest;
source.set_user_data(NULL);
//深度优先递归插入新child树上的结点
std::vector<DWXmlElement*> childs=child->d_ptr->m_childs;
child->d_ptr->m_childs.clear();
for(UINT i=0;i<childs.size();i++)
{
DWXmlElement * p=childs[i];
DW_ASSERT(p!=NULL);
child->addChild(p);
}
child->d_ptr->xmlDoc.reset();
}
const wchar_t* DWXmlElement::attribute2(const wchar_t* attrName) const
{
Q_D(const DWXmlElement);
return d->xmlNode.attribute(attrName).value();
}
std::wstring DWXmlElement::attribute( const std::wstring &attrName ) const
{
Q_D(const DWXmlElement);
return d->xmlNode.attribute(attrName.c_str()).value();
}
std::wstring DWXmlElement::attribute( int index ) const
{
Q_D(const DWXmlElement);
if(index<0 || index>= (int)d->m_attrs.size()) return L"";
return d->m_attrs[index].value();
}
std::wstring DWXmlElement::attributeName( int index ) const
{
Q_D(const DWXmlElement);
if(index<0 || index>= (int)d->m_attrs.size()) return L"";
return d->m_attrs[index].name();
}
void DWXmlElement::setAttribute( const std::wstring &attrName, const std::wstring &attrValue )
{
Q_D(DWXmlElement);
xml_attribute attr=d->xmlNode.attribute(attrName.c_str());
if(!attr) attr=d->xmlNode.append_attribute(attrName.c_str());
attr.set_value(attrValue.c_str());
}
void DWXmlElement::removeAttribute(const std::wstring &attrName)
{
Q_D(DWXmlElement);
d->xmlNode.remove_attribute(attrName.c_str());
}
DWXmlElement * DWXmlElement::elementByName( const std::wstring &name ) const
{
Q_D(const DWXmlElement);
return (DWXmlElement*)(d->xmlNode.child(name.c_str()).get_user_data());
}
std::wstring DWXmlElement::operator[]( const std::wstring &attrName ) const
{
return attribute(attrName);
}
const DWXmlElement* DWXmlElement::operator[]( int index ) const
{
return child(index);
}
int DWXmlElement::attributeCount() const
{
Q_D(DWXmlElement);
return d->m_attrs.size();
}
void DWXmlElement::deleteChild(const DWXmlElement *child)
{
Q_D(DWXmlElement);
if(!child) return;
xml_node node=child->d_ptr->xmlNode;
d->xmlNode.remove_child(node);
}
bool DWXmlElement::isEmpty() const
{
Q_D(DWXmlElement);
return d->xmlNode?false:true;
}
class DWXmlNodeWalker: public xml_tree_walker
{
public:
DWXmlNodeWalker(DWXmlElement::PCB_XMLTRAVERSE _fnCB,void * _pCtx):fnCb(_fnCB),pCtx(_pCtx)
{
}
protected:
virtual bool for_each(xml_node& node){
if(!fnCb) return false;
return fnCb((DWXmlElement *)(node.get_user_data()),pCtx);
}
DWXmlElement::PCB_XMLTRAVERSE fnCb;
void *pCtx;
};
void DWXmlElement::traverse( PCB_XMLTRAVERSE fnTraverse,void *pCtx )
{
Q_D(DWXmlElement);
DWXmlNodeWalker walker(fnTraverse,pCtx);
d->xmlNode.traverse(walker);
}
bool DWXmlElement::saveToStream( std::wstring &xmlStream ) const
{
Q_D(DWXmlElement);
xmlStream.clear();
xml_writer_string write(xmlStream);
xmlStream=L"<?xml version=\"1.0\"?>\n"; //强制加入XML声明,保持与老版本兼容
d->xmlNode.print(write,L"\t",format_default|format_no_declaration,encoding_utf16);
return true;
}
DWXmlAttribute DWXmlElement::attr( const std::wstring &attrName ) const
{
Q_D(DWXmlElement);
return DWXmlAttribute(d->xmlNode.attribute(attrName.c_str()));
}
DWXmlAttribute DWXmlElement::firstAttr() const
{
Q_D(DWXmlElement);
return DWXmlAttribute(d->xmlNode.first_attribute());
}
DWXmlAttribute DWXmlElement::lastAttr() const
{
Q_D(DWXmlElement);
return DWXmlAttribute(d->xmlNode.last_attribute());
}
DWXmlAttribute DWXmlElement::appendAttr( const std::wstring & name )
{
Q_D(DWXmlElement);
return DWXmlAttribute(d->xmlNode.append_attribute(name.c_str()));
}
DWXmlAttribute DWXmlElement::prependAttr( const std::wstring & name )
{
Q_D(DWXmlElement);
return DWXmlAttribute(d->xmlNode.prepend_attribute(name.c_str()));
}
DWXmlAttribute DWXmlElement::insertAttrAfter( const std::wstring & name, const DWXmlAttribute& attr )
{
Q_D(DWXmlElement);
return DWXmlAttribute(d->xmlNode.insert_attribute_after(name.c_str(),attr.d_ptr->xmlAttr));
}
DWXmlAttribute DWXmlElement::insertAttrBefore( const std::wstring & name, const DWXmlAttribute& attr )
{
Q_D(DWXmlElement);
return DWXmlAttribute(d->xmlNode.insert_attribute_before(name.c_str(),attr.d_ptr->xmlAttr));
}
//////////////////////////////////////////////////////////////////////////
DWXmlAttribute::DWXmlAttribute():d_ptr(new DWXmlAttributePrivate)
{
}
DWXmlAttribute::DWXmlAttribute( pugi::xml_attribute attr ):d_ptr(new DWXmlAttributePrivate(attr))
{
}
DWXmlAttribute::DWXmlAttribute( const DWXmlAttribute & src ):d_ptr(new DWXmlAttributePrivate(src.d_ptr->xmlAttr))
{
}
DWXmlAttribute::~DWXmlAttribute()
{
delete d_ptr;
}
bool DWXmlAttribute::isEmpty() const
{
Q_D(DWXmlAttribute);
return d->xmlAttr.empty();
}
const std::wstring DWXmlAttribute::name() const
{
Q_D(DWXmlAttribute);
return d->xmlAttr.name();
}
const std::wstring DWXmlAttribute::value() const
{
Q_D(DWXmlAttribute);
return d->xmlAttr.value();
}
DWXmlAttribute DWXmlAttribute::nextAttribute() const
{
Q_D(DWXmlAttribute);
return DWXmlAttribute(d->xmlAttr.next_attribute());
}
DWXmlAttribute DWXmlAttribute::prevAttribute() const
{
Q_D(DWXmlAttribute);
return DWXmlAttribute(d->xmlAttr.previous_attribute());
}
void DWXmlAttribute::set( std::wstring value )
{
Q_D(DWXmlAttribute);
d->xmlAttr.set_value(value.c_str());
}
DWXmlAttribute& DWXmlAttribute::operator=( const DWXmlAttribute & src )
{
d_ptr->xmlAttr=src.d_ptr->xmlAttr;
return *this;
}
| [
"[email protected]"
] | |
b3fc9c7dcf9d08152b8715b9f0bf91d1ce96a64c | 1e0bad222183c5ab8fbc2992d8cd61c2804f1f6f | /MFCTest/Stopwatch.h | c63c83d3ccbde475e6a7888005e2358f4b96fb82 | [] | no_license | Flowsaiba/HashLib | e71bb6dfdde134fdff3caba74a98a9342b2c95a4 | 42b19574c3851b12ae666b6848bf790bb4f44442 | refs/heads/master | 2023-03-15T11:09:07.876788 | 2018-08-08T00:52:57 | 2018-08-08T00:52:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,561 | h |
#pragma once
namespace MFCTest
{
class Stopwatch
{
private:
LARGE_INTEGER start;
LARGE_INTEGER stop;
LARGE_INTEGER frequency;
bool started;
bool stopped;
public:
Stopwatch(bool autoStart = true)
{
start.QuadPart = 0;
stop.QuadPart = 0;
started = false;
stopped = false;
QueryPerformanceFrequency(&frequency);
if (autoStart)
Start();
}
void Start()
{
if (started)
AfxThrowNotSupportedException();
started = true;
stopped = false;
QueryPerformanceCounter(&start);
}
void Stop()
{
if (!started)
AfxThrowNotSupportedException();
QueryPerformanceCounter(&stop);
started = false;
stopped = true;
}
double GetElapsedMilliseconds()
{
if (!started && !stopped)
AfxThrowNotSupportedException();
if (!stopped)
QueryPerformanceCounter(&stop);
return (double)(stop.QuadPart - start.QuadPart) * 1000.0 / (double)frequency.QuadPart;
}
void Restart()
{
Stop();
Start();
}
};
} | [
"[email protected]"
] | |
535114e3cb41c7c92379b3bdfdefebfd711eef3e | 38c10c01007624cd2056884f25e0d6ab85442194 | /extensions/renderer/script_context_set_unittest.cc | 756c94290f5fbae105d32f9b0f36cb947f05c9ac | [
"BSD-3-Clause"
] | permissive | zenoalbisser/chromium | 6ecf37b6c030c84f1b26282bc4ef95769c62a9b2 | e71f21b9b4b9b839f5093301974a45545dad2691 | refs/heads/master | 2022-12-25T14:23:18.568575 | 2016-07-14T21:49:52 | 2016-07-23T08:02:51 | 63,980,627 | 0 | 2 | BSD-3-Clause | 2022-12-12T12:43:41 | 2016-07-22T20:14:04 | null | UTF-8 | C++ | false | false | 2,169 | cc | // Copyright 2014 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 <vector>
#include "base/message_loop/message_loop.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/features/feature.h"
#include "extensions/renderer/scoped_web_frame.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/script_context_set.h"
#include "gin/public/context_holder.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "v8/include/v8.h"
namespace extensions {
TEST(ScriptContextSetTest, Lifecycle) {
base::MessageLoop loop;
ScopedWebFrame web_frame;
// Do this after construction of the webview, since it may construct the
// Isolate.
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> v8_context = v8::Context::New(isolate);
v8::Context::Scope context_scope(v8_context);
// ScriptContext relies on gin, it just doesn't look like it from here.
gin::ContextHolder context_holder(isolate);
context_holder.SetContext(v8_context);
ExtensionIdSet active_extensions;
ScriptContextSet context_set(&active_extensions);
ScriptContext* context = context_set.Register(
web_frame.frame(), v8_context, 0, 0); // no extension group or world ID
// Context is valid and resembles correctness.
EXPECT_TRUE(context->is_valid());
EXPECT_EQ(web_frame.frame(), context->web_frame());
EXPECT_EQ(v8_context, context->v8_context());
// Context has been correctly added.
EXPECT_EQ(1u, context_set.size());
EXPECT_EQ(context, context_set.GetByV8Context(v8_context));
// Test context is correctly removed.
context_set.Remove(context);
EXPECT_EQ(0u, context_set.size());
EXPECT_EQ(nullptr, context_set.GetByV8Context(v8_context));
// After removal, the context should be marked for destruction.
EXPECT_FALSE(context->is_valid());
// Run loop to do the actual deletion.
loop.RunUntilIdle();
}
} // namespace extensions
| [
"[email protected]"
] | |
bb36cad1354aa0736082d2120c66615bec1ae0d7 | ab1c643f224197ca8c44ebd562953f0984df321e | /snapin/filemgmt/dataobj.cpp | 0ec7c472bb32cf2b61864b7daa3af8750886bc63 | [] | no_license | KernelPanic-OpenSource/Win2K3_NT_admin | e162e0452fb2067f0675745f2273d5c569798709 | d36e522f16bd866384bec440517f954a1a5c4a4d | refs/heads/master | 2023-04-12T13:25:45.807158 | 2021-04-13T16:33:59 | 2021-04-13T16:33:59 | 357,613,696 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 24,196 | cpp | // DataObj.cpp : Implementation of data object classes
#include "stdafx.h"
#include "compdata.h"
#include "safetemp.h"
#include "macros.h"
USE_HANDLE_MACROS("FILEMGMT(dataobj.cpp)")
#include "FileSvc.h" // FileServiceProvider
#include "dataobj.h"
#include "smb.h"
#include "sfm.h"
#include "cmponent.h" // for COLNUM_SESSIONS_COMPUTERNAME
#define DONT_WANT_SHELLDEBUG
#include "shlobjp.h" // ILFree, ILGetSize, ILClone, etc.
#include <comstrm.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "stddtobj.cpp"
// IDataObject interface implementation
HRESULT CFileMgmtDataObject::GetDataHere(
FORMATETC __RPC_FAR *pFormatEtcIn,
STGMEDIUM __RPC_FAR *pMedium)
{
MFC_TRY;
const CLIPFORMAT cf=pFormatEtcIn->cfFormat;
if (cf == m_CFInternal)
{
CFileMgmtDataObject *pThis = this;
stream_ptr s(pMedium);
return s.Write(&pThis, sizeof(CFileMgmtDataObject*));
}
else if (cf == m_CFSnapInCLSID)
{
stream_ptr s(pMedium);
return s.Write(&m_SnapInCLSID, sizeof(GUID));
}
if (!m_MultiSelectObjList.empty())
{
//
// this is the multiselect data object, we don't support other clipformats in GetDataHere().
//
return DV_E_FORMATETC;
}
if (cf == m_CFNodeType)
{
const GUID* pguid = GetObjectTypeGUID( m_objecttype );
stream_ptr s(pMedium);
return s.Write(pguid, sizeof(GUID));
}
else if (cf == m_CFNodeTypeString)
{
const BSTR strGUID = GetObjectTypeString( m_objecttype );
stream_ptr s(pMedium);
return s.Write(strGUID);
}
else if (cf == m_CFDisplayName)
{
return PutDisplayName(pMedium);
}
else if (cf == m_CFDataObjectType)
{
stream_ptr s(pMedium);
return s.Write(&m_dataobjecttype, sizeof(m_dataobjecttype));
}
else if (cf == m_CFMachineName)
{
stream_ptr s(pMedium);
return s.Write(m_strMachineName);
}
else if (cf == m_CFTransport)
{
FILEMGMT_TRANSPORT transport = FILEMGMT_OTHER;
HRESULT hr = m_pcookie->GetTransport( &transport );
if ( FAILED(hr) )
return hr;
stream_ptr s(pMedium);
return s.Write(&transport, sizeof(DWORD));
}
else if (cf == m_CFShareName)
{
ASSERT( NULL != m_pcookie );
CString strShareName;
HRESULT hr = m_pcookie->GetShareName( strShareName );
if ( FAILED(hr) )
return hr;
stream_ptr s(pMedium);
return s.Write(strShareName);
}
else if (cf == m_CFSessionClientName)
{
ASSERT( NULL != m_pcookie );
CString strSessionClientName;
HRESULT hr = m_pcookie->GetSessionClientName( strSessionClientName );
if ( FAILED(hr) )
return hr;
stream_ptr s(pMedium);
return s.Write(strSessionClientName);
}
else if (cf == m_CFSessionUserName)
{
ASSERT( NULL != m_pcookie );
CString strSessionUserName;
HRESULT hr = m_pcookie->GetSessionUserName( strSessionUserName );
if ( FAILED(hr) )
return hr;
stream_ptr s(pMedium);
return s.Write(strSessionUserName);
}
else if (cf == m_CFSessionID)
{
DWORD dwSessionID = 0;
HRESULT hr = m_pcookie->GetSessionID( &dwSessionID );
if ( FAILED(hr) )
return hr;
stream_ptr s(pMedium);
return s.Write(&dwSessionID, sizeof(DWORD));
}
else if (cf == m_CFFileID)
{
DWORD dwFileID = 0;
HRESULT hr = m_pcookie->GetFileID( &dwFileID );
if ( FAILED(hr) )
return hr;
stream_ptr s(pMedium);
return s.Write(&dwFileID, sizeof(DWORD));
}
else if (cf == m_CFServiceName)
{
ASSERT( NULL != m_pcookie );
CString strServiceName;
HRESULT hr = m_pcookie->GetServiceName( strServiceName );
if ( FAILED(hr) )
return hr;
stream_ptr s(pMedium);
return s.Write(strServiceName);
}
else if (cf == m_CFServiceDisplayName)
{
ASSERT( NULL != m_pcookie );
CString strServiceDisplayName;
HRESULT hr = m_pcookie->GetServiceDisplayName( strServiceDisplayName );
if ( FAILED(hr) )
return hr;
stream_ptr s(pMedium);
return s.Write(strServiceDisplayName);
}
else if (cf == m_CFRawCookie)
{
stream_ptr s(pMedium);
return s.Write((PBYTE)&m_pcookie, sizeof(m_pcookie));
}
else if (cf == m_CFSnapinPreloads) // added JonN 01/19/00
{
stream_ptr s(pMedium);
BOOL bPreload = TRUE;
return s.Write((PBYTE)&bPreload, sizeof(BOOL));
}
return DV_E_FORMATETC;
MFC_CATCH;
}
HRESULT CFileMgmtDataObject::Initialize( CFileMgmtCookie* pcookie,
CFileMgmtComponentData& refComponentData,
DATA_OBJECT_TYPES type )
{
if (NULL == pcookie)
{
ASSERT(FALSE);
return E_UNEXPECTED;
}
m_pComponentData = &refComponentData;
((IComponentData*) m_pComponentData)->AddRef ();
m_objecttype = pcookie->QueryObjectType();
m_fAllowOverrideMachineName = refComponentData.m_fAllowOverrideMachineName;
#ifdef SNAPIN_PROTOTYPER
if (m_objecttype != FILEMGMT_PROTOTYPER_LEAF)
m_strMachineName = pcookie->QueryTargetServer();
#else
m_strMachineName = pcookie->QueryTargetServer();
#endif
m_dataobjecttype = type;
m_pcookie = pcookie;
m_pcookie->AddRefCookie();
VERIFY( SUCCEEDED(refComponentData.GetClassID(&m_SnapInCLSID)) );
return S_OK;
}
CFileMgmtDataObject::~CFileMgmtDataObject()
{
FreeMultiSelectObjList();
if (NULL != m_pcookie)
{
m_pcookie->ReleaseCookie();
}
if ( m_pComponentData )
((IComponentData*) m_pComponentData)->Release ();
}
/////////////////////////////////////////////////////////////////////
// CFileMgmtDataObject::IDataObject::GetData()
//
// Write data into the storage medium.
// The data will be retrieved by the Send Console Message snapin.
//
//
HRESULT CFileMgmtDataObject::GetData(
FORMATETC __RPC_FAR * pFormatEtcIn,
STGMEDIUM __RPC_FAR * pMedium)
{
ASSERT(pFormatEtcIn != NULL);
ASSERT(pMedium != NULL);
HRESULT hResult = S_OK;
const CLIPFORMAT cf = pFormatEtcIn->cfFormat;
if (!m_MultiSelectObjList.empty())
{
//
// This is the multiselect dataobject.
//
if (cf == m_CFObjectTypesInMultiSelect)
{
//
// We will provide the list of object types of all the currently selected items here.
// MMC will use this format to determine extensions snapins
//
UINT nMultiSelectedObjects = m_MultiSelectObjList.size();
// Calculate the size of SMMCObjectTypes.
int cb = sizeof(DWORD) + sizeof(SMMCObjectTypes) * nMultiSelectedObjects;
//Fill out parameters
pMedium->tymed = TYMED_HGLOBAL;
pMedium->hGlobal = ::GlobalAlloc(GMEM_SHARE|GMEM_MOVEABLE, cb);
if (pMedium->hGlobal == NULL)
return STG_E_MEDIUMFULL;
SMMCObjectTypes* pMMCDO = reinterpret_cast<SMMCObjectTypes*>(::GlobalLock(pMedium->hGlobal));
pMMCDO->count = 0;
GUID *pMMCDOGuid = pMMCDO->guid;
for (CDataObjectList::iterator i = m_MultiSelectObjList.begin(); i != m_MultiSelectObjList.end(); i++)
{
CCookie* pbasecookie = NULL;
hResult = ExtractData(*i, CFileMgmtDataObject::m_CFRawCookie, &pbasecookie, sizeof(pbasecookie));
if (FAILED(hResult))
break;
pbasecookie = m_pComponentData->ActiveBaseCookie( pbasecookie );
CFileMgmtCookie* pUseThisCookie = dynamic_cast<CFileMgmtCookie*>(pbasecookie);
FileMgmtObjectType objecttype = pUseThisCookie->QueryObjectType();
const GUID* pguid = GetObjectTypeGUID(objecttype);
memcpy(pMMCDOGuid++, pguid, sizeof(GUID));
pMMCDO->count++;
}
::GlobalUnlock(pMedium->hGlobal);
if (FAILED(hResult))
{
::GlobalFree(pMedium->hGlobal);
pMedium->hGlobal = NULL;
}
} else
hResult = DV_E_FORMATETC;
return hResult;
}
if (cf == m_cfSendConsoleMessageRecipients)
{
ASSERT (m_pComponentData);
if ( m_pComponentData )
{
// I suppose it doesn't matter what type this cookie is because we
// are just using to hang enumerated session cookies off of, as long
// as it's not an abstract class.
BOOL fContinue = TRUE;
HRESULT hr = S_OK;
CSmbSessionCookie* pCookie = new CSmbSessionCookie[1];
if ( pCookie )
{
CSmbCookieBlock cookieBlock (pCookie, 1, (LPCTSTR) m_strMachineName, 0);
CBaseCookieBlock* pCookieBlock = 0;
//
// JonN 6/28/01 426224
// Shared Folder: Send Message access denied error title needs to be changed for localization
//
AFX_MANAGE_STATE(AfxGetStaticModuleState()); // required for CWaitCursor
// Enumerate all the session cookies
for (INT iTransport = FILEMGMT_FIRST_TRANSPORT;
fContinue && iTransport < FILEMGMT_NUM_TRANSPORTS;
iTransport++ )
{
hr = m_pComponentData->GetFileServiceProvider(iTransport)->EnumerateSessions(
NULL, &pCookie[0], false);
fContinue = SUCCEEDED(hr);
}
// Enumerate all the computer names from the session cookies and store them in
// the computerList
CStringList computerList;
size_t len = 0; // number of WCHARS
while ( !pCookie[0].m_listResultCookieBlocks.IsEmpty () )
{
pCookieBlock = pCookie[0].m_listResultCookieBlocks.RemoveHead ();
ASSERT (pCookieBlock);
if ( !pCookieBlock )
break;
int nCookies = pCookieBlock->QueryNumCookies ();
while (nCookies--)
{
CCookie* pBaseCookie = pCookieBlock->QueryBaseCookie (nCookies);
ASSERT (pBaseCookie);
if ( pBaseCookie )
{
CFileMgmtCookie* pFMCookie = dynamic_cast <CFileMgmtCookie*> (pBaseCookie);
ASSERT (pFMCookie);
if ( pFMCookie )
{
computerList.AddHead (pFMCookie->QueryResultColumnText (
COLNUM_SESSIONS_COMPUTERNAME, *m_pComponentData));
len += computerList.GetHead ().GetLength () + 1; // to account for NULL
}
}
}
pCookieBlock->Release ();
}
if ( !m_strMachineName.IsEmpty () )
{
computerList.AddHead (m_strMachineName);
len += computerList.GetHead ().GetLength () + 1; // to account for NULL
}
// Run through all the computer names in computerList and add them to the output buffer
//
// Write the list of recipients to the storage medium.
// - The list of recipients is a group of UNICODE strings
// terminated by TWO null characters.c
// - Allocated memory must include BOTH null characters.
//
len += 1; // to account for extra NULL at end.
WCHAR* pgrszRecipients = new WCHAR[len];
WCHAR* ptr = pgrszRecipients;
CString computerName;
if ( pgrszRecipients )
{
::ZeroMemory (pgrszRecipients, len * sizeof (WCHAR));
while ( !computerList.IsEmpty () )
{
computerName = computerList.RemoveHead ();
// append computer name
wcscpy (ptr, (LPCTSTR) computerName);
// skip past computer name and terminating NULL
ptr += computerName.GetLength () + 1;
}
// Add the name of this computer
HGLOBAL hGlobal = ::GlobalAlloc (GMEM_FIXED, len * sizeof (WCHAR));
if ( hGlobal )
{
memcpy (OUT hGlobal, pgrszRecipients, len * sizeof (WCHAR));
pMedium->hGlobal = hGlobal;
}
else
hResult = E_OUTOFMEMORY;
delete [] pgrszRecipients;
}
else
hResult = E_OUTOFMEMORY;
// pCookie deleted in destructor of cookieBlock
}
else
hResult = E_OUTOFMEMORY;
}
else
hResult = E_UNEXPECTED;
}
else if (cf == m_CFIDList)
{
LPITEMIDLIST pidl = NULL, pidlR = NULL;
hResult = m_pcookie->GetSharePIDList( &pidl );
if (SUCCEEDED(hResult))
{
pidlR = ILClone(ILFindLastID(pidl)); // relative IDList
ILRemoveLastID(pidl); // folder IDList
int cidl = 1;
UINT offset = sizeof(CIDA) + sizeof(UINT)*cidl;
UINT cbFolder = ILGetSize(pidl);
UINT cbRelative = ILGetSize(pidlR);
UINT cbTotal = offset + cbFolder + cbRelative;
HGLOBAL hGlobal = ::GlobalAlloc (GPTR, cbTotal);
if ( hGlobal )
{
LPIDA pida = (LPIDA)hGlobal;
pida->cidl = cidl;
pida->aoffset[0] = offset;
MoveMemory(((LPBYTE)hGlobal+offset), pidl, cbFolder);
offset += cbFolder;
pida->aoffset[1] = offset;
MoveMemory(((LPBYTE)hGlobal+offset), pidlR, cbRelative);
pMedium->hGlobal = hGlobal;
}
else
hResult = E_OUTOFMEMORY;
// free pidl & pidlR
if (pidl)
ILFree(pidl);
if (pidlR)
ILFree(pidlR);
} else
hResult = DV_E_FORMATETC;
} else if (cf == m_CFNodeID2)
{
if (m_objecttype != FILEMGMT_ROOT &&
m_objecttype != FILEMGMT_SHARES &&
m_objecttype != FILEMGMT_SESSIONS &&
m_objecttype != FILEMGMT_RESOURCES &&
m_objecttype != FILEMGMT_SERVICES)
{
hResult = DV_E_FORMATETC;
} else
{
const BSTR strGUID = GetObjectTypeString( m_objecttype );
// JonN 12/11/01 502856
int cbString = (lstrlen(strGUID) + 1) * sizeof(TCHAR);
pMedium->tymed = TYMED_HGLOBAL;
pMedium->hGlobal = ::GlobalAlloc(GMEM_SHARE|GMEM_MOVEABLE,
sizeof(SNodeID2) + cbString);
if (!(pMedium->hGlobal))
{
hResult = E_OUTOFMEMORY;
} else
{
SNodeID2 *pNodeID = (SNodeID2 *)GlobalLock(pMedium->hGlobal);
if (!pNodeID)
{
hResult = HRESULT_FROM_WIN32(GetLastError());
GlobalFree(pMedium->hGlobal);
pMedium->hGlobal = NULL;
} else
{
pNodeID->dwFlags = 0;
pNodeID->cBytes = cbString;
CopyMemory(pNodeID->id, strGUID, cbString);
GlobalUnlock(pMedium->hGlobal);
}
}
}
} else
hResult = DV_E_FORMATETC; // Invalid/unknown clipboard format
return hResult;
} // CMyComputerDataObject::GetData()
HRESULT CFileMgmtDataObject::PutDisplayName(STGMEDIUM* pMedium)
// Writes the "friendly name" to the provided storage medium
// Returns the result of the write operation
{
if ( !IsAutonomousObjectType(m_objecttype) )
{
ASSERT(FALSE);
return DV_E_FORMATETC;
}
CString strDisplayName;
BOOL fStaticNode = ( NULL != m_pComponentData
&& !m_pComponentData->IsExtensionSnapin()
&& m_pComponentData->QueryRootCookie().QueryObjectType()
== m_objecttype);
// will only succeed for scope cookies
m_pcookie->GetDisplayName( strDisplayName, fStaticNode );
// LoadStringPrintf(nStringId, OUT &strDisplayName, (LPCTSTR)m_strMachineName);
stream_ptr s(pMedium);
return s.Write(strDisplayName);
}
void CFileMgmtDataObject::FreeMultiSelectObjList()
{
if (!m_MultiSelectObjList.empty())
{
for (CDataObjectList::iterator i = m_MultiSelectObjList.begin(); i != m_MultiSelectObjList.end(); i++)
{
CComObject<CFileMgmtDataObject>* pDataObject = reinterpret_cast<CComObject<CFileMgmtDataObject>*>(*i);
delete pDataObject;
}
m_MultiSelectObjList.clear();
}
}
HRESULT CFileMgmtDataObject::InitMultiSelectDataObjects(CFileMgmtComponentData& refComponentData)
{
FreeMultiSelectObjList();
ASSERT(!m_pComponentData);
m_pComponentData = &refComponentData;
((IComponentData*) m_pComponentData)->AddRef ();
VERIFY( SUCCEEDED(refComponentData.GetClassID(&m_SnapInCLSID)) );
return S_OK;
}
HRESULT CFileMgmtDataObject::AddMultiSelectDataObjects(CFileMgmtCookie* pCookie, DATA_OBJECT_TYPES type)
{
HRESULT hr = S_OK;
CComObject<CFileMgmtDataObject>* pDataObject = NULL;
hr = CComObject<CFileMgmtDataObject>::CreateInstance(&pDataObject);
if (SUCCEEDED(hr))
hr = pDataObject->Initialize(pCookie, *m_pComponentData, type );
IDataObject *piDataObject = NULL;
if (SUCCEEDED(hr))
hr = pDataObject->QueryInterface(IID_IDataObject, reinterpret_cast<void**>(&piDataObject));
if (SUCCEEDED(hr))
{
m_MultiSelectObjList.push_back(piDataObject);
} else
{
delete pDataObject;
}
return hr;
}
// Register the clipboard formats
CLIPFORMAT CFileMgmtDataObject::m_CFSnapinPreloads =
(CLIPFORMAT)RegisterClipboardFormat(CCF_SNAPIN_PRELOADS);
CLIPFORMAT CFileMgmtDataObject::m_CFDisplayName =
(CLIPFORMAT)RegisterClipboardFormat(CCF_DISPLAY_NAME);
CLIPFORMAT CFileMgmtDataObject::m_CFNodeID2 =
(CLIPFORMAT)RegisterClipboardFormat(CCF_NODEID2);
CLIPFORMAT CFileMgmtDataObject::m_CFTransport =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_TRANSPORT");
CLIPFORMAT CFileMgmtDataObject::m_CFMachineName =
(CLIPFORMAT)RegisterClipboardFormat(L"MMC_SNAPIN_MACHINE_NAME");
CLIPFORMAT CFileMgmtDataObject::m_CFShareName =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_SHARE_NAME");
CLIPFORMAT CFileMgmtDataObject::m_CFSessionClientName =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_SESSION_CLIENT_NAME");
CLIPFORMAT CFileMgmtDataObject::m_CFSessionUserName =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_SESSION_USER_NAME");
CLIPFORMAT CFileMgmtDataObject::m_CFSessionID =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_SESSION_ID");
CLIPFORMAT CFileMgmtDataObject::m_CFFileID =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_FILE_ID");
CLIPFORMAT CFileMgmtDataObject::m_CFServiceName =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_SERVICE_NAME");
CLIPFORMAT CFileMgmtDataObject::m_CFServiceDisplayName =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_SERVICE_DISPLAYNAME");
CLIPFORMAT CDataObject::m_CFRawCookie =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_RAW_COOKIE");
// Additional clipboard formats for the Send Console Message snapin
CLIPFORMAT CFileMgmtDataObject::m_cfSendConsoleMessageRecipients =
(CLIPFORMAT)RegisterClipboardFormat(_T("mmc.sendcmsg.MessageRecipients"));
// Additional clipboard formats for the Security Page
CLIPFORMAT CFileMgmtDataObject::m_CFIDList =
(CLIPFORMAT)RegisterClipboardFormat(CFSTR_SHELLIDLIST);
CLIPFORMAT CFileMgmtDataObject::m_CFObjectTypesInMultiSelect =
(CLIPFORMAT)RegisterClipboardFormat(CCF_OBJECT_TYPES_IN_MULTI_SELECT);
CLIPFORMAT CFileMgmtDataObject::m_CFMultiSelectDataObject =
(CLIPFORMAT)RegisterClipboardFormat(CCF_MMC_MULTISELECT_DATAOBJECT);
CLIPFORMAT CFileMgmtDataObject::m_CFMultiSelectSnapins =
(CLIPFORMAT)RegisterClipboardFormat(CCF_MULTI_SELECT_SNAPINS);
CLIPFORMAT CFileMgmtDataObject::m_CFInternal =
(CLIPFORMAT)RegisterClipboardFormat(L"FILEMGMT_SNAPIN_INTERNAL");
STDMETHODIMP CFileMgmtComponentData::QueryDataObject(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT* ppDataObject)
{
MFC_TRY;
// WARNING cookie cast
CCookie* pbasecookie = reinterpret_cast<CCookie*>(cookie);
CFileMgmtCookie* pUseThisCookie = ActiveCookie((CFileMgmtCookie*)pbasecookie);
ASSERT( IsValidObjectType(pUseThisCookie->QueryObjectType()) );
CComObject<CFileMgmtDataObject>* pDataObject = NULL;
HRESULT hRes = CComObject<CFileMgmtDataObject>::CreateInstance(&pDataObject);
if ( FAILED(hRes) )
return hRes;
HRESULT hr = pDataObject->Initialize( pUseThisCookie, *this, type );
if ( SUCCEEDED(hr) )
{
hr = pDataObject->QueryInterface(IID_IDataObject,
reinterpret_cast<void**>(ppDataObject));
}
if ( FAILED(hr) )
{
delete pDataObject;
return hr;
}
return hr;
MFC_CATCH;
}
/////////////////////////////////////////////////////////////////////
// FileMgmtObjectTypeFromIDataObject()
//
// Find the objecttype of a IDataObject pointer. The purpose
// of this routine is to combine ExtractObjectTypeGUID() and
// CheckObjectTypeGUID() into a single function.
//
// Return the FILEMGMT_* node type (enum FileMgmtObjectType).
//
// HISTORY
// 30-Jul-97 t-danm Creation.
//
FileMgmtObjectType
FileMgmtObjectTypeFromIDataObject(IN LPDATAOBJECT lpDataObject)
{
ASSERT(lpDataObject != NULL);
GUID guidObjectType = GUID_NULL; // JonN 11/21/00 PREFIX 226042
HRESULT hr = ExtractObjectTypeGUID( IN lpDataObject, OUT &guidObjectType );
ASSERT( SUCCEEDED(hr) );
return (FileMgmtObjectType)CheckObjectTypeGUID(IN &guidObjectType );
} // FileMgmtObjectTypeFromIDataObject()
HRESULT ExtractBaseCookie(
IN LPDATAOBJECT piDataObject,
OUT CCookie** ppcookie,
OUT FileMgmtObjectType* pobjecttype )
{
HRESULT hr = ExtractData( piDataObject,
CFileMgmtDataObject::m_CFRawCookie,
(PBYTE)ppcookie,
sizeof(CCookie*) );
if ( SUCCEEDED(hr) && NULL != pobjecttype )
{
*pobjecttype = FileMgmtObjectTypeFromIDataObject(piDataObject);
}
return hr;
}
BOOL IsMultiSelectObject(LPDATAOBJECT piDataObject)
{
BOOL bMultiSelectObject = FALSE;
if (piDataObject)
{
//
// return TRUE if piDataObject is the composite data object (MMC_MS_DO) created by MMC.
//
STGMEDIUM stgmedium = {TYMED_HGLOBAL, NULL, NULL};
FORMATETC formatetc = {CFileMgmtDataObject::m_CFMultiSelectDataObject,
NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
HRESULT hr = piDataObject->GetData(&formatetc, &stgmedium);
if (S_OK == hr && stgmedium.hGlobal)
{
DWORD* pdwData = reinterpret_cast<DWORD*>(::GlobalLock(stgmedium.hGlobal));
bMultiSelectObject = (1 == *pdwData);
::GlobalUnlock(stgmedium.hGlobal);
::GlobalFree(stgmedium.hGlobal);
}
}
return bMultiSelectObject;
}
| [
"[email protected]"
] | |
05b31d8cb297eb3d7d88239886dcac195fc73c74 | 48461badfdba98eb7fb5e659cf0b311645794bff | /cw/SymCode.h | cfd16663e0861e70643cc30bb2700c1bf1534ceb | [] | no_license | IvanShish/DSAProjects | 72ba6cca5da6be835bf39b26bf952016bad062e0 | 823a49db5bc90fd98da180862fa88e17eabb6c1e | refs/heads/main | 2023-04-01T04:04:38.508624 | 2021-04-03T20:24:48 | 2021-04-03T20:24:48 | 354,384,589 | 0 | 0 | null | 2021-04-03T20:23:49 | 2021-04-03T20:09:06 | C++ | WINDOWS-1251 | C++ | false | false | 2,316 | h | #ifndef SymCode_h
#define SymCode_h
#include <string>
#include <vector>
class Sym {
private:
struct elem {
char c; // символ
string code; // статический код
elem() {
c = '\0';
code = "00000000";
}
};
int num = 0; // длина вектора arr
vector <elem> arr; // вектор хранит символы и их коды
public:
//--------------------------------------- задает код символу
string code(char c) {
int i = 0;
int n = ++num;
int j;
elem a;
a.c = c;
for (i = 0; n > 0; i++) { // код символа задается как его индекс
// в векторе arr в двоичной системе
j = n % 2;
n /= 2;
if (j)
a.code[i] = '1';
}
arr.push_back(a);
return a.code;
}
//--------------------------------------- записывает в файл символы и их коды
void writeFile(ofstream& file) {
int i;
for (i = 0; i < num; i++) {
file << arr[i].code << " " << arr[i].c << endl;
}
}
//--------------------------------------- считывает из фала символы и их коды
int readFile(ifstream& file) {
char sym;
elem a;
while (!file.eof()) { //производится считывание ключей
char tmp = NULL; //для считывания ненужных символов
string codee; //считывание кода символа
file.get(sym);
if (sym == '\n') {
file.get(sym);
if (sym != ' ') break;
else sym = '\n';
}
else file.get(tmp);
file >> codee;
if (!isdigit(codee[0])) return 1;
file.get(tmp);
a.code = codee;
a.c = sym;
num++;
arr.push_back(a);
}
return 0;
}
//--------------------------------------- находит символ по коду
char whatSym(string code) {
int i;
for (i = 0; i < num; i++) {
if (arr[i].code == code)
return arr[i].c;
}
return '\0';
}
//--------------------------------------- печатает коды символов
void print_Codes(ofstream & out) {
int i = 0;
while (i < num) {
out << arr[i].c << " " << arr[i].code << endl;
i++;
}
}
};
#endif | [
"[email protected]"
] | |
02877c307e87e82535d8a2b10865becc22f0f00f | 93fd5f604959d63a976aabda42ed80d65587693f | /QDSoftRender/Device.h | 4dd0ae328bedbb7cdf57601582ae2da1a550d0c2 | [] | no_license | qilinlee/QDSoftRender | 0070611a8246bec6862138d7c71be92a4245d6f8 | ce9c050e5542b893ad45d62d19724b8f228cbb5c | refs/heads/master | 2021-01-10T04:44:55.660527 | 2016-02-13T11:24:57 | 2016-02-13T11:24:57 | 43,470,313 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,209 | h | #pragma once
#ifndef __DEVICE_H__
#define __DEVICE_H__
#include <memory>
#include "Color.h"
#include "Error.h"
namespace QDSoftRender
{
enum DeviceClearFlag
{
CLEAR_COLOR = 1,
CLEAR_ZBUFFER = 2,
CLEAR_ALL = CLEAR_COLOR | CLEAR_ZBUFFER,
};
enum DeviceState
{
DEVST_UNKNOWN = 0,
DEVST_IDLE = 1,
DEVST_DRAWING = 2,
};
class Device;
typedef std::shared_ptr<Device> DeviceSP;
class Device
{
public:
static DeviceSP CreateDevice(int iWidth, int iHeight,ColorDataType color,unsigned long dwBackColor);
static void DestroyDevice(DeviceSP device);
~Device();
void Clear(DeviceClearFlag flag);
void Present(unsigned char *pCanvas);
void BeginDraw();
void EndDraw();
friend void DrawPixel(DeviceSP spDevice, int iX, int iY, Color color);
private:
Device(int iWidth,int iHeight,ColorDataType color,unsigned long dwBackColor = 0xFFFFFFFF);
Device(const Device &src);
Device& operator=(const Device &src);
private:
static DeviceSP _Instance;
int m_iWidth;
int m_iHeight;
int m_iPitch;
ColorDataType m_eColorType;
unsigned int *m_pFrameBuffer;
float *m_pZBuffer;
Color m_BackColor;
DeviceState m_eDevState;
Error m_objLastError;
};
}
#endif | [
"[email protected]"
] | |
9c8e02fd86d5324b219960d0305e3072347084b4 | ec63a3d5ca2c8603e80c71e9babb5834f61a19b4 | /lib/99-operator/monoid/MonoidRangeMinPointUpdate.cpp | e5e0e1fb14a1b9637908e43ad0f81b6f6b60c821 | [] | no_license | ningenMe/compro-library | 9d105722bac44340582c5783e6c7d600112ab93f | 3e12cedbfbf0b966d099807c1894eeead56e8756 | refs/heads/master | 2023-08-08T05:05:07.177278 | 2023-07-30T17:45:38 | 2023-07-30T17:45:38 | 248,217,524 | 5 | 1 | null | 2021-09-21T00:35:23 | 2020-03-18T11:50:27 | C++ | UTF-8 | C++ | false | false | 536 | cpp | /*
* @title MonoidRangeMinPointUpdate - [区間min, 点更新]
* @docs md/operator/monoid/MonoidRangeMinPointUpdate.md
*/
template<class T> struct MonoidRangeMinPointUpdate {
using TypeNode = T;
inline static constexpr TypeNode unit_node = (1LL<<31)-1;
inline static constexpr TypeNode func_fold(TypeNode l,TypeNode r){return min(l,r);}
inline static constexpr TypeNode func_operate(TypeNode l,TypeNode r){return r;}
inline static constexpr bool func_check(TypeNode nodeVal,TypeNode var){return var > nodeVal;}
}; | [
"[email protected]"
] | |
1b0c9574aa252e35b2ce71526e0282e5fcd60b69 | 94a88c9cb36803c36eeff0fad57689e5fe76cab1 | /Qt/NLP_CHEN/my_theta.h | 0e884e6af260457ea48fc2f1c55fc13d245ef7b1 | [] | no_license | YFCbingyi/test_own | c5e38842765831dcc6c45e3181f370083877fc7f | 8b5461deceeb0b64ef8b571796a017ee532be429 | refs/heads/master | 2021-07-19T19:15:56.742920 | 2020-10-29T02:32:49 | 2020-10-29T02:32:49 | 225,312,122 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 422 | h | #ifndef MY_THETA_H
#define MY_THETA_H
#include "testbase.h"
class my_theta : public TestBase
{
public:
my_theta();
void test();
void LineAngle1();
void LineAngle2();
private:
typedef struct
{
double X;
double Y;
}point;
typedef struct
{
point A;
point B;
double deg;
}line;
line lineA;
line lineB;
};
#endif // MY_THETA_H
| [
"“[email protected]”"
] | |
9278b524b08199c1b316fcbc7e500708b3336459 | 15838d58cf92f120591b1717f5c7cc1c103ec15a | /breastPhantom.hxx | 5d4da9e4cf51327db0128aa035b94d522c5b7a8f | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | ChristianGraff/breastPhantom | dd13a5e0db1a4416f1e55f4bd04c8dd8705a506b | 370336f312074a8f90a37dfb51cee1a7e9bc517e | refs/heads/master | 2020-06-22T05:40:52.643140 | 2019-03-28T15:12:07 | 2019-03-28T15:12:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,604 | hxx | /*! \file breastPhantom.hxx
* \brief breastPhantom main header file
* \author Christian G. Graff
* \version 1.0
* \date 2018
*
* \copyright To the extent possible under law, the author(s) have
* dedicated all copyright and related and neighboring rights to this
* software to the public domain worldwide. This software is
* distributed without any warranty. You should have received a copy
* of the CC0 Public Domain Dedication along with this software.
* If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*
*/
#ifndef BREASTPHANTOM_HXX_
#define BREASTPHANTOM_HXX_
#ifndef __IOS__
#define __IOS__
#include <iostream>
#endif
#ifndef __CSDTINT__
#define __CSTDINT__
#include <cstdint>
#endif
#include <math.h>
#include <unistd.h>
#include <sys/stat.h>
// debug
#include <time.h>
#include <zlib.h>
#ifndef __OMP__
#define __OMP__
#include <omp.h>
#endif
#include "perlinNoise.hxx"
#include "createDuct.hxx"
#include "createArtery.hxx"
#include "createVein.hxx"
// vtk stuff
#include <vtkVersion.h>
#ifndef __VTKSMARTPOINTER__
#define __VTKSMARTPOINTER__
#include <vtkSmartPointer.h>
#endif
#ifndef __VTKMATH__
#define __VTKMATH__
#include <vtkMath.h>
#endif
#include <vtkPolyData.h>
#include <vtkCleanPolyData.h>
#include <vtkVertexGlyphFilter.h>
#include <vtkPolyDataNormals.h>
#include <vtkGeometryFilter.h>
#include <vtkDecimatePro.h>
#include <vtkTIFFWriter.h>
#include <vtkFloatArray.h>
#include <vtkCellArray.h>
#include <vtkPointData.h>
#include <vtkSortDataArray.h>
#include <vtkParametricSpline.h>
#include <vtkProperty.h>
#include <vtkTransform.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkSmoothPolyDataFilter.h>
#include <vtkSurfaceReconstructionFilter.h>
#include <vtkContourFilter.h>
#include <vtkReverseSense.h>
#ifndef __VTKIMAGEDATA__
#define __VTKIMAGEDATA__
#include <vtkImageData.h>
#endif
#include <vtkFillHolesFilter.h>
#include <vtkCellLocator.h>
#include <vtkXMLPolyDataWriter.h>
#ifndef __VTKIMAGEDATAWRITER__
#define __VTKIMAGEDATAWRITER__
#include <vtkXMLImageDataWriter.h>
#endif
#ifndef __VTKIMAGEDATAREADER__
#define __VTKIMAGEDATAREADER__
#include <vtkXMLImageDataReader.h>
#endif
#include <vtkMetaImageWriter.h>
#include <vtkPointLocator.h>
#include <vtkOctreePointLocator.h>
#include <vtkMinimalStandardRandomSequence.h>
#ifndef __VTKVECTOR__
#define __VTKVECTOR__
#include <vtkVector.h>
#endif
// number of fat lobule Fourier perturbation coefficients
#define NUMCOEFF 3
#ifndef __TISSUESTRUCT__
#define __TISSUESTRUCT__
#include "tissueStruct.hxx"
#endif
#endif /* BREASTPHANTOM_HXX_ */
| [
"[email protected]"
] | |
81354084274d786097672bc4479532336a12cde6 | 1a751dc75e80f0b3d64e7a9d7277b0f233dee6c9 | /src/mtl/refcnt_ptr.h | cce49d1e68e1f93ae91cf3e7658a60103815fe08 | [] | no_license | EmanueleCannizzaro/felyx | c53f3a0511b260749ca39fa19ac5539061150b2c | bf8e40415bce8105bef626304853f0dd7ebcf145 | refs/heads/master | 2020-04-02T22:54:58.728252 | 2016-08-06T09:39:27 | 2016-08-06T09:39:27 | 65,073,658 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,117 | h | // -*- c++ -*-
//
// $Id: refcnt_ptr.h,v 1.1.1.1 2004/12/13 17:55:20 okoenigl Exp $
//
// Copyright 1997, 1998, 1999 University of Notre Dame.
// Authors: Andrew Lumsdaine, Jeremy G. Siek, Lie-Quan Lee
//
// This file is part of the Matrix Template Library
//
// You should have received a copy of the License Agreement for the
// Matrix Template Library along with the software; see the
// file LICENSE. If not, contact Office of Research, University of Notre
// Dame, Notre Dame, IN 46556.
//
// Permission to modify the code and to distribute modified code is
// granted, provided the text of this NOTICE is retained, a notice that
// the code was modified is included with the above COPYRIGHT NOTICE and
// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
// file is distributed with the modified code.
//
// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
// By way of example, but not limitation, Licensor MAKES NO
// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
// OR OTHER RIGHTS.
//
#ifndef MTL_REFCNT_PTR_H
#define MTL_REFCNT_PTR_H
#include "mtl/mtl_config.h"
#include "mtl/mtl_exception.h"
namespace mtl {
template <class Object>
class refcnt_ptr {
typedef refcnt_ptr<Object> self;
public:
inline refcnt_ptr() : object(0), count(0) { }
inline refcnt_ptr(Object* c)
: object(c), count(0) {
if ( object )
count = new int(1);
}
//: object(c), count(new int(1)) { }
inline refcnt_ptr(const self& x) : object(x.object), count(x.count) {
inc();
}
inline ~refcnt_ptr() { dec(); }
inline self& operator=(Object* c) {
if (object) dec();
object = c;
count = new int(1);
return *this;
}
inline self& operator=(const self& x) {
if (this == &x)
return *this;
if (object) dec();
object = x.object;
count = x.count;
inc();
return *this;
}
inline Object& operator*() MTL_THROW_ASSERTION {
MTL_ASSERT(count != 0, "refcnt_ptr::operator*()");
MTL_ASSERT(*count >= 0, "refcnt_ptr::operator*()");
return *object;
}
inline const Object& operator*() const MTL_THROW_ASSERTION {
MTL_ASSERT(count != 0, "const refcnt_ptr::operator*()");
MTL_ASSERT(*count >= 0, "const refcnt_ptr::operator*()");
return *object;
}
inline Object* operator->() MTL_THROW_ASSERTION {
MTL_ASSERT(count != 0, "refcnt_ptr::operator->()");
MTL_ASSERT(*count >= 0, "refcnt_ptr::operator->()");
return object;
}
inline const Object* operator->() const MTL_THROW_ASSERTION {
MTL_ASSERT(count != 0, "const refcnt_ptr::operator->()");
MTL_ASSERT(*count >= 0, "const refcnt_ptr::operator->()");
return object;
}
inline void inc() { if (count) (*count)++; }
inline void dec() {
if (count) {
(*count)--;
if (*count <= 0) {
delete object;
delete count;
}
}
}
protected:
Object* object;
int* count;
};
} /* namespace mtl */
#endif
| [
"[email protected]"
] | |
873e8f4fc5c602742d2c7f025a47c2c5cf1b0bcd | 73935c1814a8fe260167d4aa1b01d39de72f5c0f | /src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp | a3534558544320ad7e03875d0e56408ed5fd5e07 | [] | no_license | planee/Mop-548 | e794ed978237f355efa813c2be8f8fb14d1907dc | a852cc0be53fcc2951b51452e3ebaa9f1d7d7397 | refs/heads/master | 2022-12-23T01:08:51.566255 | 2020-09-25T03:55:52 | 2020-09-25T03:55:52 | 298,549,776 | 1 | 7 | null | 2020-09-25T11:10:28 | 2020-09-25T11:10:27 | null | UTF-8 | C++ | false | false | 28,931 | cpp | #include "ScriptPCH.h"
#include "dragon_soul.h"
#define MAX_ENCOUNTER 8
enum Spells
{
SPELL_TWILIGHT_SHIFT = 106368,
SPELL_HEROIC_WILL_AOE = 105554,
SPELL_HEROIC_WILL = 106108,
SPELL_LAST_DEFENDER_OF_AZEROTH_DRUID = 106224,
SPELL_LAST_DEFENDER_OF_AZEROTH_PALADIN = 106226,
SPELL_LAST_DEFENDER_OF_AZEROTH_DK = 106227,
SPELL_LAST_DEFENDER_OF_AZEROTH_WARRIOR = 106080,
SPELL_LAST_DEFENDER_OF_AZEROTH_MONK = 129873,
SPELL_GIFT_OF_LIVE_AURA = 105896,
SPELL_ESSENCE_OF_DREAMS_AURA = 105900,
SPELL_YSERA_PRESENCE = 106456,
SPELL_YSERA_PRESENCE_AURA = 106457,
SPELL_THE_DREAMER = 106463,
SPELL_ENTER_THE_DREAM = 106464,
SPELL_SOURCE_OF_MAGIC_AURA = 105903,
SPELL_TIMELOOP = 105984,
SPELL_DREAM = 106466,
};
class instance_dragon_soul : public InstanceMapScript
{
public:
instance_dragon_soul() : InstanceMapScript("instance_dragon_soul", 967) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_dragon_soul_InstanceMapScript(map);
}
struct instance_dragon_soul_InstanceMapScript : public InstanceScript
{
instance_dragon_soul_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetBossNumber(MAX_ENCOUNTER);
uiMorchokGUID = 0;
uiKohcromGUID = 0;
uiYorsahjGUID = 0;
uiZonozzGUID = 0;
uiHagaraGUID = 0;
uiUltraxionGUID = 0;
uiBlackhornGUID = 0;
uiAllianceShipGUID = 0;
uiSwayzeGUID = 0;
uiReevsGUID = 0;
uiDeckGUID = 0;
uiMaelstormGUID = 0;
uiDeathwingGUID = 0;
uiAlexstraszaDragonGUID = 0;
uiNozdormuDragonGUID = 0;
uiYseraDragonGUID = 0;
uiKalecgosDragonGUID = 0;
uiTrallMaelstrom = 0;
memset(uiLesserCacheofTheAspects, 0, sizeof(uiLesserCacheofTheAspects));
memset(uiBackPlates, 0, sizeof(uiBackPlates));
memset(uiGreaterCacheofTheAspects, 0, sizeof(uiGreaterCacheofTheAspects));
memset(uiElementiumFragment, 0, sizeof(uiElementiumFragment));
bHagaraEvent = 0;
isHeroicFailed = 0;
}
void OnPlayerEnter(Player* pPlayer)
{
if (!uiTeamInInstance)
uiTeamInInstance = pPlayer->GetTeam();
if (InstanceScript* pInstance = pPlayer->GetInstanceScript())
if (pInstance->GetBossState(BOSS_ULTRAXION) != DONE)
{
StartEventWyrmrest(pPlayer, NPC_HARBRINGER_OF_TWILIGHT);
StartEventWyrmrest(pPlayer, NPC_HARBRINGER_OF_DESTRUCTION);
StartEventWyrmrest(pPlayer, NPC_FORCE_OF_DESTRUCTION);
StartEventWyrmrest(pPlayer, NPC_PORTENT_OF_TWILIGHT);
StartEventWyrmrest(pPlayer, NPC_ARCANE_WARDEN);
StartEventWyrmrest(pPlayer, NPC_CHAMPION_OF_MAGIC);
StartEventWyrmrest(pPlayer, NPC_CHAMPION_OF_LIFE);
StartEventWyrmrest(pPlayer, NPC_CHAMPION_OF_TIME);
StartEventWyrmrest(pPlayer, NPC_CHAMPION_OF_EMERALD_DREAM);
StartEventWyrmrest(pPlayer, NPC_DEATHWING_TOWER);
}
if (InstanceScript* pInstance = pPlayer->GetInstanceScript())
if (pInstance->GetBossState(DATA_ZONOZZ) != IN_PROGRESS || pInstance->GetBossState(DATA_YORSAHJ) != IN_PROGRESS)
{
std::list<Creature*> portalEternity;
std::list<Creature*> portalBase;
GetCreatureListWithEntryInGrid(portalEternity, pPlayer, NPC_TRAVEL_TO_EYE_OF_ETERNITY, 2000.0f);
GetCreatureListWithEntryInGrid(portalBase, pPlayer, NPC_TRAVEL_TO_WYRMREST_BASE, 2000.0f);
if (portalEternity.empty())
return;
if (portalBase.empty())
return;
for (std::list<Creature*>::iterator itr = portalEternity.begin(); itr != portalEternity.end(); ++itr)
{
(*itr)->RemoveAura(SPELL_TELEPORT_VISUAL_DISABLED);
(*itr)->CastSpell((*itr), SPELL_TELEPORT_VISUAL_ACTIVE, true);
}
for (std::list<Creature*>::iterator itr = portalBase.begin(); itr != portalBase.end(); ++itr)
{
(*itr)->RemoveAura(SPELL_TELEPORT_VISUAL_DISABLED);
(*itr)->CastSpell((*itr), SPELL_TELEPORT_VISUAL_ACTIVE, true);
}
}
if (pPlayer->HasSpell(SPELL_DREAM))
pPlayer->removeSpell(SPELL_DREAM, false, false);
RemoveEncounterAuras();
}
void OnCreatureCreate(Creature* pCreature)
{
switch (pCreature->GetEntry())
{
case NPC_MORCHOK:
uiMorchokGUID = pCreature->GetGUID();
break;
case NPC_KOHCROM:
uiKohcromGUID = pCreature->GetGUID();
break;
case NPC_YORSAHJ:
uiYorsahjGUID = pCreature->GetGUID();
break;
case NPC_ZONOZZ:
uiZonozzGUID = pCreature->GetGUID();
break;
case NPC_HAGARA:
uiHagaraGUID = pCreature->GetGUID();
break;
case NPC_ULTRAXION:
uiUltraxionGUID = pCreature->GetGUID();
break;
case NPC_BLACKHORN:
uiBlackhornGUID = pCreature->GetGUID();
break;
case NPC_SKY_CAPTAIN_SWAYZE:
if (pCreature->GetPositionZ() > 200.0f)
{
uiSwayzeGUID = pCreature->GetGUID();
if (GetBossState(DATA_ULTRAXION) == DONE)
pCreature->SetVisible(true);
else
pCreature->SetVisible(false);
}
break;
case NPC_KAANU_REEVS:
if (pCreature->GetPositionZ() > 200.0f)
{
uiReevsGUID = pCreature->GetGUID();
if (GetBossState(DATA_ULTRAXION) == DONE)
pCreature->SetVisible(true);
else
pCreature->SetVisible(false);
}
break;
case NPC_DEATHWING:
uiDeathwingGUID = pCreature->GetGUID();
break;
case NPC_ALEXSTRASZA_DRAGON:
uiAlexstraszaDragonGUID = pCreature->GetGUID();
break;
case NPC_NOZDORMU_DRAGON:
uiNozdormuDragonGUID = pCreature->GetGUID();
break;
case NPC_YSERA_DRAGON:
uiYseraDragonGUID = pCreature->GetGUID();
break;
case NPC_KALECGOS_DRAGON:
uiKalecgosDragonGUID = pCreature->GetGUID();
break;
case NPC_THRALL_2:
uiTrallMaelstrom = pCreature->GetGUID();
break;
case NPC_TRAVEL_TO_WYRMREST_TEMPLE:
case NPC_TRAVEL_TO_EYE_OF_ETERNITY:
case NPC_TRAVEL_TO_WYRMREST_BASE:
case NPC_TRAVEL_TO_WYRMREST_SUMMIT:
teleportGUIDs.push_back(pCreature->GetGUID());
break;
case NPC_TRAVEL_TO_DECK:
if (GetBossState(DATA_BLACKHORN) == DONE)
pCreature->SetVisible(true);
else
pCreature->SetVisible(false);
uiDeckGUID = pCreature->GetGUID();
teleportGUIDs.push_back(pCreature->GetGUID());
break;
case NPC_TRAVEL_TO_MAELSTORM:
if (GetBossState(DATA_SPINE) == DONE)
pCreature->SetVisible(true);
else
pCreature->SetVisible(false);
uiMaelstormGUID = pCreature->GetGUID();
teleportGUIDs.push_back(pCreature->GetGUID());
break;
default:
break;
}
}
void OnCreatureRemove(Creature* pCreature)
{
switch (pCreature->GetEntry())
{
case NPC_ULTRAXION:
uiUltraxionGUID = 0;
break;
case NPC_BLACKHORN:
uiBlackhornGUID = 0;
break;
case NPC_DEATHWING:
uiDeathwingGUID = 0;
break;
case NPC_ALEXSTRASZA_DRAGON:
uiAlexstraszaDragonGUID = 0;
break;
case NPC_NOZDORMU_DRAGON:
uiNozdormuDragonGUID = 0;
break;
case NPC_YSERA_DRAGON:
uiYseraDragonGUID = 0;
break;
case NPC_KALECGOS_DRAGON:
uiKalecgosDragonGUID = 0;
break;
}
}
void OnGameObjectCreate(GameObject* pGo)
{
switch (pGo->GetEntry())
{
case GO_LESSER_CACHE_OF_THE_ASPECTS_10N:
uiLesserCacheofTheAspects[0] = pGo->GetGUID();
break;
case GO_LESSER_CACHE_OF_THE_ASPECTS_25N:
uiLesserCacheofTheAspects[1] = pGo->GetGUID();
break;
case GO_LESSER_CACHE_OF_THE_ASPECTS_10H:
uiLesserCacheofTheAspects[2] = pGo->GetGUID();
break;
case GO_LESSER_CACHE_OF_THE_ASPECTS_25H:
uiLesserCacheofTheAspects[3] = pGo->GetGUID();
break;
case GO_ALLIANCE_SHIP:
uiAllianceShipGUID = pGo->GetGUID();
if (GetBossState(DATA_ULTRAXION) == DONE)
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
pGo->UpdateObjectVisibility();
break;
case GO_DEATHWING_BACK_PLATE_1:
uiBackPlates[0] = pGo->GetGUID();
break;
case GO_DEATHWING_BACK_PLATE_2:
uiBackPlates[1] = pGo->GetGUID();
break;
case GO_DEATHWING_BACK_PLATE_3:
uiBackPlates[2] = pGo->GetGUID();
break;
case GO_GREATER_CACHE_OF_THE_ASPECTS_10N:
uiGreaterCacheofTheAspects[0] = pGo->GetGUID();
break;
case GO_GREATER_CACHE_OF_THE_ASPECTS_25N:
uiGreaterCacheofTheAspects[1] = pGo->GetGUID();
break;
case GO_GREATER_CACHE_OF_THE_ASPECTS_10H:
uiGreaterCacheofTheAspects[2] = pGo->GetGUID();
break;
case GO_GREATER_CACHE_OF_THE_ASPECTS_25H:
uiGreaterCacheofTheAspects[3] = pGo->GetGUID();
break;
case GO_ELEMENTIUM_FRAGMENT_10N:
uiElementiumFragment[0] = pGo->GetGUID();
break;
case GO_ELEMENTIUM_FRAGMENT_25N:
uiElementiumFragment[1] = pGo->GetGUID();
break;
case GO_ELEMENTIUM_FRAGMENT_10H:
uiElementiumFragment[2] = pGo->GetGUID();
break;
case GO_ELEMENTIUM_FRAGMENT_25H:
uiElementiumFragment[3] = pGo->GetGUID();
break;
default:
break;
}
}
uint64 GetData64(uint32 type)
{
switch (type)
{
case DATA_MORCHOK: return uiMorchokGUID;
case DATA_KOHCROM: return uiKohcromGUID;
case DATA_YORSAHJ: return uiYorsahjGUID;
case DATA_ZONOZZ: return uiZonozzGUID;
case DATA_HAGARA: return uiHagaraGUID;
case DATA_ULTRAXION: return uiUltraxionGUID;
case DATA_BLACKHORN: return uiBlackhornGUID;
case DATA_LESSER_CACHE_10N: return uiLesserCacheofTheAspects[0];
case DATA_LESSER_CACHE_25N: return uiLesserCacheofTheAspects[1];
case DATA_LESSER_CACHE_10H: return uiLesserCacheofTheAspects[2];
case DATA_LESSER_CACHE_25H: return uiLesserCacheofTheAspects[3];
case DATA_SWAYZE: return uiSwayzeGUID;
case DATA_REEVS: return uiReevsGUID;
case DATA_DEATHWING: return uiDeathwingGUID;
case DATA_ALEXSTRASZA_DRAGON: return uiAlexstraszaDragonGUID;
case DATA_NOZDORMU_DRAGON: return uiNozdormuDragonGUID;
case DATA_YSERA_DRAGON: return uiYseraDragonGUID;
case DATA_KALECGOS_DRAGON: return uiKalecgosDragonGUID;
case DATA_TRALL_MAELSTROM: return uiTrallMaelstrom;
case DATA_ALLIANCE_SHIP: return uiAllianceShipGUID;
case DATA_BACK_PLATE_1: return uiBackPlates[0];
case DATA_BACK_PLATE_2: return uiBackPlates[1];
case DATA_BACK_PLATE_3: return uiBackPlates[2];
case DATA_GREATER_CACHE_10N: return uiGreaterCacheofTheAspects[0];
case DATA_GREATER_CACHE_25N: return uiGreaterCacheofTheAspects[1];
case DATA_GREATER_CACHE_10H: return uiGreaterCacheofTheAspects[2];
case DATA_GREATER_CACHE_25H: return uiGreaterCacheofTheAspects[3];
case DATA_ELEMENTIUM_FRAGMENT_10N: return uiElementiumFragment[0];
case DATA_ELEMENTIUM_FRAGMENT_25N: return uiElementiumFragment[1];
case DATA_ELEMENTIUM_FRAGMENT_10H: return uiElementiumFragment[2];
case DATA_ELEMENTIUM_FRAGMENT_25H: return uiElementiumFragment[3];
default: return 0;
}
return 0;
}
void SetData(uint32 type, uint32 data)
{
if (type == DATA_HAGARA_EVENT)
{
bHagaraEvent = data;
SaveToDB();
}
switch (type)
{
case DATA_MORCHOK:
switch (data)
{
case NOT_STARTED:
case IN_PROGRESS:
case FAIL:
case DONE:
break;
}
MorchokEvent = data;
break;
}
}
uint32 GetData(uint32 type)
{
if (type == DATA_MORCHOK)
return MorchokEvent;
if (type == DATA_HAGARA_EVENT)
return bHagaraEvent;
else if (type == DATA_ALL_HEROIC)
return (isHeroicFailed == 0) ? true : false;
return 0;
}
bool SetBossState(uint32 type, EncounterState state)
{
if (!InstanceScript::SetBossState(type, state))
return false;
switch (type)
{
case BOSS_MORCHOK:
if (state == NOT_STARTED)
{
}
break;
case BOSS_WARLORD:
case BOSS_UNSLEEPING:
case BOSS_HAGARA:
case BOSS_WARMASTER:
case BOSS_DEATHWING:
case BOSS_ULTRAXION:
case DATA_PORTALS_ON_OFF:
break;
}
if (type == DATA_BLACKHORN)
if (Creature* pDeck = instance->GetCreature(uiDeckGUID))
pDeck->SetVisible(state == DONE ? true : false);
if (type == DATA_SPINE)
if (Creature* pMaelstorm = instance->GetCreature(uiMaelstormGUID))
pMaelstorm->SetVisible(state == DONE ? true : false);
if (state == DONE)
if (!instance->IsHeroic())
{
isHeroicFailed = 1;
SaveToDB();
}
// visual state of teleporters
if (state == IN_PROGRESS)
{
if (!teleportGUIDs.empty())
for (std::vector<uint64>::const_iterator itr = teleportGUIDs.begin(); itr != teleportGUIDs.end(); ++itr)
if (Creature* pTeleport = instance->GetCreature((*itr)))
{
pTeleport->RemoveAura(SPELL_TELEPORT_VISUAL_ACTIVE);
pTeleport->CastSpell(pTeleport, SPELL_TELEPORT_VISUAL_DISABLED, true);
}
}
else
{
if (!teleportGUIDs.empty())
for (std::vector<uint64>::const_iterator itr = teleportGUIDs.begin(); itr != teleportGUIDs.end(); ++itr)
if (Creature* pTeleport = instance->GetCreature((*itr)))
{
pTeleport->RemoveAura(SPELL_TELEPORT_VISUAL_DISABLED);
pTeleport->CastSpell(pTeleport, SPELL_TELEPORT_VISUAL_ACTIVE, true);
}
}
return true;
}
void TrownRock(uint32 entry)
{
std::list<Creature*> targetRock;
Creature* morchok = instance->GetCreature(uiMorchokGUID);
GetCreatureListWithEntryInGrid(targetRock, morchok, entry, 200.0f);
if (targetRock.empty())
return;
targetRock.remove_if([&morchok](Creature* c) {return !morchok->IsWithinLOSInMap(c); });
if (targetRock.size() > 1)
{
WoWSource::RandomResizeList(targetRock, 1);
if (Creature* target = targetRock.front())
{
morchok->CastSpell(target, SPELL_MORCHOK_SIEGE_MISSILE_2, true);
}
}
}
void RemoveEncounterAuras()
{
if (!plrList.isEmpty())
{
for (Map::PlayerList::const_iterator i = plrList.begin(); i != plrList.end(); ++i)
{
if (Player* pPlayer = i->getSource())
{
if (InstanceScript* pInstance = pPlayer->GetInstanceScript())
{
if (pInstance->GetBossState(BOSS_ULTRAXION) == NOT_STARTED)
{
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_SHIFT);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_HEROIC_WILL_AOE);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_HEROIC_WILL);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GIFT_OF_LIVE_AURA);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ESSENCE_OF_DREAMS_AURA);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SOURCE_OF_MAGIC_AURA);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TIMELOOP);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_LAST_DEFENDER_OF_AZEROTH_DK);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_LAST_DEFENDER_OF_AZEROTH_PALADIN);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_LAST_DEFENDER_OF_AZEROTH_DRUID);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_LAST_DEFENDER_OF_AZEROTH_WARRIOR);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_LAST_DEFENDER_OF_AZEROTH_MONK);
}
if (pInstance->GetBossState(DATA_SPINE) == DONE && pInstance->GetBossState(DATA_MADNESS) != DONE)
{
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_YSERA_PRESENCE);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_YSERA_PRESENCE_AURA);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_THE_DREAMER);
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ENTER_THE_DREAM);
}
}
}
}
}
}
void StartEventWyrmrest(Player* player, uint32 entry)
{
std::list<Creature*> dragon;
GetCreatureListWithEntryInGrid(dragon, player, entry, 1000.0f);
if (dragon.empty())
return;
for (std::list<Creature*>::iterator itr = dragon.begin(); itr != dragon.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_START_WYRMREST_EVENT);
}
void ExitBlistering(Player* player) //Hack for evite the blistering all time in the limb of madness
{
std::list<Creature*> dragon;
GetCreatureListWithEntryInGrid(dragon, player, 56188, 1000.0f); //Blistering Tentacle, Madness of Deathwing
if (dragon.empty())
return;
for (std::list<Creature*>::iterator itr = dragon.begin(); itr != dragon.end(); ++itr)
(*itr)->AI()->Reset();
}
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
std::string str_data;
std::ostringstream saveStream;
saveStream << "D S " << GetBossSaveData() << bHagaraEvent << " " << isHeroicFailed << " ";
str_data = saveStream.str();
OUT_SAVE_INST_DATA_COMPLETE;
return str_data;
}
void Load(const char* in)
{
if (!in)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'D' && dataHead2 == 'S')
{
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
uint32 tmpEvent;
loadStream >> tmpEvent;
if (tmpEvent != DONE)
tmpEvent = NOT_STARTED;
bHagaraEvent = tmpEvent;
loadStream >> tmpEvent;
if (tmpEvent != 1)
tmpEvent = 0;
isHeroicFailed = tmpEvent;
} else OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
}
void Update(uint32 diff)
{
if (playerTimer <= diff)
{
if (!plrList.isEmpty())
for (Map::PlayerList::const_iterator i = plrList.begin(); i != plrList.end(); ++i)
if (Player* pPlayer = i->getSource())
if (pInstance = pPlayer->GetInstanceScript())
{
if (pInstance->GetBossState(BOSS_MORCHOK) != DONE)
if (pPlayer->GetPositionZ() < 50.0f && !pPlayer->IsBeingTeleported())
pPlayer->NearTeleportTo(morchokPos.GetPositionX(), morchokPos.GetPositionY(), morchokPos.GetPositionZ(), morchokPos.GetOrientation());
if (pInstance->GetBossState(BOSS_ULTRAXION) == IN_PROGRESS)
if (pPlayer->GetPositionZ() < 310.0f && !pPlayer->IsBeingTeleported())
pPlayer->NearTeleportTo(-1761.76f, -2388.99f, 341.59f, 0);
if (pInstance->GetBossState(DATA_BLACKHORN) == DONE && pInstance->GetBossState(DATA_SPINE) == NOT_STARTED)
if (pPlayer->isDead())
pPlayer->NearTeleportTo(skyfirePos.GetPositionX(), skyfirePos.GetPositionY(), skyfirePos.GetPositionZ(), skyfirePos.GetOrientation());
if (pInstance->GetBossState(BOSS_MORCHOK) == DONE && pInstance->GetBossState(DATA_ZONOZZ) != DONE)
if (pPlayer->GetPositionZ() < -250.0f && !pPlayer->IsBeingTeleported())
pPlayer->NearTeleportTo(-1769.329956f, -1916.869995f, -226.28f, 0.0f);
if (pInstance->GetBossState(DATA_SPINE) == DONE && pInstance->GetBossState(DATA_MADNESS) == NOT_STARTED)
if (pPlayer->isDead())
ExitBlistering(pPlayer);
if (pInstance->GetBossState(DATA_MADNESS) == DONE || pInstance->GetBossState(DATA_MADNESS) == NOT_STARTED)
if (pPlayer->HasSpell(SPELL_DREAM))
pPlayer->removeSpell(SPELL_DREAM, false, false);
if (pInstance->GetBossState(DATA_MADNESS) == NOT_STARTED && pInstance->GetBossState(DATA_SPINE) == DONE)
if (Creature* trall = instance->GetCreature(uiTrallMaelstrom))
if (trall->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
trall->AI()->DoAction(ACTION_RESET_BATTLE);
}
playerTimer = 2000;
}
else
playerTimer -= diff;
if (trownStoneTimer <= diff)
{
if (!plrList.isEmpty())
for (Map::PlayerList::const_iterator i = plrList.begin(); i != plrList.end(); ++i)
if (Player* pPlayer = i->getSource())
if (InstanceScript* pInstance = pPlayer->GetInstanceScript())
if (pInstance->GetBossState(BOSS_MORCHOK) == NOT_STARTED)
{
if (Creature* morchok = instance->GetCreature(uiMorchokGUID))
{
morchok->CastSpell(morchok, SPELL_MORCHOK_SIEGE_MISSILE_1, true);
TrownRock(NPC_TARGET_DUMMY);
}
}
trownStoneTimer = 7000;
}
else
trownStoneTimer -= diff;
}
private:
uint32 uiTeamInInstance;
uint32 playerTimer;
uint32 trownStoneTimer;
uint64 uiMorchokGUID;
uint64 uiKohcromGUID;
uint64 uiYorsahjGUID;
uint64 uiZonozzGUID;
uint64 uiHagaraGUID;
uint64 uiUltraxionGUID;
uint64 uiBlackhornGUID;
uint64 uiAllianceShipGUID;
uint64 uiSwayzeGUID;
uint64 uiReevsGUID;
uint64 uiDeckGUID;
uint64 uiMaelstormGUID;
uint64 uiDeathwingGUID;
uint64 uiAlexstraszaDragonGUID;
uint64 uiNozdormuDragonGUID;
uint64 uiYseraDragonGUID;
uint64 uiKalecgosDragonGUID;
uint64 uiTrallMaelstrom;
uint64 uiLesserCacheofTheAspects[4];
uint64 uiBackPlates[3];
uint64 uiGreaterCacheofTheAspects[4];
uint64 uiElementiumFragment[4];
std::vector<uint64> teleportGUIDs;
uint32 bHagaraEvent;
uint32 isHeroicFailed;
uint32 MorchokEvent;
Map::PlayerList const &plrList = instance->GetPlayers();
InstanceScript* pInstance;
};
};
void AddSC_instance_dragon_soul()
{
new instance_dragon_soul();
}
| [
"[email protected]"
] | |
d16d42215992a40e5606d660fe035353fba2a796 | 14ba7a644ee2e4e20dd15d7f28be88fa9c3d566d | /SamSungSW/14503.cpp | e1fb9755ea8628740576d8ce2d1bfd5795690197 | [] | no_license | hmtyj2/Baek-Jun | a28b3ba0910478028582f01404aa766881913d55 | 411fc9cad3bd617c2468dd7a4af019f88ea6f1e4 | refs/heads/master | 2020-09-04T04:45:02.206484 | 2019-11-05T05:13:50 | 2019-11-05T05:13:50 | 219,660,663 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,261 | cpp | #include <stdio.h>
#include <iostream>
using namespace std;
int map[52][52];
int N,M;
int dir[4][2]={{-1,0},{0,1},{1,0},{0,-1}};
struct robot{
int row;
int col;
int head;
};
void move(robot *rt, int count){
int left;
left=(rt->head)-1;
if(left==-1){
left=3;
}
if(map[rt->row][rt->col]==0){
map[rt->row][rt->col]=-1;
move(rt,count+1);
return;
}
int flag,temp;
for(flag=0,temp=0;temp<4;temp++){
if(map[rt->row+dir[temp][0]][rt->col+dir[temp][1]]!=0){
flag++;
}
}
if(flag==4){
if(map[rt->row-dir[rt->head][0]][rt->col-dir[rt->head][1]]!=1){
rt->row-=dir[rt->head][0];
rt->col-=dir[rt->head][1];
move(rt,count);
return;
}
else{
printf("%d\n",count);
return;
}
}
else if(map[rt->row+dir[left][0]][rt->col+dir[left][1]]==0){
rt->head=left;
rt->row+=dir[left][0];
rt->col+=dir[left][1];
move(rt,count);
return;
}
else if(map[rt->row+dir[left][0]][rt->col+dir[left][1]]!=0){
rt->head=left;
move(rt,count);
return;
}
}
int main(){
int temp,temp1,temp2;
robot t;
robot *rt=&t;
scanf("%d %d",&N,&M);
scanf("%d %d %d",&t.row,&t.col,&t.head);
for(temp=1;temp<=N;temp++){
for(temp1=1;temp1<=M;temp1++){
scanf("%d",&map[temp][temp1]);
}
}
rt->row+=1;
rt->col+=1;
move(rt,0);
} | [
"[email protected]"
] | |
b7a9d848374117a8f2106f9396bd14027b4b00b9 | 1f1290c8cea180624fef11751a7f16fbdc706465 | /Progetto_2013-14/anello.cpp | 742718b2fa3012d7cc54899979ec114e0295a0e2 | [] | no_license | alexrzz/PAO | c8b5086d8540f77d5dc4befae1d61a4d6dbfbdc3 | d42d9842a372fc803078cc9e6551559de0e716e0 | refs/heads/master | 2021-01-15T13:45:04.688430 | 2015-03-09T15:39:42 | 2015-03-09T15:39:42 | 31,904,308 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 625 | cpp | #include "anello.h"
Anello::Anello(string m, int q, double p, double mi, bool s) : Gioiello(m, q, p), misura(mi), solitario(s) {}
Anello* Anello::clone()const {
return new Anello(*this);
}
bool Anello::operator==(Gioiello* p) const {
Anello* q = dynamic_cast<Anello*>(p);
if(q)
return (this->Gioiello::operator==(p) && misura == q->misura && solitario == q->solitario);
}
double Anello::getMisura() const {
return misura;
}
bool Anello::getSolitario() const {
return solitario;
}
void Anello::setMisura(double m) {
misura = m;
}
void Anello::setSolitario(bool s) {
solitario = s;
}
| [
"[email protected]"
] | |
86808ac72b0b210dcd893693e6a75a12dc814989 | 153341ec0013aca8a750d288d3885b20ceaa8cb6 | /ploymorphism/testing.cpp | f185dc2d3c3742b51b106d67e654f48b90deb027 | [] | no_license | allie5/education | 82e2e508ee2d1d983003112715f6c8e430f54141 | 63a543e98086d2bc77bc5f23c59a0191b11ea893 | refs/heads/master | 2021-05-31T11:39:00.547825 | 2016-02-10T16:49:00 | 2016-02-10T16:49:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 679 | cpp | #include <iostream>
#include "testing.h"
using namespace std;
static void mess();
class Email : public Message {
string message;
string sender;
public:
Email(string sender_in) {
sender = sender_in;
}
virtual void set_string(string message_in) {
message = message_in;
}
virtual string get_string();
virtual ~Email() {}
};
string Email::get_string() {
mess();
cout << "Sent by " << sender << endl;
return message;
}
static void mess() {
cout << "Message Sent" << endl;
}
Message* Player_factory(string sender) {
cout << "Message Created: " << endl;
return new Email(sender);
}
| [
"[email protected]"
] | |
3f9340710847cf20fc80515b7e16d8a5876a0065 | 037d518773420f21d74079ee492827212ba6e434 | /blazetest/src/mathtest/smatdvecmult/DCaVDa.cpp | 89b5be838a382a173efa9fbe816fb9bc78d141ef | [
"BSD-3-Clause"
] | permissive | chkob/forked-blaze | 8d228f3e8d1f305a9cf43ceaba9d5fcd603ecca8 | b0ce91c821608e498b3c861e956951afc55c31eb | refs/heads/master | 2021-09-05T11:52:03.715469 | 2018-01-27T02:31:51 | 2018-01-27T02:31:51 | 112,014,398 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,276 | cpp | //=================================================================================================
/*!
// \file src/mathtest/smatdvecmult/DCaVDa.cpp
// \brief Source file for the DCaVDa sparse matrix/dense vector multiplication math test
//
// Copyright (C) 2012-2018 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. 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 names of the Blaze development group 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.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/CompressedMatrix.h>
#include <blaze/math/DiagonalMatrix.h>
#include <blaze/math/DynamicVector.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/smatdvecmult/OperationTest.h>
#include <blazetest/system/MathTest.h>
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'DCaVDa'..." << std::endl;
using blazetest::mathtest::TypeA;
try
{
// Matrix type definitions
typedef blaze::DiagonalMatrix< blaze::CompressedMatrix<TypeA> > DCa;
typedef blaze::DynamicVector<TypeA> VDa;
// Creator type definitions
typedef blazetest::Creator<DCa> CDCa;
typedef blazetest::Creator<VDa> CVDa;
// Running tests with small matrices and vectors
for( size_t i=0UL; i<=6UL; ++i ) {
for( size_t j=0UL; j<=i; ++j ) {
RUN_SMATDVECMULT_OPERATION_TEST( CDCa( i, j ), CVDa( i ) );
}
}
// Running tests with large matrices and vectors
RUN_SMATDVECMULT_OPERATION_TEST( CDCa( 67UL, 7UL ), CVDa( 67UL ) );
RUN_SMATDVECMULT_OPERATION_TEST( CDCa( 127UL, 13UL ), CVDa( 127UL ) );
RUN_SMATDVECMULT_OPERATION_TEST( CDCa( 64UL, 8UL ), CVDa( 64UL ) );
RUN_SMATDVECMULT_OPERATION_TEST( CDCa( 128UL, 16UL ), CVDa( 128UL ) );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during sparse matrix/dense vector multiplication:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
| [
"[email protected]"
] | |
591257aa63d9426ae20737676321ef9959c4b66c | cd72b19d2030f36f78dab52390d092ed3dc8005f | /apps/src/libvideostitch-gui/centralwidget/formats/extensionhandlers/rawextensionhandler.hpp | f4d1a8acd28cfea160bc62a42d60a0247877a189 | [
"MIT",
"DOC"
] | permissive | stitchEm/stitchEm | 08c5a3ef95c16926c944c1835fdd4ab4b6855580 | 4a0e9fc167f10c7dde46394aff302927c15ce6cb | refs/heads/master | 2022-11-27T20:13:45.741733 | 2022-11-22T17:26:07 | 2022-11-22T17:26:07 | 182,059,770 | 250 | 68 | MIT | 2022-11-22T17:26:08 | 2019-04-18T09:36:54 | C++ | UTF-8 | C++ | false | false | 782 | hpp | // Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "extensionhandler.hpp"
class RawExtensionHandler : public ExtensionHandler {
public:
RawExtensionHandler() {
extension = "abgr";
format = "raw";
}
private:
QString handle(const QString &filename, const QString &format) const {
QString ret;
if (this->format == format) {
ret = filename + "." + extension;
}
return ret;
}
QString stripBasename(const QString &inputText, const QString &format) const {
QString ret = inputText;
QString toRemove = QString(".") + extension;
if (inputText.contains(toRemove) && this->format == format) {
ret.remove(toRemove);
return ret;
} else {
return QString();
}
}
};
| [
"[email protected]"
] | |
3cd4cee90695a5a27f3dbd6990ba475d17681ce1 | c776476e9d06b3779d744641e758ac3a2c15cddc | /examples/litmus/c/run-scripts/tmp_5/Z6.2+pooncerelease+ctrlonceonce+poonceonce.c.cbmc_out.cpp | 7f1c27b40d3f55c4bccadc7aa30355fe057221c9 | [] | no_license | ashutosh0gupta/llvm_bmc | aaac7961c723ba6f7ffd77a39559e0e52432eade | 0287c4fb180244e6b3c599a9902507f05c8a7234 | refs/heads/master | 2023-08-02T17:14:06.178723 | 2023-07-31T10:46:53 | 2023-07-31T10:46:53 | 143,100,825 | 3 | 4 | null | 2023-05-25T05:50:55 | 2018-08-01T03:47:00 | C++ | UTF-8 | C++ | false | false | 40,461 | cpp | // Global variabls:
// 0:vars:3
// 3:atom_1_X0_1:1
// 4:atom_2_X0_1:1
// Local global variabls:
// 0:thr0:1
// 1:thr1:1
// 2:thr2:1
#define ADDRSIZE 5
#define LOCALADDRSIZE 3
#define NTHREAD 4
#define NCONTEXT 5
#define ASSUME(stmt) __CPROVER_assume(stmt)
#define ASSERT(stmt) __CPROVER_assert(stmt, "error")
#define max(a,b) (a>b?a:b)
char __get_rng();
char get_rng( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
char get_rng_th( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
int main(int argc, char **argv) {
// Declare arrays for intial value version in contexts
int local_mem[LOCALADDRSIZE];
// Dumping initializations
local_mem[0+0] = 0;
local_mem[1+0] = 0;
local_mem[2+0] = 0;
int cstart[NTHREAD];
int creturn[NTHREAD];
// declare arrays for contexts activity
int active[NCONTEXT];
int ctx_used[NCONTEXT];
// declare arrays for intial value version in contexts
int meminit_[ADDRSIZE*NCONTEXT];
#define meminit(x,k) meminit_[(x)*NCONTEXT+k]
int coinit_[ADDRSIZE*NCONTEXT];
#define coinit(x,k) coinit_[(x)*NCONTEXT+k]
int deltainit_[ADDRSIZE*NCONTEXT];
#define deltainit(x,k) deltainit_[(x)*NCONTEXT+k]
// declare arrays for running value version in contexts
int mem_[ADDRSIZE*NCONTEXT];
#define mem(x,k) mem_[(x)*NCONTEXT+k]
int co_[ADDRSIZE*NCONTEXT];
#define co(x,k) co_[(x)*NCONTEXT+k]
int delta_[ADDRSIZE*NCONTEXT];
#define delta(x,k) delta_[(x)*NCONTEXT+k]
// declare arrays for local buffer and observed writes
int buff_[NTHREAD*ADDRSIZE];
#define buff(x,k) buff_[(x)*ADDRSIZE+k]
int pw_[NTHREAD*ADDRSIZE];
#define pw(x,k) pw_[(x)*ADDRSIZE+k]
// declare arrays for context stamps
char cr_[NTHREAD*ADDRSIZE];
#define cr(x,k) cr_[(x)*ADDRSIZE+k]
char iw_[NTHREAD*ADDRSIZE];
#define iw(x,k) iw_[(x)*ADDRSIZE+k]
char cw_[NTHREAD*ADDRSIZE];
#define cw(x,k) cw_[(x)*ADDRSIZE+k]
char cx_[NTHREAD*ADDRSIZE];
#define cx(x,k) cx_[(x)*ADDRSIZE+k]
char is_[NTHREAD*ADDRSIZE];
#define is(x,k) is_[(x)*ADDRSIZE+k]
char cs_[NTHREAD*ADDRSIZE];
#define cs(x,k) cs_[(x)*ADDRSIZE+k]
char crmax_[NTHREAD*ADDRSIZE];
#define crmax(x,k) crmax_[(x)*ADDRSIZE+k]
char sforbid_[ADDRSIZE*NCONTEXT];
#define sforbid(x,k) sforbid_[(x)*NCONTEXT+k]
// declare arrays for synchronizations
int cl[NTHREAD];
int cdy[NTHREAD];
int cds[NTHREAD];
int cdl[NTHREAD];
int cisb[NTHREAD];
int caddr[NTHREAD];
int cctrl[NTHREAD];
int r0= 0;
char creg_r0;
char creg__r0__0_;
char creg___r0__0___0_;
char creg__r0__1_;
int r1= 0;
char creg_r1;
char creg__r1__1_;
int r2= 0;
char creg_r2;
int r3= 0;
char creg_r3;
int r4= 0;
char creg_r4;
int r5= 0;
char creg_r5;
int r6= 0;
char creg_r6;
char creg__r6__2_;
int r7= 0;
char creg_r7;
int r8= 0;
char creg_r8;
int r9= 0;
char creg_r9;
int r10= 0;
char creg_r10;
char creg__r10__1_;
int r11= 0;
char creg_r11;
char old_cctrl= 0;
char old_cr= 0;
char old_cdy= 0;
char old_cw= 0;
char new_creg= 0;
buff(0,0) = 0;
pw(0,0) = 0;
cr(0,0) = 0;
iw(0,0) = 0;
cw(0,0) = 0;
cx(0,0) = 0;
is(0,0) = 0;
cs(0,0) = 0;
crmax(0,0) = 0;
buff(0,1) = 0;
pw(0,1) = 0;
cr(0,1) = 0;
iw(0,1) = 0;
cw(0,1) = 0;
cx(0,1) = 0;
is(0,1) = 0;
cs(0,1) = 0;
crmax(0,1) = 0;
buff(0,2) = 0;
pw(0,2) = 0;
cr(0,2) = 0;
iw(0,2) = 0;
cw(0,2) = 0;
cx(0,2) = 0;
is(0,2) = 0;
cs(0,2) = 0;
crmax(0,2) = 0;
buff(0,3) = 0;
pw(0,3) = 0;
cr(0,3) = 0;
iw(0,3) = 0;
cw(0,3) = 0;
cx(0,3) = 0;
is(0,3) = 0;
cs(0,3) = 0;
crmax(0,3) = 0;
buff(0,4) = 0;
pw(0,4) = 0;
cr(0,4) = 0;
iw(0,4) = 0;
cw(0,4) = 0;
cx(0,4) = 0;
is(0,4) = 0;
cs(0,4) = 0;
crmax(0,4) = 0;
cl[0] = 0;
cdy[0] = 0;
cds[0] = 0;
cdl[0] = 0;
cisb[0] = 0;
caddr[0] = 0;
cctrl[0] = 0;
cstart[0] = get_rng(0,NCONTEXT-1);
creturn[0] = get_rng(0,NCONTEXT-1);
buff(1,0) = 0;
pw(1,0) = 0;
cr(1,0) = 0;
iw(1,0) = 0;
cw(1,0) = 0;
cx(1,0) = 0;
is(1,0) = 0;
cs(1,0) = 0;
crmax(1,0) = 0;
buff(1,1) = 0;
pw(1,1) = 0;
cr(1,1) = 0;
iw(1,1) = 0;
cw(1,1) = 0;
cx(1,1) = 0;
is(1,1) = 0;
cs(1,1) = 0;
crmax(1,1) = 0;
buff(1,2) = 0;
pw(1,2) = 0;
cr(1,2) = 0;
iw(1,2) = 0;
cw(1,2) = 0;
cx(1,2) = 0;
is(1,2) = 0;
cs(1,2) = 0;
crmax(1,2) = 0;
buff(1,3) = 0;
pw(1,3) = 0;
cr(1,3) = 0;
iw(1,3) = 0;
cw(1,3) = 0;
cx(1,3) = 0;
is(1,3) = 0;
cs(1,3) = 0;
crmax(1,3) = 0;
buff(1,4) = 0;
pw(1,4) = 0;
cr(1,4) = 0;
iw(1,4) = 0;
cw(1,4) = 0;
cx(1,4) = 0;
is(1,4) = 0;
cs(1,4) = 0;
crmax(1,4) = 0;
cl[1] = 0;
cdy[1] = 0;
cds[1] = 0;
cdl[1] = 0;
cisb[1] = 0;
caddr[1] = 0;
cctrl[1] = 0;
cstart[1] = get_rng(0,NCONTEXT-1);
creturn[1] = get_rng(0,NCONTEXT-1);
buff(2,0) = 0;
pw(2,0) = 0;
cr(2,0) = 0;
iw(2,0) = 0;
cw(2,0) = 0;
cx(2,0) = 0;
is(2,0) = 0;
cs(2,0) = 0;
crmax(2,0) = 0;
buff(2,1) = 0;
pw(2,1) = 0;
cr(2,1) = 0;
iw(2,1) = 0;
cw(2,1) = 0;
cx(2,1) = 0;
is(2,1) = 0;
cs(2,1) = 0;
crmax(2,1) = 0;
buff(2,2) = 0;
pw(2,2) = 0;
cr(2,2) = 0;
iw(2,2) = 0;
cw(2,2) = 0;
cx(2,2) = 0;
is(2,2) = 0;
cs(2,2) = 0;
crmax(2,2) = 0;
buff(2,3) = 0;
pw(2,3) = 0;
cr(2,3) = 0;
iw(2,3) = 0;
cw(2,3) = 0;
cx(2,3) = 0;
is(2,3) = 0;
cs(2,3) = 0;
crmax(2,3) = 0;
buff(2,4) = 0;
pw(2,4) = 0;
cr(2,4) = 0;
iw(2,4) = 0;
cw(2,4) = 0;
cx(2,4) = 0;
is(2,4) = 0;
cs(2,4) = 0;
crmax(2,4) = 0;
cl[2] = 0;
cdy[2] = 0;
cds[2] = 0;
cdl[2] = 0;
cisb[2] = 0;
caddr[2] = 0;
cctrl[2] = 0;
cstart[2] = get_rng(0,NCONTEXT-1);
creturn[2] = get_rng(0,NCONTEXT-1);
buff(3,0) = 0;
pw(3,0) = 0;
cr(3,0) = 0;
iw(3,0) = 0;
cw(3,0) = 0;
cx(3,0) = 0;
is(3,0) = 0;
cs(3,0) = 0;
crmax(3,0) = 0;
buff(3,1) = 0;
pw(3,1) = 0;
cr(3,1) = 0;
iw(3,1) = 0;
cw(3,1) = 0;
cx(3,1) = 0;
is(3,1) = 0;
cs(3,1) = 0;
crmax(3,1) = 0;
buff(3,2) = 0;
pw(3,2) = 0;
cr(3,2) = 0;
iw(3,2) = 0;
cw(3,2) = 0;
cx(3,2) = 0;
is(3,2) = 0;
cs(3,2) = 0;
crmax(3,2) = 0;
buff(3,3) = 0;
pw(3,3) = 0;
cr(3,3) = 0;
iw(3,3) = 0;
cw(3,3) = 0;
cx(3,3) = 0;
is(3,3) = 0;
cs(3,3) = 0;
crmax(3,3) = 0;
buff(3,4) = 0;
pw(3,4) = 0;
cr(3,4) = 0;
iw(3,4) = 0;
cw(3,4) = 0;
cx(3,4) = 0;
is(3,4) = 0;
cs(3,4) = 0;
crmax(3,4) = 0;
cl[3] = 0;
cdy[3] = 0;
cds[3] = 0;
cdl[3] = 0;
cisb[3] = 0;
caddr[3] = 0;
cctrl[3] = 0;
cstart[3] = get_rng(0,NCONTEXT-1);
creturn[3] = get_rng(0,NCONTEXT-1);
// Dumping initializations
mem(0+0,0) = 0;
mem(0+1,0) = 0;
mem(0+2,0) = 0;
mem(3+0,0) = 0;
mem(4+0,0) = 0;
// Dumping context matching equalities
co(0,0) = 0;
delta(0,0) = -1;
mem(0,1) = meminit(0,1);
co(0,1) = coinit(0,1);
delta(0,1) = deltainit(0,1);
mem(0,2) = meminit(0,2);
co(0,2) = coinit(0,2);
delta(0,2) = deltainit(0,2);
mem(0,3) = meminit(0,3);
co(0,3) = coinit(0,3);
delta(0,3) = deltainit(0,3);
mem(0,4) = meminit(0,4);
co(0,4) = coinit(0,4);
delta(0,4) = deltainit(0,4);
co(1,0) = 0;
delta(1,0) = -1;
mem(1,1) = meminit(1,1);
co(1,1) = coinit(1,1);
delta(1,1) = deltainit(1,1);
mem(1,2) = meminit(1,2);
co(1,2) = coinit(1,2);
delta(1,2) = deltainit(1,2);
mem(1,3) = meminit(1,3);
co(1,3) = coinit(1,3);
delta(1,3) = deltainit(1,3);
mem(1,4) = meminit(1,4);
co(1,4) = coinit(1,4);
delta(1,4) = deltainit(1,4);
co(2,0) = 0;
delta(2,0) = -1;
mem(2,1) = meminit(2,1);
co(2,1) = coinit(2,1);
delta(2,1) = deltainit(2,1);
mem(2,2) = meminit(2,2);
co(2,2) = coinit(2,2);
delta(2,2) = deltainit(2,2);
mem(2,3) = meminit(2,3);
co(2,3) = coinit(2,3);
delta(2,3) = deltainit(2,3);
mem(2,4) = meminit(2,4);
co(2,4) = coinit(2,4);
delta(2,4) = deltainit(2,4);
co(3,0) = 0;
delta(3,0) = -1;
mem(3,1) = meminit(3,1);
co(3,1) = coinit(3,1);
delta(3,1) = deltainit(3,1);
mem(3,2) = meminit(3,2);
co(3,2) = coinit(3,2);
delta(3,2) = deltainit(3,2);
mem(3,3) = meminit(3,3);
co(3,3) = coinit(3,3);
delta(3,3) = deltainit(3,3);
mem(3,4) = meminit(3,4);
co(3,4) = coinit(3,4);
delta(3,4) = deltainit(3,4);
co(4,0) = 0;
delta(4,0) = -1;
mem(4,1) = meminit(4,1);
co(4,1) = coinit(4,1);
delta(4,1) = deltainit(4,1);
mem(4,2) = meminit(4,2);
co(4,2) = coinit(4,2);
delta(4,2) = deltainit(4,2);
mem(4,3) = meminit(4,3);
co(4,3) = coinit(4,3);
delta(4,3) = deltainit(4,3);
mem(4,4) = meminit(4,4);
co(4,4) = coinit(4,4);
delta(4,4) = deltainit(4,4);
// Dumping thread 1
int ret_thread_1 = 0;
cdy[1] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[1] >= cstart[1]);
T1BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !36, metadata !DIExpression()), !dbg !45
// br label %label_1, !dbg !46
goto T1BLOCK1;
T1BLOCK1:
// call void @llvm.dbg.label(metadata !44), !dbg !47
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !37, metadata !DIExpression()), !dbg !48
// call void @llvm.dbg.value(metadata i64 2, metadata !40, metadata !DIExpression()), !dbg !48
// store atomic i64 2, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !49
// ST: Guess
iw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW _l20_c3
old_cw = cw(1,0+1*1);
cw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM _l20_c3
// Check
ASSUME(active[iw(1,0+1*1)] == 1);
ASSUME(active[cw(1,0+1*1)] == 1);
ASSUME(sforbid(0+1*1,cw(1,0+1*1))== 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(cw(1,0+1*1) >= iw(1,0+1*1));
ASSUME(cw(1,0+1*1) >= old_cw);
ASSUME(cw(1,0+1*1) >= cr(1,0+1*1));
ASSUME(cw(1,0+1*1) >= cl[1]);
ASSUME(cw(1,0+1*1) >= cisb[1]);
ASSUME(cw(1,0+1*1) >= cdy[1]);
ASSUME(cw(1,0+1*1) >= cdl[1]);
ASSUME(cw(1,0+1*1) >= cds[1]);
ASSUME(cw(1,0+1*1) >= cctrl[1]);
ASSUME(cw(1,0+1*1) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,0+1*1) = 2;
mem(0+1*1,cw(1,0+1*1)) = 2;
co(0+1*1,cw(1,0+1*1))+=1;
delta(0+1*1,cw(1,0+1*1)) = -1;
ASSUME(creturn[1] >= cw(1,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !41, metadata !DIExpression()), !dbg !50
// call void @llvm.dbg.value(metadata i64 1, metadata !43, metadata !DIExpression()), !dbg !50
// store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) release, align 8, !dbg !51
// ST: Guess
// : Release
iw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW _l21_c3
old_cw = cw(1,0);
cw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM _l21_c3
// Check
ASSUME(active[iw(1,0)] == 1);
ASSUME(active[cw(1,0)] == 1);
ASSUME(sforbid(0,cw(1,0))== 0);
ASSUME(iw(1,0) >= 0);
ASSUME(iw(1,0) >= 0);
ASSUME(cw(1,0) >= iw(1,0));
ASSUME(cw(1,0) >= old_cw);
ASSUME(cw(1,0) >= cr(1,0));
ASSUME(cw(1,0) >= cl[1]);
ASSUME(cw(1,0) >= cisb[1]);
ASSUME(cw(1,0) >= cdy[1]);
ASSUME(cw(1,0) >= cdl[1]);
ASSUME(cw(1,0) >= cds[1]);
ASSUME(cw(1,0) >= cctrl[1]);
ASSUME(cw(1,0) >= caddr[1]);
ASSUME(cw(1,0) >= cr(1,0+0));
ASSUME(cw(1,0) >= cr(1,0+1));
ASSUME(cw(1,0) >= cr(1,0+2));
ASSUME(cw(1,0) >= cr(1,3+0));
ASSUME(cw(1,0) >= cr(1,4+0));
ASSUME(cw(1,0) >= cw(1,0+0));
ASSUME(cw(1,0) >= cw(1,0+1));
ASSUME(cw(1,0) >= cw(1,0+2));
ASSUME(cw(1,0) >= cw(1,3+0));
ASSUME(cw(1,0) >= cw(1,4+0));
// Update
caddr[1] = max(caddr[1],0);
buff(1,0) = 1;
mem(0,cw(1,0)) = 1;
co(0,cw(1,0))+=1;
delta(0,cw(1,0)) = -1;
is(1,0) = iw(1,0);
cs(1,0) = cw(1,0);
ASSUME(creturn[1] >= cw(1,0));
// ret i8* null, !dbg !52
ret_thread_1 = (- 1);
goto T1BLOCK_END;
T1BLOCK_END:
// Dumping thread 2
int ret_thread_2 = 0;
cdy[2] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[2] >= cstart[2]);
T2BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !55, metadata !DIExpression()), !dbg !67
// br label %label_2, !dbg !50
goto T2BLOCK1;
T2BLOCK1:
// call void @llvm.dbg.label(metadata !65), !dbg !69
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !57, metadata !DIExpression()), !dbg !70
// %0 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !53
// LD: Guess
old_cr = cr(2,0);
cr(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM _l27_c15
// Check
ASSUME(active[cr(2,0)] == 2);
ASSUME(cr(2,0) >= iw(2,0));
ASSUME(cr(2,0) >= 0);
ASSUME(cr(2,0) >= cdy[2]);
ASSUME(cr(2,0) >= cisb[2]);
ASSUME(cr(2,0) >= cdl[2]);
ASSUME(cr(2,0) >= cl[2]);
// Update
creg_r0 = cr(2,0);
crmax(2,0) = max(crmax(2,0),cr(2,0));
caddr[2] = max(caddr[2],0);
if(cr(2,0) < cw(2,0)) {
r0 = buff(2,0);
ASSUME((!(( (cw(2,0) < 1) && (1 < crmax(2,0)) )))||(sforbid(0,1)> 0));
ASSUME((!(( (cw(2,0) < 2) && (2 < crmax(2,0)) )))||(sforbid(0,2)> 0));
ASSUME((!(( (cw(2,0) < 3) && (3 < crmax(2,0)) )))||(sforbid(0,3)> 0));
ASSUME((!(( (cw(2,0) < 4) && (4 < crmax(2,0)) )))||(sforbid(0,4)> 0));
} else {
if(pw(2,0) != co(0,cr(2,0))) {
ASSUME(cr(2,0) >= old_cr);
}
pw(2,0) = co(0,cr(2,0));
r0 = mem(0,cr(2,0));
}
ASSUME(creturn[2] >= cr(2,0));
// call void @llvm.dbg.value(metadata i64 %0, metadata !59, metadata !DIExpression()), !dbg !70
// %conv = trunc i64 %0 to i32, !dbg !54
// call void @llvm.dbg.value(metadata i32 %conv, metadata !56, metadata !DIExpression()), !dbg !67
// %cmp = icmp eq i32 %conv, 0, !dbg !55
creg__r0__0_ = max(0,creg_r0);
// %conv1 = zext i1 %cmp to i32, !dbg !55
// call void @llvm.dbg.value(metadata i32 %conv1, metadata !60, metadata !DIExpression()), !dbg !67
// %tobool = icmp ne i32 %conv1, 0, !dbg !56
creg___r0__0___0_ = max(0,creg__r0__0_);
// br i1 %tobool, label %if.then, label %if.else, !dbg !58
old_cctrl = cctrl[2];
cctrl[2] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[2] >= old_cctrl);
ASSUME(cctrl[2] >= creg___r0__0___0_);
if(((r0==0)!=0)) {
goto T2BLOCK2;
} else {
goto T2BLOCK3;
}
T2BLOCK2:
// br label %lbl_label227, !dbg !59
goto T2BLOCK4;
T2BLOCK3:
// br label %lbl_label227, !dbg !60
goto T2BLOCK4;
T2BLOCK4:
// call void @llvm.dbg.label(metadata !66), !dbg !79
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !61, metadata !DIExpression()), !dbg !80
// call void @llvm.dbg.value(metadata i64 1, metadata !63, metadata !DIExpression()), !dbg !80
// store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !63
// ST: Guess
iw(2,0+2*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l31_c3
old_cw = cw(2,0+2*1);
cw(2,0+2*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l31_c3
// Check
ASSUME(active[iw(2,0+2*1)] == 2);
ASSUME(active[cw(2,0+2*1)] == 2);
ASSUME(sforbid(0+2*1,cw(2,0+2*1))== 0);
ASSUME(iw(2,0+2*1) >= 0);
ASSUME(iw(2,0+2*1) >= 0);
ASSUME(cw(2,0+2*1) >= iw(2,0+2*1));
ASSUME(cw(2,0+2*1) >= old_cw);
ASSUME(cw(2,0+2*1) >= cr(2,0+2*1));
ASSUME(cw(2,0+2*1) >= cl[2]);
ASSUME(cw(2,0+2*1) >= cisb[2]);
ASSUME(cw(2,0+2*1) >= cdy[2]);
ASSUME(cw(2,0+2*1) >= cdl[2]);
ASSUME(cw(2,0+2*1) >= cds[2]);
ASSUME(cw(2,0+2*1) >= cctrl[2]);
ASSUME(cw(2,0+2*1) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,0+2*1) = 1;
mem(0+2*1,cw(2,0+2*1)) = 1;
co(0+2*1,cw(2,0+2*1))+=1;
delta(0+2*1,cw(2,0+2*1)) = -1;
ASSUME(creturn[2] >= cw(2,0+2*1));
// %cmp2 = icmp eq i32 %conv, 1, !dbg !64
creg__r0__1_ = max(0,creg_r0);
// %conv3 = zext i1 %cmp2 to i32, !dbg !64
// call void @llvm.dbg.value(metadata i32 %conv3, metadata !64, metadata !DIExpression()), !dbg !67
// store i32 %conv3, i32* @atom_1_X0_1, align 4, !dbg !65, !tbaa !66
// ST: Guess
iw(2,3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW _l33_c15
old_cw = cw(2,3);
cw(2,3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM _l33_c15
// Check
ASSUME(active[iw(2,3)] == 2);
ASSUME(active[cw(2,3)] == 2);
ASSUME(sforbid(3,cw(2,3))== 0);
ASSUME(iw(2,3) >= creg__r0__1_);
ASSUME(iw(2,3) >= 0);
ASSUME(cw(2,3) >= iw(2,3));
ASSUME(cw(2,3) >= old_cw);
ASSUME(cw(2,3) >= cr(2,3));
ASSUME(cw(2,3) >= cl[2]);
ASSUME(cw(2,3) >= cisb[2]);
ASSUME(cw(2,3) >= cdy[2]);
ASSUME(cw(2,3) >= cdl[2]);
ASSUME(cw(2,3) >= cds[2]);
ASSUME(cw(2,3) >= cctrl[2]);
ASSUME(cw(2,3) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,3) = (r0==1);
mem(3,cw(2,3)) = (r0==1);
co(3,cw(2,3))+=1;
delta(3,cw(2,3)) = -1;
ASSUME(creturn[2] >= cw(2,3));
// ret i8* null, !dbg !70
ret_thread_2 = (- 1);
goto T2BLOCK_END;
T2BLOCK_END:
// Dumping thread 3
int ret_thread_3 = 0;
cdy[3] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[3] >= cstart[3]);
T3BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !91, metadata !DIExpression()), !dbg !101
// br label %label_3, !dbg !48
goto T3BLOCK1;
T3BLOCK1:
// call void @llvm.dbg.label(metadata !100), !dbg !103
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !93, metadata !DIExpression()), !dbg !104
// %0 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !51
// LD: Guess
old_cr = cr(3,0+2*1);
cr(3,0+2*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN LDCOM _l39_c15
// Check
ASSUME(active[cr(3,0+2*1)] == 3);
ASSUME(cr(3,0+2*1) >= iw(3,0+2*1));
ASSUME(cr(3,0+2*1) >= 0);
ASSUME(cr(3,0+2*1) >= cdy[3]);
ASSUME(cr(3,0+2*1) >= cisb[3]);
ASSUME(cr(3,0+2*1) >= cdl[3]);
ASSUME(cr(3,0+2*1) >= cl[3]);
// Update
creg_r1 = cr(3,0+2*1);
crmax(3,0+2*1) = max(crmax(3,0+2*1),cr(3,0+2*1));
caddr[3] = max(caddr[3],0);
if(cr(3,0+2*1) < cw(3,0+2*1)) {
r1 = buff(3,0+2*1);
ASSUME((!(( (cw(3,0+2*1) < 1) && (1 < crmax(3,0+2*1)) )))||(sforbid(0+2*1,1)> 0));
ASSUME((!(( (cw(3,0+2*1) < 2) && (2 < crmax(3,0+2*1)) )))||(sforbid(0+2*1,2)> 0));
ASSUME((!(( (cw(3,0+2*1) < 3) && (3 < crmax(3,0+2*1)) )))||(sforbid(0+2*1,3)> 0));
ASSUME((!(( (cw(3,0+2*1) < 4) && (4 < crmax(3,0+2*1)) )))||(sforbid(0+2*1,4)> 0));
} else {
if(pw(3,0+2*1) != co(0+2*1,cr(3,0+2*1))) {
ASSUME(cr(3,0+2*1) >= old_cr);
}
pw(3,0+2*1) = co(0+2*1,cr(3,0+2*1));
r1 = mem(0+2*1,cr(3,0+2*1));
}
ASSUME(creturn[3] >= cr(3,0+2*1));
// call void @llvm.dbg.value(metadata i64 %0, metadata !95, metadata !DIExpression()), !dbg !104
// %conv = trunc i64 %0 to i32, !dbg !52
// call void @llvm.dbg.value(metadata i32 %conv, metadata !92, metadata !DIExpression()), !dbg !101
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !96, metadata !DIExpression()), !dbg !107
// call void @llvm.dbg.value(metadata i64 1, metadata !98, metadata !DIExpression()), !dbg !107
// store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !54
// ST: Guess
iw(3,0+1*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW _l40_c3
old_cw = cw(3,0+1*1);
cw(3,0+1*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM _l40_c3
// Check
ASSUME(active[iw(3,0+1*1)] == 3);
ASSUME(active[cw(3,0+1*1)] == 3);
ASSUME(sforbid(0+1*1,cw(3,0+1*1))== 0);
ASSUME(iw(3,0+1*1) >= 0);
ASSUME(iw(3,0+1*1) >= 0);
ASSUME(cw(3,0+1*1) >= iw(3,0+1*1));
ASSUME(cw(3,0+1*1) >= old_cw);
ASSUME(cw(3,0+1*1) >= cr(3,0+1*1));
ASSUME(cw(3,0+1*1) >= cl[3]);
ASSUME(cw(3,0+1*1) >= cisb[3]);
ASSUME(cw(3,0+1*1) >= cdy[3]);
ASSUME(cw(3,0+1*1) >= cdl[3]);
ASSUME(cw(3,0+1*1) >= cds[3]);
ASSUME(cw(3,0+1*1) >= cctrl[3]);
ASSUME(cw(3,0+1*1) >= caddr[3]);
// Update
caddr[3] = max(caddr[3],0);
buff(3,0+1*1) = 1;
mem(0+1*1,cw(3,0+1*1)) = 1;
co(0+1*1,cw(3,0+1*1))+=1;
delta(0+1*1,cw(3,0+1*1)) = -1;
ASSUME(creturn[3] >= cw(3,0+1*1));
// %cmp = icmp eq i32 %conv, 1, !dbg !55
creg__r1__1_ = max(0,creg_r1);
// %conv1 = zext i1 %cmp to i32, !dbg !55
// call void @llvm.dbg.value(metadata i32 %conv1, metadata !99, metadata !DIExpression()), !dbg !101
// store i32 %conv1, i32* @atom_2_X0_1, align 4, !dbg !56, !tbaa !57
// ST: Guess
iw(3,4) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW _l42_c15
old_cw = cw(3,4);
cw(3,4) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM _l42_c15
// Check
ASSUME(active[iw(3,4)] == 3);
ASSUME(active[cw(3,4)] == 3);
ASSUME(sforbid(4,cw(3,4))== 0);
ASSUME(iw(3,4) >= creg__r1__1_);
ASSUME(iw(3,4) >= 0);
ASSUME(cw(3,4) >= iw(3,4));
ASSUME(cw(3,4) >= old_cw);
ASSUME(cw(3,4) >= cr(3,4));
ASSUME(cw(3,4) >= cl[3]);
ASSUME(cw(3,4) >= cisb[3]);
ASSUME(cw(3,4) >= cdy[3]);
ASSUME(cw(3,4) >= cdl[3]);
ASSUME(cw(3,4) >= cds[3]);
ASSUME(cw(3,4) >= cctrl[3]);
ASSUME(cw(3,4) >= caddr[3]);
// Update
caddr[3] = max(caddr[3],0);
buff(3,4) = (r1==1);
mem(4,cw(3,4)) = (r1==1);
co(4,cw(3,4))+=1;
delta(4,cw(3,4)) = -1;
ASSUME(creturn[3] >= cw(3,4));
// ret i8* null, !dbg !61
ret_thread_3 = (- 1);
goto T3BLOCK_END;
T3BLOCK_END:
// Dumping thread 0
int ret_thread_0 = 0;
cdy[0] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[0] >= cstart[0]);
T0BLOCK0:
// %thr0 = alloca i64, align 8
// %thr1 = alloca i64, align 8
// %thr2 = alloca i64, align 8
// call void @llvm.dbg.value(metadata i32 %argc, metadata !119, metadata !DIExpression()), !dbg !145
// call void @llvm.dbg.value(metadata i8** %argv, metadata !120, metadata !DIExpression()), !dbg !145
// %0 = bitcast i64* %thr0 to i8*, !dbg !67
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #7, !dbg !67
// call void @llvm.dbg.declare(metadata i64* %thr0, metadata !121, metadata !DIExpression()), !dbg !147
// %1 = bitcast i64* %thr1 to i8*, !dbg !69
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #7, !dbg !69
// call void @llvm.dbg.declare(metadata i64* %thr1, metadata !125, metadata !DIExpression()), !dbg !149
// %2 = bitcast i64* %thr2 to i8*, !dbg !71
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #7, !dbg !71
// call void @llvm.dbg.declare(metadata i64* %thr2, metadata !126, metadata !DIExpression()), !dbg !151
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !127, metadata !DIExpression()), !dbg !152
// call void @llvm.dbg.value(metadata i64 0, metadata !129, metadata !DIExpression()), !dbg !152
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !74
// ST: Guess
iw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l51_c3
old_cw = cw(0,0+2*1);
cw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l51_c3
// Check
ASSUME(active[iw(0,0+2*1)] == 0);
ASSUME(active[cw(0,0+2*1)] == 0);
ASSUME(sforbid(0+2*1,cw(0,0+2*1))== 0);
ASSUME(iw(0,0+2*1) >= 0);
ASSUME(iw(0,0+2*1) >= 0);
ASSUME(cw(0,0+2*1) >= iw(0,0+2*1));
ASSUME(cw(0,0+2*1) >= old_cw);
ASSUME(cw(0,0+2*1) >= cr(0,0+2*1));
ASSUME(cw(0,0+2*1) >= cl[0]);
ASSUME(cw(0,0+2*1) >= cisb[0]);
ASSUME(cw(0,0+2*1) >= cdy[0]);
ASSUME(cw(0,0+2*1) >= cdl[0]);
ASSUME(cw(0,0+2*1) >= cds[0]);
ASSUME(cw(0,0+2*1) >= cctrl[0]);
ASSUME(cw(0,0+2*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+2*1) = 0;
mem(0+2*1,cw(0,0+2*1)) = 0;
co(0+2*1,cw(0,0+2*1))+=1;
delta(0+2*1,cw(0,0+2*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+2*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !130, metadata !DIExpression()), !dbg !154
// call void @llvm.dbg.value(metadata i64 0, metadata !132, metadata !DIExpression()), !dbg !154
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !76
// ST: Guess
iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l52_c3
old_cw = cw(0,0+1*1);
cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l52_c3
// Check
ASSUME(active[iw(0,0+1*1)] == 0);
ASSUME(active[cw(0,0+1*1)] == 0);
ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(cw(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cw(0,0+1*1) >= old_cw);
ASSUME(cw(0,0+1*1) >= cr(0,0+1*1));
ASSUME(cw(0,0+1*1) >= cl[0]);
ASSUME(cw(0,0+1*1) >= cisb[0]);
ASSUME(cw(0,0+1*1) >= cdy[0]);
ASSUME(cw(0,0+1*1) >= cdl[0]);
ASSUME(cw(0,0+1*1) >= cds[0]);
ASSUME(cw(0,0+1*1) >= cctrl[0]);
ASSUME(cw(0,0+1*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+1*1) = 0;
mem(0+1*1,cw(0,0+1*1)) = 0;
co(0+1*1,cw(0,0+1*1))+=1;
delta(0+1*1,cw(0,0+1*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !133, metadata !DIExpression()), !dbg !156
// call void @llvm.dbg.value(metadata i64 0, metadata !135, metadata !DIExpression()), !dbg !156
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !78
// ST: Guess
iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l53_c3
old_cw = cw(0,0);
cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l53_c3
// Check
ASSUME(active[iw(0,0)] == 0);
ASSUME(active[cw(0,0)] == 0);
ASSUME(sforbid(0,cw(0,0))== 0);
ASSUME(iw(0,0) >= 0);
ASSUME(iw(0,0) >= 0);
ASSUME(cw(0,0) >= iw(0,0));
ASSUME(cw(0,0) >= old_cw);
ASSUME(cw(0,0) >= cr(0,0));
ASSUME(cw(0,0) >= cl[0]);
ASSUME(cw(0,0) >= cisb[0]);
ASSUME(cw(0,0) >= cdy[0]);
ASSUME(cw(0,0) >= cdl[0]);
ASSUME(cw(0,0) >= cds[0]);
ASSUME(cw(0,0) >= cctrl[0]);
ASSUME(cw(0,0) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0) = 0;
mem(0,cw(0,0)) = 0;
co(0,cw(0,0))+=1;
delta(0,cw(0,0)) = -1;
ASSUME(creturn[0] >= cw(0,0));
// store i32 0, i32* @atom_1_X0_1, align 4, !dbg !79, !tbaa !80
// ST: Guess
iw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l54_c15
old_cw = cw(0,3);
cw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l54_c15
// Check
ASSUME(active[iw(0,3)] == 0);
ASSUME(active[cw(0,3)] == 0);
ASSUME(sforbid(3,cw(0,3))== 0);
ASSUME(iw(0,3) >= 0);
ASSUME(iw(0,3) >= 0);
ASSUME(cw(0,3) >= iw(0,3));
ASSUME(cw(0,3) >= old_cw);
ASSUME(cw(0,3) >= cr(0,3));
ASSUME(cw(0,3) >= cl[0]);
ASSUME(cw(0,3) >= cisb[0]);
ASSUME(cw(0,3) >= cdy[0]);
ASSUME(cw(0,3) >= cdl[0]);
ASSUME(cw(0,3) >= cds[0]);
ASSUME(cw(0,3) >= cctrl[0]);
ASSUME(cw(0,3) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,3) = 0;
mem(3,cw(0,3)) = 0;
co(3,cw(0,3))+=1;
delta(3,cw(0,3)) = -1;
ASSUME(creturn[0] >= cw(0,3));
// store i32 0, i32* @atom_2_X0_1, align 4, !dbg !84, !tbaa !80
// ST: Guess
iw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW _l55_c15
old_cw = cw(0,4);
cw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM _l55_c15
// Check
ASSUME(active[iw(0,4)] == 0);
ASSUME(active[cw(0,4)] == 0);
ASSUME(sforbid(4,cw(0,4))== 0);
ASSUME(iw(0,4) >= 0);
ASSUME(iw(0,4) >= 0);
ASSUME(cw(0,4) >= iw(0,4));
ASSUME(cw(0,4) >= old_cw);
ASSUME(cw(0,4) >= cr(0,4));
ASSUME(cw(0,4) >= cl[0]);
ASSUME(cw(0,4) >= cisb[0]);
ASSUME(cw(0,4) >= cdy[0]);
ASSUME(cw(0,4) >= cdl[0]);
ASSUME(cw(0,4) >= cds[0]);
ASSUME(cw(0,4) >= cctrl[0]);
ASSUME(cw(0,4) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,4) = 0;
mem(4,cw(0,4)) = 0;
co(4,cw(0,4))+=1;
delta(4,cw(0,4)) = -1;
ASSUME(creturn[0] >= cw(0,4));
// %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #7, !dbg !85
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[1] >= cdy[0]);
// %call5 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #7, !dbg !86
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[2] >= cdy[0]);
// %call6 = call i32 @pthread_create(i64* noundef %thr2, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t2, i8* noundef null) #7, !dbg !87
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[3] >= cdy[0]);
// %3 = load i64, i64* %thr0, align 8, !dbg !88, !tbaa !89
r3 = local_mem[0];
// %call7 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !91
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[1]);
// %4 = load i64, i64* %thr1, align 8, !dbg !92, !tbaa !89
r4 = local_mem[1];
// %call8 = call i32 @pthread_join(i64 noundef %4, i8** noundef null), !dbg !93
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[2]);
// %5 = load i64, i64* %thr2, align 8, !dbg !94, !tbaa !89
r5 = local_mem[2];
// %call9 = call i32 @pthread_join(i64 noundef %5, i8** noundef null), !dbg !95
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[3]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !137, metadata !DIExpression()), !dbg !171
// %6 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !97
// LD: Guess
old_cr = cr(0,0+1*1);
cr(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l65_c12
// Check
ASSUME(active[cr(0,0+1*1)] == 0);
ASSUME(cr(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cr(0,0+1*1) >= 0);
ASSUME(cr(0,0+1*1) >= cdy[0]);
ASSUME(cr(0,0+1*1) >= cisb[0]);
ASSUME(cr(0,0+1*1) >= cdl[0]);
ASSUME(cr(0,0+1*1) >= cl[0]);
// Update
creg_r6 = cr(0,0+1*1);
crmax(0,0+1*1) = max(crmax(0,0+1*1),cr(0,0+1*1));
caddr[0] = max(caddr[0],0);
if(cr(0,0+1*1) < cw(0,0+1*1)) {
r6 = buff(0,0+1*1);
ASSUME((!(( (cw(0,0+1*1) < 1) && (1 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,1)> 0));
ASSUME((!(( (cw(0,0+1*1) < 2) && (2 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,2)> 0));
ASSUME((!(( (cw(0,0+1*1) < 3) && (3 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,3)> 0));
ASSUME((!(( (cw(0,0+1*1) < 4) && (4 < crmax(0,0+1*1)) )))||(sforbid(0+1*1,4)> 0));
} else {
if(pw(0,0+1*1) != co(0+1*1,cr(0,0+1*1))) {
ASSUME(cr(0,0+1*1) >= old_cr);
}
pw(0,0+1*1) = co(0+1*1,cr(0,0+1*1));
r6 = mem(0+1*1,cr(0,0+1*1));
}
ASSUME(creturn[0] >= cr(0,0+1*1));
// call void @llvm.dbg.value(metadata i64 %6, metadata !139, metadata !DIExpression()), !dbg !171
// %conv = trunc i64 %6 to i32, !dbg !98
// call void @llvm.dbg.value(metadata i32 %conv, metadata !136, metadata !DIExpression()), !dbg !145
// %cmp = icmp eq i32 %conv, 2, !dbg !99
creg__r6__2_ = max(0,creg_r6);
// %conv10 = zext i1 %cmp to i32, !dbg !99
// call void @llvm.dbg.value(metadata i32 %conv10, metadata !140, metadata !DIExpression()), !dbg !145
// %7 = load i32, i32* @atom_1_X0_1, align 4, !dbg !100, !tbaa !80
// LD: Guess
old_cr = cr(0,3);
cr(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l67_c13
// Check
ASSUME(active[cr(0,3)] == 0);
ASSUME(cr(0,3) >= iw(0,3));
ASSUME(cr(0,3) >= 0);
ASSUME(cr(0,3) >= cdy[0]);
ASSUME(cr(0,3) >= cisb[0]);
ASSUME(cr(0,3) >= cdl[0]);
ASSUME(cr(0,3) >= cl[0]);
// Update
creg_r7 = cr(0,3);
crmax(0,3) = max(crmax(0,3),cr(0,3));
caddr[0] = max(caddr[0],0);
if(cr(0,3) < cw(0,3)) {
r7 = buff(0,3);
ASSUME((!(( (cw(0,3) < 1) && (1 < crmax(0,3)) )))||(sforbid(3,1)> 0));
ASSUME((!(( (cw(0,3) < 2) && (2 < crmax(0,3)) )))||(sforbid(3,2)> 0));
ASSUME((!(( (cw(0,3) < 3) && (3 < crmax(0,3)) )))||(sforbid(3,3)> 0));
ASSUME((!(( (cw(0,3) < 4) && (4 < crmax(0,3)) )))||(sforbid(3,4)> 0));
} else {
if(pw(0,3) != co(3,cr(0,3))) {
ASSUME(cr(0,3) >= old_cr);
}
pw(0,3) = co(3,cr(0,3));
r7 = mem(3,cr(0,3));
}
ASSUME(creturn[0] >= cr(0,3));
// call void @llvm.dbg.value(metadata i32 %7, metadata !141, metadata !DIExpression()), !dbg !145
// %8 = load i32, i32* @atom_2_X0_1, align 4, !dbg !101, !tbaa !80
// LD: Guess
old_cr = cr(0,4);
cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM _l68_c13
// Check
ASSUME(active[cr(0,4)] == 0);
ASSUME(cr(0,4) >= iw(0,4));
ASSUME(cr(0,4) >= 0);
ASSUME(cr(0,4) >= cdy[0]);
ASSUME(cr(0,4) >= cisb[0]);
ASSUME(cr(0,4) >= cdl[0]);
ASSUME(cr(0,4) >= cl[0]);
// Update
creg_r8 = cr(0,4);
crmax(0,4) = max(crmax(0,4),cr(0,4));
caddr[0] = max(caddr[0],0);
if(cr(0,4) < cw(0,4)) {
r8 = buff(0,4);
ASSUME((!(( (cw(0,4) < 1) && (1 < crmax(0,4)) )))||(sforbid(4,1)> 0));
ASSUME((!(( (cw(0,4) < 2) && (2 < crmax(0,4)) )))||(sforbid(4,2)> 0));
ASSUME((!(( (cw(0,4) < 3) && (3 < crmax(0,4)) )))||(sforbid(4,3)> 0));
ASSUME((!(( (cw(0,4) < 4) && (4 < crmax(0,4)) )))||(sforbid(4,4)> 0));
} else {
if(pw(0,4) != co(4,cr(0,4))) {
ASSUME(cr(0,4) >= old_cr);
}
pw(0,4) = co(4,cr(0,4));
r8 = mem(4,cr(0,4));
}
ASSUME(creturn[0] >= cr(0,4));
// call void @llvm.dbg.value(metadata i32 %8, metadata !142, metadata !DIExpression()), !dbg !145
// %and = and i32 %7, %8, !dbg !102
creg_r9 = max(creg_r7,creg_r8);
r9 = r7 & r8;
// call void @llvm.dbg.value(metadata i32 %and, metadata !143, metadata !DIExpression()), !dbg !145
// %and11 = and i32 %conv10, %and, !dbg !103
creg_r10 = max(creg__r6__2_,creg_r9);
r10 = (r6==2) & r9;
// call void @llvm.dbg.value(metadata i32 %and11, metadata !144, metadata !DIExpression()), !dbg !145
// %cmp12 = icmp eq i32 %and11, 1, !dbg !104
creg__r10__1_ = max(0,creg_r10);
// br i1 %cmp12, label %if.then, label %if.end, !dbg !106
old_cctrl = cctrl[0];
cctrl[0] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[0] >= old_cctrl);
ASSUME(cctrl[0] >= creg__r10__1_);
if((r10==1)) {
goto T0BLOCK1;
} else {
goto T0BLOCK2;
}
T0BLOCK1:
// call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([127 x i8], [127 x i8]* @.str.1, i64 0, i64 0), i32 noundef 71, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #8, !dbg !107
// unreachable, !dbg !107
r11 = 1;
goto T0BLOCK_END;
T0BLOCK2:
// %9 = bitcast i64* %thr2 to i8*, !dbg !110
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %9) #7, !dbg !110
// %10 = bitcast i64* %thr1 to i8*, !dbg !110
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %10) #7, !dbg !110
// %11 = bitcast i64* %thr0 to i8*, !dbg !110
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %11) #7, !dbg !110
// ret i32 0, !dbg !111
ret_thread_0 = 0;
goto T0BLOCK_END;
T0BLOCK_END:
ASSUME(meminit(0,1) == mem(0,0));
ASSUME(coinit(0,1) == co(0,0));
ASSUME(deltainit(0,1) == delta(0,0));
ASSUME(meminit(0,2) == mem(0,1));
ASSUME(coinit(0,2) == co(0,1));
ASSUME(deltainit(0,2) == delta(0,1));
ASSUME(meminit(0,3) == mem(0,2));
ASSUME(coinit(0,3) == co(0,2));
ASSUME(deltainit(0,3) == delta(0,2));
ASSUME(meminit(0,4) == mem(0,3));
ASSUME(coinit(0,4) == co(0,3));
ASSUME(deltainit(0,4) == delta(0,3));
ASSUME(meminit(1,1) == mem(1,0));
ASSUME(coinit(1,1) == co(1,0));
ASSUME(deltainit(1,1) == delta(1,0));
ASSUME(meminit(1,2) == mem(1,1));
ASSUME(coinit(1,2) == co(1,1));
ASSUME(deltainit(1,2) == delta(1,1));
ASSUME(meminit(1,3) == mem(1,2));
ASSUME(coinit(1,3) == co(1,2));
ASSUME(deltainit(1,3) == delta(1,2));
ASSUME(meminit(1,4) == mem(1,3));
ASSUME(coinit(1,4) == co(1,3));
ASSUME(deltainit(1,4) == delta(1,3));
ASSUME(meminit(2,1) == mem(2,0));
ASSUME(coinit(2,1) == co(2,0));
ASSUME(deltainit(2,1) == delta(2,0));
ASSUME(meminit(2,2) == mem(2,1));
ASSUME(coinit(2,2) == co(2,1));
ASSUME(deltainit(2,2) == delta(2,1));
ASSUME(meminit(2,3) == mem(2,2));
ASSUME(coinit(2,3) == co(2,2));
ASSUME(deltainit(2,3) == delta(2,2));
ASSUME(meminit(2,4) == mem(2,3));
ASSUME(coinit(2,4) == co(2,3));
ASSUME(deltainit(2,4) == delta(2,3));
ASSUME(meminit(3,1) == mem(3,0));
ASSUME(coinit(3,1) == co(3,0));
ASSUME(deltainit(3,1) == delta(3,0));
ASSUME(meminit(3,2) == mem(3,1));
ASSUME(coinit(3,2) == co(3,1));
ASSUME(deltainit(3,2) == delta(3,1));
ASSUME(meminit(3,3) == mem(3,2));
ASSUME(coinit(3,3) == co(3,2));
ASSUME(deltainit(3,3) == delta(3,2));
ASSUME(meminit(3,4) == mem(3,3));
ASSUME(coinit(3,4) == co(3,3));
ASSUME(deltainit(3,4) == delta(3,3));
ASSUME(meminit(4,1) == mem(4,0));
ASSUME(coinit(4,1) == co(4,0));
ASSUME(deltainit(4,1) == delta(4,0));
ASSUME(meminit(4,2) == mem(4,1));
ASSUME(coinit(4,2) == co(4,1));
ASSUME(deltainit(4,2) == delta(4,1));
ASSUME(meminit(4,3) == mem(4,2));
ASSUME(coinit(4,3) == co(4,2));
ASSUME(deltainit(4,3) == delta(4,2));
ASSUME(meminit(4,4) == mem(4,3));
ASSUME(coinit(4,4) == co(4,3));
ASSUME(deltainit(4,4) == delta(4,3));
ASSERT(r11== 0);
}
| [
"[email protected]"
] | |
37cc1409a72ea7f48e2b760e96b4ffef0ba562d6 | 2c2a597ccf11116a843ef252e9fedf85dd807d64 | /SPMS/Arduino/libraries/RFIDTag/RFIDTag.h | 34c74c188c1fc0b36b2bd6f0e639c1f81ac6b812 | [] | no_license | JanahanMathanamohan/CompletedProjects | 75c6126f6b80c6b2670367af4aefe212699fbda2 | 5210fbf8cf0c5ff1eddc68a1687ec27e8954aff6 | refs/heads/master | 2021-01-17T20:24:58.850865 | 2016-07-26T14:47:52 | 2016-07-26T14:47:52 | 64,226,780 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 188 | h | #ifndef RFIDTag_h
#define RFIDTag_h
class RFIDTag{
public:
RFIDTag(int array[]);
int getID(int i);
void setID(int i,int id);
private:
int rfidTag[4] = {0,0,0,0};
};
#endif | [
"[email protected]"
] | |
46f6e2781c93abdb4fa2429e922e3357e5567057 | b1ec1d5f4e6b1a58b9c26f4c2bab0313610fa446 | /BLinkedList.cc | 8101d1636cd9ff64a5255b8b1b27de29f64f4705 | [] | no_license | InTheSky555/LinkedList | 4eda26e9c6cca0aea1ef825f5ef849aebabd24fa | fdacb03aefa9ed59a98862730c0939736d8569ac | refs/heads/master | 2021-04-09T10:28:14.970438 | 2016-05-28T12:55:44 | 2016-05-28T12:55:44 | 59,894,544 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,241 | cc | #include "BLinkedList.h"
BLList::BLList()
{
this->root = NULL;
}
BLList::~BLList()
{
}
void BLList::midorder(BLNode* root)
{
if(root->left != NULL)
{
midorder(root->left);
}
std::cout << root->data << std::endl;
if(root->right != NULL)
{
midorder(root->right);
}
}
bool BLList::print_list()
{
if(this->root != NULL)
{
midorder(this->root);
}
return true;
}
// virtual bool make_null();
BLNode* BLList::find(element_type data)
{
return NULL;
}
bool BLList::insert(BLNode* root, element_type data)
{
if(data < root->data)
{
if(root->left != NULL)
{
insert(root->left,data);
}
else
{
BLNode* newnode = new BLNode(data);
root->left = newnode;
return true;
}
}
else if(data > root->data)
{
if(root->right != NULL)
{
insert(root->right,data);
}
else
{
BLNode* newnode = new BLNode(data);
root->right = newnode;
return true;
}
}
return false;
}
bool BLList::insert(element_type data)
{
if(this->root == NULL)
{
BLNode* newnode = new BLNode(data);
this->root = newnode;
}
else
{
insert(this->root,data);
}
return true;
}
// virtual bool delete_key(element_type data);
// virtual element_type delete_kth(int position);
// virtual bool is_empty();
| [
"[email protected]"
] | |
700156fdaa3817f8a4a19196a1ead70f67b49fad | a95883a9d92a657e8704f85b488700a0101ddb35 | /test/serialbox/core/UnittestUnreachable.cpp | 64e6566759cb4a4059fb35c51c8d85ee7c646cdc | [
"BSD-2-Clause",
"BSD-3-Clause",
"MIT"
] | permissive | mlange05/serialbox2 | d19b5f3094cc10a453b5a7d1580cf51c4085fdff | fa72d8a39f62c7c0b76536680f7a9953957f59f2 | refs/heads/master | 2020-04-26T03:51:51.141899 | 2019-02-04T10:19:37 | 2019-02-04T10:19:37 | 173,281,773 | 1 | 0 | BSD-2-Clause | 2019-03-01T10:20:08 | 2019-03-01T10:20:08 | null | UTF-8 | C++ | false | false | 903 | cpp | //===-- serialbox/core/UnittestUnreachable.cpp --------------------------------------*- C++ -*-===//
//
// S E R I A L B O X
//
// This file is distributed under terms of BSD license.
// See LICENSE.txt for more information
//
//===------------------------------------------------------------------------------------------===//
//
/// \file
/// This file contains the unittests for the Unreachable utility.
///
//===------------------------------------------------------------------------------------------===//
#include "serialbox/core/Type.h"
#include "serialbox/core/Unreachable.h"
#include <gtest/gtest.h>
using namespace serialbox;
TEST(UnreachableTest, Unreachable) {
#if defined(SERIALBOX_RUN_DEATH_TESTS) && !defined(NDEBUG)
ASSERT_DEATH_IF_SUPPORTED(serialbox_unreachable("blub"), "^FATAL ERROR: UNREACHABLE executed");
#endif
}
| [
"[email protected]"
] | |
a648b6e0c0201648b29541f07bf222bcbfc99dd7 | 83120258156459f6aa7575fdd360f225c3b9d797 | /cnn-text-classification/MaxPoolingLayer.cpp | ab36fdf865820cb4355a285f7a88b9c34cb2dbae | [] | no_license | byeongkeunahn/cnn-text-classification | 7ce576e840b8911beae54853183709434c8f2569 | e20520880926907e15f72f40d1e82c4037ea3726 | refs/heads/master | 2020-09-24T16:34:20.296299 | 2019-12-04T14:39:59 | 2019-12-04T14:39:59 | 225,799,617 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,646 | cpp |
#include "pch.h"
#include "MaxPoolingLayer.h"
MaxPoolingLayer::MaxPoolingLayer(Layer *pInput)
{
auto indim = pInput->GetOutputDimension();
if (indim.size() != 1 || indim[0] == 0 || indim[0] <= -2) { /* we allow for indeterminate input dimension */
throw std::exception("SoftmaxLayer: Input layer has wrong dimensions");
}
m_dim = indim[0];
m_OutputGrad = new float[1];
AddInLayer(pInput);
}
MaxPoolingLayer::~MaxPoolingLayer()
{
delete[] m_OutputGrad;
}
std::vector<int> MaxPoolingLayer::GetOutputDimension() {
return std::vector<int>({ 1 });
}
int MaxPoolingLayer::GetNumberOfParams() {
return 0; // indicates non-necessity of optimizer
}
void MaxPoolingLayer::ForwardProp() {
Layer *pInputLayer = m_inLayers[0]; // there is only one such layer
m_dimCurrent = pInputLayer->GetCurrentOutputDimension()[0];
float *input = (float *)pInputLayer->GetOutput();
m_Output = input[0];
m_ArgMaxIndex = 0;
for (int i = 0; i < m_dimCurrent; i++) {
if (input[i] > m_Output) {
m_Output = input[i];
m_ArgMaxIndex = i;
}
}
memset(m_OutputGrad, 0, sizeof(float) * 1);
}
void MaxPoolingLayer::BackwardProp() {
/* compute the gradients */
m_InputGrad.resize(m_dimCurrent);
memset(&m_InputGrad[0], 0, sizeof(float)*m_dimCurrent);
m_InputGrad[m_ArgMaxIndex] = m_OutputGrad[0];
/* broadcasting */
BroadcastInputGradient(&m_InputGrad[0]);
}
float* MaxPoolingLayer::GetOutput() {
return &m_Output;
}
void MaxPoolingLayer::UpdateParams() {
/* a max-pooling layer does not have any associated parameters */
}
| [
"[email protected]"
] | |
8d9db7bc9640ee71c2ed508c5071dbafc4445ffa | a33aac97878b2cb15677be26e308cbc46e2862d2 | /program_data/PKU_raw/98/741.c | 3fe489d1f2114d22fb947a2586593803b7e11bbf | [] | no_license | GabeOchieng/ggnn.tensorflow | f5d7d0bca52258336fc12c9de6ae38223f28f786 | 7c62c0e8427bea6c8bec2cebf157b6f1ea70a213 | refs/heads/master | 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 353 | c | /*
* word.cpp
*
* Created on: 2011-12-11
* Author: wangshiheng
*/
int main()
{
char words[41];
int s=-1,l,n,i;
cin>>n;
for (i=0;i<n;i++)
{
cin>>words;
l=strlen(words);
if (s==-1){s=l+s+1;cout<<words;}
else if (s+l+1<=80){s=l+s+1;cout<<' '<<words;}
else {s=l;cout<<endl;cout<<words;}
}
return 0;
}
| [
"[email protected]"
] | |
2826c3f2c39720f75aa7654b4e71020cb2de6c85 | 524fdadabf05e19ef5b8ec05c770603ff36086c1 | /Solutions/101482 - 2014-2015 Northwestern European Regional Contest (NWERC 2014)/J.cpp | d355d1dbf71236f5cbcfe6d86c0ee76b216ad658 | [] | no_license | DolaBMOon/Codeforces-Gyms-Solutions | f000866f2fe1ffa6b480f7b7e85ed7f793a28d51 | 668271c177b447e79375bdb3248213cc0f36308a | refs/heads/master | 2020-04-01T16:44:12.685470 | 2018-10-15T11:03:44 | 2018-10-15T11:03:44 | 153,395,640 | 1 | 0 | null | 2018-10-17T04:31:29 | 2018-10-17T04:31:29 | null | UTF-8 | C++ | false | false | 1,265 | cpp | // 2014-2015 Northwestern European Regional Contest (NWERC 2014)
// 101482J
#include <bits/stdc++.h>
using namespace std;
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;
map<string, int> M;
int main() {
#ifndef ONLINE_JUDGE
//freopen("in.in", "r", stdin);
//freopen("out.in", "w", stdout);
#endif
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin >> n;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
M[s]++;
}
int res = 0;
for (int i = 0; i < n; i++) {
cin >> s;
if (M[s])
res++, M[s]--;
}
cout << res << endl;
return 0;
}
| [
"[email protected]"
] | |
6175a4db8e9be50ec0ea72a8e95b2bbc388708f5 | c9cf0586ace11aa32fa67606d237a130a06364ee | /circular-cylinder-10-30/12.75/phi | 26488573449191391ce9870fb4f2356ca868a58e | [] | no_license | jezvonek/CFD-Final-Project | c74cfa21f22545c27d97d85cf30eb6dc8c824dc1 | 7c9a7fb032d74f20888effa0a0b75b212bf899f4 | refs/heads/master | 2022-07-05T14:43:52.967657 | 2020-05-14T03:40:56 | 2020-05-14T03:40:56 | 262,370,756 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 49,009 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6.0
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "12.75";
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
4670
(
0.00424699
-0.628554
0.624307
0.0122693
-0.603223
0.595201
0.0209059
-0.583306
0.57467
0.0289567
-0.555734
0.547683
0.0362441
-0.526202
0.518915
0.0429416
-0.497071
0.490373
0.0492963
-0.469794
0.463439
0.055518
-0.445194
0.438972
0.0617797
-0.423496
0.417234
-0.404591
0.398106
0.0682651
0.00438248
-0.632937
0.0122514
-0.611092
0.0205506
-0.591605
0.0281974
-0.563381
0.0350726
-0.533078
0.0413818
-0.50338
0.0473788
-0.475791
0.0532623
-0.451077
0.0591926
-0.429426
-0.410741
0.0653419
0.00441621
-0.637353
0.0120292
-0.618705
0.019901
-0.599477
0.0270474
-0.570527
0.033419
-0.539449
0.0392577
-0.509219
0.0448239
-0.481357
0.0503013
-0.456555
0.0558332
-0.434958
-0.416498
0.0615905
0.00433664
-0.641689
0.0116107
-0.625979
0.0189769
-0.606843
0.0255435
-0.577094
0.031327
-0.545233
0.0366079
-0.5145
0.0416632
-0.486413
0.0466752
-0.461567
0.051784
-0.440067
-0.421893
0.0571792
0.00417003
-0.64586
0.0110143
-0.632824
0.01781
-0.613639
0.0237401
-0.583024
0.0288699
-0.550362
0.0335014
-0.519131
0.0379225
-0.490834
0.0423358
-0.46598
0.0469197
-0.44465
-0.426916
0.0519421
0.00391217
-0.649772
0.010248
-0.639159
0.0164093
-0.6198
0.0216588
-0.588273
0.0261065
-0.55481
0.030052
-0.523077
0.0337537
-0.494535
0.0374142
-0.469641
0.041299
-0.448535
-0.431455
0.0458382
0.00359147
-0.653363
0.00935223
-0.64492
0.0148006
-0.625249
0.019283
-0.592756
0.0229821
-0.558509
0.0262301
-0.526325
0.0292505
-0.497556
0.0321619
-0.472552
0.0351825
-0.451556
-0.434872
0.0386001
0.00326065
-0.656624
0.00843806
-0.650098
0.0131158
-0.629926
0.0166978
-0.596338
0.0194378
-0.561249
0.0217668
-0.528654
0.0240173
-0.499806
0.0262884
-0.474823
0.028409
-0.453677
-0.435939
0.0294753
0.00300695
-0.659631
0.00767084
-0.654762
0.0116191
-0.633875
0.0142825
-0.599001
0.0158732
-0.56284
0.0167713
-0.529552
0.0173956
-0.500431
0.0181986
-0.475626
0.0193593
-0.454837
-0.436227
0.0196481
0.0029251
-0.662556
0.00715212
-0.658989
0.0105292
-0.637252
0.0125302
-0.601002
0.0132645
-0.563574
0.0127949
-0.529082
0.0110001
-0.498636
0.00800788
-0.472634
0.00567878
-0.452508
-0.443817
0.0132681
0.687008
0.00311451
-0.690123
0.683916
0.00309276
0.680857
0.00305833
0.677871
0.00298677
0.674994
0.00287607
0.672255
0.00273955
0.669662
0.00259257
0.667196
0.0024667
0.664842
0.00235331
0.00228646
0.690215
0.0055273
-0.692628
0.687391
0.00591688
0.684267
0.00618248
0.680924
0.00632917
0.677431
0.00636937
0.673853
0.00631701
0.67023
0.00621556
0.666583
0.00611383
0.662864
0.00607266
0.00616186
0.658401
0.00633263
-0.659207
0.657105
0.00721349
0.65539
0.00789702
0.65335
0.00836928
0.65105
0.00866912
0.648569
0.00879858
0.645953
0.00883122
0.643227
0.00883937
0.640363
0.00893748
0.00927269
0.612657
0.00630108
-0.612626
0.61225
0.0076207
0.611443
0.00870383
0.610349
0.009464
0.609008
0.0100095
0.607541
0.0102662
0.605977
0.0103945
0.604399
0.0104173
0.60278
0.0105571
0.0110502
0.570301
0.00615573
-0.570156
0.57008
0.00784152
0.569495
0.00928855
0.568714
0.0102458
0.567712
0.0110109
0.566722
0.0112568
0.565692
0.0114245
0.564873
0.0112361
0.564191
0.0112392
0.0116668
0.534214
0.00624501
-0.534303
0.533819
0.0082368
0.533058
0.0100496
0.5322
0.0111036
0.53108
0.0121312
0.530173
0.0121633
0.529196
0.0124019
0.528812
0.0116199
0.528641
0.0114105
0.0112256
0.503705
0.00666772
-0.504128
0.503026
0.00891636
0.501935
0.0111404
0.500849
0.0121894
0.499336
0.0136443
0.498305
0.0131945
0.49699
0.0137166
0.497026
0.0115841
0.496888
0.0115481
0.00947798
0.477543
0.00741062
-0.478286
0.476596
0.00986324
0.475168
0.012569
0.473857
0.0134998
0.471818
0.0156839
0.470549
0.0144632
0.46844
0.0158257
0.469158
0.0108659
0.468756
0.0119498
0.00560022
0.454627
0.00845804
-0.455675
0.453464
0.0110269
0.451753
0.0142801
0.450313
0.0149397
0.44778
0.0182165
0.446254
0.0159888
0.442858
0.0192218
0.443978
0.00974644
0.44387
0.0120582
-0.00303836
0.43414
-0.43559
0.00990805
0.432734
0.0124329
0.430778
0.0162359
0.429282
0.0164361
0.426451
0.0210467
0.424739
0.0177014
0.420081
0.0238792
0.419647
0.0101809
0.418887
0.0128181
-0.0279679
0.702142
-0.000772143
-0.70137
0.702579
-0.000437455
0.702549
3.01478e-05
0.702001
0.000547885
0.700946
0.00105585
0.699428
0.00151739
0.697511
0.00191756
0.695261
0.00224953
0.692766
0.00249478
0.00264336
0.686328
-0.00499212
-0.682108
0.689873
-0.00398305
0.692714
-0.00281055
0.6948
-0.0015384
0.696124
-0.00026741
0.696713
0.000927679
0.696607
0.00202401
0.695859
0.00299759
0.694512
0.00384133
0.00452802
0.637805
-0.0109032
-0.631894
0.643077
-0.00925468
0.647614
-0.00734705
0.651384
-0.00530863
0.654406
-0.00328981
0.656706
-0.00137236
0.658306
0.000423839
0.659234
0.00207018
0.659521
0.00355383
0.00484267
0.586053
-0.0172527
-0.579703
0.591787
-0.0149892
0.596758
-0.0123175
0.600968
-0.00951895
0.604483
-0.00680465
0.607335
-0.00422463
0.609542
-0.0017828
0.611135
0.000477149
0.612146
0.00254249
0.00436311
0.544455
-0.0235985
-0.53811
0.550085
-0.0206183
0.554851
-0.0170835
0.558855
-0.0135235
0.562202
-0.0101512
0.564914
-0.00693715
0.567018
-0.00388714
0.568568
-0.00107195
0.569595
0.00151528
0.00380232
0.511633
-0.0300147
-0.505217
0.516997
-0.025983
0.521341
-0.021427
0.52496
-0.0171428
0.527938
-0.0131293
0.530267
-0.00926545
0.532007
-0.00562703
0.533237
-0.00230212
0.533984
0.000768357
0.0034825
0.484756
-0.0368148
-0.477956
0.489816
-0.0310436
0.4937
-0.0253104
0.496971
-0.020414
0.499578
-0.015736
0.501487
-0.0111751
0.502833
-0.00697238
0.503709
-0.00317832
0.504122
0.000354729
0.00347706
0.461849
-0.0440946
-0.454569
0.466593
-0.0357873
0.470093
-0.0288111
0.473074
-0.0233952
0.475317
-0.017979
0.476845
-0.0127024
0.477858
-0.00798569
0.47844
-0.00375994
0.478564
0.000230394
0.0037551
0.44181
-0.0504138
-0.43549
0.446311
-0.0402888
0.449766
-0.032266
0.452317
-0.0259464
0.454067
-0.0197293
0.455245
-0.0138795
0.455988
-0.00872956
0.456332
-0.00410324
0.456206
0.000356517
0.0042859
0.423482
-0.426004
-0.0478925
0.427762
-0.0445683
0.433
-0.0375045
0.434652
-0.0275979
0.435487
-0.0205639
0.436308
-0.0147007
0.436805
-0.00922684
0.436885
-0.00418361
0.436461
0.0007812
0.00515692
0.0504208
0.366615
-0.362765
-0.054271
0.0460796
0.38415
-0.379809
0.0412952
0.403164
-0.398379
0.0360461
0.424202
-0.418953
0.0302701
0.448346
-0.44257
0.0238827
0.477654
-0.471266
0.0168443
0.515943
-0.508905
0.00942465
0.568221
-0.560801
0.00287695
0.629488
-0.62294
0.679618
-0.676741
0.0512091
0.370803
-0.0553971
0.0466045
0.388755
0.0416138
0.408154
0.0361963
0.429619
0.030282
0.45426
0.0237903
0.484145
0.0166968
0.523037
0.00930112
0.575617
0.00286635
0.635923
0.682485
0.0511275
0.375003
-0.0553274
0.0465443
0.393338
0.041567
0.413132
0.0361365
0.43505
0.0301831
0.460214
0.0236438
0.490685
0.0165241
0.530157
0.00915747
0.582983
0.00280891
0.642271
0.685294
0.052519
0.379736
-0.0572519
0.0474552
0.398402
0.0420872
0.418499
0.0363573
0.44078
0.0301895
0.466382
0.0235136
0.497361
0.0163322
0.537338
0.00898584
0.59033
0.00273006
0.648527
0.688024
0.0515428
0.383941
-0.0557481
0.0468652
0.403079
0.0417463
0.423618
0.0361223
0.446404
0.0299661
0.472538
0.0232639
0.504063
0.0160705
0.544531
0.00877199
0.597628
0.00263393
0.654665
0.690658
0.0538415
0.389143
-0.0590437
0.0482348
0.408686
0.0423643
0.429489
0.0362427
0.452525
0.029805
0.478975
0.0229675
0.5109
0.015743
0.551756
0.0085106
0.60486
0.00251429
0.660662
0.693172
0.0516945
0.392968
-0.0555192
0.0469263
0.413454
0.0415536
0.434862
0.0356671
0.458412
0.0293052
0.485337
0.0224813
0.517724
0.0152932
0.558944
0.0081727
0.611981
0.00236333
0.666471
0.695535
0.0563013
0.39994
-0.0632731
0.0488867
0.420869
0.0419386
0.44181
0.0353545
0.464996
0.0287136
0.491978
0.021815
0.524623
0.0146904
0.566069
0.00774523
0.618926
0.00216977
0.672046
0.697705
0.0525162
0.406121
-0.0586972
0.0461563
0.427229
0.0404124
0.447554
0.034277
0.471131
0.027695
0.49856
0.0208494
0.531468
0.0138801
0.573038
0.00719758
0.625609
0.00195134
0.677293
0.699656
0.0548789
-0.0747619
0.0466171
0.0396017
0.0327775
0.0261213
0.0194801
0.0128147
0.00652888
0.00171357
0.0596363
0.328097
-0.328443
-0.05929
0.0523998
0.342328
-0.335091
0.0447326
0.356754
-0.349087
0.0376705
0.373338
-0.366276
0.0311702
0.392693
-0.386193
0.0248716
0.416341
-0.410042
0.0183728
0.448034
-0.441535
0.0113815
0.494684
-0.487693
0.00433222
0.559933
-0.552884
0.642566
-0.638234
0.0534356
0.333087
-0.0584259
0.0486601
0.347103
0.0433966
0.362018
0.0377207
0.379014
0.0317611
0.398653
0.0255062
0.422595
0.0188203
0.45472
0.0115934
0.501911
0.00440781
0.567118
0.646974
0.0508033
0.337877
-0.0555938
0.0465673
0.351339
0.0419831
0.366602
0.0369816
0.384015
0.0315068
0.404127
0.0254906
0.428612
0.0188397
0.461371
0.0115421
0.509209
0.00431186
0.574349
0.651286
0.0500442
0.34138
-0.0535465
0.0460457
0.355338
0.0415204
0.371127
0.0365861
0.388949
0.0312081
0.409505
0.0252687
0.434551
0.0186362
0.468004
0.0113192
0.516526
0.0041307
0.581537
0.655417
0.0497713
0.344512
-0.0529032
0.0458634
0.359246
0.0413958
0.375595
0.0364648
0.393881
0.0310571
0.414913
0.0250738
0.440534
0.0183907
0.474687
0.0110457
0.523871
0.0039325
0.58865
0.659349
0.0495864
0.347809
-0.0528833
0.0456704
0.363162
0.0412516
0.380013
0.0363519
0.39878
0.0309328
0.420332
0.0249015
0.446566
0.0181561
0.481432
0.0107809
0.531246
0.00374712
0.595684
0.663096
0.0496088
0.351354
-0.0531544
0.0456133
0.367157
0.0411606
0.384466
0.03624
0.403701
0.0307928
0.425779
0.0247188
0.45264
0.0179243
0.488227
0.0105325
0.538638
0.003585
0.602632
0.666681
0.0498661
0.355099
-0.0536105
0.0457373
0.371286
0.0411888
0.389015
0.0361929
0.408697
0.0306804
0.431292
0.0245468
0.458773
0.0177046
0.495069
0.0103076
0.546035
0.00344237
0.609497
0.670124
0.0500909
0.358912
-0.0539042
0.0458843
0.375493
0.0412552
0.393644
0.0361788
0.413773
0.0305894
0.436881
0.0243873
0.464975
0.0174983
0.501958
0.0101074
0.553426
0.00333826
0.616266
0.673462
0.0504873
-0.05434
0.0461711
0.0414356
0.036256
0.030567
0.0242761
0.0173291
0.00995376
0.00327927
-0.30488
0.0614096
-0.0849722
-0.301498
0.0423708
-0.0457528
-0.299183
0.0380435
-0.0403591
-0.299428
0.0243521
-0.0241065
-0.299422
0.0186783
-0.0186844
-0.300386
0.0101013
-0.00913807
-0.301688
0.00414422
-0.00284132
-0.303742
-0.0025543
0.00460785
-0.306347
-0.00824214
0.0108474
-0.0136713
-0.309552
0.0168764
-0.323718
0.0500365
-0.319699
0.0383516
-0.31576
0.0341048
-0.315311
0.0239024
-0.314942
0.0183097
-0.315731
0.0108902
-0.316922
0.00533467
-0.318858
-0.000618307
-0.321328
-0.00577155
-0.0106558
-0.324344
-0.340896
0.0418453
-0.337269
0.0347248
-0.333341
0.0301766
-0.332214
0.0227756
-0.331526
0.0176223
-0.332057
0.0114207
-0.333123
0.00640102
-0.334951
0.00120924
-0.337349
-0.00337329
-0.0077066
-0.340298
-0.359636
0.0352061
-0.355663
0.0307514
-0.352055
0.0265687
-0.350426
0.021147
-0.349461
0.0166573
-0.349685
0.0116444
-0.350579
0.00729524
-0.352276
0.00290556
-0.354599
-0.00104984
-0.00479104
-0.357515
-0.380352
0.0293659
-0.375987
0.0263863
-0.372444
0.0230249
-0.370374
0.0190776
-0.369122
0.0154046
-0.36898
0.0115025
-0.369613
0.00792874
-0.371085
0.00437732
-0.373245
0.00110979
-0.0019872
-0.376048
-0.404418
0.0237421
-0.399742
0.02171
-0.395983
0.0192664
-0.393403
0.0164971
-0.391726
0.0137275
-0.39108
0.0108566
-0.391275
0.00812427
-0.392328
0.00542996
-0.394121
0.00290224
0.000497755
-0.396606
-0.435676
0.0178826
-0.430559
0.0165928
-0.426299
0.0150067
-0.423023
0.0132205
-0.420655
0.01136
-0.419243
0.00944506
-0.418694
0.0075744
-0.418996
0.00573193
-0.420065
0.00397187
0.00228901
-0.421856
-0.481276
0.0114656
-0.475463
0.0107799
-0.470391
0.00993427
-0.46615
0.00897958
-0.46275
0.00795964
-0.460212
0.00690727
-0.458497
0.00585928
-0.457589
0.00482411
-0.457432
0.00381511
0.00283619
-0.457979
-0.546133
0.00471548
-0.539836
0.00448301
-0.534103
0.00420089
-0.529026
0.00390267
-0.524629
0.00356218
-0.520931
0.00320973
-0.51792
0.00284827
-0.515587
0.0024906
-0.513901
0.00212954
0.00174035
-0.512805
-0.633519
-0.629036
-0.624835
-0.620932
-0.61737
-0.61416
-0.611312
-0.608821
-0.606692
-0.604952
-0.313145
-0.0182482
0.0218413
-0.317032
-0.0224135
0.0263002
-0.321155
-0.0260469
0.0301697
-0.325432
-0.029118
0.0333949
-0.329748
-0.0315677
0.0358841
-0.334086
-0.0332612
0.037599
-0.338131
-0.0344332
0.0384785
-0.340619
-0.0355861
0.038074
-0.34312
-0.0361532
0.0386538
-0.0361372
-0.347055
0.0400721
-0.327762
-0.0148298
-0.331492
-0.0186837
-0.335462
-0.0220768
-0.339599
-0.0249808
-0.343796
-0.027371
-0.347875
-0.0291821
-0.351649
-0.0306591
-0.355109
-0.0321263
-0.358089
-0.0331725
-0.03418
-0.360046
-0.3437
-0.0114285
-0.347456
-0.0149271
-0.3515
-0.0180336
-0.355752
-0.0207287
-0.36011
-0.0230123
-0.364403
-0.0248894
-0.368532
-0.0265307
-0.372595
-0.0280624
-0.3763
-0.0294674
-0.0312776
-0.379203
-0.360942
-0.00800087
-0.364783
-0.0110868
-0.368965
-0.0138516
-0.373404
-0.0162892
-0.378002
-0.0184144
-0.382629
-0.0202625
-0.387226
-0.0219337
-0.391797
-0.0234915
-0.396169
-0.0250951
-0.027161
-0.400286
-0.379428
-0.0046214
-0.383285
-0.00722965
-0.387546
-0.00959098
-0.392125
-0.0117098
-0.396933
-0.0136063
-0.401878
-0.0153178
-0.406906
-0.0169051
-0.411966
-0.0184317
-0.416991
-0.0200702
-0.0220591
-0.422093
-0.399731
-0.00149642
-0.403402
-0.00355783
-0.407548
-0.00544533
-0.412091
-0.00716725
-0.416954
-0.00874289
-0.42207
-0.0102019
-0.427386
-0.0115893
-0.432844
-0.0129729
-0.438433
-0.0144814
-0.0162251
-0.444267
-0.424345
0.000992111
-0.427438
-0.000465112
-0.431072
-0.00181132
-0.435186
-0.00305281
-0.439722
-0.00420695
-0.444628
-0.00529551
-0.449861
-0.00635703
-0.45538
-0.00745327
-0.461191
-0.00867084
-0.0100521
-0.467364
-0.459239
0.00225201
-0.461112
0.00140741
-0.463558
0.000635036
-0.46654
-7.06252e-05
-0.470017
-0.000730144
-0.473955
-0.00135767
-0.478326
-0.00198538
-0.483121
-0.00265855
-0.488351
-0.00344143
-0.00435796
-0.494045
-0.512258
0.00170453
-0.512247
0.00139625
-0.512739
0.00112747
-0.513719
0.000908915
-0.515154
0.000705172
-0.51703
0.000518048
-0.51934
0.000325539
-0.522108
0.000108802
-0.525372
-0.000177354
-0.000594941
-0.529135
-0.603247
-0.601851
-0.600723
-0.599814
-0.599109
-0.598591
-0.598266
-0.598157
-0.598334
-0.598929
0.000511642
-0.599441
0.0047993
-0.533423
0.0110975
-0.500343
0.0177854
-0.474052
0.0240733
-0.450555
0.0296304
-0.42765
0.0343389
-0.404994
0.0382907
-0.383155
0.0415256
-0.363281
-0.345996
0.0404671
0.000971673
-0.600412
0.00585508
-0.538306
0.0126757
-0.507164
0.0198201
-0.481196
0.0265293
-0.457264
0.0325783
-0.433699
0.0380713
-0.410487
0.0432685
-0.388352
0.0480414
-0.368054
-0.349976
0.0520214
0.00145161
-0.601864
0.00693953
-0.543794
0.014281
-0.514505
0.0218673
-0.488782
0.0289973
-0.464394
0.0354942
-0.440196
0.0414027
-0.416396
0.0467358
-0.393685
0.0513467
-0.372665
-0.353823
0.0551939
0.00190917
-0.603773
0.00800237
-0.549887
0.0158304
-0.522333
0.0238093
-0.496761
0.0313059
-0.471891
0.0382052
-0.447095
0.0446254
-0.422816
0.050768
-0.399828
0.0568451
-0.378742
-0.36001
0.0630314
0.00238075
-0.606154
0.00902435
-0.556531
0.0172707
-0.530579
0.0255603
-0.505051
0.0333117
-0.479642
0.0404352
-0.454219
0.0470443
-0.429425
0.0533022
-0.406085
0.0593087
-0.384749
-0.365704
0.065003
0.00283405
-0.608988
0.00996507
-0.563662
0.0185455
-0.53916
0.0270574
-0.513563
0.034983
-0.487568
0.0422851
-0.461521
0.0491229
-0.436263
0.0557013
-0.412664
0.0621684
-0.391216
-0.372079
0.0685437
0.00326798
-0.612256
0.0108013
-0.571195
0.019614
-0.547972
0.0282423
-0.522191
0.0362291
-0.495555
0.0435732
-0.468865
0.0504409
-0.443131
0.057014
-0.419237
0.0633994
-0.397601
-0.378253
0.0695728
0.00366338
-0.615919
0.0115075
-0.579039
0.0204452
-0.55691
0.0290853
-0.530831
0.0370456
-0.503515
0.0443759
-0.476195
0.0512743
-0.450029
0.0579427
-0.425905
0.0645238
-0.404182
-0.384803
0.0710743
0.0040239
-0.619943
0.0120734
-0.587089
0.0210142
-0.565851
0.0295472
-0.539364
0.0373657
-0.511334
0.0445629
-0.483392
0.0513554
-0.456821
0.0579491
-0.432499
0.0644945
-0.410728
-0.391392
0.071083
0.00436391
0.0124763
0.0212949
0.0296134
0.0371948
0.0441756
0.0507936
0.0572666
0.0637728
0.0704869
0.0476528
-1.7941
1.81472
0.0452719
-1.45193
1.45431
0.0434538
-1.20162
1.20344
0.0442205
-1.01104
1.01027
0.0465248
-0.821746
0.819441
0.0469787
-0.65589
0.655436
0.0468281
-0.511475
0.511626
0.0463954
-0.388769
0.389201
0.045957
-0.285132
0.28557
0.0456355
-0.19645
0.196772
0.0453087
-0.116676
0.117003
0.0449214
-0.0445382
0.0449255
0.044811
0.022073
-0.0219626
0.0455711
0.0593799
-0.0601399
0.0471379
0.0673789
-0.0689457
0.0475314
0.0180292
-0.0184228
0.0464873
-0.0137504
0.0147946
0.0415367
-0.0807067
0.0856573
0.0339909
-0.0490749
0.0566207
0.120353
-0.116793
0.0391355
-1.7679
0.0334599
-1.44626
0.0324902
-1.20066
0.0345066
-1.01306
0.0383548
-0.825594
0.0403969
-0.657932
0.0414999
-0.512578
0.0421083
-0.389377
0.0425068
-0.28553
0.0428561
-0.1968
0.0430868
-0.116907
0.0431743
-0.0446257
0.0434299
0.0218175
0.0443529
0.0584568
0.0458174
0.0659144
0.0459614
0.0178853
0.0447281
-0.0125172
0.0397224
-0.075701
0.0325744
-0.0419269
0.123504
0.0306133
-1.73692
0.0217637
-1.43741
0.021356
-1.20025
0.0247093
-1.01641
0.0300686
-0.830953
0.033698
-0.661561
0.0360686
-0.514949
0.0377259
-0.391034
0.0389684
-0.286773
0.0399933
-0.197825
0.0407887
-0.117702
0.0413603
-0.0451973
0.0419812
0.0211966
0.0430586
0.0573794
0.0444263
0.0645467
0.0443613
0.0179503
0.0429967
-0.0111526
0.0380053
-0.0707096
0.031301
-0.0352226
0.126234
0.0222392
-1.70198
0.0112743
-1.42644
0.0109627
-1.19994
0.0151698
-1.02062
0.0217666
-0.83755
0.0269075
-0.666702
0.0305515
-0.518593
0.0332663
-0.393749
0.035361
-0.288867
0.037066
-0.19953
0.0384299
-0.119066
0.0394907
-0.0462581
0.0404739
0.0202134
0.0416988
0.0561545
0.0429791
0.0632664
0.0427464
0.018183
0.0413045
-0.00971069
0.0363898
-0.0657949
0.0301655
-0.0289983
0.128534
0.0151619
-1.6652
0.00322645
-1.41451
0.00167375
-1.19838
0.0057973
-1.02474
0.0133478
-0.845101
0.0199908
-0.673345
0.0249513
-0.523554
0.0287436
-0.397541
0.031701
-0.291825
0.0340904
-0.201919
0.0360245
-0.121
0.0375757
-0.0478093
0.0389165
0.0188727
0.0402843
0.0547866
0.0414901
0.0620606
0.0411303
0.0185428
0.0396603
-0.00824059
0.0348777
-0.0610123
0.029161
-0.0232817
0.1304
0.0094094
-1.62877
-0.0053101
-1.39979
-0.00926179
-1.19443
-0.00499308
-1.02901
0.00414926
-0.854243
0.0127455
-0.681942
0.019225
-0.530033
0.0241569
-0.402473
0.0279987
-0.295667
0.0310795
-0.205
0.0335841
-0.123505
0.0356242
-0.0498493
0.0373172
0.0171796
0.0388257
0.0532781
0.0399727
0.0609136
0.039525
0.0189904
0.038071
-0.00678654
0.0334686
-0.05641
0.0282795
-0.0180926
0.131831
-0.00444264
-1.58573
-0.0245238
-1.37971
-0.027111
-1.19184
-0.0194281
-1.03669
-0.00667614
-0.866995
0.00488031
-0.693498
0.0132765
-0.538429
0.0194774
-0.408674
0.0242498
-0.300439
0.0280381
-0.208788
0.0311154
-0.126582
0.033642
-0.0523758
0.0356828
0.0151388
0.037333
0.051628
0.0384391
0.0598075
0.0379405
0.0194889
0.0365414
-0.00538746
0.0321606
-0.0520292
0.027512
-0.013444
0.132828
-0.0358992
-1.52035
-0.054058
-1.36155
-0.0491091
-1.19679
-0.035516
-1.05029
-0.0182253
-0.884286
-0.00337589
-0.708347
0.00712816
-0.548933
0.0146976
-0.416243
0.0204492
-0.306191
0.0249659
-0.213305
0.0286201
-0.130236
0.0316311
-0.0553869
0.0340176
0.0127524
0.0358141
0.0498314
0.0368997
0.058722
0.0363849
0.0200037
0.0350747
-0.00407726
0.0309501
-0.0479046
0.0268488
-0.0093428
0.133393
-0.0461862
-1.45452
-0.058503
-1.34923
-0.0555333
-1.19976
-0.0433434
-1.06248
-0.0262718
-0.901357
-0.010536
-0.724083
0.00128542
-0.560755
0.0100066
-0.424965
0.0166743
-0.312858
0.0219013
-0.218532
0.0261208
-0.134456
0.0296056
-0.0588717
0.0323319
0.0100261
0.0342796
0.0478837
0.0353642
0.0576374
0.0348644
0.0205036
0.0336719
-0.00288475
0.029832
-0.0440647
0.02628
-0.00579077
0.13353
0.0717611
-1.51301
0.0104349
-1.2879
-0.0224653
-1.16686
-0.0316557
-1.05328
-0.0268202
-0.906193
-0.0151639
-0.735739
-0.00359739
-0.572321
0.0057251
-0.434287
0.0130911
-0.320224
0.0189441
-0.224385
0.0236892
-0.139201
0.0276118
-0.0627942
0.0306558
0.00698207
0.0327403
0.0457993
0.0338371
0.0565406
0.0333771
0.0209636
0.0323239
-0.00183154
0.0288096
-0.0405505
0.0258037
-0.00278487
0.133251
0.512031
-1.23233
-0.79271
0.419453
-1.19533
0.348983
-1.09639
0.254433
-0.958735
0.179127
-0.830886
0.133309
-0.689922
0.10406
-0.543072
0.0840582
-0.414285
0.0712883
-0.307454
0.0633717
-0.216468
0.0588043
-0.134633
0.0566979
-0.0606878
0.0570757
0.0066043
0.0589908
0.0438841
0.0615428
0.0539886
0.0613723
0.0211341
0.0594372
0.000103543
0.0523675
-0.0334808
0.0459173
0.00366539
0.132355
0.629134
-0.991887
-0.869579
0.473862
-1.04005
0.362036
-0.984567
0.275565
-0.872265
0.205415
-0.760736
0.155119
-0.639626
0.12142
-0.509373
0.0979917
-0.390857
0.0822693
-0.291732
0.0721918
-0.206391
0.0662525
-0.128694
0.063444
-0.0578793
0.063823
0.00622525
0.0659263
0.0417809
0.0687897
0.0511252
0.0685291
0.0213947
0.0664082
0.00222445
0.0589976
-0.0260702
0.0528309
0.00983202
0.130178
0.752314
-0.781845
-0.962356
0.579509
-0.86725
0.452132
-0.85719
0.348631
-0.768764
0.257572
-0.669677
0.188777
-0.570831
0.143912
-0.464508
0.114437
-0.361381
0.0946256
-0.271921
0.0817895
-0.193555
0.0741961
-0.121101
0.0706069
-0.0542901
0.071004
0.00582813
0.073395
0.0393899
0.0766338
0.0478864
0.0763641
0.0216644
0.0741587
0.00442983
0.0666504
-0.0185619
0.061139
0.0153434
0.126216
0.800574
-0.581504
-1.00092
0.610499
-0.677175
0.466082
-0.712773
0.367385
-0.670066
0.286119
-0.588412
0.216727
-0.501439
0.166239
-0.414019
0.132171
-0.327314
0.108406
-0.248155
0.0923382
-0.177487
0.0826943
-0.111457
0.0781858
-0.0497816
0.0786152
0.00539877
0.0814194
0.0365856
0.0851339
0.0441719
0.0850107
0.0217876
0.0828804
0.00656016
0.0756817
-0.0113633
0.0712167
0.0198084
0.119874
0.861445
-0.430392
-1.01256
0.705951
-0.521681
0.5699
-0.576722
0.455005
-0.555171
0.348902
-0.482308
0.258304
-0.410842
0.194009
-0.349723
0.15242
-0.285725
0.123817
-0.219553
0.103937
-0.157607
0.0917964
-0.099316
0.0862147
-0.0442
0.0866837
0.00492979
0.0900675
0.0332018
0.0943901
0.0398493
0.0946766
0.021501
0.0928633
0.00837346
0.0864753
-0.00497527
0.0834795
0.0228042
0.110487
0.888619
-0.304197
-1.01481
0.733358
-0.36642
0.573843
-0.417207
0.438448
-0.419777
0.341058
-0.384918
0.271052
-0.340835
0.216451
-0.295122
0.173402
-0.242677
0.140317
-0.186467
0.116352
-0.133642
0.101467
-0.0844305
0.0947475
-0.0374808
0.0952965
0.00438087
0.099472
0.0290263
0.104602
0.0347189
0.105679
0.0204248
0.104516
0.00953588
0.099469
7.18941e-05
0.0984093
0.0238639
0.0974032
0.873886
-0.199738
-0.978346
0.751308
-0.243842
0.624739
-0.290638
0.513296
-0.308334
0.421361
-0.292983
0.338268
-0.257742
0.262359
-0.219214
0.201253
-0.18157
0.157888
-0.143103
0.12897
-0.104724
0.111539
-0.0669997
0.10389
-0.0298324
0.104675
0.0035968
0.10991
0.0237904
0.116143
0.0284868
0.118468
0.018099
0.118377
0.0096276
0.115148
0.00330045
0.11655
0.0224618
0.0801144
0.844114
-0.120426
-0.923426
0.747676
-0.147403
0.634706
-0.177669
0.519301
-0.192928
0.415682
-0.189364
0.329676
-0.171736
0.260594
-0.150132
0.207306
-0.128283
0.168075
-0.103871
0.140114
-0.0767633
0.122139
-0.0490247
0.114132
-0.0218255
0.115371
0.00235821
0.121937
0.017224
0.129631
0.0207933
0.133661
0.0140687
0.135094
0.00819427
0.134027
0.00436749
0.138422
0.0180665
0.0583199
0.82532
-0.0573466
-0.888399
0.747425
-0.0695081
0.654687
-0.0849312
0.55669
-0.0949313
0.463532
-0.0962064
0.380835
-0.089039
0.308573
-0.0778693
0.246628
-0.0663381
0.196902
-0.0541445
0.16064
-0.0405017
0.137712
-0.026097
0.127593
-0.0117065
0.128735
0.00121683
0.136618
0.00934084
0.146051
0.01136
0.152088
0.0080321
0.155379
0.00490295
0.156565
0.00318204
0.164297
0.0103339
0.0318511
0.856352
-0.913699
0.786844
0.701913
0.606982
0.510775
0.421736
0.343867
0.277529
0.223385
0.182883
0.156786
0.145079
0.146296
0.155637
0.166997
0.175029
0.179932
0.183114
0.193448
0.93331
-0.00251134
-0.92089
0.94246
0.00328258
0.947114
0.0115815
0.948155
0.0153958
0.943263
0.0259383
0.934141
0.0268235
0.91496
0.0430606
0.888257
0.0368831
0.840632
0.060444
0.0199536
0.96026
-0.0096257
-0.953146
0.964709
-0.00116549
0.966825
0.00946467
0.96439
0.0178314
0.959232
0.0310963
0.946968
0.0390875
0.934279
0.0557497
0.91408
0.0570815
0.904049
0.0704751
0.0544235
0.962978
-0.0115696
-0.961034
0.963773
-0.0019605
0.964209
0.00902844
0.96308
0.0189612
0.963282
0.0308937
0.963355
0.0390149
0.968532
0.0505724
0.97163
0.0539834
0.975545
0.0665598
0.067613
0.96089
-0.0117012
-0.960759
0.961891
-0.00296134
0.964756
0.00616375
0.969069
0.0146479
0.976178
0.0237845
0.983495
0.0316982
0.991664
0.0424041
0.994992
0.0506545
0.998542
0.0630105
0.0652397
0.963879
-0.011061
-0.964519
0.964674
-0.00375678
0.967046
0.00379144
0.970231
0.0114627
0.974275
0.0197406
0.978094
0.0278795
0.983784
0.0367141
0.990794
0.0436448
1.0023
0.051508
0.0549795
0.949504
-0.0088217
-0.951743
0.948697
-0.00295001
0.949453
0.00303633
0.951882
0.0090331
0.956621
0.0150017
0.963861
0.02064
0.974323
0.0262513
0.986648
0.0313204
1.001
0.0371539
0.041167
0.911609
-0.00659504
-0.913836
0.911261
-0.00260188
0.912921
0.00137637
0.91665
0.00530376
0.922473
0.00917949
0.930131
0.0129813
0.939604
0.0167787
0.95054
0.0203841
0.963654
0.0240397
0.0264759
0.870186
-0.00451323
-0.872268
0.869666
-0.00208227
0.87071
0.000332649
0.873311
0.00270279
0.877489
0.00500146
0.883274
0.007196
0.89079
0.0092632
0.900018
0.0111556
0.911124
0.012934
0.0141741
0.851502
-0.00237265
-0.853643
0.850643
-0.00122272
0.851073
-9.73811e-05
0.852792
0.000983803
0.85579
0.0020034
0.86004
0.00294599
0.865504
0.00379905
0.87211
0.00454926
0.879846
0.00519809
0.00562074
0.889919
-0.892291
0.888696
0.888599
0.889582
0.891586
0.894532
0.898331
0.90288
0.908078
0.741714
0.104107
-0.893714
0.784212
-0.087066
0.813835
-0.0671275
0.826608
-0.0403711
0.840582
-0.034538
0.857384
-0.0315028
0.874253
-0.0260955
0.890495
-0.0204262
0.906104
-0.0148278
-0.00962898
0.850187
0.0665914
-0.812671
0.8642
-0.101079
0.882534
-0.085461
0.893613
-0.0514499
0.901148
-0.0420731
0.911424
-0.0417787
0.92326
-0.0379323
0.934462
-0.031628
0.944543
-0.0249089
-0.0182318
0.908695
0.0469476
-0.889051
0.916335
-0.108719
0.923634
-0.0927606
0.932006
-0.0598215
0.937434
-0.0475015
0.942351
-0.0466953
0.948321
-0.0439028
0.953985
-0.0372918
0.958305
-0.0292293
-0.0209606
0.963459
0.0285515
-0.945063
0.958476
-0.103735
0.956137
-0.0904216
0.959361
-0.0630458
0.961551
-0.0496921
0.961544
-0.0466874
0.961323
-0.0436827
0.961355
-0.0373237
0.9612
-0.0290736
-0.0205199
1.01932
0.0112167
-1.00199
1.00295
-0.0873618
0.990784
-0.0782565
0.986796
-0.0590573
0.984102
-0.0469987
0.979528
-0.0421131
0.97427
-0.0384241
0.969821
-0.0328754
0.966586
-0.0258382
-0.0184528
1.04631
-0.00742385
-1.02767
1.0228
-0.0638496
1.00335
-0.0588054
0.992147
-0.0478533
0.984395
-0.0392463
0.976422
-0.0341401
0.968206
-0.0302081
0.961017
-0.0256869
0.955538
-0.0203583
-0.0146588
1.01817
-0.0184266
-1.00716
0.994971
-0.0406533
0.974561
-0.0383964
0.960129
-0.0334211
0.949474
-0.0285914
0.940103
-0.0247683
0.931375
-0.0214805
0.923805
-0.018117
0.917908
-0.0144608
-0.010587
0.961636
-0.0160646
-0.963998
0.944169
-0.0231862
0.928031
-0.0222581
0.91492
-0.0203104
0.904372
-0.0180436
0.895436
-0.015832
0.887657
-0.0137013
0.881085
-0.0115454
0.875916
-0.00929146
-0.00693894
0.926448
-0.00855118
-0.933961
0.914018
-0.0107565
0.902166
-0.0104062
0.891567
-0.00971169
0.882339
-0.00881546
0.874343
-0.00783576
0.867459
-0.00681762
0.861676
-0.00576254
0.85705
-0.00466521
-0.00353146
0.960594
-0.969145
0.949837
0.939431
0.929719
0.920904
0.913068
0.906251
0.900488
0.895823
0.130411
0.0475149
-0.0504841
0.139795
0.146147
-0.155531
0.15709
0.251274
-0.268568
0.18308
0.370184
-0.396175
0.217959
0.50154
-0.536419
0.257344
0.643873
-0.683258
0.308081
0.768476
-0.819214
0.385831
0.920399
-0.998149
0.548964
1.05935
-1.22249
1.16598
-1.51073
0.152577
0.0437285
0.163804
0.13492
0.184431
0.230647
0.215388
0.339227
0.259915
0.457013
0.31034
0.593449
0.378897
0.699919
0.460268
0.839029
0.642383
0.877239
0.995693
0.178296
0.039068
0.191481
0.121734
0.216267
0.20586
0.251827
0.303667
0.308716
0.400124
0.37082
0.531346
0.467927
0.602811
0.558522
0.748434
0.722879
0.712882
0.829521
0.208195
0.0335638
0.222766
0.107164
0.252559
0.176067
0.290348
0.265878
0.360683
0.329789
0.430797
0.461231
0.552864
0.480744
0.65797
0.643329
0.81786
0.552991
0.702318
0.242906
0.0274497
0.258199
0.0918712
0.292871
0.141394
0.331474
0.227275
0.410267
0.250996
0.484777
0.386722
0.614411
0.35111
0.73662
0.52112
0.874295
0.415316
0.574626
0.282722
0.0212444
0.298866
0.0757272
0.335415
0.104845
0.376189
0.186501
0.451571
0.175614
0.531102
0.307191
0.640587
0.241625
0.775933
0.385774
0.888798
0.302451
0.435749
0.327862
0.0150885
0.345669
0.0579204
0.378681
0.0718324
0.424917
0.140266
0.483294
0.117237
0.571862
0.218623
0.648632
0.164855
0.779524
0.254882
0.878534
0.203441
0.307119
0.379301
0.00924891
0.399058
0.0381642
0.425424
0.0454656
0.476135
0.0895551
0.517627
0.0757448
0.60453
0.13172
0.662523
0.106862
0.770323
0.147082
0.853072
0.120692
0.196193
0.439739
0.00433914
0.459429
0.0184744
0.481877
0.0230182
0.529154
0.0422775
0.565468
0.0394308
0.637292
0.0598965
0.690487
0.0536659
0.771775
0.0657948
0.837758
0.0547087
0.0999902
0.511888
0.530362
0.553381
0.595658
0.635089
0.694985
0.748651
0.814446
0.869155
0.0724426
0.0523426
-0.0539366
0.0754534
0.159175
-0.162186
0.0792984
0.271896
-0.27574
0.0829382
0.391024
-0.394664
0.0848468
0.513793
-0.515701
0.0842933
0.632448
-0.631895
0.0835797
0.762255
-0.761542
0.0824355
0.947015
-0.945871
0.0788365
1.21048
-1.20688
1.59815
-1.57358
0.0722583
0.0509067
0.0748714
0.156562
0.0781888
0.268578
0.0812186
0.387994
0.0825671
0.512444
0.0812757
0.63374
0.0797208
0.76381
0.0776064
0.949129
0.0747823
1.2133
1.61753
0.0720305
0.0496776
0.0741869
0.154406
0.0769003
0.265865
0.0792121
0.385682
0.0798759
0.511781
0.0777263
0.635889
0.0752426
0.766294
0.0719003
0.952471
0.0688365
1.21637
1.63104
0.0717635
0.0487021
0.0734117
0.152758
0.0754524
0.263824
0.0769481
0.384186
0.0768033
0.511925
0.0736667
0.639026
0.0702035
0.769757
0.0656507
0.957024
0.0641846
1.21783
1.63797
0.0714612
0.048025
0.0725573
0.151662
0.0738645
0.262517
0.0744576
0.383593
0.0733825
0.513001
0.0691291
0.643279
0.0645475
0.774339
0.0584555
0.963116
0.0553043
1.22098
1.63753
0.0711273
0.0476889
0.0716347
0.151154
0.0721556
0.261996
0.0717727
0.383976
0.0696492
0.515124
0.0641926
0.648736
0.0584785
0.780053
0.0516671
0.969928
0.0501915
1.22246
1.62868
0.0707649
0.0477341
0.0706539
0.151265
0.0703441
0.262306
0.0689267
0.385394
0.0656265
0.518424
0.0588554
0.655507
0.0514651
0.787443
0.043554
0.977839
0.0356247
1.23039
1.60878
0.0703763
0.0481986
0.0696237
0.152018
0.0684469
0.263482
0.0659521
0.387888
0.0613799
0.522996
0.0534202
0.663466
0.044608
0.796255
0.0381443
0.984302
0.0349968
1.23354
1.58051
0.0699649
0.0491174
0.0685487
0.153434
0.0664786
0.265553
0.0628725
0.391495
0.0568199
0.529049
0.0473524
0.672934
0.0359814
0.807626
0.0279498
0.992334
0.0184909
1.24299
1.5403
0.0695732
0.0674763
0.0644606
0.0597807
0.0524107
0.0420866
0.0304992
0.0246841
0.045192
0.0707551
0.0663647
-0.0663338
0.0731477
0.194728
-0.197121
0.0766302
0.319115
-0.322598
0.0791403
0.435882
-0.438392
0.0796954
0.542551
-0.543106
0.0779475
0.651535
-0.649787
0.0708159
0.78349
-0.776358
0.0505157
0.946256
-0.925956
0.00780704
1.13881
-1.0961
1.29329
-1.34478
0.0713627
0.0658692
0.0744283
0.191662
0.0787922
0.314751
0.0826873
0.431987
0.0856182
0.53962
0.089478
0.647675
0.0940171
0.778951
0.0964402
0.943833
0.0947392
1.14051
1.32961
0.0717858
0.0650048
0.0752119
0.188236
0.0799875
0.309976
0.0844686
0.427506
0.0880354
0.536053
0.0927165
0.642994
0.0987709
0.772896
0.103213
0.939391
0.0970789
1.14665
1.37109
0.0721184
0.0638378
0.0757994
0.184555
0.0808236
0.304951
0.0855974
0.422732
0.0890658
0.532584
0.0927468
0.639313
0.0964875
0.769155
0.0952783
0.9406
0.0828602
1.15907
1.40041
0.0723697
0.0624318
0.0762081
0.180717
0.0813478
0.299812
0.0862337
0.417846
0.0893957
0.529422
0.0918137
0.636895
0.0936309
0.767338
0.0905985
0.943632
0.0794996
1.17016
1.427
0.0725455
0.060849
0.0764518
0.17681
0.081604
0.29466
0.0865167
0.412934
0.0894901
0.526449
0.0912055
0.635179
0.0927392
0.765804
0.0911826
0.945189
0.0818785
1.17947
1.456
0.07265
0.0591503
0.0765382
0.172922
0.0816127
0.289585
0.086488
0.408058
0.0893951
0.523542
0.0908067
0.633768
0.0925484
0.764063
0.0922985
0.945439
0.0835074
1.18826
1.48635
0.0726873
0.0573945
0.0764741
0.169135
0.0813807
0.284678
0.08613
0.403309
0.0889636
0.520708
0.0900753
0.632656
0.0916027
0.762535
0.0916731
0.945368
0.0837673
1.19617
1.51651
0.0726621
0.0556383
0.0762665
0.165531
0.0809124
0.280033
0.0854197
0.398802
0.0880767
0.518051
0.0887395
0.631993
0.0896281
0.761647
0.0895615
0.945435
0.0832446
1.20248
1.54585
0.0725791
0.0759238
0.0802158
0.0843541
0.0867041
0.0868025
0.0869078
0.0864721
0.0820747
0.498089
0.0081708
0.474747
0.0233418
0.438531
0.0362159
0.393732
0.0447987
0.345413
0.0483197
0.299014
0.0463985
0.260134
0.0388797
0.234338
0.0257965
0.226313
0.00802504
-0.0121342
0.238447
0.425223
0.0166981
0.400859
0.0477062
0.363246
0.0738286
0.316147
0.0918981
0.264122
0.100344
0.212344
0.0981771
0.166218
0.0850057
0.130824
0.06119
0.109456
0.029393
-0.00481125
0.102133
0.36243
0.0258172
0.33638
0.0737558
0.296066
0.114143
0.245096
0.142867
0.188062
0.157379
0.129369
0.15687
0.0716426
0.142732
0.01349
0.119343
-0.0491285
0.0920115
0.0641447
-0.118085
0.309142
0.0349829
0.282758
0.10014
0.240962
0.155939
0.185433
0.198396
0.117671
0.225141
0.0400392
0.234502
-0.0434083
0.22618
-0.135155
0.211089
-0.240588
0.197444
0.179952
-0.356395
0.264268
0.0435085
0.239451
0.124957
0.199691
0.195699
0.147255
0.250833
0.0865348
0.285861
0.0201205
0.300916
-0.0670741
0.313374
-0.199978
0.343993
-0.365513
0.362979
0.335359
-0.52092
0.226564
0.0508356
0.204791
0.14673
0.168714
0.231777
0.118007
0.301539
0.0511371
0.352731
-0.0348579
0.386911
-0.146025
0.424542
-0.286206
0.484173
-0.445122
0.521895
0.495034
-0.604796
0.194717
0.0567321
0.176654
0.164793
0.145816
0.262615
0.101696
0.34566
0.043912
0.410515
-0.0267379
0.457561
-0.116989
0.514792
-0.2505
0.617684
-0.433864
0.705259
0.688801
-0.627631
0.167683
0.0611719
0.153481
0.178995
0.128178
0.287919
0.0903218
0.383515
0.0366347
0.464202
-0.038089
0.532285
-0.136674
0.613377
-0.263096
0.744107
-0.426852
0.869015
0.877296
-0.615347
0.144572
0.0643031
0.134036
0.189532
0.114471
0.307483
0.0844957
0.413491
0.0420534
0.506644
-0.0175944
0.591933
-0.0967608
0.692544
-0.198541
0.845887
-0.342591
1.01306
1.09681
-0.562106
0.124748
0.117159
0.102045
0.077143
0.0406815
-0.0171725
-0.100987
-0.181055
-0.264094
-0.512059
0.240347
-0.00190015
0.243726
-0.00337935
0.248538
-0.00481129
0.254721
-0.00618303
0.262224
-0.00750352
0.270998
-0.00877381
0.280995
-0.0099974
0.292176
-0.0111801
0.304503
-0.0123278
-0.0134462
0.31795
0.104522
-0.00428892
0.107239
-0.00609646
0.110368
-0.00794011
0.113906
-0.00972115
0.117839
-0.0114363
0.122134
-0.0130687
0.126749
-0.014613
0.131637
-0.0160682
0.136745
-0.0174351
-0.0187151
0.142014
-0.116675
-0.0056981
-0.115716
-0.00705566
-0.115203
-0.00845364
-0.115076
-0.00984822
-0.115303
-0.011209
-0.115853
-0.0125185
-0.116699
-0.0137669
-0.117819
-0.0149484
-0.119194
-0.01606
-0.0171006
-0.120809
-0.352538
-0.00955461
-0.349181
-0.0104126
-0.346774
-0.0108605
-0.345123
-0.0114993
-0.344153
-0.0121792
-0.343776
-0.0128957
-0.343938
-0.0136049
-0.344595
-0.0142914
-0.345712
-0.0149428
-0.0155543
-0.347258
-0.516643
-0.0138318
-0.512191
-0.0148639
-0.508964
-0.0140875
-0.506472
-0.0139919
-0.504956
-0.0136945
-0.504297
-0.0135553
-0.504466
-0.0134357
-0.505367
-0.0133902
-0.506928
-0.0133819
-0.0134134
-0.509069
-0.603931
-0.0146975
-0.601486
-0.0173085
-0.600744
-0.0148293
-0.600364
-0.0143723
-0.600844
-0.0132144
-0.601615
-0.0127845
-0.602767
-0.0122841
-0.604178
-0.0119786
-0.605881
-0.0116787
-0.0114768
-0.607818
-0.634816
-0.00751268
-0.638668
-0.0134561
-0.643013
-0.0104844
-0.645269
-0.0121165
-0.647409
-0.0110742
-0.648928
-0.0112655
-0.650464
-0.0107483
-0.651745
-0.0106975
-0.652888
-0.0105353
-0.0105744
-0.65379
-0.632483
0.00962286
-0.640809
-0.00512983
-0.648751
-0.00254215
-0.65421
-0.00665745
-0.659957
-0.00532765
-0.664376
-0.00684646
-0.668017
-0.00710716
-0.670238
-0.00847634
-0.671365
-0.0094087
-0.0105692
-0.67137
-0.59481
0.0423261
-0.611061
0.0111213
-0.630656
0.0170529
-0.644227
0.00691405
-0.656089
0.00653431
-0.663805
0.000869473
-0.669081
-0.00183172
-0.671473
-0.00608351
-0.671638
-0.00924391
-0.0125329
-0.669675
-0.554705
-0.589337
-0.612643
-0.629835
-0.641986
-0.650254
-0.654927
-0.656403
-0.654799
-0.650456
0.332491
-0.0145411
0.348103
-0.0156128
0.364768
-0.0166645
0.382464
-0.0176963
0.401171
-0.0187064
0.420862
-0.0196914
0.441513
-0.0206511
0.463111
-0.0215981
0.485677
-0.022566
-0.0235728
0.50925
0.147383
-0.0199109
0.152799
-0.0210288
0.158213
-0.0220781
0.163584
-0.0230671
0.168873
-0.0239954
0.174038
-0.0248565
0.179055
-0.0256685
0.183969
-0.0265115
0.188906
-0.0275037
-0.0286209
0.193955
-0.122652
-0.0180672
-0.124696
-0.018985
-0.1269
-0.0198739
-0.129211
-0.0207558
-0.131607
-0.0216
-0.134171
-0.0222923
-0.1371
-0.0227391
-0.140474
-0.0231381
-0.143811
-0.0241661
-0.0265376
-0.145895
-0.349228
-0.0160979
-0.351615
-0.016598
-0.354401
-0.0170871
-0.357469
-0.0176879
-0.360672
-0.0183976
-0.364269
-0.0186951
-0.36934
-0.0176686
-0.376914
-0.0155634
-0.385355
-0.015725
-0.0240083
-0.387885
-0.511764
-0.0134033
-0.515033
-0.0133282
-0.518926
-0.0131949
-0.523243
-0.0133699
-0.527461
-0.0141803
-0.531609
-0.0145473
-0.53775
-0.0115276
-0.548742
-0.00457062
-0.561914
-0.00255304
-0.0273696
-0.558553
-0.609961
-0.0112606
-0.612291
-0.0109981
-0.614931
-0.0105545
-0.617862
-0.0104387
-0.620413
-0.0116298
-0.621909
-0.0130514
-0.624349
-0.00908746
-0.632162
0.00324262
-0.643063
0.00834817
-0.038854
-0.631579
-0.654396
-0.0106554
-0.654506
-0.0108877
-0.654174
-0.0108865
-0.653736
-0.0108768
-0.653081
-0.0122851
-0.651034
-0.0150976
-0.648123
-0.0119984
-0.648876
0.00399531
-0.652762
0.0122343
-0.0542029
-0.637413
-0.67035
-0.0116758
-0.668112
-0.0131251
-0.664642
-0.014357
-0.660423
-0.0150961
-0.65639
-0.0163181
-0.651983
-0.0195043
-0.645069
-0.0189127
-0.638075
-0.0029983
-0.6341
0.00825918
-0.0717385
-0.616564
-0.665999
-0.0153516
-0.66082
-0.0183038
-0.654283
-0.0208936
-0.646568
-0.0228118
-0.638762
-0.0241233
-0.632173
-0.0260942
-0.623618
-0.0274669
-0.608694
-0.0179227
-0.596101
-0.00433328
-0.0858503
-0.58199
-0.643966
-0.63597
-0.626694
-0.616111
-0.60435
-0.592845
-0.581834
-0.561682
-0.527362
-0.57314
0.588982
-0.0797319
0.636407
-0.0474248
0.761672
-0.125265
0.900013
-0.138341
1.02434
-0.124325
1.13625
-0.111916
1.23572
-0.099464
1.31934
-0.0836265
1.38342
-0.0640729
1.42884
-0.0454218
1.45453
-0.0256904
1.46664
-0.0121071
1.4604
0.00623801
1.44753
0.0128707
1.42172
0.0258126
1.3942
0.0275119
1.37746
0.0167387
1.34682
0.0306418
1.36525
-0.0184319
-0.00572752
0.265883
-0.151661
0.278349
-0.0598904
0.428653
-0.275569
0.547741
-0.257429
0.662199
-0.238783
0.768441
-0.218158
0.858604
-0.189627
0.931549
-0.156572
0.988073
-0.120596
1.02959
-0.086941
1.05622
-0.0523217
1.0704
-0.0262821
1.07106
0.00558095
1.06488
0.0190422
1.04771
0.0429878
1.03366
0.0415604
1.01547
0.0349326
1.00343
0.0426763
1.04075
-0.0557469
-0.0182313
-0.0171997
-0.280356
0.0182447
-0.0953348
0.180465
-0.437789
0.292092
-0.369057
0.397989
-0.344679
0.490336
-0.310506
0.567408
-0.266698
0.629852
-0.219016
0.678797
-0.169542
0.714803
-0.122946
0.738915
-0.0764343
0.75162
-0.0389866
0.75491
0.00229059
0.751269
0.0226835
0.738928
0.0553287
0.727411
0.0530769
0.711828
0.0505162
0.730771
0.023733
0.779938
-0.104914
-0.0266582
-0.195713
-0.472528
-0.0936725
-0.197375
0.0314431
-0.562905
0.128813
-0.466427
0.225947
-0.441813
0.310543
-0.395102
0.380802
-0.336958
0.436296
-0.27451
0.478492
-0.211738
0.508329
-0.152783
0.52783
-0.0959351
0.537452
-0.0486091
0.540224
-0.000481383
0.535019
0.0278892
0.52267
0.067677
0.513569
0.0621781
0.511528
0.0525569
0.549696
-0.0144342
0.588789
-0.144007
-0.023013
-0.360858
-0.670223
-0.182633
-0.375599
-0.0819035
-0.663634
0.0262904
-0.574621
0.123395
-0.538917
0.203375
-0.475082
0.266548
-0.400131
0.31426
-0.322223
0.349184
-0.246661
0.372986
-0.176586
0.388136
-0.111085
0.395167
-0.0556405
0.396326
-0.00163982
0.389223
0.0349913
0.378451
0.0784493
0.375266
0.0653636
0.384401
0.0434214
0.422448
-0.0524815
0.443047
-0.164606
-0.00991918
-0.476895
-0.824907
-0.248449
-0.604045
-0.142267
-0.769816
-0.0242193
-0.692669
0.0685578
-0.631694
0.140408
-0.546931
0.194625
-0.454348
0.23412
-0.361718
0.262147
-0.274687
0.280805
-0.195244
0.292479
-0.122758
0.29753
-0.0606915
0.297238
-0.00134812
0.289981
0.0422487
0.282747
0.0856833
0.284908
0.0632024
0.297755
0.0305748
0.326199
-0.0809258
0.331692
-0.170099
0.00733916
-0.506809
-0.955512
-0.274289
-0.836564
-0.156799
-0.887306
-0.042238
-0.80723
0.0419862
-0.715919
0.103574
-0.608519
0.148177
-0.498951
0.179728
-0.393269
0.201585
-0.296545
0.21595
-0.209609
0.224818
-0.131626
0.228347
-0.064221
0.22725
-0.000250665
0.221208
0.0482907
0.217549
0.0893424
0.222537
0.0582141
0.234327
0.0187847
0.252228
-0.0988264
0.248421
-0.166293
0.0249969
-0.478303
-1.09377
-0.262809
-1.05206
-0.138905
-1.01121
-0.040035
-0.906099
0.0316523
-0.787606
0.081871
-0.658738
0.117154
-0.534234
0.14158
-0.417695
0.158203
-0.313168
0.16906
-0.220466
0.175681
-0.138247
0.178101
-0.0666406
0.176758
0.00109162
0.17237
0.0526795
0.171302
0.09041
0.177022
0.052494
0.186183
0.00962324
0.195867
-0.108509
0.187228
-0.157654
0.0411314
-0.425878
-1.24988
-0.232039
-1.2459
-0.109602
-1.13365
-0.02893
-0.986772
0.0284417
-0.844978
0.0681978
-0.698494
0.0954082
-0.561445
0.113906
-0.436192
0.1263
-0.325562
0.13437
-0.228536
0.139234
-0.143111
0.140881
-0.0682874
0.139614
0.00235874
0.136732
0.0555616
0.137207
0.0899352
0.14252
0.0471809
0.149081
0.00306144
0.153234
-0.112662
0.142587
-0.147008
0.0550378
-0.351057
-1.47197
-0.197974
-1.39898
-0.0866163
-1.24501
-0.0191045
-1.05428
0.0265659
-0.890648
0.0581661
-0.730094
0.0791118
-0.582391
0.0930767
-0.450157
0.102244
-0.334729
0.108197
-0.234489
0.111708
-0.146622
0.112859
-0.0694388
0.111775
0.00344347
0.110088
0.0572485
0.111298
0.088725
0.115771
0.0427079
0.120275
-0.00144293
0.120879
-0.113266
0.109907
-0.136035
0.0665857
0.100834
-1.53233
0.132323
-1.43047
0.138624
-1.25131
0.128327
-1.04399
0.115682
-0.878003
0.10202
-0.716432
0.0893062
-0.569677
0.0786699
-0.439521
0.070243
-0.326303
0.0639151
-0.228161
0.0591876
-0.141895
0.0555129
-0.0657641
0.0525853
0.00637106
0.0514502
0.0583836
0.0535878
0.0865874
0.0579302
0.0383656
0.0620311
-0.00554385
0.0624619
-0.113697
0.0558593
-0.129433
0.0719148
0.134321
-1.61463
0.134275
-1.43043
0.135188
-1.25222
0.123776
-1.03257
0.110545
-0.864772
0.0980254
-0.703912
0.0863418
-0.557993
0.0766452
-0.429824
0.0689517
-0.318609
0.0631454
-0.222355
0.0587506
-0.1375
0.0552718
-0.0622854
0.0524899
0.00915295
0.0515085
0.0593651
0.0536294
0.0844665
0.0575365
0.0344585
0.0609136
-0.00892089
0.0603729
-0.113156
0.0531228
-0.122183
0.0773775
0.121455
-1.68089
0.124315
-1.43329
0.123211
-1.25111
0.116092
-1.02546
0.104171
-0.852852
0.0933498
-0.693091
0.0829859
-0.547629
0.0742919
-0.42113
0.0673511
-0.311668
0.0620755
-0.217079
0.0580332
-0.133458
0.0547805
-0.0590326
0.0522026
0.0117308
0.0514035
0.0601642
0.0535165
0.0823534
0.0569808
0.0309943
0.0596532
-0.0115933
0.0582512
-0.111754
0.0504958
-0.114427
0.0828951
0.119996
-1.73786
0.121233
-1.43452
0.113783
-1.24366
0.108563
-1.02023
0.0977878
-0.842076
0.0883402
-0.683644
0.0793307
-0.53862
0.0716743
-0.413474
0.0655136
-0.305508
0.0607822
-0.212348
0.0571
-0.129776
0.0540893
-0.056022
0.0517419
0.0140782
0.0511401
0.060766
0.053234
0.0802595
0.0562553
0.027973
0.0582652
-0.0136032
0.0560927
-0.109582
0.0479717
-0.106306
0.0883782
0.105109
-1.77796
0.111031
-1.44044
0.10284
-1.23547
0.0998798
-1.01727
0.0911569
-0.833354
0.083053
-0.67554
0.0753846
-0.530951
0.0687649
-0.406854
0.0634052
-0.300148
0.059249
-0.208191
0.0559561
-0.126483
0.053216
-0.0532819
0.0511238
0.0161704
0.0507255
0.0611643
0.052785
0.0782
0.0553695
0.0253885
0.0567661
-0.0149999
0.0539174
-0.106733
0.0455632
-0.0979522
0.0937471
0.0978589
-1.80728
0.102778
-1.44536
0.0935075
-1.2262
0.0910496
-1.01482
0.0843517
-0.826656
0.077528
-0.668716
0.0711636
-0.524587
0.0655758
-0.401266
0.0610252
-0.295597
0.0574707
-0.204637
0.054603
-0.123615
0.0521712
-0.05085
0.0503612
0.0179804
0.050169
0.0613565
0.052178
0.0761911
0.0543371
0.0232294
0.0551744
-0.0158371
0.0517451
-0.103304
0.0432807
-0.0894878
0.0989327
0.0864159
-1.82412
0.0914104
-1.45036
0.0836108
-1.2184
0.0818094
-1.01302
0.0772664
-0.822113
0.0717865
-0.663236
0.0666923
-0.519493
0.0621335
-0.396707
0.0583964
-0.29186
0.0554635
-0.201704
0.0530548
-0.121206
0.0509698
-0.048765
0.0494669
0.0194833
0.0494795
0.0613439
0.0514222
0.0742484
0.0531731
0.0214786
0.0535091
-0.0161731
0.0495945
-0.099389
0.041133
-0.0810263
0.103875
0.0780965
-1.83115
0.0808229
-1.45308
0.074064
-1.21164
0.0725362
-1.01149
0.0699293
-0.819506
0.065849
-0.659156
0.0619977
-0.515642
0.0584666
-0.393176
0.055547
-0.288941
0.0532511
-0.199408
0.0513307
-0.119286
0.0496283
-0.0470626
0.0484534
0.0206581
0.0486658
0.0611315
0.050528
0.0723862
0.0518933
0.0201132
0.0517894
-0.0160692
0.0474834
-0.095083
0.0391267
-0.0726696
0.108525
0.0674901
-1.82755
0.0690131
-1.45461
0.0641214
-1.20675
0.063171
-1.01054
0.0623433
-0.818678
0.0597288
-0.656541
0.0571071
-0.51302
0.0546044
-0.390674
0.0525061
-0.286843
0.050859
-0.197761
0.0494513
-0.117878
0.0481628
-0.0457741
0.0473325
0.0214884
0.0477369
0.060727
0.0495071
0.0706161
0.0505148
0.0191055
0.050034
-0.0155884
0.0454278
-0.0904767
0.0372663
-0.0645081
0.112842
0.0576498
0.0573558
0.0540465
0.0537829
0.0545463
0.0534411
0.0520471
0.0505749
0.0493023
0.0483132
0.0474377
0.0465891
0.0461148
0.046702
0.0483723
0.049055
0.0482612
0.0434417
0.0355543
)
;
boundaryField
{
inlet
{
type calculated;
value nonuniform List<scalar>
40
(
-0.127442
-0.148791
-0.173635
-0.202691
-0.236792
-0.276516
-0.321706
-0.373462
-0.43483
-0.507549
-0.0708486
-0.0708224
-0.0708014
-0.070788
-0.0707841
-0.0707912
-0.07081
-0.0708408
-0.0708836
-0.07094
-0.070786
-0.0708672
-0.0709214
-0.0709513
-0.0709636
-0.0709628
-0.0709512
-0.0709314
-0.0709059
-0.0708774
-0.506259
-0.433751
-0.371549
-0.318308
-0.272794
-0.233891
-0.200614
-0.172123
-0.147703
-0.126779
)
;
}
outlet
{
type calculated;
value nonuniform List<scalar>
40
(
0.0468137
0.0550081
0.0651009
0.0775582
0.0928674
0.111493
0.133839
0.160217
0.190766
0.225299
0.0304307
0.0294232
0.0285715
0.0278656
0.0272949
0.0268485
0.0265152
0.0262838
0.0261431
0.026082
0.0505301
0.0476602
0.0449782
0.0424887
0.0401942
0.0380952
0.0361903
0.0344766
0.0329497
0.0316034
1.37098
1.05325
0.788365
0.585144
0.429953
0.314434
0.230764
0.171094
0.128681
0.0983588
)
;
}
top
{
type symmetryPlane;
value uniform 0;
}
bottom
{
type symmetryPlane;
value uniform 0;
}
cylinder
{
type calculated;
value nonuniform List<scalar>
80
(
-3.15291e-18
-5.75045e-18
6.82599e-18
9.04146e-18
5.10564e-18
-1.18499e-17
-3.29982e-17
-1.28958e-18
-2.33085e-18
-9.76837e-18
2.83921e-18
-1.20895e-18
9.46915e-19
-1.23283e-17
1.53727e-17
8.99843e-18
-3.98807e-17
2.77511e-18
-1.43245e-18
-3.45483e-17
7.36401e-17
1.43245e-18
-2.77511e-18
7.39353e-17
-7.57141e-18
-3.9504e-17
1.23283e-17
-9.46915e-19
1.20895e-18
-2.1358e-18
3.15291e-18
5.75045e-18
-6.82599e-18
-9.04146e-18
2.76095e-17
7.93608e-18
-1.71659e-17
1.28958e-18
5.71233e-17
-4.14762e-17
-9.76837e-18
-5.71233e-17
-1.28958e-18
1.71659e-17
-1.18499e-17
-2.76095e-17
9.04146e-18
6.82599e-18
-5.75045e-18
-3.15291e-18
-7.36401e-17
-1.38017e-17
2.77511e-18
-6.13374e-17
8.99843e-18
3.9504e-17
-1.23283e-17
9.46915e-19
-1.20895e-18
2.1358e-18
-2.1358e-18
1.20895e-18
-9.46915e-19
1.23283e-17
-3.9504e-17
-7.57141e-18
6.13374e-17
-2.77511e-18
1.38017e-17
7.36401e-17
9.76837e-18
2.33085e-18
1.28958e-18
3.29982e-17
-2.37334e-17
-5.10564e-18
-9.04146e-18
-6.82599e-18
5.75045e-18
3.15291e-18
)
;
}
frontandback
{
type empty;
value nonuniform 0();
}
}
// ************************************************************************* //
| [
"[email protected]"
] | ||
fc0e5b79cd2c4652d897c1dd3beaf57667e3c24f | 8074e582c99623ec91ca8dd2cdfa10b3563cfac4 | /examples/Arduino/oscuinoSerial/oscuinoSerial.ino | 26d267f7102488fbca19cfde759ab239f028a392 | [] | no_license | Macciza/oscuino | dc2d693c4e641f3b7bb74a1a45c523140634f54f | 044047b78f4a17d9b82902bfaf12a2a67c772d5a | refs/heads/master | 2021-01-15T23:12:15.140636 | 2012-06-27T21:01:03 | 2012-06-27T21:01:03 | 4,851,594 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,962 | ino | #include <OSCBundle.h>
#include <OSCMessage.h>
/*
This example is meant to be used with the MAX/MSP
to Arduino Interface called oscuinoSerial.maxpatch
*/
#include <SLIPEncodedSerial.h>
OSCBundle bundle(SLIPSerial);
OSCBundle bundleOUT(SLIPSerial);
//many definitions and abstractions are taken from OSCuino 1.0 by Adrian Freed 2011
static PROGMEM float floattable[1024] = {
0.000000, 0.000978, 0.001955, 0.002933, 0.003910, 0.004888, 0.005865, 0.006843, 0.007820, 0.008798, 0.009775,
0.010753, 0.011730, 0.012708, 0.013685, 0.014663, 0.015640, 0.016618, 0.017595, 0.018573, 0.019550,
0.020528, 0.021505, 0.022483, 0.023460, 0.024438, 0.025415, 0.026393, 0.027370, 0.028348, 0.029326,
0.030303, 0.031281, 0.032258, 0.033236, 0.034213, 0.035191, 0.036168, 0.037146, 0.038123, 0.039101,
0.040078, 0.041056, 0.042033, 0.043011, 0.043988, 0.044966, 0.045943, 0.046921, 0.047898, 0.048876,
0.049853, 0.050831, 0.051808, 0.052786, 0.053763, 0.054741, 0.055718, 0.056696, 0.057674, 0.058651,
0.059629, 0.060606, 0.061584, 0.062561, 0.063539, 0.064516, 0.065494, 0.066471, 0.067449, 0.068426,
0.069404, 0.070381, 0.071359, 0.072336, 0.073314, 0.074291, 0.075269, 0.076246, 0.077224, 0.078201,
0.079179, 0.080156, 0.081134, 0.082111, 0.083089, 0.084066, 0.085044, 0.086022, 0.086999, 0.087977,
0.088954, 0.089932, 0.090909, 0.091887, 0.092864, 0.093842, 0.094819, 0.095797, 0.096774, 0.097752,
0.098729, 0.099707, 0.100684, 0.101662, 0.102639, 0.103617, 0.104594, 0.105572, 0.106549, 0.107527,
0.108504, 0.109482, 0.110459, 0.111437, 0.112414, 0.113392, 0.114370, 0.115347, 0.116325, 0.117302,
0.118280, 0.119257, 0.120235, 0.121212, 0.122190, 0.123167, 0.124145, 0.125122, 0.126100, 0.127077,
0.128055, 0.129032, 0.130010, 0.130987, 0.131965, 0.132942, 0.133920, 0.134897, 0.135875, 0.136852,
0.137830, 0.138807, 0.139785, 0.140762, 0.141740, 0.142717, 0.143695, 0.144673, 0.145650, 0.146628,
0.147605, 0.148583, 0.149560, 0.150538, 0.151515, 0.152493, 0.153470, 0.154448, 0.155425, 0.156403,
0.157380, 0.158358, 0.159335, 0.160313, 0.161290, 0.162268, 0.163245, 0.164223, 0.165200, 0.166178,
0.167155, 0.168133, 0.169110, 0.170088, 0.171065, 0.172043, 0.173021, 0.173998, 0.174976, 0.175953,
0.176931, 0.177908, 0.178886, 0.179863, 0.180841, 0.181818, 0.182796, 0.183773, 0.184751, 0.185728,
0.186706, 0.187683, 0.188661, 0.189638, 0.190616, 0.191593, 0.192571, 0.193548, 0.194526, 0.195503,
0.196481, 0.197458, 0.198436, 0.199413, 0.200391, 0.201369, 0.202346, 0.203324, 0.204301, 0.205279,
0.206256, 0.207234, 0.208211, 0.209189, 0.210166, 0.211144, 0.212121, 0.213099, 0.214076, 0.215054,
0.216031, 0.217009, 0.217986, 0.218964, 0.219941, 0.220919, 0.221896, 0.222874, 0.223851, 0.224829,
0.225806, 0.226784, 0.227761, 0.228739, 0.229717, 0.230694, 0.231672, 0.232649, 0.233627, 0.234604,
0.235582, 0.236559, 0.237537, 0.238514, 0.239492, 0.240469, 0.241447, 0.242424, 0.243402, 0.244379,
0.245357, 0.246334, 0.247312, 0.248289, 0.249267, 0.250244, 0.251222, 0.252199, 0.253177, 0.254154,
0.255132, 0.256109, 0.257087, 0.258065, 0.259042, 0.260020, 0.260997, 0.261975, 0.262952, 0.263930,
0.264907, 0.265885, 0.266862, 0.267840, 0.268817, 0.269795, 0.270772, 0.271750, 0.272727, 0.273705,
0.274682, 0.275660, 0.276637, 0.277615, 0.278592, 0.279570, 0.280547, 0.281525, 0.282502, 0.283480,
0.284457, 0.285435, 0.286413, 0.287390, 0.288368, 0.289345, 0.290323, 0.291300, 0.292278, 0.293255,
0.294233, 0.295210, 0.296188, 0.297165, 0.298143, 0.299120, 0.300098, 0.301075, 0.302053, 0.303030,
0.304008, 0.304985, 0.305963, 0.306940, 0.307918, 0.308895, 0.309873, 0.310850, 0.311828, 0.312805,
0.313783, 0.314761, 0.315738, 0.316716, 0.317693, 0.318671, 0.319648, 0.320626, 0.321603, 0.322581,
0.323558, 0.324536, 0.325513, 0.326491, 0.327468, 0.328446, 0.329423, 0.330401, 0.331378, 0.332356,
0.333333, 0.334311, 0.335288, 0.336266, 0.337243, 0.338221, 0.339198, 0.340176, 0.341153, 0.342131,
0.343109, 0.344086, 0.345064, 0.346041, 0.347019, 0.347996, 0.348974, 0.349951, 0.350929, 0.351906,
0.352884, 0.353861, 0.354839, 0.355816, 0.356794, 0.357771, 0.358749, 0.359726, 0.360704, 0.361681,
0.362659, 0.363636, 0.364614, 0.365591, 0.366569, 0.367546, 0.368524, 0.369501, 0.370479, 0.371457,
0.372434, 0.373412, 0.374389, 0.375367, 0.376344, 0.377322, 0.378299, 0.379277, 0.380254, 0.381232,
0.382209, 0.383187, 0.384164, 0.385142, 0.386119, 0.387097, 0.388074, 0.389052, 0.390029, 0.391007,
0.391984, 0.392962, 0.393939, 0.394917, 0.395894, 0.396872, 0.397849, 0.398827, 0.399804, 0.400782,
0.401760, 0.402737, 0.403715, 0.404692, 0.405670, 0.406647, 0.407625, 0.408602, 0.409580, 0.410557,
0.411535, 0.412512, 0.413490, 0.414467, 0.415445, 0.416422, 0.417400, 0.418377, 0.419355, 0.420332,
0.421310, 0.422287, 0.423265, 0.424242, 0.425220, 0.426197, 0.427175, 0.428152, 0.429130, 0.430108,
0.431085, 0.432063, 0.433040, 0.434018, 0.434995, 0.435973, 0.436950, 0.437928, 0.438905, 0.439883,
0.440860, 0.441838, 0.442815, 0.443793, 0.444770, 0.445748, 0.446725, 0.447703, 0.448680, 0.449658,
0.450635, 0.451613, 0.452590, 0.453568, 0.454545, 0.455523, 0.456500, 0.457478, 0.458456, 0.459433,
0.460411, 0.461388, 0.462366, 0.463343, 0.464321, 0.465298, 0.466276, 0.467253, 0.468231, 0.469208,
0.470186, 0.471163, 0.472141, 0.473118, 0.474096, 0.475073, 0.476051, 0.477028, 0.478006, 0.478983,
0.479961, 0.480938, 0.481916, 0.482893, 0.483871, 0.484848, 0.485826, 0.486804, 0.487781, 0.488759,
0.489736, 0.490714, 0.491691, 0.492669, 0.493646, 0.494624, 0.495601, 0.496579, 0.497556, 0.498534,
0.499511, 0.500489, 0.501466, 0.502444, 0.503421, 0.504399, 0.505376, 0.506354, 0.507331, 0.508309,
0.509286, 0.510264, 0.511241, 0.512219, 0.513196, 0.514174, 0.515152, 0.516129, 0.517107, 0.518084,
0.519062, 0.520039, 0.521017, 0.521994, 0.522972, 0.523949, 0.524927, 0.525904, 0.526882, 0.527859,
0.528837, 0.529814, 0.530792, 0.531769, 0.532747, 0.533724, 0.534702, 0.535679, 0.536657, 0.537634,
0.538612, 0.539589, 0.540567, 0.541544, 0.542522, 0.543500, 0.544477, 0.545455, 0.546432, 0.547410,
0.548387, 0.549365, 0.550342, 0.551320, 0.552297, 0.553275, 0.554252, 0.555230, 0.556207, 0.557185,
0.558162, 0.559140, 0.560117, 0.561095, 0.562072, 0.563050, 0.564027, 0.565005, 0.565982, 0.566960,
0.567937, 0.568915, 0.569892, 0.570870, 0.571848, 0.572825, 0.573803, 0.574780, 0.575758, 0.576735,
0.577713, 0.578690, 0.579668, 0.580645, 0.581623, 0.582600, 0.583578, 0.584555, 0.585533, 0.586510,
0.587488, 0.588465, 0.589443, 0.590420, 0.591398, 0.592375, 0.593353, 0.594330, 0.595308, 0.596285,
0.597263, 0.598240, 0.599218, 0.600196, 0.601173, 0.602151, 0.603128, 0.604106, 0.605083, 0.606061,
0.607038, 0.608016, 0.608993, 0.609971, 0.610948, 0.611926, 0.612903, 0.613881, 0.614858, 0.615836,
0.616813, 0.617791, 0.618768, 0.619746, 0.620723, 0.621701, 0.622678, 0.623656, 0.624633, 0.625611,
0.626588, 0.627566, 0.628543, 0.629521, 0.630499, 0.631476, 0.632454, 0.633431, 0.634409, 0.635386,
0.636364, 0.637341, 0.638319, 0.639296, 0.640274, 0.641251, 0.642229, 0.643206, 0.644184, 0.645161,
0.646139, 0.647116, 0.648094, 0.649071, 0.650049, 0.651026, 0.652004, 0.652981, 0.653959, 0.654936,
0.655914, 0.656891, 0.657869, 0.658847, 0.659824, 0.660802, 0.661779, 0.662757, 0.663734, 0.664712,
0.665689, 0.666667, 0.667644, 0.668622, 0.669599, 0.670577, 0.671554, 0.672532, 0.673509, 0.674487,
0.675464, 0.676442, 0.677419, 0.678397, 0.679374, 0.680352, 0.681329, 0.682307, 0.683284, 0.684262,
0.685239, 0.686217, 0.687195, 0.688172, 0.689150, 0.690127, 0.691105, 0.692082, 0.693060, 0.694037,
0.695015, 0.695992, 0.696970, 0.697947, 0.698925, 0.699902, 0.700880, 0.701857, 0.702835, 0.703812,
0.704790, 0.705767, 0.706745, 0.707722, 0.708700, 0.709677, 0.710655, 0.711632, 0.712610, 0.713587,
0.714565, 0.715543, 0.716520, 0.717498, 0.718475, 0.719453, 0.720430, 0.721408, 0.722385, 0.723363,
0.724340, 0.725318, 0.726295, 0.727273, 0.728250, 0.729228, 0.730205, 0.731183, 0.732160, 0.733138,
0.734115, 0.735093, 0.736070, 0.737048, 0.738025, 0.739003, 0.739980, 0.740958, 0.741935, 0.742913,
0.743891, 0.744868, 0.745846, 0.746823, 0.747801, 0.748778, 0.749756, 0.750733, 0.751711, 0.752688,
0.753666, 0.754643, 0.755621, 0.756598, 0.757576, 0.758553, 0.759531, 0.760508, 0.761486, 0.762463,
0.763441, 0.764418, 0.765396, 0.766373, 0.767351, 0.768328, 0.769306, 0.770283, 0.771261, 0.772239,
0.773216, 0.774194, 0.775171, 0.776149, 0.777126, 0.778104, 0.779081, 0.780059, 0.781036, 0.782014,
0.782991, 0.783969, 0.784946, 0.785924, 0.786901, 0.787879, 0.788856, 0.789834, 0.790811, 0.791789,
0.792766, 0.793744, 0.794721, 0.795699, 0.796676, 0.797654, 0.798631, 0.799609, 0.800587, 0.801564,
0.802542, 0.803519, 0.804497, 0.805474, 0.806452, 0.807429, 0.808407, 0.809384, 0.810362, 0.811339,
0.812317, 0.813294, 0.814272, 0.815249, 0.816227, 0.817204, 0.818182, 0.819159, 0.820137, 0.821114,
0.822092, 0.823069, 0.824047, 0.825024, 0.826002, 0.826979, 0.827957, 0.828935, 0.829912, 0.830890,
0.831867, 0.832845, 0.833822, 0.834800, 0.835777, 0.836755, 0.837732, 0.838710, 0.839687, 0.840665,
0.841642, 0.842620, 0.843597, 0.844575, 0.845552, 0.846530, 0.847507, 0.848485, 0.849462, 0.850440,
0.851417, 0.852395, 0.853372, 0.854350, 0.855327, 0.856305, 0.857283, 0.858260, 0.859238, 0.860215,
0.861193, 0.862170, 0.863148, 0.864125, 0.865103, 0.866080, 0.867058, 0.868035, 0.869013, 0.869990,
0.870968, 0.871945, 0.872923, 0.873900, 0.874878, 0.875855, 0.876833, 0.877810, 0.878788, 0.879765,
0.880743, 0.881720, 0.882698, 0.883675, 0.884653, 0.885630, 0.886608, 0.887586, 0.888563, 0.889541,
0.890518, 0.891496, 0.892473, 0.893451, 0.894428, 0.895406, 0.896383, 0.897361, 0.898338, 0.899316,
0.900293, 0.901271, 0.902248, 0.903226, 0.904203, 0.905181, 0.906158, 0.907136, 0.908113, 0.909091,
0.910068, 0.911046, 0.912023, 0.913001, 0.913978, 0.914956, 0.915934, 0.916911, 0.917889, 0.918866,
0.919844, 0.920821, 0.921799, 0.922776, 0.923754, 0.924731, 0.925709, 0.926686, 0.927664, 0.928641,
0.929619, 0.930596, 0.931574, 0.932551, 0.933529, 0.934506, 0.935484, 0.936461, 0.937439, 0.938416,
0.939394, 0.940371, 0.941349, 0.942326, 0.943304, 0.944282, 0.945259, 0.946237, 0.947214, 0.948192,
0.949169, 0.950147, 0.951124, 0.952102, 0.953079, 0.954057, 0.955034, 0.956012, 0.956989, 0.957967,
0.958944, 0.959922, 0.960899, 0.961877, 0.962854, 0.963832, 0.964809, 0.965787, 0.966764, 0.967742,
0.968719, 0.969697, 0.970674, 0.971652, 0.972630, 0.973607, 0.974585, 0.975562, 0.976540, 0.977517,
0.978495, 0.979472, 0.980450, 0.981427, 0.982405, 0.983382, 0.984360, 0.985337, 0.986315, 0.987292,
0.988270, 0.989247, 0.990225, 0.991202, 0.992180, 0.993157, 0.994135, 0.995112, 0.996090, 0.997067,
0.998045, 0.999022, 1.000000,
};
static inline float floatfrom10bitint(int n)
{
return pgm_read_float(floattable+constrain(n,0,1023));
}
inline void digitalPullup(uint8_t pin, boolean b) {
pinMode(pin, INPUT);
digitalWrite(pin, b?HIGH:LOW);
}
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define ANALOG_PINS 16
const int DIGITAL_PINS=54;
inline void analogPullup(uint8_t pin, boolean b) {
digitalPullup(pin+54,b);
}
inline void analogOutWrite(uint8_t pin, uint8_t b) {
pinMode(pin+54, OUTPUT);
digitalWrite(pin+54,b);
}
#else
// teensy++
#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#define ANALOG_PINS 8
const int DIGITAL_PINS=38;
inline void analogPullup(uint8_t pin, boolean b) {
pinMode(38+pin,b?INPUT_PULLUP: INPUT);
}
inline void analogOutWrite(uint8_t pin, uint8_t b) {
pinMode(38+pin, OUTPUT); // change directions of an analog pin
digitalWrite(38+pin,b);
}
#else
//AT90USB1286 teensy++
#if defined(__AVR_ATmega32U4__)
//teensy 2.0
#define ANALOG_PINS 12
const int DIGITAL_PINS=11; // actually the teensy 2.0 has two more non contiguously addressed (22 and 23)
inline void analogPullup(uint8_t pin, boolean b) {
if(pin==11)
pin = -1; // ouch read the diagram carefully! http://www.pjrc.com/teensy/pinout.html
pinMode(21-pin,b?INPUT_PULLUP: INPUT);
}
typedef enum {
endOfpinlist=-1, a0=14,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15 }
pinnames;
inline void analogOutWrite(uint8_t pin, uint8_t b) {
if(pin==11)
pin = -1; // ouch
pinMode(21-pin, OUTPUT); // change directions of an analog pin
digitalWrite(21-pin,b);
}
#else
//6 or 8 depending
#define ANALOG_PINS 8
const int DIGITAL_PINS=13;
inline void analogPullup(uint8_t pin, boolean b) {
digitalPullup(pin+14,b?HIGH:LOW);
}
inline void analogOutWrite(uint8_t pin, uint8_t b) {
pinMode(pin+14, OUTPUT); // change directions of an analog pin
digitalWrite(pin+14,b);
}
#endif
#endif
#endif
float getSupplyVoltage(){
#if !defined(__AVR_ATmega8__)
// temperature and power supply measurement on some Arduinos
// powersupply
int result;
// Read 1.1V reference against AVcc
#if defined(__AVR_ATmega32U4__)
ADMUX = 0x40 | _BV(MUX4)| _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
ADCSRB = 0;
// ADCSRB = DEFAULT_ADCSRB | (1<<MUX5);
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) || defined(__AVR_ATmega1280__)
ADMUX = 0x40| _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1) ;
ADCSRB = 0;
#else
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
#endif
delayMicroseconds(300); // wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
float supplyvoltage = 1.1264 *1023 / result;
return supplyvoltage;
#endif
}
float getTemperature(){
int result;
#if defined(__AVR_ATmega32U4__) || (!defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega8__) && !defined(__AVR_AT90USB646__) && !defined(__AVR_AT90USB1286__))
// temperature
#if defined(__AVR_ATmega32U4__)
ADMUX = _BV(REFS1) | _BV(REFS0) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0);
ADCSRB = _BV(MUX5);
#else
ADMUX = _BV(REFS1) | _BV(REFS0) | _BV(MUX3);
#endif
delayMicroseconds(200); // wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
float temp = result/1023.0;
return temp;
analogReference(DEFAULT);
#endif
}
char pinString[54][4] = {"/0" ,"/1" ,"/2" ,"/3" ,"/4" ,"/5" ,"/6" ,"/7" ,"/8" ,"/9" ,"/10" ,"/11" ,"/12" ,"/13" ,"/14" ,"/15" ,"/16" ,"/17" ,"/18" ,"/19" ,"/20" ,"/21" ,"/22" ,"/23" ,"/24" ,"/25" ,"/26" ,"/27" ,"/28" ,"/29" ,"/30" ,"/31" ,"/32" ,"/33" ,"/34" ,"/35" ,"/36" ,"/37" ,"/38" ,"/39" ,"/40" ,"/41" ,"/42" ,"/43" ,"/44" ,"/45" ,"/46" ,"/47" ,"/48" ,"/49" ,"/50" ,"/51" ,"/52" ,"/53"};
/*
The main part of the program.
*/
void setup() {
//setup ethernet part
SLIPSerial.begin(115200);
}
boolean analogPolling = false;
boolean digitalPolling = false;
void loop(){
bundle.clear();
//read the incoming message
bundleReceive();
polling();
}
void bundleReceive(){
if (bundle.receive()>0){
// "/*" = "/\052"
//bc of a bug in the Arduino IDE, it won't compile with "/*" in a string.
bundle.route("/a", handleAnalog);
sendBundle();
bundle.route("/d", handleDigital);
sendBundle();
bundle.route("/s", handleSystem);
sendBundle();
bundle.route("/p", handlePolling);
}
}
void sendBundle(){
//send the outgoing message
if(bundleOUT.size()){
bundleOUT.send();
SLIPSerial.endTransmission();
#if defined(CORE_TEENSY)
Serial.send_now();
#endif
}
}
/*
ANALOG METHOD
*/
boolean pullupState[16] = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
void routeAnalogPullup(OSCMessage msg, int addrOffset ){
for(byte i = 0; i < ANALOG_PINS; i++){
//match against the pin numbers
if(msg.fullMatch(pinString[i], addrOffset)){
//reset the message in case its a pattern being matched mutliple times
msg.reset();
//if it has an value then it's an output with that value
if (msg.isInt()){
int pullup = msg.getInt();
pullupState[i] = pullup;
analogPullup(i, pullup);
}
}
}
}
inline int doAnalogRead(int pin){
analogPullup(pin, pullupState[pin]);
return analogRead(pin);
}
void handleAnalog(OSCMessage msg, int addrOffset ){
//match analog pullup command
msg.route("/up", routeAnalogPullup, addrOffset);
//match input or output
for(byte i = 0; i < ANALOG_PINS; i++){
//match against the pin numbers
if(msg.fullMatch(pinString[i], addrOffset)){
//reset the message in case its a pattern being matched mutliple times
msg.reset();
//if it has an value then it's an output with that value
if (msg.isInt()){
analogOutWrite(i, msg.getInt());
} else if (msg.isString()){
//if its a string then use that string is a custom address for the output
char addrBuff[16];
msg.getString(addrBuff);
bundleOUT.addMessage(addrBuff).add(doAnalogRead(i));
} else {
//otherwise just do an analog reading and send the value
char outputAddr[6] = "/a/xx";
//put the pin num in the output address
outputAddr[3] = pinString[i][1];
outputAddr[4] = pinString[i][2];
bundleOUT.addMessage(outputAddr).add(doAnalogRead(i));
}
}
}
}
/*
DIGITAL METHODS
*/
void routeDigitalPullup(OSCMessage msg, int addrOffset ){
for(byte i = 0; i < DIGITAL_PINS; i++){
//match against the pin numbers
if(msg.fullMatch(pinString[i], addrOffset)){
//reset the message in case its a pattern being matched mutliple times
msg.reset();
//if it has an value then it's an output with that value
if (msg.isInt()){
digitalPullup(i, msg.getInt());
}
}
}
}
inline int doDigitalRead(int pin){
pinMode(pin, INPUT);
return digitalRead(pin);
}
void handleDigital(OSCMessage msg, int addrOffset ){
//match analog pullup command
msg.route("/up", routeDigitalPullup, addrOffset);
//match input or output
for(byte i = 0; i < DIGITAL_PINS; i++){
//match against the pin numbers
if(msg.fullMatch(pinString[i], addrOffset)){
//reset the message in case its a pattern being matched mutliple times
msg.reset();
//if it has an value then it's an output with that value
if (msg.isInt()){
pinMode(i, OUTPUT);
digitalWrite(i, msg.getInt());
} else if (msg.isString()){
//if its a string then use that string is a custom address for the output
char addrBuff[16];
msg.getString(addrBuff);
bundleOUT.addMessage(addrBuff).add(doDigitalRead(i));
} else {
//otherwise just do an analog reading and send the value
char outputAddr[6] = "/d/xx";
//put the pin num in the output address
outputAddr[3] = pinString[i][1];
outputAddr[4] = pinString[i][2];
bundleOUT.addMessage(outputAddr).add(doDigitalRead(i));
}
}
}
}
/*
SYSTEM MESSAGES
*/
void handleSystem(OSCMessage msg, int addrOffset ){
if (msg.fullMatch("/t", addrOffset)){
bundleOUT.addMessage("/s/t").add(getTemperature());
}
if (msg.fullMatch("/p", addrOffset)){
bundleOUT.addMessage("/s/p").add(getSupplyVoltage());
}
if (msg.fullMatch("/m", addrOffset)){
bundleOUT.addMessage("/s/m").add(long(micros()));
}
if (msg.fullMatch("/d", addrOffset)){
bundleOUT.addMessage("/s/d").add(DIGITAL_PINS);
}
if (msg.fullMatch("/a", addrOffset)){
bundleOUT.addMessage("/s/a").add(ANALOG_PINS);
}
}
/*
POLLING MESSAGES
*/
void polling(){
if (analogPolling){
int msgCounter = 0;
for(byte i = 0; i < ANALOG_PINS; i++){
//otherwise just do an analog reading and send the value
char outputAddr[6] = "/a/xx";
//put the pin num in the output address
outputAddr[3] = pinString[i][1];
outputAddr[4] = pinString[i][2];
bundleOUT.addMessage(outputAddr).add(doAnalogRead(i));
msgCounter++;
if (msgCounter>12){
sendBundle();
msgCounter = 0;
}
}
sendBundle();
}
if (digitalPolling){
int msgCounter = 0;
for(byte i = 0; i < DIGITAL_PINS; i++){
//otherwise just do an analog reading and send the value
char outputAddr[6] = "/d/xx";
//put the pin num in the output address
outputAddr[3] = pinString[i][1];
outputAddr[4] = pinString[i][2];
bundleOUT.addMessage(outputAddr).add(doDigitalRead(i));
msgCounter++;
if (msgCounter>12){
sendBundle();
msgCounter = 0;
}
}
sendBundle();
}
}
void handlePolling(OSCMessage msg, int addrOffset ){
if (msg.fullMatch("/a", addrOffset)){
msg.reset();
if(msg.isInt()){
analogPolling = msg.getInt();
}
}
if (msg.fullMatch("/d", addrOffset)){
msg.reset();
if(msg.isInt()){
digitalPolling = msg.getInt();
}
}
}
| [
"[email protected]"
] | |
7ad0c0c2594cfa17265cfd6171007cc8cdb37635 | db98a53250d04d7170ef3f9bd686f37a0573ba14 | /QuestionAnswer单选测试系统/源代码/TestSystem_up1/answerui.cpp | 55da9d5e427e002b0810fb7e58ef7f20844becba | [] | no_license | Albert-Shi/QuestionAnswer | 8f85952636c67f4b41033fa9f2d88bd33a0814eb | 0627c80a33155441e5e0dd26130a5f1e5875ff37 | refs/heads/master | 2021-04-28T05:21:45.291630 | 2018-02-20T09:09:20 | 2018-02-20T09:09:20 | 122,175,782 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,254 | cpp | #include "answerui.h"
#include "ui_answerui.h"
#include "core.h"
#define SIZE 200
int SELECT = -1;
extern Question G_QUESTION;
//extern int STANDARD[SIZE];
extern int CRRECT;
extern bool STOP;
AnswerUI::AnswerUI(QWidget *parent) :
QDialog(parent),
ui(new Ui::AnswerUI)
{
ui->setupUi(this);
G_QUESTION.getQustionOptionOrder((unsigned)time(NULL));
ui->question_textbrowser->setText(G_QUESTION.getQuestion());
ui->A_textBrowser->setText(G_QUESTION.getKey(G_QUESTION.optionOrder[0]));
ui->B_textbrowser->setText(G_QUESTION.getKey(G_QUESTION.optionOrder[1]));
ui->C_textbrowser->setText(G_QUESTION.getKey(G_QUESTION.optionOrder[2]));
ui->D_textbrowser->setText(G_QUESTION.getKey(G_QUESTION.optionOrder[3]));
}
AnswerUI::~AnswerUI()
{
delete ui;
}
void AnswerUI::on_radioButton_clicked()
{
SELECT = 0;
}
void AnswerUI::on_radioButton_2_clicked()
{
SELECT = 1;
}
void AnswerUI::on_radioButton_3_clicked()
{
SELECT = 2;
}
void AnswerUI::on_radioButton_4_clicked()
{
SELECT = 3;
}
void AnswerUI::on_next_button_clicked()
{
if(SELECT == -1) {
//创建需要的Dialog窗体,总布局,文字布局,按钮布局,Label,pushbutton
QDialog *qd = new QDialog;
QVBoxLayout *mainl = new QVBoxLayout;
QVBoxLayout *qvb = new QVBoxLayout;
QVBoxLayout *qvbb = new QVBoxLayout;
QLabel *qlbel = new QLabel(QWidget::tr("没有选择任何选项,请重新选择!"), qd);
QPushButton *qpb = new QPushButton(QWidget::tr("确定"), qd);
//设置信号跟槽
connect(qpb, SIGNAL(clicked(bool)), qd, SLOT(close()));
connect(qpb, SIGNAL(clicked(bool)), this, SLOT(show()));
//设置基本参数(Dialog大小,标题,添加布局),show
qpb->setDefault(true);
qd->setWindowTitle("错误");
qd->resize(QSize(150,100));
qvbb->addWidget(qpb);
qvb->addWidget(qlbel);
mainl->addLayout(qvb);
mainl->addLayout(qvbb);
qd->setLayout(mainl);
qd->exec();
}else{
if(G_QUESTION.standard == SELECT) {
CRRECT++;
}
this->close();
}
}
void AnswerUI::on_pushButton_clicked()
{
STOP = true;
this->close();
}
| [
"[email protected]"
] | |
92340cdf32d36a08a96fe69a3fb30ef961781c01 | d7823252aa58c501c1541b0cf70f2115a12abfb2 | /40214330/source/Animation.cpp | f80ae91be6ce4c001cad4af4e199038bffa85483 | [] | no_license | ScottBain96/kylesAdventureGamesEng | 4288de734284fe2d88678aac617914db4ca4c0b9 | d604d40b18f72d1f888c2307ebf2c012d6af970f | refs/heads/master | 2020-05-27T11:38:39.297087 | 2019-05-25T20:44:52 | 2019-05-25T20:44:52 | 188,603,897 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 937 | cpp | #include "Animation.h"
Animation::Animation(void)
{
}
Animation::~Animation(void)
{
}
void Animation::loadContent(std::string text, sf::Texture image, sf::Vector2f position)
{
//"this->" refers to the class variable instead of the parameter
this->preText = text;
this->image = image;
this->position = position;
alpha = 1.0f;
textColor = sf::Color(100, 20, 33);
if (image.getSize().x > 0)
{
}
sprite.setTexture(image);
this->text.setString(text);
active = false;
}
void Animation::unloadContent()
{
}
void Animation::draw(sf::RenderWindow &window)
{
std::string str = text.getString();
if (str != "")
{
window.draw(text);
}
if (sprite.getTexture() != NULL)
{
window.draw(sprite);
}
}
float Animation::getAlpha()
{
return alpha;
}
void Animation::setAlpha(float value)
{
alpha = value;
}
void Animation::setActive(bool value)
{
active = value;
}
void Animation::update(sf::RenderWindow &window)
{
} | [
"[email protected]"
] | |
569998d0f7f4246805f2e15857af0cdac976e61a | e98b265914ec3dbdc5eefe443505e58321ef5c00 | /mojo/gpu/mojo_gles2_impl_autogen.h | f5f989ce870cf8d8879344bbae783a03160c9193 | [
"BSD-3-Clause"
] | permissive | zhouyige/chrome4sdp | d223f33cf45889bf9437ad9614e1c414c6c37faf | a9655c8758922ec2ff07400f6be8c448749a8c64 | refs/heads/master | 2022-12-17T17:36:19.467887 | 2017-01-04T07:35:25 | 2017-01-04T07:35:25 | 78,020,809 | 0 | 1 | BSD-3-Clause | 2022-11-17T18:58:27 | 2017-01-04T14:05:31 | null | UTF-8 | C++ | false | false | 43,038 | h | // Copyright 2014 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.
// This file is auto-generated from
// gpu/command_buffer/build_gles2_cmd_buffer.py
// It's formatted by clang-format using chromium coding style:
// clang-format -i -style=chromium filename
// DO NOT EDIT!
// This file is included by gles2_interface.h to declare the
// GL api functions.
#ifndef MOJO_GPU_MOJO_GLES2_IMPL_AUTOGEN_H_
#define MOJO_GPU_MOJO_GLES2_IMPL_AUTOGEN_H_
#include <memory>
#include "gpu/command_buffer/client/gles2_interface.h"
#include "mojo/public/c/gles2/gles2.h"
namespace mojo {
class MojoGLES2Impl : public gpu::gles2::GLES2Interface {
public:
explicit MojoGLES2Impl(MojoGLES2Context context) { context_ = context; }
~MojoGLES2Impl() override {}
void ActiveTexture(GLenum texture) override;
void AttachShader(GLuint program, GLuint shader) override;
void BindAttribLocation(GLuint program,
GLuint index,
const char* name) override;
void BindBuffer(GLenum target, GLuint buffer) override;
void BindBufferBase(GLenum target, GLuint index, GLuint buffer) override;
void BindBufferRange(GLenum target,
GLuint index,
GLuint buffer,
GLintptr offset,
GLsizeiptr size) override;
void BindFramebuffer(GLenum target, GLuint framebuffer) override;
void BindRenderbuffer(GLenum target, GLuint renderbuffer) override;
void BindSampler(GLuint unit, GLuint sampler) override;
void BindTexture(GLenum target, GLuint texture) override;
void BindTransformFeedback(GLenum target, GLuint transformfeedback) override;
void BlendColor(GLclampf red,
GLclampf green,
GLclampf blue,
GLclampf alpha) override;
void BlendEquation(GLenum mode) override;
void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) override;
void BlendFunc(GLenum sfactor, GLenum dfactor) override;
void BlendFuncSeparate(GLenum srcRGB,
GLenum dstRGB,
GLenum srcAlpha,
GLenum dstAlpha) override;
void BufferData(GLenum target,
GLsizeiptr size,
const void* data,
GLenum usage) override;
void BufferSubData(GLenum target,
GLintptr offset,
GLsizeiptr size,
const void* data) override;
GLenum CheckFramebufferStatus(GLenum target) override;
void Clear(GLbitfield mask) override;
void ClearBufferfi(GLenum buffer,
GLint drawbuffers,
GLfloat depth,
GLint stencil) override;
void ClearBufferfv(GLenum buffer,
GLint drawbuffers,
const GLfloat* value) override;
void ClearBufferiv(GLenum buffer,
GLint drawbuffers,
const GLint* value) override;
void ClearBufferuiv(GLenum buffer,
GLint drawbuffers,
const GLuint* value) override;
void ClearColor(GLclampf red,
GLclampf green,
GLclampf blue,
GLclampf alpha) override;
void ClearDepthf(GLclampf depth) override;
void ClearStencil(GLint s) override;
GLenum ClientWaitSync(GLsync sync,
GLbitfield flags,
GLuint64 timeout) override;
void ColorMask(GLboolean red,
GLboolean green,
GLboolean blue,
GLboolean alpha) override;
void CompileShader(GLuint shader) override;
void CompressedTexImage2D(GLenum target,
GLint level,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLint border,
GLsizei imageSize,
const void* data) override;
void CompressedTexSubImage2D(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLsizei imageSize,
const void* data) override;
void CompressedTexImage3D(GLenum target,
GLint level,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLsizei depth,
GLint border,
GLsizei imageSize,
const void* data) override;
void CompressedTexSubImage3D(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLsizei width,
GLsizei height,
GLsizei depth,
GLenum format,
GLsizei imageSize,
const void* data) override;
void CompressTexture() override;
void CopyBufferSubData(GLenum readtarget,
GLenum writetarget,
GLintptr readoffset,
GLintptr writeoffset,
GLsizeiptr size) override;
void CopyTexImage2D(GLenum target,
GLint level,
GLenum internalformat,
GLint x,
GLint y,
GLsizei width,
GLsizei height,
GLint border) override;
void CopyTexSubImage2D(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint x,
GLint y,
GLsizei width,
GLsizei height) override;
void CopyTexSubImage3D(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLint x,
GLint y,
GLsizei width,
GLsizei height) override;
GLuint CreateProgram() override;
GLuint CreateShader(GLenum type) override;
void CullFace(GLenum mode) override;
void DeleteBuffers(GLsizei n, const GLuint* buffers) override;
void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) override;
void DeleteProgram(GLuint program) override;
void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) override;
void DeleteSamplers(GLsizei n, const GLuint* samplers) override;
void DeleteSync(GLsync sync) override;
void DeleteShader(GLuint shader) override;
void DeleteTextures(GLsizei n, const GLuint* textures) override;
void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) override;
void DepthFunc(GLenum func) override;
void DepthMask(GLboolean flag) override;
void DepthRangef(GLclampf zNear, GLclampf zFar) override;
void DetachShader(GLuint program, GLuint shader) override;
void Disable(GLenum cap) override;
void DisableVertexAttribArray(GLuint index) override;
void DrawArrays(GLenum mode, GLint first, GLsizei count) override;
void DrawElements(GLenum mode,
GLsizei count,
GLenum type,
const void* indices) override;
void DrawRangeElements(GLenum mode,
GLuint start,
GLuint end,
GLsizei count,
GLenum type,
const void* indices) override;
void Enable(GLenum cap) override;
void EnableVertexAttribArray(GLuint index) override;
GLsync FenceSync(GLenum condition, GLbitfield flags) override;
void Finish() override;
void Flush() override;
void FramebufferRenderbuffer(GLenum target,
GLenum attachment,
GLenum renderbuffertarget,
GLuint renderbuffer) override;
void FramebufferTexture2D(GLenum target,
GLenum attachment,
GLenum textarget,
GLuint texture,
GLint level) override;
void FramebufferTextureLayer(GLenum target,
GLenum attachment,
GLuint texture,
GLint level,
GLint layer) override;
void FrontFace(GLenum mode) override;
void GenBuffers(GLsizei n, GLuint* buffers) override;
void GenerateMipmap(GLenum target) override;
void GenFramebuffers(GLsizei n, GLuint* framebuffers) override;
void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override;
void GenSamplers(GLsizei n, GLuint* samplers) override;
void GenTextures(GLsizei n, GLuint* textures) override;
void GenTransformFeedbacks(GLsizei n, GLuint* ids) override;
void GetActiveAttrib(GLuint program,
GLuint index,
GLsizei bufsize,
GLsizei* length,
GLint* size,
GLenum* type,
char* name) override;
void GetActiveUniform(GLuint program,
GLuint index,
GLsizei bufsize,
GLsizei* length,
GLint* size,
GLenum* type,
char* name) override;
void GetActiveUniformBlockiv(GLuint program,
GLuint index,
GLenum pname,
GLint* params) override;
void GetActiveUniformBlockName(GLuint program,
GLuint index,
GLsizei bufsize,
GLsizei* length,
char* name) override;
void GetActiveUniformsiv(GLuint program,
GLsizei count,
const GLuint* indices,
GLenum pname,
GLint* params) override;
void GetAttachedShaders(GLuint program,
GLsizei maxcount,
GLsizei* count,
GLuint* shaders) override;
GLint GetAttribLocation(GLuint program, const char* name) override;
void GetBooleanv(GLenum pname, GLboolean* params) override;
void GetBufferParameteri64v(GLenum target,
GLenum pname,
GLint64* params) override;
void GetBufferParameteriv(GLenum target,
GLenum pname,
GLint* params) override;
GLenum GetError() override;
void GetFloatv(GLenum pname, GLfloat* params) override;
GLint GetFragDataLocation(GLuint program, const char* name) override;
void GetFramebufferAttachmentParameteriv(GLenum target,
GLenum attachment,
GLenum pname,
GLint* params) override;
void GetInteger64v(GLenum pname, GLint64* params) override;
void GetIntegeri_v(GLenum pname, GLuint index, GLint* data) override;
void GetInteger64i_v(GLenum pname, GLuint index, GLint64* data) override;
void GetIntegerv(GLenum pname, GLint* params) override;
void GetInternalformativ(GLenum target,
GLenum format,
GLenum pname,
GLsizei bufSize,
GLint* params) override;
void GetProgramiv(GLuint program, GLenum pname, GLint* params) override;
void GetProgramInfoLog(GLuint program,
GLsizei bufsize,
GLsizei* length,
char* infolog) override;
void GetRenderbufferParameteriv(GLenum target,
GLenum pname,
GLint* params) override;
void GetSamplerParameterfv(GLuint sampler,
GLenum pname,
GLfloat* params) override;
void GetSamplerParameteriv(GLuint sampler,
GLenum pname,
GLint* params) override;
void GetShaderiv(GLuint shader, GLenum pname, GLint* params) override;
void GetShaderInfoLog(GLuint shader,
GLsizei bufsize,
GLsizei* length,
char* infolog) override;
void GetShaderPrecisionFormat(GLenum shadertype,
GLenum precisiontype,
GLint* range,
GLint* precision) override;
void GetShaderSource(GLuint shader,
GLsizei bufsize,
GLsizei* length,
char* source) override;
const GLubyte* GetString(GLenum name) override;
const GLubyte* GetStringi(GLenum name, GLuint index) override;
void GetSynciv(GLsync sync,
GLenum pname,
GLsizei bufsize,
GLsizei* length,
GLint* values) override;
void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) override;
void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) override;
void GetTransformFeedbackVarying(GLuint program,
GLuint index,
GLsizei bufsize,
GLsizei* length,
GLsizei* size,
GLenum* type,
char* name) override;
GLuint GetUniformBlockIndex(GLuint program, const char* name) override;
void GetUniformfv(GLuint program, GLint location, GLfloat* params) override;
void GetUniformiv(GLuint program, GLint location, GLint* params) override;
void GetUniformuiv(GLuint program, GLint location, GLuint* params) override;
void GetUniformIndices(GLuint program,
GLsizei count,
const char* const* names,
GLuint* indices) override;
GLint GetUniformLocation(GLuint program, const char* name) override;
void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override;
void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override;
void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override;
void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override;
void GetVertexAttribPointerv(GLuint index,
GLenum pname,
void** pointer) override;
void Hint(GLenum target, GLenum mode) override;
void InvalidateFramebuffer(GLenum target,
GLsizei count,
const GLenum* attachments) override;
void InvalidateSubFramebuffer(GLenum target,
GLsizei count,
const GLenum* attachments,
GLint x,
GLint y,
GLsizei width,
GLsizei height) override;
GLboolean IsBuffer(GLuint buffer) override;
GLboolean IsEnabled(GLenum cap) override;
GLboolean IsFramebuffer(GLuint framebuffer) override;
GLboolean IsProgram(GLuint program) override;
GLboolean IsRenderbuffer(GLuint renderbuffer) override;
GLboolean IsSampler(GLuint sampler) override;
GLboolean IsShader(GLuint shader) override;
GLboolean IsSync(GLsync sync) override;
GLboolean IsTexture(GLuint texture) override;
GLboolean IsTransformFeedback(GLuint transformfeedback) override;
void LineWidth(GLfloat width) override;
void LinkProgram(GLuint program) override;
void PauseTransformFeedback() override;
void PixelStorei(GLenum pname, GLint param) override;
void PolygonOffset(GLfloat factor, GLfloat units) override;
void ReadBuffer(GLenum src) override;
void ReadPixels(GLint x,
GLint y,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
void* pixels) override;
void ReleaseShaderCompiler() override;
void RenderbufferStorage(GLenum target,
GLenum internalformat,
GLsizei width,
GLsizei height) override;
void ResumeTransformFeedback() override;
void SampleCoverage(GLclampf value, GLboolean invert) override;
void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) override;
void SamplerParameterfv(GLuint sampler,
GLenum pname,
const GLfloat* params) override;
void SamplerParameteri(GLuint sampler, GLenum pname, GLint param) override;
void SamplerParameteriv(GLuint sampler,
GLenum pname,
const GLint* params) override;
void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override;
void ShaderBinary(GLsizei n,
const GLuint* shaders,
GLenum binaryformat,
const void* binary,
GLsizei length) override;
void ShaderSource(GLuint shader,
GLsizei count,
const GLchar* const* str,
const GLint* length) override;
void ShallowFinishCHROMIUM() override;
void ShallowFlushCHROMIUM() override;
void OrderingBarrierCHROMIUM() override;
void StencilFunc(GLenum func, GLint ref, GLuint mask) override;
void StencilFuncSeparate(GLenum face,
GLenum func,
GLint ref,
GLuint mask) override;
void StencilMask(GLuint mask) override;
void StencilMaskSeparate(GLenum face, GLuint mask) override;
void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override;
void StencilOpSeparate(GLenum face,
GLenum fail,
GLenum zfail,
GLenum zpass) override;
void TexImage2D(GLenum target,
GLint level,
GLint internalformat,
GLsizei width,
GLsizei height,
GLint border,
GLenum format,
GLenum type,
const void* pixels) override;
void TexImage3D(GLenum target,
GLint level,
GLint internalformat,
GLsizei width,
GLsizei height,
GLsizei depth,
GLint border,
GLenum format,
GLenum type,
const void* pixels) override;
void TexParameterf(GLenum target, GLenum pname, GLfloat param) override;
void TexParameterfv(GLenum target,
GLenum pname,
const GLfloat* params) override;
void TexParameteri(GLenum target, GLenum pname, GLint param) override;
void TexParameteriv(GLenum target,
GLenum pname,
const GLint* params) override;
void TexStorage3D(GLenum target,
GLsizei levels,
GLenum internalFormat,
GLsizei width,
GLsizei height,
GLsizei depth) override;
void TexSubImage2D(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
const void* pixels) override;
void TexSubImage3D(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLsizei width,
GLsizei height,
GLsizei depth,
GLenum format,
GLenum type,
const void* pixels) override;
void TransformFeedbackVaryings(GLuint program,
GLsizei count,
const char* const* varyings,
GLenum buffermode) override;
void Uniform1f(GLint location, GLfloat x) override;
void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override;
void Uniform1i(GLint location, GLint x) override;
void Uniform1iv(GLint location, GLsizei count, const GLint* v) override;
void Uniform1ui(GLint location, GLuint x) override;
void Uniform1uiv(GLint location, GLsizei count, const GLuint* v) override;
void Uniform2f(GLint location, GLfloat x, GLfloat y) override;
void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override;
void Uniform2i(GLint location, GLint x, GLint y) override;
void Uniform2iv(GLint location, GLsizei count, const GLint* v) override;
void Uniform2ui(GLint location, GLuint x, GLuint y) override;
void Uniform2uiv(GLint location, GLsizei count, const GLuint* v) override;
void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override;
void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override;
void Uniform3i(GLint location, GLint x, GLint y, GLint z) override;
void Uniform3iv(GLint location, GLsizei count, const GLint* v) override;
void Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z) override;
void Uniform3uiv(GLint location, GLsizei count, const GLuint* v) override;
void Uniform4f(GLint location,
GLfloat x,
GLfloat y,
GLfloat z,
GLfloat w) override;
void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override;
void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override;
void Uniform4iv(GLint location, GLsizei count, const GLint* v) override;
void Uniform4ui(GLint location,
GLuint x,
GLuint y,
GLuint z,
GLuint w) override;
void Uniform4uiv(GLint location, GLsizei count, const GLuint* v) override;
void UniformBlockBinding(GLuint program,
GLuint index,
GLuint binding) override;
void UniformMatrix2fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UniformMatrix2x3fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UniformMatrix2x4fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UniformMatrix3fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UniformMatrix3x2fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UniformMatrix3x4fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UniformMatrix4fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UniformMatrix4x2fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UniformMatrix4x3fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat* value) override;
void UseProgram(GLuint program) override;
void ValidateProgram(GLuint program) override;
void VertexAttrib1f(GLuint indx, GLfloat x) override;
void VertexAttrib1fv(GLuint indx, const GLfloat* values) override;
void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) override;
void VertexAttrib2fv(GLuint indx, const GLfloat* values) override;
void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) override;
void VertexAttrib3fv(GLuint indx, const GLfloat* values) override;
void VertexAttrib4f(GLuint indx,
GLfloat x,
GLfloat y,
GLfloat z,
GLfloat w) override;
void VertexAttrib4fv(GLuint indx, const GLfloat* values) override;
void VertexAttribI4i(GLuint indx,
GLint x,
GLint y,
GLint z,
GLint w) override;
void VertexAttribI4iv(GLuint indx, const GLint* values) override;
void VertexAttribI4ui(GLuint indx,
GLuint x,
GLuint y,
GLuint z,
GLuint w) override;
void VertexAttribI4uiv(GLuint indx, const GLuint* values) override;
void VertexAttribIPointer(GLuint indx,
GLint size,
GLenum type,
GLsizei stride,
const void* ptr) override;
void VertexAttribPointer(GLuint indx,
GLint size,
GLenum type,
GLboolean normalized,
GLsizei stride,
const void* ptr) override;
void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override;
void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override;
void BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
GLint srcY1,
GLint dstX0,
GLint dstY0,
GLint dstX1,
GLint dstY1,
GLbitfield mask,
GLenum filter) override;
void RenderbufferStorageMultisampleCHROMIUM(GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height) override;
void RenderbufferStorageMultisampleEXT(GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height) override;
void FramebufferTexture2DMultisampleEXT(GLenum target,
GLenum attachment,
GLenum textarget,
GLuint texture,
GLint level,
GLsizei samples) override;
void TexStorage2DEXT(GLenum target,
GLsizei levels,
GLenum internalFormat,
GLsizei width,
GLsizei height) override;
void GenQueriesEXT(GLsizei n, GLuint* queries) override;
void DeleteQueriesEXT(GLsizei n, const GLuint* queries) override;
void QueryCounterEXT(GLuint id, GLenum target) override;
GLboolean IsQueryEXT(GLuint id) override;
void BeginQueryEXT(GLenum target, GLuint id) override;
void BeginTransformFeedback(GLenum primitivemode) override;
void EndQueryEXT(GLenum target) override;
void EndTransformFeedback() override;
void GetQueryivEXT(GLenum target, GLenum pname, GLint* params) override;
void GetQueryObjectivEXT(GLuint id, GLenum pname, GLint* params) override;
void GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint* params) override;
void GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64* params) override;
void GetQueryObjectui64vEXT(GLuint id,
GLenum pname,
GLuint64* params) override;
void SetDisjointValueSyncCHROMIUM() override;
void InsertEventMarkerEXT(GLsizei length, const GLchar* marker) override;
void PushGroupMarkerEXT(GLsizei length, const GLchar* marker) override;
void PopGroupMarkerEXT() override;
void GenVertexArraysOES(GLsizei n, GLuint* arrays) override;
void DeleteVertexArraysOES(GLsizei n, const GLuint* arrays) override;
GLboolean IsVertexArrayOES(GLuint array) override;
void BindVertexArrayOES(GLuint array) override;
void SwapBuffers() override;
GLuint GetMaxValueInBufferCHROMIUM(GLuint buffer_id,
GLsizei count,
GLenum type,
GLuint offset) override;
GLboolean EnableFeatureCHROMIUM(const char* feature) override;
void* MapBufferCHROMIUM(GLuint target, GLenum access) override;
GLboolean UnmapBufferCHROMIUM(GLuint target) override;
void* MapBufferSubDataCHROMIUM(GLuint target,
GLintptr offset,
GLsizeiptr size,
GLenum access) override;
void UnmapBufferSubDataCHROMIUM(const void* mem) override;
void* MapBufferRange(GLenum target,
GLintptr offset,
GLsizeiptr size,
GLbitfield access) override;
GLboolean UnmapBuffer(GLenum target) override;
void* MapTexSubImage2DCHROMIUM(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
GLenum access) override;
void UnmapTexSubImage2DCHROMIUM(const void* mem) override;
void ResizeCHROMIUM(GLuint width,
GLuint height,
GLfloat scale_factor,
GLboolean alpha) override;
const GLchar* GetRequestableExtensionsCHROMIUM() override;
void RequestExtensionCHROMIUM(const char* extension) override;
void GetProgramInfoCHROMIUM(GLuint program,
GLsizei bufsize,
GLsizei* size,
void* info) override;
void GetUniformBlocksCHROMIUM(GLuint program,
GLsizei bufsize,
GLsizei* size,
void* info) override;
void GetTransformFeedbackVaryingsCHROMIUM(GLuint program,
GLsizei bufsize,
GLsizei* size,
void* info) override;
void GetUniformsES3CHROMIUM(GLuint program,
GLsizei bufsize,
GLsizei* size,
void* info) override;
GLuint CreateImageCHROMIUM(ClientBuffer buffer,
GLsizei width,
GLsizei height,
GLenum internalformat) override;
void DestroyImageCHROMIUM(GLuint image_id) override;
GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width,
GLsizei height,
GLenum internalformat,
GLenum usage) override;
void GetTranslatedShaderSourceANGLE(GLuint shader,
GLsizei bufsize,
GLsizei* length,
char* source) override;
void PostSubBufferCHROMIUM(GLint x,
GLint y,
GLint width,
GLint height) override;
void CopyTextureCHROMIUM(GLenum source_id,
GLenum dest_id,
GLint internalformat,
GLenum dest_type,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) override;
void CopySubTextureCHROMIUM(GLenum source_id,
GLenum dest_id,
GLint xoffset,
GLint yoffset,
GLint x,
GLint y,
GLsizei width,
GLsizei height,
GLboolean unpack_flip_y,
GLboolean unpack_premultiply_alpha,
GLboolean unpack_unmultiply_alpha) override;
void CompressedCopyTextureCHROMIUM(GLenum source_id, GLenum dest_id) override;
void DrawArraysInstancedANGLE(GLenum mode,
GLint first,
GLsizei count,
GLsizei primcount) override;
void DrawElementsInstancedANGLE(GLenum mode,
GLsizei count,
GLenum type,
const void* indices,
GLsizei primcount) override;
void VertexAttribDivisorANGLE(GLuint index, GLuint divisor) override;
void GenMailboxCHROMIUM(GLbyte* mailbox) override;
void ProduceTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override;
void ProduceTextureDirectCHROMIUM(GLuint texture,
GLenum target,
const GLbyte* mailbox) override;
void ConsumeTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override;
GLuint CreateAndConsumeTextureCHROMIUM(GLenum target,
const GLbyte* mailbox) override;
void BindUniformLocationCHROMIUM(GLuint program,
GLint location,
const char* name) override;
void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) override;
void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) override;
void TraceBeginCHROMIUM(const char* category_name,
const char* trace_name) override;
void TraceEndCHROMIUM() override;
void DiscardFramebufferEXT(GLenum target,
GLsizei count,
const GLenum* attachments) override;
void LoseContextCHROMIUM(GLenum current, GLenum other) override;
GLuint64 InsertFenceSyncCHROMIUM() override;
void GenSyncTokenCHROMIUM(GLuint64 fence_sync, GLbyte* sync_token) override;
void GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync,
GLbyte* sync_token) override;
void VerifySyncTokensCHROMIUM(GLbyte** sync_tokens, GLsizei count) override;
void WaitSyncTokenCHROMIUM(const GLbyte* sync_token) override;
void DrawBuffersEXT(GLsizei count, const GLenum* bufs) override;
void DiscardBackbufferCHROMIUM() override;
void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order,
GLenum plane_transform,
GLuint overlay_texture_id,
GLint bounds_x,
GLint bounds_y,
GLint bounds_width,
GLint bounds_height,
GLfloat uv_x,
GLfloat uv_y,
GLfloat uv_width,
GLfloat uv_height) override;
void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
const GLfloat* contents_rect,
GLfloat opacity,
GLuint background_color,
GLuint edge_aa_mask,
const GLfloat* bounds_rect,
GLboolean is_clipped,
const GLfloat* clip_rect,
GLint sorting_context_id,
const GLfloat* transform,
GLuint filter) override;
void CommitOverlayPlanesCHROMIUM() override;
void SwapInterval(GLint interval) override;
void FlushDriverCachesCHROMIUM() override;
GLuint GetLastFlushIdCHROMIUM() override;
void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) override;
GLuint GenPathsCHROMIUM(GLsizei range) override;
void DeletePathsCHROMIUM(GLuint path, GLsizei range) override;
GLboolean IsPathCHROMIUM(GLuint path) override;
void PathCommandsCHROMIUM(GLuint path,
GLsizei numCommands,
const GLubyte* commands,
GLsizei numCoords,
GLenum coordType,
const GLvoid* coords) override;
void PathParameterfCHROMIUM(GLuint path,
GLenum pname,
GLfloat value) override;
void PathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value) override;
void PathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask) override;
void StencilFillPathCHROMIUM(GLuint path,
GLenum fillMode,
GLuint mask) override;
void StencilStrokePathCHROMIUM(GLuint path,
GLint reference,
GLuint mask) override;
void CoverFillPathCHROMIUM(GLuint path, GLenum coverMode) override;
void CoverStrokePathCHROMIUM(GLuint path, GLenum coverMode) override;
void StencilThenCoverFillPathCHROMIUM(GLuint path,
GLenum fillMode,
GLuint mask,
GLenum coverMode) override;
void StencilThenCoverStrokePathCHROMIUM(GLuint path,
GLint reference,
GLuint mask,
GLenum coverMode) override;
void StencilFillPathInstancedCHROMIUM(
GLsizei numPaths,
GLenum pathNameType,
const GLvoid* paths,
GLuint pathBase,
GLenum fillMode,
GLuint mask,
GLenum transformType,
const GLfloat* transformValues) override;
void StencilStrokePathInstancedCHROMIUM(
GLsizei numPaths,
GLenum pathNameType,
const GLvoid* paths,
GLuint pathBase,
GLint reference,
GLuint mask,
GLenum transformType,
const GLfloat* transformValues) override;
void CoverFillPathInstancedCHROMIUM(GLsizei numPaths,
GLenum pathNameType,
const GLvoid* paths,
GLuint pathBase,
GLenum coverMode,
GLenum transformType,
const GLfloat* transformValues) override;
void CoverStrokePathInstancedCHROMIUM(
GLsizei numPaths,
GLenum pathNameType,
const GLvoid* paths,
GLuint pathBase,
GLenum coverMode,
GLenum transformType,
const GLfloat* transformValues) override;
void StencilThenCoverFillPathInstancedCHROMIUM(
GLsizei numPaths,
GLenum pathNameType,
const GLvoid* paths,
GLuint pathBase,
GLenum fillMode,
GLuint mask,
GLenum coverMode,
GLenum transformType,
const GLfloat* transformValues) override;
void StencilThenCoverStrokePathInstancedCHROMIUM(
GLsizei numPaths,
GLenum pathNameType,
const GLvoid* paths,
GLuint pathBase,
GLint reference,
GLuint mask,
GLenum coverMode,
GLenum transformType,
const GLfloat* transformValues) override;
void BindFragmentInputLocationCHROMIUM(GLuint program,
GLint location,
const char* name) override;
void ProgramPathFragmentInputGenCHROMIUM(GLuint program,
GLint location,
GLenum genMode,
GLint components,
const GLfloat* coeffs) override;
void CoverageModulationCHROMIUM(GLenum components) override;
GLenum GetGraphicsResetStatusKHR() override;
void BlendBarrierKHR() override;
void ApplyScreenSpaceAntialiasingCHROMIUM() override;
void BindFragDataLocationIndexedEXT(GLuint program,
GLuint colorNumber,
GLuint index,
const char* name) override;
void BindFragDataLocationEXT(GLuint program,
GLuint colorNumber,
const char* name) override;
GLint GetFragDataIndexEXT(GLuint program, const char* name) override;
void UniformMatrix4fvStreamTextureMatrixCHROMIUM(
GLint location,
GLboolean transpose,
const GLfloat* default_value) override;
void StartTilingQCOM(GLuint x,
GLuint y,
GLuint width,
GLuint height,
GLbitfield preserveMask) override;
void EndTilingQCOM(GLbitfield preserveMask) override;
private:
MojoGLES2Context context_;
};
} // namespace mojo
#endif // MOJO_GPU_MOJO_GLES2_IMPL_AUTOGEN_H_
| [
"[email protected]"
] | |
e1d04d8271eb5ad0baa21599c8612556d0120572 | 027eda7f41dc38eddeed50713bc23328c5bab6b4 | /CalulatorLanguage/CalulatorLanguage/main.cpp | 4bff767ed137f26cdd4cf56e91b3f2fed9f9f5e0 | [] | no_license | iamjwc/CS438 | 6e9872c88f639316beff32cc60bd4d5edf9cd037 | 9ebceb46abe063c3cacff299e0750b608358b216 | refs/heads/master | 2021-01-04T14:21:34.738661 | 2011-10-21T23:07:03 | 2011-10-21T23:07:03 | 2,623,746 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,927 | cpp | #include <iostream>
#include <fstream>
#include <list>
#include <string>
using namespace std;
template<class T>
void gc( T*& v )
{
delete v;
v = NULL;
}
void clean_stack( list<char>* stack )
{
while( stack->size() && stack->front() == '(' ) stack->pop_front();
}
int pop_number( list<char>* stack )
{
string s = "";
for(; stack->size() && isdigit( stack->front() ); s = stack->front() + s, stack->pop_front() );
int pos_neg = 1;
if(stack->front() == '_')
{
stack->pop_front();
pos_neg = -1;
}
return pos_neg * atoi( s.c_str() );
}
int registers[26] = {0};
int last_registers[26] = {0};
void update_registers()
{
for( int i = 0; i < 26; ++i )
last_registers[i] = registers[i];
}
int& pop_variable( list<char>* stack )
{
int& val = registers[stack->front()-'A'];
stack->pop_front();
return val;
}
char pop_operator( list<char>* stack )
{
char op = stack->front();
stack->pop_front();
return op;
}
bool get_value( list<char>* stack, int& val, char& var )
{
if( isdigit( stack->front() ) )
val = pop_number( stack );
else if( isalpha( var = stack->front() ) )
val = pop_variable( stack );
else
return false;
return true;
}
int compute( char op, int a, int b )
{
if( op == '+' ) return a + b;
if( op == '-' ) return a - b;
if( op == '*' ) return a * b;
if( op == '/' ) return a / b;
}
int compute( char op, char a, int b )
{
return registers[a-'A'] = b;
}
int eval( list<char>* stack )
{
int a, b;
char op;
char var = 0;
bool reuse_b = false;
bool use_a = true;
while( stack->size() && stack->front() != '(' )
{
if( !reuse_b && !get_value( stack, b, var ) )
{
stack->pop_front();
b = eval( stack );
if( !stack->size() || stack->front() == ')')
return b;
}
if( stack->front() == '(' )
{
stack->pop_front();
return b;
}
if( stack->size() && stack->front() == '_' )
{
b *= -1;
stack->pop_front();
}
op = pop_operator( stack );
if( !get_value( stack, a, var ) )
{
stack->pop_front();
a = eval( stack );
}
if( stack->size() && stack->front() == '_' )
{
a *= -1;
stack->pop_front();
}
if( isalpha(var) && op == '=' )
b = compute( op, var, b );
else
b = compute( op, a, b );
reuse_b = true;
}
clean_stack( stack );
return b;
}
void print_changes()
{
bool changed = false;
for( int i = 0; i < 26; ++i )
{
if( registers[i] != last_registers[i] )
{
if( changed )
cout << ", ";
cout << char('A'+i) << " = " << registers[i];
changed = true;
}
}
if( !changed )
cout << "No Change";
cout << endl;
}
int main()
{
list<char>* stack = new list<char>();
list<string>* queue = new list<string>();
string s = "";
ifstream* fin = new ifstream();
fin->open("172.in");
do
{
getline( *fin, s );
queue->push_back( s );
} while ( s[0] != '#' );
queue->pop_back();
fin->close();
gc(fin);
while( queue->size() )
{
s = queue->front();
queue->pop_front();
bool padded = false;
for( int i = 0, n = s.length(); i < n; ++i )
{
if( s[i] != ' ' )
{
stack->push_front( s[i] );
if( s[i] == '=' && !padded )
{
for( int i = 0; i < 100; ++i )
{
stack->push_front('0');
stack->push_front('+');
stack->push_front('(');
}
padded = true;
}
}
}
for( int i = 0; i < 100; ++i )
stack->push_front(')');
update_registers();
eval( stack );
print_changes();
}
gc(stack);
gc(queue);
return 0;
} | [
"[email protected]"
] | |
76e4dd4d3bd80bf528141cb666a62fa3e788d0c3 | 24cb74052f95d275dfb8599ea342cadd5e312fa1 | /Bit Manipulation/Common Bit Tasks/Clear ith Bit.cpp | dad046d178e9154d8aea2902f3c8dc723a7aeb81 | [
"MIT"
] | permissive | Datta2901/Algorithmic-Implementations | 44ccd6b1996fac660ec1c268a5fa44fda59abb0e | 9e1afe97d54d4dc50be9170bc1a155562e0aafa6 | refs/heads/master | 2023-08-31T17:25:52.391313 | 2021-10-15T17:46:56 | 2021-10-15T17:46:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 948 | cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
// Function to clear the ith bit in n
// NOTE: in the code below 0-based indexing of bits from RHS to LHS(i.e. from
// LSB to MSB) is considered
ll clear_bit(ll n, ll i) {
ll mask = ~(1LL << i);
ll res = n & mask;
return res;
}
void solve()
{
ll n, pos; cin >> n >> pos;
cout << clear_bit(n, pos) << "\n";
}
int main()
{
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
srand(chrono::high_resolution_clock::now().time_since_epoch().count());
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
// #ifndef ONLINE_JUDGE
// freopen("error.txt", "w", stderr);
// #endif
int t = 1;
// int test = 1;
// cin >> t;
while(t--) {
// cout << "Case #" << test++ << ": ";
solve();
}
return 0;
} | [
"[email protected]"
] | |
6866358cd49a910425a0ddc391aa035901e61261 | 20754fcb0048cc5279ea37bb6578a779ed8dcd5d | /Continuous Speech Train/seg_K_mean.h | 6b40e7ca17b9013603f71dbd307372131b54960b | [] | no_license | ScienisTmiaoT/Speech-Recognition | 2fa3b0dcdac544631ab80d00580414a9d1d05559 | 19c89b66d94a1c5bdce514fbead16bf2bd2ab810 | refs/heads/master | 2021-01-12T12:49:14.201361 | 2016-11-16T10:45:18 | 2016-11-16T10:45:18 | 68,998,555 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 998 | h | #ifndef seg_K_mean_h
#define seg_K_mean_h
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
#define SEG_NUM (5)
#define DIMENSION (39)
#define PI (3.1416)
#define MIN_VARIANCE (0.001)
double nodeCost(vector<double>& frame, vector<double>& segTem, vector<double>& varianceTerm);
double edgeCost(int nextIndex, vector<int>& countTransfer);
vector<vector<double>> dtw2hmm(vector<vector<vector<double>>>& temGroup, vector<vector<double>>& varianceTerm, vector<vector<int>>& countTransfer);
double segmentalDtw(vector<vector<double>>& inputAduio, vector<vector<double>>& temAduio, vector<vector<double>> varianceTerm, vector<vector<int>> countTransfer);
vector<vector<vector<vector<int>>>> conDtw2hmm(vector<vector<vector<vector<double>>>> temGroup, vector<vector<vector<vector<int>>>> initSegIndex, vector<vector<vector<double>>>& varianceTerm, vector<vector<vector<int>>>& countTransfer);
#endif /* seg_K_mean_h */
| [
"[email protected]"
] | |
f198b6981f369b24cb1c0225ee063689de779940 | bd2139703c556050403c10857bde66f688cd9ee6 | /loom/15/webrev.00/src/hotspot/share/memory/iterator.cpp | 01dbf33d19621801d3032db3e752dd2ec00c5fc3 | [] | no_license | isabella232/cr-archive | d03427e6fbc708403dd5882d36371e1b660ec1ac | 8a3c9ddcfacb32d1a65d7ca084921478362ec2d1 | refs/heads/master | 2023-02-01T17:33:44.383410 | 2020-12-17T13:47:48 | 2020-12-17T13:47:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,368 | cpp | /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "code/nmethod.hpp"
#include "gc/shared/barrierSetNMethod.hpp"
#include "memory/iterator.inline.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp"
DoNothingClosure do_nothing_cl;
void CLDToOopClosure::do_cld(ClassLoaderData* cld) {
cld->oops_do(_oop_closure, _cld_claim);
}
void ObjectToOopClosure::do_object(oop obj) {
obj->oop_iterate(_cl);
}
void VoidClosure::do_void() {
ShouldNotCallThis();
}
void CodeBlobToOopClosure::do_nmethod(nmethod* nm) {
nm->oops_do(_cl);
if (_fix_relocations) {
nm->fix_oop_relocations();
}
}
void CodeBlobToOopClosure::do_code_blob(CodeBlob* cb) {
nmethod* nm = cb->as_nmethod_or_null();
if (nm != NULL) {
do_nmethod(nm);
}
}
void MarkingCodeBlobClosure::do_code_blob(CodeBlob* cb) {
nmethod* nm = cb->as_nmethod_or_null();
if (nm != NULL && nm->oops_do_try_claim()) {
nm->mark_as_maybe_on_continuation();
nm->oops_do_keepalive(_cl, _keepalive_nmethods /* keepalive_is_strong */);
if (_fix_relocations) {
nm->fix_oop_relocations();
}
if (_keepalive_nmethods) {
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
if (bs_nm != NULL) {
bs_nm->disarm(nm);
}
}
}
}
| [
"[email protected]"
] | |
a2247e4e47eb574e57a214d66f2e2c47fc0cdbb9 | 32a4cc9a39a10583ff342266d77d5cfd54c80804 | /Source/Castlevania/Private/Spawn/LightPowerupSpawnActor.cpp | d170550572b9244eb677c316991a7ad1feaa2014 | [] | no_license | samalo0/Castlevania | 98f9ddbc1ff02c96fa6fd1e1f1e45b68fb796963 | 068ee4d668d05c2b35dde3ac5983db55873d3f8b | refs/heads/master | 2023-04-19T09:26:15.454063 | 2021-05-09T13:16:34 | 2021-05-09T13:16:34 | 329,926,809 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,970 | cpp | //----------------------------------------------------------------------------------------------------------------------
// Copyright 2021 Stephen Maloney
// Owner: Stephen Maloney
// Created: 1/3/2021
//----------------------------------------------------------------------------------------------------------------------
#include "Spawn/LightPowerupSpawnActor.h"
#include "Components/BoxComponent.h"
#include "CastlevaniaCameraActor.h"
#include "PaperFlipbookComponent.h"
#include "Components/PointLightComponent.h"
#include "WeaponActor.h"
ALightPowerupSpawnActor::ALightPowerupSpawnActor()
{
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.bStartWithTickEnabled = true;
PrimaryActorTick.TickInterval = 1.0f/8.0f;
FlipbookComponent = CreateDefaultSubobject<UPaperFlipbookComponent>(TEXT("FlipbookComponent"));
FlipbookComponent->SetupAttachment(GetRootComponent());
FlipbookComponent->SetCollisionProfileName("NoCollision");
FlipbookComponent->SetComponentTickEnabled(false);
PointLightComponent = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLightComponent"));
PointLightComponent->SetupAttachment(GetRootComponent());
PointLightComponent->SetCastShadows(false);
PointLightComponent->SetIntensityUnits(ELightUnits::Candelas);
PointLightComponent->SetIntensity(1.0f);
PointLightComponent->SetLightColor(FLinearColor(1.0f, 0.5f, 0.0f));
PointLightComponent->SetAttenuationRadius(75.0f);
}
void ALightPowerupSpawnActor::BeginPlay()
{
Super::BeginPlay();
BoxComponent->OnComponentEndOverlap.AddDynamic(this, &ALightPowerupSpawnActor::OnBoxEndOverlap);
// Check for camera overlap on begin play.
TArray<AActor*> OverlappingActors;
BoxComponent->GetOverlappingActors(OverlappingActors, ACastlevaniaCameraActor::StaticClass());
if(OverlappingActors.Num() > 0)
{
for(AActor* Actor : OverlappingActors)
{
ACastlevaniaCameraActor* Camera = Cast<ACastlevaniaCameraActor>(Actor);
if(IsValid(Camera))
{
SetActorTickEnabled(true);
FlipbookComponent->SetComponentTickEnabled(true);
PointLightComponent->SetVisibility(true);
break;
}
}
}
else
{
FlipbookComponent->SetComponentTickEnabled(false);
PointLightComponent->SetVisibility(false);
}
}
void ALightPowerupSpawnActor::OnBoxBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, const int32 OtherBodyIndex, const bool bFromSweep, const FHitResult& SweepResult)
{
ACastlevaniaPawn* Pawn = Cast<ACastlevaniaPawn>(OtherActor);
AWeaponActor* Weapon = Cast<AWeaponActor>(OtherActor);
if(IsValid(Pawn) || IsValid(Weapon))
{
BoxComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
FlipbookComponent->SetLooping(false);
FlipbookComponent->SetFlipbook(BurnOutFlipBook);
FlipbookComponent->OnFinishedPlaying.AddDynamic(this, &ALightPowerupSpawnActor::OnFinishedPlaying);
FlipbookComponent->PlayFromStart();
}
ACastlevaniaCameraActor* Camera = Cast<ACastlevaniaCameraActor>(OtherActor);
if(IsValid(Camera))
{
FlipbookComponent->SetComponentTickEnabled(true);
SetActorTickEnabled(true);
PointLightComponent->SetVisibility(true);
}
Super::OnBoxBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
}
void ALightPowerupSpawnActor::OnBoxEndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
ACastlevaniaCameraActor* Camera = Cast<ACastlevaniaCameraActor>(OtherActor);
if(IsValid(Camera))
{
FlipbookComponent->SetComponentTickEnabled(false);
SetActorTickEnabled(false);
PointLightComponent->SetVisibility(false);
}
}
void ALightPowerupSpawnActor::OnFinishedPlaying()
{
SpawnPowerup();
Destroy();
}
void ALightPowerupSpawnActor::Tick(const float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
PointLightComponent->SetIntensity(FMath::RandRange(MinimumLight, MaximumLight));
}
| [
"[email protected]"
] | |
2006335c8057d3b3186bfb980f65eff4a8c107a8 | 2a35885833380c51048e54fbdc7d120fd6034f39 | /Online Judges/AtCoder/abc157FYakinikuOptimizationProblem.cpp | 3055e90c2b04947b5d3d28747d49c7851fb26748 | [] | no_license | NelsonGomesNeto/Competitive-Programming | 8152ab8aa6a40b311e0704b932fe37a8f770148b | 4d427ae6a06453d36cbf370a7ec3d33e68fdeb1d | refs/heads/master | 2022-05-24T07:06:25.540182 | 2022-04-07T01:35:08 | 2022-04-07T01:35:08 | 201,100,734 | 8 | 7 | null | null | null | null | UTF-8 | C++ | false | false | 2,994 | cpp | #include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;
/* Tutorial:
We will cook meat[i] iff dist(p, meat[i])*c <= T
We can rewrite it as: dist(p, meat[i]) <= T / c, which
is the same as saying that p is inside circle(center: meat[i], radious: T/c)
So, we can use a binary search and find the minimum T in which
there's a point inside at least K circles (from meats)
That point will be either the center of a circle or the intersection
of two circles (so we can test in O(n^3))
*/
const int maxN = 60; int n, k;
const double eps = 1e-7;
struct Point
{
double x, y;
Point operator+(const Point &other) { return Point{x + other.x, y + other.y}; }
Point operator-(const Point &other) { return Point{x - other.x, y - other.y}; }
Point operator*(const double a) { return Point{x * a, y * a}; }
double operator*(const Point &other) { return x * other.x + y * other.y; }
double distance(Point &other) { return sqrt((x - other.x)*(x - other.x) + (y - other.y)*(y - other.y)); }
double cross(Point &other) { return x*other.y - y*other.x; }
Point rotate(double rad) { return Point{x * cos(rad) - y * sin(rad), x * sin(rad) + y * cos(rad)}; }
Point normalized()
{
double norm = sqrt(x*x + y*y);
return Point{x / norm, y / norm};
}
void read() { scanf("%lf %lf", &x, &y); }
void print() { printf("(%3.3lf, %3.3lf)\n", x, y); }
};
struct Circle
{
Point center; double radious;
bool contains(Point &p) { return center.distance(p) <= radious + eps; }
pair<Point, Point> circleIntersections(Circle &other)
{
double d = center.distance(other.center);
double u = acos((other.radious*other.radious + d*d - radious*radious) / (2.0*other.radious*d));
Point dc = (center - other.center).normalized() * other.radious;
return pair<Point, Point>
{
other.center + dc.rotate(u),
other.center + dc.rotate(-u)
};
}
};
struct Meat
{
Point p; double c;
void read() { p.read(); scanf("%lf", &c); }
Circle getCircle(double T) { return Circle{p, T / c}; }
};
Meat meats[maxN];
Circle circles[maxN];
bool valid(Point &a)
{
int done = 0;
for (int i = 0; i < n; i++)
done += circles[i].contains(a);
return done >= k;
}
bool can(double T)
{
for (int i = 0; i < n; i++)
circles[i] = meats[i].getCircle(T);
for (int i = 0; i < n; i++)
{
if (valid(meats[i].p))
return true;
for (int j = i + 1; j < n; j++)
{
pair<Point, Point> intersections = circles[i].circleIntersections(circles[j]);
if (valid(intersections.first) || valid(intersections.second))
return true;
}
}
return false;
}
int main()
{
while (scanf("%d %d", &n, &k) != EOF)
{
for (int i = 0; i < n; i++)
meats[i].read();
double lo = 0, hi = 1e6;
while (abs(hi - lo) > eps)
{
double mid = (lo + hi) / 2;
if (can(mid)) hi = mid;
else lo = mid;
}
printf("%lf\n", lo);
}
return 0;
} | [
"[email protected]"
] | |
bae68062ee80d900460a0ef90c49cc8ae0e4827d | fb9b97269ad61497ae7a667a58d2e9638b6c0cf5 | /src/CMap/Map1/dialog.cpp | b09fe044ba84b87ccd919a75af20988128471b86 | [] | no_license | smurav/gis36 | b98e4b485ae205a1025d8ccb280bbc3412b9961b | 3c7ad6e43cb3bdcb00622ee4008dde0ad96ce56d | refs/heads/master | 2016-09-05T13:36:53.446309 | 2012-09-07T05:59:56 | 2012-09-07T05:59:56 | 2,359,643 | 22 | 9 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 622 | cpp | #include "dialog.h"
#include "ui_dialog.h"
#include "QCursor"
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
this->setMouseTracking(false);
my_view = new CMyGraphicsView(this);
my_view->setGeometry(30,40,331,241);//место расположения и параметры сцены
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_pushButton_clicked()
{
my_view->scale(0.9,0.9);//уменьшение масштаба
}
void Dialog::on_pushButton_2_clicked()
{
my_view->scale(1.1,1.1);//увеличение масштаба
}
| [
"[email protected]"
] | |
ff860c2794d75dc2bd417ffbe614d290969a5865 | b7c76a6b0fc38257952f518806e03c7fa378ebc0 | /src/tests/end2end/BindGroupTests.cpp | b2fa09e8c5cc03dbabc4247040c6e9ec000dae1e | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | sddz-hl/dawn | 936e669379c7f9cf0d1776a360d9cbb08fd11ae1 | c532048062befdee8bb57d18f01d3a3c403d49de | refs/heads/main | 2023-01-21T19:21:35.029490 | 2020-12-04T19:31:40 | 2020-12-04T19:31:40 | 318,813,436 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 54,633 | cpp | // Copyright 2018 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "common/Assert.h"
#include "common/Constants.h"
#include "common/Math.h"
#include "tests/DawnTest.h"
#include "utils/ComboRenderPipelineDescriptor.h"
#include "utils/WGPUHelpers.h"
constexpr static uint32_t kRTSize = 8;
class BindGroupTests : public DawnTest {
protected:
wgpu::CommandBuffer CreateSimpleComputeCommandBuffer(const wgpu::ComputePipeline& pipeline,
const wgpu::BindGroup& bindGroup) {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Dispatch(1);
pass.EndPass();
return encoder.Finish();
}
wgpu::PipelineLayout MakeBasicPipelineLayout(
std::vector<wgpu::BindGroupLayout> bindingInitializer) const {
wgpu::PipelineLayoutDescriptor descriptor;
descriptor.bindGroupLayoutCount = bindingInitializer.size();
descriptor.bindGroupLayouts = bindingInitializer.data();
return device.CreatePipelineLayout(&descriptor);
}
wgpu::ShaderModule MakeSimpleVSModule() const {
return utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.f, 1.f), vec2(1.f, 1.f), vec2(-1.f, -1.f));
gl_Position = vec4(pos[gl_VertexIndex], 0.f, 1.f);
})");
}
wgpu::ShaderModule MakeFSModule(std::vector<wgpu::BindingType> bindingTypes) const {
ASSERT(bindingTypes.size() <= kMaxBindGroups);
std::ostringstream fs;
fs << R"(
#version 450
layout(location = 0) out vec4 fragColor;
)";
for (size_t i = 0; i < bindingTypes.size(); ++i) {
switch (bindingTypes[i]) {
case wgpu::BindingType::UniformBuffer:
fs << "layout (std140, set = " << i << ", binding = 0) uniform UniformBuffer"
<< i << R"( {
vec4 color;
} buffer)"
<< i << ";\n";
break;
case wgpu::BindingType::StorageBuffer:
fs << "layout (std430, set = " << i << ", binding = 0) buffer StorageBuffer"
<< i << R"( {
vec4 color;
} buffer)"
<< i << ";\n";
break;
default:
UNREACHABLE();
}
}
fs << R"(
void main() {
fragColor = vec4(0.0);
)";
for (size_t i = 0; i < bindingTypes.size(); ++i) {
fs << "fragColor += buffer" << i << ".color;\n";
}
fs << "}\n";
return utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment,
fs.str().c_str());
}
wgpu::RenderPipeline MakeTestPipeline(const utils::BasicRenderPass& renderPass,
std::vector<wgpu::BindingType> bindingTypes,
std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
wgpu::ShaderModule vsModule = MakeSimpleVSModule();
wgpu::ShaderModule fsModule = MakeFSModule(bindingTypes);
wgpu::PipelineLayout pipelineLayout = MakeBasicPipelineLayout(bindGroupLayouts);
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.layout = pipelineLayout;
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
pipelineDescriptor.cColorStates[0].colorBlend.operation = wgpu::BlendOperation::Add;
pipelineDescriptor.cColorStates[0].colorBlend.srcFactor = wgpu::BlendFactor::One;
pipelineDescriptor.cColorStates[0].colorBlend.dstFactor = wgpu::BlendFactor::One;
pipelineDescriptor.cColorStates[0].alphaBlend.operation = wgpu::BlendOperation::Add;
pipelineDescriptor.cColorStates[0].alphaBlend.srcFactor = wgpu::BlendFactor::One;
pipelineDescriptor.cColorStates[0].alphaBlend.dstFactor = wgpu::BlendFactor::One;
return device.CreateRenderPipeline(&pipelineDescriptor);
}
};
// Test a bindgroup reused in two command buffers in the same call to queue.Submit().
// This test passes by not asserting or crashing.
TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
const char* shader = R"(
#version 450
layout(std140, set = 0, binding = 0) uniform Contents {
float f;
} contents;
void main() {
}
)";
wgpu::ShaderModule module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, shader);
wgpu::ComputePipelineDescriptor cpDesc;
cpDesc.computeStage.module = module;
cpDesc.computeStage.entryPoint = "main";
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
wgpu::BufferDescriptor bufferDesc;
bufferDesc.size = sizeof(float);
bufferDesc.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Uniform;
wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, cp.GetBindGroupLayout(0), {{0, buffer}});
wgpu::CommandBuffer cb[2];
cb[0] = CreateSimpleComputeCommandBuffer(cp, bindGroup);
cb[1] = CreateSimpleComputeCommandBuffer(cp, bindGroup);
queue.Submit(2, cb);
}
// Test a bindgroup containing a UBO which is used in both the vertex and fragment shader.
// It contains a transformation matrix for the VS and the fragment color for the FS.
// These must result in different register offsets in the native APIs.
TEST_P(BindGroupTests, ReusedUBO) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
wgpu::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
mat2 transform;
};
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.f, 1.f), vec2(1.f, 1.f), vec2(-1.f, -1.f));
gl_Position = vec4(transform * pos[gl_VertexIndex], 0.f, 1.f);
})");
wgpu::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 0, binding = 1) uniform fragmentUniformBuffer {
vec4 color;
};
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = color;
})");
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
textureDescriptor.vertexStage.module = vsModule;
textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
struct Data {
float transform[8];
char padding[256 - 8 * sizeof(float)];
float color[4];
};
ASSERT(offsetof(Data, color) == 256);
constexpr float dummy = 0.0f;
Data data{
{1.f, 0.f, dummy, dummy, 0.f, 1.0f, dummy, dummy},
{0},
{0.f, 1.f, 0.f, 1.f},
};
wgpu::Buffer buffer =
utils::CreateBufferFromData(device, &data, sizeof(data), wgpu::BufferUsage::Uniform);
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, pipeline.GetBindGroupLayout(0),
{{0, buffer, 0, sizeof(Data::transform)}, {1, buffer, 256, sizeof(Data::color)}});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
RGBA8 filled(0, 255, 0, 255);
RGBA8 notFilled(0, 0, 0, 0);
uint32_t min = 1, max = kRTSize - 3;
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, max, max);
}
// Test a bindgroup containing a UBO in the vertex shader and a sampler and texture in the fragment
// shader. In D3D12 for example, these different types of bindings end up in different namespaces,
// but the register offsets used must match between the shader module and descriptor range.
TEST_P(BindGroupTests, UBOSamplerAndTexture) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
wgpu::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (set = 0, binding = 0) uniform vertexUniformBuffer {
mat2 transform;
};
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.f, 1.f), vec2(1.f, 1.f), vec2(-1.f, -1.f));
gl_Position = vec4(transform * pos[gl_VertexIndex], 0.f, 1.f);
})");
wgpu::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 0, binding = 1) uniform sampler samp;
layout (set = 0, binding = 2) uniform texture2D tex;
layout (location = 0) out vec4 fragColor;
void main() {
fragColor = texture(sampler2D(tex, samp), gl_FragCoord.xy);
})");
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
constexpr float dummy = 0.0f;
constexpr float transform[] = {1.f, 0.f, dummy, dummy, 0.f, 1.f, dummy, dummy};
wgpu::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform),
wgpu::BufferUsage::Uniform);
wgpu::SamplerDescriptor samplerDescriptor = {};
samplerDescriptor.minFilter = wgpu::FilterMode::Nearest;
samplerDescriptor.magFilter = wgpu::FilterMode::Nearest;
samplerDescriptor.mipmapFilter = wgpu::FilterMode::Nearest;
samplerDescriptor.addressModeU = wgpu::AddressMode::ClampToEdge;
samplerDescriptor.addressModeV = wgpu::AddressMode::ClampToEdge;
samplerDescriptor.addressModeW = wgpu::AddressMode::ClampToEdge;
wgpu::Sampler sampler = device.CreateSampler(&samplerDescriptor);
wgpu::TextureDescriptor descriptor;
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = kRTSize;
descriptor.size.height = kRTSize;
descriptor.size.depth = 1;
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureView textureView = texture.CreateView();
uint32_t width = kRTSize, height = kRTSize;
uint32_t widthInBytes = width * sizeof(RGBA8);
widthInBytes = (widthInBytes + 255) & ~255;
uint32_t sizeInBytes = widthInBytes * height;
uint32_t size = sizeInBytes / sizeof(RGBA8);
std::vector<RGBA8> data = std::vector<RGBA8>(size);
for (uint32_t i = 0; i < size; i++) {
data[i] = RGBA8(0, 255, 0, 255);
}
wgpu::Buffer stagingBuffer =
utils::CreateBufferFromData(device, data.data(), sizeInBytes, wgpu::BufferUsage::CopySrc);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{{0, buffer, 0, sizeof(transform)}, {1, sampler}, {2, textureView}});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(stagingBuffer, 0, widthInBytes);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {width, height, 1};
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
RGBA8 filled(0, 255, 0, 255);
RGBA8 notFilled(0, 0, 0, 0);
uint32_t min = 1, max = kRTSize - 3;
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, max, max);
}
TEST_P(BindGroupTests, MultipleBindLayouts) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
wgpu::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
layout (set = 0, binding = 0) uniform vertexUniformBuffer1 {
mat2 transform1;
};
layout (set = 1, binding = 0) uniform vertexUniformBuffer2 {
mat2 transform2;
};
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.f, 1.f), vec2(1.f, 1.f), vec2(-1.f, -1.f));
gl_Position = vec4((transform1 + transform2) * pos[gl_VertexIndex], 0.f, 1.f);
})");
wgpu::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 0, binding = 1) uniform fragmentUniformBuffer1 {
vec4 color1;
};
layout (set = 1, binding = 1) uniform fragmentUniformBuffer2 {
vec4 color2;
};
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = color1 + color2;
})");
utils::ComboRenderPipelineDescriptor textureDescriptor(device);
textureDescriptor.vertexStage.module = vsModule;
textureDescriptor.cFragmentStage.module = fsModule;
textureDescriptor.cColorStates[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&textureDescriptor);
struct Data {
float transform[8];
char padding[256 - 8 * sizeof(float)];
float color[4];
};
ASSERT(offsetof(Data, color) == 256);
std::vector<Data> data;
std::vector<wgpu::Buffer> buffers;
std::vector<wgpu::BindGroup> bindGroups;
data.push_back(
{{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, {0}, {0.0f, 1.0f, 0.0f, 1.0f}});
data.push_back(
{{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}, {0}, {1.0f, 0.0f, 0.0f, 1.0f}});
for (int i = 0; i < 2; i++) {
wgpu::Buffer buffer =
utils::CreateBufferFromData(device, &data[i], sizeof(Data), wgpu::BufferUsage::Uniform);
buffers.push_back(buffer);
bindGroups.push_back(utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{{0, buffers[i], 0, sizeof(Data::transform)},
{1, buffers[i], 256, sizeof(Data::color)}}));
}
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroups[0]);
pass.SetBindGroup(1, bindGroups[1]);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
RGBA8 filled(255, 255, 0, 255);
RGBA8 notFilled(0, 0, 0, 0);
uint32_t min = 1, max = kRTSize - 3;
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, max, max);
}
// This test reproduces an out-of-bound bug on D3D12 backends when calling draw command twice with
// one pipeline that has 4 bind group sets in one render pass.
TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer}});
wgpu::RenderPipeline pipeline =
MakeTestPipeline(renderPass,
{wgpu::BindingType::UniformBuffer, wgpu::BindingType::UniformBuffer,
wgpu::BindingType::UniformBuffer, wgpu::BindingType::UniformBuffer},
{layout, layout, layout, layout});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline);
// The color will be added 8 times, so the value should be 0.125. But we choose 0.126
// because of precision issues on some devices (for example NVIDIA bots).
std::array<float, 4> color = {0.126, 0, 0, 0.126};
wgpu::Buffer uniformBuffer =
utils::CreateBufferFromData(device, &color, sizeof(color), wgpu::BufferUsage::Uniform);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, layout, {{0, uniformBuffer, 0, sizeof(color)}});
pass.SetBindGroup(0, bindGroup);
pass.SetBindGroup(1, bindGroup);
pass.SetBindGroup(2, bindGroup);
pass.SetBindGroup(3, bindGroup);
pass.Draw(3);
pass.SetPipeline(pipeline);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
RGBA8 filled(255, 0, 0, 255);
RGBA8 notFilled(0, 0, 0, 0);
uint32_t min = 1, max = kRTSize - 3;
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, max, max);
}
// Test that bind groups can be set before the pipeline.
TEST_P(BindGroupTests, SetBindGroupBeforePipeline) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
// Create a bind group layout which uses a single uniform buffer.
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer}});
// Create a pipeline that uses the uniform bind group layout.
wgpu::RenderPipeline pipeline =
MakeTestPipeline(renderPass, {wgpu::BindingType::UniformBuffer}, {layout});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
// Create a bind group with a uniform buffer and fill it with RGBAunorm(1, 0, 0, 1).
std::array<float, 4> color = {1, 0, 0, 1};
wgpu::Buffer uniformBuffer =
utils::CreateBufferFromData(device, &color, sizeof(color), wgpu::BufferUsage::Uniform);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, layout, {{0, uniformBuffer, 0, sizeof(color)}});
// Set the bind group, then the pipeline, and draw.
pass.SetBindGroup(0, bindGroup);
pass.SetPipeline(pipeline);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
// The result should be red.
RGBA8 filled(255, 0, 0, 255);
RGBA8 notFilled(0, 0, 0, 0);
uint32_t min = 1, max = kRTSize - 3;
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, max, max);
}
// Test that dynamic bind groups can be set before the pipeline.
TEST_P(BindGroupTests, SetDynamicBindGroupBeforePipeline) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
// Create a bind group layout which uses a single dynamic uniform buffer.
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer, true}});
// Create a pipeline that uses the dynamic uniform bind group layout for two bind groups.
wgpu::RenderPipeline pipeline = MakeTestPipeline(
renderPass, {wgpu::BindingType::UniformBuffer, wgpu::BindingType::UniformBuffer},
{layout, layout});
// Prepare data RGBAunorm(1, 0, 0, 0.5) and RGBAunorm(0, 1, 0, 0.5). They will be added in the
// shader.
std::array<float, 4> color0 = {1, 0, 0, 0.501};
std::array<float, 4> color1 = {0, 1, 0, 0.501};
size_t color1Offset = Align(sizeof(color0), kMinDynamicBufferOffsetAlignment);
std::vector<uint8_t> data(color1Offset + sizeof(color1));
memcpy(data.data(), color0.data(), sizeof(color0));
memcpy(data.data() + color1Offset, color1.data(), sizeof(color1));
// Create a bind group and uniform buffer with the color data. It will be bound at the offset
// to each color.
wgpu::Buffer uniformBuffer =
utils::CreateBufferFromData(device, data.data(), data.size(), wgpu::BufferUsage::Uniform);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, layout, {{0, uniformBuffer, 0, 4 * sizeof(float)}});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
// Set the first dynamic bind group.
uint32_t dynamicOffset = 0;
pass.SetBindGroup(0, bindGroup, 1, &dynamicOffset);
// Set the second dynamic bind group.
dynamicOffset = color1Offset;
pass.SetBindGroup(1, bindGroup, 1, &dynamicOffset);
// Set the pipeline and draw.
pass.SetPipeline(pipeline);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
// The result should be RGBAunorm(1, 0, 0, 0.5) + RGBAunorm(0, 1, 0, 0.5)
RGBA8 filled(255, 255, 0, 255);
RGBA8 notFilled(0, 0, 0, 0);
uint32_t min = 1, max = kRTSize - 3;
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, max, max);
}
// Test that bind groups set for one pipeline are still set when the pipeline changes.
TEST_P(BindGroupTests, BindGroupsPersistAfterPipelineChange) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
// Create a bind group layout which uses a single dynamic uniform buffer.
wgpu::BindGroupLayout uniformLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer, true}});
// Create a bind group layout which uses a single dynamic storage buffer.
wgpu::BindGroupLayout storageLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::StorageBuffer, true}});
// Create a pipeline which uses the uniform buffer and storage buffer bind groups.
wgpu::RenderPipeline pipeline0 = MakeTestPipeline(
renderPass, {wgpu::BindingType::UniformBuffer, wgpu::BindingType::StorageBuffer},
{uniformLayout, storageLayout});
// Create a pipeline which uses the uniform buffer bind group twice.
wgpu::RenderPipeline pipeline1 = MakeTestPipeline(
renderPass, {wgpu::BindingType::UniformBuffer, wgpu::BindingType::UniformBuffer},
{uniformLayout, uniformLayout});
// Prepare data RGBAunorm(1, 0, 0, 0.5) and RGBAunorm(0, 1, 0, 0.5). They will be added in the
// shader.
std::array<float, 4> color0 = {1, 0, 0, 0.5};
std::array<float, 4> color1 = {0, 1, 0, 0.5};
size_t color1Offset = Align(sizeof(color0), kMinDynamicBufferOffsetAlignment);
std::vector<uint8_t> data(color1Offset + sizeof(color1));
memcpy(data.data(), color0.data(), sizeof(color0));
memcpy(data.data() + color1Offset, color1.data(), sizeof(color1));
// Create a bind group and uniform buffer with the color data. It will be bound at the offset
// to each color.
wgpu::Buffer uniformBuffer =
utils::CreateBufferFromData(device, data.data(), data.size(), wgpu::BufferUsage::Uniform);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, uniformLayout, {{0, uniformBuffer, 0, 4 * sizeof(float)}});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
// Set the first pipeline (uniform, storage).
pass.SetPipeline(pipeline0);
// Set the first bind group at a dynamic offset.
// This bind group matches the slot in the pipeline layout.
uint32_t dynamicOffset = 0;
pass.SetBindGroup(0, bindGroup, 1, &dynamicOffset);
// Set the second bind group at a dynamic offset.
// This bind group does not match the slot in the pipeline layout.
dynamicOffset = color1Offset;
pass.SetBindGroup(1, bindGroup, 1, &dynamicOffset);
// Set the second pipeline (uniform, uniform).
// Both bind groups match the pipeline.
// They should persist and not need to be bound again.
pass.SetPipeline(pipeline1);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
// The result should be RGBAunorm(1, 0, 0, 0.5) + RGBAunorm(0, 1, 0, 0.5)
RGBA8 filled(255, 255, 0, 255);
RGBA8 notFilled(0, 0, 0, 0);
uint32_t min = 1, max = kRTSize - 3;
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, max, max);
}
// Do a successful draw. Then, change the pipeline and one bind group.
// Draw to check that the all bind groups are set.
TEST_P(BindGroupTests, DrawThenChangePipelineAndBindGroup) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
// Create a bind group layout which uses a single dynamic uniform buffer.
wgpu::BindGroupLayout uniformLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer, true}});
// Create a bind group layout which uses a single dynamic storage buffer.
wgpu::BindGroupLayout storageLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::StorageBuffer, true}});
// Create a pipeline with pipeline layout (uniform, uniform, storage).
wgpu::RenderPipeline pipeline0 =
MakeTestPipeline(renderPass,
{wgpu::BindingType::UniformBuffer, wgpu::BindingType::UniformBuffer,
wgpu::BindingType::StorageBuffer},
{uniformLayout, uniformLayout, storageLayout});
// Create a pipeline with pipeline layout (uniform, storage, storage).
wgpu::RenderPipeline pipeline1 =
MakeTestPipeline(renderPass,
{wgpu::BindingType::UniformBuffer, wgpu::BindingType::StorageBuffer,
wgpu::BindingType::StorageBuffer},
{uniformLayout, storageLayout, storageLayout});
// Prepare color data.
// The first draw will use { color0, color1, color2 }.
// The second draw will use { color0, color3, color2 }.
// The pipeline uses additive color and alpha blending so the result of two draws should be
// { 2 * color0 + color1 + 2 * color2 + color3} = RGBAunorm(1, 1, 1, 1)
std::array<float, 4> color0 = {0.501, 0, 0, 0};
std::array<float, 4> color1 = {0, 1, 0, 0};
std::array<float, 4> color2 = {0, 0, 0, 0.501};
std::array<float, 4> color3 = {0, 0, 1, 0};
size_t color1Offset = Align(sizeof(color0), kMinDynamicBufferOffsetAlignment);
size_t color2Offset = Align(color1Offset + sizeof(color1), kMinDynamicBufferOffsetAlignment);
size_t color3Offset = Align(color2Offset + sizeof(color2), kMinDynamicBufferOffsetAlignment);
std::vector<uint8_t> data(color3Offset + sizeof(color3), 0);
memcpy(data.data(), color0.data(), sizeof(color0));
memcpy(data.data() + color1Offset, color1.data(), sizeof(color1));
memcpy(data.data() + color2Offset, color2.data(), sizeof(color2));
memcpy(data.data() + color3Offset, color3.data(), sizeof(color3));
// Create a uniform and storage buffer bind groups to bind the color data.
wgpu::Buffer uniformBuffer =
utils::CreateBufferFromData(device, data.data(), data.size(), wgpu::BufferUsage::Uniform);
wgpu::Buffer storageBuffer =
utils::CreateBufferFromData(device, data.data(), data.size(), wgpu::BufferUsage::Storage);
wgpu::BindGroup uniformBindGroup =
utils::MakeBindGroup(device, uniformLayout, {{0, uniformBuffer, 0, 4 * sizeof(float)}});
wgpu::BindGroup storageBindGroup =
utils::MakeBindGroup(device, storageLayout, {{0, storageBuffer, 0, 4 * sizeof(float)}});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
// Set the pipeline to (uniform, uniform, storage)
pass.SetPipeline(pipeline0);
// Set the first bind group to color0 in the dynamic uniform buffer.
uint32_t dynamicOffset = 0;
pass.SetBindGroup(0, uniformBindGroup, 1, &dynamicOffset);
// Set the first bind group to color1 in the dynamic uniform buffer.
dynamicOffset = color1Offset;
pass.SetBindGroup(1, uniformBindGroup, 1, &dynamicOffset);
// Set the first bind group to color2 in the dynamic storage buffer.
dynamicOffset = color2Offset;
pass.SetBindGroup(2, storageBindGroup, 1, &dynamicOffset);
pass.Draw(3);
// Set the pipeline to (uniform, storage, storage)
// - The first bind group should persist (inherited on some backends)
// - The second bind group needs to be set again to pass validation.
// It changed from uniform to storage.
// - The third bind group should persist. It should be set again by the backend internally.
pass.SetPipeline(pipeline1);
// Set the second bind group to color3 in the dynamic storage buffer.
dynamicOffset = color3Offset;
pass.SetBindGroup(1, storageBindGroup, 1, &dynamicOffset);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
RGBA8 filled(255, 255, 255, 255);
RGBA8 notFilled(0, 0, 0, 0);
uint32_t min = 1, max = kRTSize - 3;
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
EXPECT_PIXEL_RGBA8_EQ(notFilled, renderPass.color, max, max);
}
// Regression test for crbug.com/dawn/408 where dynamic offsets were applied in the wrong order.
// Dynamic offsets should be applied in increasing order of binding number.
TEST_P(BindGroupTests, DynamicOffsetOrder) {
// We will put the following values and the respective offsets into a buffer.
// The test will ensure that the correct dynamic offset is applied to each buffer by reading the
// value from an offset binding.
std::array<uint32_t, 3> offsets = {3 * kMinDynamicBufferOffsetAlignment,
1 * kMinDynamicBufferOffsetAlignment,
2 * kMinDynamicBufferOffsetAlignment};
std::array<uint32_t, 3> values = {21, 67, 32};
// Create three buffers large enough to by offset by the largest offset.
wgpu::BufferDescriptor bufferDescriptor;
bufferDescriptor.size = 3 * kMinDynamicBufferOffsetAlignment + sizeof(uint32_t);
bufferDescriptor.usage = wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopyDst;
wgpu::Buffer buffer0 = device.CreateBuffer(&bufferDescriptor);
wgpu::Buffer buffer3 = device.CreateBuffer(&bufferDescriptor);
// This test uses both storage and uniform buffers to ensure buffer bindings are sorted first by
// binding number before type.
bufferDescriptor.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst;
wgpu::Buffer buffer2 = device.CreateBuffer(&bufferDescriptor);
// Populate the values
queue.WriteBuffer(buffer0, offsets[0], &values[0], sizeof(uint32_t));
queue.WriteBuffer(buffer2, offsets[1], &values[1], sizeof(uint32_t));
queue.WriteBuffer(buffer3, offsets[2], &values[2], sizeof(uint32_t));
wgpu::Buffer outputBuffer = utils::CreateBufferFromData(
device, wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::Storage, {0, 0, 0});
// Create the bind group and bind group layout.
// Note: The order of the binding numbers are intentionally different and not in increasing
// order.
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {
{3, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageBuffer, true},
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageBuffer, true},
{2, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer, true},
{4, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer},
});
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, bgl,
{
{0, buffer0, 0, sizeof(uint32_t)},
{3, buffer3, 0, sizeof(uint32_t)},
{2, buffer2, 0, sizeof(uint32_t)},
{4, outputBuffer, 0, 3 * sizeof(uint32_t)},
});
wgpu::ComputePipelineDescriptor pipelineDescriptor;
pipelineDescriptor.computeStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
layout(std140, set = 0, binding = 2) uniform Buffer2 {
uint value2;
};
layout(std430, set = 0, binding = 3) readonly buffer Buffer3 {
uint value3;
};
layout(std430, set = 0, binding = 0) readonly buffer Buffer0 {
uint value0;
};
layout(std430, set = 0, binding = 4) buffer OutputBuffer {
uvec3 outputBuffer;
};
void main() {
outputBuffer = uvec3(value0, value2, value3);
}
)");
pipelineDescriptor.computeStage.entryPoint = "main";
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDescriptor);
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder computePassEncoder = commandEncoder.BeginComputePass();
computePassEncoder.SetPipeline(pipeline);
computePassEncoder.SetBindGroup(0, bindGroup, offsets.size(), offsets.data());
computePassEncoder.Dispatch(1);
computePassEncoder.EndPass();
wgpu::CommandBuffer commands = commandEncoder.Finish();
queue.Submit(1, &commands);
EXPECT_BUFFER_U32_RANGE_EQ(values.data(), outputBuffer, 0, values.size());
}
// Test that visibility of bindings in BindGroupLayout can be none
// This test passes by not asserting or crashing.
TEST_P(BindGroupTests, BindGroupLayoutVisibilityCanBeNone) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
wgpu::BindGroupLayoutEntry entry = {0, wgpu::ShaderStage::None,
wgpu::BindingType::UniformBuffer};
wgpu::BindGroupLayoutDescriptor descriptor;
descriptor.entryCount = 1;
descriptor.entries = &entry;
wgpu::BindGroupLayout layout = device.CreateBindGroupLayout(&descriptor);
wgpu::RenderPipeline pipeline = MakeTestPipeline(renderPass, {}, {layout});
std::array<float, 4> color = {1, 0, 0, 1};
wgpu::Buffer uniformBuffer =
utils::CreateBufferFromData(device, &color, sizeof(color), wgpu::BufferUsage::Uniform);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, layout, {{0, uniformBuffer, 0, sizeof(color)}});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
}
// Regression test for crbug.com/dawn/448 that dynamic buffer bindings can have None visibility.
TEST_P(BindGroupTests, DynamicBindingNoneVisibility) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
wgpu::BindGroupLayoutEntry entry = {0, wgpu::ShaderStage::None,
wgpu::BindingType::UniformBuffer, true};
wgpu::BindGroupLayoutDescriptor descriptor;
descriptor.entryCount = 1;
descriptor.entries = &entry;
wgpu::BindGroupLayout layout = device.CreateBindGroupLayout(&descriptor);
wgpu::RenderPipeline pipeline = MakeTestPipeline(renderPass, {}, {layout});
std::array<float, 4> color = {1, 0, 0, 1};
wgpu::Buffer uniformBuffer =
utils::CreateBufferFromData(device, &color, sizeof(color), wgpu::BufferUsage::Uniform);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, layout, {{0, uniformBuffer, 0, sizeof(color)}});
uint32_t dynamicOffset = 0;
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup, 1, &dynamicOffset);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
}
// Test that bind group bindings may have unbounded and arbitrary binding numbers
TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
wgpu::ShaderModule vsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.f, 1.f), vec2(1.f, 1.f), vec2(-1.f, -1.f));
gl_Position = vec4(pos[gl_VertexIndex], 0.f, 1.f);
})");
wgpu::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout (set = 0, binding = 953) uniform ubo1 {
vec4 color1;
};
layout (set = 0, binding = 47) uniform ubo2 {
vec4 color2;
};
layout (set = 0, binding = 111) uniform ubo3 {
vec4 color3;
};
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = color1 + 2 * color2 + 4 * color3;
})");
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.vertexStage.module = vsModule;
pipelineDescriptor.cFragmentStage.module = fsModule;
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&pipelineDescriptor);
wgpu::Buffer black =
utils::CreateBufferFromData(device, wgpu::BufferUsage::Uniform, {0.f, 0.f, 0.f, 0.f});
wgpu::Buffer red =
utils::CreateBufferFromData(device, wgpu::BufferUsage::Uniform, {0.251f, 0.0f, 0.0f, 0.0f});
wgpu::Buffer green =
utils::CreateBufferFromData(device, wgpu::BufferUsage::Uniform, {0.0f, 0.251f, 0.0f, 0.0f});
wgpu::Buffer blue =
utils::CreateBufferFromData(device, wgpu::BufferUsage::Uniform, {0.0f, 0.0f, 0.251f, 0.0f});
auto DoTest = [&](wgpu::Buffer color1, wgpu::Buffer color2, wgpu::Buffer color3, RGBA8 filled) {
auto DoTestInner = [&](wgpu::BindGroup bindGroup) {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup);
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, 1, 1);
};
utils::BindingInitializationHelper bindings[] = {
{953, color1, 0, 4 * sizeof(float)}, //
{47, color2, 0, 4 * sizeof(float)}, //
{111, color3, 0, 4 * sizeof(float)}, //
};
// Should work regardless of what order the bindings are specified in.
DoTestInner(utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{bindings[0], bindings[1], bindings[2]}));
DoTestInner(utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{bindings[1], bindings[0], bindings[2]}));
DoTestInner(utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{bindings[2], bindings[0], bindings[1]}));
};
// first color is normal, second is 2x, third is 3x.
DoTest(black, black, black, RGBA8(0, 0, 0, 0));
// Check the first binding maps to the first slot. We know this because the colors are
// multiplied 1x.
DoTest(red, black, black, RGBA8(64, 0, 0, 0));
DoTest(green, black, black, RGBA8(0, 64, 0, 0));
DoTest(blue, black, black, RGBA8(0, 0, 64, 0));
// Use multiple bindings and check the second color maps to the second slot.
// We know this because the second slot is multiplied 2x.
DoTest(green, blue, black, RGBA8(0, 64, 128, 0));
DoTest(blue, green, black, RGBA8(0, 128, 64, 0));
DoTest(red, green, black, RGBA8(64, 128, 0, 0));
// Use multiple bindings and check the third color maps to the third slot.
// We know this because the third slot is multiplied 4x.
DoTest(black, blue, red, RGBA8(255, 0, 128, 0));
DoTest(blue, black, green, RGBA8(0, 255, 64, 0));
DoTest(red, black, blue, RGBA8(64, 0, 255, 0));
}
// This is a regression test for crbug.com/dawn/355 which tests that destruction of a bind group
// that holds the last reference to its bind group layout does not result in a use-after-free. In
// the bug, the destructor of BindGroupBase, when destroying member mLayout,
// Ref<BindGroupLayoutBase> assigns to Ref::mPointee, AFTER calling Release(). After the BGL is
// destroyed, the storage for |mPointee| has been freed.
TEST_P(BindGroupTests, LastReferenceToBindGroupLayout) {
wgpu::BufferDescriptor bufferDesc;
bufferDesc.size = sizeof(float);
bufferDesc.usage = wgpu::BufferUsage::Uniform;
wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc);
wgpu::BindGroup bg;
{
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Vertex, wgpu::BindingType::UniformBuffer}});
bg = utils::MakeBindGroup(device, bgl, {{0, buffer, 0, sizeof(float)}});
}
}
// Test that bind groups with an empty bind group layout may be created and used.
TEST_P(BindGroupTests, EmptyLayout) {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {});
wgpu::ComputePipelineDescriptor pipelineDesc;
pipelineDesc.layout = utils::MakeBasicPipelineLayout(device, &bgl);
pipelineDesc.computeStage.entryPoint = "main";
pipelineDesc.computeStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
void main() {
})");
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bg);
pass.Dispatch(1);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
}
// Test creating a BGL with a storage buffer binding but declared readonly in the shader works.
// This is a regression test for crbug.com/dawn/410 which tests that it can successfully compile and
// execute the shader.
TEST_P(BindGroupTests, ReadonlyStorage) {
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
pipelineDescriptor.vertexStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450
void main() {
const vec2 pos[3] = vec2[3](vec2(-1.f, 1.f), vec2(1.f, 1.f), vec2(-1.f, -1.f));
gl_Position = vec4(pos[gl_VertexIndex], 0.f, 1.f);
})");
pipelineDescriptor.cFragmentStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(set = 0, binding = 0) readonly buffer buffer0 {
vec4 color;
};
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = color;
})");
constexpr uint32_t kRTSize = 4;
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
pipelineDescriptor.cColorStates[0].format = renderPass.colorFormat;
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::StorageBuffer}});
pipelineDescriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
wgpu::RenderPipeline renderPipeline = device.CreateRenderPipeline(&pipelineDescriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
std::array<float, 4> greenColor = {0, 1, 0, 1};
wgpu::Buffer storageBuffer = utils::CreateBufferFromData(
device, &greenColor, sizeof(greenColor), wgpu::BufferUsage::Storage);
pass.SetPipeline(renderPipeline);
pass.SetBindGroup(0, utils::MakeBindGroup(device, bgl, {{0, storageBuffer}}));
pass.Draw(3);
pass.EndPass();
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0);
}
// Test that creating a large bind group, with each binding type at the max count, works and can be
// used correctly. The test loads a different value from each binding, and writes 1 to a storage
// buffer if all values are correct.
TEST_P(BindGroupTests, ReallyLargeBindGroup) {
DAWN_SKIP_TEST_IF(IsOpenGLES());
std::string interface = "#version 450\n";
std::string body;
uint32_t binding = 0;
uint32_t expectedValue = 42;
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
auto CreateTextureWithRedData = [&](uint32_t value, wgpu::TextureUsage usage) {
wgpu::TextureDescriptor textureDesc = {};
textureDesc.usage = wgpu::TextureUsage::CopyDst | usage;
textureDesc.size = {1, 1, 1};
textureDesc.format = wgpu::TextureFormat::R32Uint;
wgpu::Texture texture = device.CreateTexture(&textureDesc);
wgpu::Buffer textureData =
utils::CreateBufferFromData(device, wgpu::BufferUsage::CopySrc, {expectedValue});
wgpu::BufferCopyView bufferCopyView = {};
bufferCopyView.buffer = textureData;
bufferCopyView.layout.bytesPerRow = 256;
wgpu::TextureCopyView textureCopyView = {};
textureCopyView.texture = texture;
wgpu::Extent3D copySize = {1, 1, 1};
commandEncoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
return texture;
};
std::vector<wgpu::BindGroupEntry> bgEntries;
static_assert(kMaxSampledTexturesPerShaderStage == kMaxSamplersPerShaderStage,
"Please update this test");
body += "result = 0;\n";
for (uint32_t i = 0; i < kMaxSampledTexturesPerShaderStage; ++i) {
wgpu::Texture texture =
CreateTextureWithRedData(expectedValue, wgpu::TextureUsage::Sampled);
bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()});
interface += "layout(set = 0, binding = " + std::to_string(binding++) +
") uniform utexture2D tex" + std::to_string(i) + ";\n";
wgpu::SamplerDescriptor samplerDesc = {};
bgEntries.push_back({binding, nullptr, 0, 0, device.CreateSampler(&samplerDesc), nullptr});
interface += "layout(set = 0, binding = " + std::to_string(binding++) +
") uniform sampler samp" + std::to_string(i) + ";\n";
body += "if (texelFetch(usampler2D(tex" + std::to_string(i) + ", samp" + std::to_string(i) +
"), ivec2(0, 0), 0).r != " + std::to_string(expectedValue++) + ") {\n";
body += " return;\n";
body += "}\n";
}
for (uint32_t i = 0; i < kMaxStorageTexturesPerShaderStage; ++i) {
wgpu::Texture texture =
CreateTextureWithRedData(expectedValue, wgpu::TextureUsage::Storage);
bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()});
interface += "layout(set = 0, binding = " + std::to_string(binding++) +
", r32ui) uniform readonly uimage2D image" + std::to_string(i) + ";\n";
body += "if (imageLoad(image" + std::to_string(i) +
", ivec2(0, 0)).r != " + std::to_string(expectedValue++) + ") {\n";
body += " return;\n";
body += "}\n";
}
for (uint32_t i = 0; i < kMaxUniformBuffersPerShaderStage; ++i) {
wgpu::Buffer buffer = utils::CreateBufferFromData<uint32_t>(
device, wgpu::BufferUsage::Uniform, {expectedValue, 0, 0, 0});
bgEntries.push_back({binding, buffer, 0, 4 * sizeof(uint32_t), nullptr, nullptr});
interface += "layout(std140, set = 0, binding = " + std::to_string(binding++) +
") uniform UBuf" + std::to_string(i) + " {\n";
interface += " uint ubuf" + std::to_string(i) + ";\n";
interface += "};\n";
body += "if (ubuf" + std::to_string(i) + " != " + std::to_string(expectedValue++) + ") {\n";
body += " return;\n";
body += "}\n";
}
// Save one storage buffer for writing the result
for (uint32_t i = 0; i < kMaxStorageBuffersPerShaderStage - 1; ++i) {
wgpu::Buffer buffer = utils::CreateBufferFromData<uint32_t>(
device, wgpu::BufferUsage::Storage, {expectedValue});
bgEntries.push_back({binding, buffer, 0, sizeof(uint32_t), nullptr, nullptr});
interface += "layout(std430, set = 0, binding = " + std::to_string(binding++) +
") readonly buffer SBuf" + std::to_string(i) + " {\n";
interface += " uint sbuf" + std::to_string(i) + ";\n";
interface += "};\n";
body += "if (sbuf" + std::to_string(i) + " != " + std::to_string(expectedValue++) + ") {\n";
body += " return;\n";
body += "}\n";
}
wgpu::Buffer result = utils::CreateBufferFromData<uint32_t>(
device, wgpu::BufferUsage::Storage | wgpu::BufferUsage::CopySrc, {0});
bgEntries.push_back({binding, result, 0, sizeof(uint32_t), nullptr, nullptr});
interface += "layout(std430, set = 0, binding = " + std::to_string(binding++) +
") writeonly buffer Result {\n";
interface += " uint result;\n";
interface += "};\n";
body += "result = 1;\n";
std::string shader = interface + "void main() {\n" + body + "}\n";
wgpu::ComputePipelineDescriptor cpDesc;
cpDesc.computeStage.module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, shader.c_str());
cpDesc.computeStage.entryPoint = "main";
wgpu::ComputePipeline cp = device.CreateComputePipeline(&cpDesc);
wgpu::BindGroupDescriptor bgDesc = {};
bgDesc.layout = cp.GetBindGroupLayout(0);
bgDesc.entryCount = static_cast<uint32_t>(bgEntries.size());
bgDesc.entries = bgEntries.data();
wgpu::BindGroup bg = device.CreateBindGroup(&bgDesc);
wgpu::ComputePassEncoder pass = commandEncoder.BeginComputePass();
pass.SetPipeline(cp);
pass.SetBindGroup(0, bg);
pass.Dispatch(1, 1, 1);
pass.EndPass();
wgpu::CommandBuffer commands = commandEncoder.Finish();
queue.Submit(1, &commands);
EXPECT_BUFFER_U32_EQ(1, result, 0);
}
DAWN_INSTANTIATE_TEST(BindGroupTests,
D3D12Backend(),
MetalBackend(),
OpenGLBackend(),
OpenGLESBackend(),
VulkanBackend());
| [
"[email protected]"
] | |
0868bdeecbd04165908c1f2060cbcad5282f272a | d657e6161bb4b4c603d1deba4e0bcd871eb9031c | /matlab_code/jjcao_code-head/toolbox/jjcao_mesh/geodesic/mex/gw/gw_core/GW_VertexIterator.cpp | f69d75920ecc2d2c1c7b93e84f8b4e5341d97786 | [
"MIT"
] | permissive | joycewangsy/normals_pointnet | 84c508b7b5f96cb0c8fdbfd1d5a2bcac4e68772a | fc74a8ed1a009b18785990b1b4c20eda0549721c | refs/heads/main | 2023-01-05T23:12:30.500115 | 2020-11-09T12:29:56 | 2020-11-09T12:29:56 | 311,324,467 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,907 | cpp | /*------------------------------------------------------------------------------*/
/**
* \file GW_VertexIterator.cpp
* \brief Definition of class \c GW_VertexIterator
* \author Gabriel Peyr?
* \date 4-2-2003
*/
/*------------------------------------------------------------------------------*/
#ifdef GW_SCCSID
static const char* sccsid = "@(#) GW_VertexIterator.cpp(c) Gabriel Peyr?003";
#endif // GW_SCCSID
#include "stdafx.h"
#include "GW_VertexIterator.h"
#include "GW_Face.h"
using namespace GW;
GW_VertexIterator::GW_VertexIterator( GW_Face* pFace, GW_Vertex* pOrigin, GW_Vertex* pDirection, GW_Face* pPrevFace, GW_U32 nNbrIncrement )
: pFace_ ( pFace),
pOrigin_ ( pOrigin ),
pDirection_ ( pDirection ),
pPrevFace_ ( pPrevFace ),
nNbrIncrement_ ( nNbrIncrement )
{ }
/* assignement */
GW_VertexIterator& GW_VertexIterator::operator=( const GW_VertexIterator& it)
{
this->pFace_ = it.pFace_;
this->pOrigin_ = it.pOrigin_;
this->pDirection_ = it.pDirection_;
this->pPrevFace_ = it.pPrevFace_;
this->nNbrIncrement_= it.nNbrIncrement_;
return *this;
}
/* egality */
GW_Bool GW_VertexIterator::operator==( const GW_VertexIterator& it)
{
return (this->pFace_==it.pFace_)
&& (this->pOrigin_==it.pOrigin_)
&& (this->pDirection_==it.pDirection_)
&& (this->pPrevFace_==it.pPrevFace_);
}
/* egality */
GW_Bool GW_VertexIterator::operator!=( const GW_VertexIterator& it)
{
return (this->pFace_!=it.pFace_)
|| (this->pOrigin_!=it.pOrigin_)
|| (this->pDirection_!=it.pDirection_)
|| (this->pPrevFace_!=it.pPrevFace_);
}
/* egality */
GW_Vertex* GW_VertexIterator::operator*( )
{
return this->pDirection_;
}
/* progression : \todo take in acount NULL pointer */
void GW_VertexIterator::operator++()
{
if( this->nNbrIncrement_>100 )
{
GW_ASSERT( GW_False );
(*this) = GW_VertexIterator(NULL,NULL,NULL,NULL);
return;
}
if( pFace_==NULL && pOrigin_!=NULL )
{
GW_ASSERT(pDirection_!=NULL);
/* we are on a border face : Rewind on the first face */
while( pPrevFace_!=NULL )
{
pFace_ = pPrevFace_;
pPrevFace_ = pPrevFace_->GetFaceNeighbor( *pDirection_ );
pDirection_ = pFace_->GetVertex( *pOrigin_, *pDirection_ );
}
if( pFace_==pOrigin_->GetFace() )
{
// we are on End.
(*this) = GW_VertexIterator(NULL,NULL,NULL,NULL);
}
else
{
(*this) = GW_VertexIterator( pFace_, pOrigin_, pDirection_, pPrevFace_, nNbrIncrement_+1 );
}
return;
}
if( pFace_!=NULL && pDirection_!=NULL && pOrigin_!=NULL )
{
GW_Face* pNextFace = pFace_->GetFaceNeighbor( *pDirection_ );
/* check for end() */
if( pNextFace==pOrigin_->GetFace() )
{
(*this) = GW_VertexIterator(NULL,NULL,NULL,NULL);
}
else
{
GW_Vertex* pNextDirection = pFace_->GetVertex( *pOrigin_, *pDirection_ );
GW_ASSERT( pNextDirection!=NULL );
/* RMK : pNextFace can be NULL in case of a border edge */
(*this) = GW_VertexIterator( pNextFace, pOrigin_, pNextDirection, pFace_, nNbrIncrement_+1 );
}
}
else
{
(*this) = GW_VertexIterator(NULL,NULL,NULL,NULL);
}
}
/*------------------------------------------------------------------------------*/
// Name : GW_VertexIterator::GetLeftFace
/**
* \return [GW_Face*] Can be NULL.
* \author Gabriel Peyr?
* \date 4-3-2003
*
* Get the face in the left of the current edge.
*/
/*------------------------------------------------------------------------------*/
GW_Face* GW_VertexIterator::GetLeftFace()
{
if( pDirection_==NULL )
return NULL;
if( pPrevFace_!=NULL )
{
/* we must use prev-face because we can be on a border vertex. */
return pPrevFace_;;
}
else
{
GW_ASSERT( pFace_!=NULL );
GW_ASSERT( pOrigin_!=NULL );
return pFace_->GetFaceNeighbor( *pDirection_,*pOrigin_ );
}
}
/*------------------------------------------------------------------------------*/
// Name : GW_VertexIterator::GetRightFace
/**
* \return [GW_Face*] Can be NULL.
* \author Gabriel Peyr?
* \date 4-3-2003
*
* Get the face in the right of the current edge.
*/
/*------------------------------------------------------------------------------*/
GW_Face* GW_VertexIterator::GetRightFace()
{
return pFace_;
}
/*------------------------------------------------------------------------------*/
// Name : GW_VertexIterator::GetRightVertex
/**
* \return [GW_Vertex*] Can be NULL
* \author Gabriel Peyr?
* \date 4-3-2003
*
* Get the vertex just after.
*/
/*------------------------------------------------------------------------------*/
GW_Vertex* GW_VertexIterator::GetRightVertex()
{
if( pDirection_==NULL )
return NULL;
if( pFace_==NULL )
{
return NULL;
}
else
{
GW_ASSERT( pOrigin_!=NULL );
return pFace_->GetVertex( *pDirection_,*pOrigin_ );
}
}
/*------------------------------------------------------------------------------*/
// Name : GW_VertexIterator::GetLeftVertex
/**
* \return [GW_Vertex*] Can be NULL
* \author Gabriel Peyr?
* \date 4-3-2003
*
* Get the vertex just before.
*/
/*------------------------------------------------------------------------------*/
GW_Vertex* GW_VertexIterator::GetLeftVertex()
{
if( pDirection_==NULL )
return NULL;
if( pPrevFace_!=NULL )
{
/* we must use prev-face because we can be on a border vertex. */
GW_ASSERT( pOrigin_!=NULL );
return pPrevFace_->GetVertex( *pDirection_,*pOrigin_ );
}
else
{
GW_ASSERT( pFace_!=NULL );
pPrevFace_ = pFace_->GetFaceNeighbor( *pDirection_,*pOrigin_ );
if( pPrevFace_!=NULL )
return pPrevFace_->GetVertex( *pDirection_,*pOrigin_ );
else
return NULL;
}
}
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) Gabriel Peyr?
///////////////////////////////////////////////////////////////////////////////
// END OF FILE //
///////////////////////////////////////////////////////////////////////////////
| [
"[email protected]"
] | |
61372001b15c0c3fbbda63a95653859205aef0a7 | c9e32374ecc46eac59437a068d424e6eb28ca849 | /xju/SafeTriggerPIf.hh | 4838bb85434c35ae9b5bff380c1668b1e9aee929 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | urnest/urnest | 261884b2ee71d64748c9e2afe7e78c9df61d91e7 | 6ec484080222f27a33070fa3b65593645f94a575 | refs/heads/master | 2023-07-13T06:16:41.566253 | 2023-07-06T11:04:34 | 2023-07-06T11:04:34 | 6,716,252 | 1 | 1 | MIT | 2023-06-11T03:06:14 | 2012-11-16T04:12:22 | C++ | UTF-8 | C++ | false | false | 1,781 | hh | // -*- mode: c++ ; c-file-style: "osse" ; -*-
//
// From code Copyright (c) 1997 Trevor Taylor with permission
// Copyright (c) 2003 Trevor Taylor
//
// Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all.
// Trevor Taylor makes no representations about the suitability of this
// software for any purpose. It is provided "as is" without express or
// implied warranty.
//
// Template for a "safe" trigger interface. This interface allows some
// capability of the implementor to be invoked, with a type-safe
// parameter. The invoked
// capability cannot throw any exceptions.
//
// (See also TriggerIf.hh)
//
#ifndef _XJU_SAFETRIGGERPIF_HH_
#define _XJU_SAFETRIGGERPIF_HH_
namespace xju
{
template<class T>
class SafeTriggerPIf
{
public:
virtual void trigger(T) throw() = 0;
virtual ~SafeTriggerPIf() {}
};
template<class T1, class T2>
class SafeTriggerP2If
{
public:
virtual void trigger(T1, T2) throw() = 0;
virtual ~SafeTriggerP2If() {}
};
template<class T1, class T2, class T3>
class SafeTriggerP3If
{
public:
virtual void trigger(T1, T2, T3) throw() = 0;
virtual ~SafeTriggerP3If() {}
};
template<class T1, class T2, class T3, class T4>
class SafeTriggerP4If
{
public:
virtual void trigger(T1, T2, T3, T4) throw() = 0;
virtual ~SafeTriggerP4If() {}
};
template<class T1, class T2, class T3, class T4, class T5>
class SafeTriggerP5If
{
public:
virtual void trigger(T1, T2, T3, T4, T5) throw() = 0;
virtual ~SafeTriggerP5If() {}
};
}
#endif
| [
"[email protected]"
] | |
474b5a2f7972c56092d6953f424b5172bcc0a59b | 6fc57553a02b485ad20c6e9a65679cd71fa0a35d | /zircon/system/ulib/blobfs/include/blobfs/unbuffered-operations-builder.h | a107d1d30dfa5623511f2e530eb9e5acb9bafe42 | [
"BSD-3-Clause",
"MIT"
] | permissive | OpenTrustGroup/fuchsia | 2c782ac264054de1a121005b4417d782591fb4d8 | 647e593ea661b8bf98dcad2096e20e8950b24a97 | refs/heads/master | 2023-01-23T08:12:32.214842 | 2019-08-03T20:27:06 | 2019-08-03T20:27:06 | 178,452,475 | 1 | 1 | BSD-3-Clause | 2023-01-05T00:43:10 | 2019-03-29T17:53:42 | C++ | UTF-8 | C++ | false | false | 1,610 | 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.
#pragma once
#ifndef __Fuchsia__
#error Fuchsia-only Header
#endif
#include <utility>
#include <blobfs/operation.h>
#include <fbl/macros.h>
#include <fbl/vector.h>
#include <lib/zx/vmo.h>
#include <zircon/assert.h>
#include <zircon/device/block.h>
namespace blobfs {
// A builder which helps clients collect and coalesce UnbufferedOperations which target the same
// in-memory / on-disk structures.
//
// This class is thread-compatible.
class UnbufferedOperationsBuilder {
public:
UnbufferedOperationsBuilder() : block_count_(0) {}
UnbufferedOperationsBuilder(const UnbufferedOperationsBuilder&) = delete;
UnbufferedOperationsBuilder& operator=(const UnbufferedOperationsBuilder&) = delete;
UnbufferedOperationsBuilder(UnbufferedOperationsBuilder&&) = default;
UnbufferedOperationsBuilder& operator=(UnbufferedOperationsBuilder&&) = default;
~UnbufferedOperationsBuilder();
// Returns the total number of blocks in all requests.
uint64_t BlockCount() const { return block_count_; }
// Adds a UnbufferedOperation to the list of requests.
//
// Empty requests are dropped.
void Add(const UnbufferedOperation& operation);
// Removes the vector of requests, and returns them to the caller.
// This resets the |UnbufferedOperationsBuilder| object.
fbl::Vector<UnbufferedOperation> TakeOperations();
private:
fbl::Vector<UnbufferedOperation> operations_;
uint64_t block_count_;
};
} // namespace blobfs
| [
"[email protected]"
] | |
da1a97e8dd37aaf0873e6cc3a1fccc93b02f4b72 | ebcd8839312e536580c0258aa2084244c328cc43 | /2020_Study/백준16964 BFS 스페셜 저지.cpp | bf57367fcdf78972b6581b86621a4fbee7a0b5f5 | [] | no_license | KimSeongHeon/Baekjoon_Online_Judge | 4f2e50d20e67712af4e9003518dcfd466f626d13 | 5e8e5c2d58f94c90907e6a0f123ddfceff55020f | refs/heads/master | 2022-09-05T09:28:30.327270 | 2020-05-28T12:38:20 | 2020-05-28T12:38:20 | 220,878,876 | 1 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 1,371 | cpp | #include<iostream>
#include<vector>
#include<memory.h>
#include<algorithm>
#include<queue>
using namespace std;
int n; //³ëµå °³¼ö
bool checked[100002];
int v_depth[100002];
int v_parent[100002];
int v_index[100002];
vector<int> edge[100002];
void dfs(int x, int depth, int parent) {
//cout << "dfs : " << x << " depth : " << depth << endl;
v_depth[x] = depth;
v_parent[x] = parent;
checked[x] = true;
for (int i = 0; i < edge[x].size(); i++) {
if (!checked[edge[x][i]]) {
dfs(edge[x][i], depth + 1, x);
}
}
}
int main() {
cin >> n;
for (int i = 0; i < n - 1; i++) {
int node1, node2;
cin >> node1 >> node2;
edge[node1].push_back(node2);
edge[node2].push_back(node1);
}
vector<int> sub;
for (int i = 0; i < n; i++) {
int element;
cin >> element;
sub.push_back(element);
v_index[element] = i + 1;
}
if (sub.front() != 1) { cout << 0; return 0; }
dfs(sub.front(), 0, 0);
v_parent[sub.front()] = 0;
v_index[0] = 0;
/*for (int i = 0; i < n; i++) {
cout << v_index[v_parent[sub[i]]] << endl;
}*/
for (int i = 1; i < sub.size(); i++) {
int previous = sub[i - 1];
int now = sub[i];
if (v_depth[previous] != v_depth[now] && v_depth[previous] + 1 != v_depth[now]) {
cout << 0;
return 0;
}
if (v_index[v_parent[now]] < v_index[v_parent[previous]]) {
cout << 0;
return 0;
}
}
cout << 1;
return 0;
} | [
"[email protected]"
] | |
e019e526b0e50752bc0eb6a621c76117f612941f | cff81ff659ad529706dc9ba1befbc68d8ae5ad26 | /hr_Leonardo's_Prime_Factors.cpp | 1fe2f1e7d0a4534752b677f8eb0f9038b7f6ee9b | [] | no_license | iishipatel/Competetive-Programming | 9dafb3e49e60daee0f7dfca7f88ea23fd0777507 | 2ece5d282e753aee38d503bc5102baffa0141b2f | refs/heads/master | 2020-08-05T23:03:48.027950 | 2019-10-08T12:02:27 | 2019-10-08T12:02:27 | 212,747,647 | 1 | 0 | null | 2019-10-04T06:12:08 | 2019-10-04T06:12:06 | null | UTF-8 | C++ | false | false | 621 | cpp | /*
Author : Abhinav
Modified : 17-12-2017 02:02:49 AM
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
const ll mod = 1e9+7;
vi pr;
int prime[16] ={2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
ll t,i,num;
vi pr;
i=1;
pr.emplace_back(2);
while(i<16){
pr.emplace_back(pr[i-1]*prime[i]);
i++;
}
cin >> t;
while(t-- > 0){
cin >> num;
i = 0;
while(pr[i] <= num && i<pr.size())
i++;
if(i == pr.size())
cout << "17\n";
else
cout << i << "\n";
}
return 0;
} | [
"[email protected]"
] | |
3a1ee66b704f8013131c072981d78f8f6c5e651c | e9e8064dd3848b85b65e871877c55f025628fb49 | /code/MapEngine/VOSBase/VOSCom.h | 494d669bfb3d0501930db5cb9bda27e35b8d6d5d | [] | no_license | xxh0078/gmapx | eb5ae8eefc2308b8ca3a07f575ee3a27b3e90d95 | e265ad90b302db7da05345e2467ec2587e501e90 | refs/heads/master | 2021-06-02T14:42:30.372998 | 2019-08-29T02:45:10 | 2019-08-29T02:45:10 | 12,397,909 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 364 | h | #pragma once
class CVOSCom
{
public:
CVOSCom(void);
public:
~CVOSCom(void);
HANDLE ReOpenCom();
HANDLE OpenCom( const char* lpszCom );
void CloseCom();
int Read(char* pBuf, unsigned long ulLen );
int Write(char* pBuf, unsigned long ulLen );
bool IsOpen();
private:
HANDLE m_hCom;
DCB m_DCBInfo;
COMMTIMEOUTS m_CommTimeouts;
char m_strName[6];
};
| [
"[email protected]"
] | |
9a8269fd08be51b45d5201e42c02ed0792aa407c | 3a07a9368564bc79dd4ab90570ee995bb922b68d | /source/montador.hpp | 6ff8b52ac8a8074906f470628c81a30c667dbe60 | [] | no_license | notopoloko/Trabalho-1-de-SB | 9df1f7c071963083b3d0465a081a8336c5eb4c35 | 699aecf2c1adf336984f00bc8ad77358994c10b6 | refs/heads/master | 2020-08-06T16:26:28.391455 | 2019-12-02T00:02:19 | 2019-12-02T00:02:19 | 213,073,451 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,608 | hpp | #include <fstream>
#include <iostream>
#include <iterator>
#include <string>
#include <map>
#include <sstream>
#include <vector>
/* Erros a serem detectados
– declarações e rótulos ausentes; Ok
– declarações e rótulos repetidos; Ok
– pulo para rótulos inválidos; ~
– pulo para seção errada; Ok
– diretivas inválidas; ~
– instruções inválidas; ~
– diretivas ou instruções na seção errada;
– divisão por zero (para constante); Ok
– instruções com a quantidade de operando inválida; Ok
– instruções com o tipo de operando inválido; ~
– tokens inválidos;
– dois rótulos na mesma linha; OK
– seção TEXT faltante; OK
– seção inválida;
– tipo de argumento inválido; ~
– modificação de um valor constante; Ok
– acessar posição não reservada pelo SPACE (exemplo accesar SPACE+4,
sendo que somente foi reservada uma posição) Ok
*/
class Montador
{
private:
const std::string fileName;
bool codeIsFineToGo = true;
bool isSecondArg = false; // Para uso esclusivo NAO modifique esse argumento
std::map <std::string, std::uint16_t> codes = {
{"ADD", 1},
{"SUB", 2},
{"MULT", 3},
{"DIV", 4},
{"JMP", 5},
{"JMPN", 6},
{"JMPP", 7},
{"JMPZ", 8},
{"COPY", 9},
{"LOAD", 10},
{"STORE", 11},
{"INPUT", 12},
{"OUTPUT", 13},
{"STOP", 14}
};
std::map < std::string, int > labels;
std::map < std::string, std::vector< std::uint16_t > > deps;
std::vector < std::int16_t > endCode;
std::map < std::uint16_t, std::string> instructionLines;
std::map < std::string, std::vector< int > > useTable;
std::map < std::string, std::vector< int > > defTable;
std::vector < uint8_t > relocable;
std::string programName;
std::string mountedCode;
void mountCode(const std::string &code);
void mountData(const std::string &data);
void dealInstruction (std::stringstream &instructionLine, std::string instruction, std::size_t ¤tPosition);
bool checkVar(std::string &var);
bool checkInst( std::uint16_t i, std::vector<std::string> &instructions);
std::size_t checkIfThereIsSum( std::string &variable, std::stringstream &instructionLine );
void showInstructions( const std::vector<std::uint16_t> &pos );
std::uint8_t countOcurrences ( std::string &s, const char &character );
public:
Montador();
~Montador();
std::string mount ( std::string fileName, bool isOneFile);
// std::string mountMultipleFiles(std::string fileName1, std::string fileName2);
};
| [
"[email protected]"
] | |
ef22e553673be3fb3a6ebe156eb0d05dfadae907 | bbe2c5d98fd9c0ffaa16e60ec1ecd04a6ece058b | /UIKit Ripoff/CoreGraphics/CGRect.hpp | 0ac4e4256ca3403ea2e70b615d3dc9770a302c20 | [] | no_license | BeeFl/GraphingCalculator-SFML | 896d9b5af7ace49db21aefd24d5b49e935063772 | 2100c023307a47837042525da2ea15852cfb7daf | refs/heads/master | 2021-10-28T14:47:27.301489 | 2019-04-24T04:55:24 | 2019-04-24T04:55:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 867 | hpp | //
// CGRect.hpp
// Graphing Calculator CAS
//
// Created by Jack Zhao on 11/19/18.
// Copyright © 2018 Jack Zhao. All rights reserved.
//
#ifndef CGRect_hpp
#define CGRect_hpp
#include "CGPoint.hpp"
#include "CGSize.hpp"
#include "CGVector.hpp"
struct CGRect {
CGPoint origin;
CGSize size;
CGRect(CGPoint _origin, CGSize _size);
CGRect(double x = 0, double y = 0, double width = 0, double height = 0);
double height() const;
double width() const;
double minX() const;
double midX() const;
double maxX() const;
double minY() const;
double midY() const;
double maxY() const;
CGPoint midPoint() const;
void setOrigin(const CGPoint& point);
void setSize(const CGSize& _size);
bool contains(CGPoint aPoint) const;
bool contains(CGRect aRect) const;
};
#endif /* CGRect_hpp */
| [
"[email protected]"
] | |
ef8f2633caba7ff916632d797593d49e15423374 | 4260b36e781deaf5c4e67ac39a2a95201f9a8f45 | /src/mousepinsprite.cpp | d674e9d86259b3e203605f250330b6afe87fd564 | [] | no_license | VKuzia/corona-game | 2acb79cda35b15260f9c380d9571653b0b01a5c5 | 7cbad18bfcaa4ba162d7c5b40059547d715242aa | refs/heads/master | 2023-07-09T14:17:17.437509 | 2021-08-19T12:28:37 | 2021-08-19T12:28:37 | 397,905,464 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,333 | cpp | #include "mousepinsprite.h"
#include "spritemanager.h"
const int kMousePinWidth = 29;
const int kMousePinHeight = 29;
const int kDefaultTransparency = 200;
MousePinSprite::MousePinSprite(QGraphicsView* graphics_area, int x, int y, qreal size) :
GraphicsUnit (graphics_area, GraphicsUnit::kPin, x, y, kMousePinWidth * size, kMousePinHeight * size),
transparency_(kDefaultTransparency)
{
this->setZValue(1);
}
MousePinSprite::~MousePinSprite() {}
QRectF MousePinSprite::boundingRect() const
{
return rect_;
}
void MousePinSprite::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
painter->setOpacity(transparency_ / 255.0);
painter->drawImage(rect_, *SpriteManager::GetImage(SpriteManager::kPin));
}
void MousePinSprite::Update(int x, int y)
{
moveBy(x-x_, y-y_);
update();
x_ = x;
y_ = y;
}
void MousePinSprite::HandleCollisions() {
for (auto item : this->collidingItems()) {
GraphicsUnit* item_s = dynamic_cast<GraphicsUnit*>(item);
if (item_s == nullptr) {
continue;
}
switch(item_s->GetType()) {
case GraphicsUnit::kCoronaBullet:
if (item_s->isActive()) {
item_s->setVisible(false);
dynamic_cast<CoronaBullet*>(item_s)->Die();
}
}
}
}
| [
"[email protected]"
] | |
68e4b25883a9e9985e601cb099d6156492f1e147 | 44a676b33c39798820bc1a6819b6cd6a156bf108 | /CF712/THE_VIRUS.cpp | dad4a37b29c36a98828aef2638d449232f1899b4 | [] | no_license | Mayank-MP05/CPP-Codes-Contests | 9111a02221ac64031f5516c88c36df039975f073 | f5113b4a84517df7ecce010da98f12aaf91e8259 | refs/heads/main | 2023-04-19T07:09:41.961955 | 2021-05-07T11:47:07 | 2021-05-07T11:47:07 | 354,313,141 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,209 | cpp | #include<bits/stdc++.h>
using namespace std;
#define fo(i,n) for(i=0;i<n;i++)
#define ll long long
#define deb(x) if(SHOW) cout << #x << "=" << x << endl
#define deb2(x, y) if(SHOW) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define debArr(a,n) if(SHOW) for(int z=0;z<n;z++){ cout<<a[z]<<" "; } cout<<endl;
#define deb2DArr(a,m,n) if(SHOW) for(int z=0;z<m;z++){for(int y=0;y<n;y++){ cout<<a[z][y]<<" "; } cout<<endl;}
#define deb3(x, y, z) if(SHOW) cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" |\
"<<#z<<": "<<z<<endl
#define deb4(a, b, c, d) if(SHOW) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" |\
"<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define deb5(a, b, c, d, e) if(SHOW) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" |\
"<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define deb6(a, b, c, d, e, f) if(SHOW) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<< c<<" |\
"<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define line if(SHOW) cout<<"\n__________________________________________\n";
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define SHOW true
void solve(string virus, ll m) {
ll i, j, n, a, b, c;
string patient;
cin >> patient;
n = patient.size();
j = 0; // Iterator for Virus
if (n > m) {
cout << "NEGATIVE\n";
return;
}
for (i = 0 ; i < n and j < m ; ) {
if (virus[j] == patient[i]) {
i++;
}
j++;
}
if (i == n) {
cout << "POSITIVE\n";
} else {
cout << "NEGATIVE\n";
}
}
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t = 1;
string virus;
cin >> virus;
ll m = virus.length();
cin >> t;
while (t--) {
solve(virus, m);
}
return 0;
}
| [
"[email protected]"
] | |
65c6cb9bb68ce5d4241956f7e6b9bb7959dda036 | 3693a4c271684c2b6d913ea694b100806ed28dbd | /Classes/Models/Characters/Visitors/Animations/AnimationAttacker.h | 9c113dfb15f60fca0fe07813966c358862231515 | [
"MIT"
] | permissive | HectorHernandezMarques/NinjaNoMeiyo | 1f99d13a66a3203df5a3dbb55cc8d86ffca53394 | 4ae0b99e12d172a34e84de990e47817deed632e2 | refs/heads/master | 2021-03-24T12:16:15.388635 | 2018-06-04T23:31:25 | 2018-06-04T23:31:25 | 84,374,001 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 726 | h | #ifndef NINJANOMEIYO_MODELS_CHARACTERS_VISITORS_ANIMATIONS_ANIMATIONATTACKER_H
#define NINJANOMEIYO_MODELS_CHARACTERS_VISITORS_ANIMATIONS_ANIMATIONATTACKER_H
#include "./AnimationVisitor.h"
namespace NinjaNoMeiyo {
namespace Models {
namespace Characters {
namespace Visitors {
namespace Animations {
class AnimationAttacker : public AnimationVisitor {
public:
AnimationAttacker(Sense sense);
virtual ~AnimationAttacker();
void visit(Ryunosuke &ryunosuke);
void update(Characters::Aspects::Characters::Aspect &aspect);
void setState(States::State &state, Interaction interactionType);
protected:
private:
Sense sense;
};
}
}
}
}
}
#endif | [
"[email protected]"
] | |
d1eca355aa1db19ef934aafbf1e26b25d215be39 | 156781703c24d27e1641caa80e71ff6e0b79c7ff | /waf_sqli/utility/http_parser.h | 3478077dec96fe3de83fe0ef860195bb9a3acbe0 | [] | no_license | fpesce/WAF-wasm | 23bd935b5d93b8b60c8cfd878f58b41296ee1eba | 118fed5f750be5fd6cb3e1534709bd3ceb2fa3e2 | refs/heads/master | 2022-12-13T07:21:28.750999 | 2020-09-14T21:42:30 | 2020-09-14T21:42:30 | 295,532,421 | 0 | 0 | null | 2020-09-14T21:42:31 | 2020-09-14T20:34:01 | null | UTF-8 | C++ | false | false | 438 | h | #include "common.h"
// Decode the given string encoded in URI formatting
std::string percentDecode(std::string encoded);
// parse the http path into key-value pairs of parameters
QueryParams parsePath(std::string path);
// parse the http request body into key-value pairs of parameters
QueryParams parseBody(std::string body);
// parse the http cookie header value into key-value pairs
QueryParams parseCookie(std::string cookie);
| [
"[email protected]"
] | |
e4df2cd4c361a2eb3fdde26896a0925f72ccd552 | 9d7fc1660d1e5d60d4a286da60313b372f48ed3b | /Communication/UnixSockServer.cpp | 060af7dd8947fea41e62bc24bbc8c9d3e653a938 | [] | no_license | zlmone/dev_hub | ba78a4074cab367422fcb9649a9f65f86cb63dc1 | 6b03bfc14bfc2437c8161ef7be1a2747d4cd5be0 | refs/heads/master | 2023-07-07T20:21:47.635045 | 2019-06-21T02:07:41 | 2019-06-21T02:07:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 789 | cpp | #include <string.h>
#include "UnixSockServer.h"
using namespace std;
using namespace lux;
UnixSockServer::UnixSockServer(const string unixSock)
// : m_acceptor(new UnixAcceptor(unixSock, this))
{
m_acceptor = new UnixAcceptor(unixSock, this);
}
UnixSockServer::~UnixSockServer()
{
m_acceptor->Stop();
delete m_acceptor;
m_acceptor = NULL;
}
bool UnixSockServer::Start()
{
return m_acceptor->StartListen() == 0;
}
////////////////////////////// test ///////////////////////////
UnixSockServer *UnixSockServerTest()
{
UnixSockServer *server = new UnixSockServer("/tmp/go.sock");
if (!server->Start()){
cerr << "server start failed." << endl;
return NULL;
}
cout << "server start ok" << endl;
return server;
}
| [
"[email protected]"
] | |
886e65f0261080850cad5eb48a932925b020aaae | 4440ed8abe23437f15ee535bcff2e0f258e68076 | /Basics/towerofHanoi.cpp | 1e5c709fbc746e33f8d0ce9ac35c4e56f0fae73c | [] | no_license | AkarshSimha007/CompetitiveCoding | 0260b0eb93566596ae083466cd9a39894e5734af | 7f77bc51833ecbf13ef84ddbb3b4882bb3c03489 | refs/heads/master | 2023-05-02T22:18:01.055245 | 2021-05-23T04:15:51 | 2021-05-23T04:15:51 | 311,567,180 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 284 | cpp | #include<iostream>
using namespace std;
void toh(int n,char src,char dest,char help){
if(n==0){
return;
}
toh(n-1,src,help,dest);
cout<<"Move from "<<src<<" to "<<dest<<endl;
toh(n-1,help,dest,src);
}
int main(){
toh(4,'A','C','B');
return 0;
} | [
"[email protected]"
] | |
0a3dc98dd9aa00bfbcdb4af49cfdd498a8470c6d | 487aefc4aa02e429ebdaafd11b6af07bc150aec3 | /src/app/shader/ShaderProgram.h | fae41ab293afc49767c0696a36293fab5c69eb9e | [] | no_license | Tehtehteh/c-raio | 5f849cde25e5b9732144be63dd40e4bf52489e99 | cfe9c3b5610cb88a38519057d9cb8d6bbbeb9197 | refs/heads/master | 2020-06-06T01:48:45.883493 | 2019-06-20T18:58:26 | 2019-06-20T18:58:26 | 192,605,532 | 0 | 0 | null | 2019-06-20T18:58:27 | 2019-06-18T20:07:36 | C | UTF-8 | C++ | false | false | 462 | h | #ifndef GL_SKELETON_SHADERPROGRAM_H
#define GL_SKELETON_SHADERPROGRAM_H
#include <GLFW/glfw3.h>
#include <vector>
#include <iostream>
#include "Shader.h"
class ShaderProgram {
public:
explicit ShaderProgram(const std::vector<Shader>&);
~ShaderProgram();
void use();
GLuint get_uniform_location(std::string);
GLuint get_uniform_location(const char*);
GLuint id;
std::vector<Shader> shaders;
};
#endif //GL_SKELETON_SHADERPROGRAM_H
| [
"[email protected]"
] | |
0b4707bc26e6ec5984da708f833a056205b8b5a9 | d11235048abad36a8f09b5881c225074869aca71 | /include/thrust/system/detail/generic/remove.h | 75235f5c598a6603cea17f4440bdea26ac7450c0 | [] | no_license | peu-oliveira/pibiti | 108057e196e7388a39916bf464d89d886d3e2cba | 7acfa9d173c7d2bd4d4406e030a8510ced8a3add | refs/heads/main | 2023-04-18T00:30:43.890808 | 2021-04-28T13:55:50 | 2021-04-28T13:55:50 | 306,166,539 | 1 | 0 | null | 2021-04-28T13:55:50 | 2020-10-21T22:54:45 | C | UTF-8 | C++ | false | false | 3,615 | h | /*
* Copyright 2008-2013 NVIDIA Corporation
*
* 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.
*/
/*! \file remove.h
* \brief Generic implementations of remove functions.
*/
#pragma once
#include <thrust/detail/config.h>
#include <thrust/system/detail/generic/tag.h>
namespace thrust
{
namespace system
{
namespace detail
{
namespace generic
{
template<typename DerivedPolicy,
typename ForwardIterator,
typename T>
__host__ __device__
ForwardIterator remove(thrust::execution_policy<DerivedPolicy> &exec,
ForwardIterator first,
ForwardIterator last,
const T &value);
template<typename DerivedPolicy,
typename InputIterator,
typename OutputIterator,
typename T>
__host__ __device__
OutputIterator remove_copy(thrust::execution_policy<DerivedPolicy> &exec,
InputIterator first,
InputIterator last,
OutputIterator result,
const T &value);
template<typename DerivedPolicy,
typename ForwardIterator,
typename Predicate>
__host__ __device__
ForwardIterator remove_if(thrust::execution_policy<DerivedPolicy> &exec,
ForwardIterator first,
ForwardIterator last,
Predicate pred);
template<typename DerivedPolicy,
typename ForwardIterator,
typename InputIterator,
typename Predicate>
__host__ __device__
ForwardIterator remove_if(thrust::execution_policy<DerivedPolicy> &exec,
ForwardIterator first,
ForwardIterator last,
InputIterator stencil,
Predicate pred);
template<typename DerivedPolicy,
typename InputIterator,
typename OutputIterator,
typename Predicate>
__host__ __device__
OutputIterator remove_copy_if(thrust::execution_policy<DerivedPolicy> &exec,
InputIterator first,
InputIterator last,
OutputIterator result,
Predicate pred);
template<typename DerivedPolicy,
typename InputIterator1,
typename InputIterator2,
typename OutputIterator,
typename Predicate>
__host__ __device__
OutputIterator remove_copy_if(thrust::execution_policy<DerivedPolicy> &exec,
InputIterator1 first,
InputIterator1 last,
InputIterator2 stencil,
OutputIterator result,
Predicate pred);
} // end namespace generic
} // end namespace detail
} // end namespace system
} // end namespace thrust
#include <thrust/system/detail/generic/remove.inl>
| [
"[email protected]"
] | |
7345009858acc3a39833149d1c3f4a2522cda7c8 | 8bf096c857cde9c39398ff50b12ce6ecc0f69e68 | /PCM/qt_gui/OGL_viewports_skin2.hpp | ff2fe2a5061b7ed3861d2ac8cd96af6c270f5c92 | [] | no_license | JackZhouSz/ebpd_vs2015 | 796a346907a5a6be6c02d82bf0aeaa92566ea44e | 190248cd9e66ecaadb7111e50a4c30e34ff52f31 | refs/heads/master | 2023-03-20T09:14:38.661344 | 2017-06-30T14:26:20 | 2017-06-30T14:26:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,807 | hpp | #ifndef OGL_VIEWPORTS_SKIN2_HPP__
#define OGL_VIEWPORTS_SKIN2_HPP__
#include "toolbars/gizmo/gizmo.hpp"
#include "qt_gui/toolbars/OGL_widget_enum.hpp"
#include "GlobalObject.h"
#include <QFrame>
#include <vector>
#include <QLayout>
#include <QGLWidget>
#include <QTime>
class main_window;
class PaintCanvas;
class CameraViewer;
class Viewport_frame_skin2;
typedef std::vector<PaintCanvas*> Vec_viewports;
typedef std::vector<CameraViewer*> Vec_cameraViewers;
// =============================================================================
class OGL_widget_skin2_hidden : public QGLWidget {
public:
OGL_widget_skin2_hidden(QWidget* w) : QGLWidget(w) {}
void initializeGL();
};
// =============================================================================
/** @class OGL_viewports
@brief Multiple viewports handling with different layouts
*/
class OGL_viewports_skin2 : public QFrame {
Q_OBJECT
public:
OGL_viewports_skin2(QWidget* w, main_window* m);
~OGL_viewports_skin2();
/// Updates all viewports
void updateGL();
// -------------------------------------------------------------------------
/// @name Getter & Setters
// -------------------------------------------------------------------------
enum Layout_e { SINGLE, VDOUBLE, HDOUBLE, FOUR };
/// Erase all viewports and rebuild them according to the specified layout
/// 'setting'
void set_viewports_layout(Layout_e setting);
/// @warning the list is undefined if used after a call to
/// set_viewports_layout()
Vec_viewports& get_viewports();
// TODO: to be deleted
/// sets io for all viewports
void set_io(EOGL_widget::IO_t io_type);
/// sets gizmo type (rotation, scaling, translation) for all viewports
void set_gizmo(Gizmo::Gizmo_t type);
/// Show/hide gizmo for all viewports
void show_gizmo(bool state);
/// sets camera pivot for all viewports
// void set_cam_pivot(EOGL_widget::Pivot_t m);
/// sets gizmo pivot for all viewports
// void set_gizmo_pivot(EIO_Selection::Pivot_t piv);
/// sets gizmo orientation for all viewports
// void set_gizmo_dir(EIO_Selection::Dir_t dir);
void set_alpha_strength(float a);
/// @return the active frame
PaintCanvas* active_viewport(){
setGlobalCanvas(_current_viewport);
return _current_viewport;
}
PaintCanvas* prev_viewport()
{
return _prev_viewport;
}
QGLWidget* shared_viewport(){ return _hidden; }
void toggleCameraViewer();
// -------------------------------------------------------------------------
/// @name Events
// -------------------------------------------------------------------------
void enterEvent( QEvent* e);
// -------------------------------------------------------------------------
/// @name Qt Signals & Slots
// -------------------------------------------------------------------------
private slots:
/// Designed to be called each time a single viewport draws one frame.
void incr_frame_count();
void active_viewport_slot(int id);
signals:
void frame_count_changed(int);
void active_viewport_changed(int id);
/// Update status bar
void update_status(QString);
private:
// -------------------------------------------------------------------------
/// @name Tools
// -------------------------------------------------------------------------
QLayout* gen_single ();
QLayout* gen_vdouble();
QLayout* gen_hdouble();
QLayout* gen_four ();
/// suppress all viewports and layouts
void erase_viewports();
void erase_cameraViewers();
/// Creates a new viewport with the correct signals slots connections
PaintCanvas* new_viewport(Viewport_frame_skin2* ogl_frame);
/// Creates a new viewport frame with the correct signals slots connections
Viewport_frame_skin2* new_viewport_frame(QWidget* parent, int id);
/// Sets the frame color by replacing its styleSheet color
void set_frame_border_color(Viewport_frame_skin2* f, int r, int g, int b);
void first_viewport_as_active();
/// Before drawing compute every pre process like mesh deformation
void update_scene();
// -------------------------------------------------------------------------
/// @name Attributes
// -------------------------------------------------------------------------
bool _skel_mode;
EOGL_widget::IO_t _io_type;
/// Vector of OGL_widget
Vec_viewports _viewports;
CameraViewer* _cameraViewer;
/// List of frames associated to the viewports
std::vector<Viewport_frame_skin2*> _viewports_frame;
/// The active viewport
PaintCanvas* _current_viewport;
PaintCanvas* _prev_viewport;
/// opengl shared context between all viewports
/// (in order to share VBO textures etc.)
OGL_widget_skin2_hidden* _hidden;
/// Layout containing all viewports
QLayout* _main_layout;
/// main widow the widget's belongs to
main_window* _main_window;
/// sum of frames drawn by the viewports
int _frame_count;
/// Fps counting timer
QTime _fps_timer;
};
// =============================================================================
class Viewport_frame_skin2 : public QFrame {
Q_OBJECT
public:
Viewport_frame_skin2(QWidget* w, int id) : QFrame(w), _id(id)
{
setFrameShape(QFrame::Box);
setFrameShadow(QFrame::Plain);
setLineWidth(1);
setStyleSheet(QString::fromUtf8("color: rgb(0, 0, 0);"));
}
int id() const { return _id; }
signals:
void active(int);
private slots:
void activate(){
emit active(_id);
}
private:
int _id;
};
// =============================================================================
#endif // OGL_VIEWPORTS_SKIN2_HPP__
| [
"[email protected]"
] | |
3023a9a159c571472ca076dda544ab1955e33630 | 1bf6927ad32481b95b271f4f1fbf5ec426edef32 | /src/qt/bitcoinunits.cpp | 23103d8c8d3558141f7feb7b8142ce411ffdaaef | [
"MIT"
] | permissive | dream8coin/dreamcoin | 288691f7d45dedefbe68c75800480eb434741294 | 100e73f65aa378c28304af8749df23ee739208ce | refs/heads/master | 2018-02-09T07:55:32.717927 | 2017-10-22T00:51:37 | 2017-10-22T00:51:37 | 70,240,498 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 4,291 | cpp | #include "bitcoinunits.h"
#include <QStringList>
BitcoinUnits::BitcoinUnits(QObject *parent):
QAbstractListModel(parent),
unitlist(availableUnits())
{
}
QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits()
{
QList<BitcoinUnits::Unit> unitlist;
unitlist.append(BTC);
unitlist.append(mBTC);
unitlist.append(uBTC);
return unitlist;
}
bool BitcoinUnits::valid(int unit)
{
switch(unit)
{
case BTC:
case mBTC:
case uBTC:
return true;
default:
return false;
}
}
QString BitcoinUnits::name(int unit)
{
switch(unit)
{
case BTC: return QString("DRM8");
case mBTC: return QString("mDRM8");
case uBTC: return QString::fromUtf8("μDRM8");
default: return QString("???");
}
}
QString BitcoinUnits::description(int unit)
{
switch(unit)
{
case BTC: return QString("Dream8coins");
case mBTC: return QString("Milli-Dream8coins (1 / 1,000)");
case uBTC: return QString("Micro-Dream8coins (1 / 1,000,000)");
default: return QString("???");
}
}
qint64 BitcoinUnits::factor(int unit)
{
switch(unit)
{
case BTC: return 100000000;
case mBTC: return 100000;
case uBTC: return 100;
default: return 100000000;
}
}
int BitcoinUnits::amountDigits(int unit)
{
switch(unit)
{
case BTC: return 8; // 21,000,000 (# digits, without commas)
case mBTC: return 11; // 21,000,000,000
case uBTC: return 14; // 21,000,000,000,000
default: return 0;
}
}
int BitcoinUnits::decimals(int unit)
{
switch(unit)
{
case BTC: return 8;
case mBTC: return 5;
case uBTC: return 2;
default: return 0;
}
}
QString BitcoinUnits::format(int unit, qint64 n, bool fPlus)
{
// Note: not using straight sprintf here because we do NOT want
// localized number formatting.
if(!valid(unit))
return QString(); // Refuse to format invalid unit
qint64 coin = factor(unit);
int num_decimals = decimals(unit);
qint64 n_abs = (n > 0 ? n : -n);
qint64 quotient = n_abs / coin;
qint64 remainder = n_abs % coin;
QString quotient_str = QString::number(quotient);
QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0');
// Right-trim excess 0's after the decimal point
int nTrim = 0;
for (int i = remainder_str.size()-1; i>=2 && (remainder_str.at(i) == '0'); --i)
++nTrim;
remainder_str.chop(nTrim);
if (n < 0)
quotient_str.insert(0, '-');
else if (fPlus && n > 0)
quotient_str.insert(0, '+');
return quotient_str + QString(".") + remainder_str;
}
QString BitcoinUnits::formatWithUnit(int unit, qint64 amount, bool plussign)
{
return format(unit, amount, plussign) + QString(" ") + name(unit);
}
bool BitcoinUnits::parse(int unit, const QString &value, qint64 *val_out)
{
if(!valid(unit) || value.isEmpty())
return false; // Refuse to parse invalid unit or empty string
int num_decimals = decimals(unit);
QStringList parts = value.split(".");
if(parts.size() > 2)
{
return false; // More than one dot
}
QString whole = parts[0];
QString decimals;
if(parts.size() > 1)
{
decimals = parts[1];
}
if(decimals.size() > num_decimals)
{
return false; // Exceeds max precision
}
bool ok = false;
QString str = whole + decimals.leftJustified(num_decimals, '0');
if(str.size() > 18)
{
return false; // Longer numbers will exceed 63 bits
}
qint64 retvalue = str.toLongLong(&ok);
if(val_out)
{
*val_out = retvalue;
}
return ok;
}
int BitcoinUnits::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return unitlist.size();
}
QVariant BitcoinUnits::data(const QModelIndex &index, int role) const
{
int row = index.row();
if(row >= 0 && row < unitlist.size())
{
Unit unit = unitlist.at(row);
switch(role)
{
case Qt::EditRole:
case Qt::DisplayRole:
return QVariant(name(unit));
case Qt::ToolTipRole:
return QVariant(description(unit));
case UnitRole:
return QVariant(static_cast<int>(unit));
}
}
return QVariant();
}
| [
"[email protected]"
] | |
8065d043c55e8dd9afef048b5546d5533ec1a910 | c785b9f58e3e6ab2998b2923ad0df3ba5e64fbb2 | /Classes/Client/GameManager/TimeManager.cpp | a53e5ca6385bf0bc2d0c9a251f479f6432ffb204 | [] | no_license | kylinda/xcode_jifengyongzhezhuan | d4673c4be036b0b79197271d2cca211541f15e0c | d914d59259bc1412f281193aadd6ad1c1f0b4ac0 | refs/heads/master | 2021-01-21T16:18:43.402867 | 2014-11-11T05:26:26 | 2014-11-11T05:26:26 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 10,477 | cpp | #include "OnlineNetworkManager.h"
#include "TimeManager.h"
#include "CCLuaEngine.h"
#include <time.h>
TimeManager::TimeManager()
:serverMinusLocalTime(0)
,latestLocalTime(0)
,initFlag(false)
,lastSyncServerTime(0)
,acceCount(0)
,timeZone(0)
{
CCScheduler * pSchedule = CCDirector::sharedDirector()->getScheduler();
pSchedule->scheduleSelector(schedule_selector(TimeManager::update),
this,
0,
false);
#ifdef OUR_DEBUG
pSchedule->scheduleSelector(schedule_selector(TimeManager::updateMem),
this,
10.0,
false);
#endif
//this->m_shopFreshTime = 0;
}
TimeManager::~TimeManager()
{
CCScheduler * pSchedule = CCDirector::sharedDirector()->getScheduler();
pSchedule->unscheduleSelector(schedule_selector(TimeManager::update),
this);
#ifdef OUR_DEBUG
pSchedule->unscheduleSelector(schedule_selector(TimeManager::updateMem),
this);
#endif
}
#ifdef OUR_DEBUG
void TimeManager::updateMem(float dt)
{
check_memory();
}
#endif
void TimeManager::syncServerTime(unsigned int serTime)
{
CCLOG("serTime : (%u, %u), %u", lastSyncServerTime, serTime, serTime - lastSyncServerTime);
//误差超过60s断开连接,防止修改本地时间
if (abs((long)serTime - getCurServerTime()) > 60 && initFlag)
{
// TODO : to login?
OnlineNetworkManager::sShareInstance()->LostConnection2Server("TimeManager check unsync");
initFlag = false;
return;
}
if (lastSyncServerTime && initFlag)
{
if ((long)serTime - lastSyncServerTime < 10)
{
//容忍一定程度的收包过快,防止发包拥塞
//if (acceCount > 3)
{
OnlineNetworkManager::sShareInstance()->LostConnection2Server("Accelerate detected");
initFlag = false;
acceCount = 0;
return;
}
/*else
{
acceCount++;
}*/
}
}
lastSyncServerTime = serTime;
this->serverMinusLocalTime = serTime - latestLocalTime;
initFlag = true;
}
long TimeManager::getCurServerTime()
{
long simuServerTime = latestLocalTime + serverMinusLocalTime;
return simuServerTime;
}
string TimeManager::secondsToString(long seconds)
{
string result = "00:00";
if (seconds <= 0) {
return result;
}
char resStr[16];
long hour, min, sec;
hour = min = sec = 0;
min = seconds / 60;
sec = seconds % 60;
hour = min / 60;
min = min % 60;
if (!hour)
{
sprintf(resStr, "%02ld:%02ld", min, sec);
}
else
{
sprintf(resStr, "%02ld:%02ld:%02ld", hour, min, sec);
}
result = string(resStr);
return result;
}
//C++
bool TimeManager::registerTimer(TimeProtocol * observer, int counterId, long endTime)
{
bool ret = false;
if (observer == NULL)
return ret;
if (timeObMap.end() == timeObMap.find(counterId)
&& timeObMap[counterId].end() == timeObMap[counterId].find(observer))
{
TimeObSet timeObSet;
timeObMap[counterId] = timeObSet;
timeObMap[counterId].insert(observer);
counterMap[counterId] = endTime - getCurServerTime();
ret = true;
}
CCAssert(ret, "TimeManager:registerTimer failed");
return ret;
}
//C++
bool TimeManager::unregisterTimer(TimeProtocol * observer, int counterId)
{
bool ret = false;
if (observer == NULL || timeObMap.end() == timeObMap.find(counterId))
return ret;
if (timeObMap[counterId].find(observer) != timeObMap[counterId].end())
{
timeObMap[counterId].erase(observer);
//无人监听后删除timer
if (timeObMap[counterId].size() == 0)
{
timeObMap.erase(counterId);
counterMap.erase(counterId);
}
ret = true;
}
CCAssert(ret, "TimeManager:unregisterTimer failed");
return ret;
}
//C++
bool TimeManager::attachTimer(TimeProtocol * observer, int counterId)
{
bool ret = false;
if (counterMap.end() == counterMap.find(counterId)
|| timeObMap.end() == timeObMap.find(counterId))
{
CCAssert(0, "TimeManager: can't find timer");
}
else if (timeObMap[counterId].end() != timeObMap[counterId].find(observer))
{
CCAssert(0, "TimeManager: already attached Timer");
}
else
{
timeObMap[counterId].insert(observer);
ret = true;
}
CCAssert(ret, "TimeManager:attachTimer failed");
return ret;
}
//Lua
int TimeManager::registerLuaTimer(int handler, int counterId, long endTime)
{
int ret = 0;
if (handler == NULL)
return ret;
if (luaObMap.end() == luaObMap.find(counterId)
&& luaObMap[counterId].end() == luaObMap[counterId].find(handler))
{
LuaObSet luaObSet;
luaObMap[counterId] = luaObSet;
luaObMap[counterId].insert(handler);
counterMap[counterId] = endTime - getCurServerTime();
ret = handler;
}
CCAssert(ret, "TimeManager:registerLuaTimer failed");
return ret;
}
//Lua
bool TimeManager::unregisterLuaTimer(int handler, int counterId)
{
bool ret = false;
if (handler == NULL || luaObMap.end() == luaObMap.find(counterId))
return ret;
if (luaObMap[counterId].find(handler) != luaObMap[counterId].end())
{
luaObMap[counterId].erase(handler);
CCLuaEngine::defaultEngine()->removeScriptHandler(handler);
//无人监听后删除timer
if (luaObMap[counterId].size() == 0)
{
luaObMap.erase(counterId);
counterMap.erase(counterId);
}
ret = true;
}
CCAssert(ret, "TimeManager:unregisterLuaTimer failed");
return ret;
}
//Lua
int TimeManager::attachLuaTimer(int handler, int counterId)
{
int ret = 0;
if (counterMap.end() == counterMap.find(counterId)
|| luaObMap.end() == luaObMap.find(counterId))
{
CCAssert(0, "TimeManager: can't find lua timer");
}
else if (luaObMap[counterId].end() != luaObMap[counterId].find(handler))
{
CCAssert(0, "TimeManager: already attached lua Timer");
}
else
{
luaObMap[counterId].insert(handler);
ret = handler;
}
CCAssert(ret, "TimeManager:attachLuaTimer failed");
return handler;
}
//通用
bool TimeManager::startTimer(int counterId, long endTime)
{
bool ret = false;
if (counterMap.end() == counterMap.find(counterId))
{
counterMap[counterId] = endTime - getCurServerTime();
ret = true;
}
CCAssert(ret, "TimeManager:startTimer failed");
return ret;
}
//通用
bool TimeManager::stopTimer(int counterId)
{
bool ret = false;
if (counterMap.end() != counterMap.find(counterId))
{
counterMap.erase(counterId);
timeObMap.erase(counterId);
//停止?模仿下面写
//for(ObserverHandlers::iterator it = m_scriptHandler.begin();
// it != m_scriptHandler.end();++it)
//{
// if(*it)
// {
// CCLuaEngine::defaultEngine()->removeScriptHandler(*it);
// }
//}
//m_scriptHandler.clear();
luaObMap.erase(counterId);
ret = true;
}
//CCAssert(ret, "TimeManager:stopTimer failed");
return ret;
}
//通用
bool TimeManager::renewTimer(int counterId, long endTime)
{
bool ret = false;
if (counterMap.end() != counterMap.find(counterId))
{
counterMap[counterId] = endTime - getCurServerTime();
ret = true;
}
CCAssert(ret, "TimeManager:renewTimer failed");
return ret;
}
//通用
bool TimeManager::hasTimer(int counterId)
{
bool ret = false;
if (counterMap.end() != counterMap.find(counterId))
{
ret = true;
}
return ret;
}
//C++
bool TimeManager::hasObserver(TimeProtocol * observer, int counterId)
{
bool ret = false;
if (hasTimer(counterId) && timeObMap[counterId].end() != timeObMap[counterId].find(observer))
{
ret = true;
}
return ret;
}
//Lua
bool TimeManager::hasLuaObserver(int handler, int counterId)
{
bool ret = false;
if (hasTimer(counterId) && luaObMap[counterId].end() != luaObMap[counterId].find(handler))
{
ret = true;
}
return ret;
}
void TimeManager::update(float dt)
{
time_t nowTime;
time(&nowTime);
if (nowTime > latestLocalTime)
{
long delta = nowTime - latestLocalTime;
latestLocalTime = nowTime;
//更新计时数据
for (CounterMap::iterator iter = counterMap.begin();iter != counterMap.end(); ++iter) {
(*iter).second -= delta;
}
updateObservers(delta);
updateLuaObservers(delta);
}
}
void TimeManager::updateObservers(long delta)
{
vector<int> finishedTimer;
for (TimeObMap::iterator iter = timeObMap.begin();iter != timeObMap.end(); ++iter) {
int counterId = (*iter).first;
if (counterMap.find(counterId) != counterMap.end())
{
CounterMap::iterator counterIter = counterMap.find(counterId);
long remainTime = (*counterIter).second;
//更新每个observer
TimeObSet obSet = (*iter).second;
TimeObSet::iterator obSetIter = obSet.begin();
for (TimeObSet::iterator obSetIter = obSet.begin(); obSetIter != obSet.end(); obSetIter++)
{
if(NULL != *obSetIter)
{
(*obSetIter)->onUpdateRemainTime(remainTime >= 0 ? remainTime : 0);
}
}
//倒计时已为负值,加入删除vector,不能直接删除
if (remainTime < 0)
{
finishedTimer.push_back(counterId);
}
}
}
//清除已结束的timer
for (size_t i = 0; i < finishedTimer.size(); i++)
{
counterMap.erase(finishedTimer[i]);
timeObMap.erase(finishedTimer[i]);
}
}
void TimeManager::updateLuaObservers(long delta)
{
vector<int> finishedTimer;
for (LuaObMap::iterator iter = luaObMap.begin();iter != luaObMap.end(); ++iter) {
int counterId = (*iter).first;
if (counterMap.find(counterId) != counterMap.end())
{
CounterMap::iterator counterIter = counterMap.find(counterId);
long remainTime = (*counterIter).second;
//更新每个observer
LuaObSet obSet = (*iter).second;
LuaObSet::iterator obSetIter = obSet.begin();
for (LuaObSet::iterator obSetIter = obSet.begin(); obSetIter != obSet.end(); obSetIter++)
{
if(NULL != *obSetIter)
{
CCLuaEngine* engine = CCLuaEngine::defaultEngine();
engine->cleanStack();
engine->pushInt(remainTime >= 0 ? remainTime : 0);
engine->executeFunctionByHandler(*obSetIter,1);
}
}
//倒计时已为负值,加入删除vector,不能直接删除
if (remainTime < 0)
{
finishedTimer.push_back(counterId);
}
}
}
//清除已结束的timer
//for (size_t i = 0; i < finishedTimer.size(); i++)
//{
// counterMap.erase(finishedTimer[i]);
// luaObMap.erase(finishedTimer[i]);
//}
}
void TimeManager::ResetData()
{
serverMinusLocalTime = 0;
latestLocalTime = 0;
lastSyncServerTime = 0;
acceCount = 0;
//是否同步过系统时间
initFlag = false;
timeObMap.clear();
luaObMap.clear();
counterMap.clear();
} | [
"[email protected]"
] | |
ee9fcc3b0eee9afe5d686b0b32fc54a74f3e77ec | d2636c570b66284262d5a883f0e80bb1b6e59488 | /Binary Tree Preorder Traversal/Binary_Tree_Preorder_Traversal.cpp | ee1ebaad474a50b7ba2ec03668b0ee1946582668 | [] | no_license | hamedkiani/LeetCode | 2e925c4a980af616dc641640f1ef9764a66c7873 | 451a991f71dc9d3f24f32d6bb5896fb45679f5b4 | refs/heads/master | 2020-04-08T21:33:40.354392 | 2019-02-18T02:04:47 | 2019-02-18T02:04:47 | 159,749,116 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 643 | cpp | class Solution {
public:
vector<int> preorderTraversal(TreeNode* root)
{
vector<int> res;
helper(root, res);
return res;
}
void helper(TreeNode* root, vector<int> &res)
{
if (!root)
return;
stack<TreeNode*> stk;
TreeNode* temp = root;
while(temp || !stk.empty())
{
while(temp)
{
res.push_back(temp->val);
stk.push(temp);
temp = temp->left;
}
temp = stk.top();
stk.pop();
temp = temp->right;
}
return;
}
};
| [
"[email protected]"
] | |
872c067679d328846150ab8b044551c9dd19e7a0 | fb5b631102c64101a9fde04b3977df8f96b772d6 | /e20190001_Hetapuz/Hetapuz/Hetapuz/PzRotate.cpp | ef5c4431eda99a605acd5937422b810e81cc8e6a | [
"MIT"
] | permissive | soleil-taruto/Henrietta | e3bbc1796e288467b073829635f4717b7fe33e89 | b6979a8e0e49829a9b1ca42dc41194db66cbe298 | refs/heads/main | 2023-05-04T08:51:28.321987 | 2021-05-29T17:24:50 | 2021-05-29T17:24:50 | 346,037,804 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 2,315 | cpp | #include "StdInc.h"
int DirRotClock(int dir)
{
switch(dir)
{
case 2: dir = 4; break;
case 4: dir = 8; break;
case 6: dir = 2; break;
case 8: dir = 6; break;
default:
error();
}
return dir;
}
int DirRotHanClock(int dir)
{
return DirRotClock(DirRotClock(DirRotClock(dir)));
}
int DirRot(int dir, int rotDir)
{
switch(rotDir)
{
case -1: dir = DirRotHanClock(dir); break;
case 1: dir = DirRotClock(dir); break;
default:
error();
}
return dir;
}
int DirX;
int DirY;
void SetDir(int dir)
{
DirX = 0;
DirY = 0;
switch(dir)
{
case 2: DirY++; break;
case 4: DirX--; break;
case 6: DirX++; break;
case 8: DirY--; break;
default:
error();
}
}
int PairX[2];
int PairY[2];
void SetPairPos(int x, int y, int dir)
{
PairX[0] = x;
PairY[0] = y;
SetDir(dir);
PairX[1] = x + DirX;
PairY[1] = y + DirY;
}
int Pzr_Dir;
int Pzr_RotDir; // -1 == 反時計, 1 == 時計
int Pzr_X;
double Pzr_Y;
Map_t *Pzr_Map;
static Puyo_t *GetPuyo(int x, int y)
{
if(
0 <= x && x < MAP_X_BOUND &&
0 <= y && y < MAP_Y_BOUND
)
{
return Pzr_Map->PanelTable[x][y].Puyo;
}
return (Puyo_t *)"Dummy";
}
void DoRotate(void)
{
int jx = Pzr_X;
int jy = (int)Pzr_Y;
Pzr_Dir = DirRot(Pzr_Dir, Pzr_RotDir);
SetPairPos(jx, jy, Pzr_Dir);
if(GetPuyo(PairX[1], PairY[1])) // ? めり込む
{
if(Pzr_Dir == 4) // ? 左
{
if(GetPuyo(PairX[1] + 2, PairY[1]) == NULL)
{
Pzr_X++;
goto endfunc;
}
}
else if(Pzr_Dir == 6) // ? 右
{
if(GetPuyo(PairX[1] - 2, PairY[1]) == NULL)
{
Pzr_X--;
goto endfunc;
}
}
else
goto adjust_tate;
Pzr_Dir = DirRot(Pzr_Dir, Pzr_RotDir);
}
adjust_tate:
// このへんてきとー
while(-10.0 < PairY[0])
{
SetPairPos(Pzr_X, (int)Pzr_Y, Pzr_Dir);
if( !GetPuyo(PairX[0], PairY[0]) &&
!GetPuyo(PairX[1], PairY[1])) break;
Pzr_Y = (int)Pzr_Y - 1;
}
for(; ; )
{
SetPairPos(Pzr_X, (int)Pzr_Y, Pzr_Dir);
if( 0 <= PairY[0] &&
0 <= PairY[1]) break;
Pzr_Y = (int)Pzr_Y + 1;
}
endfunc:
// check ...
SetPairPos(Pzr_X, (int)Pzr_Y, Pzr_Dir);
errorCase(PairX[0] < 0);
errorCase(MAP_X_BOUND <= PairX[0]);
errorCase(PairY[0] < 0);
errorCase(MAP_Y_BOUND <= PairY[0]);
errorCase(PairX[1] < 0);
errorCase(MAP_X_BOUND <= PairX[1]);
errorCase(PairY[1] < 0);
errorCase(MAP_Y_BOUND <= PairY[1]);
}
| [
"[email protected]"
] | |
214fe06da20b0ec45edf1078548a1d1cfa071157 | ae6d3e45a39e43d5eea1bacd86276c3582db30ce | /package/logger/logger/logger_singleton.hpp | 0577ce08f436bd7d40bf04412953fdf3290712d8 | [
"MIT"
] | permissive | mambaru/wfc_core | 9a84cdae2025199e8f7e2dfacb77ceeaf09b3d14 | 3ed4ed26f1a3b3bc4b7737256587c3c778f716b8 | refs/heads/master | 2023-08-30T23:11:20.982761 | 2023-08-30T13:14:00 | 2023-08-30T13:14:03 | 153,644,525 | 0 | 0 | MIT | 2021-04-20T23:22:41 | 2018-10-18T15:13:33 | C++ | UTF-8 | C++ | false | false | 313 | hpp | //
// Author: Vladimir Migashko <[email protected]>, (C) 2013-2015
//
// Copyright: See COPYING file that comes with this distribution
//
#pragma once
#include <wfc/module/component.hpp>
namespace wfc{ namespace core{
class logger_singleton
: public ::wfc::component
{
public:
logger_singleton();
};
}}
| [
"[email protected]"
] | |
592911704faa29f2eb78b22553f23a756274d13f | 6a2488cfeef100dc95e1db80de10fd791280fdc5 | /src/manual_controller_node.cpp | 3fa5622463f81b3bef04dea65e097d58fb7910d5 | [] | no_license | rdrive/isr_m2_controllers | b7e6b7db9807867902b8bd1887e1cfc82b882d78 | 3a5ed8155d0b60b027bda11dfdf5948ef7e06acc | refs/heads/master | 2020-06-23T21:38:58.325278 | 2016-11-25T01:58:23 | 2016-11-25T01:58:23 | 74,633,934 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 171 | cpp | #include "ros/ros.h"
#include <cstdlib>
int main(int argc, char** argv)
{
ros::init(argc, argv, "isr_m2_manual_controller");
ros::NodeHandle nh;
return 0;
}
| [
"[email protected]"
] | |
d6a400488b2399aae64f0f32cc5c147d5ab150e1 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/collectd/gumtree/collectd_repos_function_1927_last_repos.cpp | 696184aa4a1283bb96b1634cef863388e02487b5 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,521 | cpp | static int wh_write_kairosdb(const data_set_t *ds,
const value_list_t *vl, /* {{{ */
wh_callback_t *cb) {
int status;
pthread_mutex_lock(&cb->send_lock);
if (cb->curl == NULL) {
status = wh_callback_init(cb);
if (status != 0) {
ERROR("write_http plugin: wh_callback_init failed.");
pthread_mutex_unlock(&cb->send_lock);
return -1;
}
}
status = format_kairosdb_value_list(
cb->send_buffer, &cb->send_buffer_fill, &cb->send_buffer_free, ds, vl,
cb->store_rates, (char const *const *)http_attrs, http_attrs_num,
cb->data_ttl, cb->metrics_prefix);
if (status == -ENOMEM) {
status = wh_flush_nolock(/* timeout = */ 0, cb);
if (status != 0) {
wh_reset_buffer(cb);
pthread_mutex_unlock(&cb->send_lock);
return status;
}
status = format_kairosdb_value_list(
cb->send_buffer, &cb->send_buffer_fill, &cb->send_buffer_free, ds, vl,
cb->store_rates, (char const *const *)http_attrs, http_attrs_num,
cb->data_ttl, cb->metrics_prefix);
}
if (status != 0) {
pthread_mutex_unlock(&cb->send_lock);
return status;
}
DEBUG("write_http plugin: <%s> buffer %zu/%zu (%g%%)", cb->location,
cb->send_buffer_fill, cb->send_buffer_size,
100.0 * ((double)cb->send_buffer_fill) /
((double)cb->send_buffer_size));
/* Check if we have enough space for this command. */
pthread_mutex_unlock(&cb->send_lock);
return 0;
} | [
"[email protected]"
] | |
d61bc38c8be3e97a468557675f4f481a212b5812 | ba709284cdd695a2267e2cf1e55610624eefd49d | /Classes/map/MapManager.h | b251ca930a6419119f39beccab222fe5e50f88d2 | [] | no_license | talkvip/TRPGlikeRPGMockUp | 6fa4cf6487454f7fcd5af9e3d8d7da4b428960ba | 00eca38d712092ed665ff7d2f7b944742c8189b8 | refs/heads/master | 2020-04-04T13:16:43.391186 | 2014-03-30T15:19:42 | 2014-03-30T15:19:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,288 | h | //
// Created by 藤井 陽介 on 2014/03/06.
//
#ifndef __MapManager_H_
#define __MapManager_H_
enum MapDataType {
NONE = 0,
MOVE_DIST = 1,
ATTACK_DIST = 2,
MAP_ITEM = 3,
PLAYER = 4,
ENEMY = 5,
OBSTACLE = 6,
MOVE_STEP_DIST = 10, // 移動経路
SELECTED_DIST = 11, // 選択位置
};
enum MoveDirectionType {
MOVE_NONE = -1,
MOVE_DOWN = 0,
MOVE_LEFT = 1,
MOVE_RIGHT = 2,
MOVE_UP = 3
};
typedef struct _MapIndex {
int x;
int y;
MoveDirectionType moveDictType;
} MapIndex;
typedef struct _MapItem {
/** 短形マップ上の区分. */
MapDataType mapDataType;
MapIndex mapIndex;
/** 移動可能距離. */
int moveDist;
/** 攻撃可能距離. */
int attackDist;
} MapItem;
typedef struct _ActorMapItem : public MapItem {
/** プレイヤーを一意に識別するID. */
int seqNo;
/** 移動済みフラグ. */
bool moveDone;
/** 攻撃済みフラグ. */
bool attackDone;
} ActorMapItem;
typedef struct _DropMapItem : public MapItem {
/** ドロップアイテムを一意に識別するID. */
int seqNo;
/** アイテムID */
int itemId;
} DropMapItem;
class MapManager {
};
#endif //__MapManager_H_
| [
"[email protected]"
] | |
775ee7eecd0ff640d4857c0fca4b8f77e7977857 | 9573913e046fe50b852cf1c7a355b9b10155ed17 | /Semester 3/Struktur Data/Interpolation Search/interpolationSearch.cpp | 68a5f399f413ec5fe40822a63c38920d502d65c3 | [] | no_license | mentadp/tugas-kuliah | 0ba0059863ecf04a53bf3553a36961b4159a71cb | 51eaebf9a3ec89a1e5503e0c2ec8470b89389780 | refs/heads/main | 2023-05-31T06:35:43.019992 | 2023-05-04T13:15:03 | 2023-05-04T13:15:03 | 369,778,078 | 1 | 0 | null | 2021-05-22T10:23:37 | 2021-05-22T10:23:36 | null | UTF-8 | C++ | false | false | 2,342 | cpp | // Taufik Hidayat | 301200032 | Informatika Pagi
#include <iostream>
using namespace std;
void cetakNama() {
printf(
"Nama : Taufik Hidayat\n"
"NIM : 301200032\n"
"Kelas : IF Pagi\n"
"Jenis Program : Interpolation Search\n"
"===========================================\n"
);
}
int inputArray(int array[], int jumlah) {
for(int i = 0; i < jumlah; i++) {
printf("Masukkan data ke - %d: ", i + 1);
cin >> array[i];
}
return array[jumlah];
}
// Taufik Hidayat | 301200032 | Informatika Pagi
int urutkanArray(int sortedArray[], int jumlah) {
int min, temp;
for(int i = 0; i < jumlah - 1; i++) {
min = i;
for(int j = i + 1; j < jumlah; j++)
if (sortedArray[j] < sortedArray[min])
min = j;
temp = sortedArray[i];
sortedArray[i] = sortedArray[min];
sortedArray[min] = temp;
}
return sortedArray[jumlah];
}
int interpolationSearch(int array[], int jumlah, int angkaYangDicari) {
int low = 0,
high = jumlah - 1;
while (low <= high && angkaYangDicari >= array[low] && angkaYangDicari <= array[high]) {
// Taufik Hidayat | 301200032 | Informatika Pagi
if (low == high) {
if (array[low] == angkaYangDicari) return low;
return -1;
}
int pos = low + (((double)(high - low) / (array[high] - array[low])) * (angkaYangDicari - array[low]));
if (array[pos] == angkaYangDicari)
return pos;
if (array[pos] < angkaYangDicari)
low = pos + 1;
else
high = pos - 1;
}
return -1;
}
int main() {
int jumlah,
angkaYangDicari;
cetakNama();
// Taufik Hidayat | 301200032 | Informatika Pagi
printf("Masukkan jumlah data yang akan di-input: ");
cin >> jumlah;
int array[jumlah];
array[jumlah] = inputArray(array, jumlah);
urutkanArray(array, jumlah);
printf("\nArray yang sudah diurutkan:\n[");
for(int i = 0; i < jumlah; i++) {
printf("%d", array[i]);
if(i <= jumlah - 2) printf(", ");
}
printf("]\n");
printf("\nMasukkan angka yang ingin dicari: ");
cin >> angkaYangDicari;
int index = interpolationSearch(array, jumlah, angkaYangDicari);
printf("\nHasil: ");
if (index != -1)
cout << "Data ditemukan pada indeks ke-" << index;
else
cout << "Data tidak ditemukan!";
return 0;
}
// Taufik Hidayat | 301200032 | Informatika Pagi | [
"[email protected]"
] | |
921492c5cf95c4bdc4637c3fa9798e284918d3e2 | 4f823642d0111c1a60ca6fb6afda71b0a625bc97 | /src_tests/arm_neon/test_vhsub.cpp | 4a8a256768ec45cb1994761039733239abafabcc | [
"Apache-2.0"
] | permissive | webstorage119/iris-2 | 9ac5096bbc11c825436ac5ffd5149f063796961f | ba4b20f570d03bf896ad3634e5fbf4a6bf5b02f5 | refs/heads/master | 2022-02-16T05:34:11.465894 | 2019-09-04T20:35:31 | 2019-09-04T20:35:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 829 | cpp | #include <iris/iris.h>
#include <cassert>
using namespace iris;
template<typename T>
void test_vhsub(T(*func)(T,T)) {
T v1, v2;
for(size_t i = 0; i < T::length; i++) {
v1.template at<typename T::elementType>(i) = i;
v2.template at<typename T::elementType>(i) = -i;
}
T result = func(v1,v2);
for(size_t i = 0; i < T::length; i++) {
assert(result.template at<typename T::elementType>(i) == static_cast<typename T::elementType>(i));
}
}
int main() {
test_vhsub(vhsub_s8);
test_vhsub(vhsub_s16);
test_vhsub(vhsub_s32);
test_vhsub(vhsub_u8);
test_vhsub(vhsub_u16);
test_vhsub(vhsub_u32);
test_vhsub(vhsubq_s8);
test_vhsub(vhsubq_s16);
test_vhsub(vhsubq_s32);
test_vhsub(vhsubq_u8);
test_vhsub(vhsubq_u16);
test_vhsub(vhsubq_u32);
}
| [
"[email protected]"
] | |
c74825f530b1cc475d3391e836ad9894e180b366 | 244b4f2d65ac8590a22f870c494dfe16c2ba14c8 | /2579_계단 오르기.cpp | b6d90b180afe8d378cdf8a8a3dd3a1f2b993b613 | [] | no_license | PGENIE/SelfStudy | 6d74859a4b0bcff90600bcf7448f479d3e8cf051 | 9ec9289e49291580f5224de68dcc828cfcd96945 | refs/heads/master | 2021-07-12T02:17:58.408961 | 2020-10-14T13:28:20 | 2020-10-14T13:28:20 | 209,071,490 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 767 | cpp | #include<iostream>
#include<algorithm>
using namespace std;
/*
나(i번째)를 밟는다고 가정
= 한 칸 전에서 왔거나, 두 칸 전에서 왔거나
//한 칸 전에서 왔다면? 연속 세 칸을 밟을 수는 없으므로 얘는 자신으로부터 두 칸 전에서 왔을 것이다.
//따라서
//1. 세칸 전까지 최댓값 + 한칸 전의 값 + 나의 값
//2. 두칸전까지 최댓값 + 나의 값 이 됨.
*/
int dp[301] = { 0 };
int stair[301] = { 0 };
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> stair[i];
}
dp[1] = stair[1];
dp[2] = stair[1] + stair[2];
for (int i = 3; i <= n; i++)
{
dp[i] = max(dp[i - 3] + stair[i - 1] + stair[i], dp[i - 2] + stair[i]);
}
cout << dp[n];
return 0;
} | [
"[email protected]"
] | |
0e14b05450d36def1853e62ab3d00914eae517b2 | 1334014eaeffdde4886da49ce5f387c46a5cc23a | /2020-2/DataStructure/week01/2a_Multicob.cpp | 96a8b376f93f9d165e387e504fbb597f8bbdb325 | [] | no_license | gusah009/Algorithm | a85b1a4526a885b1f809c23c55565f453a5294c4 | 5da952e16a6f90f663706675812f042707aa7280 | refs/heads/main | 2023-07-31T17:28:20.404630 | 2021-09-05T06:14:00 | 2021-09-05T06:14:00 | 357,753,076 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,404 | cpp | #include <iostream>
using namespace std;
#define UP 0
#define DOWN 1
#define RIGHT 2
#define LEFT 3
int K;
int x[51], y[51], C_x[3], C_y[3];
int answer_x, answer_y;
char C_dir[3];
int board[1000][1000][2]; //[0] : 시계방향 , [1] : 반시계방향
int crash[3]; // 01, 12, 20
int T;
void makingBoard(int k)
{
if (x[k-1] == x[k]) {
if (y[k] - y[k-1] > 0) {
for (int i = 0; i < abs(y[k] - y[k-1]); i++) {
board[x[k]][y[k-1] + i][0] = UP;
board[x[k]][y[k-1] + i + 1][1] = DOWN;
}
} else {
for (int i = 0; i < abs(y[k] - y[k-1]); i++) {
board[x[k]][y[k-1] - i][0] = DOWN;
board[x[k]][y[k-1] - i - 1][1] = UP;
}
}
} else if (y[k-1] == y[k]) {
if (x[k] - x[k-1] > 0) {
for (int i = 0; i < abs(x[k] - x[k-1]); i++) {
board[x[k-1] + i][y[k-1]][0] = RIGHT;
board[x[k-1] + i + 1][y[k-1]][1] = LEFT;
}
} else {
for (int i = 0; i < abs(x[k] - x[k-1]); i++) {
board[x[k-1] - i][y[k-1]][0] = LEFT;
board[x[k-1] - i - 1][y[k-1]][1] = RIGHT;
}
}
}
}
bool crashCheck1(int robot1, int robot2)
{
if (C_dir[robot1] != C_dir[robot2]) {
int next1[2];
int d = C_dir[robot1] == '+' ? 0 : 1;
switch(board[C_x[robot1]][C_y[robot1]][d]) {
case UP:
next1[0] = C_x[robot1];
next1[1] = C_y[robot1] + 1;
break;
case DOWN:
next1[0] = C_x[robot1];
next1[1] = C_y[robot1] - 1;
break;
case LEFT:
next1[0] = C_x[robot1] - 1;
next1[1] = C_y[robot1];
break;
case RIGHT:
next1[0] = C_x[robot1] + 1;
next1[1] = C_y[robot1];
break;
}
if (next1[0] == C_x[robot2] && next1[1] == C_y[robot2]) {
return true;
}
}
return false;
}
bool crashCheck2(int robot1, int robot2)
{
if (C_x[robot1] == C_x[robot2] && C_y[robot1] == C_y[robot2]) {
return true;
}
return false;
}
void moving(int robot)
{
int d = C_dir[robot] == '+' ? 0 : 1;
switch(board[C_x[robot]][C_y[robot]][d]) {
case UP:
C_y[robot]++;
break;
case DOWN:
C_y[robot]--;
break;
case LEFT:
C_x[robot]--;
break;
case RIGHT:
C_x[robot]++;
break;
}
}
int main()
{
cin >> K;
cin >> x[0] >> y[0];
for (int k = 1; k <= K; k++) {
if (k != K) {
cin >> x[k] >> y[k];
} else {
x[K] = x[0];
y[K] = y[0];
}
makingBoard(k);
}
for (int c = 0; c < 3; c++) {
cin >> C_x[c] >> C_y[c] >> C_dir[c];
}
cin >> T;
for (int t = 0; t < T; t++) {
for (int i = 0; i < 3; i++) {
if (crashCheck1(i, (i+1)%3)) { // 둘이 1번경우에서 부딪혔다면
C_dir[i] = C_dir[i] == '+' ? '-' : '+';
C_dir[(i+1)%3] = C_dir[(i+1)%3] == '+' ? '-' : '+';
crash[i] = 1;
crash[(i+1)%3] = 1;
} else if (crashCheck2(i, (i+1)%3)) { // 둘이 2번경우에서 부딪혔다면
C_dir[i] = C_dir[i] == '+' ? '-' : '+';
C_dir[(i+1)%3] = C_dir[(i+1)%3] == '+' ? '-' : '+';
} else { // 안부딪혔다면
}
}
for (int i = 0; i < 3; i++) {
if (crash[i] != 1) {
moving(i);
}
crash[i] = 0;
}
cout << "t: " << t << "\n";
for (int i = 0; i < 3; i++) {
cout << C_x[i] << " " << C_y[i] << "\n";
}
}
for (int i = 0; i < 3; i++) {
cout << C_x[i] << " " << C_y[i] << "\n";
}
} | [
"[email protected]"
] | |
1b51255deb31792d17f3a8b22f0e0402e8979d2d | 326618d336b2ec6857c928dffa9272ad110413f5 | /Hashing/Hash.h | 1752be9f11e98a48824b9b5e0fbc79091018da20 | [] | no_license | tyler-baker/My-Projects | 0d445b3d580cf63313e93cb1b1f275030929e7d1 | 1cc73c4b20aa0ed09ff10eec76eb2617db12421f | refs/heads/master | 2021-01-10T02:26:53.996463 | 2015-06-01T23:08:30 | 2015-06-01T23:08:30 | 36,546,279 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,514 | h | // Tyler Baker
// Hash.h
// Test
#ifndef __hashlab__Hash__
#define __hashlab__Hash__
#include <iostream>
using namespace std;
template <class TYPE> class HashEntry
{
private:
TYPE key;
TYPE value;
public:
HashEntry(TYPE key, TYPE value)
{
this->key = key;
this->value = value;
}
TYPE getKey()
{
return key;
}
TYPE getValue()
{
return value;
}
};
template <class TYPE> class HashMap
{
private:
HashEntry <TYPE> **table;
int TABLE_SIZE;
int numPuts;
int hash(int key);
public:
HashMap(const int size)
: TABLE_SIZE(size)
{
numPuts = 0;
table = new HashEntry<TYPE>*[TABLE_SIZE];
for (int i = 0; i < TABLE_SIZE; i++)
table[i] = nullptr;
}
TYPE get(int key);
void put(int key, TYPE value);
~HashMap()
{
for (int i = 0; i < TABLE_SIZE; i++)
if (table[i] != nullptr)
delete table[i];
delete[] table;
}
};
template <class TYPE>
TYPE HashMap<TYPE>::get(int key)
{
int index = hash(key);
const int start = index;
if(index >= 0 && index <= TABLE_SIZE){
if(table[index] != nullptr && table[index]->getKey() == key)
return table[index]->getValue();
else{
while(index < TABLE_SIZE){
index++;
if(table[index] != nullptr && table[index]->getKey() == key)
return table[index]->getValue();
}
index = 0;
while(index < start){
if(table[index] != nullptr && table[index]->getKey() == key)
return table[index]->getKey();
index++;
}
}
}
return -1;
}
template <class TYPE>
void HashMap<TYPE>::put(int key, TYPE value)
{
int index = hash(key);
const int start = index;
HashEntry <TYPE>* tempPtr = new HashEntry <TYPE> (key,value);
if(numPuts < TABLE_SIZE){
if(table[index] == nullptr){
table[index] = tempPtr;
numPuts++;
}
else{
if(table[index]->getKey() == key)
table[index] = tempPtr;
else{
index++;
while(table[index] != nullptr && index < TABLE_SIZE
&& table[index]->getKey() != key)
index++;
if(table[index] == nullptr){
table[index] = tempPtr;
numPuts++;
}
else if(table[index]->getKey() == key)
table[index] = tempPtr;
else{
index = 0;
while(table[index] != nullptr && index < start)
index++;
if(table[index] == nullptr){
table[index] = tempPtr;
numPuts++;
}
}
}
}
}
else
cout << endl << endl << "Sorry, the table is completely full." << endl;
}
template <class TYPE>
int HashMap<TYPE>::hash(int key){
return key % TABLE_SIZE;
}
#endif /* defined(__hashlab__Hash__) */
| [
"[email protected]"
] | |
4b8f9ef8e0e97f670d008ebc0b3d3e764cb49894 | d0c44dd3da2ef8c0ff835982a437946cbf4d2940 | /cmake-build-debug/programs_tiling/function14659/function14659_schedule_2/function14659_schedule_2.cpp | b7bfd6353d8b945f12bfb2a6637bc2de24916f38 | [] | no_license | IsraMekki/tiramisu_code_generator | 8b3f1d63cff62ba9f5242c019058d5a3119184a3 | 5a259d8e244af452e5301126683fa4320c2047a3 | refs/heads/master | 2020-04-29T17:27:57.987172 | 2019-04-23T16:50:32 | 2019-04-23T16:50:32 | 176,297,755 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 913 | cpp | #include <tiramisu/tiramisu.h>
using namespace tiramisu;
int main(int argc, char **argv){
tiramisu::init("function14659_schedule_2");
constant c0("c0", 4096), c1("c1", 16384);
var i0("i0", 0, c0), i1("i1", 0, c1), i100("i100", 1, c0 - 1), i101("i101", 1, c1 - 1), i01("i01"), i02("i02"), i03("i03"), i04("i04");
input input0("input0", {i0, i1}, p_int32);
computation comp0("comp0", {i100, i101}, (input0(i100, i101) - input0(i100 + 1, i101) + input0(i100 - 1, i101)));
comp0.tile(i100, i101, 32, 128, i01, i02, i03, i04);
comp0.parallelize(i01);
buffer buf00("buf00", {4096, 16384}, p_int32, a_input);
buffer buf0("buf0", {4096, 16384}, p_int32, a_output);
input0.store_in(&buf00);
comp0.store_in(&buf0);
tiramisu::codegen({&buf00, &buf0}, "../data/programs/function14659/function14659_schedule_2/function14659_schedule_2.o");
return 0;
} | [
"[email protected]"
] | |
24df1b7ee694ff67598f732241ba4e437bf19f9e | 423acf0de71a2a6be96b52dec91f8484e7b4990e | /src/SpecialFunctions.cpp | d73c151127d6d60a13692c081ffbeb91e7001499 | [] | no_license | cran/NPBayesImputeCat | 0a7bb36a5eb0ca56ae516a558077611576e57d00 | 1f7f89a1076edc4dfc10a31543c9e42277a7554b | refs/heads/master | 2022-10-14T10:42:56.975697 | 2022-10-03T12:30:02 | 2022-10-03T12:30:02 | 158,117,009 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,720 | cpp | /*
* Copyright (C) 2018 Quanli Wang
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
//#include "stdafx.h"
#include "SpecialFunctions.h"
#include <cmath>
#include <cerrno>
SpecialFunctions::SpecialFunctions(void)
{
}
SpecialFunctions::~SpecialFunctions(void)
{
}
double SpecialFunctions::gammaln(double x)
{
double d1 = -5.772156649015328605195174e-1;
double p1[] = {4.945235359296727046734888e0, 2.018112620856775083915565e2,
2.290838373831346393026739e3, 1.131967205903380828685045e4,
2.855724635671635335736389e4, 3.848496228443793359990269e4,
2.637748787624195437963534e4, 7.225813979700288197698961e3};
double q1[] = {6.748212550303777196073036e1, 1.113332393857199323513008e3,
7.738757056935398733233834e3, 2.763987074403340708898585e4,
5.499310206226157329794414e4, 6.161122180066002127833352e4,
3.635127591501940507276287e4, 8.785536302431013170870835e3};
double d2 = 4.227843350984671393993777e-1;
double p2[] = {4.974607845568932035012064e0, 5.424138599891070494101986e2,
1.550693864978364947665077e4, 1.847932904445632425417223e5,
1.088204769468828767498470e6, 3.338152967987029735917223e6,
5.106661678927352456275255e6, 3.074109054850539556250927e6};
double q2[] = {1.830328399370592604055942e2, 7.765049321445005871323047e3,
1.331903827966074194402448e5, 1.136705821321969608938755e6,
5.267964117437946917577538e6, 1.346701454311101692290052e7,
1.782736530353274213975932e7, 9.533095591844353613395747e6};
double d4 = 1.791759469228055000094023e0;
double p4[] = {1.474502166059939948905062e4, 2.426813369486704502836312e6,
1.214755574045093227939592e8, 2.663432449630976949898078e9,
2.940378956634553899906876e10, 1.702665737765398868392998e11,
4.926125793377430887588120e11, 5.606251856223951465078242e11};
double q4[] = {2.690530175870899333379843e3, 6.393885654300092398984238e5,
4.135599930241388052042842e7, 1.120872109616147941376570e9,
1.488613728678813811542398e10, 1.016803586272438228077304e11,
3.417476345507377132798597e11, 4.463158187419713286462081e11};
double c[] = {-1.910444077728e-03, 8.4171387781295e-04,
-5.952379913043012e-04, 7.93650793500350248e-04,
-2.777777777777681622553e-03, 8.333333333333333331554247e-02,
5.7083835261e-03};
if ( (x > 0) && (x <= 2.2204e-016)) { //x < eps
return -log(x);
} else if ((x > 2.2204e-016) && ( x <= 0.5)) {
double xden = 1;
double xnum = 0;
for (int i = 0; i < 8; i++) {
xnum = xnum * x + p1[i];
xden = xden * x + q1[i];
}
return -log(x) + (x * (d1 + x * (xnum / xden)));
} else if((x > 0.5) && (x <= 0.6796875)) {
double xm1 = (x - 0.5) - 0.5;
double xden = 1;
double xnum = 0;
for (int i = 0; i < 8; i++) {
xnum = xnum * xm1 + p2[i];
xden = xden * xm1 + q2[i];
}
return -log(x) + xm1 * (d2 + xm1 * (xnum / xden));
} else if ((x > 0.6796875) && (x <= 1.5)) {
double xm1 = (x - 0.5) - 0.5;
double xden = 1;
double xnum = 0;
for (int i = 0; i < 8; i++) {
xnum = xnum * xm1 + p1[i];
xden = xden * xm1 + q1[i];
}
return xm1 * (d1 + xm1 * (xnum / xden));
} else if ((x > 1.5) && (x <= 4)) {
double xm2 = x - 2;
double xden = 1;
double xnum = 0;
for (int i = 0; i < 8; i++) {
xnum = xnum * xm2 + p2[i];
xden = xden * xm2 + q2[i];
}
return xm2 * (d2 + xm2 * (xnum / xden));
} else if ((x > 4) && (x <= 12)) {
double xm4 = x - 4;
double xden = -1;
double xnum = 0;
for (int i = 0; i < 8; i++) {
xnum = xnum * xm4 + p4[i];
xden = xden * xm4 + q4[i];
}
return d4 + xm4 * (xnum / xden);
} else {
double r = c[6];
double ysq = x * x;
for (int i = 0; i < 6; i++) {
r = r / ysq + c[i];
}
r = r / x;
double corr = log(x);
double spi = 0.9189385332046727417803297;
return r + spi - 0.5 * corr + x * ( corr - 1);
}
}
double SpecialFunctions::betaln(double x, double y)
{
return gammaln(x) + gammaln(y) - gammaln(x + y);
}
/*
* The standard normal CDF, for one random variable.
*
* Author: W. J. Cody
* URL: http://www.netlib.org/specfun/erf
*
* This is the erfc() routine only, adapted by the
* transform stdnormal_cdf(u)=(erfc(-u/sqrt(2))/2;
*/
double SpecialFunctions::normcdf(double u) {
static const double SQRT2 = 1.414213562;
static const double a[5] = {
1.161110663653770e-002,3.951404679838207e-001,2.846603853776254e+001,
1.887426188426510e+002,3.209377589138469e+003
};
static const double b[5] = {
1.767766952966369e-001,8.344316438579620e+000,1.725514762600375e+002,
1.813893686502485e+003,8.044716608901563e+003
};
static const double c[9] = {
2.15311535474403846e-8,5.64188496988670089e-1,8.88314979438837594e00,
6.61191906371416295e01,2.98635138197400131e02,8.81952221241769090e02,
1.71204761263407058e03,2.05107837782607147e03,1.23033935479799725E03
};
static const double d[9] = {
1.00000000000000000e00,1.57449261107098347e01,1.17693950891312499e02,
5.37181101862009858e02,1.62138957456669019e03,3.29079923573345963e03,
4.36261909014324716e03,3.43936767414372164e03,1.23033935480374942e03
};
static const double p[6] = {
1.63153871373020978e-2,3.05326634961232344e-1,3.60344899949804439e-1,
1.25781726111229246e-1,1.60837851487422766e-2,6.58749161529837803e-4
};
static const double q[6] = {
1.00000000000000000e00,2.56852019228982242e00,1.87295284992346047e00,
5.27905102951428412e-1,6.05183413124413191e-2,2.33520497626869185e-3
};
double y, z;
y = fabs(u);
if (y <= 0.46875*SQRT2) {
/* evaluate erf() for |u| <= sqrt(2)*0.46875 */
z = y*y;
y = u*((((a[0]*z+a[1])*z+a[2])*z+a[3])*z+a[4])
/((((b[0]*z+b[1])*z+b[2])*z+b[3])*z+b[4]);
return 0.5+y;
}
z = exp(-y*y/2)/2;
if (y <= 4.0) {
/* evaluate erfc() for sqrt(2)*0.46875 <= |u| <= sqrt(2)*4.0 */
y = y/SQRT2;
y = ((((((((c[0]*y+c[1])*y+c[2])*y+c[3])*y+c[4])*y+c[5])*y+c[6])*y+c[7])*y+c[8])
/((((((((d[0]*y+d[1])*y+d[2])*y+d[3])*y+d[4])*y+d[5])*y+d[6])*y+d[7])*y+d[8]);
y = z*y;
} else {
/* evaluate erfc() for |u| > sqrt(2)*4.0 */
z = z*SQRT2/y;
y = 2/(y*y);
y = y*(((((p[0]*y+p[1])*y+p[2])*y+p[3])*y+p[4])*y+p[5])
/(((((q[0]*y+q[1])*y+q[2])*y+q[3])*y+q[4])*y+q[5]);
y = z*(1/sqrt(3.1415926535)-y);
}
return (u < 0.0 ? y : 1-y);
}
//Inverse stdnorm cdf
double SpecialFunctions::norminv(double p)
{
/* Coefficients in rational approximations. */
static const double LOW = 0.02425;
static const double HIGH = 0.97575;
static const double a[] =
{
-3.969683028665376e+01,
2.209460984245205e+02,
-2.759285104469687e+02,
1.383577518672690e+02,
-3.066479806614716e+01,
2.506628277459239e+00
};
static const double b[] =
{
-5.447609879822406e+01,
1.615858368580409e+02,
-1.556989798598866e+02,
6.680131188771972e+01,
-1.328068155288572e+01
};
static const double c[] =
{
-7.784894002430293e-03,
-3.223964580411365e-01,
-2.400758277161838e+00,
-2.549732539343734e+00,
4.374664141464968e+00,
2.938163982698783e+00
};
static const double d[] =
{
7.784695709041462e-03,
3.224671290700398e-01,
2.445134137142996e+00,
3.754408661907416e+00
};
double q, r;
errno = 0;
if (p < 0 || p > 1)
{
errno = EDOM;
return 0.0;
}
else if (p == 0)
{
errno = ERANGE;
return -HUGE_VAL /* minus "infinity" */;
}
else if (p == 1)
{
errno = ERANGE;
return HUGE_VAL /* "infinity" */;
}
else if (p < LOW)
{
/* Rational approximation for lower region */
q = sqrt(-2*log(p));
return (((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /
((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1);
}
else if (p > HIGH)
{
/* Rational approximation for upper region */
q = sqrt(-2*log(1-p));
return -(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /
((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1);
}
else
{
/* Rational approximation for central region */
q = p - 0.5;
r = q*q;
return (((((a[0]*r+a[1])*r+a[2])*r+a[3])*r+a[4])*r+a[5])*q /
(((((b[0]*r+b[1])*r+b[2])*r+b[3])*r+b[4])*r+1);
}
}
void SpecialFunctions::cmpower2(int nSize, double *px, double* py, double* pResult) {
for (int i = 0; i < nSize; i++) {
pResult[i] = pow(px[i], py[i]);
}
}
void SpecialFunctions::cmrand(int nSize, MTRand& mt, double* pResult)
{
for (int i = 0; i < nSize; i++) {
pResult[i] = 1- mt.randExc(); //a number in (0,1];
}
}
bool SpecialFunctions::gammarand(double a, double b, int nSize, MTRand& mt, vector<double>& result)
{
result.clear();
//Return false if a or b is not positive.
if ((a <= 0) || (b <= 0) || (nSize < 1)) return false;
//If a == 1, then gamma is exponential. (Devroye, page 405).
if (a == 1) {
double * pRand = new double[nSize];
cmrand(nSize,mt,pRand);
for (int i = 0; i < nSize; i++) {
result.push_back(-b * log(pRand[i]));
}
delete [] pRand;
pRand = NULL;
}
//common working variables
double *pU = new double[nSize];
double *pV = new double[nSize];
double *pX = new double[nSize];
double *pY = new double[nSize];
//Devroye, page 418 Johnk's generator
if ((a < 1) && (a > 0)) {
double c = 1.0 / a;
double d = 1.0 / (1 - a);
double *pC = new double[nSize];
double *pD = new double[nSize];
int i;
for (i = 0; i < nSize; i++) {
pC[i] = c;
pD[i] = d;
}
int nRemain = nSize;
while (nRemain) {
cmrand(nRemain,mt, pU);
cmrand(nRemain,mt, pV);
cmpower2(nRemain, pU, pC, pX);
cmpower2(nRemain, pV, pD, pY);
int nAccept = 0;
for (i = 0; i < nRemain; i++) {
if (pX[i] + pY[i] <= 1.0) {
pX[nAccept] = pX[i];
pY[nAccept] = pY[i];
nAccept++;
}
}
if (nAccept) {
double *pE = new double[nAccept];
cmrand(nAccept, mt,pE);
for (i = 0; i < nAccept; i++) {
pE[i] = -log(pE[i]);
result.push_back(b * pE[i] * pX[i] / (pX[i] + pY[i]));
nRemain--;
}
delete [] pE;
pE = NULL;
}
}
delete [] pC;
pC = NULL;
delete [] pD;
pD = NULL;
}
//Use a rejection method for a > 1
//Devroye, page 410 Best's algorithm
if (a > 1) {
double bb = a - 1;
double c = 3 * a - 0.75;
int nRemain = nSize;
double *pZ = new double[nSize];
double *pW = new double[nSize];
while (nRemain) {
cmrand(nRemain, mt,pU);
cmrand(nRemain, mt,pV);
int i;
for (i = 0; i < nRemain; i++) {
pW[i] = pU[i] * (1 - pU[i]);
pY[i] = sqrt(c/ pW[i]) * (pU[i] - 0.5);
pX[i] = bb + pY[i];
pZ[i] = 64 * pW[i] * pW[i] * pW[i] * pV[i] * pV[i];
}
int nAccept = 0;
for (i = 0; i < nRemain; i++) {
if (pX[i] >=0) {
pU[nAccept] = pU[i];
pV[nAccept] = pV[i];
pW[nAccept] = pW[i];
pZ[nAccept] = pZ[i];
pX[nAccept] = pX[i];
pY[nAccept] = pY[i];
nAccept++;
}
}
if (nAccept) {
for (int i = 0; i < nAccept; i++) {
if (pZ[i] <= (1.0 - 2.0 * pY[i] * pY[i] / pX[i])) {
result.push_back(b * pX[i]);
nRemain--;
} else {
if (log(pZ[i])<= 2 * (bb * log(pX[i] / bb) - pY[i])) {
result.push_back(b * pX[i]);
nRemain--;
}
}
}
}
}
delete [] pZ;
pZ = NULL;
delete [] pW;
pW = NULL;
}
delete [] pX;
pX = NULL;
delete [] pY;
pY = NULL;
delete [] pU;
pU = NULL;
delete [] pV;
pV = NULL;
return true;
}
double SpecialFunctions::chi2rand(double a, MTRand& mt) {
return gammarand(a/2,2,mt);
}
double SpecialFunctions::gammarand(double a, double b, MTRand& mt)
{
//Return -1 if a or b is not positive.
if ((a <= 0) || (b <= 0)) return -1.0;
//If a == 1, then gamma is exponential. (Devroye, page 405).
if (a == 1) {
return -b * log(1 - mt.randExc());
}
//Devroye, page 418 Johnk's generator
if ((a < 1) && (a > 0)) {
double c = 1.0 / a;
double d = 1.0 / (1 - a);
while (1) {
double dX = pow(1-mt.randExc(), c);
double dY = pow(1-mt.randExc(), d);
if (dX + dY <= 1.0) {
double dE = -log(1 - mt.randExc());
return b * dE * dX / (dX + dY );
}
}
}
//Use a rejection method for a > 1
//Devroye, page 410 Best's algorithm
if (a > 1) {
double bb = a - 1;
double c = 3 * a - 0.75;
while (1) {
double dU = 1-mt.randExc();
double dV = 1-mt.randExc();
double dW = dU * (1 - dU);
double dY = sqrt(c / dW) * (dU - 0.5);
double dX = bb + dY;
if (dX >=0) {
double dZ = 64 * dW * dW * dW * dV * dV;
if (dZ <= (1.0 - 2.0 * dY * dY / dX)) {
return b * dX;
} else {
if (log(dZ)<= 2 * (bb * log(dX / bb) - dY)) {
return b * dX;
}
}
}
}
}
return -1.0;
}
bool SpecialFunctions::betarand(double a, double b, int nSize, MTRand& mt, vector<double>& result)
{
result.clear();
if ((a <= 0) || (b <= 0) || (nSize < 1)) return false;
vector<double> ra, rb;
if (!gammarand(a, 1, nSize,mt, ra)) return false;
if (!gammarand(b, 1, nSize, mt, rb)) return false;
for (int i = 0; i < nSize; i++) {
result.push_back(ra[i] / (ra[i] + rb[i]));
}
return true;
}
double SpecialFunctions::betarand(double a, double b, MTRand& mt)
{
if ((a <= 0) || (b <= 0)) return -1.0;
double ra = gammarand(a, 1, mt);
double rb = gammarand(b, 1, mt);
return ra / (ra + rb);
}
double SpecialFunctions::betapdf(double x, double a, double b, int logspace)
{
double d = 0;
d = gammaln(a+b) - gammaln(a) - gammaln(b) + (a-1)*log(x)+(b-1)*log(1-x);
if(!logspace)
d = exp(d);
return d;
}
double SpecialFunctions::gammainc(double x, double a)
{
if (x <= 0 || a <= 0) return 0.0;
double amax = 1048576.0; //2^20;
if (a > amax) //Approximation for a > amax. Accurate to about 5.e-5.
{
double onethird = 1.0 / 3.0;
x = amax - onethird + sqrt(amax/a)*(x-(a-onethird));
if (x<0) return 0.0;
a = amax;
}
double eps = 2.2204e-014; //2^(-52) * 100;
//Series expansion for x < a+ 1
if (x < a + 1)
{
double ap = a;
double del = 1.0;
double sum = 1.0;
while ( del >= eps * sum)
{
ap += 1.0;
del *= x / ap;
sum += del;
}
return sum * exp(-x + a * log(x)-gammaln(a+1));
} else {
double a0 = 1.0;
double a1 = x;
double b0 = 0.0;
double b1 = 1.0;
double fac = 1.0 / a1;
double n = 1;
double g = b1 * fac;
double gold = b0;
while ( fabs(g-gold) >= eps * fabs(g))
{
gold = g;
double ana = n - a;
a0 = ( a1 + a0 * ana) * fac;
b0 = ( b1 + b0 * ana) * fac;
double anf = n * fac;
a1 = x * a0 + anf * a1;
b1 = x * b0 + anf * b1;
fac = 1 / a1;
g = b1 * fac;
n += 1;
}
return 1.0 - exp(-x + a * log(x) - gammaln(a)) * g;
}
}
double SpecialFunctions::gammacdf(double x,double a, double b)
{
if (x < 0) return 0.0;
return gammainc(x / b, a);
}
double SpecialFunctions::gammapdf(double x,double a, double b)
{
double z = x / b;
double u = (a - 1) * log(z) - z - gammaln(a);
return (exp(u) / b);
}
double SpecialFunctions::gammainv(double p,double a, double b)
{
if (p <=0) return 0.0;
if (a <=0) return 0.0;
// ==== Newton's Method to find a root of GAMCDF(X,A,B) = P ====
// Choose a starting guess for q. Use quantiles from a lognormal
// distribution with the same mean (==a) and variance (==a) as G(a,1).
double loga = log(a);
double sigsq = log(1+a) - loga;
double mu = loga - 0.5 * sigsq;
//double q = exp(mu - sqrt(2*sigsq)*erfcinv(2*p)); //original implementation
double q = exp(mu + sqrt(sigsq)*norminv(p));
//Limit the number of iterations.
int maxiter = 500;
double reltol = 1.8190e-012; //eps(class(q)).^(3/4);
double F = gammacdf(q,a,1.0);
double dF = F - p;
for (int iter = 0; iter < maxiter; iter++) {
// Compute the Newton step, but limit its size to prevent stepping to
// negative or infinite values.
double f = gammapdf(q,a,1);
double h = dF / f;
//Avoid taking too large of a step
double qnew = 10 * q;
if (q-h < qnew) {qnew = q-h;}
if (q / 10 > qnew) { qnew = q / 10;}
// Break out of the iteration loop when the relative size of the last step
// is small for all elements of q.
if (fabs(h) <= reltol*q) {
q = qnew;
break;
} else {
// Check the error, and backstep for those elements whose error did not
// decrease. The direction of h is always correct, because f > 0
double dFold = dF;
for (int j = 0; j < 25; j++) {
F = gammacdf(qnew,a,1.0);
dF = F - p;
if (fabs(dF) <= fabs(dFold)) {
break;
} else {
qnew = (q + qnew)/2;
}
}
}
q = qnew;
}
// Add in the scale factor
return q * b;
}
unsigned int SpecialFunctions::binorand(int n, double p, MTRand& mt) {
//when n is large
unsigned int a, b, k = 0;
while (n > 10) {
double X;
a = 1 + (n / 2);
b = 1 + n - a;
X = betarand((double)a, (double)b, mt);
if (X >= p) {
n = a - 1;
p /= X;
} else {
k += a;
n = b - 1;
p = (p - X) / (1.0 - X);
}
}
for (int i=0; i < n; i++) {
if (mt() < p) k++;
}
return k;
}
#if !defined(M_PI)
#define M_PI 3.141592653989793
#endif
double SpecialFunctions::gammarand_int(unsigned int a, MTRand& mt) {
if (a < 12) {
unsigned int i;
double prod = 1.0;
for (i = 0; i < a; i++) {
prod *= mt.randDblExc();
}
return -log (prod);
} else {
/* Works only if a > 1, and is most efficient if a is large
This algorithm, reported in Knuth, is attributed to Ahrens. A
faster one, we are told, can be found in: J. H. Ahrens and
U. Dieter, Computing 12 (1974) 223-246. */
double sqa, x, y, v;
double da = (double)a;
sqa = sqrt(2.0 * da - 1.0);
do {
do {
y = tan (M_PI * mt.randExc());
x = sqa * y + da - 1.0;
}
while (x <= 0);
v = mt.randExc();
} while (v > (1.0 + y * y) * exp ((a - 1.0) * log (x / (a - 1.0)) - sqa * y));
return x;
}
}
unsigned int SpecialFunctions::poissonrand(double mu, MTRand& mt) {
double emu;
double prod = 1.0;
unsigned int k = 0;
while (mu > 10.0) {
unsigned int m = mu * (7.0 / 8.0);
double X = gammarand_int(m,mt);
if (X >= mu) {
return k + binorand(m-1, mu / X,mt);
} else {
k += m;
mu -= X;
}
}
/* This following method works well when mu is small */
emu = exp(-mu);
do {
prod *= mt.randExc();
k++;
} while (prod > emu);
return k - 1;
}
/* The negative binomial distribution has the form,
prob(k) = Gamma(n + k)/(Gamma(n) Gamma(k + 1)) p^n (1-p)^k
for k = 0, 1, ... . Note that n does not have to be an integer.
This is the Leger's algorithm (given in the answers in Knuth) */
unsigned int SpecialFunctions:: negative_binomial_rand (double p, double n, MTRand& mt) {
double X = gammarand(n,1.0,mt);
double r = X * (1.0 - p) / p;
unsigned int k = poissonrand(r,mt) ;
return k;
}
double SpecialFunctions::log_sum(double a, double b){
return a < b ? b + log(1.0 + exp(a - b)) : a + log(1.0+exp(b - a));
}
double SpecialFunctions::log_gamma_rand(double shape, MTRand& mt){
//function to sample from loggamma (shape = alpha, scale = 1)
// for small values of shape uses the method from p.45 of RObert & Casella (2002)
return (
(shape < 0.5) ?
log(mt.randExc())/shape + log(gammarand(1.0 + shape, 1.0,mt))
: log(gammarand(shape, 1.0,mt))
);
}
void SpecialFunctions::multinomialrand (unsigned int K, unsigned int N, double *p, unsigned int *n, MTRand& mt) {
unsigned int k;
double norm = 0.0;
double sum_p = 0.0;
unsigned int sum_n = 0;
/* p[k] may contain non-negative weights that do not sum to 1.0.
* Even a probability distribution will not exactly sum to 1.0
* due to rounding errors.
*/
for (k = 0; k < K; k++) {
norm += p[k];
}
for (k = 0; k < K; k++) {
if (p[k] > 0.0) {
n[k] = binorand(N - sum_n, p[k] /(norm - sum_p),mt);
} else {
n[k] = 0;
}
sum_p += p[k];
sum_n += n[k];
}
}
int SpecialFunctions::discreterand_norm(int K, double *p, double norm, MTRand& mt){
double u = mt.randExc() * norm; //a number between 0 and norm.
int k=0;
double cum = p[0];
while(u > cum){
cum += p[++k];
}
return k;
}
int SpecialFunctions::discreterand(int K, double *p, MTRand& mt){
double norm = 0.0;
for (int k = 0; k < K; ++k) norm += p[k];
return discreterand_norm(K,p,norm,mt);
}
| [
"[email protected]"
] | |
924d2e45283466f95e8d15d7d586344f2823ca58 | b33a9177edaaf6bf185ef20bf87d36eada719d4f | /qtbase/src/tools/uic/cpp/cppwritedeclaration.cpp | 38047fd5930b3d3205fca01bd8b9941c2933a8ab | [
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-commercial-license",
"LGPL-2.0-or-later",
"LGPL-2.1-only",
"GFDL-1.3-only",
"LicenseRef-scancode-qt-commercial-1.1",
"LGPL-3.0-only",
"LicenseRef-scancode-qt-company-exception-lgpl-2.1",
"GPL-1.0-or-later",
"GPL-3.0-only",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"GPL-2.0-only",
"Qt-LGPL-exception-1.1",
"LicenseRef-scancode-digia-qt-preview",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-generic-exception"
] | permissive | wgnet/wds_qt | ab8c093b8c6eead9adf4057d843e00f04915d987 | 8db722fd367d2d0744decf99ac7bafaba8b8a3d3 | refs/heads/master | 2021-04-02T11:07:10.181067 | 2020-06-02T10:29:03 | 2020-06-02T10:34:19 | 248,267,925 | 1 | 0 | Apache-2.0 | 2020-04-30T12:16:53 | 2020-03-18T15:20:38 | null | UTF-8 | C++ | false | false | 10,149 | cpp | /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "cppwritedeclaration.h"
#include "cppwriteicondeclaration.h"
#include "cppwriteinitialization.h"
#include "cppwriteiconinitialization.h"
#include "cppextractimages.h"
#include "driver.h"
#include "ui4.h"
#include "uic.h"
#include "databaseinfo.h"
#include "customwidgetsinfo.h"
#include <qtextstream.h>
#include <qdebug.h>
QT_BEGIN_NAMESPACE
namespace {
void openNameSpaces(const QStringList &namespaceList, QTextStream &output) {
if (namespaceList.empty())
return;
const QStringList::const_iterator cend = namespaceList.constEnd();
for (QStringList::const_iterator it = namespaceList.constBegin(); it != cend; ++it) {
if (!it->isEmpty()) {
output << "namespace " << *it << " {\n";
}
}
}
void closeNameSpaces(const QStringList &namespaceList, QTextStream &output) {
if (namespaceList.empty())
return;
QListIterator<QString> it(namespaceList);
it.toBack();
while (it.hasPrevious()) {
const QString ns = it.previous();
if (!ns.isEmpty()) {
output << "} // namespace " << ns << "\n";
}
}
}
void writeScriptContextClass(const QString &indent, QTextStream &str) {
str << indent << "class ScriptContext\n"
<< indent << "{\n"
<< indent << "public:\n"
<< indent << " void run(const QString &script, QWidget *widget, const QWidgetList &childWidgets)\n"
<< indent << " {\n"
<< indent << " QScriptValue widgetObject = scriptEngine.newQObject(widget);\n"
<< indent << " QScriptValue childWidgetArray = scriptEngine.newArray (childWidgets.size());\n"
<< indent << " for (int i = 0; i < childWidgets.size(); i++)\n"
<< indent << " childWidgetArray.setProperty(i, scriptEngine.newQObject(childWidgets[i]));\n"
<< indent << " QScriptContext *ctx = scriptEngine.pushContext();\n"
<< indent << " ctx ->activationObject().setProperty(QLatin1String(\"widget\"), widgetObject);\n"
<< indent << " ctx ->activationObject().setProperty(QLatin1String(\"childWidgets\"), childWidgetArray);\n\n"
<< indent << " scriptEngine.evaluate(script);\n"
<< indent << " if (scriptEngine.hasUncaughtException ()) {\n"
<< indent << " qWarning() << \"An exception occurred at line \" << scriptEngine.uncaughtExceptionLineNumber()\n"
<< indent << " << \" of the script for \" << widget->objectName() << \": \" << engineError() << '\\n'\n"
<< indent << " << script;\n"
<< indent << " }\n\n"
<< indent << " scriptEngine.popContext();\n"
<< indent << " }\n\n"
<< indent << "private:\n"
<< indent << " QString engineError()\n"
<< indent << " {\n"
<< indent << " QScriptValue error = scriptEngine.evaluate(\"Error\");\n"
<< indent << " return error.toString();\n"
<< indent << " }\n\n"
<< indent << " QScriptEngine scriptEngine;\n"
<< indent << "};\n\n";
}
}
namespace CPP {
WriteDeclaration::WriteDeclaration(Uic *uic, bool activateScripts) :
m_uic(uic),
m_driver(uic->driver()),
m_output(uic->output()),
m_option(uic->option()),
m_activateScripts(activateScripts)
{
}
void WriteDeclaration::acceptUI(DomUI *node)
{
QString qualifiedClassName = node->elementClass() + m_option.postfix;
QString className = qualifiedClassName;
QString varName = m_driver->findOrInsertWidget(node->elementWidget());
QString widgetClassName = node->elementWidget()->attributeClass();
QString exportMacro = node->elementExportMacro();
if (!exportMacro.isEmpty())
exportMacro.append(QLatin1Char(' '));
QStringList namespaceList = qualifiedClassName.split(QLatin1String("::"));
if (namespaceList.count()) {
className = namespaceList.last();
namespaceList.removeLast();
}
// This is a bit of the hack but covers the cases Qt in/without namespaces
// and User defined classes in/without namespaces. The "strange" case
// is a User using Qt-in-namespace having his own classes not in a namespace.
// In this case the generated Ui helper classes will also end up in
// the Qt namespace (which is harmless, but not "pretty")
const bool needsMacro = namespaceList.count() == 0
|| namespaceList[0] == QLatin1String("qdesigner_internal");
if (needsMacro)
m_output << "QT_BEGIN_NAMESPACE\n\n";
openNameSpaces(namespaceList, m_output);
if (namespaceList.count())
m_output << "\n";
m_output << "class " << exportMacro << m_option.prefix << className << "\n"
<< "{\n"
<< "public:\n";
const QStringList connections = m_uic->databaseInfo()->connections();
for (int i=0; i<connections.size(); ++i) {
const QString connection = connections.at(i);
if (connection == QLatin1String("(default)"))
continue;
m_output << m_option.indent << "QSqlDatabase " << connection << "Connection;\n";
}
TreeWalker::acceptWidget(node->elementWidget());
if (const DomButtonGroups *domButtonGroups = node->elementButtonGroups())
acceptButtonGroups(domButtonGroups);
m_output << "\n";
WriteInitialization(m_uic, m_activateScripts).acceptUI(node);
if (node->elementImages()) {
if (m_option.extractImages) {
ExtractImages(m_uic->option()).acceptUI(node);
} else {
m_output << "\n"
<< "protected:\n"
<< m_option.indent << "enum IconID\n"
<< m_option.indent << "{\n";
WriteIconDeclaration(m_uic).acceptUI(node);
m_output << m_option.indent << m_option.indent << "unknown_ID\n"
<< m_option.indent << "};\n";
WriteIconInitialization(m_uic).acceptUI(node);
}
}
if (m_activateScripts) {
m_output << "\nprivate:\n\n";
writeScriptContextClass(m_option.indent, m_output);
}
m_output << "};\n\n";
closeNameSpaces(namespaceList, m_output);
if (namespaceList.count())
m_output << "\n";
if (m_option.generateNamespace && !m_option.prefix.isEmpty()) {
namespaceList.append(QLatin1String("Ui"));
openNameSpaces(namespaceList, m_output);
m_output << m_option.indent << "class " << exportMacro << className << ": public " << m_option.prefix << className << " {};\n";
closeNameSpaces(namespaceList, m_output);
if (namespaceList.count())
m_output << "\n";
}
if (needsMacro)
m_output << "QT_END_NAMESPACE\n\n";
}
void WriteDeclaration::acceptWidget(DomWidget *node)
{
QString className = QLatin1String("QWidget");
if (node->hasAttributeClass())
className = node->attributeClass();
m_output << m_option.indent << m_uic->customWidgetsInfo()->realClassName(className) << " *" << m_driver->findOrInsertWidget(node) << ";\n";
TreeWalker::acceptWidget(node);
}
void WriteDeclaration::acceptSpacer(DomSpacer *node)
{
m_output << m_option.indent << "QSpacerItem *" << m_driver->findOrInsertSpacer(node) << ";\n";
TreeWalker::acceptSpacer(node);
}
void WriteDeclaration::acceptLayout(DomLayout *node)
{
QString className = QLatin1String("QLayout");
if (node->hasAttributeClass())
className = node->attributeClass();
m_output << m_option.indent << className << " *" << m_driver->findOrInsertLayout(node) << ";\n";
TreeWalker::acceptLayout(node);
}
void WriteDeclaration::acceptActionGroup(DomActionGroup *node)
{
m_output << m_option.indent << "QActionGroup *" << m_driver->findOrInsertActionGroup(node) << ";\n";
TreeWalker::acceptActionGroup(node);
}
void WriteDeclaration::acceptAction(DomAction *node)
{
m_output << m_option.indent << "QAction *" << m_driver->findOrInsertAction(node) << ";\n";
TreeWalker::acceptAction(node);
}
void WriteDeclaration::acceptButtonGroup(const DomButtonGroup *buttonGroup)
{
m_output << m_option.indent << "QButtonGroup *" << m_driver->findOrInsertButtonGroup(buttonGroup) << ";\n";
TreeWalker::acceptButtonGroup(buttonGroup);
}
} // namespace CPP
QT_END_NAMESPACE
| [
"[email protected]"
] | |
df2ca76a10a50e814aed27916e0b850ef4a16f84 | 096928e3e8608eb9170581b3586517e236d00e63 | /atomic_queue.h | 6f19d0960deb217397a53dd44decb41b03530570 | [
"MIT"
] | permissive | zsuzuki/test_cpp | f8c7c026282106fab92ec9c24dcae41a2d91ea46 | d7d3b5a23748bf8e25ef1913f7b07d2f2e38cda6 | refs/heads/master | 2023-05-07T03:37:37.674727 | 2023-04-25T16:17:04 | 2023-04-25T16:17:04 | 92,431,621 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,677 | h | //
// Copyright 2018 Yoshinori Suzuki<[email protected]>
//
#pragma once
#include <atomic>
#include <cstddef>
#include <vector>
template <class T>
struct QueueValue
{
std::atomic<T> value;
//
QueueValue() = default;
QueueValue(T n) { value = n; }
QueueValue(T& n) { value = n; }
QueueValue(T&& n) { value = n; }
//
QueueValue<T>& operator=(const QueueValue<T>& other)
{
value = other.pointer;
return *this;
}
QueueValue<T>& operator=(T other)
{
value = other;
return *this;
}
operator T() { return value.load(); }
T load() const { return value.load(); }
};
//
// atomic queue <pointer> class
//
template <class T>
class Queue
{
std::vector<QueueValue<T*>> buffer;
std::atomic_int start{0};
std::atomic_int end{0};
public:
Queue(size_t sz) : buffer(sz)
{
for (auto& pt : buffer)
{
pt = nullptr;
}
}
//
bool push(T* p)
{
int n, e = end;
do
{
n = (e + 1) % buffer.size();
if (n == start)
return false;
} while (end.compare_exchange_weak(e, n) == false);
buffer[e] = p;
return true;
}
//
T* pop()
{
int s = start;
if (s == end)
{
return nullptr;
}
int n = (s + 1) % buffer.size();
if (start.compare_exchange_weak(s, n) == false)
{
return nullptr;
}
auto p = buffer[s].load();
while (p == nullptr)
{
p = buffer[s];
}
buffer[s] = nullptr;
return p;
}
bool empty() const { return start == end; }
};
//
// atomic queue <number> class
//
template <class T>
class NQueue
{
std::vector<QueueValue<T>> buffer;
std::atomic_int start{0};
std::atomic_int end{0};
T invalid_value;
public:
NQueue(size_t sz, T invalid = 0) : buffer(sz)
{
invalid_value = invalid;
for (auto& pt : buffer)
{
pt = invalid;
}
}
//
bool push(T p)
{
int n, e = end;
do
{
n = (e + 1) % buffer.size();
if (n == start)
return false;
} while (end.compare_exchange_weak(e, n) == false);
buffer[e] = p;
return true;
}
//
struct Result
{
T value;
bool ok;
//
operator bool() const { return ok; }
};
Result pop()
{
int s = start;
if (s == end)
return Result{invalid_value, false};
int n = (s + 1) % buffer.size();
if (start.compare_exchange_weak(s, n) == false)
return Result{invalid_value, false};
auto p = buffer[s].load();
while (p == invalid_value)
p = buffer[s];
buffer[s] = invalid_value;
return Result{p, true};
}
bool empty() const { return start == end; }
};
| [
"[email protected]"
] | |
44678095c7aa6def9ffeaa9a1e95d9815dff2b65 | bb233b85fffe79eb9e33e7af76fdafcc7e651c6a | /src/lib/ecl/EKF/gps_checks.cpp | 613bac59f3c589ab21c424b69c8ce0fd4eeef5c6 | [
"BSD-3-Clause"
] | permissive | sritank/Firmware2 | 2c86e537222fecfef335b6761521951e40359f7d | 7fb2406bf973def6e814f0789bb2d0256907264e | refs/heads/master | 2020-12-26T14:14:30.647968 | 2020-01-31T18:11:23 | 2020-01-31T18:11:23 | 237,534,298 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,371 | cpp | /****************************************************************************
*
* Copyright (c) 2013 Estimation and Control Library (ECL). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name ECL nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* @file gps_checks.cpp
* Perform pre-flight and in-flight GPS quality checks
*
* @author Paul Riseborough <[email protected]>
*
*/
#include "ekf.h"
#include <ecl.h>
#include <geo_lookup/geo_mag_declination.h>
#include <mathlib/mathlib.h>
// GPS pre-flight check bit locations
#define MASK_GPS_NSATS (1<<0)
#define MASK_GPS_PDOP (1<<1)
#define MASK_GPS_HACC (1<<2)
#define MASK_GPS_VACC (1<<3)
#define MASK_GPS_SACC (1<<4)
#define MASK_GPS_HDRIFT (1<<5)
#define MASK_GPS_VDRIFT (1<<6)
#define MASK_GPS_HSPD (1<<7)
#define MASK_GPS_VSPD (1<<8)
bool Ekf::collect_gps(const gps_message &gps)
{
// Run GPS checks always
_gps_checks_passed = gps_is_good(gps);
if (!_NED_origin_initialised && _gps_checks_passed) {
// If we have good GPS data set the origin's WGS-84 position to the last gps fix
const double lat = gps.lat / 1.0e7;
const double lon = gps.lon / 1.0e7;
map_projection_init_timestamped(&_pos_ref, lat, lon, _time_last_imu);
// if we are already doing aiding, correct for the change in position since the EKF started navigationg
if (_control_status.flags.opt_flow || _control_status.flags.gps || _control_status.flags.ev_pos || _control_status.flags.ev_vel) {
double est_lat, est_lon;
map_projection_reproject(&_pos_ref, -_state.pos(0), -_state.pos(1), &est_lat, &est_lon);
map_projection_init_timestamped(&_pos_ref, est_lat, est_lon, _time_last_imu);
}
// Take the current GPS height and subtract the filter height above origin to estimate the GPS height of the origin
_gps_alt_ref = 1e-3f * (float)gps.alt + _state.pos(2);
_NED_origin_initialised = true;
_earth_rate_NED = calcEarthRateNED((float)_pos_ref.lat_rad);
_last_gps_origin_time_us = _time_last_imu;
// set the magnetic field data returned by the geo library using the current GPS position
_mag_declination_gps = math::radians(get_mag_declination(lat, lon));
_mag_inclination_gps = math::radians(get_mag_inclination(lat, lon));
_mag_strength_gps = 0.01f * get_mag_strength(lat, lon);
// request a reset of the yaw using the new declination
_mag_yaw_reset_req = true;
// save the horizontal and vertical position uncertainty of the origin
_gps_origin_eph = gps.eph;
_gps_origin_epv = gps.epv;
// if the user has selected GPS as the primary height source, switch across to using it
if (_params.vdist_sensor_type == VDIST_SENSOR_GPS) {
ECL_INFO_TIMESTAMPED("GPS checks passed (WGS-84 origin set, using GPS height)");
setControlGPSHeight();
// zero the sensor offset
_hgt_sensor_offset = 0.0f;
} else {
ECL_INFO_TIMESTAMPED("GPS checks passed (WGS-84 origin set)");
}
}
// start collecting GPS if there is a 3D fix and the NED origin has been set
return _NED_origin_initialised && (gps.fix_type >= 3);
}
/*
* Return true if the GPS solution quality is adequate to set an origin for the EKF
* and start GPS aiding.
* All activated checks must pass for 10 seconds.
* Checks are activated using the EKF2_GPS_CHECK bitmask parameter
* Checks are adjusted using the EKF2_REQ_* parameters
*/
bool Ekf::gps_is_good(const gps_message &gps)
{
// Check the fix type
_gps_check_fail_status.flags.fix = (gps.fix_type < 3);
// Check the number of satellites
_gps_check_fail_status.flags.nsats = (gps.nsats < _params.req_nsats);
// Check the position dilution of precision
_gps_check_fail_status.flags.pdop = (gps.pdop > _params.req_pdop);
// Check the reported horizontal and vertical position accuracy
_gps_check_fail_status.flags.hacc = (gps.eph > _params.req_hacc);
_gps_check_fail_status.flags.vacc = (gps.epv > _params.req_vacc);
// Check the reported speed accuracy
_gps_check_fail_status.flags.sacc = (gps.sacc > _params.req_sacc);
// check if GPS quality is degraded
_gps_error_norm = fmaxf((gps.eph / _params.req_hacc) , (gps.epv / _params.req_vacc));
_gps_error_norm = fmaxf(_gps_error_norm , (gps.sacc / _params.req_sacc));
// Calculate time lapsed since last update, limit to prevent numerical errors and calculate a lowpass filter coefficient
const float filt_time_const = 10.0f;
const float dt = fminf(fmaxf(float(_time_last_imu - _gps_pos_prev.timestamp) * 1e-6f, 0.001f), filt_time_const);
const float filter_coef = dt / filt_time_const;
// The following checks are only valid when the vehicle is at rest
const double lat = gps.lat * 1.0e-7;
const double lon = gps.lon * 1.0e-7;
if (!_control_status.flags.in_air && _vehicle_at_rest) {
// Calculate position movement since last measurement
float delta_pos_n = 0.0f;
float delta_pos_e = 0.0f;
// calculate position movement since last GPS fix
if (_gps_pos_prev.timestamp > 0) {
map_projection_project(&_gps_pos_prev, lat, lon, &delta_pos_n, &delta_pos_e);
} else {
// no previous position has been set
map_projection_init_timestamped(&_gps_pos_prev, lat, lon, _time_last_imu);
_gps_alt_prev = 1e-3f * (float)gps.alt;
}
// Calculate the horizontal and vertical drift velocity components and limit to 10x the threshold
const Vector3f vel_limit(_params.req_hdrift, _params.req_hdrift, _params.req_vdrift);
Vector3f pos_derived(delta_pos_n, delta_pos_e, (_gps_alt_prev - 1e-3f * (float)gps.alt));
pos_derived = matrix::constrain(pos_derived / dt, -10.0f * vel_limit, 10.0f * vel_limit);
// Apply a low pass filter
_gps_pos_deriv_filt = pos_derived * filter_coef + _gps_pos_deriv_filt * (1.0f - filter_coef);
// Calculate the horizontal drift speed and fail if too high
_gps_drift_metrics[0] = Vector2f(_gps_pos_deriv_filt.xy()).norm();
_gps_check_fail_status.flags.hdrift = (_gps_drift_metrics[0] > _params.req_hdrift);
// Fail if the vertical drift speed is too high
_gps_drift_metrics[1] = fabsf(_gps_pos_deriv_filt(2));
_gps_check_fail_status.flags.vdrift = (_gps_drift_metrics[1] > _params.req_vdrift);
// Check the magnitude of the filtered horizontal GPS velocity
Vector2f gps_velNE = matrix::constrain(Vector2f(gps.vel_ned.xy()),
-10.0f * _params.req_hdrift,
10.0f * _params.req_hdrift);
_gps_velNE_filt = gps_velNE * filter_coef + _gps_velNE_filt * (1.0f - filter_coef);
_gps_drift_metrics[2] = _gps_velNE_filt.norm();
_gps_check_fail_status.flags.hspeed = (_gps_drift_metrics[2] > _params.req_hdrift);
_gps_drift_updated = true;
} else if (_control_status.flags.in_air) {
// These checks are always declared as passed when flying
// If on ground and moving, the last result before movement commenced is kept
_gps_check_fail_status.flags.hdrift = false;
_gps_check_fail_status.flags.vdrift = false;
_gps_check_fail_status.flags.hspeed = false;
_gps_drift_updated = false;
} else {
// This is the case where the vehicle is on ground and IMU movement is blocking the drift calculation
_gps_drift_updated = true;
}
// save GPS fix for next time
map_projection_init_timestamped(&_gps_pos_prev, lat, lon, _time_last_imu);
_gps_alt_prev = 1e-3f * (float)gps.alt;
// Check the filtered difference between GPS and EKF vertical velocity
float vz_diff_limit = 10.0f * _params.req_vdrift;
float vertVel = fminf(fmaxf((gps.vel_ned(2) - _state.vel(2)), -vz_diff_limit), vz_diff_limit);
_gps_velD_diff_filt = vertVel * filter_coef + _gps_velD_diff_filt * (1.0f - filter_coef);
_gps_check_fail_status.flags.vspeed = (fabsf(_gps_velD_diff_filt) > _params.req_vdrift);
// assume failed first time through
if (_last_gps_fail_us == 0) {
_last_gps_fail_us = _time_last_imu;
}
// if any user selected checks have failed, record the fail time
if (
_gps_check_fail_status.flags.fix ||
(_gps_check_fail_status.flags.nsats && (_params.gps_check_mask & MASK_GPS_NSATS)) ||
(_gps_check_fail_status.flags.pdop && (_params.gps_check_mask & MASK_GPS_PDOP)) ||
(_gps_check_fail_status.flags.hacc && (_params.gps_check_mask & MASK_GPS_HACC)) ||
(_gps_check_fail_status.flags.vacc && (_params.gps_check_mask & MASK_GPS_VACC)) ||
(_gps_check_fail_status.flags.sacc && (_params.gps_check_mask & MASK_GPS_SACC)) ||
(_gps_check_fail_status.flags.hdrift && (_params.gps_check_mask & MASK_GPS_HDRIFT)) ||
(_gps_check_fail_status.flags.vdrift && (_params.gps_check_mask & MASK_GPS_VDRIFT)) ||
(_gps_check_fail_status.flags.hspeed && (_params.gps_check_mask & MASK_GPS_HSPD)) ||
(_gps_check_fail_status.flags.vspeed && (_params.gps_check_mask & MASK_GPS_VSPD))
) {
_last_gps_fail_us = _time_last_imu;
} else {
_last_gps_pass_us = _time_last_imu;
}
// continuous period without fail of x seconds required to return a healthy status
return _time_last_imu - _last_gps_fail_us > (uint64_t)_min_gps_health_time_us;
}
| [
"[email protected]"
] | |
4585a5c00eedaa8d1fe40cdf89222e382ac06910 | ec506faf01c4d1986340fcf58e31f61346434697 | /118B.cpp | 83b967fbeef3cd04856374763fe1a9b72aa7f6c4 | [] | no_license | neha10gupta97/codeforces | 1b90352dbbaa3435bef68833cd6f08f553e7bf82 | bbc03a1703b2a9f1be082294b46b2e9596445341 | refs/heads/master | 2021-01-21T06:30:31.411297 | 2017-04-07T08:57:55 | 2017-04-07T08:57:55 | 83,244,601 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 319 | cpp | #include<bits/stdc++.h>
using namespace std;
main(){
int n,i,j;
cin>>n;
for(i=0;i<2*n+1;i++){
for(j=0;j<abs(n-i);j++)
cout<<" "<<" ";
for(j=0;j<=n-abs(n-i);j++){
cout<<j;
if(i!=0&&i!=2*n)
cout<<" ";
}
for(j=n-abs(n-i)-1;j>=0;j--){
cout<<j;
if(j!=0)
cout<<" ";
}
cout<<endl;
}
}
| [
"[email protected]"
] | |
7737d23ec245b3fcb4313fd3be2e5c5cf22618b7 | 0713816f29ef7922ad1caf20c2715caabfa2b209 | /src/normals.cpp | e44dddaa8a881a635184551d13a639e6a799dcd4 | [] | no_license | tizian/nori-base-2019 | 655278c8ffd61646643e0407f336c012eb51bf04 | bc455b7a5e969c7de07e757aa7e683721be43eca | refs/heads/master | 2022-09-09T21:55:25.929267 | 2020-06-01T08:16:25 | 2020-06-01T08:16:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 830 | cpp | #include <nori/integrator.h>
#include <nori/scene.h>
NORI_NAMESPACE_BEGIN
class NormalIntegrator : public Integrator {
public:
NormalIntegrator(const PropertyList &props) {
/* No parameters this time */
}
Color3f Li(const Scene *scene, Sampler *sampler, const Ray3f &ray) const {
/* Find the surface that is visible in the requested direction */
Intersection its;
if (!scene->rayIntersect(ray, its))
return Color3f(0.0f);
/* Return the component-wise absolute
value of the shading normal as a color */
Normal3f n = its.shFrame.n.cwiseAbs();
return Color3f(n.x(), n.y(), n.z());
}
std::string toString() const {
return "NormalIntegrator[]";
}
};
NORI_REGISTER_CLASS(NormalIntegrator, "normals");
NORI_NAMESPACE_END
| [
"[email protected]"
] | |
6ffa86cc593f47d5a30b038045e6c7a2b241bd8c | 3346f8c782c06db3385eb087a2af3fc6886c8f1d | /Exp9/ImageLib.h | a572f1dbaa670dcd7f8f7331dd3a68972f2bc682 | [] | no_license | whatwewant/3D_GraphicProgramming_2014 | b30dfacbdf5ba5fbe7f3c5777de0ee651c8e4e86 | e5cd76191014dfe79a30764ebcb6bd23dfdc49d2 | refs/heads/master | 2020-04-27T01:16:58.159230 | 2015-01-09T08:48:12 | 2015-01-09T08:48:12 | 27,206,724 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 965 | h | #ifndef _IMAGE_LIB_
#define _IMAGE_LIB_
class CImage
{
public:
int width, height; // 图像宽度和高度
int bpp; // 每个像素所占据的字节数
unsigned char *pixels; // 像素缓冲区
CImage(void) {width=0; height=0; bpp=1; pixels=NULL;}
~CImage(void) {Clear();}
void Clear(void) {if (pixels!=NULL) {delete [] pixels; pixels=NULL;}}
void FlipX(void);
void FlipY(void);
int Load(const char *file_name);
protected:
int LoadJPEG(const char *file_name);
};
unsigned int Load2DTexture(const char *file_name);
unsigned int Load2DMipmapTexture(const char *file_name);
unsigned int LoadCubemapTexture(
const char *image_file_left, const char *image_file_right,
const char *image_file_up, const char *image_file_down,
const char *image_file_front, const char *image_file_back );
unsigned int Load2DTransparentTexture(const char *color_file_name,
const char *alpha_file_name);
#endif
| [
"[email protected]"
] | |
8f7506bdcce8c14949d176d25c4fdbcc6c70ae9d | 61a62af6e831f3003892abf4f73bb1aa4d74d1c7 | /Google CodeJam/2022/Round 1A/C.cpp | ea5e9c1d31b248c88f34a774d045b71749f6b498 | [] | no_license | amsraman/Competitive_Programming | 7e420e5d029e8adfbe7edf845db77f96bd1ae80d | 6f869a1e1716f56b081769d7f36ffa23ae82e356 | refs/heads/master | 2023-03-17T00:20:19.866063 | 2023-03-11T00:24:29 | 2023-03-11T00:24:29 | 173,763,104 | 16 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,173 | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int t, e, w, x[100][100];
int main() {
cin >> t;
for(int _ = 1; _ <= t; _++) {
cin >> e >> w;
for(int i = 0; i < e; i++) {
for(int j = 0; j < w; j++) {
cin >> x[i][j];
}
}
vector<vector<int>> common(e, vector<int>(e, 0));
for(int i = 0; i < e; i++) {
vector<int> mn_w(w, INF);
for(int j = i; j < e; j++) {
for(int k = 0; k < w; k++) {
mn_w[k] = min(mn_w[k], x[j][k]);
common[i][j] += mn_w[k];
}
}
}
vector<vector<int>> dp(e, vector<int>(e, 0));
for(int i = e - 1; i >= 0; i--) {
for(int j = i + 1; j < e; j++) {
dp[i][j] = 0x3f3f3f3f;
for(int k = i; k < j; k++) {
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j] + 2 * common[i][k] + 2 * common[k + 1][j] - 4 * common[i][j]);
}
}
}
cout << "Case #" << _ << ": " << dp[0][e - 1] + 2 * common[0][e - 1] << endl;
}
} | [
"[email protected]"
] | |
07f4e91f1918acd078d5e47d6b837731014c57a4 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/collectd/gumtree/collectd_repos_function_1168_collectd-5.6.1.cpp | 4abeef7c83cf47239a0585c89d52e7d4f4649ece | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,738 | cpp | static void logfile_print (const char *msg, int severity,
cdtime_t timestamp_time)
{
FILE *fh;
_Bool do_close = 0;
struct tm timestamp_tm;
char timestamp_str[64];
char level_str[16] = "";
if (print_severity)
{
switch (severity)
{
case LOG_ERR:
snprintf(level_str, sizeof (level_str), "[error] ");
break;
case LOG_WARNING:
snprintf(level_str, sizeof (level_str), "[warning] ");
break;
case LOG_NOTICE:
snprintf(level_str, sizeof (level_str), "[notice] ");
break;
case LOG_INFO:
snprintf(level_str, sizeof (level_str), "[info] ");
break;
case LOG_DEBUG:
snprintf(level_str, sizeof (level_str), "[debug] ");
break;
default:
break;
}
}
if (print_timestamp)
{
time_t tt = CDTIME_T_TO_TIME_T (timestamp_time);
localtime_r (&tt, ×tamp_tm);
strftime (timestamp_str, sizeof (timestamp_str), "%Y-%m-%d %H:%M:%S",
×tamp_tm);
timestamp_str[sizeof (timestamp_str) - 1] = '\0';
}
pthread_mutex_lock (&file_lock);
if (log_file == NULL)
{
fh = fopen (DEFAULT_LOGFILE, "a");
do_close = 1;
}
else if (strcasecmp (log_file, "stderr") == 0)
fh = stderr;
else if (strcasecmp (log_file, "stdout") == 0)
fh = stdout;
else
{
fh = fopen (log_file, "a");
do_close = 1;
}
if (fh == NULL)
{
char errbuf[1024];
fprintf (stderr, "logfile plugin: fopen (%s) failed: %s\n",
(log_file == NULL) ? DEFAULT_LOGFILE : log_file,
sstrerror (errno, errbuf, sizeof (errbuf)));
}
else
{
if (print_timestamp)
fprintf (fh, "[%s] %s%s\n", timestamp_str, level_str, msg);
else
fprintf (fh, "%s%s\n", level_str, msg);
if (do_close) {
fclose (fh);
} else {
fflush(fh);
}
}
pthread_mutex_unlock (&file_lock);
return;
} | [
"[email protected]"
] | |
cd904c96c18de5c7d0d60b0b42effbf1bfec898d | f81124e4a52878ceeb3e4b85afca44431ce68af2 | /re20_3/processor40/55/U | 85ac3853f16e94bb3612250f842affe3c0d382de | [] | no_license | chaseguy15/coe-of2 | 7f47a72987638e60fd7491ee1310ee6a153a5c10 | dc09e8d5f172489eaa32610e08e1ee7fc665068c | refs/heads/master | 2023-03-29T16:59:14.421456 | 2021-04-06T23:26:52 | 2021-04-06T23:26:52 | 355,040,336 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 36,346 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "55";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
928
(
(0.445749 -0.00100234 -1.19839e-22)
(0.448745 -0.000992089 -8.43745e-23)
(0.451711 -0.000981961 1.65516e-22)
(0.454649 -0.000971953 -1.17234e-22)
(0.457558 -0.000962064 -6.50431e-23)
(0.460439 -0.000952293 -1.63836e-23)
(0.446396 -0.00300499 1.4331e-22)
(0.449386 -0.00297427 -4.37621e-22)
(0.452347 -0.00294391 9.86291e-23)
(0.455279 -0.00291391 2.97104e-22)
(0.458183 -0.00288427 -2.81302e-22)
(0.461058 -0.00285498 3.70586e-22)
(0.447689 -0.00500153 6.41059e-22)
(0.450667 -0.00495042 -2.19389e-22)
(0.453617 -0.00489991 5.51746e-22)
(0.456538 -0.00485 1.02286e-22)
(0.45943 -0.00480068 -7.07933e-22)
(0.462294 -0.00475196 3.31676e-22)
(0.449623 -0.00698793 7.94152e-22)
(0.452584 -0.00691656 -8.19743e-22)
(0.455516 -0.00684603 -7.45688e-22)
(0.458419 -0.00677634 5.67817e-22)
(0.461295 -0.00670748 5.48799e-22)
(0.464142 -0.00663943 -3.27409e-22)
(0.452191 -0.00896019 1.10992e-21)
(0.455129 -0.00886875 3.59216e-22)
(0.458038 -0.00877839 -4.94164e-22)
(0.460919 -0.00868909 6.80975e-22)
(0.463772 -0.00860086 -1.45474e-21)
(0.466597 -0.00851367 1.19667e-22)
(0.455385 -0.0109144 -2.31339e-22)
(0.458294 -0.0108031 2.70145e-22)
(0.461175 -0.0106932 -4.72687e-22)
(0.464028 -0.0105845 -5.63161e-22)
(0.466853 -0.0104771 1.31249e-21)
(0.469651 -0.010371 -1.8121e-21)
(0.462069 -0.0127159 6.36234e-22)
(0.464916 -0.0125866 4.0235e-22)
(0.467735 -0.0124588 -1.14073e-21)
(0.470527 -0.0123326 7.86092e-22)
(0.473292 -0.0122078 -1.28279e-22)
(0.466441 -0.0146033 6.27957e-22)
(0.469249 -0.014455 2.17983e-21)
(0.472029 -0.0143085 -2.68357e-21)
(0.474783 -0.0141637 9.80253e-22)
(0.47751 -0.0140206 1.06623e-21)
(0.471396 -0.0164619 3.24115e-22)
(0.474159 -0.016295 1.90698e-22)
(0.476896 -0.01613 8.85313e-22)
(0.479607 -0.015967 -1.56018e-21)
(0.482291 -0.015806 -8.81692e-22)
(0.476917 -0.0182881 5.59565e-22)
(0.479631 -0.018103 9.32932e-22)
(0.482319 -0.0179201 -7.91274e-23)
(0.484982 -0.0177393 1.1126e-21)
(0.487619 -0.0175606 -1.59096e-21)
(0.482986 -0.0200786 2.8466e-21)
(0.485647 -0.0198758 3.70254e-23)
(0.488282 -0.0196753 -3.42834e-21)
(0.490892 -0.0194772 2.41635e-21)
(0.493477 -0.0192814 8.91599e-22)
(0.489585 -0.0218304 1.68197e-21)
(0.492187 -0.0216104 -1.50232e-21)
(0.494764 -0.0213928 1.25664e-21)
(0.497317 -0.0211779 -1.21077e-22)
(0.499846 -0.0209654 -1.0581e-21)
(0.496691 -0.0235405 1.11812e-21)
(0.49923 -0.0233037 1.67721e-21)
(0.501746 -0.0230696 6.92109e-22)
(0.504238 -0.0228383 -1.89977e-21)
(0.506707 -0.0226098 -2.00185e-21)
(0.504282 -0.0252059 -4.95587e-22)
(0.506755 -0.024953 6.36511e-22)
(0.509205 -0.024703 2.18251e-22)
(0.511632 -0.0244559 4.29351e-22)
(0.514037 -0.0242117 -1.97504e-22)
(0.512335 -0.0268243 -7.74145e-22)
(0.514738 -0.0265558 -2.34881e-21)
(0.517118 -0.0262905 1.30065e-21)
(0.519477 -0.0260282 -2.75851e-22)
(0.521815 -0.0257689 -9.48655e-22)
(0.52413 -0.0255127 2.81379e-21)
(0.520824 -0.0283931 3.80379e-21)
(0.523153 -0.0281097 2.01143e-21)
(0.525462 -0.0278296 -3.7793e-21)
(0.527749 -0.0275527 -2.31387e-21)
(0.530015 -0.027279 5.61317e-21)
(0.532261 -0.0270085 -2.13471e-21)
(0.531977 -0.0296125 -6.21995e-21)
(0.53421 -0.0293183 2.66431e-21)
(0.536422 -0.0290274 1.30842e-21)
(0.538615 -0.0287399 1.06517e-21)
(0.540788 -0.0284558 2.00587e-22)
(0.541182 -0.0310623 1.18778e-21)
(0.543336 -0.0307546 1.27328e-21)
(0.545471 -0.0304505 -7.13599e-22)
(0.547587 -0.0301498 -1.65999e-21)
(0.549684 -0.0298526 -2.7223e-21)
(0.550741 -0.0324574 1.94202e-21)
(0.552814 -0.0321369 -3.59914e-21)
(0.554869 -0.0318201 2.77628e-21)
(0.556906 -0.0315069 -2.08892e-21)
(0.558926 -0.0311973 -2.7866e-21)
(0.560626 -0.0337962 -3.56503e-21)
(0.562616 -0.0334636 6.69846e-21)
(0.564589 -0.0331348 -8.83103e-22)
(0.566546 -0.0328098 -1.85512e-21)
(0.568485 -0.0324884 5.8999e-22)
(0.570809 -0.0350774 1.92701e-21)
(0.572715 -0.0347335 -8.08295e-22)
(0.574604 -0.0343934 5.34739e-22)
(0.576478 -0.0340572 2.90052e-22)
(0.578336 -0.0337248 -1.75728e-21)
(0.581262 -0.0363001 1.2057e-21)
(0.583082 -0.0359455 1.98915e-21)
(0.584886 -0.0355948 -3.41137e-21)
(0.586676 -0.0352481 7.22833e-21)
(0.58845 -0.0349053 -4.73918e-22)
(0.59021 -0.0345664 -2.2727e-21)
(0.593689 -0.0370987 1.84436e-21)
(0.595407 -0.0367382 -2.45688e-21)
(0.597111 -0.0363817 -3.08622e-21)
(0.598801 -0.0360291 1.73061e-21)
(0.600478 -0.0356806 -1.86031e-21)
(0.604508 -0.0381927 2.97955e-21)
(0.606138 -0.0378229 -3.31217e-21)
(0.607756 -0.0374573 6.72468e-21)
(0.609361 -0.0370957 5.44215e-23)
(0.610954 -0.0367382 -6.03516e-21)
(0.61551 -0.0392269 -6.85681e-21)
(0.617053 -0.0388487 5.78141e-21)
(0.618584 -0.0384746 -3.11216e-21)
(0.620103 -0.0381047 3.27766e-21)
(0.621611 -0.0377389 -2.47459e-21)
(0.626668 -0.0402012 7.78677e-22)
(0.628122 -0.0398152 2.84677e-21)
(0.629566 -0.0394334 2.06712e-21)
(0.631 -0.0390558 -4.81743e-22)
(0.632422 -0.0386824 6.09712e-23)
(0.63932 -0.0407219 3.38788e-21)
(0.640677 -0.040333 -3.32346e-21)
(0.642024 -0.0399484 1.11755e-21)
(0.643362 -0.039568 4.12481e-21)
(0.64469 -0.0391918 -3.17117e-21)
(0.650619 -0.041569 1.98727e-21)
(0.651888 -0.0411738 5.61876e-22)
(0.65315 -0.0407828 -1.096e-21)
(0.654403 -0.0403961 -1.80417e-21)
(0.655647 -0.0400137 4.47141e-22)
(0.661992 -0.042364 9.50921e-22)
(0.663175 -0.0419629 2.45073e-21)
(0.664351 -0.0415661 -4.2404e-21)
(0.66552 -0.0411736 -3.30286e-21)
(0.666681 -0.0407853 3.74363e-21)
(0.673414 -0.0431115 -1.74806e-22)
(0.674512 -0.0427048 -5.36307e-22)
(0.675603 -0.0423025 3.42037e-22)
(0.676688 -0.0419045 4.23944e-21)
(0.677766 -0.0415108 -3.48757e-21)
(0.692466 -0.0441927 0)
(0.693435 -0.0437802 0)
(0.694399 -0.0433719 0)
(0.695358 -0.0429679 0)
(0.696312 -0.0425682 0)
(0.720422 -0.0454052 0)
(0.721202 -0.0449873 0)
(0.721979 -0.0445737 0)
(0.722753 -0.0441642 0)
(0.723524 -0.0437591 0)
(0.748787 -0.0463804 0)
(0.74938 -0.0459595 0)
(0.749971 -0.0455428 0)
(0.750562 -0.0451302 0)
(0.751151 -0.0447217 0)
(0.777331 -0.0470902 0)
(0.77774 -0.0466691 0)
(0.77815 -0.046252 0)
(0.77856 -0.0458389 0)
(0.778971 -0.0454298 0)
(0.80583 -0.0475396 0)
(0.806061 -0.047121 0)
(0.806294 -0.0467063 0)
(0.80653 -0.0462953 0)
(0.806768 -0.0458883 0)
(0.834071 -0.0477403 0)
(0.834131 -0.0473268 0)
(0.834196 -0.0469169 0)
(0.834264 -0.0465106 0)
(0.834337 -0.0461079 0)
(0.861852 -0.0477043 0)
(0.861751 -0.0472983 0)
(0.861657 -0.0468956 0)
(0.861568 -0.0464963 0)
(0.861484 -0.0461003 0)
(0.888989 -0.0474464 0)
(0.888738 -0.04705 0)
(0.888495 -0.0466566 0)
(0.888259 -0.0462663 0)
(0.88803 -0.0458791 0)
(0.915314 -0.0469831 0)
(0.914925 -0.0465982 0)
(0.914545 -0.046216 0)
(0.914174 -0.0458366 0)
(0.91381 -0.04546 0)
(0.940677 -0.0463328 0)
(0.940164 -0.045961 0)
(0.939661 -0.0455916 0)
(0.939167 -0.0452247 0)
(0.938682 -0.0448602 0)
(0.964951 -0.045515 0)
(0.964327 -0.0451576 0)
(0.963714 -0.0448023 0)
(0.963111 -0.0444492 0)
(0.962518 -0.0440982 0)
(0.988028 -0.0445498 0)
(0.987308 -0.044208 0)
(0.986599 -0.0438679 0)
(0.985901 -0.0435295 0)
(0.985214 -0.043193 0)
(1.00982 -0.0434581 0)
(1.00902 -0.0431326 0)
(1.00823 -0.0428083 0)
(1.00745 -0.0424855 0)
(1.00668 -0.0421642 0)
(1.03027 -0.0422605 0)
(1.0294 -0.0419516 0)
(1.02854 -0.0416438 0)
(1.0277 -0.041337 0)
(1.02686 -0.0410314 0)
(1.04933 -0.0409771 0)
(1.0484 -0.0406852 0)
(1.04749 -0.0403939 0)
(1.04659 -0.0401034 0)
(1.04571 -0.0398137 0)
(1.06697 -0.0396275 0)
(1.06601 -0.0393524 0)
(1.06506 -0.0390776 0)
(1.06412 -0.0388033 0)
(1.06319 -0.0385296 0)
(1.0832 -0.0382299 0)
(1.08221 -0.0379714 0)
(1.08123 -0.0377129 0)
(1.08026 -0.0374546 0)
(1.07931 -0.0371965 0)
(1.09803 -0.0368013 0)
(1.09702 -0.036559 0)
(1.09602 -0.0363164 0)
(1.09504 -0.0360737 0)
(1.09406 -0.0358309 0)
(1.11148 -0.0353574 0)
(1.11047 -0.0351306 0)
(1.10946 -0.0349032 0)
(1.10847 -0.0346755 0)
(1.10749 -0.0344476 0)
(1.1236 -0.0339118 0)
(1.12259 -0.0336998 0)
(1.12159 -0.033487 0)
(1.1206 -0.0332737 0)
(1.11962 -0.0330599 0)
(1.13444 -0.0324765 0)
(1.13344 -0.0322786 0)
(1.13245 -0.0320796 0)
(1.13147 -0.0318799 0)
(1.1305 -0.0316794 0)
(1.14407 -0.0310619 0)
(1.14309 -0.0308771 0)
(1.14211 -0.0306911 0)
(1.14115 -0.0305042 0)
(1.14019 -0.0303163 0)
(1.15256 -0.0296764 0)
(1.1516 -0.0295038 0)
(1.15064 -0.0293299 0)
(1.1497 -0.0291549 0)
(1.14876 -0.0289789 0)
(1.15997 -0.0283266 0)
(1.15904 -0.0281654 0)
(1.15811 -0.0280028 0)
(1.1572 -0.0278389 0)
(1.15628 -0.0276738 0)
(1.1664 -0.0270178 0)
(1.1655 -0.0268671 0)
(1.1646 -0.0267148 0)
(1.16371 -0.0265612 0)
(1.16283 -0.0264063 0)
(1.17193 -0.0257535 0)
(1.17105 -0.0256124 0)
(1.17019 -0.0254698 0)
(1.16933 -0.0253256 0)
(1.16848 -0.0251801 0)
(1.17662 -0.0245359 0)
(1.17578 -0.0244038 0)
(1.17495 -0.0242699 0)
(1.17412 -0.0241345 0)
(1.1733 -0.0239977 0)
(1.18057 -0.0233663 0)
(1.17976 -0.0232424 0)
(1.17896 -0.0231166 0)
(1.17817 -0.0229892 0)
(1.17738 -0.0228604 0)
(1.18384 -0.0222447 0)
(1.18307 -0.0221283 0)
(1.1823 -0.02201 0)
(1.18154 -0.0218901 0)
(1.18078 -0.0217686 0)
(1.18652 -0.0211703 0)
(1.18578 -0.0210608 0)
(1.18505 -0.0209495 0)
(1.18432 -0.0208364 0)
(1.18359 -0.0207217 0)
(1.18867 -0.0201418 0)
(1.18797 -0.0200387 0)
(1.18726 -0.0199337 0)
(1.18656 -0.019827 0)
(1.18587 -0.0197187 0)
(1.19036 -0.0191571 0)
(1.18968 -0.01906 0)
(1.18901 -0.018961 0)
(1.18834 -0.0188602 0)
(1.18767 -0.0187577 0)
(1.19165 -0.018214 0)
(1.191 -0.0181224 0)
(1.19035 -0.0180289 0)
(1.18971 -0.0179337 0)
(1.18907 -0.0178368 0)
(1.19259 -0.0173098 0)
(1.19197 -0.0172234 0)
(1.19135 -0.0171352 0)
(1.19073 -0.0170451 0)
(1.19012 -0.0169534 0)
(1.19324 -0.0164417 0)
(1.19264 -0.0163603 0)
(1.19204 -0.016277 0)
(1.19145 -0.0161919 0)
(1.19086 -0.0161051 0)
(1.19363 -0.0156071 0)
(1.19306 -0.0155303 0)
(1.19248 -0.0154516 0)
(1.19191 -0.0153712 0)
(1.19135 -0.0152891 0)
(1.19382 -0.0148029 0)
(1.19326 -0.0147306 0)
(1.19271 -0.0146564 0)
(1.19216 -0.0145804 0)
(1.19161 -0.0145029 0)
(1.19383 -0.0140266 0)
(1.19329 -0.0139585 0)
(1.19276 -0.0138886 0)
(1.19223 -0.0138169 0)
(1.1917 -0.0137437 0)
(1.1937 -0.0132754 0)
(1.19318 -0.0132114 0)
(1.19266 -0.0131456 0)
(1.19215 -0.0130781 0)
(1.19163 -0.013009 0)
(1.19346 -0.0125469 0)
(1.19295 -0.0124868 0)
(1.19245 -0.012425 0)
(1.19195 -0.0123615 0)
(1.19145 -0.0122964 0)
(1.19312 -0.0118388 0)
(1.19263 -0.0117825 0)
(1.19214 -0.0117245 0)
(1.19166 -0.0116648 0)
(1.19117 -0.0116037 0)
(1.19272 -0.0111488 0)
(1.19224 -0.0110962 0)
(1.19177 -0.0110419 0)
(1.19129 -0.010986 0)
(1.19082 -0.0109287 0)
(1.19228 -0.0104751 0)
(1.19181 -0.010426 0)
(1.19134 -0.0103754 0)
(1.19088 -0.0103231 0)
(1.19042 -0.0102695 0)
(1.19179 -0.00981577 0)
(1.19134 -0.00977018 0)
(1.19088 -0.00972302 0)
(1.19042 -0.00967438 0)
(1.18997 -0.00962435 0)
(1.19129 -0.00916928 0)
(1.19084 -0.00912703 0)
(1.19039 -0.00908329 0)
(1.18995 -0.00903812 0)
(1.1895 -0.00899162 0)
(1.19079 -0.00853413 0)
(1.19034 -0.00849514 0)
(1.1899 -0.00845471 0)
(1.18946 -0.00841294 0)
(1.18903 -0.00836988 0)
(1.19028 -0.00790902 0)
(1.18984 -0.00787318 0)
(1.18941 -0.00783599 0)
(1.18898 -0.00779751 0)
(1.18855 -0.00775783 0)
(1.18978 -0.00729275 0)
(1.18935 -0.00725998 0)
(1.18892 -0.00722593 0)
(1.1885 -0.00719068 0)
(1.18807 -0.00715428 0)
(1.1893 -0.00668427 0)
(1.18888 -0.00665448 0)
(1.18845 -0.0066235 0)
(1.18803 -0.00659139 0)
(1.18761 -0.00655821 0)
(1.18885 -0.00608263 0)
(1.18843 -0.00605574 0)
(1.18801 -0.00602774 0)
(1.18759 -0.0059987 0)
(1.18718 -0.00596867 0)
(1.18842 -0.00548697 0)
(1.18801 -0.00546289 0)
(1.18759 -0.00543781 0)
(1.18718 -0.00541176 0)
(1.18677 -0.00538482 0)
(1.18636 -0.00535702 0)
(1.18803 -0.00489651 0)
(1.18762 -0.00487518 0)
(1.1872 -0.00485293 0)
(1.18679 -0.00482982 0)
(1.18639 -0.0048059 0)
(1.18598 -0.0047812 0)
(1.18767 -0.00431054 0)
(1.18726 -0.00429189 0)
(1.18685 -0.00427242 0)
(1.18645 -0.00425218 0)
(1.18604 -0.00423122 0)
(1.18564 -0.00420957 0)
(1.18735 -0.00372842 0)
(1.18695 -0.00371238 0)
(1.18654 -0.00369564 0)
(1.18613 -0.00367822 0)
(1.18573 -0.00366016 0)
(1.18533 -0.0036415 0)
(1.18708 -0.00314954 0)
(1.18667 -0.00313607 0)
(1.18627 -0.00312199 0)
(1.18586 -0.00310733 0)
(1.18546 -0.00309214 0)
(1.18506 -0.00307643 0)
(1.18684 -0.00257335 0)
(1.18644 -0.00256239 0)
(1.18604 -0.00255093 0)
(1.18564 -0.002539 0)
(1.18524 -0.00252662 0)
(1.18484 -0.00251382 0)
(1.18666 -0.0019993 0)
(1.18625 -0.00199082 0)
(1.18585 -0.00198195 0)
(1.18545 -0.00197271 0)
(1.18505 -0.00196312 0)
(1.18466 -0.0019532 0)
(1.18651 -0.00142691 0)
(1.18611 -0.00142087 0)
(1.18571 -0.00141456 0)
(1.18531 -0.00140798 0)
(1.18491 -0.00140115 0)
(1.18452 -0.00139408 0)
(1.18642 -0.000855685 0)
(1.18602 -0.000852072 0)
(1.18562 -0.000848291 0)
(1.18522 -0.000844352 0)
(1.18482 -0.000840261 0)
(1.18443 -0.000836028 0)
(1.18637 -0.000285153 0)
(1.18597 -0.00028395 0)
(1.18557 -0.000282692 0)
(1.18517 -0.00028138 0)
(1.18478 -0.000280018 0)
(1.18438 -0.000278608 0)
(0.692466 0.0441927 0)
(0.720422 0.0454052 0)
(0.748787 0.0463804 0)
(0.777331 0.0470902 0)
(0.80583 0.0475396 0)
(0.834071 0.0477403 0)
(0.861852 0.0477044 0)
(0.888989 0.0474464 0)
(0.915314 0.0469832 0)
(0.940677 0.0463328 0)
(0.964951 0.045515 0)
(0.988028 0.0445498 0)
(1.00982 0.0434581 0)
(1.03027 0.0422605 0)
(1.04933 0.0409771 0)
(1.06697 0.0396275 0)
(1.0832 0.0382299 0)
(1.09803 0.0368013 0)
(1.11148 0.0353574 0)
(1.1236 0.0339118 0)
(1.13444 0.0324766 0)
(1.14407 0.031062 0)
(1.15256 0.0296764 0)
(1.15997 0.0283267 0)
(1.1664 0.0270178 0)
(1.17193 0.0257535 0)
(1.17662 0.0245359 0)
(1.18057 0.0233663 0)
(1.18384 0.0222447 0)
(1.18652 0.0211703 0)
(1.18867 0.0201418 0)
(1.19036 0.0191571 0)
(1.19165 0.018214 0)
(1.19259 0.0173098 0)
(1.19324 0.0164417 0)
(1.19363 0.0156071 0)
(1.19382 0.0148029 0)
(1.19383 0.0140266 0)
(1.1937 0.0132754 0)
(1.19346 0.0125469 0)
(1.19312 0.0118388 0)
(1.19272 0.0111488 0)
(1.19228 0.0104751 0)
(1.19179 0.00981577 0)
(1.19129 0.00916928 0)
(1.19079 0.00853413 0)
(1.19028 0.00790902 0)
(1.18978 0.00729275 0)
(1.1893 0.00668427 0)
(1.18885 0.00608263 0)
(1.18842 0.00548697 0)
(1.18803 0.00489651 0)
(1.18767 0.00431055 0)
(1.18735 0.00372842 0)
(1.18708 0.00314954 0)
(1.18684 0.00257335 0)
(1.18666 0.0019993 0)
(1.18651 0.00142691 0)
(1.18642 0.000855685 0)
(1.18637 0.000285153 0)
(0.693435 0.0437802 0)
(0.721202 0.0449873 0)
(0.74938 0.0459595 0)
(0.77774 0.0466691 0)
(0.806061 0.047121 0)
(0.834131 0.0473268 0)
(0.861751 0.0472983 0)
(0.888738 0.04705 0)
(0.914925 0.0465982 0)
(0.940164 0.045961 0)
(0.964327 0.0451576 0)
(0.987308 0.044208 0)
(1.00902 0.0431326 0)
(1.0294 0.0419516 0)
(1.0484 0.0406852 0)
(1.06601 0.0393524 0)
(1.08221 0.0379714 0)
(1.09702 0.036559 0)
(1.11047 0.0351306 0)
(1.12259 0.0336998 0)
(1.13344 0.0322786 0)
(1.14309 0.0308771 0)
(1.1516 0.0295038 0)
(1.15904 0.0281654 0)
(1.1655 0.0268671 0)
(1.17105 0.0256124 0)
(1.17578 0.0244038 0)
(1.17976 0.0232424 0)
(1.18307 0.0221283 0)
(1.18578 0.0210608 0)
(1.18797 0.0200387 0)
(1.18968 0.01906 0)
(1.191 0.0181224 0)
(1.19197 0.0172234 0)
(1.19264 0.0163603 0)
(1.19306 0.0155303 0)
(1.19326 0.0147306 0)
(1.19329 0.0139585 0)
(1.19318 0.0132114 0)
(1.19295 0.0124868 0)
(1.19263 0.0117825 0)
(1.19224 0.0110962 0)
(1.19181 0.010426 0)
(1.19134 0.00977018 0)
(1.19084 0.00912704 0)
(1.19034 0.00849514 0)
(1.18984 0.00787318 0)
(1.18935 0.00725998 0)
(1.18888 0.00665448 0)
(1.18843 0.00605574 0)
(1.18801 0.00546289 0)
(1.18762 0.00487518 0)
(1.18726 0.00429189 0)
(1.18695 0.00371239 0)
(1.18667 0.00313607 0)
(1.18644 0.00256239 0)
(1.18625 0.00199082 0)
(1.18611 0.00142087 0)
(1.18602 0.000852073 0)
(1.18597 0.000283951 0)
(0.694399 0.0433719 0)
(0.721979 0.0445737 0)
(0.749971 0.0455428 0)
(0.77815 0.046252 0)
(0.806294 0.0467063 0)
(0.834196 0.0469169 0)
(0.861657 0.0468956 0)
(0.888495 0.0466566 0)
(0.914545 0.046216 0)
(0.939661 0.0455916 0)
(0.963714 0.0448023 0)
(0.986599 0.0438679 0)
(1.00823 0.0428083 0)
(1.02854 0.0416438 0)
(1.04749 0.0403939 0)
(1.06506 0.0390776 0)
(1.08123 0.0377129 0)
(1.09602 0.0363164 0)
(1.10946 0.0349032 0)
(1.12159 0.033487 0)
(1.13245 0.0320796 0)
(1.14211 0.0306911 0)
(1.15064 0.0293299 0)
(1.15811 0.0280028 0)
(1.1646 0.0267148 0)
(1.17019 0.0254698 0)
(1.17495 0.02427 0)
(1.17896 0.0231166 0)
(1.1823 0.02201 0)
(1.18505 0.0209495 0)
(1.18726 0.0199337 0)
(1.18901 0.018961 0)
(1.19035 0.0180289 0)
(1.19135 0.0171352 0)
(1.19204 0.016277 0)
(1.19248 0.0154516 0)
(1.19271 0.0146564 0)
(1.19276 0.0138886 0)
(1.19266 0.0131456 0)
(1.19245 0.012425 0)
(1.19214 0.0117245 0)
(1.19177 0.0110419 0)
(1.19134 0.0103754 0)
(1.19088 0.00972302 0)
(1.19039 0.00908329 0)
(1.1899 0.00845472 0)
(1.18941 0.00783599 0)
(1.18892 0.00722593 0)
(1.18845 0.0066235 0)
(1.18801 0.00602774 0)
(1.18759 0.00543781 0)
(1.1872 0.00485293 0)
(1.18685 0.00427242 0)
(1.18654 0.00369564 0)
(1.18627 0.00312199 0)
(1.18604 0.00255093 0)
(1.18585 0.00198195 0)
(1.18571 0.00141456 0)
(1.18562 0.000848292 0)
(1.18557 0.000282692 0)
(0.695358 0.0429679 0)
(0.722753 0.0441643 0)
(0.750562 0.0451302 0)
(0.77856 0.0458389 0)
(0.80653 0.0462954 0)
(0.834264 0.0465106 0)
(0.861568 0.0464963 0)
(0.888259 0.0462663 0)
(0.914174 0.0458366 0)
(0.939167 0.0452247 0)
(0.963111 0.0444492 0)
(0.985901 0.0435295 0)
(1.00745 0.0424855 0)
(1.0277 0.041337 0)
(1.04659 0.0401034 0)
(1.06412 0.0388033 0)
(1.08026 0.0374546 0)
(1.09504 0.0360737 0)
(1.10847 0.0346755 0)
(1.1206 0.0332737 0)
(1.13147 0.0318799 0)
(1.14115 0.0305042 0)
(1.1497 0.0291549 0)
(1.1572 0.0278389 0)
(1.16371 0.0265612 0)
(1.16933 0.0253256 0)
(1.17412 0.0241345 0)
(1.17817 0.0229893 0)
(1.18154 0.0218901 0)
(1.18432 0.0208364 0)
(1.18656 0.019827 0)
(1.18834 0.0188602 0)
(1.18971 0.0179337 0)
(1.19073 0.0170451 0)
(1.19145 0.0161919 0)
(1.19191 0.0153712 0)
(1.19216 0.0145804 0)
(1.19223 0.0138169 0)
(1.19215 0.0130781 0)
(1.19195 0.0123615 0)
(1.19166 0.0116648 0)
(1.19129 0.010986 0)
(1.19088 0.0103231 0)
(1.19042 0.00967438 0)
(1.18995 0.00903812 0)
(1.18946 0.00841294 0)
(1.18898 0.00779751 0)
(1.1885 0.00719068 0)
(1.18803 0.00659139 0)
(1.18759 0.0059987 0)
(1.18718 0.00541176 0)
(1.18679 0.00482982 0)
(1.18645 0.00425219 0)
(1.18613 0.00367822 0)
(1.18586 0.00310733 0)
(1.18564 0.002539 0)
(1.18545 0.00197271 0)
(1.18531 0.00140798 0)
(1.18522 0.000844352 0)
(1.18517 0.00028138 0)
(0.696312 0.0425682 0)
(0.723524 0.0437591 0)
(0.751151 0.0447217 0)
(0.778971 0.0454298 0)
(0.806768 0.0458883 0)
(0.834337 0.046108 0)
(0.861484 0.0461003 0)
(0.88803 0.0458791 0)
(0.91381 0.04546 0)
(0.938682 0.0448602 0)
(0.962518 0.0440982 0)
(0.985214 0.043193 0)
(1.00668 0.0421643 0)
(1.02686 0.0410314 0)
(1.04571 0.0398137 0)
(1.06319 0.0385296 0)
(1.07931 0.0371966 0)
(1.09406 0.0358309 0)
(1.10749 0.0344476 0)
(1.11962 0.0330599 0)
(1.1305 0.0316794 0)
(1.14019 0.0303163 0)
(1.14876 0.0289789 0)
(1.15628 0.0276738 0)
(1.16283 0.0264063 0)
(1.16848 0.0251801 0)
(1.1733 0.0239977 0)
(1.17738 0.0228604 0)
(1.18078 0.0217686 0)
(1.18359 0.0207217 0)
(1.18587 0.0197187 0)
(1.18767 0.0187577 0)
(1.18907 0.0178368 0)
(1.19012 0.0169534 0)
(1.19086 0.0161051 0)
(1.19135 0.0152891 0)
(1.19161 0.0145029 0)
(1.1917 0.0137437 0)
(1.19163 0.013009 0)
(1.19145 0.0122964 0)
(1.19117 0.0116037 0)
(1.19082 0.0109287 0)
(1.19042 0.0102695 0)
(1.18997 0.00962435 0)
(1.1895 0.00899163 0)
(1.18903 0.00836989 0)
(1.18855 0.00775783 0)
(1.18807 0.00715429 0)
(1.18761 0.00655821 0)
(1.18718 0.00596867 0)
(1.18677 0.00538482 0)
(1.18639 0.0048059 0)
(1.18604 0.00423122 0)
(1.18573 0.00366016 0)
(1.18546 0.00309214 0)
(1.18524 0.00252662 0)
(1.18505 0.00196312 0)
(1.18491 0.00140115 0)
(1.18482 0.000840261 0)
(1.18478 0.000280018 0)
(0.673414 0.0431115 1.72941e-22)
(0.674512 0.0427049 5.28751e-22)
(0.675603 0.0423025 -3.10137e-22)
(0.676688 0.0419046 -4.23829e-21)
(0.677766 0.0415108 3.47963e-21)
(0.661992 0.042364 -9.28444e-22)
(0.663175 0.0419629 -2.39472e-21)
(0.664351 0.0415661 4.20634e-21)
(0.66552 0.0411736 -1.62411e-21)
(0.666681 0.0407853 1.21581e-21)
(0.650619 0.041569 -2.13243e-21)
(0.651888 0.0411738 -7.04335e-22)
(0.65315 0.0407828 9.81355e-22)
(0.654403 0.0403961 1.69479e-21)
(0.655647 0.0400137 -5.71256e-22)
(0.63932 0.0407219 -3.13899e-21)
(0.640677 0.040333 3.39486e-21)
(0.642024 0.0399484 -8.78243e-22)
(0.643362 0.039568 -3.94339e-21)
(0.64469 0.0391918 3.28599e-21)
(0.626668 0.0402012 -7.34297e-22)
(0.628122 0.0398152 -2.9457e-21)
(0.629566 0.0394334 -1.95989e-21)
(0.631 0.0390558 3.6884e-22)
(0.632422 0.0386824 -1.2848e-22)
(0.61551 0.0392269 6.84663e-21)
(0.617053 0.0388487 -5.76399e-21)
(0.618584 0.0384746 3.12477e-21)
(0.620103 0.0381047 -3.24315e-21)
(0.621611 0.0377389 2.49237e-21)
(0.604508 0.0381927 -3.27719e-21)
(0.606138 0.0378229 3.4575e-21)
(0.607756 0.0374573 -6.93376e-21)
(0.609361 0.0370957 4.753e-21)
(0.610954 0.0367382 1.19383e-21)
(0.593689 0.0370987 -1.85632e-21)
(0.595407 0.0367382 -2.78866e-21)
(0.597111 0.0363817 8.36099e-21)
(0.598801 0.0360292 -1.79361e-21)
(0.600478 0.0356806 1.97893e-21)
(0.581263 0.0363001 -1.34602e-21)
(0.583082 0.0359455 -1.77561e-21)
(0.584886 0.0355948 3.60008e-21)
(0.586676 0.0352481 -7.11184e-21)
(0.58845 0.0349053 5.18781e-22)
(0.59021 0.0345664 2.11247e-21)
(0.570809 0.0350774 -2.00938e-21)
(0.572715 0.0347335 8.46359e-22)
(0.574604 0.0343934 -8.77744e-22)
(0.576478 0.0340572 4.04476e-21)
(0.578336 0.0337248 -3.2687e-21)
(0.560626 0.0337962 3.7557e-21)
(0.562616 0.0334636 -6.66213e-21)
(0.564589 0.0331348 1.30188e-21)
(0.566546 0.0328098 2.27049e-21)
(0.568485 0.0324884 -3.00258e-22)
(0.550741 0.0324574 -1.73828e-21)
(0.552814 0.0321369 3.34106e-21)
(0.554869 0.0318201 -2.8539e-21)
(0.556906 0.0315069 1.65412e-21)
(0.558926 0.0311973 2.86211e-21)
(0.541182 0.0310623 -1.25798e-21)
(0.543336 0.0307546 -7.54989e-22)
(0.545471 0.0304505 8.15822e-22)
(0.547587 0.0301498 1.82793e-21)
(0.549684 0.0298526 2.68898e-21)
(0.531977 0.0296125 5.89339e-21)
(0.53421 0.0293183 -2.84663e-21)
(0.536422 0.0290274 -1.68181e-21)
(0.538615 0.02874 -1.03687e-21)
(0.540788 0.0284558 -4.65453e-22)
(0.520824 0.0283931 -3.81907e-21)
(0.523153 0.0281097 -1.87967e-21)
(0.525462 0.0278296 3.67343e-21)
(0.527749 0.0275527 -2.10344e-21)
(0.530015 0.027279 -1.01808e-21)
(0.532261 0.0270085 2.25967e-21)
(0.512335 0.0268243 6.06127e-22)
(0.514738 0.0265558 2.43339e-21)
(0.517118 0.0262905 -1.33268e-21)
(0.519477 0.0260282 4.148e-23)
(0.521815 0.0257689 1.43443e-21)
(0.52413 0.0255127 -2.79992e-21)
(0.504282 0.0252059 5.41371e-22)
(0.506755 0.024953 -6.77725e-22)
(0.509205 0.024703 -4.63303e-22)
(0.511632 0.024456 -5.42255e-22)
(0.514037 0.0242118 -1.50897e-22)
(0.496691 0.0235405 -1.00028e-21)
(0.49923 0.0233037 -1.64217e-21)
(0.501746 0.0230697 -6.35294e-22)
(0.504238 0.0228384 2.01103e-21)
(0.506707 0.0226098 2.07681e-21)
(0.489585 0.0218304 -1.43407e-21)
(0.492187 0.0216104 1.63524e-21)
(0.494764 0.0213929 -8.02345e-22)
(0.497317 0.0211779 1.27077e-22)
(0.499846 0.0209654 7.90316e-22)
(0.482986 0.0200787 -2.96309e-21)
(0.485647 0.0198758 -5.74223e-23)
(0.488282 0.0196754 3.31632e-21)
(0.490892 0.0194772 -2.45058e-21)
(0.493477 0.0192815 -4.93336e-22)
(0.476917 0.0182881 -8.19719e-22)
(0.479631 0.018103 -9.929e-22)
(0.482319 0.0179201 -7.67451e-23)
(0.484982 0.0177393 -1.01718e-21)
(0.487619 0.0175606 1.46509e-21)
(0.471396 0.0164619 -2.58553e-22)
(0.474159 0.016295 -1.78492e-22)
(0.476896 0.01613 -9.16766e-22)
(0.479607 0.015967 1.58359e-21)
(0.482291 0.015806 9.34888e-22)
(0.466441 0.0146033 -6.1284e-22)
(0.469249 0.014455 -2.19167e-21)
(0.472029 0.0143085 2.78594e-21)
(0.474783 0.0141637 -1.01556e-21)
(0.47751 0.0140206 1.09312e-21)
(0.462069 0.0127159 -6.50787e-22)
(0.464916 0.0125866 -3.54228e-22)
(0.467735 0.0124588 -2.10673e-24)
(0.470527 0.0123326 3.29457e-22)
(0.473292 0.0122078 2.44302e-22)
(0.455385 0.0109144 7.61748e-23)
(0.458294 0.0108031 -3.8673e-23)
(0.461175 0.0106932 5.28679e-22)
(0.464028 0.0105845 4.37226e-22)
(0.466853 0.0104771 -1.05116e-24)
(0.469651 0.010371 6.05704e-22)
(0.452191 0.0089602 -1.01727e-21)
(0.455129 0.00886876 -5.31313e-22)
(0.458038 0.0087784 4.03415e-22)
(0.460919 0.0086891 -6.18269e-22)
(0.463772 0.00860087 1.24582e-21)
(0.466597 0.00851368 -1.25252e-22)
(0.449623 0.00698794 -7.64589e-22)
(0.452584 0.00691657 8.46109e-22)
(0.455516 0.00684604 6.49331e-22)
(0.458419 0.00677635 -6.15775e-22)
(0.461295 0.00670749 -4.67676e-22)
(0.464142 0.00663944 3.81311e-22)
(0.447689 0.00500154 -6.30815e-22)
(0.450667 0.00495043 2.26769e-22)
(0.453617 0.00489992 -5.2887e-22)
(0.456538 0.00485001 -3.80823e-23)
(0.45943 0.0048007 7.13959e-22)
(0.462294 0.00475197 -3.71876e-22)
(0.446396 0.00300499 -1.20509e-22)
(0.449386 0.00297427 4.29191e-22)
(0.452347 0.00294392 -9.17381e-23)
(0.455279 0.00291392 -3.02999e-22)
(0.458183 0.00288428 2.76636e-22)
(0.461058 0.00285499 -3.73166e-22)
(0.445749 0.00100235 1.19632e-22)
(0.448745 0.000992098 8.16882e-23)
(0.451711 0.000981971 -1.50658e-22)
(0.454649 0.000971963 1.14491e-22)
(0.457558 0.000962075 5.42961e-23)
(0.460439 0.000952305 -1.27792e-22)
)
;
boundaryField
{
inlet
{
type uniformFixedValue;
uniformValue constant (1 0 0);
value nonuniform 0();
}
outlet
{
type pressureInletOutletVelocity;
value nonuniform 0();
}
cylinder
{
type fixedValue;
value nonuniform 0();
}
top
{
type symmetryPlane;
}
bottom
{
type symmetryPlane;
}
defaultFaces
{
type empty;
}
procBoundary40to39
{
type processor;
value nonuniform List<vector>
188
(
(0.442723 -0.00101271 -2.46504e-22)
(0.443376 -0.00303607 -3.32538e-22)
(0.444681 -0.00505325 3.19993e-22)
(0.446633 -0.00706015 1.68574e-22)
(0.449225 -0.00905272 1.58483e-21)
(0.452448 -0.011027 -1.27984e-21)
(0.459195 -0.0128467 1.71113e-21)
(0.459195 -0.0128467 1.71113e-21)
(0.463606 -0.0147534 3.64824e-21)
(0.468606 -0.0166307 7.15385e-22)
(0.474177 -0.0184754 2.3067e-21)
(0.480301 -0.0202839 -1.01668e-21)
(0.486958 -0.0220531 8.48891e-22)
(0.494127 -0.02378 1.16164e-21)
(0.501786 -0.0254618 2.20536e-21)
(0.50991 -0.0270958 -7.03819e-22)
(0.518473 -0.0286797 4.35399e-21)
(0.529724 -0.0299101 -3.29465e-21)
(0.529724 -0.0299101 -3.29465e-21)
(0.539008 -0.0313735 1.55752e-21)
(0.548649 -0.0327815 -1.25931e-21)
(0.558618 -0.0341325 -3.18461e-21)
(0.568887 -0.0354253 4.78037e-21)
(0.579428 -0.0366587 7.92626e-21)
(0.591957 -0.0374633 4.82081e-21)
(0.591957 -0.0374633 4.82081e-21)
(0.602864 -0.0385665 -7.58317e-22)
(0.613955 -0.0396093 1.43234e-21)
(0.625202 -0.0405915 2.84135e-21)
(0.637954 -0.041115 4.4263e-21)
(0.637954 -0.041115 4.4263e-21)
(0.64934 -0.0419686 -3.37402e-21)
(0.660801 -0.0427694 1.38188e-21)
(0.67231 -0.0435225 -2.28518e-21)
(0.691492 -0.0446096 0)
(0.719638 -0.0458274 0)
(0.748193 -0.0468055 0)
(0.776923 -0.0475153 0)
(0.805602 -0.047962 0)
(0.834015 -0.0481573 0)
(0.861959 -0.0481137 0)
(0.889247 -0.0478459 0)
(0.915711 -0.0473708 0)
(0.9412 -0.046707 0)
(0.965585 -0.0458743 0)
(0.988759 -0.0448933 0)
(1.01064 -0.0437849 0)
(1.03115 -0.0425702 0)
(1.05026 -0.0412696 0)
(1.06795 -0.0399027 0)
(1.0842 -0.0384882 0)
(1.09905 -0.0370433 0)
(1.1125 -0.0355835 0)
(1.12462 -0.0341229 0)
(1.13545 -0.0326734 0)
(1.14506 -0.0312455 0)
(1.15353 -0.0298475 0)
(1.16092 -0.0284863 0)
(1.16732 -0.0271668 0)
(1.1728 -0.0258927 0)
(1.17746 -0.0246662 0)
(1.18138 -0.0234883 0)
(1.18462 -0.0223592 0)
(1.18727 -0.0212778 0)
(1.18939 -0.0202428 0)
(1.19104 -0.0192522 0)
(1.1923 -0.0183035 0)
(1.19322 -0.0173941 0)
(1.19384 -0.0165211 0)
(1.19421 -0.0156818 0)
(1.19438 -0.0148732 0)
(1.19437 -0.0140927 0)
(1.19422 -0.0133375 0)
(1.19396 -0.0126051 0)
(1.19362 -0.0118932 0)
(1.19321 -0.0111996 0)
(1.19275 -0.0105224 0)
(1.19226 -0.00985969 0)
(1.19175 -0.00920993 0)
(1.19123 -0.00857161 0)
(1.19072 -0.00794342 0)
(1.19022 -0.00732417 0)
(1.18973 -0.0067128 0)
(1.18927 -0.00610836 0)
(1.18884 -0.00550998 0)
(1.18845 -0.00491688 0)
(1.18809 -0.00432834 0)
(1.18777 -0.00374371 0)
(1.18749 -0.00316238 0)
(1.18725 -0.00258378 0)
(1.18706 -0.00200737 0)
(1.18692 -0.00143265 0)
(1.18682 -0.000859121 0)
(1.18677 -0.000286297 0)
(0.691492 0.0446096 0)
(0.719638 0.0458274 0)
(0.748193 0.0468055 0)
(0.776923 0.0475153 0)
(0.805602 0.047962 0)
(0.834015 0.0481573 0)
(0.861959 0.0481137 0)
(0.889247 0.0478459 0)
(0.915711 0.0473708 0)
(0.9412 0.046707 0)
(0.965585 0.0458743 0)
(0.988759 0.0448933 0)
(1.01064 0.0437849 0)
(1.03115 0.0425702 0)
(1.05026 0.0412696 0)
(1.06795 0.0399027 0)
(1.0842 0.0384882 0)
(1.09905 0.0370433 0)
(1.1125 0.0355835 0)
(1.12462 0.0341229 0)
(1.13545 0.0326734 0)
(1.14506 0.0312455 0)
(1.15353 0.0298475 0)
(1.16092 0.0284863 0)
(1.16732 0.0271668 0)
(1.1728 0.0258927 0)
(1.17746 0.0246662 0)
(1.18138 0.0234884 0)
(1.18462 0.0223592 0)
(1.18727 0.0212778 0)
(1.18939 0.0202428 0)
(1.19104 0.0192522 0)
(1.1923 0.0183035 0)
(1.19322 0.0173941 0)
(1.19384 0.0165211 0)
(1.19421 0.0156818 0)
(1.19438 0.0148733 0)
(1.19437 0.0140927 0)
(1.19422 0.0133375 0)
(1.19396 0.0126051 0)
(1.19362 0.0118932 0)
(1.19321 0.0111996 0)
(1.19275 0.0105224 0)
(1.19226 0.00985969 0)
(1.19175 0.00920993 0)
(1.19123 0.00857161 0)
(1.19072 0.00794342 0)
(1.19022 0.00732417 0)
(1.18973 0.0067128 0)
(1.18927 0.00610836 0)
(1.18884 0.00550998 0)
(1.18845 0.00491688 0)
(1.18809 0.00432834 0)
(1.18777 0.00374371 0)
(1.18749 0.00316238 0)
(1.18725 0.00258378 0)
(1.18706 0.00200737 0)
(1.18692 0.00143265 0)
(1.18682 0.000859121 0)
(1.18677 0.000286297 0)
(0.67231 0.0435225 2.27732e-21)
(0.660801 0.0427694 -1.38e-21)
(0.64934 0.0419686 3.29867e-21)
(0.637954 0.041115 -4.34582e-21)
(0.637954 0.041115 -4.34582e-21)
(0.625203 0.0405915 -2.96985e-21)
(0.613955 0.0396093 -1.35723e-21)
(0.602864 0.0385665 9.07948e-22)
(0.591957 0.0374633 -5.01614e-21)
(0.591957 0.0374633 -5.01614e-21)
(0.579428 0.0366587 -7.50376e-21)
(0.568887 0.0354253 -5.10815e-21)
(0.558618 0.0341325 3.51404e-21)
(0.548649 0.0327815 8.66517e-22)
(0.539008 0.0313735 -1.19013e-21)
(0.529724 0.0299102 3.18135e-21)
(0.529724 0.0299102 3.18135e-21)
(0.518473 0.0286797 -4.17993e-21)
(0.50991 0.0270959 4.99782e-22)
(0.501786 0.0254618 -1.97802e-21)
(0.494127 0.02378 -1.18106e-21)
(0.486958 0.0220531 -8.12996e-22)
(0.480301 0.0202839 9.42122e-22)
(0.474177 0.0184754 -2.33749e-21)
(0.468606 0.0166307 -5.56522e-22)
(0.463606 0.0147534 -3.75644e-21)
(0.459195 0.0128467 -1.68098e-21)
(0.459195 0.0128467 -1.68098e-21)
(0.452448 0.011027 1.28458e-21)
(0.449225 0.00905273 -1.58339e-21)
(0.446633 0.00706016 -1.49661e-22)
(0.444681 0.00505326 -2.50715e-22)
(0.443376 0.00303608 3.35038e-22)
(0.442723 0.00101272 2.34685e-22)
)
;
}
procBoundary40to41
{
type processor;
value nonuniform List<vector>
187
(
(0.463292 -0.000942639 -5.99514e-23)
(0.463906 -0.00282605 1.48226e-22)
(0.46513 -0.00470381 -9.59318e-23)
(0.466962 -0.0065722 -2.53261e-23)
(0.469395 -0.00842753 2.68094e-22)
(0.472421 -0.0102662 -3.92797e-22)
(0.476031 -0.0120845 4.71954e-22)
(0.480212 -0.0138792 -1.23246e-21)
(0.48495 -0.0156468 -2.13401e-21)
(0.490231 -0.0173841 1.25599e-21)
(0.496038 -0.019088 2.91288e-21)
(0.502352 -0.0207555 -4.04694e-21)
(0.509153 -0.0223838 -2.87511e-21)
(0.51642 -0.0239704 5.81308e-22)
(0.51642 -0.0239704 5.81308e-22)
(0.526425 -0.0252595 1.77903e-21)
(0.534487 -0.0267412 8.20733e-22)
(0.542941 -0.0281749 9.55699e-22)
(0.551763 -0.0295588 -4.8256e-21)
(0.560928 -0.0308912 -4.62923e-21)
(0.570408 -0.0321708 -2.69716e-21)
(0.580178 -0.0333961 -1.7694e-21)
(0.580178 -0.0333961 -1.7694e-21)
(0.591956 -0.0342313 -3.18568e-21)
(0.602141 -0.035336 -2.20433e-21)
(0.612534 -0.0363847 -4.57936e-21)
(0.623107 -0.0373772 -1.1374e-21)
(0.633834 -0.0383131 4.66374e-21)
(0.633834 -0.0383131 4.66374e-21)
(0.646008 -0.0388197 1.60894e-21)
(0.656883 -0.0396354 -2.28838e-21)
(0.667834 -0.0404013 -6.35172e-22)
(0.678839 -0.0411214 -1.88155e-21)
(0.697261 -0.0421727 0)
(0.724291 -0.0433581 0)
(0.751738 -0.0443173 0)
(0.779382 -0.0450248 0)
(0.807009 -0.0454851 0)
(0.834414 -0.045709 0)
(0.861406 -0.0457078 0)
(0.887807 -0.0454951 0)
(0.913455 -0.0450863 0)
(0.938206 -0.0444984 0)
(0.961935 -0.0437495 0)
(0.984537 -0.0428584 0)
(1.00593 -0.0418446 0)
(1.02604 -0.0407271 0)
(1.04483 -0.039525 0)
(1.06227 -0.0382565 0)
(1.07836 -0.0369389 0)
(1.0931 -0.0355883 0)
(1.10651 -0.0342195 0)
(1.11864 -0.0328457 0)
(1.12953 -0.0314785 0)
(1.13924 -0.0301278 0)
(1.14784 -0.028802 0)
(1.15538 -0.0275077 0)
(1.16195 -0.0262503 0)
(1.16763 -0.0250333 0)
(1.17248 -0.0238595 0)
(1.17659 -0.0227302 0)
(1.18003 -0.0216457 0)
(1.18287 -0.0206056 0)
(1.18518 -0.0196088 0)
(1.18701 -0.0186538 0)
(1.18844 -0.0177383 0)
(1.18951 -0.0168602 0)
(1.19028 -0.0160168 0)
(1.19078 -0.0152055 0)
(1.19107 -0.0144237 0)
(1.19117 -0.0136689 0)
(1.19112 -0.0129384 0)
(1.19096 -0.0122299 0)
(1.19069 -0.0115411 0)
(1.19035 -0.0108699 0)
(1.18996 -0.0102145 0)
(1.18952 -0.00957301 0)
(1.18906 -0.00894387 0)
(1.18859 -0.00832564 0)
(1.18812 -0.00771701 0)
(1.18765 -0.00711682 0)
(1.1872 -0.00652404 0)
(1.18676 -0.00593772 0)
(1.18676 -0.00593772 0)
(1.18595 -0.00532843 0)
(1.18558 -0.00475578 0)
(1.18524 -0.00418727 0)
(1.18493 -0.00362227 0)
(1.18467 -0.00306023 0)
(1.18444 -0.00250063 0)
(1.18426 -0.00194296 0)
(1.18413 -0.00138679 0)
(1.18404 -0.000831661 0)
(1.18399 -0.000277153 0)
(0.697261 0.0421727 0)
(0.724291 0.0433581 0)
(0.751738 0.0443174 0)
(0.779382 0.0450248 0)
(0.807009 0.0454851 0)
(0.834414 0.045709 0)
(0.861406 0.0457078 0)
(0.887807 0.0454951 0)
(0.913455 0.0450863 0)
(0.938206 0.0444984 0)
(0.961935 0.0437495 0)
(0.984537 0.0428585 0)
(1.00593 0.0418446 0)
(1.02604 0.0407271 0)
(1.04483 0.039525 0)
(1.06227 0.0382565 0)
(1.07836 0.0369389 0)
(1.0931 0.0355883 0)
(1.10651 0.0342195 0)
(1.11864 0.0328457 0)
(1.12953 0.0314785 0)
(1.13924 0.0301278 0)
(1.14784 0.028802 0)
(1.15538 0.0275077 0)
(1.16195 0.0262503 0)
(1.16763 0.0250333 0)
(1.17248 0.0238595 0)
(1.17659 0.0227302 0)
(1.18003 0.0216457 0)
(1.18287 0.0206056 0)
(1.18518 0.0196089 0)
(1.18701 0.0186538 0)
(1.18844 0.0177383 0)
(1.18951 0.0168602 0)
(1.19028 0.0160168 0)
(1.19078 0.0152055 0)
(1.19107 0.0144237 0)
(1.19117 0.0136689 0)
(1.19112 0.0129384 0)
(1.19096 0.0122299 0)
(1.19069 0.0115411 0)
(1.19035 0.0108699 0)
(1.18996 0.0102145 0)
(1.18952 0.00957301 0)
(1.18906 0.00894387 0)
(1.18859 0.00832564 0)
(1.18812 0.00771701 0)
(1.18765 0.00711682 0)
(1.1872 0.00652404 0)
(1.18676 0.00593772 0)
(1.18636 0.00535702 0)
(1.18598 0.0047812 0)
(1.18564 0.00420957 0)
(1.18533 0.0036415 0)
(1.18506 0.00307643 0)
(1.18484 0.00251382 0)
(1.18466 0.0019532 0)
(1.18452 0.00139408 0)
(1.18443 0.000836028 0)
(1.18438 0.000278608 0)
(0.678839 0.0411214 1.87456e-21)
(0.667834 0.0404013 6.60364e-22)
(0.656883 0.0396354 2.19793e-21)
(0.646008 0.0388197 3.10773e-21)
(0.633834 0.0383131 -4.62349e-21)
(0.633834 0.0383131 -4.62349e-21)
(0.623107 0.0373772 1.15668e-21)
(0.612534 0.0363847 4.59655e-21)
(0.602141 0.035336 1.87827e-21)
(0.591956 0.0342313 3.55449e-21)
(0.580178 0.0333961 1.78586e-21)
(0.580178 0.0333961 1.78586e-21)
(0.570408 0.0321708 2.65219e-21)
(0.560928 0.0308912 4.43122e-21)
(0.551763 0.0295588 4.8686e-21)
(0.542941 0.0281749 -5.69419e-22)
(0.534487 0.0267412 -8.72756e-22)
(0.526425 0.0252595 -1.94568e-21)
(0.51642 0.0239704 -8.56753e-22)
(0.51642 0.0239704 -8.56753e-22)
(0.509153 0.0223838 2.92876e-21)
(0.502352 0.0207555 4.25651e-21)
(0.496038 0.019088 -2.79942e-21)
(0.490231 0.0173841 -1.36232e-21)
(0.48495 0.0156468 2.06344e-21)
(0.480212 0.0138792 -9.38343e-22)
(0.476031 0.0120846 -5.17859e-22)
(0.472421 0.0102662 3.75761e-22)
(0.469395 0.00842754 -1.80813e-22)
(0.466962 0.00657221 -7.51131e-23)
(0.46513 0.00470382 1.63266e-22)
(0.463906 0.00282606 -1.60475e-22)
(0.463292 0.000942651 1.97781e-22)
)
;
}
}
// ************************************************************************* //
| [
"[email protected]"
] | ||
2e91e2ac4301f439e1218588a115d604dac96cf5 | cf58d74018ed456f6a2ec9e9d83ccd4ba41e5a47 | /combination_of_strings_with_qsn_mark.cpp | c90dfc71df71bfa33198420684792133d9275a73 | [] | no_license | jaishreedhage/Competitive-coding | b0e2a8331e69e044f4b537102b17d3d9a923d985 | df57007a011a10f46e4cceb99a3aca6bc71f1982 | refs/heads/master | 2021-07-14T13:05:13.674795 | 2017-10-20T06:19:57 | 2017-10-20T06:19:57 | 107,639,988 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 609 | cpp | #include <iostream>
#include <string>
using namespace std;
void genCombos(string s,int l,int h){
if(l==h+1){
cout<<s<<endl;
return;
}
if(s[l]=='?'){
s[l] = '0';
genCombos(s,l+1,h);
s[l] = '1';
genCombos(s,l+1,h);
}
else
genCombos(s,l+1,h);
}
int main(){
int Q;
cin>>Q;
while(Q>0){
string s;
cin>>s;
genCombos(s,0,s.length()-1);
Q--;
}
return 1;
}
// https://knaidu.gitbooks.io/problem-solving/content/strings/combinations_of_strings_with.html
| [
"[email protected]"
] | |
b41026dc8c812b12d3501b94206aa18d2d418c41 | 8590b7928fdcff351a6e347c4b04a085f29b7895 | /UED/library/database_file.h | 953b80c4718ae893c31596b6fd04fdd59f21f9fb | [] | no_license | liao007/VIC-CropSyst-Package | 07fd0f29634cf28b96a299dc07156e4f98a63878 | 63a626250ccbf9020717b7e69b6c70e40a264bc2 | refs/heads/master | 2023-05-23T07:15:29.023973 | 2021-05-29T02:17:32 | 2021-05-29T02:17:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 32,523 | h | #ifndef database_fileH
#define database_fileH
#include "UED/library/UED.h"
#ifndef binary_record_fileH
# include "corn/format/binary/binary_record_file.h"
#endif
#ifndef unitconvH
# include "corn/measure/unitconv.h"
#endif
#ifndef units_defH
# include "UED/library/units_def.h"
#endif
#ifndef indexH
# include "UED/library/index.h"
#endif
#include "corn/chronometry/date_I.h"
#ifndef enumlistH
# include "corn/container/enumlist.h"
#endif
#include "corn/dynamic_array/dynamic_array_T.h"
#include "common/CS_parameter.h"
#include "UED/library/variable_format.h"
//_Forward declarations_________________________________________________________
class Geolocation;
//_______________________________________________________Forward declarations__/
// Universal Environmental Database accessor class. //970305
// Forward declartions
namespace CORN
{ class Bidirectional_list;
class Text_list; //091021
}
//_____________________________________________________________________________
namespace UED {
//______________________________________________________________________________
class _UED_DLL
Database_file //070718
: public Binary_record_file_dynamic_indexed //000705
, public Units_convertor //030228
{
friend class Database_file_indexed;
friend class UED_variable_definition_format_0_record; //990114
friend class UED_units_definition_format_0_record; //990114
public:
Record_base *current_nondata_rec; //971104 eventually rename to current_record
Geolocation_record *geolocation_rec_in_memory; //070618
//Only an optional reference (owned by binary_record_file_dynamic_index)
private:
contribute_ Binary_data_record_cowl *current_data_rec; //971104
bool auto_float16; //140612
public: // enumerations
std::string compose_standard_variable_description(UED::Variable_code var_code);//971106
public:
virtual Binary_record *append_record //000706
(Binary_record *record_to_append,bool write_immediately) submission_;
virtual Binary_record *instanciate_record(Record_code code) const; //990114
// This method should be overridden by classes derived from Database_file
// inorder for it to recognize and properly load any new record types.
// Overridden instanciate_record() methods should call Database_file::instanciate_record()
// or parent classes derived from Database_file inorder to recognize all record types.
public:
Database_file //000711
(const char *ued_filename
// the filename may null indicating that
// records are to be kept in memory and will not be written to a file.
,std::ios_base::openmode _openmode //130311
,bool _auto_float16); //140612
inline virtual ~Database_file() {} //081129
virtual bool initialize() initialization_; //140119_990112
virtual bool done_with_dates_before(const CORN::Date_const &earliest_date); //141103
bool current_data_record_is_target //990119
(Record_code target_rec_code
,Variable_code target_var_code);
virtual float32 get_value //970921
(Variable_code variable
,const Time_query &time_query //990118
// UED will try to give the value for the specified date and time.
// If the date and time is not available, UED will try to estimate
// a value (the returned attribute will be set accordingly
// If the value cannot be estimated, the attribute will also be set accordingly
,CORN::Units_code &units
// The program can specify the desired units.
// UED will try to convert to those units, if it can't
// units will be set to the units available
,CORN::Quality &attribute
// The program can specify the desired attribute,
// UED will try to give a value for the attribute
// attribute will be set to the attributes available
);
virtual float32 set_value // was set
(float32 value
,const Time_query &time_query //990118
// UED will try to give the value for the specified date and time.
// If the date and time is not available, UED will try to estimate
// a value (the returned attribute will be set accordingly.
// If the value cannot be estimated, the attribute will also be set accordingly.
// If a record doesn't already exist for the time period matching the date and time,
// a record will be created having the specified units.
,CORN::Units_code &units
// The program can specify the units of the variable.
// UED will try to convert the value to the units the data is stored in
// if it can't figure out how to do that, set fails returning false.
// Note that units conversion is a feature of the
// UED database class, not the record itself.
,CORN::Quality &attribute // must be a returned value //000710
// The program can specify the desired attribute,
// UED will try to give a value for the attribute
// attribute will be set to the attributes available
// UED will check the current record attribute; if the attribute
// doesn't match it will check if individual timestep attributes
// exist and will not overwrite values of higher quality unless
// override safty is enabled.
,const Data_record_creation_layout &creation_layout
// If a time series record doesn't exist for the specified
// variable code with the specified date and time, a new record
// will be created using this layout.
,bool &record_created
,bool override_safety // = false
);
virtual bool set_vector //980925
(const Dynamic_array<float32> &values //120804
,datetime64 date_time //030714
// UED will try to give the value for the specified date and time.
// If the date and time is not available, UED will try to estimate
// a value (the returned attribute will be set accordingly
// If the value cannot be estimated, the attribute will also be set accordingly
// If a record doesn't already exist for the time period matching the date and time,
// A record will be created having the specified units.
,CORN::Units_code &units
// The program can specify the units of the variable.
// UED will try to convert the value to the units the data is stored in
// if it can't figure out how to do that, set fails returning false.
// Note that units conversion is a feature of the
// UED database class, not the record itself.
,CORN::Quality &attribute // must be a returned value //000710
// The program can specify the desired attribute,
// UED will try to give a value for the attribute
// attribute will be set to the attributes available
// UED will check the current record attribute; if the attribute
// doesn't match it will check if individual timestep attributes
// exist and will not overwrite values of higher quality unless
// override safty is enabled.
,const Data_record_creation_layout &creation_layout
// If a time series record doesn't exist for the specified
// variable code with the specified date and time, a new record
// will be created using this layout.
,bool &record_created //000405
);
virtual int16 get_vector //980928
(float32 vector_data[]
,Record_code rec_type //990118
,Variable_code variable
,const Time_query &time_query //990118
// UED will try to give the value for the specified date and time.
// If the date and time is not available, UED will try to estimate
// a value (the returned attribute will be set accordingly
// If the value cannot be estimated, the attribute will also be set accordingly
,CORN::Units_code &units
// The program can specify the desired units.
// UED will try to convert to those units, if it can't
// units will be set to the units available
,CORN::Quality &attribute
// The program can specify the desired attribute,
// UED will try to give a value for the attribute
// attribute will be set to the attributes available
,bool &record_created); //000405
// Returns the size of the vector
// The vector data is copied into buffer
virtual bool get_parameter_on //151119
(modifiable_ CS::Parameter ¶meter
,Variable_code variable
,const Time_query &time_query
,Record_code ) stream_IO_; //190122const;
// although rec_type is not used here, it is used in derived classes
virtual bool set_parameter_on //151221
(const CS::Parameter ¶meter
,Variable_code variable
,const Time_query &time_query
,Record_code rec_type);
public: // Annotation functions
const char *get_variable_description //070223
(Variable_code var_code
,std::string &description); //170424
// This method returns (in description) a description of the variable
// This is a function of Database_file because new codes can be defined within the database.
const Variable_format_abstract *get_variable_definition(Variable_code var_code) modification_; //160620_010216
///< \return a variable definition for the selected code,
/// Either from variables defined in the database or standard definitions.
/// The returned variable definition is read only!
nat16 get_variable_definitions
(Variable_format_abstract *variable_definitions[] //160620
,nat16 max_allocation) ; // provision_;
///< Fill the provided array with pointers to the current variable definitions.
/// The max_allocation is the maximum array size.
/// The variable definitions are provided (loaded in memory) as needed.
/// \return the number of variable definitions filled into the array.
/// (The remaining pointers in the array are cleared to 0).
nat16 get_defined_variables_codes(nat32 variable_codes[],nat16 max_alloc); //140922
nat16 get_defined_variables_codes(CORN::Dynamic_array<nat32>&variable_codes); //190102
std::string &get_units_description(CORN::Units_code units_code,bool abbreviated = true); //980818
// This method returns (in buffer) a description of the units
// This is a function of Database_file because new codes can be defined within the database.
Units_definition *get_units_definition
(CORN::Units_code units_code,bool abbreviated = true); //980818
// This method returns a units definition for the selected code,
// Either from units defined in the database or standard definitions.
float32 generalized_conversion_factor //990508
(int16 from_general_sub_units
,int16 to_general_sub_units);
public: // Periods
const Period_record * set_period(const Period_record ©_from_period); //041011
//This modifies or adds a period with the specified description and attributes.
//Arguments for options that are not used may be 0
//Existing periods with the same start/end dates,
//options and options values and will be updated,
//will get an updated period_description.
//Returns a pointer to either the modified matching period record, or the new period record.
//returns 0 if could not be set.
const Period_record *get_period //050120
(nat32 consider_options
,datetime64 at_date
,nat32 application_code = 0
,nat32 enumeration = 0
,nat32 index = 0
,Variable_code variable_code = 0);
// actually I think should be stream_IO_
// Searches the database for a period the date falls with in the period
// Returns the period record.
// If the period's date matches and the periods options
// specify application code, enumeration, and/or index
// these specified parameters will must also match.
// The consider_options bit mask specifies the options that must match
// It does not specify that the records options bit mask must be identical!
// This returns the first period encountered that has a date time that matches the time query,
// options and values for selected options.
// Return 0 if no matching period is found. 041011
nat32 copy_periods_to_database(Database_file &target_database); //050125
// This copies all the listed periods from this database to the specified target database.
// Returns the number of periods copied.
public: // The following function provide a database interface similar to CORN_dbase
Record_base *goto_BOF() stream_IO_; //070209
// This has been provided for backward compatibility
// use read_record(istream::beg);
// This method goes to the beginning of the file and reads the first record into the current record buffer.
// The previous current record is first moved to aux.
// The file pointer is positioned back to the beginning of the record (BOF).
// Returns the record code
Record_base *goto_next() stream_IO_; //970915
// This method advances the file pointer to the next record and reads the record.
// The current record is first swapped to aux.
// The next record is determined by the current record's size of curr_record + header bytes.
// If there isn't current record, then it does a goto_BOF() instead
// The file pointer is positioned back to the beginning of the record.
// Returns the record code.
Record_base *goto_next_record_of_type(Record_code record_type) stream_IO_; //120509_991210
// This goes to the next record of the specified type
Binary_data_record_cowl *goto_next_data_record() stream_IO_; //990430
// Similar to goto next, but skips non data record.
// Returns pointer to the retrieved datarecord or 0 if no more data record encountered.
public: // The following methods force the database to write various local definitions
virtual bool write_general_comment
(const char * general_comment); //971208
///< This is a optional comment that may occur anywhere in the document.
/// There may be more than one comment records.
/// The comment will not be added if the same comment already appears in the file.
/// \return true if the comment was added, false if the comment not unique.
virtual bool write_generating_application //971208
(nat16 version,const char *application_name);
///< This is a optional comment identifying the application that is generating the database file.
/// This method will usually only be called once.
/// The version can be any number used by the application
/// For example the upper byte could be the version number and the lower byte the release.
/// There may be more than one of these record
/// \return true if the record was added, false if the a record with version and application name already exists in the file
virtual bool write_database_description
(const char * database_description); //971208
///< This is a comment describing the application.
/// There can be multiple calls to write_database_description
/// The first occurance shall be considered the major title;
/// any subsequence descriptions shall be considered subtitles.
/// \return true if the record was added, false if a record with description already exists in the file.
virtual void write_end_definitions_marker(); //971207
// After writting definitions to the database, we will output
// the end definitions marker record to indicate that there
// will be no definitions in the file after this point.
// This allows the database class when reading the file as input
// to stop looking for definition records.
// Otherwise the database object will read the entire file looking
// for definition records.
void include_var_code_def
(const Variable_format_0 &variable_def); //990426
void include_var_code_def_ontological //160620
(const Variable_format_ontological &variable_def);
void include_units_code_def
(const Units_definition &units_def); //990426
// These include methods will output variable code definition records
// for the specified variable/units codes.
// The definitions will not be duplicated if duplicated codes are encountered.
/*190515
Geolocation_record *get_geolocation_record() stream_IO_; //050429
//180214 rename this to mod_geolocation_record
const Geolocation_record *get_geolocation_record_immutable() stream_IO_; //050429
//180214 rename this to ref_geolocation_record
*/
Geolocation_record *mod_geolocation_record() stream_IO_; //050429
//180214 rename this to mod_geolocation_record
const Geolocation_record *ref_geolocation_record() stream_IO_; //050429
//180214 rename this to ref_geolocation_record
// Returns the location record (if present)
// otherwise return 0 indicating no location record is present.
// The returned record is owned by the this, the caller must not delete it, but can update it.
Geolocation_record *take_geolocation_record(Geolocation_record *geo_location_record) modification_; //050523
// This replace/updates any existing location record, or appends the location record if not present.
// The location record is relinquished to this UED.
// Returns the passed location_record if successful, otherwise return 0.
const Geolocation_record *know_geolocation(const Geolocation &geo_location) modification_; //050523
// This replace/updates any existing location record, or appends the location record if not present.
// Returns the existing or rendered location_record if successful, otherwise return 0.
Geolocation_record *provide_geolocation_record() stream_IO_; //140606
// Gets the geolocation record.
// If doesn't exists it creates one.
nat16 get_descriptions (CORN::Text_list &descriptions) stream_IO_; //091021
nat16 get_comments (CORN::Text_list &comments) stream_IO_; //091021
const Generating_application_record *get_generating_application_record() stream_IO_;
public: // identification method overrides
inline virtual nat16 get_BOF_code() const { return UED_marker_BOF; } //990108
inline virtual nat16 get_EOF_code() const { return UED_marker_EOF; } //990108
inline virtual nat16 get_free_code(Record_code /*current_code*/) const { return UED_free_space; } //000703
// Currently I only have the option of marking the record block as free
// Eventually I will want to have a deleted bit in the header
// so records could be undeleted
virtual nat32 free_records_for_period(CORN::Year start_year, CORN::Year end_year); //100105
/**< Delete all data records within the time period
Records that have dates outside this period are not deleted.
(data values of records that are not deleted but that are
within the range of years are not delete and not invalidated)
**/
virtual nat32 free_records_for_period_variable
(CORN::Year start_year, CORN::Year end_year,Variable_code variable_code); //110601
/**< Delete all data records within the time period
having the specied variable code
Records that have dates outside this period are not deleted.
(data values of records that are not deleted but that are
within the range of years are not delete and not invalidated)
**/
};
//_Database_file_______________________________________________________________/
class _UED_DLL
Database_file_indexed : public Database_file //070718
{
friend class UED_viewer_options_dialog; //<- uses indexes to display available variables //971101
friend class UED_graphs_dialog; // These are not in the UED namespace!//971103
protected:
mutable Variable_index_list indexes;
public:
// The following functions return the file position for a record
// The specified year, date, or time
// 0 is returned if there is no record containing the specified year.
// (0 is ok because the record at file pos is always a header)
virtual float32 set_value // was set //000710
(float32 value
, const Time_query &time_query //990118
// UED will try to give the value for the specified date and time.
// If the date and time is not available, UED will try to estimate
// a value (the returned attribute will be set accordingly
// If the value cannot be estimated, the attribute will also be set accordingly
// If a record doesn't already exist for the time period matching the date and time,
// A record will be created having the specified units.
,CORN::Units_code &units
// The program can specify the units of the variable.
// UED will try to convert the value to the units the data is stored in
// if it can't figure out how to do that, set fails returning false.
// Note that units conversion is a feature of the
// UED database class, not the record itself.
,CORN::Quality &attribute // was a returned value //000710
// The program can specify the desired attribute,
// UED will try to give a value for the attribute
// attribute will be set to the attributes available
// UED will check the current record attribute; if the attribute
// doesn't match it will check if individual timestep attributes
// exist and will not overwrite values of higher quality unless
// override safty is enabled.
,const Data_record_creation_layout &creation_layout
// If a time series record doesn't exist for the specified
// variable code with the specified date and time, a new record
// will be created using this layout.
,bool &record_created //000405
,bool override_safety = false);
// Returns the value as set (if value could not be safetly replaced)
// the value as fixed in the database will be returned.
virtual float32 get_no_create //000518
(Record_code rec_type //040125
,Variable_code variable
,const Time_query &time_query //990118
,CORN::Units_code &requested_units
,CORN::Quality &attribute) stream_IO_;
virtual bool set_vector //980925
(const Dynamic_array<float32> &values //120806
,datetime64 date_time // Created vectors occur only at specific types //030714
// UED will try to give the value for the specified date and time.
// If the date and time is not available, UED will try to estimate
// a value (the returned attribute will be set accordingly
// If the value cannot be estimated, the attribute will also be set accordingly
// If a record doesn't already exist for the time period matching the date and time,
// A record will be created having the specified units.
,CORN::Units_code &units
// The program can specify the units of the variable.
// UED will try to convert the value to the units the data is stored in
// if it can't figure out how to do that, set fails returning false.
// Note that units conversion is a feature of the
// UED database class, not the record itself.
,CORN::Quality &attribute // was a returned value //000710
// The program can specify the desired attribute,
// UED will try to give a value for the attribute
// attribute will be set to the attributes available
// UED will check the current record attribute; if the attribute
// doesn't match it will check if individual timestep attributes
// exist and will not overwrite values of higher quality unless
// override safty is enabled.
,const Data_record_creation_layout &creation_layout
// If a time series record doesn't exist for the specified
// variable code with the specified date and time, a new record
// will be created using this layout.
,bool &record_created) modification_;//000405
int16 get_vector //980928
(float32 vector_data[]
,const Time_query &time_query //990118
,CORN::Units_code &requested_units
,CORN::Quality &attribute
,const Data_record_creation_layout &creation_layout
,bool &record_created); //000405
// This form of get vector allows the vector to be created if not already in the database
virtual int16 get_vector //980928
(float32 vector_data[]
,Record_code rec_type //990118
,Variable_code variable
,const Time_query &time_query //990118
// UED will try to give the value for the specified date and time.
// If the date and time is not available, UED will try to estimate
// a value (the returned attribute will be set accordingly
// If the value cannot be estimated, the attribute will also be set accordingly
,CORN::Units_code &units
// The program can specify the desired units.
// UED will try to convert to those units, if it can't
// units will be set to the units available
,CORN::Quality &attribute
// The program can specify the desired attribute,
// UED will try to give a value for the attribute
// attribute will be set to the attributes available
,bool &record_created); //000405
// Returns the size of the vector
// The vector data is copied into buffer
// This form of get_vector doesn't allow the vector to be created.
virtual bool get_parameter_on //151122
(modifiable_ CS::Parameter ¶meter
,Variable_code variable
,const Time_query &time_query
,Record_code rec_type) stream_IO_; //160331
virtual bool set_parameter_on //180808
(const CS::Parameter ¶meter
,const Time_query &time_query
,const Data_record_creation_layout &creation_layout);
virtual Binary_record *append_record //000706
(Binary_record *record_to_append,bool write_immediately) submission_;
virtual Binary_data_record_cowl *locate_data_record //990114
(Record_code rec_type
,Variable_code var_code
,const Time_query &time_query) stream_IO_; //990118
Binary_data_record_cowl *locate_or_create_data_record //990111
(const Time_query &time_query //990118
,const Data_record_creation_layout &creation_layout
,bool &record_created); //000405
Dynamic_array<float32> * get_record_buffer_array //120806_990427
(Variable_code var_code
, const Time_query &time_query //990118
,Dynamic_array<nat8> &attributes //120806_000818
,Record_type_distinguisher_interface::time_stamp_codes time_step_resolution); //010525
virtual datetime64 get_earliest_date_time //970915
( Record_code for_record_type_code = UED_FOR_ALL_RECORD_TYPES
, UED::Variable_code for_var_code = UED_FOR_ALL_VARIABLES) const; //170323
virtual datetime64 get_latest_date_time //970915
( Record_code for_record_type_code = UED_FOR_ALL_RECORD_TYPES
, Variable_code for_var_code = UED_FOR_ALL_VARIABLES) const; //170323
public:
Database_file_indexed //070718
(const char *ued_filename
,std::ios_base::openmode _openmode = std::ios::in //130311
,bool _auto_float16 = true); //140612
inline virtual ~Database_file_indexed() {} //081129
virtual bool initialize(); //140119_990112
virtual bool finalize();
// deprecated finish renamed to finalize.
//NYI void get_variable_definitions(CORN::Bidirectional_list &definition_list, bool layered_variables = false);
// Appends to definition_list (usually initially empty,
// Variable definitions of those records that are indexed.
};
//_Database_file_indexed_______________________________________________________/
}//_namespace UED______________________________________________________________/
#endif
| [
"[email protected]"
] | |
7979b48cd705ce0f9ab5809ffcead2c0b6a736d6 | 14a6a3a9c31691ccc7acd43752f17d02bd9f0259 | /DP: Longest Common Subsequence (1143).cpp | 94589f921688698c8eb3667043b649d80afc09b2 | [] | no_license | akshatjindal/leetcodePractice | 0833ccbc8c1a309096a2f80446e4cb73bcdd11be | be2f6ed47923fa12454783657cf91aea3a5c8df0 | refs/heads/master | 2022-09-25T08:40:04.252603 | 2020-05-30T09:41:18 | 2020-05-30T09:41:18 | 255,929,526 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,214 | cpp | //
// DP: Longest Common Subsequence (1143).cpp
// leetcodePrac
//
// Created by Akshat Jindal on 5/11/20.
// Copyright © 2020 Akshat Jindal. All rights reserved.
//
#include <stdio.h>
#include <unordered_map>
#include <vector>
#include "string.h"
#include <iostream>
#include <unordered_set>
#include <limits>
using namespace std;
class Solution {
public:
int longestCommonSubsequence(string text1, string text2) {
int m = (int)text1.length();
int n = (int)text2.length();
if(m == 0 || n == 0)
return 0;
vector<vector<int>> dp(m+1, vector<int>(n+1));
//let dp[i][j] represent the length of the LCS such that we are looking at text1 up to the ith index, and text2
//...up to the jth index. the first character will be the 1st index (1 based indexing).
//the 0th row and the 0th column of the memo will all be 0's cuz the longest common subsequence of X and Y where
//...either of these strings is of length 0 is going to be of length 0.
for(size_t col = 0; col <= n; ++col){
dp[0][col] = 0;
}//populate 0th row with 0's
for(size_t row = 0; row <= n; ++row){
dp[row][0] = 0;
}//populate 0th col with 0's
//bottom up approach
for(size_t row = 1; row <= m; ++row){
for(size_t col = 1; col <= n; ++col){
//text1[row-1] cuz zeroth character of string text1 is depicted by row 1
//text2[col-1] cuz zeroth character of string text2 is depicted by col 1.
//col 0 and row 0 represent strings of length 0.
if(text1[row-1] == text2[col-1]){
dp[row][col] = dp[row-1][col-1] + 1;
// cout << dp[row][col] << endl;
}
else{
dp[row][col] = max(dp[row-1][col], dp[row][col-1]);
// cout << dp[row][col] << endl;
}//if the characters are not the same.
//there are two subcases:
}//for loop going col by col.
}//for loop populating in row-major (row by row) mode.
// cout << dp[m][n] << endl;
return dp.back().back();
}
};
int main(){
Solution x;
auto resultOne = x.longestCommonSubsequence("abcde", "ace");
cout << resultOne << endl;
cout << x.longestCommonSubsequence("ace", "ace") << endl;
cout << x.longestCommonSubsequence("aaaaa", "bbbb") << endl;
}
| [
"[email protected]"
] | |
4d271a7689ee16866ed2a88dfd9164c120c41bdd | 46c5ddf56b0b44648ca03c7ab2394d6944d8d783 | /AlienAttackV2.5/explotion.cpp | 6084b88c1c383d5d97d6cb33233494ab02246a4f | [] | no_license | jdordonezn/AlienAttack | a308369e8b0f0bfe4a70a4545f37c5142819d751 | cc1bf080427ebb7fa438106c86966be548beb13f | refs/heads/master | 2020-04-08T23:58:19.554495 | 2018-12-15T21:21:01 | 2018-12-15T21:21:01 | 159,847,671 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 666 | cpp | #include "explotion.h"
explotion::explotion(QGraphicsItem *expl):QGraphicsPixmapItem(expl)
{
setPixmap(QPixmap(":/Pictures/explosion1.gif"));
}
void explotion::fotograma()
{
if(cont<3){
setPixmap(QPixmap(":/Pictures/explosion1.gif"));
}
else{
setPixmap(QPixmap(":/Pictures/explosion2.gif"));
}
cont++;
}
int explotion::getPx() const
{
return px;
}
void explotion::setPx(int value)
{
px = value;
}
int explotion::getPy() const
{
return py;
}
void explotion::setPy(int value)
{
py = value;
}
int explotion::getCont() const
{
return cont;
}
void explotion::setCont(int value)
{
cont = value;
}
| [
"[email protected]"
] | |
e71fada7ebfc2faf9a5d326dcbf788c3263b5d0d | d87a70f60866a9687263dfb13fd617873424dd61 | /lib/src/libutil/CmdLineParser.cpp | 46f50d46ae5a58228e9cc0776c6638b60d554142 | [] | no_license | shawngu39/MTH9898_HW1 | c3ecba6e2ec7d42179b77f28ba713fd2a34a3df2 | 704781955b31ea0855222243d160e2b4f05e073f | refs/heads/master | 2021-01-01T17:31:27.310723 | 2015-02-07T19:58:51 | 2015-02-07T19:58:51 | 30,224,045 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,372 | cpp | #include <util/CmdLineParser.hpp>
#include <iostream>
using namespace std;
void
CmdLineParser::parse(
int argc,
const char ** argv
)
{
int idx = 0;
string switch_name;
string switch_value;
while (idx < argc)
{
const string elem(argv[idx]);
if (elem.at(0) == '-')
{
switch_name = elem.substr(1, elem.length());
switch_value = string(argv[idx + 1]);
++idx;
}
else
{
switch_value = string(argv[idx]);
}
if (switch_name.empty())
{
cerr << "empty switch name, error..." << endl;
}
else if (switch_name == "debug")
{
_debug[switch_value] = "debug";
}
else
{
this->insert(make_pair(switch_name, switch_value));
}
++idx;
}
}
void
CmdLineParser::dump() const
{
cout << "Dump the switch-value pairs" << endl;
for (map<string, string>::const_iterator iter = this->begin();
iter != this->end(); ++iter)
{
cout << iter->first << " - " << iter->second << endl;
}
cout << "Dump the debug streams" << endl;
for (map<string, string>::const_iterator iter = _debug.begin();
iter != _debug.end(); ++iter)
{
cout << iter->first << " - " << iter->second << endl;
}
}
| [
"[email protected]"
] | |
551a49bddad60a42718b89d3b9f0e1c3d73115d4 | 79781d0497e56c74af7c8ae08542f26504b569eb | /src/miner.h | 81d3ed316af8d61cfe1b19a04ec6638996fa44df | [
"MIT"
] | permissive | Fast-Node/FNS_core | dc6e937f08b9b678532d8d38e50af2c6e4fdbcf3 | 5c6c3dc0e6ddb5a0d6f08a62e08a48e4450df405 | refs/heads/master | 2020-05-09T15:47:44.313120 | 2019-04-17T09:29:27 | 2019-04-17T09:29:27 | 181,245,068 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,215 | h | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2016 The FASTNODE developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_MINER_H
#define BITCOIN_MINER_H
#include <stdint.h>
class CBlock;
class CBlockHeader;
class CBlockIndex;
class CReserveKey;
class CScript;
class CWallet;
struct CBlockTemplate;
/** Run the miner threads */
void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads);
/** Generate a new block, without valid proof-of-work */
CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, bool fProofOfStake);
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, CWallet* pwallet, bool fProofOfStake);
/** Modify the extranonce in a block */
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce);
/** Check mined block */
void UpdateTime(CBlockHeader* block, const CBlockIndex* pindexPrev);
void BitcoinMiner(CWallet* pwallet, bool fProofOfStake);
extern double dHashesPerSec;
extern int64_t nHPSTimerStart;
#endif // BITCOIN_MINER_H
| [
"[email protected]"
] | |
9adbd1693454f601dfcaca5bb6a2e669b84795b2 | dcbee3553ea1d1c3a6a1c95ca320db9a41275f83 | /content/browser/background_sync/background_sync_context_impl.cc | 231111d4f29381f8f3311efe959cd17bfc30bad9 | [
"BSD-3-Clause"
] | permissive | thai2902/chromium | 9aa234a8d6fad9f1773136d28fd9b74209377ebf | 351470dc27ae4b3bf327fd9908a5f2f639f8fb65 | refs/heads/master | 2023-03-11T05:26:00.403891 | 2019-03-14T06:18:12 | 2019-03-14T06:18:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,321 | cc | // Copyright 2015 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/background_sync/background_sync_context_impl.h"
#include <utility>
#include "base/bind.h"
#include "base/stl_util.h"
#include "base/task/post_task.h"
#include "build/build_config.h"
#include "content/browser/background_sync/background_sync_launcher.h"
#include "content/browser/background_sync/background_sync_manager.h"
#include "content/browser/background_sync/background_sync_service_impl.h"
#include "content/browser/devtools/devtools_background_services_context.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
namespace content {
BackgroundSyncContextImpl::BackgroundSyncContextImpl()
: base::RefCountedDeleteOnSequence<BackgroundSyncContextImpl>(
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})) {}
BackgroundSyncContextImpl::~BackgroundSyncContextImpl() {
// The destructor must run on the IO thread because it implicitly accesses
// background_sync_manager_ and services_, when it runs their destructors.
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!background_sync_manager_);
DCHECK(services_.empty());
}
void BackgroundSyncContextImpl::Init(
const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context,
const scoped_refptr<DevToolsBackgroundServicesContext>& devtools_context) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(&BackgroundSyncContextImpl::CreateBackgroundSyncManager,
this, service_worker_context, devtools_context));
}
void BackgroundSyncContextImpl::Shutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(&BackgroundSyncContextImpl::ShutdownOnIO, this));
}
void BackgroundSyncContextImpl::CreateService(
blink::mojom::BackgroundSyncServiceRequest request) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(&BackgroundSyncContextImpl::CreateServiceOnIOThread, this,
std::move(request)));
}
void BackgroundSyncContextImpl::ServiceHadConnectionError(
BackgroundSyncServiceImpl* service) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(base::ContainsKey(services_, service));
services_.erase(service);
}
BackgroundSyncManager* BackgroundSyncContextImpl::background_sync_manager()
const {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
return background_sync_manager_.get();
}
void BackgroundSyncContextImpl::set_background_sync_manager_for_testing(
std::unique_ptr<BackgroundSyncManager> manager) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
background_sync_manager_ = std::move(manager);
}
void BackgroundSyncContextImpl::set_wakeup_delta_for_testing(
base::TimeDelta wakeup_delta) {
test_wakeup_delta_ = wakeup_delta;
}
base::TimeDelta BackgroundSyncContextImpl::GetSoonestWakeupDelta() {
if (!test_wakeup_delta_.is_max())
return test_wakeup_delta_;
if (!background_sync_manager_)
return base::TimeDelta::Max();
return background_sync_manager_->GetSoonestWakeupDelta();
}
void BackgroundSyncContextImpl::GetSoonestWakeupDeltaAcrossPartitions(
BrowserContext* browser_context,
base::OnceCallback<void(base::TimeDelta)> callback) {
DCHECK(browser_context);
BackgroundSyncLauncher::GetSoonestWakeupDelta(browser_context,
std::move(callback));
}
void BackgroundSyncContextImpl::FireBackgroundSyncEvents(
base::OnceClosure done_closure) {
if (!background_sync_manager_) {
std::move(done_closure).Run();
return;
}
background_sync_manager_->FireReadyEventsThenRunCallback(
std::move(done_closure));
}
#if defined(OS_ANDROID)
void BackgroundSyncContextImpl::FireBackgroundSyncEventsAcrossPartitions(
BrowserContext* browser_context,
const base::android::JavaParamRef<jobject>& j_runnable) {
DCHECK(browser_context);
BackgroundSyncLauncher::FireBackgroundSyncEvents(browser_context, j_runnable);
}
#endif
void BackgroundSyncContextImpl::CreateBackgroundSyncManager(
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
scoped_refptr<DevToolsBackgroundServicesContext> devtools_context) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(!background_sync_manager_);
background_sync_manager_ = BackgroundSyncManager::Create(
std::move(service_worker_context), std::move(devtools_context));
}
void BackgroundSyncContextImpl::CreateServiceOnIOThread(
mojo::InterfaceRequest<blink::mojom::BackgroundSyncService> request) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(background_sync_manager_);
auto service =
std::make_unique<BackgroundSyncServiceImpl>(this, std::move(request));
services_[service.get()] = std::move(service);
}
void BackgroundSyncContextImpl::ShutdownOnIO() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
services_.clear();
background_sync_manager_.reset();
}
} // namespace content
| [
"[email protected]"
] | |
535360194967e58f211bf1e43446d66809b21254 | e5205c824522084ee9f2c4639c6863d6db7932ef | /common/limit_point.h | 399c2e13aabcf125463469fbaf5442b1deae3eff | [] | no_license | By6666/qp_spline_demo | 95a4554b65e5c1e840dd56720178163a5110b4b6 | d40402f108a673a72147eb0979419728c661547f | refs/heads/master | 2023-02-15T08:28:34.746697 | 2021-01-05T12:53:12 | 2021-01-05T12:53:12 | 325,738,734 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 737 | h | /**
* @file limit_point.h
*/
#ifndef COMMON_LIMIT_POINT_H
#define COMMON_LIMIT_POINT_H
/**
* @brief common limit for path and speed
* x is independent variable
* l is lower bound on point x
* u is upper bound on point x
*/
class LimitPoint {
public:
LimitPoint() = default;
// only use to second derivative
LimitPoint(const double x, const double l, const double u) : x_(x), l_(l), u_(u) {}
void setX(const double x) { x_ = x; }
void setLowerBound(const double l) { l_ = l; }
void setUpperBound(const double u) { u_ = u_; }
double x() const { return x_; }
double l() const { return l_; }
double u() const { return u_; }
private:
double x_;
double l_;
double u_;
};
#endif // COMMON_LIMIT_POINT_H
| [
"[email protected]"
] | |
d9760646aab4a8991319cefe9c7c86c6f25b8b53 | d27bef2b73468c2fa3f7098be6c072165e440abe | /setTokenDetails.cpp | 121b679b2a08d1473ee4e3f88f36f5491f5f1ce9 | [] | no_license | jehaanj/cplusplusWorkSamples | d9f7e6e19c5922650f48cb92dd7eebfc208238cb | 2ef4b48217535e370c24a19098e5bbd52e0758bd | refs/heads/master | 2021-01-10T09:03:23.688154 | 2015-12-06T22:48:58 | 2015-12-06T22:48:58 | 47,516,546 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,327 | cpp | //Find and Set Token Details Function
//It finds the tokens that we are looking for
//It will output the token, its type and width
void TokenList::findAndSetTokenDetails(Token *token)
{
string tokenString = token->stringRep; //tokenString will get us the the string of the token we are looking at
int widthCounter = 0; // a counter to output the width of the token
if(token == NULL)//If list is empty, that means there are no tokens
{
return;
}
for(unsigned int i = 0; i< tokenString.length(); i++)//changes the whole string to lower case
{
tokenString[i]= tolower(tokenString[i]);
}
if(token->prev && token->prev->stringRep == "--")//This will identify when a comment starts and its body
{
token->setTokenType(T_CommentBody);
return;
}
if(tokenString == "true" || tokenString == "false")//This will identify a boolean variable and set its type to a literal and width 1
{
token->setTokenType(T_Literal);
token->setTokenDetails("boolean", 1);
return;
}
else if(tokenString[0] >= '0' && tokenString[0] <= '9')//This will identify an integer, it will set its type to literal and width 0
{
token->setTokenType(T_Literal);
token->setTokenDetails("integer", 0);
return;
}
else if(tokenString[0] == '\'')//This will identify an ', it will set its type to literal and width 0
{
token->setTokenType(T_Literal);
token->setTokenDetails("std_logic", 1);
return;
}
else if (tokenString[0] == '"')//This will identify an ", it will set its type to literal
{
token->setTokenType(T_Literal);//it will set the type of the token to a literal
widthCounter = tokenString.length() - 2;//its token length will be anything -2
token->setTokenDetails("std_logic_vector", widthCounter);//This will be assigned to standard logic vector
return;
}
else//This case if for Hexa, octal and binary number
{
if(tokenString[0] == 'x' || tokenString[0] == 'b' || tokenString[0] == 'o')//checks if the first token is a x=hexadecimal, b= binary and o = octal
{
if(tokenString[1] == '"')//If the second token right after it is a quotation
{
if(tokenString[2] >= '0' && tokenString[2] <= '9')//If the third token is an integer
{
token->setTokenType(T_Literal); //then set its type to literal
widthCounter = tokenString.length() - 3;//we have the width -3 because we start at position 3
if(tokenString[0] == 'x')//If it is a hexadecmial then it contains 4 bits
{
widthCounter = widthCounter*4;
}
else if(tokenString[0] == 'o')//If it is a octal then it contains 3 bits
{
widthCounter = widthCounter*3;
}
else{}
token->setTokenDetails("std_logic_vector", widthCounter);//then set it to standard logic vector and its width according to widthCounter
return;
}
}
}
}
for (unsigned int i =0 ; i < sizeof(str_operators)/sizeof(string);i++)// This for loop is to identify an operator and then set its type to operator
{
if (tokenString == str_operators [i])//I am comparing the token with the string of operators above
{
token->setTokenType(T_Operator);
token ->setTokenDetails("Type_Operator ",0);//the width will be zero
return;
}
}
for(unsigned int k = 0; k < sizeof(str_keywords)/sizeof(string); k++)// This for loop is to identify a keyword and then set its type to identifier
{
if(tokenString == str_keywords[k])//I am comparing the token with the string of keywords above
{
token->setTokenType(T_Identifier);
token->setKeyword();
token->setTokenDetails("keyword", 0);// the width will be zero
return;
}
}
//This nested for loop checks if it is a character only then its type will be identifier
for(unsigned int i =0 ; i < tokenString.length();i++)
{
for(unsigned int j = 0; j < str_char.length(); j++)
{
if (tokenString[i] == str_char[j])
{
token->setTokenType(T_Identifier);//Setting the type of the character to Identifier
if (tokens_type.head != NULL)//if the first token in the tokenlist is not equal to NULL
{
Token* to_token = tokens_type.getFirst();// creating a pointer called to_token, which gets the first token of a specific type
while (to_token)
{
string identifier = token->getStringRep();//I am getting the string in the list and putting it to identifier
for(unsigned int i = 0; i< identifier.length(); i++)//changes the string that is in identifier to lower case
{
identifier[i]= tolower(identifier[i]);
}
if (to_token->getStringRep() == identifier)// If the type of token in the string turns out to be an identifier
{ // Then call in the function setTokenDetails and output the type and width of the token
token->setTokenDetails(to_token->getTokenDetails()->type,to_token->getTokenDetails()->width);
return;
}
to_token = to_token->getNext();//This will keep going through the list to get the next token
}
}
token->setTokenDetails("Type_Identifier",0);//it will set the token details to identifier and width 0
string tokenLower_Case = token->getStringRep();
for(unsigned int i = 0; i< tokenLower_Case.length(); i++)//changes it to lower case
{
tokenLower_Case[i]= tolower(tokenLower_Case[i]);
}
//This creates the subsystem to know if the is one of these std.logic or std.logic.vector or signed or unsigned...
//It then sets its type to identifier and width according to the length
if (tokenLower_Case == "std_logic"|| tokenLower_Case== "std_logic_vector" ||tokenLower_Case== "signed" || tokenLower_Case == "unsigned"|| tokenLower_Case == "integer" || tokenLower_Case == "boolean"|| tokenLower_Case == "character"|| tokenLower_Case =="string")
{
token->setTokenType(T_Identifier);
token->setTokenDetails("type",token->getStringRep().length());
find_type(token);
}
return;
}
}
}
token->setTokenType(T_Other);// else the token type will be other
token->setTokenDetails("Type_other",0);//the width of other is zero and it will output "type_other" for its type
return;
}
//This function find type 2, finds the variable and the width of the variable that is signed, unsigned, std_logic, std_logic vector
void find_type(Token *token)
{
string type = token->getStringRep(); //This will get the string in token and put it in type
Token *p_token = token;//This is a pointer I will be using to point to the token in the list
bool flag = true;//To know if the list is complete
Token *toToken;
while(flag)//If flag is true, the list is complete
{
if (p_token->getTokenType() == 1 && (p_token->getStringRep() != type) && !(p_token->isKeyword()))//if tokentype is an identifier and its is not equal to a type
{ //and its is not a keyword
if (token->getNext()->getStringRep() == "(")//This checks if the next token is a bracket
{
string identifier = p_token->getStringRep();//This gets the string and puts it in identifier
int num1 = stoi(token->getNext()->getNext()->getStringRep(),NULL,10);//this changes the string to integer
int num2 = stoi(token->getNext()->getNext()->getNext()->getNext()->getStringRep(),NULL,10);//This changes the string to integer
int width = abs(num1 - num2) + 1;//This will output the width of the variable according to what it is declared to
p_token->setTokenDetails(type,width);//This will call in the function setTokenDetials and assign its type and width
for(unsigned int i = 0; i< identifier.length(); i++)//changes it to lower case
{
identifier[i]= tolower(identifier[i]);
}
tokens_type.append(identifier); //We are taking the variable and putting it in a universal list to keep track of its type
toToken = tokens_type.getLast();//The last is always changing when you append, so we are always pointing to a new last
toToken->setTokenDetails(type,width);
}
else
{
string identifier = p_token->getStringRep();//will get the string and put it in identifier
for(unsigned int i = 0; i< identifier.length(); i++)//changes it to lower case
{
identifier[i]= tolower(identifier[i]);
}
tokens_type.append(identifier);//We are taking the variable and putting it in a universal list to keep track of its type
toToken = tokens_type.getLast();//The last is always changing when you append, so we are always pointing to a new last
if(type == "integer")//If the type is an integer, width will equal to zero, and set its type to integer
{
p_token->setTokenDetails(type,0);
toToken->setTokenDetails(type,0);
}
else//If it is not an intger, then it will have width 1
{
p_token->setTokenDetails(type,1);
toToken->setTokenDetails(type,1);
}
}
}
string tokenLowerCase = p_token->getStringRep();
for(unsigned int i = 0; i< tokenLowerCase.length(); i++)//changes it to lower case
{
tokenLowerCase[i]= tolower(tokenLowerCase[i]);
}
if(tokenLowerCase== "port")//This means that there are still tokens left in the variable, keep going, we are not at the end
{
flag = false;
}
else if (p_token ->getStringRep() ==";")//This means that there are still tokens left in the variable, keep going, we are not at the end
{
flag = false;
}
else if (tokenLowerCase=="signal")//This means that there are still tokens left in the variable, keep going, we are not at the end
{
flag = false;
}
else if (tokenLowerCase == "variable")//This means that there are still tokens left in the variable, keep going, we are not at the end
{
flag = false;
}
else
{
p_token = p_token->getPrev();//This will keep getting the previous token
}
}
}
| [
"[email protected]"
] | |
66f3f766c456e2b22d9ad4215d1755eb0a3f9cc7 | 785df77400157c058a934069298568e47950e40b | /Common/Foam/include/base/processorCyclicGAMGInterfaceField.hxx | e446840d2486524a8e02fbd2d1ff961326e2831a | [] | no_license | amir5200fx/Tonb | cb108de09bf59c5c7e139435e0be008a888d99d5 | ed679923dc4b2e69b12ffe621fc5a6c8e3652465 | refs/heads/master | 2023-08-31T08:59:00.366903 | 2023-08-31T07:42:24 | 2023-08-31T07:42:24 | 230,028,961 | 9 | 3 | null | 2023-07-20T16:53:31 | 2019-12-25T02:29:32 | C++ | UTF-8 | C++ | false | false | 3,239 | hxx | #pragma once
#ifndef _processorCyclicGAMGInterfaceField_Header
#define _processorCyclicGAMGInterfaceField_Header
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
tnbLib::processorCyclicGAMGInterfaceField
Description
GAMG agglomerated processor interface field.
SourceFiles
processorCyclicGAMGInterfaceField.C
\*---------------------------------------------------------------------------*/
#include <processorGAMGInterfaceField.hxx>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace tnbLib
{
/*---------------------------------------------------------------------------*\
Class processorCyclicGAMGInterfaceField Declaration
\*---------------------------------------------------------------------------*/
class processorCyclicGAMGInterfaceField
:
public processorGAMGInterfaceField
{
// Private Member Functions
//- Disallow default bitwise copy construction
FoamBase_EXPORT processorCyclicGAMGInterfaceField
(
const processorCyclicGAMGInterfaceField&
);
//- Disallow default bitwise assignment
FoamBase_EXPORT void operator=(const processorCyclicGAMGInterfaceField&) = delete;
public:
//- Runtime type information
//TypeName("processorCyclic");
static const char* typeName_() { return "processorCyclic"; }
static FoamBase_EXPORT const ::tnbLib::word typeName;
static FoamBase_EXPORT int debug;
virtual const word& type() const { return typeName; };
// Constructors
//- Construct from GAMG interface and fine level interface field
FoamBase_EXPORT processorCyclicGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const lduInterfaceField& fineInterface
);
//- Construct from GAMG interface and fine level interface field
FoamBase_EXPORT processorCyclicGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const bool doTransform,
const int rank
);
// Destructor
FoamBase_EXPORT virtual ~processorCyclicGAMGInterfaceField();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace tnbLib
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif // !_processorCyclicGAMGInterfaceField_Header
| [
"[email protected]"
] | |
dd3e83c23d690d35ca85842ede95e1f2be5f53aa | 83f7eaebe41307337c6c1e5c28cd8da59afd9ae0 | /src/cas/lowlevel_index.cpp | 0fee1b42c86c9e5083aef5f070aee169503b439e | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-4.3RENO",
"MIT",
"BSD-4-Clause",
"Beerware",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-rsa-md4",
"BSD-4-Clause-UC",
"LicenseRef-scancode-rsa-1990",
"OLDAP-2.8",
"NTP",
"Zlib",
"FSFAP",
"ICU",
"RSA-MD",
"ISC"
] | permissive | RoboSherlock/uimacpp_ros | 0bc7f6d1908d09ce7ae1276b08abd577345bb458 | 35acda4aa91f2203de9aae1ea31141a6710c8d1e | refs/heads/master | 2020-03-19T05:32:50.001716 | 2018-08-11T08:04:09 | 2018-08-11T08:10:03 | 135,942,588 | 0 | 1 | Apache-2.0 | 2018-08-09T18:26:18 | 2018-06-03T21:37:44 | C++ | UTF-8 | C++ | false | false | 6,140 | cpp | /** \file lowlevel_index.cpp .
-----------------------------------------------------------------------------
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-----------------------------------------------------------------------------
Description:
-----------------------------------------------------------------------------
-------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Include dependencies */
/* ----------------------------------------------------------------------- */
#include <uima/pragmas.hpp>
#include <uima/lowlevel_index.hpp>
#include <uima/lowlevel_fsheap.hpp>
#include <uima/lowlevel_fsfilter.hpp>
#include <uima/lowlevel_indexiterator.hpp>
#include <uima/lowlevel_indexcomparator.hpp>
#include <uima/lowlevel_indexrepository.hpp>
#include <uima/msg.h>
/* ----------------------------------------------------------------------- */
/* Constants */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Forward declarations */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Types / Classes */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Implementation */
/* ----------------------------------------------------------------------- */
using namespace std;
namespace uima {
namespace lowlevel {
IndexABase::IndexABase(IndexRepository const & crIndexRepository,
uima::lowlevel::TyFSType tyType)
: iv_crIndexRepository(crIndexRepository),
iv_crFSHeap(iv_crIndexRepository.getFSHeap() ),
iv_crTypeSystem(iv_crFSHeap.getTypeSystem()),
iv_tyFSType(tyType) {
assert( iv_crTypeSystem.isValidType(iv_tyFSType) );
}
/**
* generic implementation of find().
*/
TyFS IndexABase::find(TyFS fs) const {
auto_ptr<IndexIterator> it(createIterator());
assert( EXISTS(it.get()) );
for (it->moveToFirst(); it->isValid(); it->moveToNext() ) {
TyFS nextFS = it->get();
if (nextFS == fs) {
return fs;
}
}
return uima::lowlevel::FSHeap::INVALID_FS;
}
/**
* An iterator on top of another (decorator) which does simple filtering.
*/
class FilterIndexIterator : public IndexIterator {
private:
FSFilter const * iv_cpFilter;
IndexIterator* iv_pIterator;
void moveToNextUnfiltered() {
while (iv_pIterator->isValid()) {
bool bIsFiltered = iv_cpFilter->isFiltered(iv_pIterator->get());
if (!bIsFiltered) {
return;
} else {
iv_pIterator->moveToNext();
}
}
}
void moveToPreviousUnfiltered() {
while (iv_pIterator->isValid()) {
bool bIsFiltered = iv_cpFilter->isFiltered(iv_pIterator->get());
if (!bIsFiltered) {
return;
} else {
iv_pIterator->moveToPrevious();
}
}
}
public:
FilterIndexIterator(FSFilter const * cpFilter, IndexIterator* pIterator)
: iv_cpFilter(cpFilter),
iv_pIterator(pIterator) {}
virtual ~FilterIndexIterator() {
assert( EXISTS(iv_pIterator) );
delete iv_pIterator;
}
void moveToFirst() {
assert( EXISTS(iv_pIterator) );
iv_pIterator->moveToFirst();
moveToNextUnfiltered();
}
void moveToLast() {
assert( EXISTS(iv_pIterator) );
iv_pIterator->moveToLast();
moveToPreviousUnfiltered();
}
void moveToPrevious() {
assert(isValid());
iv_pIterator->moveToPrevious();
moveToPreviousUnfiltered();
}
void moveToNext() {
assert(isValid());
iv_pIterator->moveToNext();
moveToNextUnfiltered();
}
TyFS get() const {
assert(isValid());
return iv_pIterator->get();
}
TyFSType getTyFSType() const {
assert( isValid() );
return iv_pIterator->getTyFSType();
}
bool isValid() const {
assert( EXISTS(iv_pIterator) );
return iv_pIterator->isValid();
}
IndexIterator* clone() const {
return new FilterIndexIterator(iv_cpFilter, iv_pIterator->clone());
}
bool moveTo(TyFS fs) {
assert( EXISTS(iv_pIterator) );
return iv_pIterator->moveTo(fs);
}
};
IndexIterator* IndexABase::createFilteredIterator(FSFilter const * cpFilter) const {
IndexIterator* pit = createIterator();
assert( EXISTS(pit) );
IndexIterator* result = new FilterIndexIterator(cpFilter, pit);
assert( EXISTS(result) );
return result;
}
}
}
/* ----------------------------------------------------------------------- */
| [
"[email protected]"
] | |
a98306e095d0d37d45fae4ce08b14ad8ca709714 | e6b96681b393ae335f2f7aa8db84acc65a3e6c8d | /atcoder.jp/keyence2020/keyence2020_b/Main.cpp | 69b450999c753fb527053fbd53a656454d12934b | [] | no_license | okuraofvegetable/AtCoder | a2e92f5126d5593d01c2c4d471b1a2c08b5d3a0d | dd535c3c1139ce311503e69938611f1d7311046d | refs/heads/master | 2022-02-21T15:19:26.172528 | 2021-03-27T04:04:55 | 2021-03-27T04:04:55 | 249,614,943 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,400 | cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//#define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 10000000000000ll
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define dmp(x) cerr << #x << ": " << x << endl;
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
using MaxHeap = priority_queue<T>;
template<class T>
using MinHeap = priority_queue<T,vector<T>,greater<T> >;
template<class T,class U>
ostream& operator << (ostream& os,const pair<T,U>& p){
os << p.fi << ',' << p.sec; return os;
}
template<class T,class U>
istream& operator >> (istream& is,pair<T,U>& p){
is >> p.fi >> p.sec; return is;
}
template<class T>
ostream& operator << (ostream &os,const vector<T> &vec){
for(int i=0;i<vec.size();i++){
os << vec[i];
if(i+1<vec.size())os << ' ';
}
return os;
}
template<class T>
istream& operator >> (istream &is,vector<T>& vec){
for(int i=0;i<vec.size();i++)is >> vec[i];
return is;
}
void fastio(){
cin.tie(0);
ios::sync_with_stdio(0);
cout<<fixed<<setprecision(20);
}
namespace Math{
template<int MOD> // if inv is needed, this shold be prime.
struct ModInt{
ll val;
ModInt():val(0ll){}
ModInt(const ll& v):val(((v%MOD)+MOD)%MOD){}
bool operator==(const ModInt& x)const{return val==x.val;}
bool operator!=(const ModInt& x)const{return !(*this==x);}
bool operator<(const ModInt& x)const{return val<x.val;}
bool operator>(const ModInt& x)const{return val>x.val;}
bool operator>=(const ModInt& x)const{return !(*this<x);}
bool operator<=(const ModInt& x)const{return !(*this>x);}
ModInt& operator+=(const ModInt& x){if((val+=x.val)>=MOD)val-=MOD;return *this;}
ModInt& operator-=(const ModInt& x){if((val+=MOD-x.val)>=MOD)val-=MOD;return *this;}
ModInt& operator*=(const ModInt& x){(val*=x.val)%=MOD;return *this;}
ModInt operator+(const ModInt& x)const{return ModInt(*this)+=x;}
ModInt operator-(const ModInt& x)const{return ModInt(*this)-=x;}
ModInt operator*(const ModInt& x)const{return ModInt(*this)*=x;}
friend istream& operator>>(istream&i,ModInt& x){ll v;i>>v;x=v;return i;}
friend ostream& operator<<(ostream&o,const ModInt& x){o<<x.val;return o;}
};
template<int MOD>
ModInt<MOD> pow(ModInt<MOD> a,ll x){
ModInt<MOD> res = ModInt<MOD>(1ll);
while(x){
if(x&1)res *= a;
x >>= 1;
a = a*a;
}
return res;
}
constexpr int MOD = 1e9+7;
using mint = ModInt<MOD>;
vector<mint> inv,fac,facinv;
// notice: 0C0 = 1
ModInt<MOD> nCr(int n,int r){
assert(!(n<r));
assert(!(n<0||r<0));
return fac[n]*facinv[r]*facinv[n-r];
}
void init(int SIZE){
fac.resize(SIZE+1);
inv.resize(SIZE+1);
facinv.resize(SIZE+1);
fac[0] = inv[1] = facinv[0] = mint(1ll);
for(int i=1;i<=SIZE;i++)fac[i]=fac[i-1]*mint(i);
for(int i=2;i<=SIZE;i++)inv[i]=mint(0ll)-mint(MOD/i)*inv[MOD%i];
for(int i=1;i<=SIZE;i++)facinv[i]=facinv[i-1]*inv[i];
return;
}
template<class T>
int digit(T x){
int res = 0;
while(x){
x /= T(10);
res++;
}
return res;
}
}
namespace DS{
template<class T>
struct RangeSum{
vector<T> vec;
RangeSum(){}
RangeSum(vector<T> elems):vec(elems){
for(int i=1;i<vec.size();i++){
vec[i] += vec[i-1];
}
}
T sum(int l,int r){
if(l>r)return T(0);
if(l==0)return vec[r];
else return vec[r]-vec[l-1];
}
};
template<class T>
struct BIT{
int N;
vector<T> bit;
BIT(int N):N(N){
bit = vector<T>(N+1,T(0));
}
void add(int i,T x){
i++;
while(i<=N){
bit[i]+=x;
i+=i&-i;
}
return;
}
T sum(int i){
i++;
T res = T(0);
while(i>0){
res+=bit[i];
i-=i&-i;
}
return res;
}
T sum(int l,int r){// [l,r]
assert(l<=r);
if(l==0)return sum(r);
else return sum(r)-sum(l-1);
}
};
}
namespace Util{
template<class T>
struct SlideMin{
vector<T> v;
deque<int> deq;
SlideMin(vector<T> &v):v(v){}
void add(int id){
while(!deq.empty()&&v[deq.back()]>=v[id])deq.pop_back();
deq.push_back(id);
}
T get(int id){ // [id,added]
while(!deq.empty()&&deq.front()<id)deq.pop_front();
assert(!deq.empty());
return v[deq.front()];
}
};
template<class T>
struct SlideMax{
vector<T> v;
deque<int> deq;
SlideMax(vector<T> &v):v(v){}
void add(int id){
while(!deq.empty()&&v[deq.back()]<=v[id])deq.pop_back();
deq.push_back(id);
}
T get(int id){ // [id,added]
while(!deq.empty()&&deq.front()<id)deq.pop_front();
assert(!deq.empty());
return v[deq.front()];
}
};
}
signed main(){
fastio();
int N;
cin >> N;
vector<pair<int,int>> X(N);
for(int i=0;i<N;i++){
int a,b;
cin >> a >> b;
X[i].first = a+b; // end
X[i].second = a-b; // start
}
sort(all(X)); // sort by end
int e = -INF;
int ans = 0;
for(int i=0;i<N;i++){
if(X[i].sec<e)continue;
else{
ans++;
e = X[i].fi;
}
}
cout << ans << endl;
return 0;
}
| [
"[email protected]"
] | |
b7775b9e9309312338128c5c1665d5116a9accc6 | dccd1058e723b6617148824dc0243dbec4c9bd48 | /atcoder/past202010-open/c.cpp | 88763e7980de21d912e04d2736ff271b3f13ffa7 | [] | no_license | imulan/procon | 488e49de3bcbab36c624290cf9e370abfc8735bf | 2a86f47614fe0c34e403ffb35108705522785092 | refs/heads/master | 2021-05-22T09:24:19.691191 | 2021-01-02T14:27:13 | 2021-01-02T14:27:13 | 46,834,567 | 7 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,061 | cpp | // clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on
int main() {
int h, w;
cin >> h >> w;
vector<string> s(h);
rep(i, h) cin >> s[i];
auto IN = [&](int y, int x) { return 0 <= y && y < h && 0 <= x && x < w; };
rep(i, h) {
rep(j, w) {
int ct = 0;
for (int dy = -1; dy <= 1; ++dy)
for (int dx = -1; dx <= 1; ++dx) {
int y = i + dy, x = j + dx;
if (IN(y, x) && s[y][x] == '#') ++ct;
}
cout << ct;
}
cout << "\n";
}
return 0;
}
| [
"[email protected]"
] | |
ab043d11d43adc63482128d6c4dd14d3a4f56cb4 | 1405590ef7b142cf6b343efec584313c67f886d8 | /sort/merge_k_sorted_lists.cpp | f199f1b17d0560ba7762b1c6144360406b272c6a | [
"MIT"
] | permissive | zhangxin23/leetcode | eecd90842f0efb78f5a4d4cbf6282fbdeb59f672 | 4c8fc60e59448045a3e880caaedd0486164e68e7 | refs/heads/master | 2020-05-27T01:13:10.612196 | 2016-02-15T07:20:18 | 2016-02-15T07:20:18 | 39,118,493 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,134 | cpp | #include <iostream>
#include <vector>
#include "../linear-list/list/list.h"
using namespace std;
/**
* Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
* */
class Solution {
public:
ListNode* merge(vector<ListNode*> &lists) {
if(lists.size() == 0)
return NULL;
ListNode *p = lists[0];
for(int i = 1; i < lists.size(); i++) {
p = mergeTwoSortedList(p, lists[i]);
}
return p;
}
ListNode* mergeTwoSortedList(ListNode *first, ListNode *second) {
if(first == NULL)
return second;
if(second == NULL)
return first;
ListNode dummy(-1);
ListNode *p = &dummy;
while(first != NULL && second != NULL) {
if(first->val < second->val) {
p->next = first;
first = first->next;
} else {
p->next = second;
second = second->next;
}
p = p->next;
}
p->next = first != NULL ? first : second;
return dummy.next;
}
}; | [
"[email protected]"
] | |
926564d0d5a06541334dfbc1db91224428771367 | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/247/159/CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_81.h | 7c5378edc39a1b6c0a0fa0636c326e3c863cdf1f | [] | no_license | CU-0xff/juliet-cpp | d62b8485104d8a9160f29213368324c946f38274 | d8586a217bc94cbcfeeec5d39b12d02e9c6045a2 | refs/heads/master | 2021-03-07T15:44:19.446957 | 2020-03-10T12:45:40 | 2020-03-10T12:45:40 | 246,275,244 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,664 | h | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_81.h
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-81.tmpl.h
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: console Read input from the console
* GoodSource: Fixed string
* Sinks: w32_spawnlp
* BadSink : execute command with wspawnlp
* Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT L"cmd.exe"
#define COMMAND_ARG1 L"/c"
#define COMMAND_ARG2 L"dir "
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH L"/bin/sh"
#define COMMAND_INT L"sh"
#define COMMAND_ARG1 L"-c"
#define COMMAND_ARG2 L"ls "
#define COMMAND_ARG3 data
#endif
namespace CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_81
{
class CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_81_base
{
public:
/* pure virtual function */
virtual void action(wchar_t * data) const = 0;
};
#ifndef OMITBAD
class CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_81_bad : public CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_81_base
{
public:
void action(wchar_t * data) const;
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_81_goodG2B : public CWE78_OS_Command_Injection__wchar_t_console_w32_spawnlp_81_base
{
public:
void action(wchar_t * data) const;
};
#endif /* OMITGOOD */
}
| [
"[email protected]"
] | |
b0ba09c315507a1b9082979c6827b8edb707592e | af56fa889aa3a8dc2db74f12ab99f980c64f5d34 | /Core/src/2shuffle/Prover_toom.cpp | d1e481fb0484b07235418cd0bb49b88cf673827c | [] | no_license | h25h/- | 0a9f4613413cab11d4f2c57ae690b7befffc35d7 | 277c93e91616e23fed4f90675d416d74c91a44bf | refs/heads/master | 2023-08-24T14:41:45.157050 | 2021-10-20T05:41:00 | 2021-10-20T05:41:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 32,110 | cpp | #include "Prover_toom.h"
NTL_CLIENT
extern G_q G;
extern G_q H;
extern Pedersen Ped;
extern ElGamal El;
Prover_toom::Prover_toom()
{
// TODO Auto-generated constructor stub
}
Prover_toom::Prover_toom(vector<vector<Cipher_elg>*>* Cin, vector<vector<ZZ>*>* Rin, vector<vector<vector<int>*>*>* piin, vector<int> num, string code)
{
// set the dimensions of the row and columns according to the user input
C = Cin; //sets the reencrypted chipertexts to the input
R = Rin; //sets the random elements to the input
pi = piin; // sets the permutation to the input
m = num[0]; //number of rows
n = num[1]; //number of columns
omega_mulex = num[2]; //windowsize for sliding-window technique
omega_sw = num[3]; //windowsize for multi-expo technique
omega_LL = num[4]; //windowsize for multi-expo technique
mu = num[5];
m_r = num[6];
mu_h = num[7];
//Creates the matrices A,内容为pi
A = new vector<vector<ZZ>*>(m);
func_pro::set_A(A, pi, m, n);
SetSeed(to_ZZ((unsigned int)time(0) + clock()));
//Allocate the storage needed for the vectors
chal_x6 = new vector<ZZ>(2 * m); //x6, x6^2, ... challenges from round 6
chal_y6 = new vector<ZZ>(n); //y6, y6^2, ... challenges form round 6
chal_x8 = new vector<ZZ>(2 * m + 1); //x8, x8^2, ... challenges from round 8
basis_chal_x8 = new vector<vector<long>*>(2 * m + 2); //basis of vector e for multi-expo technique
mul_chal_x8 = new vector<ZZ>(2 * m + 2); //shifted vector e, e(0) = 1, used for multi-expo
//Allocate the storage needed for the vectors
c_A = new vector<Mod_p>(m + 1); //commitments to the rows in A
r_A = new vector<ZZ>(m + 1); //random elements used for the commitments
D = new vector<vector<ZZ>*>(m + 1); //vector containing in the first row random values and in all others y*A(ij) + B(ij)-z
D_h = new vector<vector<ZZ>*>(m); //Vector of the Hadamare products of the rows in D
D_s = new vector<vector<ZZ>*>(m + 1); //Shifted rows of D_h
d = new vector<ZZ>(n); //containing random elements to proof product of D_hm
Delta = new vector<ZZ>(n); //containing random elements to proof product of D_hm
d_h = new vector<ZZ>(n); // vector containing the last row of D-h
r_D_h = new vector<ZZ>(m); //random elements for commitments to D_h
c_D_h = new vector<Mod_p>(m + 2); //commitments to the rows in D_h
C_small = new vector<vector<Cipher_elg>*>(m_r); //matrix of reduced ciphertexts
B = new vector<vector<ZZ>*>(m); //matrix of permuted exponents, exponents are x2^i, i=1, ..N
basis_B = new vector<vector<vector<long>*>*>(m); //basis for the multi-expo, containing the Bij
B_small = new vector<vector<ZZ>*>(m_r); //matrix of reduced exponents
B_0 = new vector<ZZ>(n); //vector containing random exponents
basis_B0 = new vector<vector<long>*>(n); //basis for multi-expo, containing the B0j
r_B = new vector<ZZ>(m); //random elements used to commit to B
r_B_small = new vector<ZZ>(m_r); //random elements for commitments to B_small
c_B = new vector<Mod_p>(m); //vector of commitments to rows in T
a = new vector<ZZ>(2 * m); //elements used for reencryption in round 5
r_a = new vector<ZZ>(2 * m); //random elements to commit to elements in a
c_a = new vector<Mod_p>(2 * m); //commitments to elements a
E = new vector<Cipher_elg>(2 * m); //vector of the products of the diogonals of A^T generated in round 7
rho_a = new vector<ZZ>(2 * m); //contains random elements used for the reencryption in 7
C_c = new vector<Cipher_elg>(mu_h); //Ciphertexts to prove correctness of reduction
c_a_c = new vector<Mod_p>(mu_h); //vector containing the commitments to value used for the reencryption of E_c
a_c = new vector<ZZ>(mu_h); //vector containing the values used for reecnrcyption
r_c = new vector<ZZ>(mu_h); //random elements used to commit to a_c
rho_c = new vector<ZZ>(mu_h); //random elements used in the reencryption
a = new vector<ZZ>(2 * mu); //elements used for reencryption in round 5
r_a = new vector<ZZ>(2 * mu); //random elements to commit to elements in a
c_a = new vector<Mod_p>(2 * mu); //commitments to elements a
E = new vector<Cipher_elg>(2 * mu); //vector of the products of the diogonals of Y^T generated in round 9
rho_a = new vector<ZZ>(2 * mu); //contains random elements used for the reencryption in 9
Dl = new vector<ZZ>(2 * m + 1); //bilinear_map(Y_pi, U, chal_t)
r_Dl = new vector<ZZ>(2 * m + 1); //random elements to commit to the C_ls
c_Dl = new vector<Mod_p>(2 * m + 1); //commitments to the C_ls
d_bar = new vector<ZZ>(n); // chal_x8*D_h(m-1) +d
Delta_bar = new vector<ZZ>(n); //chal_x8*d_h+Delta
D_h_bar = new vector<ZZ>(n); //sum over the rows in D_h
B_bar = new vector<ZZ>(n); // sum over the rows in B multiplied by chal^i
A_bar = new vector<ZZ>(n); //sum over the rows in A times the challenges
D_s_bar = new vector<ZZ>(n); // sum over the rows in D_s times the challenges
}
//Destructor deletes all pointers and frees the storage
Prover_toom::~Prover_toom()
{
delete chal_x6;
delete chal_y6;
delete chal_x8;
delete c_A;
delete r_A;
Functions::delete_vector(D);
Functions::delete_vector(D_h);
Functions::delete_vector(D_s);
delete d;
delete Delta;
delete d_h;
delete r_D_h;
delete c_D_h;
Functions::delete_vector(B);
Functions::delete_vector(basis_B);
delete B_0;
Functions::delete_vector(basis_B0);
delete r_B;
delete r_B_small;
delete c_B;
delete a;
delete r_a;
delete c_a;
delete rho_a;
delete Dl;
delete r_Dl;
delete c_Dl;
delete D_h_bar;
delete d_bar;
delete Delta_bar;
delete B_bar;
delete A_bar;
delete D_s_bar;
delete C_c;
delete c_a_c; //vector containing the commitments to value used for the reencryption of E_low_up
delete a_c; //vector containing the exponents
delete r_c;
delete rho_c;
delete E;
}
//round_1 picks random elements and commits to the rows of A
void Prover_toom::round_1()
{
Ped = Pedersen(n, G);
Ped.set_omega(omega_mulex, omega_LL, omega_sw);
//对向量pi的每一行进行承诺
Functions::commit_op(A, r_A, c_A);
stringstream ss;
//-1 group
ost << G.get_g() << endl;
ost << G.get_gen() << endl;
ost << G.get_ord() << endl;
ost << G.get_mod() << endl;
ost << El.get_pk() << endl;
//0 pedersen
vector<Mod_p>* pedGen = Ped.get_gen();
for (int i = 0; i <= n; i++)
{
ost << pedGen->at(i) << endl;
}
//1 c_A
for (int i = 0; i < m; i++)
{
ost << c_A->at(i) << endl;
ss << c_A->at(i).get_val();
}
ord = H.get_ord();
pk_ss << El.get_pk().get_val();
hashStr[0] = ss.str() + pk_ss.str();
}
//round_3, permuted the exponents in s, picks random elements and commits to values
void Prover_toom::round_3()
{
ZZ x2;
vector<vector<ZZ>*>* chal_x2 = new vector<vector<ZZ>*>(m);
// 用hash生成随机挑战x
string hashValueStr = sha.hash(hashStr[0]);
ZZ hashValueZZ;
conv(hashValueZZ, hashValueStr.c_str());
Mod_p hashValueModP = Mod_p(hashValueZZ, H.get_mod());
while (hashValueModP.get_val() > ord)
hashValueModP.set_val(hashValueModP.get_val() - ord);
x2 = hashValueModP.get_val();
//生成内容为x2, x2^2, ... , x2^N的顺序矩阵chal_x2
func_pro::set_x2(chal_x2, x2, m, n);
//根据向量pi将chal_x2重新排列,生成shuffle后的矩阵B
func_pro::set_B_op(B, basis_B, chal_x2, pi, omega_mulex);
//对B的每一行生成随机数和承诺
Functions::commit_op(B, r_B, c_B);
//ofstream ost("prove.pro", ios::app);
stringstream ss1, ss2;
//2 c_B
for (int i = 0; i < m; i++)
{
ost << c_B->at(i) << "\n";
ss1 << c_B->at(i).get_val();
}
//3 x2
ost << x2 << endl;
ss1 << x2;
ss2 << x2;
hashStr[1] = ss1.str() + pk_ss.str();
hashStr[2] = ss2.str() + pk_ss.str();
//ost.close();
Functions::delete_vector(chal_x2);
}
//round_5a 构建矩阵D,并对向量chal_z和D_h做承诺
void Prover_toom::round_5a()
{
long i;
ZZ temp, t; //temporary variables
vector<ZZ>* r = new vector<ZZ>(n);
vector<ZZ>* v_z = new vector<ZZ>(n); //row containing the challenge alpha
ZZ ord = H.get_ord();
time_t rawtime;
time(&rawtime);
//生成矩阵D: y × A_ij + B_ij - z
func_pro::set_D(D, A, B, chal_z4, chal_y4);
//生成用于product argument的矩阵D_h:Set the matrix D_h as the Hadamard product of the rows in D
func_pro::set_D_h(D_h, D);
for (i = 0; i < n; i++)
{
v_z->at(i) = chal_z4; //fills the vector alpha with the challenge alpha
NegateMod(r->at(i), to_ZZ(1), ord);
}
//将矩阵D的最后一行用“-1”填充
D->at(m) = r;
//将生成矩阵A的承诺的随机数向量的最后一个值设为0
r_A->at(m) = 0;
//对chal_z做承诺
Functions::commit_op(v_z, r_z, c_z);
//对D_h的每一行进行承诺
Functions::commit_op(D_h, r_D_h, c_D_h);//r_D_h为t
delete v_z;
func_pro::set_Rb(B, R, R_b);//b_ij × R_ij的结果累加
commit_ac();
/*for (int i = 0; i < basis_B->size(); i++) {
for (int j = 0; j < basis_B->at(0)->size(); j++){
for (int k = 0; k < basis_B->at(0)->at(0)->size(); k++)
cout << basis_B->at(i)->at(j)->at(k) << " ";
cout << endl;
}
cout << endl;
}*/
calculate_Cc(C, basis_B);
}
void Prover_toom::round_5()
{
// 用hash生成随机挑战y,z
string hashValueStr1 = sha.hash(hashStr[1]);
ZZ hashValueZZ1;
conv(hashValueZZ1, hashValueStr1.c_str());
Mod_p hashValueModP1 = Mod_p(hashValueZZ1, H.get_mod());
while (hashValueModP1.get_val() > ord)
hashValueModP1.set_val(hashValueModP1.get_val() - ord);
string hashValueStr2 = sha.hash(hashStr[2]);
ZZ hashValueZZ2;
conv(hashValueZZ2, hashValueStr2.c_str());
Mod_p hashValueModP2 = Mod_p(hashValueZZ2, H.get_mod());
while (hashValueModP2.get_val() > ord)
hashValueModP2.set_val(hashValueModP2.get_val() - ord);
chal_z4 = hashValueModP1.get_val();
chal_y4 = hashValueModP2.get_val();
round_5a();//构建矩阵D,并对向量chal_z和D_h做承诺
//ofstream ost("prove.pro", ios::app);
stringstream ss1, ss2;
//4 c_z
ost << c_z << endl;
ss1 << c_z;
//5 c_D_h
for (int i = 0; i < m; i++)
{
ost << c_D_h->at(i) << endl;
ss1 << c_D_h->at(i);
}
//6 C_c
for (int i = 0; i < mu_h; i++)
{
ost << C_c->at(i) << endl;
ss1 << C_c->at(i);
}
//7 c_a_c
for (int i = 0; i < mu_h; i++)
{
ost << c_a_c->at(i) << endl;
ss1 << c_a_c->at(i);
}
//8 chal_y4
ost << chal_y4 << endl;
ss1 << chal_y4;
//9 chal_z4
ost << chal_z4 << endl;
ss1 << chal_z4;
ss2 << chal_z4;
hashStr[3] = ss1.str() + pk_ss.str();
hashStr[4] = ss2.str() + pk_ss.str();
//ost.close();
}
void Prover_toom::round_7a()
{
//Set the rows in D_s as D_s(i) = chal_t_1^i+1*D_h(i) for i<m-1 and D_s(m-1) = sum(chal_x6^i+1 * D_s(i+1) and set last row of D_s to random values and also D(0)
func_pro::set_D_s(D_s, D_h, D, chal_x6, r_Dl_bar);
//calculate the values Dls as Dl(l) = sum(D(i)*D_s->at(i)*chal_y6) for j=n+i-l and commits to the values
func_pro::commit_Dl_op(c_Dl, Dl, r_Dl, D, D_s, chal_y6);
//commitments to D(0) and D_s(m)
Functions::commit_op(D->at(0), r_D0, c_D0);
Functions::commit_op(D_s->at(m), r_Dm, c_Dm);
//commitments to prove that the product over the elements in D_h->at(m) is the desired product of n *y + x2n -z
func_pro::commit_d_op(d, r_d, c_d);
func_pro::commit_Delta_op(Delta, d, r_Delta, c_Delta);
func_pro::commit_d_h_op(D_h, d_h, d, Delta, r_d_h, c_d_h);
calculate_ac_bar(chal_x6);
calculate_r_ac_bar(chal_x6);
double tstart, tstop;
vector<Cipher_elg>* e = 0;
tstart = (double)clock() / CLOCKS_PER_SEC;
reduce_C(C, B, r_B, chal_x6, m_r);
set_Rb1(chal_x6);
tstop = (double)clock() / CLOCKS_PER_SEC;
time_di = time_di + tstop - tstart;
func_pro::commit_a_op(a, r_a, c_a);
func_pro::commit_B0_op(B_0, basis_B0, r_B0, c_B0, omega_mulex);
tstart = (double)clock() / CLOCKS_PER_SEC;
e = calculate_e();
tstop = (double)clock() / CLOCKS_PER_SEC;
time_di = time_di + tstop - tstart;
//cout<<"To calculate the di's took "<<time_di<<" sec."<<endl;
calculate_E(e);
delete e;
Functions::delete_vector(C_small);
}
void Prover_toom::round_7()
{
// 用hash生成随机挑战y,z
string hashValueStr1 = sha.hash(hashStr[3]);
ZZ hashValueZZ1;
conv(hashValueZZ1, hashValueStr1.c_str());
Mod_p hashValueModP1 = Mod_p(hashValueZZ1, H.get_mod());
while (hashValueModP1.get_val() > ord)
hashValueModP1.set_val(hashValueModP1.get_val() - ord);
string hashValueStr2 = sha.hash(hashStr[4]);
ZZ hashValueZZ2;
conv(hashValueZZ2, hashValueStr2.c_str());
Mod_p hashValueModP2 = Mod_p(hashValueZZ2, H.get_mod());
while (hashValueModP2.get_val() > ord)
hashValueModP2.set_val(hashValueModP2.get_val() - ord);
ZZ chal_x6_temp = hashValueModP1.get_val();
ZZ chal_y6_temp = hashValueModP2.get_val();
func_ver::fill_vector(chal_x6, chal_x6_temp);
func_ver::fill_vector(chal_y6, chal_y6_temp);
round_7a();
//ofstream ost("prove.pro", ios::app);
stringstream ss;
//10 c_Dl
for (int i = 0; i <= 2 * m; i++)
{
ost << c_Dl->at(i) << endl;
ss << c_Dl->at(i);
}
//11 c_D0
ost << c_D0 << endl;
ss << c_D0;
//12 c_Dm
ost << c_Dm << endl;
ss << c_Dm;
//13 c_d
ost << c_d << endl;
ss << c_d;
//14 c_Delta
ost << c_Delta << endl;
ss << c_Delta;
//15 c_d_h
ost << c_d_h << endl;
ss << c_d_h;
//16 a_c_bar
ost << a_c_bar << endl;
ss << a_c_bar;
//17 r_ac_bar
ost << r_ac_bar << endl;
ss << r_ac_bar;
//18 E
for (int i = 0; i < 8; i++)
{
ost << E->at(i) << endl;
ss << E->at(i);
}
//19 c_B0
ost << c_B0 << endl;
ss << c_B0;
//20 c_a
for (int i = 0; i < 8; i++)
{
ost << c_a->at(i) << endl;
ss << c_a->at(i);
}
//21 chal_x6
for (int i = 0; i < chal_x6->size(); i++)
{
ost << chal_x6->at(i) << endl;
ss << chal_x6->at(i);
}
//22 chal_y6
for (int i = 0; i < chal_y6->size(); i++)
{
ost << chal_y6->at(i) << endl;
ss << chal_y6->at(i);
}
hashStr[5] = ss.str() + pk_ss.str();
//ost.close();
}
void Prover_toom::round_9a()
{
//Calculate D_h_bar = sum(chal^i*D_h(row(i)))
func_pro::calculate_D_h_bar(D_h_bar, D_h, chal_x8);
//calculate r_Dh_bar = sum(chal^i*r_Dh_bar(i)), opening to prove correctness of D_h
func_pro::calculate_r_Dh_bar(r_D_h, chal_x8, r_Dh_bar);
//calculate d_bar, r_d_bar, Delta_bar, r_Delta_bar, openings to prove product over elements in D_h->at(m-1)
func_pro::calculate_dbar_rdbar(D_h, chal_x8, d_bar, d, r_D_h, r_d, r_d_bar);
func_pro::calculate_Deltabar_rDeltabar(d_h, chal_x8, Delta_bar, Delta, r_d_h, r_Delta, r_Delta_bar);
//A_bar and r_A_bar, openings to prove permutation in D
func_pro::calculate_A_bar(D, A_bar, chal_x8);
func_pro::calculate_r_A_bar(r_D0, r_A, r_B, chal_x8, r_z, chal_y4, r_A_bar);
//D_s_bar and r_Ds_bar, openings to prove correctness of D_s
func_pro::calculate_D_s_bar(D_s, D_s_bar, chal_x8);
func_pro::calculate_r_Ds_bar(r_D_h, chal_x6, chal_x8, r_Ds_bar, r_Dm);
//sum of the random values used to commit to the Dl's, to prover correctness of them
func_pro::calculate_r_Dl_bar(r_Dl, chal_x8, r_Dl_bar);
//calculate B_bar
func_pro::calculate_B_bar(B_0, B_small, chal_x8, B_bar);
Functions::delete_vector(B_small);
//calculate r_B_bar
func_pro::calculate_r_B_bar(r_B_small, chal_x8, r_B0, r_B_bar);
//calculate a_bar
func_pro::calculate_a_bar(a, chal_x8, a_bar);
//calculate r_a_bar
func_pro::calculate_r_a_bar(r_a, chal_x8, r_a_bar);
//calculate rho_a_bar
func_pro::calculate_rho_a_bar(rho_a, chal_x8, rho_bar);
}
void Prover_toom::round_9() {
// 用hash生成随机挑战x
string hashValueStr = sha.hash(hashStr[5]);
ZZ hashValueZZ;
conv(hashValueZZ, hashValueStr.c_str());
Mod_p hashValueModP = Mod_p(hashValueZZ, H.get_mod());
while (hashValueModP.get_val() > ord)
hashValueModP.set_val(hashValueModP.get_val() - ord);
ZZ chal_x8_temp = hashValueModP.get_val();
//一个随机挑战
func_pro::fill_x8(chal_x8, chal_x8_temp);
round_9a();
//ofstream ost("prove.pro", ios::app);
//23 D_h_bar
for (int i = 0; i < n; i++)
{
ost << D_h_bar->at(i) << endl;
}
//24 r_Dh_bar
ost << r_Dh_bar << endl;
//25 d_bar
for (int i = 0; i < n; i++)
{
ost << d_bar->at(i) << endl;
}
//26 r_d_bar
ost << r_d_bar << endl;
//27 Delta_bar
for (int i = 0; i < n; i++)
{
ost << Delta_bar->at(i) << endl;
}
//28 r_Delta_bar
ost << r_Delta_bar << endl;
//29 A_bar
for (int i = 0; i < n; i++)
{
ost << A_bar->at(i) << endl;
}
//30 r_A_bar
ost << r_A_bar << endl;
//31 D_s_bar
for (int i = 0; i < n; i++)
{
ost << D_s_bar->at(i) << endl;
}
//32 r_Ds_bar
ost << r_Ds_bar << endl;
//33 r_Dl_bar
ost << r_Dl_bar << endl;
//34 B_bar
for (int i = 0; i < n; i++)
{
ost << B_bar->at(i) << endl;
}
//35 r_B_bar
ost << r_B_bar << endl;
//36 a_bar
ost << a_bar << endl;
//37 r_a_bar
ost << r_a_bar << endl;
//38 rho_bar
ost << rho_bar << endl;
//39 chal_x8_temp
ost << chal_x8_temp << endl;
//ost.close();
}
int Prover_toom::prove(array<string, 2> codes,string fileName)
{
ost.open(fileName, ios::out);
if (!ost)
{
cout << "[" << codes[0] << "] - " << "Can't create "<< fileName << endl;
exit(1);
}
this->round_1();
this->round_3();//生成一个挑战
this->round_5();//生成两个挑战
this->round_7();//生成两个挑战
this->round_9();//生成一个挑战
ost.close();
return 0;
}
void Prover_toom::commit_ac()
{
long i;
ZZ ord = H.get_ord();
for (i = 0; i < mu_h; i++)
{
a_c->at(i) = RandomBnd(ord);
r_c->at(i) = RandomBnd(ord);
rho_c->at(i) = RandomBnd(ord);
}
a_c->at(mu - 1) = to_ZZ(0);
r_c->at(mu - 1) = to_ZZ(0);
NegateMod(rho_c->at(mu - 1), R_b, ord);
for (i = 0; i < mu_h; i++)
{
c_a_c->at(i) = Ped.commit_sw(a_c->at(i), r_c->at(i));
}
}
void Prover_toom::calculate_Cc(vector<vector<Cipher_elg>*>* C, vector<vector<vector<long>*>*>* B)
{
long i, j, l, k;
ZZ mod = H.get_mod();
ZZ gen = H.get_gen().get_val();
Cipher_elg temp, temp_1;
ZZ t_1;
double tstart, tstop;
tstart = (double)clock() / CLOCKS_PER_SEC;
for (k = 0; k < mu_h; k++)
{
temp = Cipher_elg(1, 1, mod);
for (i = 0; i < mu; i++)
{
j = k + 1 - mu + i;
if (j >= 0 & j < mu)
{
for (l = 0; l < m_r; l++)
{
multi_expo::expo_mult(temp_1, C->at(4 * l + i), B->at(4 * l + j), omega_mulex);
Cipher_elg::mult(temp, temp, temp_1);
}
}
}
PowerMod(t_1, gen, a_c->at(k), mod);
temp_1 = El.encrypt(t_1, rho_c->at(k));
Cipher_elg::mult(C_c->at(k), temp, temp_1);
}
tstop = (double)clock() / CLOCKS_PER_SEC;
time_di = 0;
time_di = time_di + (tstop - tstart);
}
void Prover_toom::calculate_Cc(vector<vector<Cipher_elg>*>* C, vector<vector<ZZ>*>* B)
{
long i, j, l, k;
ZZ mod = H.get_mod();
ZZ gen = H.get_gen().get_val();
Cipher_elg temp, temp_1;
ZZ t_1;
double tstart, tstop;
tstart = (double)clock() / CLOCKS_PER_SEC;
for (k = 0; k < mu_h; k++)
{
temp = Cipher_elg(1, 1, mod);
for (i = 0; i < mu; i++)
{
j = k + 1 - mu + i;
if (j >= 0 & j < mu)
{
for (l = 0; l < m_r; l++)
{
multi_expo::expo_mult(temp_1, C->at(4 * l + i), B->at(4 * l + j), omega_mulex);
Cipher_elg::mult(temp, temp, temp_1);
}
}
}
PowerMod(t_1, gen, a_c->at(k), mod);
temp_1 = El.encrypt(t_1, rho_c->at(k));
Cipher_elg::mult(C_c->at(k), temp, temp_1);
}
tstop = (double)clock() / CLOCKS_PER_SEC;
time_di = 0;
time_di = time_di + (tstop - tstart);
}
void Prover_toom::calculate_ac_bar(vector<ZZ>* x)
{
long i;
ZZ temp;
ZZ ord = H.get_ord();
a_c_bar = a_c->at(0);
for (i = 1; i < mu_h; i++)
{
MulMod(temp, a_c->at(i), x->at(i - 1), ord);
AddMod(a_c_bar, a_c_bar, temp, ord);
}
}
void Prover_toom::calculate_r_ac_bar(vector<ZZ>* x)
{
long i;
ZZ temp;
ZZ ord = H.get_ord();
r_ac_bar = r_c->at(0);
for (i = 1; i < mu_h; i++)
{
MulMod(temp, r_c->at(i), x->at(i - 1), ord);
AddMod(r_ac_bar, r_ac_bar, temp, ord);
}
}
void Prover_toom::reduce_C(vector<vector<Cipher_elg>*>* C, vector<vector<ZZ>*>* B, vector<ZZ>* r_B, vector<ZZ>* x, long length)
{
long i, j;
ZZ temp, temp_1;
ZZ ord = H.get_ord();
double tstart, tstop;
vector<Cipher_elg>* row_C = 0;
vector<ZZ>* row_B = 0;
vector<ZZ>* x_temp = new vector<ZZ>(4);
tstart = (double)clock() / CLOCKS_PER_SEC;
x_temp->at(3) = 1;
x_temp->at(2) = x->at(0);
x_temp->at(1) = x->at(1);
x_temp->at(0) = x->at(2);
for (i = 0; i < length; i++)
{
row_C = new vector<Cipher_elg>(n);
row_B = new vector<ZZ>(n);
for (j = 0; j < n; j++)
{
multi_expo::multi_expo_LL(row_C->at(j), C->at(4 * i)->at(j), C->at(4 * i + 1)->at(j), C->at(4 * i + 2)->at(j), C->at(4 * i + 3)->at(j), x_temp, omega_LL);
temp = B->at(4 * i)->at(j);
MulMod(temp_1, B->at(4 * i + 1)->at(j), x_temp->at(2), ord);
AddMod(temp, temp, temp_1, ord);
MulMod(temp_1, B->at(4 * i + 2)->at(j), x_temp->at(1), ord);
AddMod(temp, temp, temp_1, ord);
MulMod(temp_1, B->at(4 * i + 3)->at(j), x_temp->at(0), ord);
AddMod(temp, temp, temp_1, ord);
row_B->at(j) = temp;
}
C_small->at(i) = row_C;
B_small->at(i) = row_B;
temp = r_B->at(4 * i);
MulMod(temp_1, r_B->at(4 * i + 1), x_temp->at(2), ord);
AddMod(temp, temp, temp_1, ord);
MulMod(temp_1, r_B->at(4 * i + 2), x_temp->at(1), ord);
AddMod(temp, temp, temp_1, ord);
MulMod(temp_1, r_B->at(4 * i + 3), x_temp->at(0), ord);
AddMod(temp, temp, temp_1, ord);
r_B_small->at(i) = temp;
}
tstop = (double)clock() / CLOCKS_PER_SEC;
time_di = time_di + (tstop - tstart);
delete x_temp;
}
void Prover_toom::set_Rb1(vector<ZZ>* x)
{
long i;
ZZ temp;
ZZ ord = H.get_ord();
R_b = rho_c->at(0);
for (i = 1; i < mu_h; i++)
{
MulMod(temp, rho_c->at(i), x->at(i - 1), ord);
AddMod(R_b, R_b, temp, ord);
}
}
vector<Cipher_elg>* Prover_toom::calculate_e()
{
long k, l;
Cipher_elg temp;
ZZ ord = H.get_ord();
ZZ mod = H.get_mod();
vector<Cipher_elg>* dt = 0;
vector<Cipher_elg>* e = new vector<Cipher_elg>(2 * m);
dt = toom4_pow(C_small, B_small);
multi_expo::expo_mult(e->at(0), C_small->at(mu - 1), basis_B0, omega_mulex);
for (k = 1; k < mu; k++)
{
multi_expo::expo_mult(temp, C_small->at(mu - k - 1), basis_B0, omega_mulex);
Cipher_elg::mult(e->at(k), temp, dt->at(2 * mu - k - 1));
}
l = 2 * mu;
for (k = mu; k < l; k++)
{
e->at(k) = dt->at(2 * mu - k - 1);
}
delete dt;
return e;
}
void Prover_toom::calculate_E(vector<Cipher_elg>* e)
{
long i, l;
Mod_p t;
Mod_p gen = H.get_gen();
ZZ ord = H.get_ord();
l = 2 * mu;
for (i = 0; i < l; i++)
{
rho_a->at(i) = RandomBnd(ord);
}
rho_a->at(mu) = R_b;
for (i = 0; i < l; i++)
{
t = gen.expo(a->at(i));
E->at(i) = El.encrypt(t, rho_a->at(i)) * e->at(i);
}
}
vector<vector<Cipher_elg>*>* Prover_toom::copy_C()
{
long i, j, l;
vector<Cipher_elg>* row_C;
l = mu * m_r;
vector<vector<Cipher_elg>*>* C_small_temp = new vector<vector<Cipher_elg>*>(l);
for (i = 0; i < l; i++)
{
row_C = new vector<Cipher_elg>(n);
for (j = 0; j < n; j++)
{
row_C->at(j) = C_small->at(i)->at(j);
}
C_small_temp->at(i) = row_C;
delete C_small->at(i);
C_small->at(i) = 0;
}
delete C_small;
C_small = 0;
return C_small_temp;
}
vector<vector<ZZ>*>* Prover_toom::copy_B()
{
long i, j;
long l = mu * m_r;
vector<vector<ZZ>*>* B_small_temp = new vector<vector<ZZ>*>(l);
vector<ZZ>* row_B;
for (i = 0; i < l; i++)
{
row_B = new vector<ZZ>(n);
for (j = 0; j < n; j++)
{
row_B->at(j) = B_small->at(i)->at(j);
}
B_small_temp->at(i) = row_B;
delete B_small->at(i);
B_small->at(i) = 0;
}
delete B_small;
return B_small_temp;
}
vector<ZZ>* Prover_toom::copy_r_B()
{
long i;
long l = mu * m_r;
vector<ZZ>* r_B_small_temp = new vector<ZZ>(l);
for (i = 0; i < l; i++)
{
r_B_small_temp->at(i) = r_B_small->at(i);
}
delete r_B_small;
r_B_small = 0;
return r_B_small_temp;
}
vector<vector<ZZ>*>* Prover_toom::evulation(vector<vector<ZZ>*>* p)
{
vector<vector<ZZ>*>* ret;
vector<ZZ>* row;
ZZ p0, p1, p2, p3, ord, temp, temp_1;
long l, i;
l = p->at(0)->size();
ord = H.get_ord();
ret = new vector<vector<ZZ>*>(l);
for (i = 0; i < l; i++)
{
row = new vector<ZZ>(7);
AddMod(p0, p->at(2)->at(i), p->at(0)->at(i), ord);
AddMod(p1, p->at(3)->at(i), p->at(1)->at(i), ord);
MulMod(temp, p->at(2)->at(i), 2, ord);
MulMod(temp_1, p->at(0)->at(i), 8, ord);
AddMod(p2, temp, temp_1, ord);
MulMod(temp, p->at(1)->at(i), 4, ord);
AddMod(p3, p->at(3)->at(i), temp, ord);
row->at(0) = p->at(3)->at(i);
MulMod(temp_1, p->at(1)->at(i), 2, ord);
AddMod(temp, temp_1, p->at(0)->at(i), ord);
MulMod(temp_1, p->at(2)->at(i), 4, ord);
AddMod(temp, temp, temp_1, ord);
MulMod(temp_1, p->at(3)->at(i), 8, ord);
AddMod(row->at(1), temp, temp_1, ord);
AddMod(row->at(2), p0, p1, ord);
SubMod(row->at(3), p0, p1, ord);
AddMod(row->at(4), p2, p3, ord);
SubMod(row->at(5), p2, p3, ord);
row->at(6) = p->at(0)->at(i);
ret->at(i) = row;
}
return ret;
}
vector<vector<vector<ZZ>*>*>* Prover_toom::evulation_pow(vector<vector<Cipher_elg>*>* p)
{
vector<vector<vector<ZZ>*>*>* ret;
vector<vector<ZZ>*>* ret_u;
vector<vector<ZZ>*>* ret_v;
vector<ZZ>* row_u;
vector<ZZ>* row_v;
ZZ p0_u, p1_u, p2_u, p3_u, temp_u, temp_1_u;
ZZ p0_v, p1_v, p2_v, p3_v, temp_v, temp_1_v;
ZZ mod = H.get_mod();
long l, i;
l = p->at(0)->size();
ret = new vector<vector<vector<ZZ>*>*>(2);
ret_u = new vector<vector<ZZ>*>(l);
ret_v = new vector<vector<ZZ>*>(l);
for (i = 0; i < l; i++)
{
row_u = new vector<ZZ>(7);
row_v = new vector<ZZ>(7);
MulMod(p0_u, p->at(1)->at(i).get_u(), p->at(3)->at(i).get_u(), mod);
MulMod(p0_v, p->at(1)->at(i).get_v(), p->at(3)->at(i).get_v(), mod);
MulMod(p1_u, p->at(0)->at(i).get_u(), p->at(2)->at(i).get_u(), mod);
MulMod(p1_v, p->at(0)->at(i).get_v(), p->at(2)->at(i).get_v(), mod);
PowerMod(temp_u, p->at(1)->at(i).get_u(), 2, mod);
PowerMod(temp_v, p->at(1)->at(i).get_v(), 2, mod);
PowerMod(temp_1_u, p->at(3)->at(i).get_u(), 8, mod);
PowerMod(temp_1_v, p->at(3)->at(i).get_v(), 8, mod);
MulMod(p2_u, temp_u, temp_1_u, mod);
MulMod(p2_v, temp_v, temp_1_v, mod);
PowerMod(temp_u, p->at(2)->at(i).get_u(), 4, mod);
PowerMod(temp_v, p->at(2)->at(i).get_v(), 4, mod);
MulMod(p3_u, p->at(0)->at(i).get_u(), temp_u, mod);
MulMod(p3_v, p->at(0)->at(i).get_v(), temp_v, mod);
row_u->at(0) = p->at(0)->at(i).get_u();
PowerMod(temp_u, p->at(2)->at(i).get_u(), 2, mod);
MulMod(temp_u, temp_u, p->at(3)->at(i).get_u(), mod);
PowerMod(temp_1_u, p->at(1)->at(i).get_u(), 4, mod);
MulMod(temp_u, temp_u, temp_1_u, mod);
PowerMod(temp_1_u, p->at(0)->at(i).get_u(), 8, mod);
MulMod(row_u->at(1), temp_u, temp_1_u, mod);
MulMod(row_u->at(2), p0_u, p1_u, mod);
InvMod(temp_u, p1_u, mod);
MulMod(row_u->at(3), p0_u, temp_u, mod);
MulMod(row_u->at(4), p2_u, p3_u, mod);
InvMod(temp_u, p3_u, mod);
MulMod(row_u->at(5), p2_u, temp_u, mod);
row_u->at(6) = p->at(3)->at(i).get_u();
row_v->at(0) = p->at(0)->at(i).get_v();
PowerMod(temp_v, p->at(2)->at(i).get_v(), 2, mod);
MulMod(temp_v, temp_v, p->at(3)->at(i).get_v(), mod);
PowerMod(temp_1_v, p->at(1)->at(i).get_v(), 4, mod);
MulMod(temp_v, temp_v, temp_1_v, mod);
PowerMod(temp_1_v, p->at(0)->at(i).get_v(), 8, mod);
MulMod(row_v->at(1), temp_v, temp_1_v, mod);
MulMod(row_v->at(2), p0_v, p1_v, mod);
InvMod(temp_v, p1_v, mod);
MulMod(row_v->at(3), p0_v, temp_v, mod);
MulMod(row_v->at(4), p2_v, p3_v, mod);
InvMod(temp_v, p3_v, mod);
MulMod(row_v->at(5), p2_v, temp_v, mod);
row_v->at(6) = p->at(3)->at(i).get_v();
ret_u->at(i) = row_u;
ret_v->at(i) = row_v;
}
ret->at(0) = ret_u;
ret->at(1) = ret_v;
return ret;
}
vector<vector<vector<ZZ>*>*>* Prover_toom::point_pow(vector<vector<vector<ZZ>*>*>* points_p, vector<vector<ZZ>*>* points_q)
{
long i, j, l;
vector<vector<vector<ZZ>*>*>* ret;
vector<vector<ZZ>*>* ret_u;
vector<vector<ZZ>*>* ret_v;
vector<ZZ>* row_u;
vector<ZZ>* row_v;
ZZ mod = H.get_mod();
l = points_p->at(0)->size();
ret = new vector<vector<vector<ZZ>*>*>(2);
ret_u = new vector<vector<ZZ>*>(l);
ret_v = new vector<vector<ZZ>*>(l);
for (j = 0; j < l; j++)
{
row_u = new vector<ZZ>(7);
row_v = new vector<ZZ>(7);
for (i = 0; i < 7; i++)
{
PowerMod(row_u->at(i), points_p->at(0)->at(j)->at(i), points_q->at(j)->at(i), mod);
PowerMod(row_v->at(i), points_p->at(1)->at(j)->at(i), points_q->at(j)->at(i), mod);
}
ret_u->at(j) = row_u;
ret_v->at(j) = row_v;
}
ret->at(0) = ret_u;
ret->at(1) = ret_v;
for (i = 0; i < l; i++)
{
delete points_p->at(0)->at(i);
points_p->at(0)->at(i) = 0;
delete points_p->at(1)->at(i);
points_p->at(1)->at(i) = 0;
}
delete points_p->at(0);
delete points_p->at(1);
delete points_p;
for (i = 0; i < l; i++)
{
delete points_q->at(i);
points_q->at(i) = 0;
}
delete points_q;
return ret;
}
vector<vector<ZZ>*>* Prover_toom::mult_points(vector<vector<vector<ZZ>*>*>* points)
{
long i, l, j;
vector<vector<ZZ>*>* ret = new vector<vector<ZZ>*>(2);
vector<ZZ>* ret_u = new vector<ZZ>(7);
vector<ZZ>* ret_v = new vector<ZZ>(7);
l = points->at(0)->size();
ZZ temp_u, temp_v;
ZZ mod = H.get_mod();
for (i = 0; i < 7; i++)
{
temp_u = 1;
temp_v = 1;
for (j = 0; j < l; j++)
{
MulMod(temp_u, temp_u, points->at(0)->at(j)->at(i), mod);
MulMod(temp_v, temp_v, points->at(1)->at(j)->at(i), mod);
}
ret_u->at(i) = temp_u;
ret_v->at(i) = temp_v;
}
for (i = 0; i < l; i++)
{
delete points->at(0)->at(i);
points->at(0)->at(i) = 0;
delete points->at(1)->at(i);
points->at(1)->at(i) = 0;
}
delete points->at(0);
points->at(0) = 0;
delete points->at(1);
points->at(1) = 0;
delete points;
ret->at(0) = ret_u;
ret->at(1) = ret_v;
return ret;
}
vector<ZZ>* Prover_toom::interpolation_pow(vector<ZZ>* points)
{
vector<ZZ>* ret = new vector<ZZ>(7);
ZZ r1, r2, r3, r4, r5, r6, r7, temp;
ZZ ord = H.get_ord();
ZZ mod = H.get_mod();
r1 = points->at(0);
r2 = points->at(1);
r3 = points->at(2);
r4 = points->at(3);
r5 = points->at(4);
r6 = points->at(5);
r7 = points->at(6);
MulMod(r2, r2, r5, mod);
InvMod(temp, r5, mod);
MulMod(r6, r6, temp, mod);
InvMod(temp, r3, mod);
MulMod(r4, r4, temp, mod);
InvMod(temp, r1, mod);
MulMod(r5, r5, temp, mod);
PowerMod(temp, r7, 64, mod);
InvMod(temp, temp, mod);
MulMod(r5, r5, temp, mod);
InvMod(temp, to_ZZ(2), ord);
PowerMod(r4, r4, temp, mod);
MulMod(r3, r3, r4, mod);
PowerMod(temp, r5, 2, mod);
MulMod(r5, temp, r6, mod);
PowerMod(temp, r3, 65, mod);
InvMod(temp, temp, mod);
MulMod(r2, r2, temp, mod);
PowerMod(r4, r4, -1, mod);
PowerMod(r6, r6, -1, mod);
InvMod(temp, r7, mod);
MulMod(r3, r3, temp, mod);
InvMod(temp, r1, mod);
MulMod(r3, r3, temp, mod);
PowerMod(temp, r3, 45, mod);
MulMod(r2, r2, temp, mod);
PowerMod(temp, r3, 8, mod);
InvMod(temp, temp, mod);
MulMod(r5, r5, temp, mod);
InvMod(temp, to_ZZ(24), ord);
PowerMod(r5, r5, temp, mod);
InvMod(temp, r2, mod);
MulMod(r6, r6, temp, mod);
PowerMod(temp, r4, 16, mod);
InvMod(temp, temp, mod);
MulMod(r2, r2, temp, mod);
InvMod(temp, to_ZZ(18), ord);
PowerMod(r2, r2, temp, mod);
InvMod(temp, r5, mod);
MulMod(r3, r3, temp, mod);
InvMod(temp, r2, mod);
MulMod(r4, r4, temp, mod);
PowerMod(temp, r2, 30, mod);
MulMod(r6, r6, temp, mod);
InvMod(temp, to_ZZ(60), ord);
PowerMod(r6, r6, temp, mod);
InvMod(temp, r6, mod);
MulMod(r2, r2, temp, mod);
ret->at(0) = r1;
ret->at(1) = r2;
ret->at(2) = r3;
ret->at(3) = r4;
ret->at(4) = r5;
ret->at(5) = r6;
ret->at(6) = r7;
return ret;
}
vector<Cipher_elg>* Prover_toom::toom4_pow(vector<vector<Cipher_elg>*>* p, vector<vector<ZZ>*>* q)
{
vector<vector<vector<ZZ>*>*>* points_p;
vector<vector<ZZ>*>* points_q;
vector<vector<vector<ZZ>*>*>* points_temp;
vector<vector<ZZ>*>* points;
vector<ZZ>* ret_u;
vector<ZZ>* ret_v;
vector<Cipher_elg>* ret = new vector<Cipher_elg>(7);
long i, l;
ZZ mod = H.get_mod();
points_p = evulation_pow(p);
points_q = evulation(q);
points_temp = point_pow(points_p, points_q);
points = mult_points(points_temp);
ret_u = interpolation_pow(points->at(0));
ret_v = interpolation_pow(points->at(1));
l = points->size();
for (i = 0; i < l; i++)
{
delete points->at(i);
points->at(i) = 0;
}
delete points;
for (i = 0; i < 7; i++)
{
ret->at(i) = Cipher_elg(ret_u->at(i), ret_v->at(i), mod);
}
delete ret_u;
delete ret_v;
return ret;
}
| [
"[email protected]"
] | |
f5639c3a9d21904925e41254f485001da32406c4 | fa04d2f56c8d4ebfb931968392811a127a4cb46c | /trunk/Cities3D/src/CitiesOnlineRules/RuleBeginBlockingActionCitiesOnline.cpp | 0d54aef1082cf5f25eb0e04ab30a97dec8f43933 | [] | no_license | andrewlangemann/Cities3D | 9ea8b04eb8ec43d05145e0b91d1c542fa3163ab3 | 58c6510f609a0c8ef801c77f5be9ea622e338f9a | refs/heads/master | 2022-10-04T10:44:51.565770 | 2020-06-03T23:44:07 | 2020-06-03T23:44:07 | 268,979,591 | 0 | 0 | null | 2020-06-03T03:25:54 | 2020-06-03T03:25:53 | null | UTF-8 | C++ | false | false | 2,621 | cpp | /*
* Cities3D - Copyright (C) 2001-2009 Jason Fugate ([email protected])
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "stdwx.h"
#include "style.h" //READ THIS BEFORE MAKING ANY CHANGES TO THIS FILE!!!
//---------------------------- SYSTEM INCLUDES -----------------------------//
//---------------------------- USER INCLUDES -----------------------------//
#include "Rule.h"
#include "RuleSetDatabase.h"
//---------------------------- TYPEDEFS -----------------------------//
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//---------------------------- STATICS -----------------------------//
//---------------------------- RULES -----------------------------//
//---------------------------------------------------------------------------//
// Class: RuleBeginBlockingActionCitiesOnline
//
//
//
// Derived From:
// <Rule>
//
// Project:
// <CitiesRules>
//
// RuleSet:
// <CitiesOnline>
//
// Mixin To:
// <RuleBeginBlockingAction>
//
class RuleBeginBlockingActionCitiesOnline : public Rule
{
public:
virtual void Execute(const DataObject &object)
{
wxInt32 player = object.read<wxInt32>();
DataObject input(-1), output;
RULE.Decide(shLogicIsThisPlayer, input, output);
// If it's the player at this machine, start their passive countdown
// timer.
if(player == output.read<wxInt32>(1))
{
RULE.Execute(shRuleResetPassiveTime, DataObject(true));
// If this player isn't the current player, notify them that they
// need to do something.
if(false == output.read<bool>())
{
// Play a sound.
RULE.Execute(shRulePlaySound, DataObject(SOUND_YOU_NEED_TO_DO_SOMETHING));
Controller::get().Transmit(shEventRequestUserAttention, 0);
}
}
// Mark this player as being on a passive turn timer.
playerGameData<wxInt32>(shPassiveTurnTimer, player) = TRUE;
}
};
IMPLEMENT_RULE_MIXIN(RuleBeginBlockingActionCitiesOnline, RuleBeginBlockingAction,
CITIESONLINE)
| [
"[email protected]"
] | |
c273b93bf5c0fb6835aff364e353d9681477f73d | 3d61fb5fd6b7ff21450e14d5fe49be3aedbbe1e4 | /Philotes/Render/renderCommon.cpp | 583a0c5228a9dfb41eeb62a26e8084a0b6bca317 | [] | no_license | yannicpeng/erbiqingnian | b3731805b11484ce99b39ba9937f848810001a44 | ead102ba873ee3fa163d61c474cfd32147db6c1d | refs/heads/master | 2021-03-12T22:28:00.617820 | 2012-05-26T05:24:53 | 2012-05-26T05:24:53 | 33,162,785 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 61 | cpp |
#include "common.h"
_NAMESPACE_BEGIN
_NAMESPACE_END | [
"cjlm007@6cb12ae1-4c77-52bf-f227-7ea6b66274e1"
] | cjlm007@6cb12ae1-4c77-52bf-f227-7ea6b66274e1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.