blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 5
140
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 986
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 145
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 122
values | content
stringlengths 3
10.4M
| authors
listlengths 1
1
| author_id
stringlengths 0
158
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
28b809ff9fcf849f4923d0360b4b2f9910052838
|
57c31af7487bfffc1e334a11a2ea7c929264af18
|
/tests_boost/test-encode-decode-interest.cpp
|
e5fc83f8686db2bbfaa63137300d26812165f80d
|
[] |
no_license
|
cawka/packaging-ndn-cpp-dev
|
85a99240109d5fccb81c2b73250135aea3dd496b
|
baed2d2a6fcd365dddae0174185db184e5057638
|
refs/heads/master
| 2021-01-20T01:03:46.083951
| 2014-01-24T03:00:58
| 2014-01-24T03:00:58
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,491
|
cpp
|
/**
* Copyright (C) 2013 Regents of the University of California.
* @author: Jeff Thompson <jefft0@remap.ucla.edu>
* See COPYING for copyright and distribution information.
*/
#include <boost/test/unit_test.hpp>
#include <ndn-cpp-dev/interest.hpp>
using namespace std;
using namespace ndn;
BOOST_AUTO_TEST_SUITE(TestInterest)
const uint8_t Interest1[] = {
0x1, 0x41, // NDN Interest
0x3, 0x14, // Name
0x4, 0x5, // NameComponent
0x6c, 0x6f, 0x63, 0x61, 0x6c,
0x4, 0x3, // NameComponent
0x6e, 0x64, 0x6e,
0x4, 0x6, // NameComponent
0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
0x5, 0x1f, // Selectors
0x09, 0x1, 0x1, // MinSuffix
0x0a, 0x1, 0x1, // MaxSuffix
0x0c, 0x14, // Exclude
0x4, 0x4, // NameComponent
0x61, 0x6c, 0x65, 0x78,
0x4, 0x4, // NameComponent
0x78, 0x78, 0x78, 0x78,
0xf, 0x0, // Any
0x4, 0x4, // NameComponent
0x79, 0x79, 0x79, 0x79,
0x0d, 0x1, // ChildSelector
0x1,
0x6, 0x1, // Nonce
0x1,
0x7, 0x1, // Scope
0x1,
0x8, // InterestLifetime
0x2, 0x3, 0xe8
};
BOOST_AUTO_TEST_CASE (Decode)
{
Block interestBlock(Interest1, sizeof(Interest1));
ndn::Interest i;
BOOST_REQUIRE_NO_THROW(i.wireDecode(interestBlock));
BOOST_REQUIRE_EQUAL(i.getName().toUri(), "/local/ndn/prefix");
BOOST_REQUIRE_EQUAL(i.getScope(), 1);
BOOST_REQUIRE_EQUAL(i.getInterestLifetime(), 1000);
BOOST_REQUIRE_EQUAL(i.getMinSuffixComponents(), 1);
BOOST_REQUIRE_EQUAL(i.getMaxSuffixComponents(), 1);
BOOST_REQUIRE_EQUAL(i.getChildSelector(), 1);
BOOST_REQUIRE_EQUAL(i.getMustBeFresh(), false);
BOOST_REQUIRE_EQUAL(i.getExclude().toUri(), "alex,xxxx,*,yyyy");
BOOST_REQUIRE_EQUAL(i.getNonce(), 1);
}
BOOST_AUTO_TEST_CASE (Encode)
{
ndn::Interest i(ndn::Name("/local/ndn/prefix"));
i.setScope(1);
i.setInterestLifetime(1000);
i.setMinSuffixComponents(1);
i.setMaxSuffixComponents(1);
i.setChildSelector(1);
i.setMustBeFresh(false);
i.getExclude().excludeOne("alex").excludeRange("xxxx", "yyyy");
i.setNonce(1);
const Block &wire = i.wireEncode();
BOOST_REQUIRE_EQUAL_COLLECTIONS(Interest1, Interest1+sizeof(Interest1),
wire.begin(), wire.end());
}
BOOST_AUTO_TEST_SUITE_END()
|
[
"alexander.afanasyev@ucla.edu"
] |
alexander.afanasyev@ucla.edu
|
9128d9b3ae48f431f9ee3a8fed7f33da3f904a93
|
22f3d35f0670837f8bc624aa1bb8984bf6e103cb
|
/info.h
|
dcd5a78aa92ad974eba665d781c29d851c5b4800
|
[] |
no_license
|
Maden23/StockExchange
|
4a7c26e87d557c1d6b9b24a60a68c6111aaa6ee0
|
1a49f079cc38748935d16a57e5745c4609b26c48
|
refs/heads/master
| 2020-04-12T21:04:09.546385
| 2018-12-21T20:35:35
| 2018-12-21T20:35:35
| 162,754,212
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 863
|
h
|
#ifndef INFO_H
#define INFO_H
#include <fstream>
#include <string>
#include <QString>
using namespace std;
enum info_t {IS_COMPANY, IS_HOLDER, IS_HOLDERWANALYSIS};
class Info
{
public:
virtual ~Info();
void setName(QString name);
QString getName() const;
virtual info_t defineInfo() const = 0;
virtual void reset() = 0;
// Вызывает виртуальную функцию write определенную для каждого потомка
friend ofstream& operator<< (ofstream &out, Info &info);
// Вызывает виртуальную функцию read определенную для каждого потомка
friend ifstream& operator>> (ifstream &in, Info &info);
protected:
QString _name;
virtual void write(ofstream &out) = 0;
virtual void read(ifstream &in) = 0;
};
#endif // INFO_H
|
[
"maden98@gmail.com"
] |
maden98@gmail.com
|
3157042ebeb7a519c118aee3513d882610a76905
|
68a76eb015df500ab93125396cf351dff1e53356
|
/Codeforces/104A.cpp
|
48eb987444850c23294ce20b678a8092e00a21f2
|
[] |
no_license
|
deepakn97/Competitive-Programming
|
a84999c0755a187a55a0bb2f384c216e7ee4bf15
|
aae415839c6d823daba5cd830935bf3350de895e
|
refs/heads/master
| 2021-10-04T08:00:59.867642
| 2018-12-03T15:37:32
| 2018-12-03T15:37:32
| 81,475,571
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 703
|
cpp
|
#include <bits/stdc++.h>
using namespace std;
#define Pi 3.141592653589793
#define eps 1e-9
#define SQR(n) (n*n)
#define MEM(a,val) memset(a,val,sizeof(a))
#define vi vector<int>
#define vii vector< vector<int> >
#define pb push_back
#define F first
#define S second
#define SS stringstream
#define all(v) (v.begin(),v.end())
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = b; i >= a; i--)
#define ll long long
#define ul unsigned long
int main()
{
int n;
cin >> n;
n -= 10;
int ans = 0;
if(n == 1)
ans = 4;
else if(n >= 2 && n <= 9)
ans = 4;
else if(n == 10)
ans = 4*4 - 1;
else if(n == 11)
ans = 4;
else
ans = 0;
cout << ans << endl;
return 0;
}
|
[
"deepak54354@gmail.com"
] |
deepak54354@gmail.com
|
61ddca7a35eb4d5f6011adc3c76230a8151e71b0
|
79d737df7d3ecb6404911ffc561942be740d2f4c
|
/rstudio-server/JAGS-v4.3.0/include/JAGS/graph/ArrayStochasticNode.h
|
62bddeb58ac93c636bc89d6d46fac2c7931e23ed
|
[] |
no_license
|
omicsclass/biodocker
|
18d3d611488173fb9dd65c6fee6c5a10cf47d170
|
6e77a4aaef187a26ff3ba628d12905093fe320ec
|
refs/heads/master
| 2023-01-05T13:26:41.664515
| 2022-12-26T10:16:53
| 2022-12-26T10:16:53
| 248,117,776
| 0
| 4
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,429
|
h
|
#ifndef ARRAY_STOCHASTIC_NODE_H_
#define ARRAY_STOCHASTIC_NODE_H_
#include <graph/StochasticNode.h>
namespace jags {
class ArrayDist;
/**
* @short Array-valued Node defined by the BUGS-language operator ~
*/
class ArrayStochasticNode : public StochasticNode {
ArrayDist const * const _dist;
std::vector<std::vector<unsigned int> > _dims;
void sp(double *lower, double *upper, unsigned int length,
unsigned int chain) const;
public:
/**
* Construct
* distribution and an array of parent nodes, considered as
* parameters to the distribution.
*/
ArrayStochasticNode(ArrayDist const *dist, unsigned int nchain,
std::vector<Node const *> const ¶meters,
Node const *lower, Node const *upper,
double const *data=0, unsigned int length=0);
double logDensity(unsigned int chain, PDFType type) const;
void randomSample(RNG *rng, unsigned int chain);
void truncatedSample(RNG *rng, unsigned int chain,
double const *lower, double const *upper);
void deterministicSample(unsigned int chain);
bool checkParentValues(unsigned int chain) const;
//StochasticNode *clone(std::vector<Node const *> const &parents,
//Node const *lower, Node const *upper) const;
unsigned int df() const;
double KL(unsigned int chain1, unsigned int chain2, RNG *rng, unsigned int nrep) const;
};
} /* namespace jags */
#endif /* ARRAY_STOCHASTIC_NODE_H_ */
|
[
"huang2002003@qq.com"
] |
huang2002003@qq.com
|
e9c31d9be30d6288b01828bc04cf3ea78ec43a28
|
131223db8fe76478768e174d85828cf10862c0dc
|
/interfaces/innerkits/native_cpp/include/bluetooth_gatt_client.h
|
9815b0af1f39da5d97dee69e9684e3db501af632
|
[
"Apache-2.0"
] |
permissive
|
openharmony-gitee-mirror/communication_bluetooth
|
e3c834043d8d96be666401ba6baa3f55e1f1f3d2
|
444309918cd00a65a10b8d798a0f5a78f8cf13be
|
refs/heads/master
| 2023-08-24T10:05:20.001354
| 2021-10-19T01:45:18
| 2021-10-19T01:45:18
| 400,050,270
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,531
|
h
|
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* 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.
*/
/**
* @addtogroup Bluetooth
* @{
*
* @brief Defines a bluetooth system that provides basic bluetooth connection and profile functions,
* including A2DP, AVRCP, BLE, GATT, HFP, MAP, PBAP, and SPP, etc.
*
* @since 6
*
*/
/**
* @file bluetooth_gatt_client.h
*
* @brief Bluetooth gatt client interface.
*
* @since 6
*
*/
#ifndef BLUETOOTH_GATT_CLIENT_H
#define BLUETOOTH_GATT_CLIENT_H
#include "bluetooth_def.h"
#include "bluetooth_gatt_service.h"
#include "bluetooth_remote_device.h"
namespace OHOS {
namespace Bluetooth {
/**
* @brief Class for GattClientCallback functions.
*
* @since 6
*
*/
class GattClientCallback {
public:
/**
* @brief The function to OnConnectionStateChanged.
*
* @param connectionState callback of gattClientCallback.
* @param ret ret of GattClientCallback.
* @since 6
*
*/
virtual void OnConnectionStateChanged(int connectionState, int ret) = 0;
/**
* @brief The function to OnCharacteristicChanged.
*
* @param characteristic Characteristic object to changed.
* @since 6
*
*/
virtual void OnCharacteristicChanged(const GattCharacteristic &characteristic)
{}
/**
* @brief The function to OnCharacteristicReadResult.
*
* @param characteristic Characteristic object.
* @param ret ret of GattClientCallback.
* @since 6
*
*/
virtual void OnCharacteristicReadResult(const GattCharacteristic &characteristic, int ret)
{}
/**
* @brief The function to OnCharacteristicWriteResult.
*
* @param characteristic Characteristic object.
* @param ret ret of GattClientCallback.
* @since 6
*
*/
virtual void OnCharacteristicWriteResult(const GattCharacteristic &characteristic, int ret)
{}
/**
* @brief The function to OnDescriptorReadResult.
*
* @param descriptor descriptor object.
* @param ret ret of GattClientCallback.
* @since 6
*
*/
virtual void OnDescriptorReadResult(const GattDescriptor &descriptor, int ret)
{}
/**
* @brief The function to OnDescriptorWriteResult.
*
* @param descriptor descriptor object.
* @param ret ret of GattClientCallback.
* @since 6
*
*/
virtual void OnDescriptorWriteResult(const GattDescriptor &descriptor, int ret)
{}
/**
* @brief The function to OnMtuUpdate.
*
* @param mtu mtu to update.
* @param ret ret of GattClientCallback.
* @since 6
*
*/
virtual void OnMtuUpdate(int mtu, int ret)
{}
/**
* @brief The function to OnServicesDiscovered.
*
* @param status Status object.
* @since 6
*
*/
virtual void OnServicesDiscovered(int status)
{}
/**
* @brief The function to OnConnectionParameterChanged.
*
* @param interval interval object.
* @param latency latency object.
* @param timeout timeout object.
* @param status status object.
* @since 6
*
*/
virtual void OnConnectionParameterChanged(int interval, int latency, int timeout, int status)
{}
/**
* @brief The function to OnSetNotifyCharacteristic.
*
* @param status status object.
* @since 6
*
*/
virtual void OnSetNotifyCharacteristic(int status)
{}
/**
* @brief A destructor of GattClientCallback.
*
* @since 6
*
*/
virtual ~GattClientCallback()
{}
};
/**
* @brief Class for GattClient functions.
*
* @since 6
*
*/
class BLUETOOTH_API GattClient {
public:
/**
* @brief The function to Connect.
*
* @param callback callback of gattClientCallback.
* @param isAutoConnect isAutoConnect of GattClient.
* @param transport transport of GattClient.
* @return int api accept status.
* @since 6
*
*/
int Connect(GattClientCallback &callback, bool isAutoConnect, int transport);
/**
* @brief The function to request connection priority.
*
* @param connPriority connPriority of GattClient.
* @return int api accept status.
* @since 6
*
*/
int RequestConnectionPriority(int connPriority);
/**
* @brief The function to disconnect.
*
* @return int api accept status.
* @since 6
*
*/
int Disconnect();
/**
* @brief The function to discover services.
*
* @return int api accept status.
* @since 6
*
*/
int DiscoverServices();
/**
* @brief The function to get service.
*
* @param uuid uuid of GattClient.
* @return service.
* @since 6
*
*/
std::optional<std::reference_wrapper<GattService>> GetService(const UUID &uuid);
/**
* @brief The function to get service.
*
* @return list of services.
* @since 6
*
*/
std::vector<GattService> &GetService();
/**
* @brief The function to read characteristic.
*
* @param characteristic Characteristic object.
* @return int read characteristic.
* @since 6
*
*/
int ReadCharacteristic(GattCharacteristic &characteristic);
/**
* @brief The function to read descriptor.
*
* @param descriptor descriptor object.
* @return int read descriptor.
* @since 6
*
*/
int ReadDescriptor(GattDescriptor &descriptor);
/**
* @brief The function to RequestBleMtuSize.
*
* @param mtu mtu of GattClient.
* @return int request ble mtu size.
* @since 6
*
*/
int RequestBleMtuSize(int mtu);
/**
* @brief The function to SetNotifyCharacteristic.
*
* @param characteristic characteristic object.
* @param enable enable of GattClient.
* @return result of #GATT_STATUS.
* @since 6
*
*/
int SetNotifyCharacteristic(GattCharacteristic &characteristic, bool enable);
/**
* @brief The function to write characteristic.
*
* @param characteristic characteristic object.
* @return int write characteristic.
* @since 6
*
*/
int WriteCharacteristic(GattCharacteristic &characteristic);
/**
* @brief The function to write characteristic.
*
* @param descriptor descriptor object.
* @return int write descriptor.
* @since 6
*
*/
int WriteDescriptor(GattDescriptor &descriptor);
/**
* @brief A constructor of GattClient.
*
* @param device Remote device object.
* @since 6
*
*/
explicit GattClient(const BluetoothRemoteDevice &device);
/**
* @brief A destructor of GattClient.
*
* @since 6
*
*/
~GattClient();
BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(GattClient);
private:
BLUETOOTH_DECLARE_IMPL();
};
} // namespace Bluetooth
} // namespace OHOS
#endif // BLUETOOTH_GATT_CLIENT_H
|
[
"guohong.cheng@huawei.com"
] |
guohong.cheng@huawei.com
|
d9173d3c1a26832112b88a1f5128e721285bef4c
|
5898d3bd9e4cb58043b40fa58961c7452182db08
|
/part1/ch03/3-3-2-move-container/src/Vector.h
|
b271a71c67ca72f7884de8018083db1716883577
|
[] |
no_license
|
sasaki-seiji/ProgrammingLanguageCPP4th
|
1e802f3cb15fc2ac51fa70403b95f52878223cff
|
2f686b385b485c27068328c6533926903b253687
|
refs/heads/master
| 2020-04-04T06:10:32.942026
| 2017-08-10T11:35:08
| 2017-08-10T11:35:08
| 53,772,682
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 524
|
h
|
/*
* Vector.h
*
* Created on: 2016/03/21
* Author: sasaki
*/
#ifndef VECTOR_H_
#define VECTOR_H_
class Vector {
private:
double* elem;
int sz;
public:
Vector(int s);
~Vector();
Vector(const Vector& a);
Vector& operator=(const Vector& a);
// move
Vector(Vector&& a);
Vector& operator=(Vector&& a);
double& operator[](int i);
const double& operator[](int i) const;
int size() const;
};
class Vector_size_mismatch { };
Vector operator+(const Vector& a, const Vector& b);
#endif /* VECTOR_H_ */
|
[
"sasaki-seiji@msj.biglobe.ne.jp"
] |
sasaki-seiji@msj.biglobe.ne.jp
|
423785318712c30856912e714b2169fdc8c11280
|
f83ef53177180ebfeb5a3e230aa29794f52ce1fc
|
/ACE/ACE_wrappers/TAO/TAO_IDL/be/be_visitor_null_return_value.cpp
|
6965580b91d971590acd159c3f2b937df60f495e
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-sun-iiop"
] |
permissive
|
msrLi/portingSources
|
fe7528b3fd08eed4a1b41383c88ee5c09c2294ef
|
57d561730ab27804a3172b33807f2bffbc9e52ae
|
refs/heads/master
| 2021-07-08T01:22:29.604203
| 2019-07-10T13:07:06
| 2019-07-10T13:07:06
| 196,183,165
| 2
| 1
|
Apache-2.0
| 2020-10-13T14:30:53
| 2019-07-10T10:16:46
| null |
UTF-8
|
C++
| false
| false
| 4,398
|
cpp
|
#include "be_visitor_null_return_value.h"
#include "be_visitor_context.h"
#include "be_helper.h"
#include "be_array.h"
#include "be_component.h"
#include "be_enum.h"
#include "be_eventtype.h"
#include "be_home.h"
#include "be_predefined_type.h"
#include "be_sequence.h"
#include "be_string.h"
#include "be_structure.h"
#include "be_typedef.h"
#include "be_union.h"
#include "be_valuebox.h"
#include "be_valuetype.h"
be_visitor_null_return_value::be_visitor_null_return_value (
be_visitor_context *ctx)
: be_visitor_decl (ctx),
os_ (*ctx->stream ())
{
}
be_visitor_null_return_value::~be_visitor_null_return_value (void)
{
}
int
be_visitor_null_return_value::visit_array (be_array *node)
{
os_ << "static_cast< ::" << node->full_name ()
<< "_slice *> (0)";
return 0;
}
int
be_visitor_null_return_value::visit_component (be_component *node)
{
return this->visit_interface (node);
}
int
be_visitor_null_return_value::visit_enum (be_enum *node)
{
os_ << "static_cast< ::" << node->full_name () << "> (0UL)";
return 0;
}
int
be_visitor_null_return_value::visit_eventtype (be_eventtype *node)
{
return this->visit_valuetype (node);
}
int
be_visitor_null_return_value::visit_home (be_home *node)
{
return this->visit_interface (node);
}
int
be_visitor_null_return_value::visit_interface (be_interface *node)
{
os_ << " ::" << node->full_name () << "::_nil ()";
return 0;
}
int
be_visitor_null_return_value::visit_predefined_type (be_predefined_type *node)
{
switch (node->pt ())
{
case AST_PredefinedType::PT_boolean:
os_ << "false";
break;
case AST_PredefinedType::PT_octet:
case AST_PredefinedType::PT_char:
case AST_PredefinedType::PT_wchar:
case AST_PredefinedType::PT_short:
case AST_PredefinedType::PT_ushort:
case AST_PredefinedType::PT_long:
case AST_PredefinedType::PT_ulong:
case AST_PredefinedType::PT_ulonglong:
case AST_PredefinedType::PT_value:
case AST_PredefinedType::PT_any:
os_ << "0";
break;
case AST_PredefinedType::PT_longlong:
os_ << "ACE_CDR_LONGLONG_INITIALIZER";
break;
case AST_PredefinedType::PT_float:
os_ << "0.0f";
break;
case AST_PredefinedType::PT_double:
os_ << "0.0";
break;
case AST_PredefinedType::PT_longdouble:
os_ << "ACE_CDR_LONG_DOUBLE_INITIALIZER";
break;
case AST_PredefinedType::PT_object:
os_ << " ::CORBA::Object::_nil ()";
break;
case AST_PredefinedType::PT_abstract:
os_ << " ::CORBA::AbstractBase::_nil ()";
break;
case AST_PredefinedType::PT_pseudo:
os_ << " ::CORBA::TypeCode::_nil ()";
break;
default: // PT_void not handled.
break;
}
return 0;
}
int
be_visitor_null_return_value::visit_sequence (be_sequence *node)
{
const char *fname = node->full_name ();
be_typedef *td = this->ctx_->tdef ();
if (td != 0)
{
fname = td->full_name ();
}
os_ << "static_cast< ::" << fname << " *> (0)";
return 0;
}
int
be_visitor_null_return_value::visit_string (be_string *node)
{
if (node->width () == (ssize_t) sizeof (char))
{
os_ << "static_cast<char *> (0)";
}
else
{
os_ << "static_cast< ::CORBA::WChar *> (0)";
}
return 0;
}
int
be_visitor_null_return_value::visit_structure (be_structure *node)
{
if (node->size_type () == AST_Type::FIXED)
{
os_ << " ::" << node->full_name () << " ()";
}
else
{
os_ << "static_cast< ::" << node->full_name ()
<< " *> (0)";
}
return 0;
}
int
be_visitor_null_return_value::visit_typedef (be_typedef *node)
{
this->ctx_->tdef (node);
return node->primitive_base_type ()->accept (this);
}
int
be_visitor_null_return_value::visit_union (be_union *node)
{
if (node->size_type () == AST_Type::FIXED)
{
os_ << " ::" << node->full_name () << " ()";
}
else
{
os_ << "static_cast< ::" << node->full_name ()
<< " *> (0)";
}
return 0;
}
int
be_visitor_null_return_value::visit_valuebox (be_valuebox *node)
{
os_ << "static_cast< ::" << node->full_name ()
<< " *> (0)";
return 0;
}
int
be_visitor_null_return_value::visit_valuetype (be_valuetype *node)
{
os_ << "static_cast< ::" << node->full_name ()
<< " *> (0)";
return 0;
}
|
[
"lihuibin705@163.com"
] |
lihuibin705@163.com
|
53b2c42d486abb9bd608d3d2b63f6bcca4d8532a
|
a3d6556180e74af7b555f8d47d3fea55b94bcbda
|
/chrome/browser/navigation_predictor/anchor_element_preloader.cc
|
7c5462136f4b33b5f08235427c9aa25c487eda48
|
[
"BSD-3-Clause"
] |
permissive
|
chromium/chromium
|
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
|
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
|
refs/heads/main
| 2023-08-24T00:35:12.585945
| 2023-08-23T22:01:11
| 2023-08-23T22:01:11
| 120,360,765
| 17,408
| 7,102
|
BSD-3-Clause
| 2023-09-10T23:44:27
| 2018-02-05T20:55:32
| null |
UTF-8
|
C++
| false
| false
| 6,059
|
cc
|
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/navigation_predictor/anchor_element_preloader.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_functions.h"
#include "chrome/browser/predictors/loading_predictor.h"
#include "chrome/browser/predictors/loading_predictor_factory.h"
#include "chrome/browser/prefetch/prefetch_prefs.h"
#include "chrome/browser/preloading/chrome_preloading.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/preloading.h"
#include "content/public/browser/preloading_data.h"
#include "content/public/browser/web_contents.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "third_party/blink/public/common/features.h"
#include "ui/base/page_transition_types.h"
#include "url/scheme_host_port.h"
namespace {
bool is_match_for_preconnect(const url::SchemeHostPort& preconnected_origin,
const GURL& visited_url) {
return preconnected_origin == url::SchemeHostPort(visited_url);
}
} // anonymous namespace
const char kPreloadingAnchorElementPreloaderPreloadingTriggered[] =
"Preloading.AnchorElementPreloader.PreloadingTriggered";
content::PreloadingFailureReason ToFailureReason(
AnchorPreloadingFailureReason reason) {
return static_cast<content::PreloadingFailureReason>(reason);
}
AnchorElementPreloader::~AnchorElementPreloader() = default;
AnchorElementPreloader::AnchorElementPreloader(
content::RenderFrameHost& render_frame_host)
: render_frame_host_(render_frame_host) {
content::PreloadingData* preloading_data =
content::PreloadingData::GetOrCreateForWebContents(
content::WebContents::FromRenderFrameHost(&*render_frame_host_));
preloading_data->SetIsNavigationInDomainCallback(
chrome_preloading_predictor::kPointerDownOnAnchor,
base::BindRepeating(
[](content::NavigationHandle* navigation_handle) -> bool {
return ui::PageTransitionCoreTypeIs(
navigation_handle->GetPageTransition(),
ui::PageTransition::PAGE_TRANSITION_LINK) &&
ui::PageTransitionIsNewNavigation(
navigation_handle->GetPageTransition());
}));
}
void AnchorElementPreloader::MaybePreconnect(const GURL& target) {
content::PreloadingData* preloading_data =
content::PreloadingData::GetOrCreateForWebContents(
content::WebContents::FromRenderFrameHost(&*render_frame_host_));
url::SchemeHostPort scheme_host_port(target);
content::PreloadingURLMatchCallback match_callback =
base::BindRepeating(is_match_for_preconnect, scheme_host_port);
// For now we add a prediction with a confidence of 100. In the future we will
// likely compute the confidence by looking at different factors (e.g. anchor
// element dimensions, last time since scroll, etc.).
preloading_data->AddPreloadingPrediction(
chrome_preloading_predictor::kPointerDownOnAnchor,
/*confidence=*/100, match_callback);
content::PreloadingAttempt* attempt = preloading_data->AddPreloadingAttempt(
chrome_preloading_predictor::kPointerDownOnAnchor,
content::PreloadingType::kPreconnect, match_callback);
if (content::PreloadingEligibility eligibility =
prefetch::IsSomePreloadingEnabled(
*Profile::FromBrowserContext(
render_frame_host_->GetBrowserContext())
->GetPrefs());
eligibility != content::PreloadingEligibility::kEligible) {
attempt->SetEligibility(eligibility);
return;
}
auto* loading_predictor = predictors::LoadingPredictorFactory::GetForProfile(
Profile::FromBrowserContext(render_frame_host_->GetBrowserContext()));
if (!loading_predictor) {
attempt->SetEligibility(ToPreloadingEligibility(
ChromePreloadingEligibility::kUnableToGetLoadingPredictor));
return;
}
attempt->SetEligibility(content::PreloadingEligibility::kEligible);
RecordUmaPreloadedTriggered(AnchorElementPreloaderType::kPreconnect);
// In addition to the globally-controlled preloading config, check for the
// feature-specific holdback. We disable the feature if the user is in either
// of those holdbacks.
if (base::GetFieldTrialParamByFeatureAsBool(
blink::features::kAnchorElementInteraction, "preconnect_holdback",
false)) {
attempt->SetHoldbackStatus(content::PreloadingHoldbackStatus::kHoldback);
}
if (attempt->ShouldHoldback()) {
return;
}
if (preconnected_targets_.find(scheme_host_port) !=
preconnected_targets_.end()) {
// We've already preconnected to that origin.
attempt->SetTriggeringOutcome(
content::PreloadingTriggeringOutcome::kDuplicate);
return;
}
int max_preloading_attempts = base::GetFieldTrialParamByFeatureAsInt(
blink::features::kAnchorElementInteraction, "max_preloading_attempts",
-1);
if (max_preloading_attempts >= 0 &&
preconnected_targets_.size() >=
static_cast<size_t>(max_preloading_attempts)) {
attempt->SetFailureReason(
ToFailureReason(AnchorPreloadingFailureReason::kLimitExceeded));
return;
}
preconnected_targets_.insert(scheme_host_port);
attempt->SetTriggeringOutcome(
content::PreloadingTriggeringOutcome::kTriggeredButOutcomeUnknown);
net::SchemefulSite schemeful_site(target);
auto network_anonymization_key =
net::NetworkAnonymizationKey::CreateSameSite(schemeful_site);
loading_predictor->PreconnectURLIfAllowed(target, /*allow_credentials=*/true,
network_anonymization_key);
}
void AnchorElementPreloader::RecordUmaPreloadedTriggered(
AnchorElementPreloaderType preload) {
base::UmaHistogramEnumeration(
kPreloadingAnchorElementPreloaderPreloadingTriggered, preload);
}
|
[
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] |
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
|
ed038aa0f3db85e36bc9577d03669b2ec3193c92
|
eca2965b6f3c9b887acf4842b7c4a5437ebbef6e
|
/1.6/wallFilmRegion/Uf
|
1f2c4a8ae6370616a97c0d0e6cf875b7481eb448
|
[] |
no_license
|
canesin/CasoSuperficiePlana
|
9c2fa7a7c73bffa2b18d9647618178c38d85ea03
|
bbfa4013c702ae7f2e895867297b096c9015b4d5
|
refs/heads/master
| 2016-09-05T23:07:15.957094
| 2012-06-27T21:37:21
| 2012-06-27T21:37:21
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 86,990
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "1.6";
object Uf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
2828
(
(-0.1596888319 0 -0.6158292821)
(-0.0800303447 0 -0.6101950662)
(0.08020192961 0 -0.5577156039)
(0.3541120431 0 -0.5382511716)
(0.6737223034 0 -0.5166149322)
(-0.9497358423 0 -0.4099233416)
(-1.006903037 0 -0.3551160448)
(-0.6579458772 0 -0.2638113257)
(-0.275199775 0 -0.5869592566)
(-0.1388771674 0 -0.6804540245)
(-0.04919915201 0 -0.6374358386)
(0.1086705666 0 -0.5605653318)
(0.4220224012 0 -0.4705387154)
(1.027996393 0 -0.6603470144)
(1.87974048 0 -1.837983314)
(1.935382737 0 -1.913382029)
(2.452409605 0 -1.624849174)
(-0.5872111901 0 -0.3709778233)
(-0.7731284553 0 -0.4358240006)
(-0.9798734947 0 -0.4743348971)
(-0.9776931318 0 -0.4135294765)
(-0.7842171895 0 -0.3218791085)
(-0.129453968 0 -0.5946587888)
(-0.002927947495 0 -0.7277074453)
(0.05999676797 0 -0.7381967075)
(0.2191910887 0 -0.7533719832)
(0.7962199131 0 -0.8809311877)
(1.833092762 0 -1.490884148)
(2.134360907 0 -1.756694694)
(2.280563404 0 -1.747639973)
(2.278237956 0 -1.543571017)
(1.680815146 0 -1.661843664)
(0.8136317905 0 -1.761528634)
(-0.4254642972 0 -0.2947329796)
(-0.6199908206 0 -0.4312941943)
(-0.8097435151 0 -0.513352954)
(-0.9156833685 0 -0.5298118141)
(-1.080044222 0 -0.5139178368)
(-1.063613432 0 -0.4659733208)
(0.08875987294 0 -0.6608775507)
(0.2250636982 0 -0.815313138)
(0.3250253631 0 -0.8358992973)
(0.5054930193 0 -0.8649377143)
(1.040644364 0 -1.040592247)
(1.95092853 0 -1.521855162)
(2.209979937 0 -1.669004519)
(2.259114282 0 -1.559827896)
(2.067324766 0 -1.298114703)
(1.315586676 0 -1.145661892)
(0.3993276713 0 -0.7916935758)
(-0.3537390693 0 0.2878352526)
(0.1563861958 0 0.4180922774)
(-0.3741871923 0 -0.3102148755)
(-0.5124089372 0 -0.4268944767)
(-0.680976807 0 -0.5635571436)
(-0.8128165538 0 -0.6312451405)
(-0.832931221 0 -0.5746959452)
(-1.22783858 0 -0.6590815894)
(-1.269392642 0 -0.5913695602)
(0.2230869206 0 -0.7120237168)
(0.4343268705 0 -0.865433183)
(0.4966165845 0 -0.9236775098)
(0.6014323074 0 -1.027303559)
(0.9112195642 0 -1.06363404)
(1.548896636 0 -1.205958186)
(2.078468621 0 -1.44325552)
(2.193815557 0 -1.365995463)
(1.893914998 0 -1.033997131)
(0.9722307173 0 -0.6523611895)
(0.1740840439 0 -0.03897061919)
(0.2196292049 0 0.3900019152)
(-0.3434767701 0 0.3638146862)
(-0.8050824712 0 0.4197682296)
(-0.3434918255 0 -0.3453900049)
(-0.4461304118 0 -0.4516164637)
(-0.6123629604 0 -0.6618884819)
(-0.7291011842 0 -0.7787614978)
(-0.7542542056 0 -0.7641866288)
(-0.8231282201 0 -0.7052523781)
(-1.341097726 0 -0.8394831255)
(-1.048616413 0 -0.7911124995)
(0.3411218909 0 -0.950568518)
(0.4536302464 0 -0.9303317232)
(0.2910987583 0 -0.9169930666)
(0.806950403 0 -1.093074888)
(1.107293813 0 -1.071490891)
(1.401367893 0 -1.036571066)
(1.715565047 0 -1.035191168)
(1.940061607 0 -1.014884746)
(1.711655622 0 -0.8663951812)
(0.05851684148 0 0.4690256586)
(0.3290683584 0 0.344236592)
(0.2665566185 0 0.4107245909)
(-0.652003473 0 0.3698068965)
(-0.8570640669 0 0.1868580804)
(-0.726900491 0 0.1576985607)
(-0.3190028165 0 -0.384057539)
(-0.4011410811 0 -0.4974152087)
(-0.5828202694 0 -0.8234138461)
(-0.6918550615 0 -1.007372045)
(-0.7208541136 0 -1.02572508)
(-0.7030623921 0 -0.9329624365)
(-0.8445195036 0 -0.9571993284)
(-1.351761304 0 -1.07054221)
(-2.341599995 0 -1.06762468)
(-1.33534912 0 -0.5962212837)
(-1.131943104 0 0.105848909)
(-0.05700038435 0 -0.8458111889)
(0.7910504277 0 -1.316378772)
(1.292565781 0 -0.8203287261)
(1.179086792 0 -0.777539736)
(1.521172732 0 -0.7919757829)
(1.66851233 0 -0.5854168396)
(1.538345012 0 -0.388070859)
(0.9546434238 0 0.03690786806)
(0.6706516199 0 0.4386867045)
(-0.6253496265 0 0.1153391734)
(-0.7524278034 0 0.1191457971)
(-0.6976752013 0 0.0527196829)
(-0.5831714335 0 0.1225718832)
(-0.3002691435 0 -0.3954381288)
(-0.3244373807 0 -0.431626742)
(-0.5191878409 0 -0.8506236198)
(-0.6502479166 0 -1.156523514)
(-0.6744102944 0 -1.225615475)
(-0.6431784615 0 -1.128967016)
(-0.7130163036 0 -1.139227938)
(-0.9146356507 0 -1.24586283)
(-1.330066746 0 -1.387702427)
(-2.457623542 0 -1.457297615)
(-1.114768674 0 -0.03755933684)
(-1.406669002 0 0.1297613479)
(-1.854759625 0 1.228491098)
(-1.712247031 0 1.605379456)
(-1.566297629 0 1.499954755)
(1.337411597 0 -0.885292388)
(1.31328142 0 -0.6709198168)
(1.382841663 0 -0.3638110004)
(1.274420657 0 -0.03021320573)
(0.7615317641 0 0.2068244667)
(0.1110626623 0 0.4521457796)
(-0.7591873816 0 -0.006119804042)
(-0.5963752461 0 -0.08927792927)
(-0.4540840582 0 -0.004966008319)
(-0.3934071016 0 0.0878655772)
(-0.3351064493 0 0.1285778865)
(-0.2759907865 0 -0.3877946362)
(-0.3124520276 0 -0.4670524836)
(-0.496088761 0 -0.865803567)
(-0.5891502172 0 -1.084566227)
(-0.5699197028 0 -1.11698144)
(-0.5777354302 0 -1.167585197)
(-0.7016411472 0 -1.330598676)
(-0.9299140559 0 -1.496165852)
(-1.247189317 0 -1.489737717)
(-1.621595916 0 -1.662431304)
(-1.60828292 0 0.1163101256)
(-0.8800848561 0 0.2256496874)
(-0.5605356223 0 0.2842224063)
(-0.4977044835 0 0.3179436049)
(-0.7026440912 0 0.5266107224)
(-0.9183875694 0 0.8549508169)
(1.091390058 0 -0.5679252041)
(1.219651346 0 -0.3765038763)
(1.059540088 0 0.4058046438)
(-0.1224174202 0 1.089076427)
(-1.026432104 0 -0.1904813939)
(-0.4988581406 0 -0.1418871144)
(-0.2314585009 0 -0.1752373767)
(-0.04558104085 0 -0.1189390903)
(0.2153711077 0 0.09413109492)
(2.162776535 0 -0.5175741683)
(4.124704378 0 -1.256044258)
(-0.2640322143 0 -0.3872828985)
(-0.2410728066 0 -0.3647425947)
(-0.2596018276 0 -0.3540446507)
(-0.3770540533 0 -0.5423366196)
(-0.4797904219 0 -0.7338210784)
(-0.4917617489 0 -0.8019207147)
(-0.5112479489 0 -0.9438578355)
(-0.6217690641 0 -1.308587629)
(-0.7593456368 0 -1.588559025)
(-0.8415274132 0 -1.240982221)
(-0.2892117024 0 0.03853827772)
(-0.8070428218 0 0.08236095177)
(-1.246438595 0 0.4598065632)
(-0.6404092927 0 0.3916290851)
(-0.5635673458 0 0.3847823718)
(-1.265794362 0 1.145189233)
(-1.135432165 0 1.482278594)
(-0.910470114 0 1.536844719)
(-0.8963738641 0 1.4073684)
(-1.088962737 0 1.382054218)
(-0.9021911985 0 0.8897141709)
(-0.430037728 0 -0.5119317377)
(0.03440014196 0 -0.5051030508)
(1.240542002 0 -1.832391357)
(2.332327882 0 -3.113837003)
(2.594568578 0 -3.395747206)
(2.827443022 0 -3.633920933)
(3.026682073 0 -4.048250744)
(-0.2830298695 0 -0.3525976541)
(-0.3214340262 0 -0.3573079689)
(-0.395147575 0 -0.3557626476)
(-0.3829559741 0 -0.3774626325)
(-0.3911001299 0 -0.5344463493)
(-0.4314690565 0 -0.6186255491)
(-0.4933998206 0 -0.6931208068)
(-0.6115985522 0 -0.8233860021)
(-0.7801829088 0 -0.9843411886)
(-0.4099298926 0 -0.1063007195)
(-0.4306545286 0 -0.03067465404)
(-3.234878968 0 0.4697607314)
(-1.174890455 0 0.6379557911)
(-0.6981806704 0 0.4598641243)
(-0.6482662085 0 0.4592191806)
(-2.189489964 0 2.480269463)
(-1.172555751 0 2.482171296)
(-0.9503625034 0 2.677982309)
(-0.8841176412 0 2.027300119)
(-0.959200042 0 1.352246697)
(-0.6759495746 0 -0.6100691847)
(0.3249383115 0 -0.99716275)
(1.434478285 0 -2.302243204)
(2.235081779 0 -3.306791926)
(2.495152556 0 -3.620964013)
(2.679979921 0 -3.823194134)
(2.872768503 0 -4.010970078)
(3.043549156 0 -4.178544518)
(-0.3326332181 0 -0.3131117534)
(-0.423156124 0 -0.3737041604)
(-0.4994763522 0 -0.3818988766)
(-0.4628846617 0 -0.3054778936)
(-0.3131985141 0 -0.3058689344)
(-0.3205941369 0 -0.4163378926)
(-0.3759145168 0 -0.5034298604)
(-0.4932408866 0 -0.6874035831)
(-0.8080908181 0 -1.121525818)
(-0.6956337871 0 -0.395648594)
(-0.6842444831 0 -0.1151967392)
(-4.486759854 0 1.141722378)
(-1.096556411 0 0.6728761132)
(-0.7764977583 0 0.5307629516)
(-0.7556167075 0 0.5407392208)
(-1.778197248 0 2.566691083)
(-0.8829175997 0 3.30681984)
(-0.6332931587 0 3.312540516)
(-0.794099949 0 2.480408977)
(-0.9192920027 0 1.433013712)
(0.04072456259 0 -1.319001394)
(0.9495593026 0 -1.770426422)
(1.997625418 0 -3.022223775)
(2.392050467 0 -3.504964244)
(2.581042236 0 -3.665631376)
(2.764796759 0 -3.794104751)
(2.938304509 0 -3.896322236)
(3.068288932 0 -3.973481488)
(-0.4992200874 0 0.2816208855)
(-0.351093117 0 -0.3073190631)
(-0.4232211911 0 -0.3678084379)
(-0.5142791834 0 -0.4133157706)
(-0.4975273338 0 -0.3004690295)
(-0.3011093218 0 -0.1767561604)
(-0.3036966584 0 -0.07843439165)
(-0.4328888706 0 0.06480702877)
(-0.3519732171 0 -0.04511116298)
(-0.3915291102 0 -0.5077785707)
(-1.126098085 0 -1.253979078)
(-0.9093351786 0 -0.363703147)
(-1.211912772 0 0.3814552383)
(-1.046053233 0 0.6499668029)
(-0.9108351263 0 0.6585050931)
(-1.157478525 0 0.7292267068)
(-0.509384605 0 0.6091596309)
(0.9156548151 0 2.063184177)
(-0.4289320097 0 1.037153122)
(-0.9333049456 0 0.8386042825)
(-1.03416737 0 0.9656258989)
(0.4160964963 0 -1.488694335)
(1.157843648 0 -1.992380478)
(2.092257951 0 -3.063534919)
(2.47598737 0 -3.494350534)
(2.622076035 0 -3.580196494)
(2.764828889 0 -3.665265527)
(2.880338039 0 -3.742331489)
(2.930150942 0 -3.781762796)
(-0.004827165859 0 -0.4032903841)
(-0.2531327339 0 -0.2258654107)
(-0.3258319434 0 -0.3022967677)
(-0.3464188637 0 -0.3752868119)
(-0.4522727911 0 -0.4651636454)
(-0.5463484042 0 -0.3439555375)
(-0.3225248976 0 -0.02725628532)
(-0.6981652763 0 0.3209805047)
(-0.8184105672 0 0.4372191062)
(-0.7028814599 0 0.4240505262)
(-0.4237384047 0 0.1089245321)
(-0.5694876506 0 -0.7052832957)
(-0.9810851008 0 -0.6273143723)
(-1.178990195 0 0.678440148)
(-1.194184594 0 0.8346326498)
(-1.105468007 0 0.9371160478)
(-0.416283358 0 0.5175180122)
(-0.5665087654 0 0.6028955407)
(-0.6994870483 0 0.7070466034)
(-0.8912313419 0 0.7517406132)
(-1.014161895 0 0.8373332226)
(-1.165805885 0 1.198198705)
(0.6264705396 0 -1.58719398)
(1.121559421 0 -1.815886354)
(1.731129955 0 -2.579311542)
(2.342102454 0 -3.262222862)
(2.540811314 0 -3.398864855)
(2.601070468 0 -3.41139216)
(2.490959779 0 -3.251544666)
(1.599780527 0 -2.120156402)
(0.3839011036 0 -0.4707311516)
(-0.2350208725 0 -0.2020014887)
(-0.2492553291 0 -0.2799895137)
(-0.2127988936 0 -0.433899565)
(-0.3235072943 0 -0.5792443193)
(-0.6436301734 0 -0.5533955277)
(-0.6163975963 0 0.3619763243)
(-0.9314102735 0 0.4927605557)
(-1.028639654 0 0.6400764198)
(-0.9753902657 0 0.6413693638)
(-0.7526890328 0 0.5242472257)
(-0.4576182396 0 0.2034912778)
(-0.5260858245 0 -0.03948545621)
(-0.7250302485 0 0.5250096674)
(0.9479504563 0 2.332846197)
(-0.1591141612 0 2.983339837)
(-0.6025920204 0 0.7075261385)
(-0.6762476236 0 0.6872610598)
(-0.8288307543 0 0.7583241427)
(-0.9747282072 0 0.8127935898)
(-1.063808815 0 0.8716572664)
(-1.099541642 0 1.038872855)
(0.88867907 0 -1.135049094)
(0.879892433 0 -1.263494045)
(1.32236795 0 -1.803336642)
(1.704404936 0 -2.331909001)
(2.004618876 0 -2.668349318)
(2.005932982 0 -2.602376694)
(1.629639046 0 -2.044831612)
(0.7935810953 0 -0.6764650703)
(0.4683147085 0 -0.4158263788)
(-0.1941064502 0 -0.1304010448)
(-0.1862282349 0 -0.1823705873)
(-0.1914660945 0 -0.2774752531)
(-0.08259687461 0 -0.8267482511)
(-0.221405899 0 -0.486837486)
(-0.7643897254 0 0.5078403322)
(-1.053665847 0 0.7432941479)
(-1.210790083 0 0.9361330921)
(-1.190211956 0 0.8950438944)
(-0.9560552721 0 0.7560073339)
(-0.7710549018 0 0.6847806858)
(-0.1766166064 0 0.2772399788)
(0.6671091226 0 0.2454917253)
(0.6245602977 0 0.6349845743)
(0.5576006732 0 1.11506118)
(-0.6433876955 0 0.8451751343)
(-0.8293912231 0 0.810334952)
(-0.9770427734 0 0.8758513809)
(-1.10852493 0 0.8916387464)
(-1.157034186 0 0.9033139921)
(-1.122649416 0 0.9265444574)
(-1.264140472 0 1.124796874)
(0.7823528776 0 -1.08860663)
(1.092722027 0 -1.078568996)
(1.288710352 0 -1.389255268)
(1.373353554 0 -1.551504934)
(1.295940671 0 -1.433713678)
(0.98843102 0 -0.9454886348)
(-0.4447705883 0 0.07856153165)
(-0.3483531705 0 0.1616084432)
(-0.21603143 0 -0.0317109916)
(-0.1543814558 0 -0.05251887493)
(-0.08190051789 0 -0.06809141724)
(0.2250677858 0 -0.3968240642)
(-0.3376375707 0 0.1229551508)
(-0.9552431941 0 0.8745545189)
(-1.370589033 0 1.27984757)
(-1.571674835 0 1.471013176)
(-1.477752601 0 1.310979457)
(-1.182795199 0 1.052430945)
(-0.8968774663 0 0.9230565801)
(-0.7240666049 0 0.7817812995)
(-0.08665059469 0 0.3322708308)
(-0.1635427726 0 0.3327695265)
(0.720272974 0 0.9933408392)
(-0.6989889543 0 0.6362902245)
(-0.9449723723 0 0.9630743762)
(-1.116576413 0 0.9948464879)
(-1.241282011 0 0.9466282017)
(-1.24388526 0 0.9055445035)
(-1.156152419 0 0.8781621778)
(-1.008931156 0 0.8310651874)
(-0.9252195079 0 0.3754175909)
(0.1062697675 0 -0.5303604333)
(1.028340082 0 -1.00870761)
(1.075227026 0 -0.9735205298)
(0.9458220257 0 -0.8490410642)
(0.3533895598 0 -0.3799011415)
(-0.3031860189 0 0.1107012987)
(-0.2718265472 0 0.1296874986)
(-0.1685394753 0 0.0376065888)
(-0.1700420635 0 0.1171508099)
(-0.01378427123 0 0.02727636102)
(0.02476446161 0 -0.04132088691)
(-0.5232064935 0 0.6036213155)
(-1.484421416 0 1.5307973)
(-2.007404106 0 1.99644799)
(-2.166673759 0 2.124898708)
(-1.951773958 0 1.872691101)
(-1.402292295 0 1.338711756)
(-0.9682531635 0 1.082166395)
(-0.7189288725 0 0.9273329159)
(-0.454346098 0 0.6486530878)
(-0.270957572 0 0.3401239039)
(-0.6002686239 0 0.3016214207)
(-0.7524816491 0 0.7815110853)
(-0.9897168064 0 0.9527528232)
(-1.236803021 0 0.9742983541)
(-1.315060638 0 0.9230357251)
(-1.258551933 0 0.8754424611)
(-1.115872322 0 0.8363300431)
(-0.8970879603 0 0.6815595431)
(-0.5951871998 0 0.04422254121)
(-0.5474872718 0 -0.3823740409)
(-0.5645500158 0 -0.3572010125)
(0.1403275939 0 -0.4932158379)
(-0.0808253433 0 -0.1869153496)
(-0.2988130614 0 0.06809019328)
(-0.2837985422 0 0.09816479246)
(-0.2405944056 0 0.1484490167)
(-0.1047045657 0 0.2233354704)
(-0.1385083097 0 0.2490510312)
(-0.1725084717 0 0.3560369853)
(-1.29268069 0 1.435385897)
(-2.201636248 0 2.238551714)
(-2.519687228 0 2.48612578)
(-2.544794633 0 2.472966955)
(-2.355554491 0 2.255931534)
(-1.680865748 0 1.561876339)
(-1.011092466 0 1.106716365)
(-0.6811528695 0 0.9486666639)
(-0.5123465108 0 0.7435155907)
(-0.6142905118 0 0.5650004808)
(-0.9145951276 0 -1.283517343)
(-0.9821245834 0 2.66541745)
(-1.334389591 0 1.013902733)
(-1.399923121 0 0.9544582628)
(-1.329049351 0 0.8818144579)
(-1.205620039 0 0.8466618672)
(-1.028782618 0 0.8331559805)
(-0.7887647196 0 0.4250923487)
(-0.4227421873 0 -0.3017252748)
(-0.5615490088 0 -0.5690191238)
(-0.504148531 0 -0.5217936783)
(-0.4012273079 0 -0.4075886076)
(-0.2978622703 0 -0.2060551246)
(-0.3312756677 0 0.02885918511)
(-0.2888138649 0 0.1344487284)
(-0.2184575629 0 0.1920334297)
(-0.00500525313 0 0.3713635854)
(0.002810256679 0 0.3879106118)
(-0.6540088281 0 0.9967227728)
(-2.295499948 0 2.403783537)
(-2.79578336 0 2.79355496)
(-2.838251192 0 2.782340745)
(-2.700379505 0 2.612217058)
(-2.406641311 0 2.288701253)
(-1.79109686 0 1.603979787)
(-0.9719163452 0 0.9339624815)
(-0.5330151978 0 0.7229221533)
(-0.4463294538 0 0.5077288776)
(-0.8900083806 0 0.6885517323)
(-1.251733802 0 0.8997689648)
(-1.446998488 0 0.9941054297)
(-1.497912453 0 1.015750363)
(-1.419545912 0 0.9549685335)
(-1.261279755 0 0.8359851038)
(-1.08641996 0 0.8253949334)
(-0.9056357315 0 0.8782222729)
(-0.6153301488 0 0.1433300162)
(-0.5411701118 0 -0.5641252797)
(-0.5953847241 0 -0.6622211177)
(-0.5917415924 0 -0.6595020824)
(-0.536304843 0 -0.592269577)
(-0.4008589225 0 -0.4334782422)
(-0.3016920556 0 -0.04688693323)
(-0.2393052236 0 0.2034376289)
(-0.09288345736 0 0.2976568068)
(0.1247284536 0 0.2041957102)
(0.1764305257 0 0.3398654582)
(-2.379909737 0 2.55244004)
(-3.113788874 0 3.14394243)
(-3.132883334 0 3.099513488)
(-2.983794964 0 2.908375729)
(-2.723480746 0 2.612427091)
(-2.264445143 0 2.115914673)
(-1.57571793 0 1.35971699)
(-0.8145779885 0 0.6668449761)
(-0.4578804598 0 0.4468001196)
(-0.8244035163 0 0.6058112162)
(-1.255625698 0 0.8752062118)
(-1.49209676 0 1.021109614)
(-1.561104317 0 1.049974634)
(-1.529814158 0 1.030630898)
(-1.378893479 0 0.9776380851)
(-1.125011316 0 0.8099506975)
(-0.8525165949 0 0.803383272)
(-0.7037587669 0 0.9540182355)
(-0.4675063885 0 0.1505639458)
(-0.5245051975 0 -0.6122156293)
(-0.6158423862 0 -0.7011731929)
(-0.6817542039 0 -0.7706542225)
(-0.692029018 0 -0.7714859791)
(-0.6251715368 0 -0.6893023759)
(-0.3826616301 0 -0.4138079146)
(0.1015987208 0 0.2167594684)
(0.07757061881 0 0.425770199)
(-3.397902059 0 3.492488597)
(-3.407304934 0 3.414551554)
(-3.239742239 0 3.185164418)
(-2.983818702 0 2.87211633)
(-2.582536464 0 2.423706977)
(-1.874447655 0 1.681025971)
(-1.198223803 0 0.9588535891)
(-0.9304454689 0 0.6906600594)
(-1.005505228 0 0.7096627318)
(-1.27742061 0 0.8886121088)
(-1.511387785 0 1.043816006)
(-1.614874999 0 1.110479555)
(-1.595813918 0 1.063235383)
(-1.46943655 0 1.022594365)
(-1.256718275 0 1.05347694)
(-0.9125809154 0 0.8054806626)
(-0.5262195122 0 0.7333524124)
(-0.4262217356 0 0.8820733056)
(-0.3732689486 0 0.5797987314)
(-0.4328362441 0 -0.5009279619)
(-0.5768352917 0 -0.6647979845)
(-0.7285708017 0 -0.8360135081)
(-0.8046819036 0 -0.9091337211)
(-0.8287198278 0 -0.921346648)
(-0.728194917 0 -0.7896431018)
(0.0644188487 0 0.0099273016)
(0.2952144662 0 0.4872659178)
(-3.676861363 0 3.764865204)
(-3.473176679 0 3.449069635)
(-3.196539747 0 3.063860252)
(-2.781092669 0 2.565095664)
(-2.077052079 0 1.852567571)
(-1.261899752 0 1.075301802)
(-1.051225118 0 0.8637487749)
(-1.056848002 0 0.8676800645)
(-1.188183426 0 0.9399061529)
(-1.436888308 0 1.063463471)
(-1.624759348 0 1.151327908)
(-1.673704533 0 1.16477694)
(-1.581100287 0 1.060084423)
(-1.242622255 0 0.9921005304)
(-0.9757322045 0 1.09346385)
(-0.709720619 0 0.6930423361)
(-0.3748693303 0 0.5137529959)
(-0.3035379087 0 0.423628362)
(-0.2446212033 0 0.2160560477)
(-0.2891092669 0 -0.2188143136)
(-0.4212194378 0 -0.4769479887)
(-0.7037773293 0 -0.8212608112)
(-0.8531678467 0 -0.9832136686)
(-0.9495508548 0 -1.074954926)
(-0.9976956365 0 -1.093927357)
(-3.630098677 0 3.711477598)
(-3.338505361 0 3.020719085)
(-2.719137211 0 2.26755378)
(-1.880883934 0 1.518720161)
(-1.189442269 0 1.076209892)
(-1.172944075 0 1.09975562)
(-1.197526082 0 1.121851004)
(-1.209576669 0 1.113648081)
(-1.361376489 0 1.141540302)
(-1.599536722 0 1.204348747)
(-1.729329958 0 1.232129013)
(-1.703075181 0 1.189308713)
(-1.520127287 0 1.047594632)
(-0.9241126651 0 0.8487182308)
(-0.6704761163 0 0.7599457381)
(-0.5627495608 0 0.4411733959)
(-0.4718519672 0 0.234670994)
(-0.4177429702 0 0.2496686333)
(-0.3506272757 0 0.2739222148)
(-0.3578070341 0 0.4646773228)
(-0.2585973669 0 0.5903277611)
(-0.5025889113 0 -0.577038577)
(-0.8007209935 0 -0.9436196682)
(-0.9822786032 0 -1.153012782)
(-1.066553695 0 -1.211274161)
(-3.512413124 0 1.611279719)
(-2.281612399 0 1.348836276)
(-1.488945873 0 1.149207907)
(-1.11502692 0 1.033078159)
(-1.27168739 0 1.315505947)
(-1.405699779 0 1.403693138)
(-1.38988454 0 1.385894982)
(-1.398703224 0 1.330276622)
(-1.587552009 0 1.306072347)
(-1.777217536 0 1.309382168)
(-1.809549611 0 1.277248892)
(-1.677340019 0 1.167550765)
(-1.368740143 0 0.9441312981)
(-0.8582013395 0 0.4724211409)
(-0.5782933556 0 0.227742146)
(-0.5064465772 0 0.1743584351)
(-0.5035176626 0 0.2305173865)
(-0.5091557597 0 0.3168486417)
(-0.524838851 0 0.4065933993)
(-0.4421787209 0 0.4620811593)
(0.1766692351 0 1.226435687)
(0.2003184548 0 1.601103619)
(0.1271286916 0 1.505335707)
(0.09677233876 0 1.269461257)
(-1.434015621 0 1.241358526)
(-1.314653954 0 1.184395399)
(-0.7843359012 0 1.246299658)
(-1.568274475 0 1.628856832)
(-1.621182677 0 1.647498924)
(-1.561504344 0 1.589370202)
(-1.630761193 0 1.471587695)
(-1.846898465 0 1.400067727)
(-1.920977206 0 1.361306316)
(-1.826374888 0 1.272537563)
(-1.553823764 0 1.073929363)
(-1.071972737 0 0.7213385718)
(-0.6206086502 0 0.1661333837)
(-0.4841644578 0 0.139964631)
(-0.4939856423 0 0.1608797826)
(-0.5436199477 0 0.2447833565)
(-0.5738334073 0 0.3697928375)
(-0.6018821809 0 0.4808649452)
(-0.5691222442 0 0.548055967)
(0.2274929327 0 0.7250819369)
(1.715636225 0 1.722050984)
(1.957370467 0 2.385809442)
(-0.3068819359 0 -0.05360939146)
(-0.6618700287 0 1.664184029)
(-1.82960907 0 1.855495455)
(-1.804210022 0 1.844758816)
(-1.734188849 0 1.713150061)
(-1.944339292 0 1.490507028)
(-2.044051877 0 1.429525473)
(-1.973948028 0 1.368679916)
(-1.737657721 0 1.202127895)
(-1.264366951 0 0.8585592285)
(-0.7077234529 0 0.4228444772)
(-0.4856468249 0 0.07405923271)
(-0.4539835403 0 0.120331426)
(-0.4965207633 0 0.1297363263)
(-0.5604218226 0 0.2498981524)
(-0.6090203068 0 0.4108896114)
(-0.6467126288 0 0.5300715578)
(-0.6465278396 0 0.6140228425)
(0.03525452334 0 0.7639570704)
(0.366657315 0 1.043417098)
(-2.130125711 0 2.123455707)
(-1.990610506 0 2.017587768)
(-2.053613304 0 1.568479581)
(-2.161330613 0 1.466818462)
(-2.102277376 0 1.446802674)
(-1.931783536 0 1.339880641)
(-1.452565868 0 0.9923676189)
(-0.7835719181 0 0.4891393079)
(-0.5094767682 0 0.2659062368)
(-0.4116412214 0 0.08692028601)
(-0.4425667393 0 0.11831055)
(-0.4951945654 0 0.1037588734)
(-0.5216887396 0 0.2430933671)
(-0.5848795416 0 0.4068527809)
(-0.6538621276 0 0.5336928131)
(-0.6698055781 0 0.6072577237)
(-0.6465644736 0 0.651102371)
(0.01049212187 0 0.6405714858)
(-2.232053924 0 1.503382158)
(-2.198473493 0 1.499042445)
(-2.084954056 0 1.449186196)
(-1.748951488 0 1.218679175)
(-0.7859759121 0 0.4751190629)
(-0.5033638983 0 0.2702284834)
(-0.4694147991 0 0.2653600919)
(-0.3805272005 0 0.1252125499)
(-0.4322898321 0 0.1345428924)
(-0.4868199094 0 0.1330988097)
(-0.5039798827 0 0.2214457076)
(-0.5588206497 0 0.3719603928)
(-0.6369461613 0 0.4998779221)
(0.4298257476 0 0.5341129237)
(0.2022944736 0 -0.2000696402)
(-0.5279791856 0 0.2742154865)
(-0.4827257084 0 0.2645110854)
(-0.4652966617 0 0.2695281598)
(-0.4024287811 0 0.1590806822)
(-0.413528577 0 0.146826249)
(-0.4749007549 0 0.156136517)
(-0.5000986543 0 0.2044802622)
(-0.8684083051 0 -0.2464210835)
(-0.6610221029 0 -0.2404273726)
(-0.4054833176 0 -0.428387199)
(-0.2343495314 0 -0.5970638439)
(-0.1170744711 0 -0.6594325594)
(-0.1347218092 0 -0.6398245146)
(-0.1360903202 0 -0.6504575366)
(-0.08932667488 0 -0.6344714862)
(-0.1230649668 0 -0.6309127936)
(-0.04290435246 0 -0.6139619199)
(0.02552375421 0 -0.5798352072)
(-0.01098048389 0 -0.5871896657)
(0.1149426505 0 -0.5392768182)
(0.2306555336 0 -0.502985388)
(0.20052741 0 -0.5430793933)
(0.3797248234 0 -0.4605794744)
(0.5529269811 0 -0.4588041636)
(0.5441659478 0 -0.5746707283)
(0.7215301645 0 -0.2700810768)
(0.0928358553 0 0.1335729884)
(-0.203704529 0 -0.2182624437)
(-0.3126905455 0 -0.5968928485)
(-0.3242657223 0 -1.493815408)
(-0.7748802722 0 -0.4277428097)
(-0.8547742448 0 -0.423895307)
(-0.9433350915 0 -0.4174321935)
(-1.015978635 0 -0.4337326392)
(-1.025803897 0 -0.402768396)
(-0.968762478 0 -0.3822634651)
(-0.9126325444 0 -0.318004116)
(-0.8937808566 0 -0.2699452041)
(2.239239842 0 -1.827103521)
(2.448704701 0 -1.738233554)
(2.447122707 0 -1.791973668)
(2.383685809 0 -1.610126669)
(2.250401813 0 -1.587336239)
(2.418248945 0 -1.690404216)
(1.813552537 0 -1.861839596)
(1.919876625 0 -2.110355513)
(-0.494829405 0 -0.3226588178)
(-0.5943168681 0 -0.3878128976)
(-0.6980640066 0 -0.4417426298)
(-0.6664241332 0 -0.4109664264)
(0.6484863591 0 -1.310354764)
(0.9487260649 0 -1.497625884)
(0.9781478479 0 -2.046635644)
(-0.3195051481 0 0.4060869675)
(-0.3729420912 0 -0.2978658624)
(-0.3956754412 0 -0.2968373371)
(-0.3923009415 0 -0.278386167)
(-0.4637297897 0 -0.3475999994)
(-0.5562800921 0 -0.4236161673)
(-0.5100414933 0 -0.3498380128)
(0.1572324079 0 0.3709360629)
(0.2305112576 0 0.3401907013)
(0.02812140883 0 0.2359091363)
(0.1077228222 0 0.4295451488)
(-0.3350517868 0 0.4426520519)
(-0.3488063973 0 -0.3370030572)
(-0.3583818649 0 -0.3274568297)
(-0.3606203796 0 -0.3180134914)
(-0.8875834667 0 0.2915672921)
(-0.8831362723 0 0.1992105393)
(-0.3266322264 0 -0.3734415822)
(-0.3284624365 0 -0.3633712084)
(-0.3358819051 0 -0.3551261917)
(-0.6730613807 0 0.1409219157)
(-0.6015833005 0 0.173985684)
(-0.3086092512 0 -0.3853701938)
(-0.3144797812 0 -0.3842229768)
(-0.366825348 0 -0.4784680883)
(-0.3385468521 0 -0.3939344777)
(-0.500135767 0 0.1017190799)
(-0.4770651608 0 0.1451431654)
(-0.5436227751 0 0.1595507624)
(-0.4193043223 0 0.1687139999)
(-0.2903964331 0 -0.3985705339)
(-0.2912464803 0 -0.3892435683)
(-0.2966286496 0 -0.3873726976)
(-0.3176754358 0 0.253063243)
(-0.1900038442 0 0.3328574313)
(-0.1517096744 0 0.1877463744)
(-0.2631547648 0 -0.397894941)
(-0.2795054652 0 -0.3996095777)
(3.796309838 0 -1.210275912)
(-0.2679866555 0 -0.3737680642)
(-0.2565612139 0 -0.3633396572)
(-0.2514152227 0 -0.3822846233)
(3.014673992 0 -4.178328479)
(3.07410724 0 -4.299561422)
(3.137519644 0 -4.374363743)
(-0.3022678588 0 -0.3128839639)
(-0.3041129444 0 -0.3245667661)
(-0.3400141646 0 -0.3477175517)
(-0.2933873859 0 -0.3508241773)
(3.08754801 0 -4.059824929)
(3.161419565 0 -4.050637015)
(3.096356333 0 -4.199139716)
(-0.09804839579 0 1.221432097)
(-0.3024411701 0 -0.2788315583)
(-0.3050182915 0 -0.2953916906)
(-0.2005059787 0 0.07348614504)
(-0.2492156606 0 -0.2264626431)
(-0.2986364098 0 -0.2644502908)
(-0.2996499384 0 -0.262090502)
(0.1395005883 0 -0.6832801164)
(0.1901771242 0 -0.6504599198)
(-0.2496366294 0 -0.2170236251)
(-0.2815657159 0 -0.2675515662)
(-0.2976137447 0 -0.2711463588)
(0.5732197964 0 -0.412613943)
(0.6197890523 0 -0.4623580622)
(0.458694237 0 -0.465207179)
(-0.2169028862 0 -0.1711376594)
(-0.2200720905 0 -0.2190298386)
(-0.2506309427 0 -0.2536914067)
(-0.3633730293 0 0.1240439654)
(0.4770396772 0 -0.3344330875)
(0.6858898798 0 -0.5154062499)
(-0.2061101093 0 -0.07542961341)
(-0.1818956472 0 -0.0768126301)
(-0.1838080621 0 -0.1591287988)
(-0.2958211833 0 0.1397619263)
(-0.2856970267 0 0.1483376666)
(-0.2908916497 0 0.1408113392)
(-0.1899640836 0 0.008389735641)
(-0.1975167903 0 0.0725364959)
(-0.2042731733 0 0.005025732303)
(-0.2549529142 0 0.1316523312)
(-0.2422428837 0 0.1417571357)
(-0.2573643923 0 0.1413275462)
(-0.1568816075 0 0.1661854132)
(-0.1960226251 0 0.1235584124)
(-0.2310005019 0 0.1680865574)
(-0.2337166533 0 0.1493715186)
(-0.0691162285 0 0.3180023086)
(-0.09831822085 0 0.2246830815)
(-0.1961171535 0 0.2251659903)
(-0.01091932828 0 0.3763468265)
(0.05689644241 0 0.31240132)
(0.04780985829 0 0.314051794)
(-0.01256692676 0 0.3587098746)
(0.03167266079 0 0.3035563806)
(0.08377149058 0 0.3245198695)
(-0.1149042107 0 0.2892427221)
(0.1140010061 0 0.1195412919)
(0.08454107395 0 0.2386421813)
(0.1184012642 0 0.2822626913)
(-0.02017391457 0 0.120003106)
(0.08100455401 0 0.1438729279)
(0.09352381896 0 0.2385571163)
(0.2310198337 0 0.5750260617)
(0.07368498238 0 0.4263674263)
(-0.04779371401 0 0.07127870927)
(0.1972600275 0 -0.903329109)
(-3.834662416 0 3.99089381)
(-3.768099288 0 3.898931695)
(-1.055392703 0 -1.165832975)
(-0.8209341945 0 0.5180130088)
(-0.6187343845 0 0.4110897349)
(-3.802158178 0 4.078229703)
(-3.405520993 0 1.608880971)
(-3.315016508 0 1.576227418)
(-3.513341939 0 3.35974945)
(0.06079931613 0 0.8775963258)
(0.4210089851 0 0.8222812795)
(-1.029556974 0 -1.201815383)
(-0.1144673578 0 -0.6868122968)
(-3.390107697 0 1.608672086)
(1.269386809 0 2.181571832)
(0.09009733739 0 1.21694535)
(0.01104948459 0 -0.1626800207)
(-1.381659748 0 1.239437202)
(1.66453426 0 1.969477283)
(1.847328917 0 2.40188712)
(-0.7071595589 0 1.878120898)
(-0.7151308628 0 1.760599305)
(-0.6926736373 0 1.765161471)
(-1.942586081 0 1.921062412)
(-1.708967956 0 1.804047576)
(-0.6004739135 0 0.6629515058)
(-0.5378348037 0 0.675085417)
(0.368933772 0 0.9721254331)
(-0.4836351154 0 0.6389745022)
(0.30708702 0 1.085777086)
(-2.215268381 0 2.097233851)
(0.6612403079 0 0.419908835)
(-0.2705983087 0 -0.1509808991)
(-2.0661558 0 2.083286916)
(-0.6726349366 0 0.5970512808)
(-0.6683687952 0 0.6163421404)
(-0.6649418706 0 0.6349036173)
(-0.1328911053 0 0.1875482601)
(-2.234325668 0 1.52537743)
(-2.218842916 0 1.511116553)
(-2.212635969 0 1.4982208)
(-2.196642806 0 1.508977053)
(-2.140027332 0 1.494357848)
(-2.153997884 0 1.490134027)
(-0.5017987148 0 0.2149297973)
(-0.5210040938 0 0.2804822632)
(-0.5271613033 0 0.2992711642)
(-0.5510587129 0 0.3538956106)
(-0.5983902119 0 0.4292482377)
(-0.6097452537 0 0.4496187881)
(-0.6617496773 0 0.5449890257)
(0.5691959837 0 1.278495023)
(0.1903640913 0 0.4923221655)
(-0.5602800528 0 0.2712794553)
(-0.5573866442 0 0.2548852814)
(-0.5328109744 0 0.2866561551)
(-0.5042404126 0 0.2766017433)
(-0.501970583 0 0.2717589226)
(-0.4841163073 0 0.2655999202)
(-0.4715316686 0 0.2604757117)
(-0.4710435194 0 0.2609581311)
(-0.464918781 0 0.2681660888)
(-0.4628649135 0 0.2487759992)
(-0.4622913516 0 0.2450666698)
(-0.4110877508 0 0.1622627932)
(-0.3700962137 0 0.1287167924)
(-0.3701354029 0 0.125395135)
(-0.4131120634 0 0.1567294024)
(-0.4497942876 0 0.152754728)
(-0.4778731982 0 0.1422076785)
(-0.6900689262 0 -0.2746166481)
(-0.3532747258 0 -0.4214339359)
(-0.4100827678 0 -0.4306434796)
(-0.2152251031 0 -0.5702810529)
(-0.1295846499 0 -0.670825224)
(-0.1830725624 0 -0.6756180379)
(-0.07877548806 0 -0.7002730511)
(-0.04981657219 0 -0.6874019997)
(-0.09866483634 0 -0.6567318769)
(-0.01250418357 0 -0.6824329933)
(0.03779194575 0 -0.6744206199)
(0.01291049736 0 -0.6040851071)
(0.1274936119 0 -0.6573864447)
(0.2892182824 0 -0.6419192198)
(0.2447819296 0 -0.5152691335)
(0.5555853504 0 -0.6590177582)
(0.9762960978 0 -0.8263871009)
(0.6371979125 0 -0.4954346705)
(1.540996475 0 -1.232760705)
(1.962215968 0 -1.709320772)
(1.71007582 0 -1.625888219)
(2.064799917 0 -1.792215478)
(2.130679845 0 -1.818633765)
(1.874628399 0 -1.870866319)
(-0.798877114 0 -0.4683147198)
(-0.8961345788 0 -0.4956789245)
(-0.8814750455 0 -0.4569257416)
(-0.9600946729 0 -0.5088472518)
(-0.9457747526 0 -0.4721366279)
(-0.9872240326 0 -0.4575396746)
(-1.017948274 0 -0.4578197469)
(-1.129564707 0 -0.4449942913)
(-1.001766324 0 -0.3734861155)
(-0.9258557924 0 -0.3934953045)
(-0.2667319833 0 -0.503182512)
(-0.2999560675 0 -0.4545381975)
(-0.01191482307 0 -0.6428871736)
(0.06434223164 0 -0.74101068)
(-0.05593865242 0 -0.6873440959)
(0.1131880089 0 -0.7907596587)
(0.1404114911 0 -0.7965836038)
(0.02436192849 0 -0.7305225042)
(0.1761982383 0 -0.7956031117)
(0.242240915 0 -0.8013281896)
(0.1161874799 0 -0.7477427254)
(0.3608349916 0 -0.8153352602)
(0.5864959517 0 -0.8668983181)
(0.4236024592 0 -0.7801671048)
(0.9848156862 0 -1.005636736)
(1.531711299 0 -1.278430512)
(1.343903761 0 -1.143349107)
(1.957842269 0 -1.56203891)
(2.12392561 0 -1.696401514)
(2.063676215 0 -1.712587514)
(2.178065616 0 -1.716410077)
(2.225242359 0 -1.702502026)
(2.196690014 0 -1.766598872)
(2.276645342 0 -1.656484364)
(2.302010039 0 -1.555379463)
(2.377622743 0 -1.657879433)
(2.170793456 0 -1.432876601)
(1.930905026 0 -1.346190949)
(2.08978224 0 -1.493194025)
(1.505548774 0 -1.415323876)
(1.389867865 0 -1.468714564)
(1.697976242 0 -1.772944112)
(-0.6512147568 0 -0.4904036946)
(-0.7363336059 0 -0.5343473569)
(-0.7153905659 0 -0.4810271738)
(-0.8164609556 0 -0.5673299362)
(-0.8699634238 0 -0.5812622145)
(-0.8927715552 0 -0.5398680809)
(-0.8659702137 0 -0.5465139651)
(-0.9350994742 0 -0.535667798)
(-0.9282479686 0 -0.4963408585)
(-1.153536002 0 -0.5814511148)
(-1.387063169 0 -0.5954500795)
(-1.265995686 0 -0.5211322849)
(-1.165825665 0 -0.5339735208)
(-0.2646464053 0 -0.596300779)
(-0.265495107 0 -0.5422084882)
(0.1608955118 0 -0.7009823645)
(0.2520735433 0 -0.7845906184)
(0.1680380182 0 -0.7568623058)
(0.3072982534 0 -0.8288393382)
(0.35687981 0 -0.8429421011)
(0.2727475227 0 -0.833750663)
(0.4076189315 0 -0.8551860871)
(0.4611623315 0 -0.8869135252)
(0.3969530623 0 -0.8435314883)
(0.5318436022 0 -0.9331324653)
(0.6803250932 0 -0.9868320999)
(0.6992081452 0 -0.9208231172)
(0.9536999849 0 -1.056431486)
(1.354106293 0 -1.183395167)
(1.523458306 0 -1.264332409)
(1.781012746 0 -1.382645783)
(2.068789028 0 -1.546677974)
(2.147371854 0 -1.654440005)
(2.196336136 0 -1.595693639)
(2.240633329 0 -1.557967815)
(2.241822131 0 -1.632815974)
(2.236479041 0 -1.465780864)
(2.168604074 0 -1.326400472)
(2.231058674 0 -1.440339128)
(1.97441168 0 -1.159911806)
(1.645004966 0 -0.9888963349)
(1.7791233 0 -1.169167899)
(1.138044659 0 -0.8812504961)
(0.8813948497 0 -0.8065548884)
(1.101678066 0 -1.134052582)
(0.3085793052 0 -0.3698832157)
(0.369149659 0 -0.4032365663)
(0.462393871 0 -0.832950841)
(-0.3992530278 0 -0.3554767691)
(-0.475633538 0 -0.4346352796)
(-0.427212271 0 -0.3477545665)
(-0.5646110417 0 -0.5308747023)
(-0.6410661734 0 -0.6053328805)
(-0.6019326784 0 -0.5063923055)
(-0.7068412293 0 -0.6577527035)
(-0.7638890316 0 -0.6945470082)
(-0.752741643 0 -0.6045049624)
(-0.7926983062 0 -0.6989703959)
(-0.7816358408 0 -0.6538402456)
(-0.8292370249 0 -0.6171192073)
(-0.8217486561 0 -0.6260978616)
(-0.9862460695 0 -0.6613272071)
(-0.9570471718 0 -0.590236075)
(-1.29318815 0 -0.7452189984)
(-1.599670471 0 -0.7599366688)
(-1.493976094 0 -0.6714070967)
(-1.282348032 0 -0.6631130168)
(-0.238737326 0 -0.6660211249)
(-0.2716636793 0 -0.6189494766)
(0.1685518532 0 -0.7105621165)
(0.2578527215 0 -0.7910300594)
(0.3567624643 0 -0.8068579841)
(0.329391771 0 -0.877924081)
(0.4201251769 0 -0.9525785364)
(0.477572328 0 -0.8919651295)
(0.5172808576 0 -0.996885147)
(0.624406783 0 -1.019074484)
(0.5296589632 0 -0.9811692882)
(0.689382167 0 -1.059012815)
(0.8073290917 0 -1.0782654)
(0.7091963828 0 -1.047127934)
(0.9542316437 0 -1.063854461)
(1.170645393 0 -1.065851981)
(1.203920563 0 -1.105194323)
(1.428362981 0 -1.094284007)
(1.671034078 0 -1.155708424)
(1.863943281 0 -1.346054953)
(1.885017889 0 -1.22526314)
(2.04062978 0 -1.259574197)
(2.183717081 0 -1.447031283)
(2.097286496 0 -1.223654096)
(2.031220203 0 -1.102894931)
(2.109100878 0 -1.219747542)
(1.814550594 0 -0.9164393943)
(1.374361228 0 -0.6946745055)
(1.53295793 0 -0.8278436984)
(-0.9953284956 0 -0.3595717074)
(0.5932464305 0 -0.2751011675)
(0.7151306866 0 -0.5029124385)
(0.1635669345 0 0.1444951432)
(0.3509111929 0 0.1366967794)
(0.3748351705 0 -0.1436475125)
(0.3363324285 0 0.4372355209)
(-0.1768331008 0 0.378666679)
(0.2095432116 0 0.4496081678)
(-0.5824844104 0 0.3411595187)
(-0.7319017774 0 0.368539056)
(-0.6055981947 0 0.4646762531)
(-0.3588126103 0 -0.3870300399)
(-0.4238820558 0 -0.4783347739)
(-0.3776722413 0 -0.3702186169)
(-0.5143568111 0 -0.616299586)
(-0.5939693885 0 -0.7370551577)
(-0.5348157264 0 -0.565683114)
(-0.6559050298 0 -0.8243315271)
(-0.7063080727 0 -0.8850528333)
(-0.6755081362 0 -0.7304648037)
(-0.7389916584 0 -0.9145120344)
(-0.7365397758 0 -0.8927957633)
(-0.7616856865 0 -0.7975095769)
(-0.7174954038 0 -0.8373015653)
(-0.74118597 0 -0.8092954609)
(-0.7502167923 0 -0.7134059951)
(-0.8300273609 0 -0.8165481234)
(-1.018689692 0 -0.857713688)
(-1.010809184 0 -0.749444804)
(-1.367088101 0 -0.9468972875)
(-1.882201729 0 -1.038869356)
(-1.716554607 0 -0.8752399419)
(-2.229108893 0 -0.9398372819)
(-2.279005594 0 -0.7345860272)
(0.03921690543 0 -0.8845115078)
(-0.7121185079 0 -0.6563527993)
(0.07868284874 0 -0.8398972429)
(0.4473369472 0 -0.9651728826)
(0.3029136124 0 -0.9813696924)
(0.3769751239 0 -1.051085575)
(0.3606214856 0 -0.9022145774)
(0.6252452358 0 -0.9074481374)
(0.547411761 0 -0.6767566889)
(0.5091767198 0 -1.033321443)
(0.1646047424 0 -0.7886230693)
(0.5743597486 0 -1.032208752)
(0.9798863142 0 -1.084345778)
(0.7531784584 0 -1.086686075)
(1.087431291 0 -1.076225714)
(1.243637364 0 -1.036692267)
(1.384385338 0 -1.027355033)
(1.500965459 0 -0.9649487227)
(1.56646917 0 -1.043075112)
(1.602222611 0 -0.892551328)
(1.707660812 0 -0.8269300088)
(1.856926134 0 -1.03280821)
(1.785701598 0 -0.7846074811)
(1.778215882 0 -0.7199620819)
(1.911363052 0 -0.9393372245)
(1.624216555 0 -0.6035166731)
(1.312948944 0 -0.623860619)
(1.207652808 0 -2.034740662)
(2.191722231 0 0.0253999703)
(0.5990027839 0 0.1384622706)
(0.4412019596 0 1.663735518)
(0.5112596044 0 0.3432328553)
(0.5423108228 0 0.4327398782)
(0.424138637 0 0.4005575723)
(-0.2874617302 0 0.2521238066)
(-0.5554571945 0 0.2617562463)
(-0.5157791372 0 0.2327268361)
(-0.6982158647 0 0.2963650869)
(-0.7968524775 0 0.1495903684)
(-0.7941458959 0 0.2980192182)
(-0.8047426242 0 0.09662541256)
(-0.7344700512 0 0.1074918215)
(-0.8413950766 0 0.1386211065)
(-0.4688654131 0 -0.6833239309)
(-0.564651831 0 -0.8800304345)
(-0.4980024645 0 -0.6697441082)
(-0.6320741911 0 -1.023104461)
(-0.6779569839 0 -1.117602982)
(-0.6450328916 0 -0.9335889289)
(-0.7030966953 0 -1.161693006)
(-0.7008677693 0 -1.145819045)
(-0.7212847083 0 -1.042840836)
(-0.6805552022 0 -1.08820605)
(-0.6764088364 0 -1.044487025)
(-0.700008283 0 -0.9698443392)
(-0.7056664912 0 -1.037973274)
(-0.7695041719 0 -1.060716619)
(-0.748685247 0 -0.9321004222)
(-0.8755235201 0 -1.107290026)
(-1.039510663 0 -1.167451939)
(-1.017010898 0 -0.9984543508)
(-1.309696951 0 -1.223672107)
(-2.011370558 0 -1.401978554)
(-1.975823865 0 -1.208690213)
(-2.427058011 0 -1.231754848)
(-2.419365463 0 -0.8179174583)
(-2.390430126 0 -0.7928147752)
(-1.105153338 0 -0.3673968906)
(-2.108553179 0 -0.6383376987)
(-2.010033779 0 -0.5186539291)
(-1.329788883 0 0.1141837667)
(-1.280723861 0 0.208270953)
(-0.8414756873 0 0.2207963075)
(-2.259092774 0 1.130390406)
(-2.209664464 0 1.634830376)
(0.4892604946 0 -1.477609941)
(-1.240880174 0 1.818163456)
(-1.328599914 0 1.976509176)
(1.082066581 0 -0.7717617159)
(0.7054255575 0 -0.1326361792)
(1.010866008 0 -0.5601741385)
(1.2890756 0 -0.6017750809)
(1.202123895 0 -0.907297875)
(1.36856135 0 -0.675056808)
(1.445546591 0 -0.8946669981)
(1.412337842 0 -0.7262606567)
(1.51695201 0 -0.5797694895)
(1.61272369 0 -0.6735821725)
(1.584208949 0 -0.455487688)
(1.597233372 0 -0.334645478)
(1.671914358 0 -0.5077620736)
(1.488306032 0 -0.1979773289)
(1.268498407 0 0.009555662806)
(1.280242389 0 -0.1997616573)
(0.8850332641 0 0.1417138019)
(0.7630113583 0 0.2908954243)
(0.7044923164 0 0.1555360887)
(0.6169019468 0 0.3237040556)
(-0.468437047 0 0.2075986859)
(0.3328702724 0 0.2883276546)
(-0.6455245651 0 0.1830720233)
(-0.7310780195 0 0.08546099444)
(-0.6546723492 0 0.2963108153)
(-0.722943007 0 -0.04708934176)
(-0.6386770808 0 -0.03852730276)
(-0.752400411 0 0.00671759306)
(-0.5771601956 0 0.03181110606)
(-0.5209535675 0 0.05367254345)
(-0.632854375 0 0.08734341201)
(-0.33126322 0 -0.4774599348)
(-0.4317963525 0 -0.701730758)
(-0.4123272342 0 -0.6172362897)
(-0.5273160747 0 -0.91819923)
(-0.5937143062 0 -1.074655657)
(-0.5983076913 0 -1.03163522)
(-0.6326891282 0 -1.176451948)
(-0.640875871 0 -1.218092714)
(-0.6768844856 0 -1.224775369)
(-0.6221028078 0 -1.200392984)
(-0.6033897629 0 -1.16589022)
(-0.6528853399 0 -1.17498664)
(-0.6111462724 0 -1.16060715)
(-0.6487368338 0 -1.187888036)
(-0.6632523157 0 -1.118940672)
(-0.7139309834 0 -1.237396425)
(-0.8087157882 0 -1.302082279)
(-0.7943726283 0 -1.182796836)
(-0.938035123 0 -1.373949133)
(-1.108970862 0 -1.439543595)
(-1.084692234 0 -1.319435037)
(-1.339960474 0 -1.489771351)
(-1.714278583 0 -1.751002835)
(-1.948324316 0 -1.607881376)
(-2.291393599 0 -1.7197939)
(-2.513284003 0 -0.9430017553)
(-2.493794323 0 -0.8439903723)
(-1.336027136 0 0.0880772739)
(-0.8597841051 0 -0.3324695165)
(-1.836478957 0 -0.684727375)
(-0.8160325274 0 0.1763538636)
(-0.6443344636 0 0.202934964)
(-1.519673064 0 0.2598348081)
(-0.6929518027 0 0.8941685132)
(-0.5486919546 0 0.5180025979)
(-1.701138716 0 1.533057447)
(-0.4856975085 0 0.3194925514)
(-0.5346548552 0 0.3492970598)
(-1.644171317 0 1.582959892)
(-0.6313238224 0 0.4526964053)
(-0.7743476205 0 0.6318569831)
(-1.380298533 0 1.221939735)
(1.041075389 0 -0.6128020189)
(1.224308679 0 -0.7454470305)
(1.342609341 0 -0.675501047)
(1.323944909 0 -0.7526687512)
(1.289351141 0 -0.5192987649)
(1.326892942 0 -0.4915069559)
(1.280818478 0 -0.3430325355)
(1.289096631 0 -0.1121587094)
(1.436127812 0 -0.1969655474)
(1.175810401 0 0.06029703705)
(0.9978808294 0 0.3345882229)
(1.009558453 0 0.1197090971)
(0.750074829 0 0.6353310409)
(0.2960589394 0 0.8293945568)
(0.6850909552 0 0.3728387044)
(-0.7203048222 0 0.3425631302)
(-0.8472556362 0 -0.2103801587)
(-0.7576255732 0 0.0447272636)
(-0.6747659475 0 -0.1057191548)
(-0.5499175176 0 -0.1038589984)
(-0.6937707518 0 -0.05797617348)
(-0.4429068442 0 -0.1210156383)
(-0.3751367575 0 -0.1052187826)
(-0.5028328808 0 -0.0630993113)
(-0.3385306396 0 -0.05309808701)
(-0.2930361573 0 -0.04225024019)
(-0.4029370642 0 0.005589202473)
(-0.3115347575 0 0.09594774827)
(-0.3066780074 0 0.1467242769)
(-0.3530855499 0 0.1300734874)
(-0.254684003 0 -0.3757894012)
(-0.2503031777 0 -0.3640166199)
(-0.2734296172 0 -0.3815520705)
(-0.2744264631 0 -0.402629502)
(-0.3520405816 0 -0.5508952568)
(-0.4081209322 0 -0.674594568)
(-0.4371272538 0 -0.7164955639)
(-0.4997768443 0 -0.8390384631)
(-0.5569303531 0 -1.000188323)
(-0.5346071734 0 -0.9183134118)
(-0.5394251134 0 -0.9587512778)
(-0.5898313863 0 -1.118759681)
(-0.5261042925 0 -0.9803387418)
(-0.5208507513 0 -1.023292345)
(-0.5592453587 0 -1.123757207)
(-0.5417445444 0 -1.112993523)
(-0.5930348529 0 -1.244224209)
(-0.6261800468 0 -1.241468723)
(-0.6717676628 0 -1.392200456)
(-0.7700272047 0 -1.522282491)
(-0.8029186259 0 -1.421187836)
(-0.8803119368 0 -1.601871145)
(-0.9964416331 0 -1.589049525)
(-1.082633912 0 -1.531201207)
(-1.068818479 0 -1.347572501)
(-0.5689834554 0 -0.1444670288)
(-1.142804504 0 -1.371371128)
(-0.4186405328 0 -0.2325168191)
(-0.7406928862 0 -0.7937445917)
(-2.017153296 0 -1.089898263)
(-0.4770538423 0 0.05928716312)
(-1.043555524 0 0.1938719789)
(-0.7861481629 0 0.1180964378)
(-1.086802564 0 0.3302334465)
(-0.7552603264 0 0.341009033)
(-0.6910597025 0 0.2619578352)
(-0.6031485217 0 0.3421783163)
(-0.5414440251 0 0.3417664243)
(-0.5119273507 0 0.302007418)
(-0.5272478645 0 0.3509551898)
(-0.6673095259 0 0.4526825342)
(-0.5721004141 0 0.3816433918)
(-0.899466021 0 0.7273532813)
(-1.007520846 0 0.9624500785)
(-0.8050658693 0 0.6905020027)
(-1.010478325 0 1.109094953)
(-0.991894415 0 1.199230887)
(0.5283345045 0 -0.1849734086)
(-0.8254596212 0 1.13970858)
(0.3826329771 0 0.1901665747)
(1.18001811 0 -0.4868262877)
(0.6674792933 0 0.06888275183)
(0.5836617552 0 0.4505341911)
(1.255182288 0 -0.001969161034)
(-0.6615257006 0 1.216512871)
(-1.127870012 0 1.452386712)
(0.6064900868 0 0.7647487914)
(-1.062765779 0 1.3321958)
(-1.070857075 0 0.189139203)
(-0.8152083855 0 0.8117026137)
(-0.7963347738 0 -0.4600325701)
(-0.4217701734 0 -0.2587175356)
(-0.6776616466 0 -0.2839894013)
(-0.2920462441 0 -0.214523775)
(-0.1843781403 0 -0.1531336878)
(-0.3639874248 0 -0.1570334719)
(-0.07646137357 0 -0.1187456747)
(0.001869179176 0 -0.105737805)
(-0.1308888785 0 -0.1703367835)
(0.09704847859 0 -0.04117765187)
(0.078499911 0 0.02925260795)
(0.02357334179 0 -0.138135753)
(0.2395890892 0 0.1344084311)
(1.23715515 0 -0.1679079366)
(0.5481417933 0 0.008410794021)
(2.724460885 0 -0.6982176874)
(3.517805929 0 -1.077721866)
(3.685363719 0 -1.20515777)
(-0.2585189074 0 -0.354899603)
(-0.2820317617 0 -0.3458596868)
(-0.2401537933 0 -0.348334531)
(-0.3121156554 0 -0.3465081662)
(-0.3354943493 0 -0.3706014216)
(-0.3087633364 0 -0.4219328122)
(-0.3602507535 0 -0.43973121)
(-0.3967269157 0 -0.5337940319)
(-0.4389001304 0 -0.6558440888)
(-0.4329789688 0 -0.6058545673)
(-0.4538897643 0 -0.6389690675)
(-0.4942088474 0 -0.7753904654)
(-0.463626451 0 -0.6511489774)
(-0.476612806 0 -0.6613666989)
(-0.4927048663 0 -0.8481706075)
(-0.4997104819 0 -0.6818173988)
(-0.5341376217 0 -0.7148390029)
(-0.5544334207 0 -1.103121811)
(-0.5704572348 0 -0.7498546172)
(-0.5744320357 0 -0.7643771478)
(-0.697734177 0 -1.493470304)
(-0.4680665652 0 -0.7695462321)
(-0.2293010886 0 -0.8530547648)
(-0.8030573765 0 -1.559178199)
(-0.08800194637 0 -0.9875470361)
(-0.3265549805 0 -0.03467041847)
(-0.7314349335 0 -0.2224687336)
(-0.3257116858 0 0.02058244248)
(-0.6126245085 0 0.01571250517)
(-0.3601945127 0 0.04523903088)
(-1.768731595 0 0.2098746867)
(-2.560963607 0 0.6594230649)
(-1.715643587 0 0.3692781697)
(-1.264715605 0 0.5783268818)
(-0.8105012883 0 0.4745210507)
(-0.794996046 0 0.4177526727)
(-0.6697015824 0 0.4290797157)
(-0.6007075064 0 0.4050119533)
(-0.5718447479 0 0.375470245)
(-0.6042845957 0 0.4208184743)
(-1.075484492 0 0.7399170892)
(-0.834373958 0 0.5698310378)
(-1.782532531 0 1.82436236)
(-1.451989326 0 1.929270586)
(-1.274828347 0 1.399954909)
(-1.172370987 0 1.954934115)
(-1.026260698 0 2.031804553)
(-1.006969305 0 1.528405978)
(-0.9334151411 0 2.074497734)
(-0.8702038791 0 1.952254682)
(-0.8625017075 0 1.488328435)
(-0.868628091 0 1.662808972)
(-0.9299759545 0 1.393637681)
(-1.004493204 0 1.359578135)
(-0.9848734658 0 1.330470804)
(-0.9100223656 0 1.355341096)
(-1.053995611 0 1.47524137)
(-0.8282784293 0 0.1060510803)
(-0.6021669499 0 -0.7014275095)
(-0.9365395325 0 -0.3363279976)
(-0.0847860532 0 -0.5947150592)
(0.2668051735 0 -0.8872887986)
(-0.2098754774 0 -0.3219903027)
(0.8237479532 0 -1.492663493)
(1.460996393 0 -2.251282227)
(0.5481198773 0 -1.022420105)
(2.008278124 0 -2.92369915)
(2.302751923 0 -3.283623874)
(1.965022159 0 -2.683321854)
(2.448988599 0 -3.467087218)
(2.548005921 0 -3.590925831)
(2.491422871 0 -3.292147956)
(2.638513716 0 -3.70032895)
(2.73294464 0 -3.8105354)
(2.705100949 0 -3.504845811)
(2.832172626 0 -3.925232301)
(2.930256831 0 -4.048661651)
(2.939242265 0 -3.818199341)
(-0.3847031682 0 -0.3678115713)
(-0.4298952174 0 -0.3771939466)
(-0.3638147622 0 -0.3604807743)
(-0.4605255669 0 -0.3682384271)
(-0.4621108102 0 -0.34386621)
(-0.4004391117 0 -0.3512188581)
(-0.4228944409 0 -0.3251511479)
(-0.3655223075 0 -0.3513725279)
(-0.374352724 0 -0.4530045673)
(-0.3442651975 0 -0.4232204497)
(-0.3607618801 0 -0.4842580968)
(-0.4129306167 0 -0.5828051446)
(-0.3809271074 0 -0.5448293952)
(-0.4133200027 0 -0.5995335227)
(-0.4573406172 0 -0.6520493258)
(-0.454092594 0 -0.6537287138)
(-0.5096628783 0 -0.7267112713)
(-0.5441998227 0 -0.7502145516)
(-0.5916142095 0 -0.8309954556)
(-0.7022303863 0 -0.9624113296)
(-0.6904892742 0 -0.9034194163)
(-0.8268699472 0 -1.096134812)
(-0.9513288076 0 -1.196232584)
(-0.8761004969 0 -1.040102716)
(-0.5076967643 0 -0.1717334847)
(-0.5377162178 0 -0.1878159852)
(-0.3987821807 0 -0.07765494819)
(-0.5501379521 0 -0.07354756866)
(-1.740078533 0 -0.01758581521)
(-1.18496293 0 -0.01149341838)
(-4.460977686 0 0.7784920116)
(-3.604347693 0 1.524092034)
(-3.258587347 0 1.03984479)
(-1.118788413 0 0.6568407201)
(-0.8401225476 0 0.5371157175)
(-0.8198143732 0 0.5097826093)
(-0.7327383483 0 0.4916904499)
(-0.6703506379 0 0.4691654249)
(-0.6322929543 0 0.4347174561)
(-0.6925321329 0 0.498020026)
(-1.620435633 0 1.181383335)
(-1.360548613 0 0.9535237145)
(-2.24387065 0 2.815990884)
(-1.454514831 0 2.991138651)
(-1.501956461 0 2.550880074)
(-1.099962332 0 2.89470236)
(-0.9287291708 0 2.980439011)
(-1.027231318 0 2.573481368)
(-0.860278103 0 3.152347673)
(-0.8364590113 0 2.957137448)
(-0.8932515328 0 2.504317683)
(-0.8589684228 0 2.361519033)
(-0.9164214531 0 1.728061498)
(-0.928295249 0 1.531721804)
(-0.9337806464 0 1.429421225)
(-0.6859626825 0 0.1748159199)
(-0.8108082845 0 1.002311496)
(-0.3471435976 0 -1.061330526)
(0.2836784418 0 -1.130422556)
(-0.1358844582 0 -0.9334644161)
(0.6822115813 0 -1.450166209)
(1.243444479 0 -2.098386377)
(0.8248106136 0 -1.590064229)
(1.79928716 0 -2.784518774)
(2.148803823 0 -3.237983065)
(1.940804979 0 -2.940905867)
(2.329869543 0 -3.452666918)
(2.444326387 0 -3.575939399)
(2.39051378 0 -3.495924485)
(2.540747373 0 -3.671358333)
(2.634670461 0 -3.755889783)
(2.587468673 0 -3.725403936)
(2.730185286 0 -3.833568293)
(2.82704538 0 -3.904514917)
(2.775721929 0 -3.918263367)
(2.922300081 0 -3.967399685)
(3.010929795 0 -4.019911482)
(2.965164854 0 -4.100338835)
(-0.3468303241 0 -0.308313131)
(-0.3923580561 0 -0.3467256882)
(-0.3763420155 0 -0.3484660855)
(-0.4346324815 0 -0.3723403908)
(-0.475634161 0 -0.3918271101)
(-0.4658501738 0 -0.3874619572)
(-0.5164008681 0 -0.3961931429)
(-0.5320371569 0 -0.3636878062)
(-0.5063808057 0 -0.3509231194)
(-0.4880333357 0 -0.3015964589)
(-0.3920666514 0 -0.245325514)
(-0.3778501985 0 -0.2798751994)
(-0.3019279105 0 -0.2217328074)
(-0.2870812778 0 -0.2289706016)
(-0.3143828908 0 -0.3548721409)
(-0.2753450458 0 -0.2475079745)
(-0.3032670289 0 -0.2339694409)
(-0.3449835528 0 -0.4654795054)
(-0.3244295965 0 -0.2256546522)
(-0.334118464 0 -0.2648244647)
(-0.4177135099 0 -0.5665848288)
(-0.3645595018 0 -0.3601566234)
(-0.4560644738 0 -0.5988540437)
(-0.6360150487 0 -0.9049687506)
(-0.6583305505 0 -0.9635382936)
(-0.9353784679 0 -1.330101284)
(-0.9711955481 0 -1.27898326)
(-1.053492488 0 -0.7822780924)
(-1.147416527 0 -0.9513646575)
(-0.7456487148 0 -0.3987793484)
(-0.7498635083 0 -0.2137828427)
(-1.348846317 0 0.09335795462)
(-2.159408872 0 -0.01952530595)
(-1.796260523 0 0.6430554101)
(-0.9021715579 0 0.3833402181)
(-3.215507742 0 1.955719445)
(-1.029628231 0 0.6329462957)
(-0.9141308394 0 0.606067992)
(-0.8724361688 0 0.5682460678)
(-0.8331094453 0 0.5828135745)
(-0.7774760852 0 0.5707694312)
(-0.7175867984 0 0.5126736584)
(-0.9399611711 0 0.6228877741)
(-1.44857873 0 0.7760319977)
(-1.70586683 0 1.296331528)
(-0.8547058188 0 1.329581514)
(-0.3823845192 0 3.884643219)
(-1.23667549 0 3.347117363)
(-0.3013418167 0 3.965918438)
(-0.22161878 0 3.284138957)
(-0.6708716381 0 3.28175129)
(-0.4334022688 0 2.47740066)
(-0.6282591382 0 2.344067662)
(-0.7031825325 0 3.076744706)
(-0.7575764037 0 2.036802578)
(-0.8775894708 0 1.646412893)
(-0.8877259478 0 1.850926506)
(-0.948458435 0 1.284839428)
(-0.1709667456 0 -1.035977107)
(-0.4466460962 0 -0.6259590575)
(0.3093865823 0 -1.436339053)
(0.6845990904 0 -1.478802142)
(0.528393007 0 -1.329491394)
(1.103852054 0 -1.942223042)
(1.62869165 0 -2.525635525)
(1.505201498 0 -2.400952978)
(2.09457634 0 -3.105360727)
(2.331729082 0 -3.406749135)
(2.260163027 0 -3.363443569)
(2.441527802 0 -3.512935231)
(2.52583954 0 -3.574446132)
(2.48936026 0 -3.591887163)
(2.609402405 0 -3.630396714)
(2.69391 0 -3.684187574)
(2.672877704 0 -3.732944282)
(2.776801315 0 -3.734269804)
(2.854685647 0 -3.779974041)
(2.854559311 0 -3.848603161)
(2.923719037 0 -3.821933063)
(2.980173829 0 -3.861179128)
(3.01104174 0 -3.937791266)
(3.022054606 0 -3.89614518)
(3.052669578 0 -3.905438105)
(3.114772484 0 -3.982942504)
(-0.3453324609 0 -0.3060060123)
(-0.3686745754 0 -0.336927904)
(-0.3889231192 0 -0.3432347378)
(-0.3930071147 0 -0.3662884889)
(-0.4343052565 0 -0.4069730637)
(-0.4640760236 0 -0.3958088214)
(-0.4930710585 0 -0.4358523653)
(-0.5277504824 0 -0.3917597069)
(-0.5389874889 0 -0.3772340984)
(-0.5065163614 0 -0.3059734398)
(-0.4109190952 0 -0.2134385571)
(-0.3993332978 0 -0.2273646287)
(-0.3004573074 0 -0.1310340379)
(-0.3439381688 0 0.0008067813312)
(-0.2894317007 0 -0.1359006194)
(-0.4731412385 0 0.1305369292)
(-0.6214527689 0 0.2384783966)
(-0.4103730841 0 0.02510434043)
(-0.6389855192 0 0.2861849831)
(-0.5928496273 0 0.2748055164)
(-0.3977484456 0 0.0324754348)
(-0.4981005099 0 0.2122311883)
(-0.4037307955 0 0.0825829694)
(-0.3382642759 0 -0.2069814447)
(-0.3702818588 0 -0.1909604256)
(-0.4884308321 0 -0.5174065549)
(-0.5106394031 0 -0.9768645508)
(-0.9932026152 0 -1.251514627)
(-1.509312813 0 -1.581770068)
(-1.452581966 0 -1.381623132)
(-1.005755024 0 -0.536635261)
(-1.456427539 0 0.08488799012)
(-1.470870204 0 0.09550230276)
(-1.262804831 0 0.5373792166)
(-0.9247123916 0 0.3280623046)
(-0.8421481985 0 0.3823687548)
(-1.124870318 0 0.7175819521)
(-1.074907999 0 0.7650709105)
(-0.9815395282 0 0.6679259634)
(-1.011671159 0 0.7709053447)
(-0.9489534215 0 0.7645019967)
(-0.8542176401 0 0.6492550199)
(-0.5846980692 0 0.5733968158)
(-0.4446157194 0 0.523789067)
(-0.7035083291 0 0.8204804331)
(-0.519301221 0 0.5744586477)
(0.1978863416 0 1.236894135)
(0.6617912469 0 1.682499135)
(-0.1143324253 0 1.100230209)
(-0.5280847013 0 0.8807241662)
(0.1944078706 0 1.474441893)
(-0.7715652838 0 0.7928627253)
(-0.9121750289 0 0.7850642221)
(-0.7750926633 0 0.8618634394)
(-0.9978161961 0 0.8257321469)
(-1.057013567 0 0.9634671391)
(-1.017058777 0 0.9694678381)
(-1.153339214 0 1.093253663)
(0.3124625064 0 -1.146188425)
(0.06824732873 0 -1.193599194)
(0.5165165003 0 -1.522731158)
(0.8048443124 0 -1.529031429)
(0.7638221008 0 -1.556749182)
(1.147795934 0 -1.939994593)
(1.526590032 0 -2.375700992)
(1.627735196 0 -2.507746563)
(1.963636941 0 -2.886289294)
(2.301272184 0 -3.277585072)
(2.361994363 0 -3.389110755)
(2.467084241 0 -3.435099129)
(2.548325412 0 -3.484343469)
(2.550252683 0 -3.539451704)
(2.609586055 0 -3.513699765)
(2.666302928 0 -3.543722378)
(2.694785784 0 -3.622942191)
(2.716179153 0 -3.572451509)
(2.751143229 0 -3.591997136)
(2.828022557 0 -3.705371107)
(2.755306824 0 -3.585482087)
(2.685262977 0 -3.5024662)
(2.917364955 0 -3.772905476)
(2.387631229 0 -3.164724844)
(1.383404931 0 -2.037428081)
(2.86475702 0 -3.684740589)
(-0.2925733519 0 -0.2938085519)
(-0.2867813989 0 -0.3312152115)
(-0.3337352716 0 -0.3326181927)
(-0.284347087 0 -0.3998369688)
(-0.3261670707 0 -0.4809356562)
(-0.3884233374 0 -0.4333991075)
(-0.3941417407 0 -0.5057675077)
(-0.5044377211 0 -0.4943527691)
(-0.512451431 0 -0.4227631764)
(-0.6150929257 0 -0.4323991098)
(-0.5677339332 0 -0.2510128613)
(-0.4606461984 0 -0.2158307819)
(-0.4685757642 0 0.2268124498)
(-0.7010724372 0 0.3689336161)
(-0.5233778077 0 0.2396305468)
(-0.8472054411 0 0.4191177388)
(-0.922836015 0 0.4898836217)
(-0.8030026534 0 0.3890246859)
(-0.9407982334 0 0.5400201448)
(-0.9188034345 0 0.5613466635)
(-0.7841085811 0 0.450337933)
(-0.8618945716 0 0.5494843065)
(-0.7677798057 0 0.5036447631)
(-0.584986854 0 0.3445673739)
(-0.5987189433 0 0.3539833512)
(-0.4358848214 0 0.06441395949)
(-0.3928649137 0 -0.2215484149)
(-0.3584898175 0 -0.0814018435)
(-1.060594743 0 -1.582245644)
(-1.374291717 0 -1.637849446)
(-0.921507265 0 -0.527656859)
(-0.8060472635 0 -0.03524202029)
(-1.097121065 0 0.02691974956)
(-0.9307179277 0 0.6705991073)
(-0.6392900278 0 0.9413954515)
(-1.018004836 0 0.3012316123)
(-0.5472346999 0 1.155767559)
(-0.6498521719 0 1.133428568)
(-1.155569754 0 0.9008374446)
(-0.6251836287 0 1.49940715)
(-0.4845174066 0 1.361781076)
(-1.033779989 0 0.9464096533)
(-0.508388073 0 0.6461073095)
(-0.5567592784 0 0.6135844038)
(-0.4917507315 0 0.5594778218)
(-0.6155917424 0 0.6496494924)
(-0.6775428665 0 0.6897353626)
(-0.6351705152 0 0.6585124108)
(-0.772266148 0 0.7208841206)
(-0.8629651441 0 0.7477773939)
(-0.7981907319 0 0.7252436564)
(-0.9328920132 0 0.7799719386)
(-0.9887895988 0 0.81398383)
(-0.9597845638 0 0.7899757517)
(-1.033358633 0 0.8534754316)
(-1.067089931 0 0.9115309024)
(-1.060452498 0 0.9294087838)
(-1.123974991 0 1.155532607)
(-0.416632992 0 0.002848244924)
(0.154531207 0 -0.8107568688)
(0.7996864839 0 -1.432337049)
(0.7556247517 0 -1.412107139)
(0.8401058434 0 -1.474015602)
(1.082578417 0 -1.634549024)
(1.271291665 0 -1.905807994)
(1.381308589 0 -2.165549441)
(1.488825918 0 -2.190200941)
(1.773878806 0 -2.560817564)
(2.088682745 0 -3.003084726)
(2.049484934 0 -2.877801791)
(2.245644834 0 -3.069588742)
(2.47315449 0 -3.364471491)
(2.349028323 0 -3.146768681)
(2.38739572 0 -3.154858018)
(2.581859115 0 -3.413034558)
(2.373967286 0 -3.110646102)
(2.293846878 0 -2.990160762)
(2.583815552 0 -3.37439949)
(2.098777757 0 -2.723110053)
(1.69538398 0 -2.172795479)
(2.226347595 0 -2.917441894)
(1.019589903 0 -1.232776139)
(0.5424664948 0 -0.4045894248)
(0.6723609217 0 -0.93230644)
(-0.2135476808 0 -0.2490231001)
(-0.2060600474 0 -0.2882460091)
(-0.2364141923 0 -0.3262251352)
(-0.169378985 0 -0.4213640851)
(-0.1446404343 0 -0.5983172074)
(-0.2434146174 0 -0.547928778)
(-0.2206702395 0 -0.7052053489)
(-0.3777780579 0 -0.7993682477)
(-0.4789450303 0 -0.6185706976)
(-0.5311331418 0 -0.6220945423)
(-0.5319737682 0 0.09872311991)
(-0.6288333388 0 -0.2373563498)
(-0.7017456045 0 0.418441072)
(-0.8737941598 0 0.4885634213)
(-0.8059709785 0 0.4214766535)
(-0.9883803629 0 0.5918750199)
(-1.066336641 0 0.7021984452)
(-1.001103484 0 0.5842976172)
(-1.110212356 0 0.7654333769)
(-1.114168599 0 0.7780765192)
(-1.018515554 0 0.6591425892)
(-1.078524966 0 0.7511569199)
(-0.989716748 0 0.6883460172)
(-0.8892051546 0 0.5925675409)
(-0.8511314398 0 0.6369961557)
(-0.7545841851 0 0.5772739322)
(-0.6037786899 0 0.3565565114)
(-0.6290673638 0 0.4792164505)
(0.2560377328 0 -0.1044206564)
(-0.3904038388 0 -0.8834163616)
(0.644990129 0 -0.3098860555)
(0.6985109336 0 -0.2380160083)
(-0.7965642174 0 -0.05847542385)
(0.7245422999 0 0.2722229163)
(0.5156739837 0 0.338223134)
(0.2863531121 0 1.018242231)
(1.153767698 0 1.14373958)
(1.457291956 0 1.447879204)
(0.889298319 0 3.087478721)
(0.9001991631 0 2.22547106)
(-0.6167041308 0 0.6952494795)
(-0.4965010214 0 0.981765909)
(-0.6844346692 0 0.6790599782)
(-0.7149602486 0 0.6953626812)
(-0.6333930866 0 0.6625068245)
(-0.7526174678 0 0.7369047407)
(-0.8169910549 0 0.7778108709)
(-0.7463438851 0 0.7246997361)
(-0.8955983018 0 0.8095253928)
(-0.9704334023 0 0.8318401967)
(-0.9076747304 0 0.7850470924)
(-1.03442448 0 0.8509321443)
(-1.081742641 0 0.8689275531)
(-1.027687689 0 0.8403785206)
(-1.107022294 0 0.8898059785)
(-1.111302845 0 0.9154462505)
(-1.083067139 0 0.9120725233)
(-1.103984437 0 0.9474646713)
(-1.175722436 0 1.166637904)
(-1.290882564 0 1.151301883)
(-0.7085223929 0 0.4956701644)
(1.100989928 0 -1.330237669)
(0.9090735286 0 -1.368062048)
(1.074857925 0 -1.179962505)
(0.9955017297 0 -1.162253367)
(1.170659997 0 -1.612163597)
(1.186394963 0 -1.426281454)
(1.32900182 0 -1.607703173)
(1.503559643 0 -2.054927802)
(1.449776007 0 -1.800918715)
(1.558721515 0 -1.969052966)
(1.886108442 0 -2.549710264)
(1.634894536 0 -2.070370416)
(1.652590957 0 -2.076408298)
(2.044425366 0 -2.683512971)
(1.596789412 0 -1.974577532)
(1.459663431 0 -1.753653638)
(1.877707699 0 -2.406585104)
(1.236552472 0 -1.398576686)
(0.9391269914 0 -0.9070060994)
(1.237758817 0 -1.461216465)
(0.4338407848 0 -0.3184333344)
(-0.5040456344 0 0.08464668339)
(-0.2361293758 0 0.09042119006)
(-0.1601060241 0 -0.1123771359)
(-0.147354815 0 -0.08760492551)
(-0.1956971368 0 -0.18448696)
(-0.1476722172 0 -0.1200985906)
(-0.009134686437 0 -0.2850504817)
(-0.09636807767 0 -0.516361585)
(0.1614892919 0 -0.4317555954)
(0.2715002257 0 -0.4570469618)
(-0.09734641395 0 -0.9832391014)
(0.07186933574 0 -0.2184668921)
(-0.6167700823 0 0.4376550899)
(-0.5631355775 0 0.3405073343)
(-0.835198331 0 0.6558889054)
(-1.02113945 0 0.8148114661)
(-0.9323779755 0 0.6130531161)
(-1.167207315 0 0.9684061094)
(-1.283512258 0 1.099927242)
(-1.149231441 0 0.8668842785)
(-1.356175764 0 1.169212573)
(-1.367650946 0 1.155060949)
(-1.225211046 0 0.9389622584)
(-1.319017547 0 1.08016556)
(-1.219072846 0 0.9851581807)
(-1.101447917 0 0.8241264279)
(-1.075654031 0 0.901458937)
(-0.9336225849 0 0.8446953456)
(-0.8470198501 0 0.7250049218)
(-0.843822439 0 0.7974302915)
(-0.7486916273 0 0.7435399189)
(-0.6625623435 0 0.6068700197)
(-0.6087695002 0 0.6385936382)
(0.0712218702 0 0.1752822136)
(0.6680927463 0 -0.214493667)
(0.66430354 0 0.2326341976)
(0.6220237638 0 0.4491548493)
(0.4892066682 0 0.3412875998)
(0.9311826824 0 0.6549501944)
(1.493985086 0 1.805926362)
(0.6644188164 0 1.345050596)
(0.9136725587 0 2.45819608)
(0.3797282968 0 2.134776203)
(-0.4805688413 0 0.9455513576)
(-0.1953964802 0 1.51611628)
(-0.6806861732 0 1.021481737)
(-0.7615569479 0 0.7815944809)
(-0.8840332305 0 0.9145715695)
(-0.9754351842 0 0.9352936764)
(-0.899283194 0 0.8509990281)
(-1.056387462 0 0.9456030121)
(-1.129057965 0 0.9396887818)
(-1.049608396 0 0.886938446)
(-1.182767242 0 0.9270168053)
(-1.208685167 0 0.9155118075)
(-1.14576524 0 0.8956680552)
(-1.20577011 0 0.9091142734)
(-1.181255478 0 0.9065827215)
(-1.146419121 0 0.9148709578)
(-1.144146011 0 0.9048252718)
(-1.098783641 0 0.9015716235)
(-1.098408183 0 0.9406423268)
(-1.047910119 0 0.8856371262)
(-1.177379817 0 0.8525814689)
(-0.9906718878 0 0.9365342553)
(-1.117434167 0 0.7038091608)
(0.315052183 0 -0.655756129)
(1.071110833 0 -1.175369189)
(0.9886401532 0 -1.141700259)
(1.152815689 0 -1.055222159)
(1.200012895 0 -1.246814113)
(1.19884742 0 -1.107256568)
(1.220453664 0 -1.165941034)
(1.345935223 0 -1.493847715)
(1.21634858 0 -1.190086644)
(1.183046076 0 -1.163015068)
(1.361057814 0 -1.537092713)
(1.11013447 0 -1.070820702)
(0.9897557512 0 -0.9111626227)
(1.173762737 0 -1.236692007)
(0.794446919 0 -0.6734029745)
(0.1264658284 0 -0.2036882862)
(0.7214255648 0 -0.5486793035)
(-0.3541457196 0 0.09281278407)
(-0.3142868698 0 0.1323995474)
(-0.3665422158 0 0.1176746367)
(-0.1616990088 0 0.01928819179)
(-0.0663759283 0 -0.02993692835)
(-0.1055420048 0 -0.03976486654)
(0.007910120718 0 -0.1027324267)
(-0.06526352703 0 -0.1233008767)
(0.0508110293 0 -0.2531846065)
(-0.03647834123 0 -0.2690227607)
(-0.05496151521 0 -0.241410809)
(0.06934704031 0 -0.2292826604)
(-0.4234057715 0 0.3337085096)
(-0.7970602857 0 0.7906131797)
(-0.6669088433 0 0.5709564885)
(-1.169804528 0 1.174870916)
(-1.465803438 0 1.457393289)
(-1.190806503 0 1.102705017)
(-1.673269999 0 1.649170657)
(-1.804554531 0 1.769212161)
(-1.501027367 0 1.410783256)
(-1.861835234 0 1.814566456)
(-1.826141532 0 1.755370639)
(-1.562764092 0 1.432217389)
(-1.688766903 0 1.583945037)
(-1.492521772 0 1.371310449)
(-1.343821045 0 1.168105892)
(-1.285654951 0 1.199432359)
(-1.096894672 0 1.088420592)
(-1.024683973 0 0.9754766549)
(-0.9448347166 0 1.011377832)
(-0.8305801469 0 0.9446128039)
(-0.8026300838 0 0.8655217597)
(-0.7146984683 0 0.8573328859)
(-0.5209484481 0 0.5522891867)
(-0.5128751116 0 0.5867816722)
(-0.2501765661 0 0.2130636682)
(-0.1468064317 0 0.3254079529)
(-0.2096621379 0 0.2042448184)
(-0.17586793 0 0.2589396139)
(0.5929431203 0 0.5917564274)
(1.67221013 0 1.196079349)
(-0.3144001907 0 0.2200803652)
(-0.6722647854 0 0.3700631688)
(-0.08810995721 0 0.6469288601)
(-0.7015438957 0 0.6841551009)
(-0.8112976061 0 0.8985123094)
(-0.8695878248 0 0.8488156307)
(-0.9399768786 0 0.9852202889)
(-1.061134494 0 1.010199759)
(-1.02904362 0 0.9983977206)
(-1.165927476 0 1.001255353)
(-1.242496317 0 0.9747033914)
(-1.191835527 0 0.9732691119)
(-1.282951576 0 0.9435005949)
(-1.287653924 0 0.9157448228)
(-1.25794384 0 0.9232467021)
(-1.261995039 0 0.8928107209)
(-1.212977615 0 0.872033804)
(-1.207330365 0 0.8911060087)
(-1.146492983 0 0.8532150821)
(-1.062988574 0 0.8391112696)
(-1.092663118 0 0.8681704035)
(-0.9564918785 0 0.7689950981)
(-0.8655938947 0 0.4908968475)
(-0.9253295038 0 0.6342704568)
(-0.7246548566 0 0.1993974181)
(-0.540083579 0 -0.08291242775)
(-0.8718153725 0 0.1973375655)
(-0.6680175911 0 -0.2304874497)
(-0.5242706035 0 -0.3442665316)
(0.8030216539 0 -0.9700193446)
(0.3826671446 0 -0.7236109256)
(0.734285716 0 -0.8362708179)
(1.082780362 0 -0.9874487717)
(0.8309251375 0 -0.8270287954)
(0.8119924813 0 -0.7660849065)
(1.031962713 0 -0.932196454)
(0.6975497622 0 -0.6656873908)
(0.3293951772 0 -0.3922060112)
(0.7962141045 0 -0.7029732818)
(-0.317513966 0 0.06784052298)
(-0.2967754592 0 0.09139662743)
(-0.3381882149 0 0.08182146911)
(-0.2862342473 0 0.1013300901)
(-0.2724759907 0 0.1144357613)
(-0.2879337549 0 0.1200418503)
(-0.1505532598 0 0.1779078432)
(-0.1510341022 0 0.1929655532)
(-0.1124523102 0 0.1199097032)
(-0.1322297176 0 0.2115606836)
(-0.0698096483 0 0.2295178241)
(0.003312353756 0 -0.02132991769)
(0.003078399232 0 0.2302236951)
(-0.2672017972 0 0.4510187881)
(-0.1090044975 0 0.1705171326)
(-0.8428963551 0 0.982499433)
(-1.419405736 0 1.51385649)
(-1.04431141 0 1.115914793)
(-1.846827623 0 1.896164753)
(-2.126459204 0 2.136355466)
(-1.801700419 0 1.817490714)
(-2.292937511 0 2.271420787)
(-2.377046461 0 2.332837942)
(-2.124525293 0 2.094724376)
(-2.397932195 0 2.339410494)
(-2.353346937 0 2.284455121)
(-2.120578696 0 2.06508946)
(-2.200743717 0 2.114952115)
(-1.900631885 0 1.798051785)
(-1.682672826 0 1.587673448)
(-1.54078442 0 1.463621459)
(-1.229353708 0 1.243769462)
(-1.158944592 0 1.180050777)
(-0.9907664378 0 1.121201981)
(-0.8211028406 0 1.042925743)
(-0.8236149026 0 1.010634267)
(-0.7113391914 0 0.9715449265)
(-0.6309317116 0 0.8840687578)
(-0.6390363699 0 0.818061205)
(-0.5471973979 0 0.760895859)
(-0.4240878316 0 0.5812564165)
(-0.2167417142 0 0.4435165235)
(-0.4513465627 0 0.5257439423)
(-0.5686264389 0 0.6011076822)
(-0.2710139824 0 0.2707292819)
(-0.7919007076 0 0.3238114158)
(-2.614645254 0 0.6930319891)
(-1.300260098 0 0.5661282947)
(-1.062606551 0 1.084946375)
(-0.9835709334 0 0.9558965108)
(-0.8369819169 0 0.8867037402)
(-1.123755972 0 0.9542812988)
(-1.253261016 0 0.9636283737)
(-1.129933446 0 0.9790546514)
(-1.329493375 0 0.9539875028)
(-1.349965126 0 0.929538733)
(-1.297534853 0 0.9514685121)
(-1.333733639 0 0.9006605593)
(-1.295703747 0 0.8763340793)
(-1.299752919 0 0.8970904198)
(-1.239107977 0 0.8594549429)
(-1.164805419 0 0.8452705883)
(-1.195886921 0 0.8553894678)
(-1.075511744 0 0.8292154413)
(-0.9657565578 0 0.7928858891)
(-1.016495487 0 0.8156917911)
(-0.8423810423 0 0.5634299704)
(-0.7171574466 0 0.185653288)
(-0.8032953237 0 0.3406480904)
(-0.468930539 0 -0.1344476423)
(-0.4972245559 0 -0.3645043314)
(-0.4578072645 0 -0.237120674)
(-0.551452238 0 -0.4863933352)
(-0.5317750902 0 -0.4792108484)
(-0.5795280014 0 -0.4013056084)
(-0.4942279696 0 -0.442468738)
(-0.4451619417 0 -0.3864275027)
(-0.3556381845 0 -0.3588613897)
(-0.3893084374 0 -0.3121493772)
(-0.3383206977 0 -0.2192177317)
(0.2333143407 0 -0.4489013539)
(-0.2951453859 0 -0.09756725025)
(-0.3070790545 0 0.02412988577)
(-0.3083366056 0 0.0420268325)
(-0.3113992644 0 0.05298978144)
(-0.3079672858 0 0.07653547563)
(-0.2944455972 0 0.08285514943)
(-0.2874706403 0 0.1114480476)
(-0.2591302508 0 0.1445146297)
(-0.2646485946 0 0.1230465117)
(-0.06844181862 0 0.3102931226)
(-0.07911323206 0 0.3048447226)
(-0.1199222184 0 0.2336849761)
(-0.09338150521 0 0.3240120069)
(-0.07492014093 0 0.3516086198)
(-0.1449910564 0 0.2892402738)
(-0.2687112933 0 0.5565550936)
(-1.040196594 0 1.265053256)
(-0.6118137621 0 0.7968721262)
(-1.777424792 0 1.917917281)
(-2.25532721 0 2.326044433)
(-1.842840123 0 1.929859905)
(-2.5224803 0 2.54176913)
(-2.65398574 0 2.636142071)
(-2.411742009 0 2.408663639)
(-2.700600995 0 2.655716075)
(-2.691163724 0 2.626191028)
(-2.557724934 0 2.501667766)
(-2.640050242 0 2.559783516)
(-2.550950157 0 2.458135595)
(-2.485772263 0 2.402419652)
(-2.411986214 0 2.303028349)
(-2.172079668 0 2.031584726)
(-2.08374841 0 1.958792399)
(-1.777651566 0 1.616912251)
(-1.346722457 0 1.24514961)
(-1.299474462 0 1.264580782)
(-1.008460999 0 1.03918191)
(-0.7764707725 0 0.9321394852)
(-0.8114734384 0 1.018486717)
(-0.6274991957 0 0.8541584279)
(-0.5267082708 0 0.7650896049)
(-0.5909413756 0 0.8665874087)
(-0.4634189759 0 0.6293572997)
(-0.5346600776 0 0.5365548369)
(-0.4775459653 0 0.5788676221)
(-0.7436409165 0 0.6173392987)
(-0.9451145044 0 0.7417437853)
(-0.8200623286 0 0.5820653939)
(-1.108234442 0 0.8327726866)
(0.908312012 0 0.8744248662)
(-0.6864786305 0 0.7436854348)
(-0.978040143 0 0.9540383508)
(-1.377270783 0 0.9783133605)
(-1.204301132 0 1.407552613)
(-1.445345136 0 0.9941366322)
(-1.45134168 0 0.9883148826)
(-1.391150779 0 0.9772090072)
(-1.420578081 0 0.9540403294)
(-1.366338955 0 0.9048345711)
(-1.373525994 0 0.9186608365)
(-1.303169466 0 0.8589578529)
(-1.234726014 0 0.8328676671)
(-1.273953869 0 0.8562292081)
(-1.156462972 0 0.8354597617)
(-1.068425159 0 0.8505912774)
(-1.123049814 0 0.843452409)
(-0.9737829676 0 0.8495749739)
(-0.863714129 0 0.7437362646)
(-0.9146646971 0 0.7675670197)
(-0.7202428443 0 0.2848715615)
(-0.4470400063 0 -0.1892411934)
(-0.5853961202 0 0.004818829342)
(-0.4790205008 0 -0.4408341213)
(-0.5771820402 0 -0.6052844889)
(-0.5485791469 0 -0.5048175849)
(-0.576883041 0 -0.6242153904)
(-0.566130928 0 -0.6162126333)
(-0.5406062916 0 -0.5524558917)
(-0.5423406926 0 -0.5938777542)
(-0.5067629808 0 -0.5550135857)
(-0.4562585651 0 -0.4731272056)
(-0.4581284322 0 -0.4991612843)
(-0.3943186254 0 -0.4233856972)
(-0.3447889627 0 -0.3250234102)
(-0.3238557883 0 -0.3258413376)
(-0.3115264729 0 -0.1540053921)
(-0.3174032546 0 -0.03934655647)
(-0.3298348391 0 0.01959133871)
(-0.325274256 0 0.1029255249)
(-0.3186332248 0 0.08796892652)
(-0.2846033376 0 0.1609683096)
(-0.2302975467 0 0.2064523394)
(-0.2520310247 0 0.1701646781)
(0.115691905 0 0.3540878956)
(-0.1830268163 0 0.6350792297)
(0.01550074828 0 0.4119353468)
(-1.428193466 0 1.705602848)
(-2.341983135 0 2.484019376)
(-1.637690741 0 1.846717295)
(-2.774655351 0 2.83717231)
(-2.950259889 0 2.963172771)
(-2.639091065 0 2.681147666)
(-3.001227927 0 2.980237041)
(-2.986519197 0 2.940529945)
(-2.847994536 0 2.814797512)
(-2.931502288 0 2.865751581)
(-2.84570373 0 2.763202189)
(-2.786680754 0 2.713164868)
(-2.72862526 0 2.630856578)
(-2.570928679 0 2.457988711)
(-2.577155483 0 2.475522402)
(-2.358457322 0 2.227790111)
(-2.080454567 0 1.920898806)
(-2.162134495 0 2.013008773)
(-1.716720718 0 1.514633608)
(-1.283297941 0 1.083831797)
(-1.346009562 0 1.185926494)
(-0.9004415038 0 0.8030531795)
(-0.623830936 0 0.6609852101)
(-0.7079676563 0 0.8086016114)
(-0.4365871906 0 0.5625101545)
(-0.397990018 0 0.474257101)
(-0.4253226151 0 0.6144915476)
(-0.5749717933 0 0.5022919225)
(-0.8338105661 0 0.6372497236)
(-0.650324981 0 0.5547294906)
(-1.066076269 0 0.7770477323)
(-1.248564502 0 0.8857671015)
(-1.090565741 0 0.8086861771)
(-1.380333512 0 0.961570133)
(-1.469864929 0 1.010654493)
(-1.362136253 0 0.9611216798)
(-1.513401125 0 1.028051231)
(-1.529650265 0 1.028144124)
(-1.486751929 0 1.011254049)
(-1.522370716 0 1.026513679)
(-1.482095753 0 1.012379144)
(-1.475748838 0 1.001608738)
(-1.405385209 0 0.9604086226)
(-1.307273101 0 0.8861472161)
(-1.343143894 0 0.8922949222)
(-1.202594693 0 0.8178389271)
(-1.095138671 0 0.7844868729)
(-1.176724279 0 0.8079536547)
(-0.9874485602 0 0.8152582019)
(-0.8932494602 0 0.8858488281)
(-0.9946789543 0 0.8661995362)
(-0.8180346814 0 0.916220222)
(-0.7430284042 0 0.7636820125)
(-0.8092949661 0 0.7355705868)
(-0.5203283026 0 0.07622178516)
(-0.4191521702 0 -0.4461002114)
(-0.3792751786 0 -0.3571424218)
(-0.5507483612 0 -0.6188688683)
(-0.5800268564 0 -0.6585201449)
(-0.583309688 0 -0.6503445983)
(-0.6102255669 0 -0.6881772932)
(-0.6321049406 0 -0.7126772237)
(-0.5997543761 0 -0.6688859367)
(-0.6404136885 0 -0.7192639662)
(-0.6361669034 0 -0.7101545282)
(-0.5714818312 0 -0.6343653885)
(-0.617309035 0 -0.6850184037)
(-0.5775861611 0 -0.6377408778)
(-0.4805552488 0 -0.5275462665)
(-0.5086538691 0 -0.5586773037)
(-0.4017184856 0 -0.4353805096)
(-0.3132984066 0 -0.3025357641)
(-0.2670862618 0 -0.2401288304)
(-0.166387557 0 0.09407385848)
(-0.320739016 0 0.1143044104)
(0.1288086528 0 0.2880600768)
(-2.245764692 0 2.459501546)
(-1.0409804 0 1.386919497)
(-3.063725695 0 3.175527202)
(-3.271619916 0 3.326411836)
(-2.927669684 0 3.010566183)
(-3.30605878 0 3.320842761)
(-3.273691957 0 3.257457806)
(-3.156418775 0 3.150385867)
(-3.206406118 0 3.164052073)
(-3.114799291 0 3.048690757)
(-3.071833215 0 3.016091129)
(-3.000942739 0 2.91217268)
(-2.860391779 0 2.749917225)
(-2.87003432 0 2.776394645)
(-2.679664773 0 2.549003842)
(-2.434900856 0 2.285234952)
(-2.527620283 0 2.399060377)
(-2.109354027 0 1.938491949)
(-1.737679831 0 1.539756314)
(-1.939723985 0 1.763455618)
(-1.390891444 0 1.160412254)
(-1.077003418 0 0.8365904218)
(-1.177396108 0 0.9516472521)
(-0.7961820017 0 0.6206093906)
(-0.6530930581 0 0.5399524111)
(-0.550901592 0 0.5231762406)
(-0.708643075 0 0.5519123519)
(-0.8814928862 0 0.6360948088)
(-0.589296225 0 0.4787518479)
(-1.085721246 0 0.7580113379)
(-1.270772276 0 0.8762699534)
(-1.060198125 0 0.7530000581)
(-1.413689319 0 0.9689908801)
(-1.511399943 0 1.033834579)
(-1.399069602 0 0.9640051089)
(-1.568306798 0 1.071362745)
(-1.594243404 0 1.087253857)
(-1.545852395 0 1.053677731)
(-1.586458175 0 1.060863829)
(-1.557960035 0 1.028359862)
(-1.554236137 0 1.033453602)
(-1.514740137 0 1.029084589)
(-1.441908455 0 1.045252269)
(-1.473421269 0 1.026276306)
(-1.333265213 0 1.009816904)
(-1.193497137 0 0.9139896553)
(-1.258701731 0 0.8929369664)
(-1.02668308 0 0.8109292515)
(-0.847162811 0 0.753221278)
(-0.985078535 0 0.7668067903)
(-0.6867413617 0 0.7826107309)
(-0.5916253547 0 0.8817467918)
(-0.7566766816 0 0.898495522)
(-0.5641485312 0 0.9598993229)
(-0.5565730339 0 0.8866751662)
(-0.6584029876 0 0.825920322)
(-0.4287164036 0 0.3571998047)
(-0.4363650281 0 -0.4177327915)
(-0.4537492219 0 -0.4652781842)
(-0.4839148216 0 -0.5716903534)
(-0.5397275644 0 -0.6221979451)
(-0.5671187446 0 -0.6492506634)
(-0.6069465872 0 -0.6963153653)
(-0.670104941 0 -0.7672940654)
(-0.6569563099 0 -0.7465942361)
(-0.7120615066 0 -0.8106359407)
(-0.7396232707 0 -0.8355793151)
(-0.6935032369 0 -0.7783628592)
(-0.7554646039 0 -0.8471642511)
(-0.7561757651 0 -0.8421276614)
(-0.6721391699 0 -0.7449887999)
(-0.735091073 0 -0.8132433708)
(-0.6777150384 0 -0.744292537)
(-0.5357242797 0 -0.5870159712)
(-0.548997299 0 -0.5953411797)
(0.1921895566 0 0.06610716707)
(0.09727174724 0 0.09823923743)
(0.2315479018 0 0.5777849833)
(-3.470063777 0 3.625229614)
(-3.01342982 0 3.191865934)
(-3.580495095 0 3.6673963)
(-3.538357031 0 3.577968229)
(-3.444198346 0 3.489194918)
(-3.459550983 0 3.457769023)
(-3.359551331 0 3.318565892)
(-3.3350614 0 3.310229454)
(-3.239484872 0 3.159928854)
(-3.095915647 0 2.978798882)
(-3.123616881 0 3.040070356)
(-2.921641605 0 2.770079972)
(-2.70023541 0 2.521281141)
(-2.810626592 0 2.673049567)
(-2.399994518 0 2.205666923)
(-1.998682185 0 1.800121176)
(-2.269820258 0 2.094466646)
(-1.562714387 0 1.357835831)
(-1.235201978 0 1.016555151)
(-1.482891416 0 1.265846579)
(-1.069334769 0 0.8389636093)
(-1.010333713 0 0.7740816591)
(-1.025891666 0 0.7787302305)
(-1.003542202 0 0.7625677195)
(-1.038820548 0 0.7823578122)
(-0.9278085175 0 0.6721744269)
(-1.118956581 0 0.8323762148)
(-1.235900846 0 0.9056955671)
(-1.133219653 0 0.7907544633)
(-1.366001931 0 0.9842026724)
(-1.483039887 0 1.052107461)
(-1.408981625 0 0.9768361161)
(-1.57134465 0 1.101804068)
(-1.625910085 0 1.132532293)
(-1.579783228 0 1.089005503)
(-1.647396951 0 1.140972199)
(-1.638800131 0 1.128611219)
(-1.622187696 0 1.11153875)
(-1.593624658 0 1.06155236)
(-1.501920598 0 1.000492315)
(-1.541356886 0 1.015841637)
(-1.381774372 0 1.011366872)
(-1.254837826 0 1.085999428)
(-1.374601935 0 1.067911314)
(-1.137213731 0 1.09302245)
(-0.9989503738 0 0.9549094959)
(-1.106901884 0 0.9409578176)
(-0.8001916387 0 0.7695637281)
(-0.5809414157 0 0.6604668846)
(-0.6997729567 0 0.7260161552)
(-0.4253466981 0 0.6406476967)
(-0.354850356 0 0.6589545737)
(-0.4392703391 0 0.8037762421)
(-0.3349720183 0 0.6913664375)
(-0.337134496 0 0.7261313319)
(-0.4432367255 0 0.8805052179)
(-0.3038969556 0 0.6466560479)
(-0.3197448089 0 0.07290343312)
(-0.3903856388 0 -0.2112091783)
(-0.3702726593 0 -0.3953041095)
(-0.4269094326 0 -0.4889267197)
(-0.4933842606 0 -0.5703814842)
(-0.516756678 0 -0.5937759028)
(-0.6435327045 0 -0.7448536169)
(-0.6675217438 0 -0.7696682738)
(-0.7279002663 0 -0.8423098399)
(-0.7886749402 0 -0.9059211316)
(-0.7720981088 0 -0.8791017148)
(-0.8378608684 0 -0.9553435158)
(-0.8756300409 0 -0.9900902929)
(-0.824830293 0 -0.9245655188)
(-0.9008358203 0 -1.008941322)
(-0.9100130862 0 -1.008009995)
(-0.8067934882 0 -0.888777488)
(-0.8904448248 0 -0.9706115758)
(-0.5614157468 0 0.1963209267)
(-0.2431526762 0 -0.04468879081)
(-3.685440189 0 3.787895476)
(-3.572213929 0 3.575249977)
(-3.580399303 0 3.612849982)
(-3.443661398 0 3.35204766)
(-3.281215211 0 3.106279854)
(-3.347723107 0 3.2679784)
(-3.071893927 0 2.829698327)
(-2.806641493 0 2.518722686)
(-3.011238914 0 2.831514104)
(-2.479771997 0 2.1751051)
(-2.067002766 0 1.788255284)
(-2.48149672 0 2.247882961)
(-1.590432689 0 1.380934373)
(-1.250594246 0 1.099402019)
(-1.611970651 0 1.412791904)
(-1.130637094 0 0.9969748095)
(-1.109819777 0 0.978366209)
(-1.101239234 0 0.9139546064)
(-1.109197436 0 0.9796707122)
(-1.111226406 0 0.9832186136)
(-1.042748763 0 0.8571150762)
(-1.126313769 0 0.9901996158)
(-1.174625792 0 1.00837291)
(-1.101822269 0 0.8939390504)
(-1.267125728 0 1.043055181)
(-1.390279543 0 1.089729953)
(-1.308600254 0 1.000800415)
(-1.514362591 0 1.136835666)
(-1.61423395 0 1.173932084)
(-1.546984558 0 1.11580927)
(-1.678041528 0 1.195123175)
(-1.7036047 0 1.198502639)
(-1.666449304 0 1.16874556)
(-1.69329349 0 1.181521278)
(-1.646604192 0 1.144110238)
(-1.647314274 0 1.139748479)
(-1.557622544 0 1.058713681)
(-1.343496614 0 0.9693443751)
(-1.435653787 0 0.9863461782)
(-1.069311765 0 0.9479443042)
(-0.8798324069 0 0.9944456807)
(-1.076972902 0 1.076206016)
(-0.8022873846 0 0.9982430676)
(-0.748692022 0 0.8471597009)
(-0.8772466724 0 0.9328926877)
(-0.6458005783 0 0.5982830201)
(-0.522634329 0 0.4215258932)
(-0.5098486608 0 0.5502087669)
(-0.4442408349 0 0.3386542306)
(-0.4060242774 0 0.2826323735)
(-0.3177485766 0 0.4887647806)
(-0.3735965288 0 0.2392097755)
(-0.3271863309 0 0.2122672021)
(-0.2936840484 0 0.320506354)
(-0.2603031246 0 0.1920595886)
(-0.2374877609 0 0.2332714359)
(-0.2129816862 0 0.1797006906)
(-0.2924879531 0 0.3453539551)
(-0.255168945 0 0.07706223987)
(-0.3413622915 0 -0.3754713525)
(-0.2876661416 0 -0.3582929702)
(-0.4858618646 0 -0.5140347613)
(-0.5882879649 0 -0.6742224057)
(-0.6418311988 0 -0.7540159963)
(-0.7535142533 0 -0.8809779186)
(-0.7856095039 0 -0.9107575047)
(-0.8463274176 0 -0.986566103)
(-0.9201619172 0 -1.066705835)
(-0.9076016732 0 -1.037824709)
(-0.9763710128 0 -1.122039902)
(-1.018654363 0 -1.155543247)
(-0.9797924774 0 -1.095032615)
(-2.801742317 0 1.449515669)
(-2.222640309 0 1.3063619)
(-3.071788231 0 2.656564593)
(-1.795934215 0 1.189441227)
(-1.498059362 0 1.097589743)
(-2.308540074 0 1.876266945)
(-1.258260991 0 1.017835285)
(-1.105970801 0 1.030266032)
(-1.453327597 0 1.220271926)
(-1.14985499 0 1.137569452)
(-1.233283638 0 1.216493815)
(-1.147589199 0 1.072695287)
(-1.283175354 0 1.2545908)
(-1.299674643 0 1.26612916)
(-1.193162811 0 1.117526963)
(-1.294527953 0 1.26043807)
(-1.28595081 0 1.244860549)
(-1.195756786 0 1.117629118)
(-1.300835138 0 1.228861164)
(-1.36255685 0 1.222804558)
(-1.26271118 0 1.120001786)
(-1.468389085 0 1.230832486)
(-1.588065792 0 1.247448749)
(-1.484405296 0 1.173194648)
(-1.688769796 0 1.262883847)
(-1.752530295 0 1.268913321)
(-1.684071509 0 1.225815613)
(-1.774719287 0 1.260186045)
(-1.756366325 0 1.233235806)
(-1.7348492 0 1.22064742)
(-1.699271315 0 1.185547428)
(-1.602800519 0 1.116620788)
(-1.633443284 0 1.138150367)
(-1.460925051 0 1.011017539)
(-1.166853746 0 0.8465453664)
(-1.243202449 0 0.9295867215)
(-0.8570279679 0 0.684656785)
(-0.6930275344 0 0.5573579516)
(-0.7440954709 0 0.8101582858)
(-0.6105496077 0 0.4109830964)
(-0.5505146734 0 0.2677799681)
(-0.6233830714 0 0.6344377768)
(-0.5185594036 0 0.2001206911)
(-0.507498632 0 0.1976591347)
(-0.5052831145 0 0.2884891934)
(-0.493450768 0 0.2237192968)
(-0.477596792 0 0.2562978617)
(-0.4468011485 0 0.236447442)
(-0.4667065381 0 0.2864995038)
(-0.4600838115 0 0.3170766683)
(-0.3860172644 0 0.262695622)
(-0.4578299368 0 0.3531898835)
(-0.4422960766 0 0.4010689302)
(-0.321393331 0 0.3204988637)
(-0.3945810764 0 0.4863388221)
(-0.3863437825 0 0.7371796452)
(-0.4091848224 0 0.608240306)
(-0.4104890227 0 0.9208382544)
(-0.3607602313 0 0.8353557925)
(-0.3293176526 0 -0.265136704)
(-0.2950473776 0 0.6574582701)
(-0.2257377724 0 0.5265715102)
(-0.661549201 0 -0.7755439467)
(-0.1954325353 0 0.4581363634)
(-0.09804817442 0 0.550247506)
(-0.9083926554 0 -1.069978934)
(-1.43318198 0 1.193697883)
(-1.372986354 0 1.185008484)
(-1.74334485 0 1.225927679)
(-1.30576175 0 1.144807586)
(-1.175826844 0 1.107241627)
(-1.305347365 0 1.08830034)
(-0.9718830603 0 1.086169353)
(-1.223713444 0 1.366812988)
(-1.112679665 0 1.165006335)
(-1.424271957 0 1.488005258)
(-1.501593143 0 1.526758827)
(-1.367877015 0 1.381372664)
(-1.519898279 0 1.534124567)
(-1.505724731 0 1.522726429)
(-1.407116857 0 1.402693987)
(-1.478782392 0 1.495659856)
(-1.467130703 0 1.455978322)
(-1.376677008 0 1.358734704)
(-1.506289015 0 1.413186804)
(-1.602094049 0 1.38073202)
(-1.474796502 0 1.311407297)
(-1.716538568 0 1.363142173)
(-1.807818201 0 1.353559553)
(-1.698016889 0 1.308495708)
(-1.857587631 0 1.342084659)
(-1.863882603 0 1.320386968)
(-1.814567402 0 1.300880513)
(-1.828512091 0 1.281773211)
(-1.751610538 0 1.22050493)
(-1.763683503 0 1.234008168)
(-1.631362995 0 1.13203958)
(-1.464310999 0 1.013169498)
(-1.548625767 0 1.075534161)
(-1.237738278 0 0.8485889398)
(-0.9469527125 0 0.5781995365)
(-1.108205535 0 0.7264667788)
(-0.721285864 0 0.2914210957)
(-0.589035316 0 0.1894129295)
(-0.6883463676 0 0.3194295804)
(-0.5174403065 0 0.1619182687)
(-0.4864936249 0 0.1565248665)
(-0.5218547776 0 0.1797038297)
(-0.4949853588 0 0.1657615262)
(-0.5115750396 0 0.192284468)
(-0.5046500171 0 0.1936859552)
(-0.5229396265 0 0.2378895385)
(-0.5324446712 0 0.2911283781)
(-0.5041683433 0 0.2739162249)
(-0.5439817908 0 0.3442682019)
(-0.5564705555 0 0.3965990075)
(-0.5161196841 0 0.3596988169)
(-0.5686672859 0 0.4488702302)
(-0.5714214258 0 0.4618755175)
(-0.5183755503 0 0.4507280025)
(-0.43567571 0 0.4446550282)
(0.7700494992 0 -0.6605653678)
(-0.2836940912 0 0.6021387435)
(1.380026038 0 0.7727214603)
(1.631927692 0 1.550418005)
(0.3283113939 0 1.598298455)
(1.704960105 0 2.020601945)
(1.695280767 0 2.283542064)
(0.1452497943 0 1.569456543)
(1.625560954 0 2.400200672)
(1.4355774 0 2.326976042)
(0.1125619625 0 1.400226415)
(-0.2221238001 0 -0.1793535304)
(-0.6295721412 0 1.559567209)
(-1.078685984 0 1.187975435)
(-0.6063913671 0 1.520144037)
(-1.542739686 0 1.695898329)
(-1.387764162 0 1.558592223)
(-1.698261312 0 1.745464885)
(-1.728829865 0 1.758842772)
(-1.620697108 0 1.649637605)
(-1.713793585 0 1.749597478)
(-1.674662677 0 1.720842238)
(-1.593824003 0 1.627773602)
(-1.643056011 0 1.665194334)
(-1.671905462 0 1.581192871)
(-1.561750395 0 1.532846879)
(-1.779425231 0 1.497938048)
(-1.893574111 0 1.446445182)
(-1.744888393 0 1.426111783)
(-1.962045745 0 1.419544762)
(-1.981300091 0 1.398218575)
(-1.906449717 0 1.38240734)
(-1.960364027 0 1.369313955)
(-1.901146352 0 1.322387959)
(-1.894186442 0 1.327368573)
(-1.798240156 0 1.247598247)
(-1.644082719 0 1.136567083)
(-1.714234023 0 1.189689931)
(-1.435171936 0 0.9859336629)
(-1.17766404 0 0.8017600685)
(-1.342707118 0 0.9240151798)
(-0.8847397803 0 0.5713031836)
(-0.6436879486 0 0.2627610258)
(-0.7817593135 0 0.408274447)
(-0.5406042704 0 0.09690752691)
(-0.4813072386 0 0.1175917164)
(-0.5263166924 0 0.1390199845)
(-0.4646910392 0 0.1275183393)
(-0.4633683778 0 0.1461356287)
(-0.4703617834 0 0.1510477786)
(-0.4952769063 0 0.150144971)
(-0.5331129973 0 0.1831458448)
(-0.5232545478 0 0.1904906996)
(-0.5599820299 0 0.2492754659)
(-0.5799787984 0 0.3237562322)
(-0.5588789759 0 0.3080269688)
(-0.5980979782 0 0.3934126861)
(-0.6148944664 0 0.4559906858)
(-0.5885605194 0 0.4280381004)
(-0.6278820997 0 0.5088859349)
(-0.6342355443 0 0.549046935)
(-0.6100570035 0 0.5232624692)
(-0.6278705717 0 0.5939824573)
(-0.5888690702 0 0.6075532086)
(-0.4561132755 0 0.4940670685)
(0.5219939968 0 0.9404145588)
(1.250674864 0 1.305504825)
(1.100145078 0 1.181816461)
(1.591403044 0 1.625287383)
(1.640488821 0 1.851713428)
(1.963962688 0 2.141719797)
(-1.978158652 0 1.972298477)
(-1.948357445 0 1.968903337)
(-1.835335685 0 1.863398484)
(-1.897273479 0 1.934278093)
(-1.826754279 0 1.872248304)
(-1.752177805 0 1.803178752)
(-1.859939622 0 1.698650643)
(-1.992372119 0 1.532950018)
(-1.815042288 0 1.584636294)
(-2.084558529 0 1.469744282)
(-2.105787247 0 1.453011175)
(-2.0226443 0 1.450033123)
(-2.087560541 0 1.437998186)
(-2.041099358 0 1.409604425)
(-2.025327603 0 1.406136345)
(-1.964090017 0 1.35992621)
(-1.834575817 0 1.270465321)
(-1.882538294 0 1.304883275)
(-1.631550738 0 1.124801176)
(-1.353703443 0 0.921030783)
(-1.529782386 0 1.05203595)
(-1.037179429 0 0.6861966896)
(-0.7576546246 0 0.4787235823)
(-0.9727909426 0 0.6466188925)
(-0.5790483914 0 0.3147348753)
(-0.4925026784 0 0.1377379182)
(-0.5506035061 0 0.1705908958)
(-0.44408316 0 0.07579704531)
(-0.4276341912 0 0.1024282435)
(-0.4525478332 0 0.1080036158)
(-0.4471195772 0 0.1167873837)
(-0.4772432592 0 0.1254133823)
(-0.4658222165 0 0.1366826645)
(-0.4967147101 0 0.1080912963)
(-0.516783634 0 0.1523702715)
(-0.5320233355 0 0.1682064895)
(-0.5423271184 0 0.2481736372)
(-0.5703818068 0 0.3379121469)
(-0.5851328607 0 0.3350714942)
(-0.6016343945 0 0.4156980969)
(-0.633936223 0 0.4846575657)
(-0.631447568 0 0.4768768981)
(-0.655203161 0 0.5386142506)
(-0.6656261642 0 0.5801053405)
(-0.6532034627 0 0.5706057247)
(-0.6623077871 0 0.611880643)
(-0.6641916989 0 0.6351459805)
(-0.6427672202 0 0.5980952556)
(-0.5780082458 0 0.2491191686)
(-0.5666296973 0 0.05588108129)
(-1.885441694 0 1.916180873)
(-2.203937309 0 1.475149088)
(-2.196686166 0 1.477101197)
(-2.137739423 0 1.477205152)
(-2.189441542 0 1.482316728)
(-2.154483213 0 1.478823344)
(-2.143198853 0 1.464085795)
(-2.100091542 0 1.452353783)
(-2.012309095 0 1.396791811)
(-2.035746716 0 1.407996262)
(-1.869546925 0 1.299888605)
(-1.570404698 0 1.079101983)
(-1.743746433 0 1.206275286)
(-1.160846789 0 0.7701376189)
(-0.7969696753 0 0.4925750436)
(-1.099347584 0 0.7279531626)
(-0.5878637951 0 0.334194456)
(-0.5063057588 0 0.2794309334)
(-0.5906021451 0 0.3450828998)
(-0.4798818561 0 0.2588477223)
(-0.4463434287 0 0.1761359942)
(-0.459307359 0 0.1468295635)
(-0.3887694851 0 0.1039003904)
(-0.386593634 0 0.1093260418)
(-0.4048636321 0 0.1028128248)
(-0.4383690623 0 0.1253458048)
(-0.4891357063 0 0.1289122422)
(-0.4886204416 0 0.1220573719)
(-0.4920308425 0 0.116314543)
(-0.4863595737 0 0.1371452566)
(-0.4983035581 0 0.1426827794)
(-0.5090551672 0 0.2323265208)
(-0.5356479855 0 0.3167368694)
(-0.5500581519 0 0.3310272887)
(-0.5698346633 0 0.3903727407)
(-0.6168769742 0 0.4645330068)
(-0.6263835047 0 0.4784483886)
(-0.6462309603 0 0.5192311846)
(-0.6697377306 0 0.566260782)
(-0.670391531 0 0.577150203)
(-2.043799209 0 1.428285468)
(-1.842156473 0 1.288421459)
(-1.962052958 0 1.366304975)
(-1.4648337 0 1.023009471)
(-0.726420014 0 0.4059926139)
(-1.224300083 0 0.8124696558)
(-0.5582825106 0 0.2921249908)
(-0.5080752442 0 0.2688022763)
(-0.5769199492 0 0.3184224628)
(-0.4840575976 0 0.2616718318)
(-0.4717579646 0 0.2610255348)
(-0.4784350366 0 0.2624300951)
(-0.4662755234 0 0.2697495951)
(-0.4568336432 0 0.2328800926)
(-0.4485283417 0 0.2086610613)
(-0.3883027327 0 0.1457205083)
(-0.3697863279 0 0.1234487991)
(-0.3750316466 0 0.1178118315)
(-0.4236380871 0 0.141565892)
(-0.4651132487 0 0.1491438634)
(-0.4794004683 0 0.1398720278)
(-0.4803124522 0 0.1473888331)
(-0.4779294999 0 0.1386460891)
(-0.4808176912 0 0.1361380954)
)
;
boundaryField
{
dominio_ascii
{
type zeroGradient;
}
wallFilmFaces_top
{
type fixedValue;
value uniform (0 0 0);
}
region0_to_wallFilmRegion_wallFilmFaces
{
type slip;
}
}
// ************************************************************************* //
|
[
"fabio.canesin@gmail.com"
] |
fabio.canesin@gmail.com
|
|
411768db6d2a464c6bf54e4e19d359dd147db23a
|
d3893a2ee04e4752cecbc873b369a8fa7113b70d
|
/third_party/skia_m63/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h
|
e27905ca292f0874a0fb7ce2159f7a636fb771b0
|
[
"BSD-3-Clause",
"MIT"
] |
permissive
|
kniefliu/WindowsSamples
|
e849137467acdfe5351e8fdd31945c37203be3c5
|
c841268ef4a0f1c6f89b8e95bf68058ea2548394
|
refs/heads/master
| 2021-01-09T10:25:49.744308
| 2020-08-12T12:37:05
| 2020-08-12T12:37:05
| 242,264,984
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,543
|
h
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*
* This file was autogenerated from GrBlurredEdgeFragmentProcessor.fp; do not modify.
*/
#ifndef GrBlurredEdgeFragmentProcessor_DEFINED
#define GrBlurredEdgeFragmentProcessor_DEFINED
#include "SkTypes.h"
#if SK_SUPPORT_GPU
#include "GrFragmentProcessor.h"
#include "GrCoordTransform.h"
#include "GrColorSpaceXform.h"
class GrBlurredEdgeFragmentProcessor : public GrFragmentProcessor {
public:
enum Mode { kGaussian_Mode = 0, kSmoothStep_Mode = 1 };
int mode() const { return fMode; }
static std::unique_ptr<GrFragmentProcessor> Make(int mode) {
return std::unique_ptr<GrFragmentProcessor>(new GrBlurredEdgeFragmentProcessor(mode));
}
GrBlurredEdgeFragmentProcessor(const GrBlurredEdgeFragmentProcessor& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;
const char* name() const override { return "BlurredEdgeFragmentProcessor"; }
private:
GrBlurredEdgeFragmentProcessor(int mode)
: INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, kNone_OptimizationFlags)
, fMode(mode) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
int fMode;
typedef GrFragmentProcessor INHERITED;
};
#endif
#endif
|
[
"liuxiufeng@qiyi.com"
] |
liuxiufeng@qiyi.com
|
d8f219c9efefc72f246451231b204f27c365818f
|
713926478a1f876c0d30744d90f829109cd1bd64
|
/Lol2019/Day_10/F/check.cpp
|
2d9fbbc26b8092f8e2381c690731676a753d2916
|
[] |
no_license
|
Igor-SeVeR/OlympiadProblems
|
f8b191488c11bf92bdfc580bbac660f6ed7bddef
|
7197aa7a6853ff916ee9da090d53580253dabffb
|
refs/heads/master
| 2020-06-10T21:45:20.565411
| 2019-07-21T18:18:55
| 2019-07-21T18:18:55
| 193,752,484
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,237
|
cpp
|
/* Autogenerated code, forces testlib to return exit codes for EJUDGE. */
#define EJUDGE
#include "testlib.h"
#include <sstream>
using namespace std;
string ending(long long x)
{
x %= 100;
if (x / 10 == 1)
return "th";
if (x % 10 == 1)
return "st";
if (x % 10 == 2)
return "nd";
if (x % 10 == 3)
return "rd";
return "th";
}
string ltoa(long long n)
{
char c[32];
sprintf(c, "%I64d", n);
return c;
}
int main(int argc, char * argv[])
{
setName("compare ordered sequences of signed int%d numbers", 8 * sizeof(long long));
registerTestlibCmd(argc, argv);
int n = 0;
string firstElems;
while (!ans.seekEof())
{
n++;
long long j = ans.readLong();
long long p = ouf.readLong();
if (j != p)
quitf(_wa, "%d%s numbers differ - expected: '%I64d', found: '%I64d'", n, ending(n).c_str(), j, p);
else
if (n <= 5)
{
if (firstElems.length() > 0)
firstElems += " ";
firstElems += ltoa(j);
}
}
if (n <= 5)
{
quitf(_ok, "%d number(s): \"%s\"", n, firstElems.c_str());
}
else
quitf(_ok, "%d numbers", n);
}
|
[
"voafanasev@edu.hse.ru"
] |
voafanasev@edu.hse.ru
|
bfc1436d0073444c1e0a6a34010268bf0c729481
|
e7305bf4b50cedfbecf236a545f109bd825840fa
|
/mesh/MeshLoader.hpp
|
9e098722747dd2797d6a4ee6e7993b13f6898fa2
|
[] |
no_license
|
lucmobz/pacs-project
|
df03257ccf4b745692b1daf30919e7db188ef573
|
e54500b96dcf0e3d44aa07fa2970f95a5ac5c4b5
|
refs/heads/main
| 2023-04-30T11:49:55.701913
| 2021-05-21T20:27:13
| 2021-05-21T20:27:13
| 369,647,056
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,662
|
hpp
|
#pragma once
#include <fstream>
#include <memory>
#include <string>
#include <vector>
#include "Mesh.hpp"
#include "MeshConnectivity.hpp"
namespace wave {
/**
\brief A MeshLoader is an abstract loader for loading mesh files.
A pure abstract class that represents an object with access to the internals
of a Mesh. using the make method a concrete loader can be instantiated (such
as MeshLoader Voro), which can then load a Mesh according to the specific
format. Addition of a new concrete loader for a different mesh format just
requires to add the concrete loader to the make method and implement it.
*/
class MeshLoader {
public:
/// \brief virtual Destructor to have inheritance.
virtual ~MeshLoader() = default;
/**
\brief Creates a specific concrete loader according to the format specified.
\param format The string containing the format.
\return Returns a unique pointer to the concrete loader instance.
*/
static auto make(const std::string& format) -> std::unique_ptr<MeshLoader>;
/**
\brief Pure virtual load method.
\param file The string containing the file path.
\param mesh The Mesh to load the file into.
*/
virtual void load(const std::string& file, Mesh& mesh) const = 0;
protected:
/// \brief Skips the given number of lines from the input stream.
static auto skip(std::ifstream& input, int nlines) -> std::ifstream&;
/// \brief Sets the input stream past the target line
static auto skip(std::ifstream& input, const std::string& target_line)
-> std::ifstream&;
/// \brief Access the internal geometrical information in a Mesh (the
/// coordinate vector).
static auto ref_geometry(Mesh& mesh) -> std::vector<double>&;
/**
\brief Access the internal topological connectivity information in a Mesh.
For example to get access to the elements in a mesh set d0 = 3, d1 = 0.
\param mesh The Mesh.
\param d0 The first topological dimension.
\param d1 The second topological dimension.
\return Returns a reference to a MeshConnectivity inside the Mesh.
*/
static auto ref_topology(Mesh& mesh, int d0, int d1) -> MeshConnectivity&;
/// \brief Finalizes the mesh by computing the sizes and last parameters.
static void finalize(Mesh& mesh);
};
//------------------------------------------------------------------------------
inline auto MeshLoader::ref_geometry(Mesh& mesh) -> std::vector<double>& {
return const_cast<std::vector<double>&>(mesh.geometry());
}
inline auto MeshLoader::ref_topology(Mesh& mesh, int d0, int d1)
-> MeshConnectivity& {
return const_cast<MeshConnectivity&>(mesh.topology(d0, d1));
}
} // namespace wave
|
[
"luca.mobz.work@gmail.com"
] |
luca.mobz.work@gmail.com
|
22d8b87956241d56037d92ffcab2d5ae4967988e
|
90e63bf53e58790a6bc8862bba1fd492747823a8
|
/boost_variant/src/main.cc
|
cc97d593ffe392c2a76be8b42a134d585cbf4411
|
[] |
no_license
|
gucchisk/cpp-samples
|
48dc64b18a41b05e13b7f758eb658c789811269a
|
d9d421edc9c97e26c0651f85969a41a050bae85a
|
refs/heads/main
| 2021-11-24T07:45:39.299140
| 2021-11-23T01:52:32
| 2021-11-23T01:52:32
| 231,418,593
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 105
|
cc
|
#include <hello.h>
#include <iostream>
int main() {
std::cout << hello(3) << std::endl;
return 0;
}
|
[
"gucchi_sk@yahoo.co.jp"
] |
gucchi_sk@yahoo.co.jp
|
172549e7a617ae45837d4360c65058e72ca4b184
|
bbd0ed6a7ecc2a038132b105b87de4c6a1e357e8
|
/examples/occa/simple/simple.cpp
|
a639d4c588009a90150d57b7640034c00714580b
|
[
"MIT"
] |
permissive
|
holke/CUDA_ATPESC15
|
08aa7a76c54afb7d06ca6dc8e947c1737d3d5548
|
a0b74b5da4f6bcb8cd0e868420fe216b7449ac33
|
refs/heads/master
| 2020-04-05T23:46:20.221140
| 2015-08-05T20:25:46
| 2015-08-05T20:25:46
| 40,311,884
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,069
|
cpp
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "occa.hpp"
int main(int argc, char **argv){
/* hard code platform and device number */
int plat = 0;
int dev = 0;
occa::device device;
device.setup("OpenCL", plat, dev);
// build jacobi kernel from source file
const char *functionName = "";
// build Jacobi kernel
occa::kernel simple = device.buildKernelFromSource("simple.occa", "simple");
// size of array
int N = 256;
// set thread array for Jacobi iteration
int T = 32;
int dims = 1;
occa::dim inner(T);
occa::dim outer((N+T-1)/T);
simple.setWorkingDims(dims, inner, outer);
size_t sz = N*sizeof(float);
// allocate array on HOST
float *h_x = (float*) malloc(sz);
for(int n=0;n<N;++n)
h_x[n] = 123;
// allocate array on DEVICE (copy from HOST)
occa::memory c_x = device.malloc(sz, h_x);
// queue kernel
simple(N, c_x);
// copy result to HOST
c_x.copyTo(h_x);
/* print out results */
for(int n=0;n<N;++n)
printf("h_x[%d] = %g\n", n, h_x[n]);
exit(0);
}
|
[
"timwar@Tims-MacBook-Pro.local"
] |
timwar@Tims-MacBook-Pro.local
|
b87b112a4cfc818f65c22ae2d5e69202037f48c9
|
6b0ed1000d6340fe8e0a5b5a0be609bf42ad5a50
|
/133.cpp
|
5559848bc23fecb1c9839795c7933e455ed98214
|
[] |
no_license
|
HarshRaikwar/Leetcode-Submissions
|
5bcdb96b63548cf0bb4522258800ebb7a3ae8b29
|
6b7aeb5def21e6652ad7b299f472e8152bafaab0
|
refs/heads/master
| 2023-07-29T18:50:46.607706
| 2021-09-13T14:35:47
| 2021-09-13T14:35:47
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 886
|
cpp
|
/*
class Node {
public:
int val;
vector<Node*> neighbors;
Node() {
val = 0;
neighbors = vector<Node*>();
}
Node(int _val) {
val = _val;
neighbors = vector<Node*>();
}
Node(int _val, vector<Node*> _neighbors) {
val = _val;
neighbors = _neighbors;
}
};
*/
class Solution {
public:
unordered_map<Node* , Node*> mp;
Node* dfs(Node* node){
if(node == NULL)return NULL;
if(mp.find(node) != mp.end())return mp[node];
Node *root = new Node(node->val);
vector<Node*> ch = node->neighbors;
vector<Node*> v;
mp[node] = root;
for(int i=0 ; i<ch.size() ; i++){
v.push_back(dfs(ch[i]));
}
root->neighbors = v;
return mp[node] = root;
}
Node* cloneGraph(Node* node) {
return dfs(node);
}
};
|
[
"sharmadeeksha325@gmail.com"
] |
sharmadeeksha325@gmail.com
|
e9ca3ba693fe11684c141ce2abc103a90527fd90
|
26f8393e1f47baa89e0c8342a3427a4107778b3e
|
/stepdriver_fw/inc/beeper.h
|
df55b92748797d14d9d5ee7936024ee48b9594d7
|
[] |
no_license
|
roma-jam/stepdriver
|
1351f26c59d1446e0947d05c2a5e2a941cb72620
|
965c89174e45ea14fc8f744b25e54bc8aaf502d3
|
refs/heads/master
| 2020-12-18T22:18:39.723280
| 2016-06-11T10:26:47
| 2016-06-11T10:26:47
| 32,232,665
| 0
| 0
| null | null | null | null |
ISO-8859-5
|
C++
| false
| false
| 984
|
h
|
/*
* beeper.h
*
* Created on: 08 рту. 2015 у.
* Author: RomaJam
*/
#ifndef INC_BEEPER_H_
#define INC_BEEPER_H_
#include "kl_lib_f100.h"
#define BEEPER_DURATION_MS 51
#define BEEPER_DELAY_MS 99
#define BEEPER_GPIO GPIOB
#define BEEPER_PIN 7
#define BEEPER_TIM TIM4
#define BEEPER_CH CCR2
#define BEEPER_ENDPOINT_SEQ 1
#define BEEPER_WIFI_RDY_SEQ 2
#define BEEPER_START_SEQ 3
struct BeeperSequence_t {
// uint8_t Delay;
uint8_t Count; // count to beep
};
class beeper_t {
private:
VirtualTimer Timer;
bool isOn;
BeeperSequence_t Seq;
void BeeperOn() { PinSet(BEEPER_GPIO, BEEPER_PIN); isOn = true; }
void BeeperOff() { PinClear(BEEPER_GPIO, BEEPER_PIN); isOn = false; }
public:
void Init();
void Beep();
void Sequence(uint8_t BeepCnt);
void Timeout();
bool isBeep() { return isOn; }
};
extern beeper_t Beeper;
#endif /* INC_BEEPER_H_ */
|
[
"jam_roma@yahoo.com"
] |
jam_roma@yahoo.com
|
53e185946ccce2f6de59f0adcf87542e8032f953
|
a94f689196fc0a40bbd97052ec5edb9668f4f250
|
/RX/other/air_compressor/air_compressor.ino
|
c8658f442d2c4bb5f4a114e71c689dff6a5bc6bc
|
[] |
no_license
|
troywiipongwii/Open-Source-RKS
|
59c0ed2311c75a7bc384557522d4edee1f085562
|
29c2022ef7864ac68b49cd0d1d837eb2d43ff816
|
refs/heads/master
| 2020-05-22T00:25:27.938863
| 2019-04-08T06:12:47
| 2019-04-08T06:12:47
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 27
|
ino
|
#include "air_compressor.h"
|
[
"fryefryefrye@foxmail.com"
] |
fryefryefrye@foxmail.com
|
0c596827c12f869019606e13b638c470699c7165
|
f20cc2b9207e71c21ea11141d941249913459c37
|
/include/nodoGenericImpl.cpp
|
f4acae48a2bb0b4e1582845f2598d0850c786c42
|
[] |
no_license
|
Dabit98/IC-Practice2
|
e8aaa7752115127be2640ffe0ba782bc6cd8ff9a
|
9d90a315b2cfc076bffe7aff2ed8ac95f96497ac
|
refs/heads/master
| 2020-07-31T23:59:27.529762
| 2019-10-23T19:30:14
| 2019-10-23T19:30:14
| 210,793,895
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 850
|
cpp
|
#include <iostream>
//Funciones de manipulacion
//Constructor nodo hijo
template <typename T>
Nodo<T>::Nodo(Nodo* padre, T dato) : Nodo<T>::Nodo(dato) {
this->padre = padre;
}
//Constructor nodo padre
template <typename T>
Nodo<T>::Nodo(T dato) {
this->padre = nullptr;
this->dato = dato;
}
//Creador de hijos
template <typename T>
Nodo<T>* Nodo<T>::crearHijo(T dato) {
Nodo<T>* hijo = new Nodo(this, dato);
hijos.push_back(hijo);
return hijo;
}
//Eliminadores de hijos
template <typename T>
void Nodo<T>::eliminarHijo(int hijo) {
Nodo* borrar = hijos[hijo];
hijos.erase(hijos.begin()+hijo);
delete borrar;
}
template <typename T>
void Nodo<T>::eliminarHijos() {
while(!hijos.empty()){
delete hijos.back();
hijos.pop_back();
}
}
//Destructor recursivo
template <typename T>
Nodo<T>::~Nodo() {
eliminarHijos();
}
|
[
"npj6@alu.ua.es"
] |
npj6@alu.ua.es
|
d87d17c18c2066a56c331d226e2a85aa9c425581
|
20825416de992d887d322b8bd5192cf1d896c87a
|
/alladin and return.cpp
|
4bbbf1fa10d05eec32a86c14ff774bece30ac1f3
|
[] |
no_license
|
pkbhowmick/LightOJ
|
becb7daf906897efe03b42f68361c5db1162ee28
|
26942e69be0829be114d6bc668983c6896ea3477
|
refs/heads/master
| 2020-03-18T00:22:38.118825
| 2018-10-03T17:15:47
| 2018-10-03T17:15:47
| 134,090,396
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,428
|
cpp
|
///LOJ - Aladdin and the Return Journey
#include <bits/stdc++.h>
#define pb push_back
#define sc1(n) scanf("%lld",&n)
#define sc2(a,b) scanf("%lld%lld",&a,&b)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define MX 60005
using namespace std;
typedef long long int ll;
typedef unsigned long long ul;
ll cost[MX/2];
vector<ll>ed[MX/2];
ll dis[MX/2];
ll fin[MX/2];
ll cost2[MX];
ll seg[4*MX];
ll tim;
ll par[MX/2];
ll P[MX/2][50];
ll L[MX/2];
void build(ll n,ll l,ll r)
{
if(l==r)
{
seg[n]=cost2[l];
return;
}
ll mid=(l+r)/2;
build(n*2,l,mid);
build(n*2+1,mid+1,r);
seg[n]=seg[2*n]+seg[2*n+1];
}
void update(ll n,ll l,ll r,ll pos,ll val)
{
if(l==r)
{
seg[n]=val;
return;
}
ll mid=(l+r)/2;
if(pos<=mid)
update(2*n,l,mid,pos,val);
else
update(2*n+1,mid+1,r,pos,val);
seg[n]=seg[2*n]+seg[2*n+1];
}
ll query(ll n,ll L,ll R,ll l,ll r)
{
if(L>r||R<l)return 0;
if(L>=l&&R<=r)return seg[n];
ll mid=(L+R)/2;
ll x=query(n*2,L,mid,l,r);
ll y=query(n*2+1,mid+1,R,l,r);
return x+y;
}
void dfs(ll u,ll p)
{
par[u]=p;
L[u]=L[p]+1;
dis[u]=++tim;
cost2[dis[u]]=cost[u];
for(ll i=0; i<ed[u].size(); i++)
{
ll v=ed[u][i];
if(v==par[u])
continue;
//cout<<"call "<<v<<endl;
dfs(v,u);
}
fin[u]=++tim;
cost2[fin[u]]=-cost[u];
}
ll lca_query(ll N, ll p, ll q)
{
ll tmp, log, i;
if (L[p] < L[q])
tmp = p, p = q, q = tmp;
log=1;
while(1)
{
ll next=log+1;
if((1<<next)>L[p])
break;
log++;
}
for (i = log; i >= 0; i--)
if (L[p] - (1 << i) >= L[q])
p = P[p][i];
if (p == q)
return p;
for (i = log; i >= 0; i--)
if (P[p][i] != -1 && P[p][i] != P[q][i])
p = P[p][i], q = P[q][i];
return par[p];
}
void lca_init(ll N)
{
memset (P,-1,sizeof(P));
ll i,j;
for (i = 0; i < N; i++)
P[i][0] = par[i];
for (j = 1; (1 << j) < N; j++)
for (i = 0; i < N; i++)
if (P[i][j - 1] != -1)
P[i][j] = P[P[i][j - 1]][j - 1];
}
int main()
{
ll test;
sc1(test);
ll t=1;
while(test--)
{
ll n;
sc1(n);
for(ll i=0; i<n; i++)
sc1(cost[i]);
for(ll i=0;i<n;i++)
ed[i].clear();
for(ll i=1; i<n; i++)
{
ll u,v;
sc2(u,v);
ed[u].pb(v);
ed[v].pb(u);
}
tim=0;
dfs(0,-1);
build(1,1,2*n);
lca_init(n);
printf("Case %lld:\n",t++);
ll q;
sc1(q);
while(q--)
{
ll ty,x,y;
sc3(ty,x,y);
if(ty)
{
update(1,1,2*n,dis[x],y);
update(1,1,2*n,fin[x],-y);
cost[x]=y;
}
else
{
ll lca=lca_query(n,x,y);
ll ad1=query(1,1,2*n,dis[lca],dis[x]);
ll ad2=query(1,1,2*n,dis[lca],dis[y]);
ll now=ad1+ad2-cost[lca];
printf("%lld\n",now);
}
}
}
return 0;
}
|
[
"noreply@github.com"
] |
pkbhowmick.noreply@github.com
|
a48022dab032488cbfd879d16e0d3e715f91c4c4
|
6ad8a1bd5ba4bd8d499fa95987e2a32f3811f841
|
/CPP_Problems/Skiena Programming Challenges/3n+1 Problem.cpp
|
4f938001bc3c23cf8da0e6eb9ead0fbe36cb5057
|
[] |
no_license
|
Huddie/CPP_Problems
|
1ef1c71c2346034f196d5e086b56a91a28df39a9
|
8028ff8c68d154f39de30462dce7f67baec3468c
|
refs/heads/master
| 2021-09-02T12:27:47.307104
| 2018-01-02T16:22:42
| 2018-01-02T16:22:42
| 105,211,946
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 676
|
cpp
|
#include <iostream>
int main() {
unsigned int inNum, start = 1, end, count, highCount;
while(std::cin >> start) {
highCount = 0;
std::cin >> end;
std::cout << start;
std::cout << " " << end;
for(; start <= end; start += 1) {
unsigned int cycle = start;
count = 0;
while (cycle != 1) {
if (cycle % 2 == 0) /* is even */
cycle /= 2;
else /* odd */
cycle = (3 * cycle) + 1;
count += 1;
// q.enque(cycle);
}
if(count > highCount) highCount = count;
}
// Memo[q.front()] = q.size()
// q.deque
std::cout << " " << ++highCount << std::endl;
}
return 0;
}
|
[
"easports96@gmail.com"
] |
easports96@gmail.com
|
e5d5d251d02668ecde61fe7bfc1e632e7babd01a
|
0d60e85ea4a13eb3467cd1dd80ce31768cee02b4
|
/src/worker.cpp
|
6a36e6a0a254a9de25089f4e7b400ca223d0d43c
|
[
"OpenSSL",
"ISC",
"MIT",
"BSL-1.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
longamu/pipy
|
c6bd7e1b9d51f873c6284deb51195d89cade60bd
|
6f4ad83fad94e9cb67e9f43756df30e8b9ee8a94
|
refs/heads/main
| 2023-07-15T03:36:24.552356
| 2021-08-23T02:26:20
| 2021-08-23T02:26:20
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,743
|
cpp
|
/*
* Copyright (c) 2019 by flomesh.io
*
* Unless prior written consent has been obtained from the copyright
* owner, the following shall not be allowed.
*
* 1. The distribution of any source codes, header files, make files,
* or libraries of the software.
*
* 2. Disclosure of any source codes pertaining to the software to any
* additional parties.
*
* 3. Alteration or removal of any notices in or on the software or
* within the documentation included within the software.
*
* ALL SOURCE CODE AS WELL AS ALL DOCUMENTATION INCLUDED WITH THIS
* SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION, WITHOUT WARRANTY OF ANY
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "worker.hpp"
#include "module.hpp"
#include "task.hpp"
#include "event.hpp"
#include "message.hpp"
#include "session.hpp"
#include "api/algo.hpp"
#include "api/configuration.hpp"
#include "api/console.hpp"
#include "api/crypto.hpp"
#include "api/hessian.hpp"
#include "api/http.hpp"
#include "api/json.hpp"
#include "api/netmask.hpp"
#include "api/os.hpp"
#include "api/pipy.hpp"
#include "api/url.hpp"
#include "api/xml.hpp"
#include "logging.hpp"
#include <array>
#include <stdexcept>
extern void main_trigger_reload();
//
// Global
//
namespace pipy {
class Global : public pjs::ObjectTemplate<Global>
{
};
} // namespace pipy
namespace pjs {
using namespace pipy;
template<> void ClassDef<Global>::init() {
ctor();
// Object
variable("Object", class_of<Constructor<Object>>());
// Boolean
variable("Boolean", class_of<Constructor<Boolean>>());
// Number
variable("Number", class_of<Constructor<Number>>());
// String
variable("String", class_of<Constructor<String>>());
// Array
variable("Array", class_of<Constructor<Array>>());
// Date
variable("Date", class_of<Constructor<Date>>());
// RegExp
variable("RegExp", class_of<Constructor<RegExp>>());
// JSON
variable("JSON", class_of<JSON>());
// XML
variable("XML", class_of<XML>());
// Hessian
variable("Hessian", class_of<Hessian>());
// console
variable("console", class_of<Console>());
// os
variable("os", class_of<OS>());
// URL
variable("URL", class_of<Constructor<URL>>());
// Netmask
variable("Netmask", class_of<Constructor<Netmask>>());
// Session
variable("Session", class_of<Constructor<Session>>());
// Data
variable("Data", class_of<Constructor<pipy::Data>>());
// Message
variable("Message", class_of<Constructor<Message>>());
// MessageStart
variable("MessageStart", class_of<Constructor<MessageStart>>());
// MessageEnd
variable("MessageEnd", class_of<Constructor<MessageEnd>>());
// SessionEnd
variable("SessionEnd", class_of<Constructor<SessionEnd>>());
// http
variable("http", class_of<http::Http>());
// crypto
variable("crypto", class_of<crypto::Crypto>());
// algo
variable("algo", class_of<algo::Algo>());
// pipy
variable("pipy", class_of<Pipy>());
// repeat
method("repeat", [](Context &ctx, Object *obj, Value &ret) {
int count;
Function *f;
if (ctx.try_arguments(1, &f)) {
Value idx;
for (int i = 0;; i++) {
idx.set(i);
(*f)(ctx, 1, &idx, ret);
if (!ctx.ok()) break;
if (!ret.to_boolean()) break;
}
} else if (ctx.try_arguments(2, &count, &f)) {
Value idx;
for (int i = 0; i < count; i++) {
idx.set(i);
(*f)(ctx, 1, &idx, ret);
if (!ctx.ok()) break;
if (!ret.to_boolean()) break;
}
} else {
ctx.error_argument_type(0, "a function");
}
});
}
} // namespace pjs
//
// Worker
//
namespace pipy {
Worker* Worker::s_current = nullptr;
std::set<Worker*> Worker::s_all_workers;
Worker::Worker()
: m_global_object(Global::make())
{
s_all_workers.insert(this);
}
Worker::~Worker() {
if (s_current == this) s_current = nullptr;
s_all_workers.erase(this);
}
auto Worker::get_module(pjs::Str *filename) -> Module* {
auto i = m_module_name_map.find(filename);
if (i == m_module_name_map.end()) return nullptr;
return i->second;
}
auto Worker::find_module(const std::string &path) -> Module* {
auto i = m_module_map.find(path);
if (i == m_module_map.end()) return nullptr;
return i->second;
}
auto Worker::load_module(const std::string &path) -> Module* {
auto i = m_module_map.find(path);
if (i != m_module_map.end()) return i->second;
auto l = m_modules.size();
auto mod = new Module(this, l);
m_module_map[path] = mod;
m_module_name_map[pjs::Str::make(path)] = mod;
m_modules.push_back(mod);
if (!m_root) m_root = mod;
if (!mod->load(path)) return nullptr;
return mod;
}
void Worker::add_export(pjs::Str *ns, pjs::Str *name, Module *module) {
auto &names = m_namespaces[ns];
auto i = names.find(name);
if (i != names.end()) {
std::string msg("duplicated variable exporting name ");
msg += name->str();
msg += " from ";
msg += module->path();
throw std::runtime_error(msg);
}
names[name] = module;
}
auto Worker::get_export(pjs::Str *ns, pjs::Str *name) -> Module* {
auto i = m_namespaces.find(ns);
if (i == m_namespaces.end()) return nullptr;
auto j = i->second.find(name);
if (j == i->second.end()) return nullptr;
return j->second;
}
auto Worker::new_loading_context() -> Context* {
return new Context(nullptr, this, m_global_object);
}
auto Worker::new_runtime_context(Context *base) -> Context* {
auto data = ContextData::make(m_modules.size());
for (size_t i = 0; i < m_modules.size(); i++) {
pjs::Object *proto = nullptr;
if (base) proto = base->m_data->at(i);
data->at(i) = m_modules[i]->new_context_data(proto);
}
auto ctx = new Context(
base ? base->group() : nullptr,
this, m_global_object, data
);
if (base) ctx->m_inbound = base->m_inbound;
return ctx;
}
bool Worker::start() {
try {
for (auto i : m_modules) i->bind_exports();
for (auto i : m_modules) i->bind_imports();
for (auto i : m_modules) i->start();
s_current = this;
} catch (std::runtime_error &err) {
Log::error("%s", err.what());
return false;
}
for (auto *task : m_tasks) {
if (!task->start()) {
return false;
}
}
return true;
}
void Worker::stop() {
for (auto *task : m_tasks) {
task->stop();
}
m_tasks.clear();
}
} // namespace pipy
|
[
"pajamacoder@flomesh.io"
] |
pajamacoder@flomesh.io
|
6847e5b54bdd836d61ecb1e1fbbecc1c5bde9dff
|
b01e58e74ba0f989c5beb8f532eec2c11f5439b5
|
/CampIme2017/Day4/wall.cpp
|
c5400debe94fa2d8d7bd8b17b5e67b418e2f7a78
|
[] |
no_license
|
breno-helf/TAPA.EXE
|
54d56e2a2c15e709819c172695200479b1b34729
|
3ac36a3d2401a2d4861fc7a51ce9b1b6a20ab112
|
refs/heads/master
| 2021-01-19T11:18:15.958602
| 2018-08-03T22:25:03
| 2018-08-03T22:25:03
| 82,236,704
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 694
|
cpp
|
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i = a; i <= b; ++i)
const int maxn = 1e5 + 10;
int t, n;
int w[2][maxn];
int h[2][maxn];
int main(){
scanf("%d",&t);
while(t--){
scanf("%d",&n);
int hmin = INT_MAX;
int wmin = INT_MAX;
int hmax = INT_MIN;
int wmax = INT_MIN;
FOR(i,1,n){
scanf("%d%d%d%d",&w[0][i],&w[1][i],&h[0][i],&h[1][i]);
hmin = min(hmin,h[0][i]);
hmax = max(hmax,h[1][i]);
wmin = min(wmin,w[0][i]);
wmax = max(wmax,w[1][i]);
}
bool ok = 0;
FOR(i,1,n)
if(h[0][i] <= hmin && hmax <= h[1][i] && w[0][i] <= wmin && wmax <= w[1][i])
ok = true;
if(ok) printf("ANO\n");
else printf("NIE\n");
}
return 0;
}
|
[
"breno.moura@hotmail.com"
] |
breno.moura@hotmail.com
|
caa80c68c7cf5bb388abb3215bce4af3038e2b37
|
f8817ace5321a3ff1b0b5739604111dce658b6e2
|
/MPU6050_complementary/MPU6050_complementary.ino
|
ba59bacb7b04bbd20bce64b329a3fc1c3ea12457
|
[] |
no_license
|
HapCoderWei/MyArduino
|
8c2d326ed864eab2414fdacb13ea15c49b52fbec
|
9704c9bb6f9a59c61ef9d31ea4bca430df4fa1ef
|
refs/heads/master
| 2021-01-10T17:45:34.827262
| 2018-08-15T15:47:04
| 2018-08-15T15:47:04
| 48,595,973
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,047
|
ino
|
#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"
MPU6050 mpu;
#define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6)
bool blinkState = false;
// Use the following global variables and access functions to help store the overall
// rotation angle of the sensor
unsigned long last_read_time;
float last_x_angle; // These are the filtered angles
float last_y_angle;
float last_z_angle;
float last_gyro_x_angle; // Store the gyro angles to compare drift
float last_gyro_y_angle;
float last_gyro_z_angle;
void set_last_read_angle_data(unsigned long time, float x, float y, float z, float x_gyro, float y_gyro, float z_gyro) {
last_read_time = time;
last_x_angle = x;
last_y_angle = y;
last_z_angle = z;
last_gyro_x_angle = x_gyro;
last_gyro_y_angle = y_gyro;
last_gyro_z_angle = z_gyro;
}
inline unsigned long get_last_time() {return last_read_time;}
inline float get_last_x_angle() {return last_x_angle;}
inline float get_last_y_angle() {return last_y_angle;}
inline float get_last_z_angle() {return last_z_angle;}
inline float get_last_gyro_x_angle() {return last_gyro_x_angle;}
inline float get_last_gyro_y_angle() {return last_gyro_y_angle;}
inline float get_last_gyro_z_angle() {return last_gyro_z_angle;}
// Use the following global variables
// to calibrate the gyroscope sensor and accelerometer readings
float base_x_gyro = 0;
float base_y_gyro = 0;
float base_z_gyro = 0;
float base_x_accel = 0;
float base_y_accel = 0;
float base_z_accel = 0;
// This global variable tells us how to scale gyroscope data
float GYRO_FACTOR;
// This global varible tells how to scale acclerometer data
float ACCEL_FACTOR;
// Variables to store the values from the sensor readings
int16_t ax, ay, az;
int16_t gx, gy, gz;
unsigned long startLoop = 0;
unsigned long loopTime = 1;
unsigned int freq = 0;
// ================================================================
// === CALIBRATION_ROUTINE ===
// ================================================================
// Simple calibration - just average first few readings to subtract
// from the later data
void calibrate_sensors() {
int num_readings = 10;
// Discard the first reading (don't know if this is needed or
// not, however, it won't hurt.)
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
// Read and average the raw values
for (int i = 0; i < num_readings; i++) {
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
base_x_gyro += gx;
base_y_gyro += gy;
base_z_gyro += gz;
base_x_accel += ax;
base_y_accel += ay;
base_y_accel += az;
}
base_x_gyro /= num_readings;
base_y_gyro /= num_readings;
base_z_gyro /= num_readings;
base_x_accel /= num_readings;
base_y_accel /= num_readings;
base_z_accel /= num_readings;
}
void setup() {
// put your setup code here, to run once:
Wire.begin();
Serial.begin(57600);
// Set the full scale range of the gyro
uint8_t FS_SEL = 0;
//mpu.setFullScaleGyroRange(FS_SEL);
// get default full scale value of gyro - may have changed from default
// function call returns values between 0 and 3
uint8_t READ_FS_SEL = mpu.getFullScaleGyroRange();
Serial.print("FS_SEL = ");
Serial.println(READ_FS_SEL);
GYRO_FACTOR = 131.0/(FS_SEL + 1);
// get default full scale value of accelerometer - may not be default value.
// Accelerometer scale factor doesn't reall matter as it divides out
uint8_t READ_AFS_SEL = mpu.getFullScaleAccelRange();
Serial.print("AFS_SEL = ");
Serial.println(READ_AFS_SEL);
pinMode(LED_PIN, OUTPUT);
// get calibration values for sensors
calibrate_sensors();
set_last_read_angle_data(millis(), 0, 0, 0, 0, 0, 0);
}
void loop() {
// put your main code here, to run repeatedly:
const float RADIANS_TO_DEGREES = 57.2958; //180/3.14159
startLoop = micros();
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
// Get time of last raw data read
unsigned long t_now = millis();
// Remove offsets and scale gyro data
float gyro_x = (gx - base_x_gyro)/GYRO_FACTOR;
float gyro_y = (gy - base_y_gyro)/GYRO_FACTOR;
float gyro_z = (gz - base_z_gyro)/GYRO_FACTOR;
float accel_x = ax; // - base_x_accel;
float accel_y = ay; // - base_y_accel;
float accel_z = az; // - base_z_accel;
float accel_angle_y = atan(-1*accel_x/sqrt(pow(accel_y,2) + pow(accel_z,2)))*RADIANS_TO_DEGREES;
float accel_angle_x = atan(accel_y/sqrt(pow(accel_x,2) + pow(accel_z,2)))*RADIANS_TO_DEGREES;
float accel_angle_z = 0;
// Compute the (filtered) gyro angles
float dt =(t_now - get_last_time())/1000.0;
float gyro_angle_x = gyro_x*dt + get_last_x_angle();
float gyro_angle_y = gyro_y*dt + get_last_y_angle();
float gyro_angle_z = gyro_z*dt + get_last_z_angle();
// Compute the drifting gyro angles
float unfiltered_gyro_angle_x = gyro_x*dt + get_last_gyro_x_angle();
float unfiltered_gyro_angle_y = gyro_y*dt + get_last_gyro_y_angle();
float unfiltered_gyro_angle_z = gyro_z*dt + get_last_gyro_z_angle();
// Apply the complementary filter to figure out the change in angle - choice of alpha is
// estimated now. Alpha depends on the sampling rate...
const float alpha = 0.96;
float angle_x = alpha*gyro_angle_x + (1.0 - alpha)*accel_angle_x;
float angle_y = alpha*gyro_angle_y + (1.0 - alpha)*accel_angle_y;
float angle_z = gyro_angle_z; //Accelerometer doesn't give z-angle
// Update the saved data with the latest values
set_last_read_angle_data(t_now, angle_x, angle_y, angle_z, unfiltered_gyro_angle_x, unfiltered_gyro_angle_y, unfiltered_gyro_angle_z);
//Serial.print("CMP:");
Serial.print(get_last_x_angle(), 2);
Serial.print(" ");
Serial.print(get_last_y_angle(), 2);
Serial.print(" ");
Serial.println(-get_last_z_angle(), 2);
// Serial.print("\t");
// Serial.println(freq);
blinkState = !blinkState;
digitalWrite(LED_PIN, blinkState);
}
|
[
"taihengw@gmail.com"
] |
taihengw@gmail.com
|
2c35c53bb41d2281e65dd57d67d29096cb078108
|
674826516f037601155f727833823078435fb015
|
/算法/入门/reverseString/reverseString.cpp
|
7c5709ff09cd37508f87bb081daf411a063d08a6
|
[] |
no_license
|
smy-10/leetcode
|
1fd89f371600e33a64abd5768c57067f1b2b57d3
|
1cd286d224ef4047583d78d1d7c98ef36dc8f993
|
refs/heads/main
| 2023-09-05T18:32:40.511990
| 2021-11-11T06:12:30
| 2021-11-11T06:12:30
| 391,800,624
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,912
|
cpp
|
// reverseString.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
/*
编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 s 的形式给出。
不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。
示例 1:
输入:s = ["h","e","l","l","o"]
输出:["o","l","l","e","h"]
示例 2:
输入:s = ["H","a","n","n","a","h"]
输出:["h","a","n","n","a","H"]
提示:
1 <= s.length <= 105
s[i] 都是 ASCII 码表中的可打印字符
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/reverse-string
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
void reverseString(vector<char>& s)
{
int left = 0;
int right = s.size() - 1;
while (left < right)
{
char temp = s[right];
s[right] = s[left];
s[left] = temp;
left++;
right--;
}
}
};
int main()
{
Solution s;
vector<char> vec{ 'h','e' ,'l' ,'l' ,'o' };
s.reverseString(vec);
std::cout << "Hello World!\n";
}
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单
// 入门使用技巧:
// 1. 使用解决方案资源管理器窗口添加/管理文件
// 2. 使用团队资源管理器窗口连接到源代码管理
// 3. 使用输出窗口查看生成输出和其他消息
// 4. 使用错误列表窗口查看错误
// 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目
// 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件
|
[
"33865665+smy-10@users.noreply.github.com"
] |
33865665+smy-10@users.noreply.github.com
|
95b91db351b2d8c31022ccbdc0edd10a840ce39a
|
5671c626ee367c9aacb909cd76a06d2fadf941e2
|
/frameworks/core/accessibility/accessibility_utils.cpp
|
8eca508655ee0ca7b5d6a12e104ef62d3d0c33bc
|
[
"Apache-2.0"
] |
permissive
|
openharmony/ace_ace_engine
|
fa3f2abad9866bbb329524fb039fa89dd9517592
|
c9be21d0e8cb9662d5f4f93184fdfdb538c9d4e1
|
refs/heads/master
| 2022-07-21T19:32:59.377634
| 2022-05-06T11:18:20
| 2022-05-06T11:18:20
| 400,083,641
| 2
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,607
|
cpp
|
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* 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 "core/accessibility/accessibility_utils.h"
namespace OHOS::Ace {
const char ACCESSIBILITY_TAG_DIV[] = "div";
const char ACCESSIBILITY_TAG_CALENDAR[] = "calendar";
const char ACCESSIBILITY_TAG_TEXT[] = "text";
const char ACCESSIBILITY_TAG_PICKER[] = "picker";
const char ACCESSIBILITY_TAG_OPTION[] = "option";
const char ACCESSIBILITY_TAG_POPUP[] = "popup";
const char ACCESSIBILITY_TAG_PROGRESS[] = "progress";
const char ACCESSIBILITY_TAG_SELECT[] = "select";
const char ACCESSIBILITY_TAG_MENU[] = "menu";
const char ACCESSIBILITY_TAG_SLIDER[] = "slider";
const char ACCESSIBILITY_TAG_SPAN[] = "span";
const char ACCESSIBILITY_TAG_STACK[] = "stack";
const char ACCESSIBILITY_TAG_SWIPER[] = "swiper";
const char ACCESSIBILITY_TAG_SWITCH[] = "switch";
const char ACCESSIBILITY_TAG_TABS[] = "tabs";
const char ACCESSIBILITY_TAG_TAB_BAR[] = "tab-bar";
const char ACCESSIBILITY_TAG_TAB_CONTENT[] = "tab-content";
const char ACCESSIBILITY_TAG_REFRESH[] = "refresh";
const char ACCESSIBILITY_TAG_IMAGE[] = "image";
const char ACCESSIBILITY_TAG_LIST[] = "list";
const char ACCESSIBILITY_TAG_LIST_ITEM[] = "list-item";
const char ACCESSIBILITY_TAG_LIST_ITEM_GROUP[] = "list-item-group";
const char ACCESSIBILITY_TAG_VIDEO[] = "video";
const char ACCESSIBILITY_TAG_RATING[] = "rating";
const char ACCESSIBILITY_TAG_MARQUEE[] = "marquee";
const char ACCESSIBILITY_TAG_NAVIGATION_BAR[] = "navigation-bar";
const char ACCESSIBILITY_TAG_NAVIGATION_MENU[] = "navigation-menu";
const char ACCESSIBILITY_TAG_TEXTAREA[] = "textarea";
const char ACCESSIBILITY_TAG_INPUT[] = "input";
const char ACCESSIBILITY_TAG_LABEL[] = "label";
const char ACCESSIBILITY_TAG_DIVIDER[] = "divider";
const char ACCESSIBILITY_TAG_CANVAS[] = "canvas";
const char ACCESSIBILITY_TAG_BUTTON[] = "button";
const char ACCESSIBILITY_TAG_CHART[] = "chart";
const char ACCESSIBILITY_TAG_CLOCK[] = "clock";
const char ACCESSIBILITY_TAG_DIALOG[] = "dialog";
const char ACCESSIBILITY_TAG_SEARCH[] = "search";
} // namespace OHOS::Ace
|
[
"mamingshuai1@huawei.com"
] |
mamingshuai1@huawei.com
|
1b046e7067c62110336820345ab58256fbd55967
|
20fb95593cc0c97e53a5e78883408051269db0fc
|
/cpp_modules/sub/sub.cc
|
1288088d3200f01b169cb7eaa949f27a3adde77b
|
[] |
no_license
|
petrenkoVitaliy/ts_cpp
|
a7f26b87eaebba0b7d54fdfa12959ab7d4b609ec
|
b393b0ac10babd630204c1bc54a1187e441df82c
|
refs/heads/master
| 2023-09-04T16:45:48.823416
| 2021-11-22T01:12:51
| 2021-11-22T01:12:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 621
|
cc
|
#include <napi.h>
#include "sub.h"
Napi::Value Sub(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
if (info.Length() < 2) {
Napi::TypeError::New(env, "Wrong number of arguments")
.ThrowAsJavaScriptException();
return env.Null();
}
if (!info[0].IsNumber() || !info[1].IsNumber()) {
Napi::TypeError::New(env, "Wrong arguments").ThrowAsJavaScriptException();
return env.Null();
}
double arg0 = info[0].As<Napi::Number>().DoubleValue();
double arg1 = info[1].As<Napi::Number>().DoubleValue();
Napi::Number num = Napi::Number::New(env, arg0 - arg1);
return num;
}
|
[
"vitaliy.ptt@gmail.com"
] |
vitaliy.ptt@gmail.com
|
f2e371e72f0d1de2190b694c2ca29a97e50e462a
|
3f3a42f429f8bcd769644148b24c3b0e6e2589ed
|
/GameProjectCopy/GameEngine/GameApp/Light/vecmap.h
|
e919de9e51e3c12771e3801eaf82efb2793c14f3
|
[] |
no_license
|
DanielNeander/my-3d-engine
|
d10ad3e57a205f6148357f47467b550c7e0e0f33
|
7f0babbfdf0b719ea4b114a89997d3e52bcb2b6c
|
refs/heads/master
| 2021-01-10T17:58:25.691360
| 2013-04-24T07:37:31
| 2013-04-24T07:37:31
| 53,236,587
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,452
|
h
|
/******************************************************************************
"Practical Methods for Precomputed Radiance Transfer Using Spherical Harmonics"
Jerome Ko - submatrix@gmail.com
Manchor Ko - man961.great@gmail.com
Matthias Zwicker - mzwicker@cs.ucsd.edu
******************************************************************************/
#ifndef VECMAP_H
#define VECMAP_H
#include <malloc.h> //_alloca
#include <map>
namespace GEOM
{
/*!
-- VecMap: maintains a map of unique objects
*/
template <class T>
class VecMap {
public:
VecMap() : m_next(0) {}
~VecMap() {}
void Reset() { m_map.clear(); m_next = 0; }
size_t Size() const { return m_map.size(); }
/// inserts if 'v' is new. Return index for the entry.
int Add( const T& v ) {
int index;
Map::const_iterator ubegin = m_map.find( v );
if (ubegin != m_map.end()) {
index = ubegin->second;
}
else {
index = Insert(v);
}
return index;
}
/// insert a new entry:
int Insert( const T& v ) {
int index = m_next++;
m_map.insert( std::make_pair(v, index) );
return index;
}
/// locates
int FindIndex( const T& v ) const {
Map::const_iterator ubegin = m_map.find( v );
if (ubegin != m_map.end()) {
return ubegin->second;
}
return -1;
}
public:
typedef std::map<T,int> Map;
Map m_map;
int m_next;
}; //end VecMap
};
#endif
|
[
"Sangyong79@gmail.com"
] |
Sangyong79@gmail.com
|
3f93728c5bade4a533c21e00a667849e35db976c
|
d0629b6c3bdb64a8346cbb5049edc90d66d646f2
|
/gfx/angle/src/tests/egl_tests/EGLSurfaceTest.cpp
|
19fe79c476fed8c2350035fcdf224610172dff7c
|
[
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] |
permissive
|
h4writer/oomrepo
|
ccd08c506796af9e7e3a3c8131179bd0a0ab3ac3
|
6c533b04356f7ac59915928282a95070dc45d08c
|
refs/heads/master
| 2022-08-03T20:40:49.348969
| 2015-10-06T09:29:56
| 2015-10-06T09:29:56
| 43,739,681
| 0
| 0
|
NOASSERTION
| 2022-03-29T21:55:20
| 2015-10-06T08:53:22
| null |
UTF-8
|
C++
| false
| false
| 14,504
|
cpp
|
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// EGLSurfaceTest:
// Tests pertaining to egl::Surface.
//
#include <gtest/gtest.h>
#include <vector>
#include "OSWindow.h"
#include "test_utils/ANGLETest.h"
namespace
{
class EGLSurfaceTest : public testing::Test
{
protected:
EGLSurfaceTest()
: mDisplay(EGL_NO_DISPLAY),
mWindowSurface(EGL_NO_SURFACE),
mPbufferSurface(EGL_NO_SURFACE),
mContext(EGL_NO_CONTEXT),
mSecondContext(EGL_NO_CONTEXT),
mOSWindow(nullptr)
{
}
void SetUp() override
{
mOSWindow = CreateOSWindow();
mOSWindow->initialize("EGLSurfaceTest", 64, 64);
}
// Release any resources created in the test body
void TearDown() override
{
if (mDisplay != EGL_NO_DISPLAY)
{
eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (mWindowSurface != EGL_NO_SURFACE)
{
eglDestroySurface(mDisplay, mWindowSurface);
mWindowSurface = EGL_NO_SURFACE;
}
if (mPbufferSurface != EGL_NO_SURFACE)
{
eglDestroySurface(mDisplay, mPbufferSurface);
mPbufferSurface = EGL_NO_SURFACE;
}
if (mContext != EGL_NO_CONTEXT)
{
eglDestroyContext(mDisplay, mContext);
mContext = EGL_NO_CONTEXT;
}
if (mSecondContext != EGL_NO_CONTEXT)
{
eglDestroyContext(mDisplay, mSecondContext);
mSecondContext = EGL_NO_CONTEXT;
}
eglTerminate(mDisplay);
mDisplay = EGL_NO_DISPLAY;
}
mOSWindow->destroy();
SafeDelete(mOSWindow);
ASSERT_TRUE(mWindowSurface == EGL_NO_SURFACE && mContext == EGL_NO_CONTEXT);
}
void initializeDisplay(EGLenum platformType)
{
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
ASSERT_TRUE(eglGetPlatformDisplayEXT != nullptr);
std::vector<EGLint> displayAttributes;
displayAttributes.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
displayAttributes.push_back(platformType);
displayAttributes.push_back(EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE);
displayAttributes.push_back(EGL_DONT_CARE);
displayAttributes.push_back(EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE);
displayAttributes.push_back(EGL_DONT_CARE);
if (platformType == EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE || platformType == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{
displayAttributes.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE);
displayAttributes.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
}
displayAttributes.push_back(EGL_NONE);
mDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, mOSWindow->getNativeDisplay(), displayAttributes.data());
ASSERT_TRUE(mDisplay != EGL_NO_DISPLAY);
EGLint majorVersion, minorVersion;
ASSERT_TRUE(eglInitialize(mDisplay, &majorVersion, &minorVersion) == EGL_TRUE);
eglBindAPI(EGL_OPENGL_ES_API);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
}
void initializeSurface(EGLConfig config)
{
mConfig = config;
std::vector<EGLint> surfaceAttributes;
surfaceAttributes.push_back(EGL_NONE);
surfaceAttributes.push_back(EGL_NONE);
// Create first window surface
mWindowSurface = eglCreateWindowSurface(mDisplay, mConfig, mOSWindow->getNativeWindow(), &surfaceAttributes[0]);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
mPbufferSurface = eglCreatePbufferSurface(mDisplay, mConfig, &surfaceAttributes[0]);
EGLint contextAttibutes[] =
{
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
mContext = eglCreateContext(mDisplay, mConfig, nullptr, contextAttibutes);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
mSecondContext = eglCreateContext(mDisplay, mConfig, nullptr, contextAttibutes);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
}
void initializeSurfaceWithDefaultConfig()
{
const EGLint configAttributes[] =
{
EGL_RED_SIZE, EGL_DONT_CARE,
EGL_GREEN_SIZE, EGL_DONT_CARE,
EGL_BLUE_SIZE, EGL_DONT_CARE,
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_DEPTH_SIZE, EGL_DONT_CARE,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_SAMPLE_BUFFERS, 0,
EGL_NONE
};
EGLint configCount;
EGLConfig config;
ASSERT_TRUE(eglChooseConfig(mDisplay, configAttributes, &config, 1, &configCount) || (configCount != 1) == EGL_TRUE);
initializeSurface(config);
}
GLuint createProgram()
{
const std::string testVertexShaderSource = SHADER_SOURCE
(
attribute highp vec4 position;
void main(void)
{
gl_Position = position;
}
);
const std::string testFragmentShaderSource = SHADER_SOURCE
(
void main(void)
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
);
return CompileProgram(testVertexShaderSource, testFragmentShaderSource);
}
void drawWithProgram(GLuint program)
{
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
GLint positionLocation = glGetAttribLocation(program, "position");
glUseProgram(program);
const GLfloat vertices[] =
{
-1.0f, 1.0f, 0.5f,
-1.0f, -1.0f, 0.5f,
1.0f, -1.0f, 0.5f,
-1.0f, 1.0f, 0.5f,
1.0f, -1.0f, 0.5f,
1.0f, 1.0f, 0.5f,
};
glVertexAttribPointer(positionLocation, 3, GL_FLOAT, GL_FALSE, 0, vertices);
glEnableVertexAttribArray(positionLocation);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableVertexAttribArray(positionLocation);
glVertexAttribPointer(positionLocation, 4, GL_FLOAT, GL_FALSE, 0, NULL);
EXPECT_PIXEL_EQ(mOSWindow->getWidth() / 2, mOSWindow->getHeight() / 2, 255, 0, 0, 255);
}
void runMessageLoopTest(EGLSurface secondSurface, EGLContext secondContext)
{
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
// Make a second context current
eglMakeCurrent(mDisplay, secondSurface, secondSurface, secondContext);
eglDestroySurface(mDisplay, mWindowSurface);
// Create second window surface
std::vector<EGLint> surfaceAttributes;
surfaceAttributes.push_back(EGL_NONE);
surfaceAttributes.push_back(EGL_NONE);
mWindowSurface = eglCreateWindowSurface(mDisplay, mConfig, mOSWindow->getNativeWindow(), &surfaceAttributes[0]);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
mOSWindow->signalTestEvent();
mOSWindow->messageLoop();
ASSERT_TRUE(mOSWindow->didTestEventFire());
// Simple operation to test the FBO is set appropriately
glClear(GL_COLOR_BUFFER_BIT);
}
EGLDisplay mDisplay;
EGLSurface mWindowSurface;
EGLSurface mPbufferSurface;
EGLContext mContext;
EGLContext mSecondContext;
EGLConfig mConfig;
OSWindow *mOSWindow;
};
// Test a surface bug where we could have two Window surfaces active
// at one time, blocking message loops. See http://crbug.com/475085
TEST_F(EGLSurfaceTest, MessageLoopBug)
{
const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{
std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return;
}
initializeDisplay(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
initializeSurfaceWithDefaultConfig();
runMessageLoopTest(EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
// Tests the message loop bug, but with setting a second context
// instead of null.
TEST_F(EGLSurfaceTest, MessageLoopBugContext)
{
const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{
std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return;
}
initializeDisplay(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
initializeSurfaceWithDefaultConfig();
runMessageLoopTest(mPbufferSurface, mSecondContext);
}
// Test a bug where calling makeCurrent twice would release the surface
TEST_F(EGLSurfaceTest, MakeCurrentTwice)
{
initializeDisplay(EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
initializeSurfaceWithDefaultConfig();
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
// Simple operation to test the FBO is set appropriately
glClear(GL_COLOR_BUFFER_BIT);
}
// Test that the D3D window surface is correctly resized after calling swapBuffers
TEST_F(EGLSurfaceTest, ResizeD3DWindow)
{
const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{
std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return;
}
initializeDisplay(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
initializeSurfaceWithDefaultConfig();
eglSwapBuffers(mDisplay, mWindowSurface);
ASSERT_EGL_SUCCESS();
EGLint height;
eglQuerySurface(mDisplay, mWindowSurface, EGL_HEIGHT, &height);
ASSERT_EGL_SUCCESS();
ASSERT_EQ(64, height); // initial size
// set window's height to 0
mOSWindow->resize(64, 0);
eglSwapBuffers(mDisplay, mWindowSurface);
ASSERT_EGL_SUCCESS();
eglQuerySurface(mDisplay, mWindowSurface, EGL_HEIGHT, &height);
ASSERT_EGL_SUCCESS();
ASSERT_EQ(0, height);
// restore window's height
mOSWindow->resize(64, 64);
eglSwapBuffers(mDisplay, mWindowSurface);
ASSERT_EGL_SUCCESS();
eglQuerySurface(mDisplay, mWindowSurface, EGL_HEIGHT, &height);
ASSERT_EGL_SUCCESS();
ASSERT_EQ(64, height);
}
// Test creating a surface that supports a EGLConfig with 16bit
// support GL_RGB565
TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support)
{
const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{
std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return;
}
const EGLint configAttributes[] =
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 0,
EGL_STENCIL_SIZE, 0,
EGL_SAMPLE_BUFFERS, 0,
EGL_NONE
};
initializeDisplay(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
EGLConfig config;
if (EGLWindow::FindEGLConfig(mDisplay, configAttributes, &config) == EGL_FALSE)
{
std::cout << "EGLConfig for a GL_RGB565 surface is not supported, skipping test" << std::endl;
return;
}
initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram();
drawWithProgram(program);
EXPECT_GL_NO_ERROR();
glDeleteProgram(program);
}
// Test creating a surface that supports a EGLConfig with 16bit
// support GL_RGBA4
TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support)
{
const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{
std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return;
}
const EGLint configAttributes[] =
{
EGL_RED_SIZE, 4,
EGL_GREEN_SIZE, 4,
EGL_BLUE_SIZE, 4,
EGL_ALPHA_SIZE, 4,
EGL_DEPTH_SIZE, 0,
EGL_STENCIL_SIZE, 0,
EGL_SAMPLE_BUFFERS, 0,
EGL_NONE
};
initializeDisplay(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
EGLConfig config;
if (EGLWindow::FindEGLConfig(mDisplay, configAttributes, &config) == EGL_FALSE)
{
std::cout << "EGLConfig for a GL_RGBA4 surface is not supported, skipping test" << std::endl;
return;
}
initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram();
drawWithProgram(program);
EXPECT_GL_NO_ERROR();
glDeleteProgram(program);
}
// Test creating a surface that supports a EGLConfig with 16bit
// support GL_RGB5_A1
TEST_F(EGLSurfaceTest, CreateWithEGLConfig5551Support)
{
const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{
std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return;
}
const EGLint configAttributes[] =
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 5,
EGL_BLUE_SIZE, 5,
EGL_ALPHA_SIZE, 1,
EGL_DEPTH_SIZE, 0,
EGL_STENCIL_SIZE, 0,
EGL_SAMPLE_BUFFERS, 0,
EGL_NONE
};
initializeDisplay(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
EGLConfig config;
if (EGLWindow::FindEGLConfig(mDisplay, configAttributes, &config) == EGL_FALSE)
{
std::cout << "EGLConfig for a GL_RGB5_A1 surface is not supported, skipping test" << std::endl;
return;
}
initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram();
drawWithProgram(program);
EXPECT_GL_NO_ERROR();
glDeleteProgram(program);
}
}
|
[
"hv1989@gmail.com"
] |
hv1989@gmail.com
|
98e8139f5f6d1caf0efcd6a5421f1bbca5cdcfca
|
3af68b32aaa9b7522a1718b0fc50ef0cf4a704a9
|
/cpp/A/C/D/B/A/AACDBA.h
|
17befe74563ec6dff62d1da082f7435138dc50f6
|
[] |
no_license
|
devsisters/2021-NDC-ICECREAM
|
7cd09fa2794cbab1ab4702362a37f6ab62638d9b
|
ac6548f443a75b86d9e9151ff9c1b17c792b2afd
|
refs/heads/master
| 2023-03-19T06:29:03.216461
| 2021-03-10T02:53:14
| 2021-03-10T02:53:14
| 341,872,233
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 67
|
h
|
#ifndef AACDBA_H
namespace AACDBA {
std::string run();
}
#endif
|
[
"nakhyun@devsisters.com"
] |
nakhyun@devsisters.com
|
e15b7dc95595f5f205a7c2286e5751b4e4913159
|
0caf226a49cd34bea109e23ef03b834b6726fbcf
|
/TP4/Ej2/poblacion.h
|
db2be2c15ad8ea094c74132f60367de6569dc18f
|
[] |
no_license
|
gtessi/IC2013-FICH
|
6d41979659595fa0d0dbfdfe87698ab8835e87d8
|
34ed7ea69d034f85a84cd9c87a930269406b37c1
|
refs/heads/master
| 2020-03-27T05:48:40.799030
| 2018-08-25T02:06:09
| 2018-08-25T02:06:09
| 146,052,979
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 5,098
|
h
|
class poblacion{
private:
vector<individuo> pueblo;
vector<individuo> progenitores;
individuo Elite, Peor;
int cantPoblacion,iteracion=0;
float probMutacion=0.01;
vector< vector <float > > Ciudades;
vector <float > promv,elitev,peorv;
public:
// poblacion vacía
poblacion(){cantPoblacion=0;}
// definimos la poblacion y ya la inicializamos al azar
poblacion(int cantPobla, vector< vector <float> > City){
cantPoblacion=cantPobla;
Ciudades=City;
int nCiudades = Ciudades.size();
for(int i=0;i<cantPoblacion;i++){
pueblo.push_back(individuo(nCiudades));
}
}
// *********************** ESTE METODO NO HAY QUE TOCARLO *********************
// SELECCIONAR LOS PROGENITORES
void selectProgenitores(int porcentaje){
int cantProg = cantPoblacion * double(porcentaje) /100.0;
if(cantPoblacion<cantProg){
cout<<"Error cantidad de progenitores"<<endl;
return;}
int ventana=cantPoblacion;
vector< vector< float > > people;
vector<float> aux;
// Calculamos el fitness para todos los individuos
// y los linkeamos con su posicion j
for(int j=0;j<cantPoblacion;j++){
aux.push_back(j);
aux.push_back(pueblo[j].fitness(Ciudades));
people.push_back(aux);
aux.clear();
}
// ordenamos los individuos para luego elegirlos
int posAux;
for(int i=0;i<cantPoblacion-1;i++){
aux.push_back(i);
aux.push_back(people[i][1]);
posAux=i;
// es un ordenamiento burbuja
for(int j=i+1;j<cantPoblacion;j++){
if(people[j][1]<aux[1]){
aux[1]=people[j][1];
aux[0]=people[j][0];
posAux=j;
}
}
// hacemos el cambio entre el mayor i con el que
// esta en la posicion i
people[posAux][0] = people[i][0];
people[posAux][1] = people[i][1];
people[i][0] = aux[0];
people[i][1] = aux[1];
aux.clear();
}
Elite = pueblo[people[0][0]];
Peor = pueblo[people[cantPoblacion-1][0]];
float cteVarVentana = (ventana-cantProg)/cantProg;
for(int i=0;i<cantProg;i++){
progenitores.push_back(
pueblo[people[int(ventana*(rand()/float(RAND_MAX)))][0]]);
ventana= ventana - cteVarVentana;
}
}
// Una vez elegidos los progenitores tenemos que mezclarlos entre si
// con una probabilidad de mutacion
void mezclarProgenitores(){
iteracion++;
individuo nuevo1,nuevo2;
int cantProg = progenitores.size();
// Variables para la mezcla, la idea es usar todos los progenitores para
// mezclar
int cantVeces = cantPoblacion / cantProg, cantPoblacionBack=cantPoblacion,
posRandom,cant=(Ciudades.size()-1)*rand()/float(RAND_MAX);
// borramos el viejo poblado
pueblo.clear();
cantPoblacion=0;
cantVeces=cantVeces/2;
// Con elitismo
pueblo.push_back(Elite);
for (int i=0;i<cantProg;i++){
for(int j=0;j<cantVeces;j++){
posRandom=int(cantProg*(rand()/float(RAND_MAX)));
if(posRandom==i){
j--;
continue;}
progenitores[i].cruzarConI(progenitores[posRandom], cant, nuevo1, nuevo2);
// ********************* PROBABILIDAD DE MUTACION ************************
if(rand()/float(RAND_MAX)<probMutacion)
nuevo1.mutar();
if(rand()/float(RAND_MAX)<probMutacion)
nuevo2.mutar();
pueblo.push_back(nuevo1);pueblo.push_back(nuevo2);
nuevo1.clear();nuevo2.clear();
cantPoblacion+=2;
}
}
while(cantPoblacion<cantPoblacionBack){
int posRandomi=int(cantProg*(rand()/float(RAND_MAX))),
posRandomj=int(cantProg*(rand()/float(RAND_MAX)));
progenitores[posRandomi].cruzarConI(progenitores[posRandomj],cant, nuevo1,nuevo2);
pueblo.push_back(nuevo1);pueblo.push_back(nuevo2);
nuevo1.clear();nuevo2.clear();
cantPoblacion+=2;
}
}
// *************** DIBUJAR ****************
void dibIteracion(){
float fitnessProm=0,fitnessPeor=0,fitnessElite=0;
for(int i=0;i<cantPoblacion;i++){
fitnessProm+=pueblo[i].fitness(Ciudades);
}
fitnessProm = fitnessProm/float(cantPoblacion);
fitnessElite = Elite.fitness(Ciudades);
fitnessPeor = Peor.fitness(Ciudades);
elitev.push_back(fitnessElite);
promv.push_back(fitnessProm);
peorv.push_back(fitnessPeor);
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPointSize(3);
glBegin(GL_LINES);
for(int i=0;i<iteracion-1;i++){
glColor3f(1.0,.0,.0);
glVertex2f(i,elitev[i]);
glVertex2f(i+1,elitev[i+1]);
glColor3f(.0,1.0,.0);
glVertex2f(i,promv[i]);
glVertex2f(i+1,promv[i+1]);
glColor3f(.0,.0,1.0);
glVertex2f(i,peorv[i]);
glVertex2f(i+1,peorv[i+1]);
}
glEnd();
glPopAttrib();
}
// *************** SHOWWWW ****************
void mostrarIndiI(int i){
if(i>cantPoblacion)
cout<<"Error, no existe ese numero de individuo"<<endl;
pueblo[i].mostrarIndi();
}
void mostrarTodo(){
for(int i=0;i<cantPoblacion;i++){
cout<<i<<": ";
pueblo[i].mostrarIndi();
cout<<endl;
}
}
void showPeor(){
cout<<"Peor: ";
Peor.mostrarIndi();
cout<<"f(x): "<<Peor.fitness(Ciudades)<<endl;
}
void showBest(){
cout<<"Elite: ";
Elite.mostrarIndi();
cout<<"f(x): "<<Elite.fitness(Ciudades)<<endl;
}
};
|
[
"noreply@github.com"
] |
gtessi.noreply@github.com
|
83dea1fb9c54b809bc3b64e9bb7ae72dd7e37e32
|
f8e473cfde05425d873e8138f854c248f95701ee
|
/CPP-08/ex01/Span.hpp
|
aca10c52b0466571d243abfe2b15d30625090bfd
|
[] |
no_license
|
Ourobore/CPP-Modules
|
cc29150d1c1dc8808c6d62d3c44190ce91ae0b80
|
a15c25dd3407c5ccdb7d67654e2009534c36d891
|
refs/heads/master
| 2023-07-15T18:35:59.999433
| 2021-08-25T08:50:59
| 2021-08-25T08:50:59
| 377,454,565
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,539
|
hpp
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Span.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: user42 <user42@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/20 10:30:18 by lchapren #+# #+# */
/* Updated: 2021/08/24 14:34:35 by user42 ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SPAN_HPP
# define SPAN_HPP
# include <iostream>
# include <climits>
# include <cstdlib>
# include <ctime>
# include <vector>
# include <algorithm>
class Span
{
private:
std::vector<int> _array;
unsigned int _N;
public:
Span(void);
Span(unsigned int N);
Span(Span const &rhs);
Span& operator=(Span const &rhs);
~Span(void);
void addNumber(int number);
void addNumber(int number, unsigned int range);
void addNumber(std::vector<int> range);
unsigned int shortestSpan(void);
unsigned int longestSpan(void);
std::vector<int>& getArray(void);
};
std::ostream& operator<<(std::ostream& o, Span &rhs);
#endif
|
[
"chaprenet.loic@gmail.com"
] |
chaprenet.loic@gmail.com
|
5af0e4abfd6f1ae4f2604b96834f841f339dd055
|
b296af8325e1964e8c1d82d74bfc4d84fcd49feb
|
/Classes/ui_layer.cpp
|
afdcb186233661eb2f5f38523fc4e19569da84d1
|
[] |
no_license
|
jj918160/GreatMonster
|
3c0f8c53e2652a0cd41968e83763c9237050a7a8
|
fda2989d0f370c0aefa184c21c277d1a43ac3086
|
refs/heads/master
| 2016-09-13T05:34:25.446673
| 2016-04-25T00:04:16
| 2016-04-25T00:04:16
| 56,599,046
| 0
| 1
| null | 2016-04-24T12:49:27
| 2016-04-19T13:27:48
|
Java
|
UTF-8
|
C++
| false
| false
| 7,308
|
cpp
|
//
// ui_layer.cpp
// 3D_fight
//
// Created by mac on 15-10-7.
//
//
#include "ui_layer.h"
#include "City_layer.h"
#include "GameScene.h"
#include "Charecter1.h"
#include "SimpleAudioEngine.h"
using namespace CocosDenshion;
int ui_layer::fight_fit=0;
bool ui_layer::init()
{
if ( !Layer::init() )
{
return false;
}
SimpleAudioEngine::getInstance()->playBackgroundMusic("voice/048.mp3",true);
SimpleAudioEngine::getInstance()->setBackgroundMusicVolume(0.2);
SimpleAudioEngine::getInstance()->setEffectsVolume(1.f);
run=false;
deltax=0.f;
deltaz=0.f;
rokerPosition=Vec2(200,150);
Sprite *spRockerBG=CCSprite::create("CG-1086.png");
spRockerBG->setPosition(rokerPosition);
spRockerBG->setOpacity(50);
addChild(spRockerBG,1);
rockerBGR=spRockerBG->getContentSize().width*0.5;
auto spRockerF = Sprite::create("CG-7005.png");
spRockerF->setPosition(rokerPosition);
addChild(spRockerF, 2,1);
auto attlistener=EventListenerTouchOneByOne::create();
attlistener->onTouchBegan=[=](Touch*touch,Event*event){
auto target=static_cast<Sprite*>(event->getCurrentTarget());
Vec2 locationInNode=target->convertToNodeSpace(touch->getLocation());
Size s=target->getContentSize();//点到判断碰撞
Rect rect=Rect(0,0,s.width,s.height);
if (rect.containsPoint(locationInNode)) {
ui_layer::fight_fit=0;
City_layer*gm=(City_layer*)this->getParent()->getChildByTag(1);
Charecter1*spp=static_cast<Charecter1*>(gm->getChildByTag(9));
if (run)
{
spp->run();
SimpleAudioEngine::getInstance()->playEffect("voice/runn.wav",true,0.6f);
}
else
{
spp->walk();
SimpleAudioEngine::getInstance()->playEffect("voice/walk.wav",true,0.6f);
}
return true;
}
return false;
};
attlistener->onTouchMoved=[&](Touch*touch,Event*event){
Vec2 point=touch->getLocation();
auto target=static_cast<Sprite*>(event->getCurrentTarget());
if (sqrt(pow((rokerPosition.x-point.x),2)+pow((rokerPosition.y-point.y),2))>=rockerBGR){
float angle=getRad(point);
target->setPosition(ccpAdd(getAnglePosition(rockerBGR, angle),rokerPosition));
}else{
target->setPosition(target->getPosition()+touch->getDelta());
}
float px=point.x-rokerPosition.x;
float pz=point.y-rokerPosition.y;
Vec2 temp=Vec2(px,pz);
temp.normalize();
deltax=temp.x;
deltaz=-temp.y;
//玩家变向
City_layer*gm=(City_layer*)this->getParent()->getChildByTag(1);
float dx=deltax*cos(gm->_rotation)+deltaz*sin(gm->_rotation);
float dy=-deltax*sin(gm->_rotation)+deltaz*cos(gm->_rotation);
if (dy<=0) {
gm->_firstrotation=-CC_RADIANS_TO_DEGREES(asin(dx))-90;
}
else{
gm->_firstrotation=CC_RADIANS_TO_DEGREES(asin(dx))+90;
}
gm->getChildByTag(9)->setRotation3D(Vec3(0,gm->_firstrotation-90,0));
};
attlistener->onTouchEnded=[&](Touch*touch,Event*event){
Sprite *spRockerF=(Sprite*)this->getChildByTag(1);
// spRockerF->runAction(CCMoveTo::create(0.05, rokerPosition));
spRockerF->setPosition(rokerPosition);
deltax=0;
deltaz=0;
City_layer*gm=(City_layer*)this->getParent()->getChildByTag(1);
Charecter1*spp=(Charecter1*)gm->getChildByTag(9);
spp->stand();
SimpleAudioEngine::getInstance()->stopAllEffects();
};
attlistener->setSwallowTouches(true);
Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(attlistener,spRockerF);
// auto item=MenuItemImage::create("CG-1492.png", "CG-1493.png", CC_CALLBACK_1(ui_layer::callback2,this));
// item->setPosition(100,600);
//
//
// auto item2=MenuItemImage::create("CG-1487.png", "CG-1486.png", CC_CALLBACK_1(ui_layer::changeCamera,this));
// item2->setPosition(860,600);
//
auto item=MenuItemImage::create("att1.png", "att2.png", CC_CALLBACK_1(ui_layer::attack,this));
item->setPosition(800,150);
//
auto tol=MenuItemToggle::createWithCallback(CC_CALLBACK_1(ui_layer::is_run,this),
MenuItemImage::create("CG-1494.png", "CG-1494.png"),
MenuItemImage::create("CG-1493.png", "CG-1493.png"),
NULL);
tol->setPosition(50,600);
//
auto menu=Menu::create(item,tol,NULL);
menu->setPosition(0,0);
this->addChild(menu);
auto sp_hp=Sprite::create("CG-1087.png");
auto hp=ProgressTimer::create(sp_hp);
hp->setType(ProgressTimer::Type::BAR);
hp->setPercentage(Charecter1::_hp*2);
hp->setPosition(820,620);
hp->setMidpoint(Vec2(1,0));
hp->setBarChangeRate(Vec2(1,0));
addChild(hp,0,10);
char text[64];
sprintf(text,"%d/50", Charecter1::_hp);
auto hp_str=Label::createWithBMFont("bitmapFontTest.fnt", text);
hp_str->setPosition(820,580);
addChild(hp_str,0,9);
scheduleUpdate();
return true;
}
void ui_layer::update(float dt)
{
auto hp=(ProgressTimer*)this->getChildByTag(10);
hp->setPercentage(Charecter1::_hp*2);
char text[64];
sprintf(text,"%d/50", Charecter1::_hp);
auto hp_text=(Label*)this->getChildByTag(9);
hp_text->setString(text);
}
float ui_layer::getRad(Vec2 pos1){
float px1=pos1.x;
float py1=pos1.y;
float x=px1-rokerPosition.x;
float y=py1-rokerPosition.y;
float xie=sqrt(pow(x,2)+pow(y,2));
float cosAngle=x/xie;
float rad=acos(cosAngle);
if (py1<rokerPosition.y) {
rad=-rad;
}
return rad;
}
Vec2 ui_layer::getAnglePosition(float r,float angle){
return Vec2(r*cos(angle),r*sin(angle));
}
//void ui_layer::changeCamera(Ref* psender){
// GameLayer*gm=(GameLayer*)this->getParent()->getChildByTag(1);
// gm->pCamera_I->setCameraFlag(CameraFlag::USER1);
// gm->pCamera_III->setCameraFlag(CameraFlag::USER2);
// gm->firstperson=true;
// //this->getScene()->setPhysics3DDebugCamera(gm->pCamera_I);
//}
//
//void ui_layer::callback2(Ref* psender){
// GameLayer*gm=(GameLayer*)this->getParent()->getChildByTag(1);
// gm->pCamera_I->setCameraFlag(CameraFlag::USER2);
// gm->pCamera_III->setCameraFlag(CameraFlag::USER1);
// gm->firstperson=false;
// float deltax=200*sin(gm->rotation);//x增量
// float deltaz=200*cos(gm->rotation);//z增量
// gm->pCamera_III->setPosition3D(gm->pla->getChildByTag(2)->getPosition3D()+Vec3(deltax,110,deltaz));
// gm->pCamera_III->lookAt(gm->pla->getChildByTag(2)->getPosition3D());
// // this->getScene()->setPhysics3DDebugCamera(gm->pCamera_III);
//}
void ui_layer::attack(Ref* psender)
{
fight_fit++;
City_layer*gm=(City_layer*)this->getParent()->getChildByTag(1);
Charecter1*spp=(Charecter1*)gm->getChildByTag(9);
spp->attack_1();
}
void ui_layer::is_run(Ref*psender){
run=!run;
}
|
[
"446413497@qq.com"
] |
446413497@qq.com
|
e348a81aad280ba10d8fe7579ecb459375e24727
|
cfe48cd7ac1ec158e389d8c821c8ffaa37265f38
|
/aeda1920_fp10/Tests/caixa.cpp
|
0464c973786398f579b28cbf7b553fddc5c29445
|
[] |
no_license
|
goncaloacteixeira/feup-aeda
|
b2e69cad54149d851b11c8800c78a21b15ba7b41
|
33a39f023a704f2536a49647d5988ed85af599c8
|
refs/heads/master
| 2023-08-18T10:05:22.592545
| 2020-01-13T18:49:35
| 2020-01-13T18:49:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,290
|
cpp
|
#include "caixa.h"
#include <sstream>
Objeto::Objeto(unsigned idObj, unsigned pesoObj): id(idObj), peso(pesoObj)
{}
unsigned Objeto::getID() const {
return id;
}
unsigned Objeto::getPeso() const {
return peso;
}
Caixa::Caixa(unsigned cap): id(ultimoId++), capacidade(cap), cargaLivre(cap)
{}
unsigned Caixa::getID() const {
return id;
}
unsigned Caixa::getCargaLivre() const {
return cargaLivre;
}
void Caixa::addObjeto(Objeto& obj) {
cargaLivre -= obj.getPeso();
objetos.push(obj);
}
void Caixa::resetID(){
ultimoId = 1;
}
unsigned Caixa::getSize() const {
return objetos.size();
}
ostream& operator<<(ostream& os, Objeto obj) {
os << "O" << obj.id << ": " << obj.peso;
return os;
}
unsigned Caixa::ultimoId = 1;
bool Objeto::operator<(const Objeto& o1) const {
return this->getPeso() < o1.getPeso();
}
bool Caixa::operator<(const Caixa& c1) const {
return this->getCargaLivre() > c1.getCargaLivre();
}
string Caixa::imprimeConteudo() const {
if (!this->objetos.empty()) {
stringstream ss;
ss << "C" << this->id << "[ ";
STACK_OBJS copy = objetos;
while (!copy.empty()) {
ss << copy.top() << " ";
copy.pop();
}
ss << "]";
return ss.str();
}
return "Caixa " + to_string(this->id) + " vazia!\n";
}
|
[
"Teixeira_2000"
] |
Teixeira_2000
|
3ac26185d4691476d721a666ea395d12887e9e47
|
ad57b429464a9571d98b9ff74e31a1cbf13c5a42
|
/avencoder/avencoder.cpp
|
780c1958a0290eb0edc852e88ff911f40a61c241
|
[] |
no_license
|
github188/avencoder_nvidia
|
9f4c236dd144b5877d18459636f2bf95d98a15e3
|
ff853db58e1f8295a57fc10faa9b75250c61672f
|
refs/heads/master
| 2020-03-19T07:19:46.785894
| 2015-09-22T09:00:51
| 2015-09-22T09:00:51
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 18,181
|
cpp
|
#include "videosource.h"
#include "videoencoder.h"
#include "audioencoder.h"
#include "audiosource.h"
#include "avmuxer.h"
#include "tssmooth.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <pthread.h>
#include <getopt.h>
#include <errno.h>
#define version_str "1.0.00.15"
const int delaytimeus = 40;
int first_frame = 1;
audio_source_t* p_audio_source = NULL;
video_source_t* p_video_source = NULL;
audio_encoder_t* p_audio_encoder = NULL;
video_encoder_t* p_video_encoder = NULL;
ts_muxer_t* p_avmuxer = NULL;
ts_smooth_t* p_tssmooth = NULL;
const int n_audio_source_sample_size = 1*1024*1024;
const int n_video_source_sample_size = 5*1024*1024;
char *p_audio_source_sample = NULL;
char *p_video_source_sample = NULL;
int n_audio_source_sample = 0;
int n_video_source_sample = 0;
const int n_audio_encode_sample_size = 1*1024*1024;
const int n_video_encode_sample_size = 5*1024*1024;
char *p_audio_encode_sample = NULL;
char *p_video_encode_sample = NULL;
int n_audio_encode_sample = 0;
int n_video_encode_sample = 0;
int write_video_frames();
int write_audio_frames();
void* statistics_process(void *param);
int m_index = 0;
int width = 1280;
int height = 720;
int encode_bitrate = 4*1024*1024;
int smooth_bitrate = 12*1024*1024;
char destip[32] = "127.0.0.1";
int destport = 14000;
char destip_record[32] = "127.0.0.1";
int destport_record = 14000;
int pmt_pid = 0x1000;
int service_id = 0x0001;
int video_pid = 0x100;
int audio_pid = 0x101;
int gopsize_min = 5;
int gopsize_max = 100;
int fps = 25;
char logfile[256] = "avencoder.log";
int main(int argc,char **argv)
{
const char *short_options = "i:w:h:b:d:p:s:g:f:l:?";
struct option long_options[] = {
{"help", no_argument, NULL, '?'},
{"index", required_argument, NULL, 'i'},
{"width", required_argument, NULL, 'w'},
{"height", required_argument, NULL, 'h'},
{"bitrate", required_argument, NULL, 'b'},
{"sbitrate",required_argument, NULL, 's'},
{"destaddr",required_argument, NULL, 'd'},
{"pids", required_argument, NULL, 'p'},
{"gopsize", required_argument, NULL, 'g'},
{"fps", required_argument, NULL, 'f'},
{"logfile", required_argument, NULL, 'l'},
{NULL, 0, NULL, 0},
};
int c = -1;
bool has_index = false;
bool has_destaddr = false;
bool has_ebitrate = false;
bool has_sbitrate = false;
while(1)
{
c = getopt_long(argc, argv, short_options, long_options, NULL);
if(c == -1)
break;
switch(c)
{
case '?':
printf("Usage:%s [options] index destaddr ....\n",argv[0]);
printf("avencoder version %s\n",version_str);
printf("-? --help Display this usage information.\n");
printf("-i --index Set the index.\n");
printf("-w --width Set the width.\n");
printf("-h --height Set the height.\n");
printf("-b --bitrate Set the encoder bitrate .\n");
printf("-s --sbitrate Set the smooth bitrate.\n");
printf("-d --destaddr Set the dest addr (ip:port).\n");
printf("-p --pids Set the service_id pmt_pid video_pid audio_pid (pmt_pid:service_id:video_pid:audio_pid).\n");
printf("-g --gopsize Set the video encode gopsize (gopsize_min:gopsize_max).\n");
printf("-l --logfile Set the log file path.\n");
printf("Example: %s --index 0 --width 1280 --height 720 --bitrate 4000000 --pids 1024:1:64:65 --gopsize 5:100 --destaddr 192.168.60.248:14000.\n",argv[0]);
printf("Example: %s -i 0 -w 1280 -h 720 -b 4000000 -p 1024:1:64:65 -g 5:100 -d 192.168.60.248:14000.\n",argv[0]);
return -1;
case 'i':
m_index = atoi(optarg);
has_index = true;
break;
case 'w':
width = atoi(optarg);
break;
case 'h':
height = atoi(optarg);
break;
case 'b':
encode_bitrate = atoi(optarg);
has_ebitrate = true;
break;
case 's':
smooth_bitrate = atoi(optarg);
has_sbitrate = true;
break;
case 'd':
if(sscanf(optarg,"%[^:]:%d",destip,&destport) != 2)
{
fprintf(stderr ,"avencoder: error destip:destport.%s.\n",optarg);
return -2;
}
strncpy(destip_record,destip,sizeof(destip_record));
destport_record = destport;
has_destaddr = true;
break;
case 'p':
if(sscanf(optarg,"%d:%d:%d:%d",&pmt_pid,&service_id,&video_pid,&audio_pid) != 4)
{
fprintf(stderr ,"avencoder: error pmt_pid:service_id:video_pid:audio_pid.%s.\n",optarg);
return -3;
}
break;
case 'g':
if(sscanf(optarg,"%d:%d",&gopsize_min,&gopsize_max) != 2)
{
gopsize_min = gopsize_max = atoi(optarg);
}
break;
case 'f':
fps = atoi(optarg);
break;
case 'l':
memset(logfile,0,sizeof(logfile));
strncpy(logfile,optarg,sizeof(logfile));
break;
}
}
if(has_index == false || has_destaddr == false)
{
fprintf(stderr ,"avencoder: index and destaddr is must,not empty.\n");
return -3;
}
if(has_ebitrate == true && has_sbitrate == false)
smooth_bitrate = encode_bitrate*3;
else if(has_ebitrate == false && has_sbitrate == true)
encode_bitrate = smooth_bitrate/3;
if(encode_bitrate < 0)
encode_bitrate = 4*1024*1024;
//TODO 检查各个参数的有效性
printf("avencoder version %s\n",version_str);
printf("++++++index=%d|width=%d|height=%d|smooth_bitrate=%d|encode_bitrate=%d|destip=%s|destport=%d++++++\n",m_index,width,height,smooth_bitrate,encode_bitrate,destip,destport);
printf("++++++pmt_pid=%d|service_id=%d|video_pid=%d|audio_pid=%d|gopsize_min=%d|gopsize_max=%d|logfile=%s++++++\n",pmt_pid,service_id,video_pid,audio_pid,gopsize_min,gopsize_max,logfile);
InputParams_audiosource audio_source_params;
InputParams_videosource video_source_params;
InputParams_videoencoder video_encoder_params;
InputParams_avmuxer avmuxer_params;
InputParams_tssmooth tssmooth_params;
audio_source_params.index = m_index;
p_audio_source = init_audio_source(&audio_source_params);
if(p_audio_source == NULL)
{
fprintf(stderr ,"avencoder: init_audio_source fail..\n");
return -1;
}
video_source_params.index = m_index;
video_source_params.width = width;
video_source_params.height = height;
p_video_source = init_video_source(&video_source_params);
if(p_video_source == NULL)
{
fprintf(stderr ,"avencoder: init_video_source fail..\n");
return -1;
}
p_audio_encoder = init_audio_encoder();
if(p_audio_encoder == NULL)
{
fprintf(stderr ,"avencoder: init_audio_encoder fail..\n");
return -1;
}
video_encoder_params.width = width;
video_encoder_params.height = height;
video_encoder_params.gopsize_min = gopsize_min;
video_encoder_params.gopsize_max = gopsize_max;
video_encoder_params.bitrate = encode_bitrate;
video_encoder_params.fps = fps;
p_video_encoder = init_video_encoder(&video_encoder_params);
if(p_video_encoder == NULL)
{
fprintf(stderr ,"avencoder: init_video_encoder fail..\n");
return -1;
}
#if 0
if(smooth_bitrate > 0)
{
memset(&tssmooth_params,0,sizeof(tssmooth_params));
tssmooth_params.index = m_index;
tssmooth_params.listen_udp_port = 0;
strcpy(tssmooth_params.dst_udp_ip,destip);
tssmooth_params.dst_udp_port = destport;
tssmooth_params.bit_rate = smooth_bitrate;
tssmooth_params.buffer_max_size = 10*1024*1024;
p_tssmooth = init_tssmooth(&tssmooth_params);
if(p_tssmooth == NULL)
{
fprintf(stderr ,"avencoder: init_smooth fail..\n");
return -1;
}
strcpy(destip,tssmooth_params.listen_udp_ip);
destport = tssmooth_params.listen_udp_port;
printf("++++++now dest addr is modify destip=%s|destport=%d++++++\n",destip,destport);
}
#endif
avmuxer_params.codecID = KY_CODEC_ID_H264;
avmuxer_params.nWidth = width;
avmuxer_params.nHeight = height;
avmuxer_params.nBitRate = encode_bitrate;
avmuxer_params.nPeakBitRate = smooth_bitrate;
avmuxer_params.nSamplerate = 48000;
avmuxer_params.nFramerate = fps;
snprintf(avmuxer_params.monitorName,sizeof(avmuxer_params.monitorName),"%d.monitor",m_index);
snprintf(avmuxer_params.appName,sizeof(avmuxer_params.appName),"%s",argv[0]);
strcpy(avmuxer_params.destip,destip);
avmuxer_params.destport = destport;
avmuxer_params.index = m_index;
avmuxer_params.pmt_pid = pmt_pid;
avmuxer_params.service_id = service_id;
avmuxer_params.video_pid = video_pid;
avmuxer_params.audio_pid = audio_pid;
p_avmuxer = init_ts_muxer(&avmuxer_params);
if(p_avmuxer == NULL)
{
fprintf(stderr ,"avencoder: init_ts_muxer fail..\n");
return -1;
}
p_audio_source_sample = (char *)malloc(n_audio_source_sample_size);
p_video_source_sample = (char *)malloc(n_video_source_sample_size);
if(p_audio_source_sample == NULL || p_video_source_sample == NULL)
{
fprintf(stderr ,"avencoder: malloc fail..\n");
return -2;
}
p_audio_encode_sample = (char *)malloc(n_audio_encode_sample_size);
p_video_encode_sample = (char *)malloc(n_video_encode_sample_size);
if(p_audio_encode_sample == NULL || p_video_encode_sample == NULL)
{
fprintf(stderr ,"avencoder: malloc fail..\n");
return -2;
}
pthread_t pthread;
int ret = pthread_create(&pthread, NULL, statistics_process, NULL);
if(ret != 0)
{
printf("avencoder: pthread_create fail!...\n");
return -3;
}
double videopts = 0.0;
double audiopts = 0.0;
struct timeval tv;
long start_time_us,end_time_us;
gettimeofday(&tv,NULL);
start_time_us = end_time_us = tv.tv_sec*1000 + tv.tv_usec/1000;
while(1)
{
gettimeofday(&tv,NULL);
start_time_us = tv.tv_sec*1000 + tv.tv_usec/1000;
write_video_frames();
video_pts(p_avmuxer,&videopts);
audio_pts(p_avmuxer,&audiopts);
//printf("++++++++++videopts = [%lf] audiopts = [%lf]+++++++++\n",videopts,audiopts);
while(audiopts < videopts)
{
write_audio_frames();
video_pts(p_avmuxer,&videopts);
audio_pts(p_avmuxer,&audiopts);
//printf("----------videopts = [%lf] audiopts = [%lf]---------\n",videopts,audiopts);
}
gettimeofday(&tv,NULL);
end_time_us = tv.tv_sec*1000 + tv.tv_usec/1000;
//if(end_time_us - start_time_us >= 40)
// printf("1++++++++++start_time_us = [%ld] end_time_us = [%ld]+++++diff=%ld++++\n",start_time_us,end_time_us,end_time_us - start_time_us);
if(end_time_us - start_time_us < delaytimeus)
usleep((delaytimeus-(end_time_us - start_time_us))*1000);
}
uninit_audio_source(p_audio_source);
uninit_video_source(p_video_source);
uninit_audio_encoder(p_audio_encoder);
uninit_video_encoder(p_video_encoder);
uninit_ts_muxer(p_avmuxer);
if(smooth_bitrate > 0 && p_tssmooth)
uninit_tssmooth(p_tssmooth);
return 0;
}
int write_video_frames()
{
int ret = -1;
int x = 0;
int y = 0;
int w = 0;
int h = 0;
//获取视频源
n_video_source_sample = n_video_source_sample_size;
if(first_frame == 0)
{
ret = get_video_sample_inc(p_video_source,p_video_source_sample,&n_video_source_sample,&x,&y,&w,&h);
if(ret < 0)
{
fprintf(stderr ,"avencoder: get_video_sample_inc fail..ret=%d\n",ret);
return -1;
}
}
else //first_frame
{
ret = get_video_sample_all(p_video_source,p_video_source_sample,&n_video_source_sample,&x,&y,&w,&h);
if(ret < 0)
{
fprintf(stderr ,"avencoder: get_video_sample_all fail..ret=%d\n",ret);
return -1;
}
first_frame = 0;
}
/*
struct timeval tv;
long time_us;
gettimeofday(&tv,NULL);
time_us = tv.tv_sec*1000 + tv.tv_usec/1000;
printf("time_us=%ld x=%d,y=%d,w=%d,h=%d, n_video_source_sample = %d\n",time_us,x,y,w,h,n_video_source_sample);
*/
//printf("n_video_source_sample = %d\n",n_video_source_sample);
//编码视频
n_video_encode_sample = n_video_encode_sample_size;
ret = encode_video_sample_inc(p_video_encoder,p_video_source_sample,n_video_source_sample,p_video_encode_sample,&n_video_encode_sample,x,y,w,h);
if(ret < 0)
{
fprintf(stderr ,"avencoder: encode_video_sample fail..\n");
return -2;
}
//printf("n_video_encode_sample = %d\n",n_video_encode_sample);
//写视频
ret = write_video_frame(p_avmuxer,p_video_encode_sample,n_video_encode_sample);
if(ret < 0)
{
fprintf(stderr ,"avencoder: write_video_frame fail..\n");
return -3;
}
return 0;
}
int write_audio_frames()
{
int ret = 0;
n_audio_source_sample = n_audio_source_sample_size;
ret = get_audio_sample(p_audio_source,p_audio_source_sample,&n_audio_source_sample);
if(ret < 0)
{
fprintf(stderr ,"avencoder: get_audio_sample fail..\n");
return -1;
}
else if(ret == 0)
{
//fprintf(stderr ,"avencoder: get_audio_sample no audio sample..\n");
n_audio_source_sample = 4608;
memset(p_audio_source_sample,0,n_audio_source_sample);
}
//else if(ret > 0)
// fprintf(stderr ,"avencoder: get_audio_sample yes audio sample..\n");
//printf("n_audio_source_sample = %d\n",n_audio_source_sample);
n_audio_encode_sample = n_audio_encode_sample_size;
ret = encode_audio_sample(p_audio_encoder,p_audio_source_sample,n_audio_source_sample,p_audio_encode_sample,&n_audio_encode_sample);
if(ret < 0)
{
fprintf(stderr ,"avencoder: encode_audio_sample fail..\n");
return -2;
}
//printf("n_audio_encode_sample = %d\n",n_audio_encode_sample);
ret = write_audio_frame(p_avmuxer,p_audio_encode_sample,n_audio_encode_sample);
if(ret < 0)
{
fprintf(stderr ,"avencoder: write_audio_frame fail..\n");
return -3;
}
return 0;
}
void* statistics_process(void *param)
{
unsigned long read_send_bytes1 = 0;
unsigned long read_count_fps1 = 0;
unsigned long read_send_bytes2 = 0;
unsigned long read_count_fps2 = 0;
unsigned long read_send_bytes_diff = 0;
unsigned long read_count_fps_diff = 0;
unsigned long mask_long = (unsigned long)(-1);
FILE *fp = NULL;
char filename[256];
snprintf(filename,sizeof(filename),"/tmp/avencoder.%d",m_index);
char tmp_buffer[1024];
while(1)
{
// if(smooth_bitrate > 0 && p_tssmooth)
// read_send_bytes1 = get_real_send_bytes(p_tssmooth);
if(p_avmuxer)
read_send_bytes1 = get_bbcvudp_real_send_bytes(p_avmuxer);
read_count_fps1 = get_real_count_fps(p_video_encoder);
usleep(1000*1000);
// if(smooth_bitrate > 0 && p_tssmooth)
// read_send_bytes2 = get_real_send_bytes(p_tssmooth);
if(p_avmuxer)
read_send_bytes2 = get_bbcvudp_real_send_bytes(p_avmuxer);
read_count_fps2 = get_real_count_fps(p_video_encoder);
if(read_send_bytes2 < read_send_bytes1)
read_send_bytes_diff = mask_long - read_send_bytes1 + read_send_bytes2;
else
read_send_bytes_diff = read_send_bytes2 - read_send_bytes1;
if(read_count_fps2 < read_count_fps1)
read_count_fps_diff = mask_long - read_count_fps1 + read_count_fps2;
else
read_count_fps_diff = read_count_fps2 - read_count_fps1;
//printf("read_send_bytes_rate = %lu read_count_fps = %lu\n",read_send_bytes_diff*8,read_count_fps_diff);
fp = fopen(filename,"w");
if(fp == NULL)
{
fprintf(stderr ,"avencoder: fopen filename %s fail.errno=%d.\n",filename,errno);
continue;
}
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"version=%s\n",version_str);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"index=%d\n",m_index);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"destaddr=%s:%d\n",destip_record,destport_record);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"destaddr_local=%s:%d\n",destip,destport);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"realbitrate=%lu\n",read_send_bytes_diff*8);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"realfps=%lu\n",read_count_fps_diff);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"encode_bitrate=%d\n",encode_bitrate);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"smooth_bitrate=%d\n",smooth_bitrate);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"fps=%d\n",fps);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"pmt_pid=%d\n",pmt_pid);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"service_id=%d\n",service_id);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"video_pid=%d\n",video_pid);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"audio_pid=%d\n",audio_pid);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"gopsize=%d:%d\n",gopsize_min,gopsize_max);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"width=%d\n",width);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
memset(tmp_buffer,0,sizeof(tmp_buffer));
snprintf(tmp_buffer,sizeof(tmp_buffer),"height=%d\n",height);
fwrite(tmp_buffer,strlen(tmp_buffer),1,fp);
fflush(fp);
fclose(fp);
}
}
|
[
"yydgame@163.com"
] |
yydgame@163.com
|
c29752ffa9200a51a604bdf5753aac1d3654afcf
|
57f1b61b9f71ebb642f9c55979788e18b490e19e
|
/gtr2/core-proxy/AuditReg.h
|
0b2b1c7295875df125b422b866ff8a30cd02593b
|
[] |
no_license
|
cash2one/5173.com
|
22ba887b5b620ed5a1ec8858de738593284ff2b3
|
b5b3b55c93e5e12076ebe01f8a439b464a11c32f
|
refs/heads/master
| 2021-01-12T16:51:01.592506
| 2016-04-08T06:46:05
| 2016-04-08T06:46:05
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 686
|
h
|
#pragma once
#include <wx\regex.h>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <Windows.h>
using namespace std;
struct RegItemData
{
wstring ItemPropertyName;
wstring ItemAttrValue;
};
class AuditReg
{
map<wxString, wxRegEx*> _regItemAttr;
vector<wxRegEx*> _regItemType;
public:
AuditReg(void);
~AuditReg(void);
wstring GetItemType( list<string>& tip );
void GetItemAttr( list<string>& tip, vector<RegItemData>& itemdata );
wstring GetItemType( string& tip );
void GetItemAttr( string& tip, vector<RegItemData>& itemdata );
void AddRegular(wxString id,wxString exp);
void AddRegular(wxString exp);
};
|
[
"24509826@qq.com"
] |
24509826@qq.com
|
94f4f8fac42cf9db0fe0997f236565f4f16e43b1
|
1b9a32ea5f2492fd3512965f92e0f057b0528d33
|
/rotate_image.cpp
|
b154422e3dc40e0f504b8532233f18513466bd36
|
[] |
no_license
|
shivangigoel1302/leetcode_solutions
|
a459a4279ffcfa889cf1fe0e8eb681e4e79186b6
|
3373f9710bd797bcda5cbd86958e8914ba9e2a15
|
refs/heads/master
| 2023-08-23T04:18:26.678630
| 2021-11-01T14:57:21
| 2021-11-01T14:57:21
| 274,206,300
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,788
|
cpp
|
class Solution {
public:
void rotate(vector<vector<int>>&matrix) {
int n=matrix.size();
if(n%2!=0)
{
for(int i=0;i<n-1;i++)
{
for(int j=i;j<n-i-1;j++)
{
for(int k=0;k<3;k++)
{
if(k==0)
{
swap(matrix[i][j],matrix[n-1-j][i]);
}
else if(k==1)
{
swap(matrix[n-1-j][i],matrix[n-i-1][n-1-j]);
}
else if(k==2)
{
swap(matrix[n-i-1][n-1-j],matrix[j][n-i-1]);
}
}
}
}
}
else
{
for(int i=0;i<n-1;i++)
{
for(int j=i;j<n-1-i;j++)
{
if(j==(n/2)-1&&i==(n/2)-1)
{
break;
}
for(int k=0;k<3;k++)
{
if(k==0)
{
swap(matrix[i][j],matrix[n-1-j][i]);
}
else if(k==1)
{
swap(matrix[n-1-j][i],matrix[n-i-1][n-1-j]);
}
else if(k==2)
{
swap(matrix[n-i-1][n-1-j],matrix[j][n-i-1]);
}
}
}
}
int key=matrix[(n/2)-1][(n/2)-1];
matrix[(n/2)-1][(n/2)-1]=matrix[n/2][(n/2)-1];
matrix[(n/2)][(n/2)-1]=matrix[n/2][n/2];
matrix[n/2][n/2]=matrix[(n/2)-1][(n/2)];
matrix[(n/2)-1][(n/2)]=key;
}
}
};
|
[
"shivangigoel1301@gmail.com"
] |
shivangigoel1301@gmail.com
|
3aab77ca920114001af534f7da15fd33304d438b
|
80b6e0535ed5bfb54e64c4aa37df233b71053511
|
/View/ViewContext/TreeView.cpp
|
9a8d8f3307fd9f774cbec2e28e56c54393fb2399
|
[] |
no_license
|
IRETD/TestSystemStudent
|
4911cf6ba298499c7a6e92988baf194dba86c66c
|
2b4140ee9476fb9786357271fe310fe34c388d81
|
refs/heads/master
| 2021-09-10T02:49:55.220737
| 2018-03-20T19:44:51
| 2018-03-20T19:44:51
| 126,067,097
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,027
|
cpp
|
#include "TreeView.h"
#include <Enum/View/ViewContext/DisciplineView/DisciplineViewIconSize.h>
#include <QHeaderView>
TreeView::TreeView( ViewContextType viewContextType ) : ViewContext( viewContextType ) {
setIconSize( QSize( DisciplineViewIconSize::WIDTH,
DisciplineViewIconSize::HEGITH ) );
header() -> resizeSections( QHeaderView::ResizeToContents );
}
QWidget *TreeView::getViewWidget() {
return this;
}
void TreeView::createConnections() {
connect( this,
&QTreeView::doubleClicked,
m_p_Model -> getDisciplineModel().data(),
&TreeStandartItemBaseModel::modelItemSelected
);
connect ( this,
&QTreeView::expanded,
m_p_Model -> getDisciplineModel().data(),
&TreeStandartItemBaseModel::itemIsExpanded );
connect ( this,
&QTreeView::collapsed,
m_p_Model -> getDisciplineModel().data(),
&TreeStandartItemBaseModel::itemIsCollapsed );
}
|
[
"zanzarah92@gmail.com"
] |
zanzarah92@gmail.com
|
9c0425aa75c9db05a355bbf976bb76ebe39d04ed
|
8e567498a9224d7c6bf71cfe66ec5360e056ec02
|
/mars/boost/range/algorithm/equal_range.hpp
|
a6ac171d966e288bf45db928484e5aa7ffac812c
|
[
"MIT",
"Zlib",
"LicenseRef-scancode-unknown-license-reference",
"OpenSSL",
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"BSL-1.0",
"Apache-2.0",
"BSD-2-Clause"
] |
permissive
|
Tencent/mars
|
db31afeeb5c0325bfceede594038381bce3c1635
|
6c7028fffe01e2b49a66c221b1ac2f548649053f
|
refs/heads/master
| 2023-08-31T07:29:50.430084
| 2023-08-09T07:24:42
| 2023-08-09T07:24:42
| 76,222,419
| 18,118
| 3,828
|
NOASSERTION
| 2023-09-12T07:37:07
| 2016-12-12T04:39:54
|
C++
|
UTF-8
|
C++
| false
| false
| 2,963
|
hpp
|
// Copyright Neil Groves 2009. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_ALGORITHM_EQUAL_RANGE_HPP_INCLUDED
#define BOOST_RANGE_ALGORITHM_EQUAL_RANGE_HPP_INCLUDED
#include <boost/concept_check.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <algorithm>
namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost
{
namespace range
{
/// \brief template function equal_range
///
/// range-based version of the equal_range std algorithm
///
/// \pre ForwardRange is a model of the ForwardRangeConcept
/// \pre SortPredicate is a model of the BinaryPredicateConcept
template<class ForwardRange, class Value>
inline std::pair<
BOOST_DEDUCED_TYPENAME mars_boost::range_iterator<ForwardRange>::type,
BOOST_DEDUCED_TYPENAME mars_boost::range_iterator<ForwardRange>::type
>
equal_range(ForwardRange& rng, const Value& val)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return std::equal_range(mars_boost::begin(rng), mars_boost::end(rng), val);
}
/// \overload
template<class ForwardRange, class Value>
inline std::pair<
BOOST_DEDUCED_TYPENAME mars_boost::range_iterator<const ForwardRange>::type,
BOOST_DEDUCED_TYPENAME mars_boost::range_iterator<const ForwardRange>::type
>
equal_range(const ForwardRange& rng, const Value& val)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return std::equal_range(mars_boost::begin(rng), mars_boost::end(rng), val);
}
/// \overload
template<class ForwardRange, class Value, class SortPredicate>
inline std::pair<
BOOST_DEDUCED_TYPENAME mars_boost::range_iterator<ForwardRange>::type,
BOOST_DEDUCED_TYPENAME mars_boost::range_iterator<ForwardRange>::type
>
equal_range(ForwardRange& rng, const Value& val, SortPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return std::equal_range(mars_boost::begin(rng), mars_boost::end(rng), val, pred);
}
/// \overload
template<class ForwardRange, class Value, class SortPredicate>
inline std::pair<
BOOST_DEDUCED_TYPENAME mars_boost::range_iterator<const ForwardRange>::type,
BOOST_DEDUCED_TYPENAME mars_boost::range_iterator<const ForwardRange>::type
>
equal_range(const ForwardRange& rng, const Value& val, SortPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return std::equal_range(mars_boost::begin(rng), mars_boost::end(rng), val, pred);
}
} // namespace range
using range::equal_range;
} // namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost
#endif // include guard
|
[
"garryyan@tencent.com"
] |
garryyan@tencent.com
|
09086a30a8080d91171f35147baabc84181564a5
|
b8f5694f4b31d6414d340b55808aea5106a3dad5
|
/xcore/xcam_mutex.h
|
ee6780b2ce8f0cac565028c668b863c63984f9c4
|
[
"Apache-2.0"
] |
permissive
|
wenqingfu/libxcam
|
ae69e123df12802ab3a2f1162873e2bf23e6d78d
|
8873f20503e40bda79666131c36203fb8887e6c8
|
refs/heads/master
| 2020-12-25T08:37:33.484311
| 2016-09-12T00:09:04
| 2016-09-12T00:09:04
| 32,378,292
| 0
| 0
| null | 2015-03-17T07:35:16
| 2015-03-17T07:35:14
|
C++
|
UTF-8
|
C++
| false
| false
| 2,319
|
h
|
/*
* xcam_mutex.h - Lock
*
* Copyright (c) 2014 Intel 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.
*
* Author: Wind Yuan <feng.yuan@intel.com>
*/
#ifndef XCAM_MUTEX_H
#define XCAM_MUTEX_H
#include "xcam_utils.h"
#include <pthread.h>
#include <sys/time.h>
namespace XCam {
class Mutex {
friend class Cond;
private:
XCAM_DEAD_COPY (Mutex);
public:
Mutex () {
pthread_mutex_init (&_mutex, NULL);
}
virtual ~Mutex () {
pthread_mutex_destroy (&_mutex);
}
void lock() {
pthread_mutex_lock (&_mutex);
}
void unlock() {
pthread_mutex_unlock (&_mutex);
}
private:
pthread_mutex_t _mutex;
};
class Cond {
private:
XCAM_DEAD_COPY (Cond);
public:
Cond () {
pthread_cond_init (&_cond, NULL);
}
~Cond () {
pthread_cond_destroy (&_cond);
}
int wait (Mutex &mutex) {
return pthread_cond_wait (&_cond, &mutex._mutex);
}
int timedwait (Mutex &mutex, uint32_t time_in_us) {
struct timeval now;
struct timespec abstime;
gettimeofday (&now, NULL);
now.tv_usec += time_in_us;
abstime.tv_sec += now.tv_sec + now.tv_usec / 1000000;
abstime.tv_nsec = (now.tv_usec % 1000000) * 1000;
return pthread_cond_timedwait (&_cond, &mutex._mutex, &abstime);
}
int signal() {
return pthread_cond_signal (&_cond);
}
int broadcast() {
return pthread_cond_broadcast (&_cond);
}
private:
pthread_cond_t _cond;
};
class SmartLock {
private:
XCAM_DEAD_COPY (SmartLock);
public:
SmartLock (XCam::Mutex &mutex): _mutex(mutex) {
_mutex.lock();
}
virtual ~SmartLock () {
_mutex.unlock();
}
private:
XCam::Mutex &_mutex;
};
};
#endif //XCAM_MUTEX_H
|
[
"feng.yuan@intel.com"
] |
feng.yuan@intel.com
|
55f6b4b4bf67d2735213257420e0d0d7fd0f3896
|
b1dabaf550797d09925e62962825e4018a00503b
|
/chart.h
|
5aebb3397245ef8b9d8d47bc7b41eef604f36caf
|
[] |
no_license
|
jodijhouranda/Kalingga
|
7e2b46020470a1a138175e3e0b2ce764a302c22f
|
bba16f48392e6a2d3414ec3029267061f7da46dd
|
refs/heads/master
| 2020-04-16T18:32:55.552285
| 2015-07-15T07:11:42
| 2015-07-15T07:11:42
| 33,490,872
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 697
|
h
|
#ifndef CHART_H
#define CHART_H
#include <QFile>
#include <QGraphicsSvgItem>
#include <QTextStream>
#include <QGraphicsScene>
#include <QDebug>
#include <QGraphicsView>
#include <resultviewitem.h>
#include <QHBoxLayout>
#include <QSvgWidget>
#include <RInside.h>
class Chart
{
public:
Chart();
~Chart();
void setupChartView(QString chartName ,QString variable,QWidget* configWidget);
void filterSVGFile();
void setTempFile(RInside& rconn);
void printGraph(RInside& rconn);
void printGraph(RInside& rconn,int width,int height);
QSvgWidget* graph;
private:
QString m_tempfile;
QString m_svgfile;
QString tfile;
QString sfile;
};
#endif // CHART_H
|
[
"jwst.28@gmail.com"
] |
jwst.28@gmail.com
|
d69c6db72b6012f6652c6e9267d192c01d8b3b4e
|
8e28be5cc8af1fd494ae44174b0a1e7692d2673f
|
/robot/src-ori/RobotSystem.h
|
0f938bf8b4723f325d73d85b02684d45517f240c
|
[] |
no_license
|
xiaochun-yang/19-ID
|
e10a17964aa7291deed991b453bc2ab565140b88
|
e446b1fa8bdbcbe4ae13aca439cc807faaae74ac
|
refs/heads/master
| 2021-05-26T07:46:29.105890
| 2019-01-08T20:34:28
| 2019-01-08T20:34:28
| 127,952,810
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,615
|
h
|
#ifndef __ROBOT_SYSTEM_H__
#define __ROBOT_SYSTEM_H__
#include "xos.h"
#include "DcsMessageManager.h"
#include "DcsMessageService.h"
#include "RobotService.h"
#include "activeObject.h"
#include "DcsConfig.h"
#include <string>
class CRobotSystem: public Observer
{
public:
CRobotSystem();
~CRobotSystem();
void RunFront( ); //will block until signal by other thread through OnStop()
void OnStop( );
//implement Observer
virtual void ChangeNotification( activeObject* pSubject );
// static CRobotSystem* getInstance();
// bool loadProperties(const std::string& name);
// const DcsConfig& getConfig() const
// {
// return m_config;
// }
private:
//help function
BOOL WaitAllStart( );
void WaitAllStop( );
BOOL OnInit( );
void Cleanup( );
////////////////////////////////////DATA////////////////////
private:
//create managers first
DcsMessageManager m_MsgManager;
//create services
DcsMessageService m_DcsServer;
RobotService m_RobotServer;
//wait signal to quit
xos_event_t m_EvtStop;
int m_FlagStop;
//to wait both console and message service to start and stop
xos_semaphore_t m_SemWaitStatus;
activeObject::Status volatile m_DcsStatus;
activeObject::Status volatile m_RobotStatus;
// DcsConfig m_config;
};
#endif //#ifndef __ROBOT_SYSTEM_H__
|
[
"root@yangxc.(none)"
] |
root@yangxc.(none)
|
2576de9d880446a5456eda28e35e396468852ba6
|
6fd7591f7911dbe7a31c0af14f94ba009f1f23cb
|
/NumberGuessingGame/util.h
|
73b4386508d697db7aaba51d62cb7b807b083db2
|
[] |
no_license
|
RichardMSullivan/TerminalGame
|
bdd481401442c991e097c38316691581edb0bda3
|
b341cc74c8640ff0916a5a8e5afa0dd106f01419
|
refs/heads/master
| 2020-03-29T22:57:40.075936
| 2018-10-08T07:49:01
| 2018-10-08T07:49:01
| 150,449,690
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 157
|
h
|
#ifndef UTIL_H
#define UTIL_H
int checkInRange(int guess, int MIN, int MAX);
int strToNum(std::string string);
int randomNum( int MIN, int MAX );
#endif
|
[
"richard.sullivan2@g.austincc.edu"
] |
richard.sullivan2@g.austincc.edu
|
707f00441347825551cf09b86ce01ab90726b8f2
|
56649046304376279d71bf6fd82562f7efa293ca
|
/PracSim/include/mpsk_symbtowave.h
|
55341b92734f42b3059184fa582badb11e365196
|
[] |
no_license
|
zwm152/WirelessCommSystemSimuC-Model
|
b9b3de73956caa8e872c3d36580ec863962d8ef2
|
7be3562b5a516c73f06c4090b5806ffe7319fe8a
|
refs/heads/master
| 2021-09-23T15:41:08.088030
| 2018-09-25T12:04:04
| 2018-09-25T12:04:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 898
|
h
|
//
// File = mpsk_iq_mod.h
//
#ifndef _MPSK_IQ_MOD_H_
#define _MPSK_IQ_MOD_H_
#include "signal_T.h"
#include "psmodel.h"
class MpskSymbsToQuadWaves : public PracSimModel
{
public:
MpskSymbsToQuadWaves( char* instance_nam,
PracSimModel* outer_model,
Signal<byte_t>* in_symb_seq,
Signal<float>* i_out_sig,
Signal<float>* q_out_sig,
Signal<bit_t>* symb_clock_out );
~MpskSymbsToQuadWaves(void);
void Initialize(void);
int Execute(void);
private:
int In_Block_Size;
int Out_Block_Size;
int Bits_Per_Symb;
int Num_Diff_Symbs;
int Samps_Per_Symb;
double Symb_Duration;
float *I_Compon;
float *Q_Compon;
Signal<byte_t> *In_Symb_Seq;
Signal<float> *I_Out_Sig;
Signal<float> *Q_Out_Sig;
Signal<bit_t> *Symb_Clock_Out;
Signal< std::complex<float> > *Cmpx_Out_Sig;
};
#endif
|
[
"huhaichaotd@139.com"
] |
huhaichaotd@139.com
|
188caa720ef449ba95de968837f33415b26fbadf
|
783fbeabbc7fc8090ee9e6765d26b38aa5db2efb
|
/src/ublox/src/comms/field/ArrayList.h
|
a7c6965924bccca3cbdda54a723cd7b2a3d8e842
|
[] |
no_license
|
salkinium/navimet
|
760cd876987012f274429cb285efe329451f9ca0
|
833fc426c66401348315d66baee2a54ae6142834
|
refs/heads/master
| 2022-01-08T19:17:33.009843
| 2019-08-04T23:27:28
| 2019-08-04T23:27:28
| 164,520,548
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 19,606
|
h
|
//
// Copyright 2014 - 2018 (C). Alex Robenko. All rights reserved.
//
// This file 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, see <http://www.gnu.org/licenses/>.
#pragma once
#include <vector>
#include "comms/ErrorStatus.h"
#include "comms/options.h"
#include "comms/util/StaticVector.h"
#include "comms/util/ArrayView.h"
#include "basic/ArrayList.h"
#include "details/AdaptBasicField.h"
#include "details/OptionsParser.h"
#include "tag.h"
namespace comms
{
namespace field
{
namespace details
{
template <bool THasOrigDataViewStorage>
struct ArrayListOrigDataViewStorageType;
template <>
struct ArrayListOrigDataViewStorageType<true>
{
template <typename TElement>
using Type = comms::util::ArrayView<TElement>;
};
template <>
struct ArrayListOrigDataViewStorageType<false>
{
template <typename TElement>
using Type = std::vector<TElement>;
};
template <bool THasSequenceFixedSizeUseFixedSizeStorage>
struct ArrayListSequenceFixedSizeUseFixedSizeStorageType;
template <>
struct ArrayListSequenceFixedSizeUseFixedSizeStorageType<true>
{
template <typename TElement, typename TOpt>
using Type = comms::util::StaticVector<TElement, TOpt::SequenceFixedSize>;
};
template <>
struct ArrayListSequenceFixedSizeUseFixedSizeStorageType<false>
{
template <typename TElement, typename TOpt>
using Type =
typename ArrayListOrigDataViewStorageType<
TOpt::HasOrigDataView && std::is_integral<TElement>::value && (sizeof(TElement) == sizeof(std::uint8_t))
>::template Type<TElement>;
};
template <bool THasFixedSizeStorage>
struct ArrayListFixedSizeStorageType;
template <>
struct ArrayListFixedSizeStorageType<true>
{
template <typename TElement, typename TOpt>
using Type = comms::util::StaticVector<TElement, TOpt::FixedSizeStorage>;
};
template <>
struct ArrayListFixedSizeStorageType<false>
{
template <typename TElement, typename TOpt>
using Type =
typename ArrayListSequenceFixedSizeUseFixedSizeStorageType<TOpt::HasSequenceFixedSizeUseFixedSizeStorage>
::template Type<TElement, TOpt>;
};
template <bool THasCustomStorage>
struct ArrayListCustomArrayListStorageType;
template <>
struct ArrayListCustomArrayListStorageType<true>
{
template <typename TElement, typename TOpt>
using Type = typename TOpt::CustomStorageType;
};
template <>
struct ArrayListCustomArrayListStorageType<false>
{
template <typename TElement, typename TOpt>
using Type =
typename ArrayListFixedSizeStorageType<TOpt::HasFixedSizeStorage>::template Type<TElement, TOpt>;
};
template <typename TElement, typename TOpt>
using ArrayListStorageTypeT =
typename ArrayListCustomArrayListStorageType<TOpt::HasCustomStorageType>::template Type<TElement, TOpt>;
template <typename TFieldBase, typename TElement, typename... TOptions>
using ArrayListBase =
AdaptBasicFieldT<
comms::field::basic::ArrayList<
TFieldBase,
ArrayListStorageTypeT<TElement, OptionsParser<TOptions...> >
>,
TOptions...
>;
} // namespace details
/// @brief Field that represents a sequential collection of fields.
/// @details By default uses
/// <a href="http://en.cppreference.com/w/cpp/container/vector">std::vector</a>,
/// for internal storage, unless comms::option::FixedSizeStorage option is used,
/// which forces usage of comms::util::StaticVector instead.
/// @tparam TFieldBase Base class for this field, expected to be a variant of
/// comms::Field.
/// @tparam TElement Element of the collection, can be either basic integral value
/// (such as std::uint8_t) or any other field from comms::field namespace.@n
/// For example:
/// @code
/// using MyFieldBase = comms::Field<comms::option::BigEndian>;
/// using RawDataSeqField =
/// comms::field::ArrayList<
/// MyFieldBase,
/// std::uint8_t
/// >;
/// using CollectionOfBundlesField =
/// comms::field::ArrayList<
/// MyFieldBase,
/// std::field::Bundle<
/// MyFieldBase,
/// std::tuple<
/// comms::field::IntValue<MyFieldBase, std::uint16_t>
/// comms::field::IntValue<MyFieldBase, std::uint8_t>
/// comms::field::IntValue<MyFieldBase, std::uint8_t>
/// >
/// >
/// >;
/// @endcode
/// @tparam TOptions Zero or more options that modify/refine default behaviour
/// of the field.@n
/// Supported options are:
/// @li @ref comms::option::FixedSizeStorage
/// @li @ref comms::option::CustomStorageType
/// @li @ref comms::option::SequenceSizeFieldPrefix
/// @li @ref comms::option::SequenceSerLengthFieldPrefix
/// @li @ref comms::option::SequenceElemSerLengthFieldPrefix
/// @li @ref comms::option::SequenceElemFixedSerLengthFieldPrefix
/// @li @ref comms::option::SequenceSizeForcingEnabled
/// @li @ref comms::option::SequenceLengthForcingEnabled
/// @li @ref comms::option::SequenceFixedSize
/// @li @ref comms::option::SequenceTerminationFieldSuffix
/// @li @ref comms::option::SequenceTrailingFieldSuffix
/// @li @ref comms::option::DefaultValueInitialiser
/// @li @ref comms::option::ContentsValidator
/// @li @ref comms::option::ContentsRefresher
/// @li @ref comms::option::HasCustomRead
/// @li @ref comms::option::HasCustomRefresh
/// @li @ref comms::option::FailOnInvalid
/// @li @ref comms::option::IgnoreInvalid
/// @li @ref comms::option::OrigDataView (valid only if TElement is integral type
/// of 1 byte size.
/// @li @ref comms::option::EmptySerialization
/// @li @ref comms::option::VersionStorage
/// @extends comms::Field
/// @headerfile comms/field/ArrayList.h
template <typename TFieldBase, typename TElement, typename... TOptions>
class ArrayList : private details::ArrayListBase<TFieldBase, TElement, TOptions...>
{
using BaseImpl = details::ArrayListBase<TFieldBase, TElement, TOptions...>;
public:
/// @brief Endian used for serialisation.
using Endian = typename BaseImpl::Endian;
/// @brief Version type
using VersionType = typename BaseImpl::VersionType;
/// @brief All the options provided to this class bundled into struct.
using ParsedOptions = details::OptionsParser<TOptions...>;
/// @brief Tag indicating type of the field
using Tag = typename std::conditional<
std::is_integral<TElement>::value,
tag::RawArrayList,
tag::ArrayList
>::type;
/// @brief Type of underlying value.
/// @details If comms::option::FixedSizeStorage option is NOT used, the
/// ValueType is std::vector<TElement>, otherwise it becomes
/// comms::util::StaticVector<TElement, TSize>, where TSize is a size
/// provided to comms::option::FixedSizeStorage option.
using ValueType = typename BaseImpl::ValueType;
/// @brief Type of the element.
using ElementType = typename BaseImpl::ElementType;
/// @brief Default constructor
ArrayList() = default;
/// @brief Value constructor
explicit ArrayList(const ValueType& val)
: BaseImpl(val)
{
}
/// @brief Value constructor
explicit ArrayList(ValueType&& val)
: BaseImpl(std::move(val))
{
}
/// @brief Copy constructor
ArrayList(const ArrayList&) = default;
/// @brief Move constructor
ArrayList(ArrayList&&) = default;
/// @brief Destructor
~ArrayList() noexcept = default;
/// @brief Copy assignment
ArrayList& operator=(const ArrayList&) = default;
/// @brief Move assignment
ArrayList& operator=(ArrayList&&) = default;
/// @brief Get access to the value storage.
ValueType& value()
{
return BaseImpl::value();
}
/// @brief Get access to the value storage.
const ValueType& value() const
{
return BaseImpl::value();
}
/// @brief Get length of serialised data
constexpr std::size_t length() const
{
return BaseImpl::length();
}
/// @brief Read field value from input data sequence
/// @details By default, the read operation will try to consume all the
/// data available, unless size limiting option (such as
/// comms::option::SequenceSizeFieldPrefix, comms::option::SequenceFixedSize,
/// comms::option::SequenceSizeForcingEnabled,
/// comms::option::SequenceLengthForcingEnabled) is used.
/// @param[in, out] iter Iterator to read the data.
/// @param[in] len Number of bytes available for reading.
/// @return Status of read operation.
/// @post Iterator is advanced.
template <typename TIter>
ErrorStatus read(TIter& iter, std::size_t len)
{
return BaseImpl::read(iter, len);
}
/// @brief Read field value from input data sequence without error check and status report.
/// @details Similar to @ref read(), but doesn't perform any correctness
/// checks and doesn't report any failures.
/// @param[in, out] iter Iterator to read the data.
/// @post Iterator is advanced.
template <typename TIter>
void readNoStatus(TIter& iter)
{
BaseImpl::readNoStatus(iter);
}
/// @brief Write current field value to output data sequence
/// @details By default, the write operation will write all the
/// elements the field contains. If comms::option::SequenceFixedSize option
/// is used, the number of elements, that is going to be written, is
/// exactly as the option specifies. If underlying vector storage
/// doesn't contain enough data, the default constructed elements will
/// be appended to the written sequence until the required amount of
/// elements is reached.
/// @param[in, out] iter Iterator to write the data.
/// @param[in] len Maximal number of bytes that can be written.
/// @return Status of write operation.
/// @post Iterator is advanced.
template <typename TIter>
ErrorStatus write(TIter& iter, std::size_t len) const
{
return BaseImpl::write(iter, len);
}
/// @brief Write current field value to output data sequence without error check and status report.
/// @details Similar to @ref write(), but doesn't perform any correctness
/// checks and doesn't report any failures.
/// @param[in, out] iter Iterator to write the data.
/// @post Iterator is advanced.
template <typename TIter>
void writeNoStatus(TIter& iter) const
{
BaseImpl::writeNoStatus(iter);
}
/// @brief Check validity of the field value.
/// @details The collection is valid if all the elements are valid. In case
/// comms::option::ContentsValidator option is used, the validator,
/// it provides, is invoked IN ADDITION to the validation of the elements.
/// @return true in case the field's value is valid, false otherwise.
bool valid() const
{
return BaseImpl::valid();
}
/// @brief Refresh the field.
/// @details Calls refresh() on all the elements (if they are fields and not raw bytes).
/// @brief Returns true if any of the elements has been updated, false otherwise.
bool refresh()
{
return BaseImpl::refresh();
}
/// @brief Get minimal length that is required to serialise field of this type.
static constexpr std::size_t minLength()
{
return BaseImpl::minLength();
}
/// @brief Get maximal length that is required to serialise field of this type.
static constexpr std::size_t maxLength()
{
return BaseImpl::maxLength();
}
/// @brief Force number of elements that must be read in the next read()
/// invocation.
/// @details Exists only if comms::option::SequenceSizeForcingEnabled option has been
/// used.
/// @param[in] count Number of elements to read during following read operation.
void forceReadElemCount(std::size_t count)
{
return BaseImpl::forceReadElemCount(count);
}
/// @brief Clear forcing of the number of elements that must be read in the next read()
/// invocation.
/// @details Exists only if comms::option::SequenceSizeForcingEnabled option has been
/// used.
void clearReadElemCount()
{
return BaseImpl::clearReadElemCount();
}
/// @brief Force available length for the next read() invocation.
/// @details Exists only if @ref comms::option::SequenceLengthForcingEnabled option has been
/// used.
/// @param[in] count Number of elements to read during following read operation.
void forceReadLength(std::size_t count)
{
return BaseImpl::forceReadLength(count);
}
/// @brief Clear forcing of the available length in the next read()
/// invocation.
/// @details Exists only if @ref comms::option::SequenceLengthForcingEnabled option has been
/// used.
void clearReadLengthForcing()
{
return BaseImpl::clearReadLengthForcing();
}
/// @brief Force serialisation length of a single element.
/// @details The function can be used to force a serialisation length of a
/// single element within the ArrayList.
/// Exists only if @ref comms::option::SequenceElemLengthForcingEnabled option has been
/// used.
/// @param[in] count Number of elements to read during following read operation.
void forceReadElemLength(std::size_t count)
{
return BaseImpl::forceReadElemLength(count);
}
/// @brief Clear forcing the serialisation length of the single element.
/// @details Exists only if comms::option::SequenceElemLengthForcingEnabled option has been
/// used.
void clearReadElemLengthForcing()
{
return BaseImpl::clearReadElemLengthForcing();
}
/// @brief Compile time check if this class is version dependent
static constexpr bool isVersionDependent()
{
return ParsedOptions::HasCustomVersionUpdate || BaseImpl::isVersionDependent();
}
/// @brief Get version of the field.
/// @details Exists only if @ref comms::option::VersionStorage option has been provided.
VersionType getVersion() const
{
return BaseImpl::getVersion();
}
/// @brief Default implementation of version update.
/// @return @b true in case the field contents have changed, @b false otherwise
bool setVersion(VersionType version)
{
return BaseImpl::setVersion(version);
}
protected:
using BaseImpl::readData;
using BaseImpl::writeData;
private:
static_assert(!ParsedOptions::HasSerOffset,
"comms::option::NumValueSerOffset option is not applicable to ArrayList field");
static_assert(!ParsedOptions::HasFixedLengthLimit,
"comms::option::FixedLength option is not applicable to ArrayList field");
static_assert(!ParsedOptions::HasFixedBitLengthLimit,
"comms::option::FixedBitLength option is not applicable to ArrayList field");
static_assert(!ParsedOptions::HasVarLengthLimits,
"comms::option::VarLength option is not applicable to ArrayList field");
static_assert(!ParsedOptions::HasScalingRatio,
"comms::option::ScalingRatio option is not applicable to ArrayList field");
static_assert(!ParsedOptions::HasUnits,
"comms::option::Units option is not applicable to ArrayList field");
static_assert(!ParsedOptions::HasMultiRangeValidation,
"comms::option::ValidNumValueRange (or similar) option is not applicable to ArrayList field");
static_assert((!ParsedOptions::HasOrigDataView) || (std::is_integral<TElement>::value && (sizeof(TElement) == sizeof(std::uint8_t))),
"Usage of comms::option::OrigDataView option is allowed only for raw binary data (std::uint8_t) types.");
static_assert(!ParsedOptions::HasVersionsRange,
"comms::option::ExistsBetweenVersions (or similar) option is not applicable to ArrayList field");
static_assert(!ParsedOptions::HasInvalidByDefault,
"comms::option::InvalidByDefault option is not applicable to ArrayList field");
};
/// @brief Equivalence comparison operator.
/// @details Performs lexicographical compare of two array fields.
/// @param[in] field1 First field.
/// @param[in] field2 Second field.
/// @return true in case first field is less than second field.
/// @related ArrayList
template <typename TFieldBase, typename TElement, typename... TOptions>
bool operator<(
const ArrayList<TFieldBase, TElement, TOptions...>& field1,
const ArrayList<TFieldBase, TElement, TOptions...>& field2)
{
return std::lexicographical_compare(
field1.value().begin(), field1.value().end(),
field2.value().begin(), field2.value().end());
}
/// @brief Non-equality comparison operator.
/// @param[in] field1 First field.
/// @param[in] field2 Second field.
/// @return true in case fields are NOT equal, false otherwise.
/// @related ArrayList
template <typename TFieldBase, typename TElement, typename... TOptions>
bool operator!=(
const ArrayList<TFieldBase, TElement, TOptions...>& field1,
const ArrayList<TFieldBase, TElement, TOptions...>& field2)
{
return (field1 < field2) || (field2 < field1);
}
/// @brief Equality comparison operator.
/// @param[in] field1 First field.
/// @param[in] field2 Second field.
/// @return true in case fields are equal, false otherwise.
/// @related ArrayList
template <typename TFieldBase, typename TElement, typename... TOptions>
bool operator==(
const ArrayList<TFieldBase, TElement, TOptions...>& field1,
const ArrayList<TFieldBase, TElement, TOptions...>& field2)
{
return !(field1 != field2);
}
/// @brief Compile time check function of whether a provided type is any
/// variant of comms::field::ArrayList.
/// @tparam T Any type.
/// @return true in case provided type is any variant of @ref ArrayList
/// @related comms::field::ArrayList
template <typename T>
constexpr bool isArrayList()
{
return std::is_same<typename T::Tag, tag::ArrayList>::value;
}
/// @brief Upcast type of the field definition to its parent comms::field::ArrayList type
/// in order to have access to its internal types.
/// @related comms::field::ArrayList
template <typename TFieldBase, typename TElement, typename... TOptions>
inline
ArrayList<TFieldBase, TElement, TOptions...>&
toFieldBase(ArrayList<TFieldBase, TElement, TOptions...>& field)
{
return field;
}
/// @brief Upcast type of the field definition to its parent comms::field::ArrayList type
/// in order to have access to its internal types.
/// @related comms::field::ArrayList
template <typename TFieldBase, typename TElement, typename... TOptions>
inline
const ArrayList<TFieldBase, TElement, TOptions...>&
toFieldBase(const ArrayList<TFieldBase, TElement, TOptions...>& field)
{
return field;
}
} // namespace field
} // namespace comms
|
[
"niklas.hauser@rwth-aachen.de"
] |
niklas.hauser@rwth-aachen.de
|
7d5f82629ef70061fe92747e2188fe097e9822db
|
314314c74fc749f3224bcb33a477c2bdeb260cd2
|
/src/appleseedmaya/exporters/shadingnetworkexporter.h
|
df7b34437eaa1771bf8e7a587d7bf6c065a2bfc0
|
[
"MIT"
] |
permissive
|
nyue/appleseed-maya2
|
aabbc35ace375cf2371369dd1d2f234bc4402a13
|
9f3db31cde58dc65296c3895fef04b328b39f5d5
|
refs/heads/master
| 2020-06-14T20:10:43.320103
| 2016-11-30T17:31:17
| 2016-11-30T17:31:17
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,243
|
h
|
//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2016 Esteban Tovagliari, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#ifndef APPLESEED_MAYA_EXPORTERS_SHADING_NETWORK_EXPORTER_H
#define APPLESEED_MAYA_EXPORTERS_SHADING_NETWORK_EXPORTER_H
// Standard headers.
#include <set>
// Maya headers.
#include <maya/MPlug.h>
// appleseed.renderer headers.
#include "renderer/api/shadergroup.h"
// appleseed.maya headers.
#include "appleseedmaya/exporters/mpxnodeexporter.h"
#include "appleseedmaya/shadingnoderegistry.h"
#include "appleseedmaya/utils.h"
class ShadingNetworkExporter
: public MPxNodeExporter
{
public:
enum Context
{
SurfaceContext,
DisplacementContext
};
MString shaderGroupName() const;
virtual void createEntity(const AppleseedSession::Options& options);
virtual void flushEntity();
private:
friend class ShadingEngineExporter;
ShadingNetworkExporter(
const Context context,
const MObject& object,
renderer::Project& project,
AppleseedSession::SessionMode sessionMode);
void exportShader(const MObject& node);
void exportAttributeValue(
const MPlug& plug,
const OSLParamInfo& paramInfo,
renderer::ParamArray& shaderParams);
void exportArrayAttributeValue(
const MPlug& plug,
const OSLParamInfo& paramInfo,
renderer::ParamArray& shaderParams);
void exportConnections(const MObject& node);
void createCompoundChildConnectionAdapterShader(
const MPlug& plug,
const OSLParamInfo& paramInfo);
Context m_context;
AppleseedEntityPtr<renderer::ShaderGroup> m_shaderGroup;
std::set<MString, MStringCompareLess> m_shadersExported;
size_t m_numAdaptersCreated;
};
typedef boost::shared_ptr<ShadingNetworkExporter> ShadingNetworkExporterPtr;
#endif // !APPLESEED_MAYA_EXPORTERS_SHADING_ENGINE_EXPORTER_H
|
[
"ramenhdr@gmail.com"
] |
ramenhdr@gmail.com
|
f6785ca63b503e995a710ad9cc19a9b0f8d6316d
|
d64737d31ae9caba2820ea1048be3f9bce708b42
|
/cpp/linked-list-cycle.cpp
|
d1864bf8ff63ab8fa8e2faee7534aa82178b1608
|
[] |
no_license
|
ldcduc/leetcode-training
|
2453ec13e69160bc29e8e516e19544c2b25bf945
|
40db37375372f14dd45d0a069c8b86fe36221f09
|
refs/heads/master
| 2023-08-05T01:46:52.993542
| 2021-09-18T16:47:54
| 2021-09-18T16:47:54
| 271,736,046
| 9
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 838
|
cpp
|
/* Problem url: https://leetcode.com/problems/linked-list-cycle
* Code by: ldcduc
* */
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode* node1 = head, * node2 = head;
if (head == NULL) {
return false;
}
while (true) {
if (node1->next == NULL || node2->next == NULL || node2->next->next == NULL) {
break;
}
node1 = node1->next;
node2 = node2->next->next;
if (node1 == node2) {
return true;
}
}
return false;
}
};
/*
* Comment by ldcduc
* Suggested tags: linked list, fun, easy
*
* */
|
[
"ldcduc@apcs.vn"
] |
ldcduc@apcs.vn
|
43dc1f3c4f670bc92051625d930e9c9568d08b3e
|
b8dbc3c7a55c0bdb5f8e077f0b2d8c1a032c9eb9
|
/tst-endian.cc
|
84c8282b845ac5e218eeb408995aca5829f16d6f
|
[] |
no_license
|
thuermann/cc.endian
|
8f9bfc2a1879927a60a37a2a051fd924dc22c4ae
|
4fc9d4191cfb6f2a0d4090004a84cb8d1e4c6067
|
refs/heads/master
| 2020-03-15T12:22:07.213569
| 2017-11-30T10:19:54
| 2017-11-30T10:19:54
| 132,141,777
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 760
|
cc
|
//
// $Id: tst-endian.cc,v 1.4 2017/11/30 10:19:54 urs Exp $
//
#include "endian.hh"
be<short> n, m, k = 0x1234;
be<int> a, b, c = 0x42;
be<long> x, y, z = 0x0815;
short s1, s2;
int i1, i2;
long l1, l2;
int main()
{
k = 42;
c = 666;
z = 4711;
n = s1;
s2 = m;
a = i1;
i2 = b;
x = l1;
l2 = y;
}
void bar (void)
{
n *= 2;
m *= 3;
k /= 4;
a += b;
c -= a;
// The following is equivalent to b += 10.
b += 4;
b += 6;
// The following two stmts are a NOP and could be
// completely eliminated.
x++;
--x;
// The following is equivalent to y += 2.
y++;
++y;
// The following is equivalent to l1 = l2 = z.
l1 = z++;
l2 = --z;
}
int foo()
{
int s = 0;
for (be<int> i = 0; i < 10; i++)
s += i;
return s;
}
|
[
"urs@isnogud.escape.de"
] |
urs@isnogud.escape.de
|
d6600819ba7c80e418b08d70a15f648c7d90c525
|
7de07a6709e001bf361ff97068f2ad4d2a119da8
|
/CubeSolverENG4/CubeSolverENG4/CubeSolver.cpp
|
af0ebd755f26981f9eb59226419e1bfa084df43d
|
[] |
no_license
|
VB6Hobbyst7/PolycubeSolver
|
66959aefb28d1079c65e07a5bfca9325ddc89089
|
e12d76071285572e97440e6ab058d2606b988a67
|
refs/heads/master
| 2021-12-14T19:11:02.130941
| 2017-05-22T08:29:10
| 2017-05-22T08:29:10
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,203
|
cpp
|
/*
* File: CubeSolver.cpp *
*
* Created on April 8, 2016, 2:13 PM
*/
using namespace std;
#include "definitions.h"
#include "dlxSolver.h"
#include "cubeConfig.h"
#include "puzzlePiece.h"
long NUMGAMEPIECES;
typedef std::vector<long> puzzlePieceIdent;
#define ONE_SOLUTION 1
#define ALL_SOLUTIONS 1000000
int main(int argc, char** argv) {
long cubeDimSize;
long numOfSolutions;
long pieceSize;
long pieceIdent;
long** puzzlePiecesXYZ;
puzzlePieceIdent* solution;
cubeConfig* puzzleCube = new cubeConfig();
if(argc == 2 && argv[1][0]=='1')
numOfSolutions = ONE_SOLUTION;
else if (argc == 2 && argv[1][0]=='a')
numOfSolutions = ALL_SOLUTIONS;
else
numOfSolutions = ONE_SOLUTION;
std::ifstream fin(argv[2]);
if (!fin.is_open()){
cerr<<"Could not open file"<<endl;
exit(1);
}
fin >> cubeDimSize;
cout << cubeDimSize <<endl;
fin >> NUMGAMEPIECES;
cout << NUMGAMEPIECES<<endl;
puzzlePiecesXYZ = new long*[NUMGAMEPIECES];
/*Read in all game pieces*/
for(long piece = 0; piece < NUMGAMEPIECES;piece++){
fin >> pieceIdent;
fin >> pieceSize;
/*Read in unit cubes for single puzzle piece*/
for (long row = 0; row < pieceSize; row++) {
puzzlePiecesXYZ[row] = new long[3];
fin>>(puzzlePiecesXYZ[row])[X];
fin>>(puzzlePiecesXYZ[row])[Y];
fin>>(puzzlePiecesXYZ[row])[Z];
}
puzzleCube->addPuzzlePiece(pieceIdent,pieceSize,puzzlePiecesXYZ);
}
puzzlePiecePtr* winningPuzzlePieces = new puzzlePiecePtr[NUMGAMEPIECES];
PieceConfigSets* puzzlePieces = &(puzzleCube->getAllBitSets());
dlxSolver solver(numOfSolutions,puzzlePieces);
if (solver.findSolutions()) {
long i = 0;
solution = solver.getSolution(1);
for (long ident : (*solution)) {
winningPuzzlePieces[i] = puzzleCube->getPuzzlePieceNum(ident);
winningPuzzlePieces[i]->printPuzzlePiece();
i++;
}
}
delete(puzzleCube);
return 0;
}
|
[
"artur.prusinowski@gmail.com"
] |
artur.prusinowski@gmail.com
|
80df0013f2c9661325e1fe8ee453c43d9c559f5f
|
c9ea4b7d00be3092b91bf157026117bf2c7a77d7
|
/高级数据结构初步/P4392_fast.cpp
|
04ff9569ca6af559cee2c91b9aab1c2b9aa21a8c
|
[] |
no_license
|
Jerry-Terrasse/Programming
|
dc39db2259c028d45c58304e8f29b2116eef4bfd
|
a59a23259d34a14e38a7d4c8c4d6c2b87a91574c
|
refs/heads/master
| 2020-04-12T08:31:48.429416
| 2019-04-20T00:32:55
| 2019-04-20T00:32:55
| 162,387,499
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,529
|
cpp
|
//P4392 [BOI2007]Sound 静音问题
#include<cstdio>
#define MAXN 1000010
#define MAXM 10010
using namespace std;
struct queue
{
int mem[MAXN],*head,*tail;
inline queue();
}q,r;
int a[MAXN],n=0,m=0,c=0;
bool flag=false;
inline void read(int&);
void write(const int&);
int main()
{
register int i=0;
read(n);read(m);read(c);
if(n<m)
{
puts("NONE");
return 0;
}
for(i=0;i<n;++i)
{
read(a[i]);
}
for(i=0;i<m;++i)
{
for(;q.tail-q.head&&a[*(q.tail-1)]>=a[i];--q.tail);
*q.tail=i;++q.tail;
for(;r.tail-r.head&&a[*(r.tail-1)]<=a[i];--r.tail);
*r.tail=i;++r.tail;
}
if(a[*r.head]-a[*q.head]<=c)
{
flag=true;
puts("1");
}
for(;i<n;++i)
{
for(;q.tail-q.head&&a[*(q.tail-1)]>=a[i];--q.tail);
*q.tail=i;++q.tail;
if(*q.head+m==i)
{
++q.head;
}
for(;r.tail-r.head&&a[*(r.tail-1)]<=a[i];--r.tail);
*r.tail=i;++r.tail;
if(*r.head+m==i)
{
++r.head;
}
if(a[*r.head]-a[*q.head]<=c)
{
flag=true;
write(i+2-m);
putchar('\n');
}
}
if(!flag)
{
puts("NONE");
}
return 0;
}
inline queue::queue()
{
head=tail=mem;
return;
}
void write(const int &x)
{
if(x>9)
{
write(x/10);
}
putchar(x%10^48);
return;
}
inline void read(int &x)
{
register char c=getchar();
for(x=0;c<'0'||c>'9';c=getchar());
for(;c>='0'&&c<='9';c=getchar())
{
x=(x<<1)+(x<<3)+(c^48);
}
return;
}
|
[
"3305049949@qq.com"
] |
3305049949@qq.com
|
8e11c9b7c1bda25a185aa86294709e04f7425265
|
bd63a879ee50d98f2bcf8fb7780c6c295f9ac07c
|
/learn/test/push_relabel.cpp
|
93973162d96f2500c1b44f2c9c1fd0c3ec514b07
|
[] |
no_license
|
lijiansong/.trash
|
2c56b5effc2136a08e272e145e01e1bb54218bb3
|
da5307e086a31ec335385d1c533af3cbd6653a64
|
refs/heads/master
| 2021-06-21T06:31:25.170024
| 2017-08-13T05:22:46
| 2017-08-13T05:22:46
| 67,503,889
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 2,290
|
cpp
|
/*
Name:
Copyright:
Author:
Date: 11/12/16 23:50
Description:
http://blog.csdn.net/hechenghai/article/details/42719715
*/
#include <cstdio>
#include <climits>
#include <algorithm>
#include <cstring>
using namespace std;
const int MAXN=1001;
int s, t;
int n, np, nc, m;
char str[50];
int c[MAXN][MAXN];
int f[MAXN][MAXN];
int e[MAXN];
int h[MAXN];
void push(int u, int v)
{
int d = min(e[u], c[u][v] - f[u][v]);
f[u][v] += d;
f[v][u] = -f[u][v];
e[u] -= d;
e[v] += d;
}
bool relabel(int u)
{
int mh = INT_MAX;
for(int i=0; i<n+2; ++i)
{
if(c[u][i] > f[u][i])
mh = min(mh, h[i]);
}
if(mh == INT_MAX)
return false; //残留网络中无从u出发的路
h[u] = mh + 1;
for(int i=0; i<n+2; ++i)
{
if(e[u] == 0) //已无余流,不需再次push
break;
if(h[i] == mh && c[u][i] > f[u][i]) //push的条件
push(u, i);
}
return true;
}
void init_preflow()
{
memset(h, 0, sizeof(h));
memset(e, 0, sizeof(e));
h[s] = n+2;
for(int i=0; i<n+2; ++i)
{
if(c[s][i] == 0)
continue;
f[s][i] = c[s][i];
f[i][s] = -f[s][i];
e[i] = c[s][i];
e[s] -= c[s][i];
}
}
void push_relabel()
{
init_preflow();
bool flag = true; //表示是否还有relabel操作
while(flag)
{
flag = false;
for(int i=0; i<n; ++i)
if(e[i] > 0)
flag = flag || relabel(i);
}
}
int main()
{
while(scanf("%d%d%d%d", &n, &np, &nc, &m) != EOF)
{
s = n; t = n+1;
memset(c, 0, sizeof(c));
memset(f, 0, sizeof(f));
while(m--)
{
scanf("%s", &str);
int u=0, v=0, z=0;
sscanf(str, "(%d,%d)%d", &u, &v, &z);
c[u][v] = z;
}
for(int i=0; i<np+nc; ++i)
{
scanf("%s", &str);
int u=0, z=0;
sscanf(str, "(%d)%d", &u, &z);
if(i < np)
c[s][u] = z;
else if(i >= np && i < np + nc)
c[u][t] = z;
}
push_relabel();
printf("%d\n", e[t]);
}
}
|
[
"noreply@github.com"
] |
lijiansong.noreply@github.com
|
f236ea549a59f6711998919aafb6791caf9675f7
|
70fe255d0a301952a023be5e1c1fefd062d1e804
|
/其它练习/华东师范大学保研机试题练习/2009-3.cpp
|
c2a6cdfccec43f24c67f7c68359ee67bfc41cbdb
|
[
"MIT"
] |
permissive
|
LauZyHou/Algorithm-To-Practice
|
524d4318032467a975cf548d0c824098d63cca59
|
66c047fe68409c73a077eae561cf82b081cf8e45
|
refs/heads/master
| 2021-06-18T01:48:43.378355
| 2021-01-27T14:44:14
| 2021-01-27T14:44:14
| 147,997,740
| 8
| 1
| null | null | null | null |
WINDOWS-1252
|
C++
| false
| false
| 1,297
|
cpp
|
#include<iostream>
#include<list>
using namespace std;
//ËØÊý¶Ô,×÷·Ï
list<int> su;
int n,t,cnt;
bool isSu(int n) {
if(n == 1)
return false;
if(n < 4)
return true;
for(int i = 2; i * i <= n; i++) {
if(n % i == 0)
return false;
}
return true;
}
int main() {
scanf("%d", &n);
while(n--) {
scanf("%d",&t);
if(t<3){
printf("0\n");
continue;
}
for(int i = 2; i <= t; i++) {
if(isSu(i))
su.push_back(i);
}
if(su.empty()){
printf("0\n");
continue;
}
list<int>::const_iterator itA=su.cbegin();
list<int>::const_iterator itB=su.cend();
while(itA!=itB){
if(*itA+*itB==t+1){
cnt++;
itA++;
if(itA==itB)
break;
itB--;
cout<<"P";
}else if(*itA+*itB<t+1){
itA++;
cout<<"L";
}else{
itB--;
cout<<"K";
}
}
cnt=cnt<<2;
if(((*itA)<<2)==t+1)
cnt++;
printf("%d--\n",cnt);
cnt=0;
su.clear();
}
return 0;
}
|
[
"java233@foxmail.com"
] |
java233@foxmail.com
|
86f05f74907a15eba34f59f5c4bf67db7838eefd
|
fe276f0bae62c1a762323dda3cd42f5037df3dec
|
/cppLabs/src/Img.h
|
738279cb2fd4b7a2c63c38d03b213b9ec731d5a7
|
[] |
no_license
|
vivere-dally/ppd_c-
|
503cd254f812aa54816c346919456b9858e5f932
|
6380859c37ff5e862415c4333fb658b79a871d5e
|
refs/heads/main
| 2023-01-12T16:06:16.500455
| 2020-11-07T20:20:57
| 2020-11-07T20:20:57
| 307,159,280
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 434
|
h
|
#pragma once
#include <math.h>
template <typename T>
class Img {
protected:
int get_pure_index(int index, int limit) {
int pure_index = abs(index);
if(pure_index >= limit) {
int offset = (1 + pure_index - limit) * 2;
pure_index -= offset;
}
return pure_index;
}
public:
virtual void fill_img(int* numbers) = 0;
virtual void apply_kernel(T kernel, int kernel_rows, int kernel_columns) = 0;
};
|
[
"stefanbuciujr@gmail.com"
] |
stefanbuciujr@gmail.com
|
8550d9762b9fc92c89e56c5dd8fce556953c1a1b
|
15b30861877807094a5974ab892c72d25e487d19
|
/database/field_names.cpp
|
c2721d8652f7afd93a93bb10c110c5d7d5a0a97d
|
[] |
no_license
|
LuaxY/Linxemu
|
0a4775b5d3273b5a56f622fbf6132b688f842ca0
|
407f4024c523657b826fd62dc783483393f80544
|
refs/heads/master
| 2016-09-06T13:32:57.339527
| 2013-08-21T14:30:58
| 2013-08-21T14:30:58
| 17,882,652
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,010
|
cpp
|
/***********************************************************************
field_names.cpp - Implements the FieldNames class.
Copyright (c) 1998 by Kevin Atkinson, (c) 1999-2001 by MySQL AB, and
(c) 2004-2010 by Educational Technology Resources, Inc. Others may
also hold copyrights on code in this file. See the CREDITS.txt file
in the top directory of the distribution for details.
This file is part of MySQL++.
MySQL++ is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
MySQL++ 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with MySQL++; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
***********************************************************************/
#define MYSQLPP_NOT_HEADER
#include "common.h"
#include "field_names.h"
#include "result.h"
#include <algorithm>
namespace mysqlpp
{
namespace internal
{
extern void str_to_lwr(std::string& s);
}
void
FieldNames::init(const ResultBase* res)
{
size_t num = res->num_fields();
reserve(num);
for (size_t i = 0; i < num; i++)
{
push_back(res->fields().at(i).name());
}
}
unsigned int
FieldNames::operator [](const std::string& s) const
{
std::string temp1(s);
internal::str_to_lwr(temp1);
for (const_iterator it = begin(); it != end(); ++it)
{
std::string temp2(*it);
internal::str_to_lwr(temp2);
if (temp2.compare(temp1) == 0)
{
return it - begin();
}
}
return end() - begin();
}
} // end namespace mysqlpp
|
[
"yann.guineau@gmail.com"
] |
yann.guineau@gmail.com
|
1c515369c243ba9a580ea9712a9ac62a5f9ae4c7
|
78918391a7809832dc486f68b90455c72e95cdda
|
/boost_lib/boost/python/object/value_holder.hpp
|
55d305b69afdd6b9210923155eefeb8ebac5e62a
|
[
"MIT"
] |
permissive
|
kyx0r/FA_Patcher
|
50681e3e8bb04745bba44a71b5fd04e1004c3845
|
3f539686955249004b4483001a9e49e63c4856ff
|
refs/heads/master
| 2022-03-28T10:03:28.419352
| 2020-01-02T09:16:30
| 2020-01-02T09:16:30
| 141,066,396
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,782
|
hpp
|
#if !defined(BOOST_PP_IS_ITERATING)
// Copyright David Abrahams 2001.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
# ifndef VALUE_HOLDER_DWA20011215_HPP
# define VALUE_HOLDER_DWA20011215_HPP
# include <boost/python/object/value_holder_fwd.hpp>
# include <boost/python/instance_holder.hpp>
# include <boost/python/type_id.hpp>
# include <boost/python/wrapper.hpp>
# include <boost/python/object/inheritance_query.hpp>
# include <boost/python/object/forward.hpp>
# include <boost/python/detail/force_instantiate.hpp>
# include <boost/python/detail/preprocessor.hpp>
# include <boost/preprocessor/comma_if.hpp>
# include <boost/preprocessor/enum_params.hpp>
# include <boost/preprocessor/iterate.hpp>
# include <boost/preprocessor/repeat.hpp>
# include <boost/preprocessor/debug/line.hpp>
# include <boost/preprocessor/repetition/enum_params.hpp>
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
# include <boost/utility/addressof.hpp>
namespace boost
{
namespace python
{
namespace objects
{
#define BOOST_PYTHON_UNFORWARD_LOCAL(z, n, _) BOOST_PP_COMMA_IF(n) objects::do_unforward(a##n,0)
template <class Value>
struct value_holder : instance_holder
{
typedef Value held_type;
typedef Value value_type;
// Forward construction to the held object
# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/object/value_holder.hpp>, 1))
# include BOOST_PP_ITERATE()
private: // required holder implementation
void* holds(type_info, bool null_ptr_only);
template <class T>
inline void* holds_wrapped(type_info dst_t, wrapper<T>*,T* p)
{
return python::type_id<T>() == dst_t ? p : 0;
}
inline void* holds_wrapped(type_info, ...)
{
return 0;
}
private: // data members
Value m_held;
};
template <class Value, class Held>
struct value_holder_back_reference : instance_holder
{
typedef Held held_type;
typedef Value value_type;
// Forward construction to the held object
# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/object/value_holder.hpp>, 2))
# include BOOST_PP_ITERATE()
private: // required holder implementation
void* holds(type_info, bool null_ptr_only);
private: // data members
Held m_held;
};
# undef BOOST_PYTHON_UNFORWARD_LOCAL
template <class Value>
void* value_holder<Value>::holds(type_info dst_t, bool /*null_ptr_only*/)
{
if (void* wrapped = holds_wrapped(dst_t, boost::addressof(m_held), boost::addressof(m_held)))
return wrapped;
type_info src_t = python::type_id<Value>();
return src_t == dst_t ? boost::addressof(m_held)
: find_static_type(boost::addressof(m_held), src_t, dst_t);
}
template <class Value, class Held>
void* value_holder_back_reference<Value,Held>::holds(
type_info dst_t, bool /*null_ptr_only*/)
{
type_info src_t = python::type_id<Value>();
Value* x = &m_held;
if (dst_t == src_t)
return x;
else if (dst_t == python::type_id<Held>())
return &m_held;
else
return find_static_type(x, src_t, dst_t);
}
}
}
} // namespace boost::python::objects
# endif // VALUE_HOLDER_DWA20011215_HPP
// --------------- value_holder ---------------
// For gcc 4.4 compatability, we must include the
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
#else // BOOST_PP_IS_ITERATING
#if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder))
# endif
# define N BOOST_PP_ITERATION()
# if (N != 0)
template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)>
# endif
value_holder(
PyObject* self BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a))
: m_held(
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil)
)
{
python::detail::initialize_wrapper(self, boost::addressof(this->m_held));
}
# undef N
// --------------- value_holder_back_reference ---------------
#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder_back_reference))
# endif
# define N BOOST_PP_ITERATION()
# if (N != 0)
template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)>
# endif
value_holder_back_reference(
PyObject* p BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a))
: m_held(
p BOOST_PP_COMMA_IF(N)
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil)
)
{
}
# undef N
#endif // BOOST_PP_ITERATION_DEPTH()
#endif
|
[
"k.melekhin@gmail.com"
] |
k.melekhin@gmail.com
|
150be5d375f7f99308fa8ab2b19b326da4569f1d
|
11228887a9e68aba52c68a9c3c116461c1122c74
|
/EngineMechanics/MathManipulations.h
|
372b9abe9f20c63a5e1ca7032cdaf0c299615b52
|
[] |
no_license
|
mgoulet/phase4
|
ddc348d7e3dc58f6e5778f6649973fa24e882a6d
|
15de636b55c273d36884cebcd27708f044204dca
|
refs/heads/master
| 2016-09-06T00:20:31.478035
| 2011-12-21T21:13:14
| 2011-12-21T21:13:14
| 3,029,498
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,123
|
h
|
////////////////////////////////////////////////
// Martin Goulet
// Project:
// MathManipulations.h
////////////////////////////////////////////////
/*
NOTE: This namespace does NOT contain the manipulations found
in the PrimitiveManipulations from the previous version
of the project.
*/
#ifndef MATHMANIPULATIONS_H
#define MATHMANIPULATIONS_H
#include <iostream>
#include <deque>
#include <cmath>
#include "MathEntities.h"
using namespace std;
namespace MathManipulations
{
//explicit vectorial operator overloaders
bool AddVEC (VEC& vtarget_ref, const VEC& v_ref);
bool AddVEC (VEC& vtarget_ref, const VEC& v1_ref, const VEC& v2_ref);
bool SubVEC (VEC& vtarget_ref, const VEC& v1_ref);
bool SubVEC (VEC& vtarget_ref, const VEC& v1_ref, const VEC& v2_ref);
bool MulVEC (VEC& vtarget_ref, float f);
//trivial structure manipulations
float SizVEC (const VEC& v_ref);
bool InvVEC (VEC& v_ref);
bool NorVEC (VEC& v_ref);
bool CroVEC (VEC& vtarget_ref, const VEC& v1_ref, const VEC& v2_ref);
float DotVEC (const VEC& v1_ref, const VEC& v2_ref);
float RtsCHK (float fCentreBit, float fErrorBit, float fResultToClassify);
float FndDeg (const VEC& v1_ref, const VEC& v2_ref);
//compound structure manipulations
bool PrlCHK (const PLN& pln_ref, const TRI& tri_ref);
bool IntLINPLN (VEC& v_ref, const LIN& lin_ref, const PLN& pln_ref);
bool IntSEGPLN (VEC& v_ref, const LIN& lin_ref, const PLN& pln_ref);
bool IntRAYPLN (VEC& v_ref, const LIN& lin_ref, const PLN& pln_ref);
//3X3 matrix manipulations
float DetMtx3X3 (const M3X3& m3x3_ref);
bool RotMtx3X3 (VEC& vtarget_ref, const VEC& vxis_ref, float fAngle);
bool MulMtx3X3 (M3X3& m3x3_ref, float f);
bool MulMtx3X3 (M3X3& m3x3target_ref, const M3X3& m3x3_ref);
bool TrsMtx3X3 (M3X3& m3x3_ref);
bool InvMtx3X3 (M3X3& m3x3_ref);
//4X4 matrix manipulations
bool CpyMtx4X4 (M4X4& m4x4_ref, const M3X3& m3x3_ref);
bool MulMtx4X4 (M4X4& m4x4_ref, float f);
bool MulMtx4X4 (M4X4& m4x4target_ref, const M4X4& m4x4_ref);
bool MulMtx4X4 (VEC& vtarget_ref, const M4X4& m4x4_ref, const VEC& v_ref);
};
#endif MATHMANIPULATIONS_H
|
[
"martin.goulet@gmail.com"
] |
martin.goulet@gmail.com
|
0bbed5209f713c5e8627c5d430dc89144f597371
|
c044f03d16fc7506a6699a31061ea6a1abd3a68e
|
/src/bonus.cpp
|
6132326236f986f319061c5514608bbbb3e7ac58
|
[] |
no_license
|
mirkoviviano/CppND-Capstone-A-Weird-Snake-Game
|
4c0a3befe81467058f7e09f0c85aef0530e2fe19
|
978d650ab5d11a1b565a8b9f4eb1b40d23fbcf22
|
refs/heads/master
| 2020-07-21T20:32:59.264141
| 2019-10-11T16:56:47
| 2019-10-11T16:56:47
| 206,969,159
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 240
|
cpp
|
#include "bonus.h"
#include <cmath>
#include <iostream>
int Bonus::GetPower(){
Bonus::Power power = Bonus::Power(rand() % 4 + 1);
return power;
}
int Bonus::Duration(){
duration = rand() % 10000 + 1000;
return duration;
}
|
[
"info@mirkoviviano.it"
] |
info@mirkoviviano.it
|
5694f62d857ae5146549885e4d64d943718de41a
|
9c11b715c8f86bae205f9798bdd283de190458e4
|
/src/include/Nvim/PictureRenderer.cpp
|
eaa3905201c96d56390634fab26bdacd6c15b1f4
|
[
"Apache-2.0"
] |
permissive
|
some-mthfka/Viy
|
c8855d33414b95371d894a0ccdd8358c0fd53639
|
c78cfb55e548ce40b9fe3756e4ce2a923b84a552
|
refs/heads/master
| 2022-02-20T20:26:53.712733
| 2019-04-30T20:41:32
| 2019-04-30T20:41:32
| 67,196,697
| 4
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,992
|
cpp
|
#include <Nvim/PictureRenderer.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <iostream>
#include <Debug.hpp>
nvim::PictureRenderer::PictureRenderer(const DataHolder &dataHolder,
const GUIOptions &GUIOptions,
PictureProvider &pictureProvider)
: mDataHolder(dataHolder)
, mGUIOptions(GUIOptions)
, mPictureProvider(pictureProvider)
{
resize(); //uses mGUIOptions for info
}
void nvim::PictureRenderer::drawPictureFragment(const sf::Texture &texture,
const Tag &pictureTag,
int row)
{
//top, left, bottom, right
sf::IntRect fragment(
0,
static_cast<float>(pictureTag.getFragmentNumber()) / pictureTag.getSize() * texture.getSize().y,
texture.getSize().x,
texture.getSize().y / pictureTag.getSize());
sf::Sprite picFragment(texture, fragment);
picFragment.setScale(
static_cast<float>(mGUIOptions.getLineSpacing()) / fragment.height,
static_cast<float>(mGUIOptions.getLineSpacing()) / fragment.height);
picFragment.setPosition(pictureTag.getHorizontalPosition() * mGUIOptions.getCharWidth(),
mGUIOptions.getLineSpacing() * row);
//clean with background color first
sf::RectangleShape cellRow(
sf::Vector2f(std::max
(static_cast<int>(fragment.width * picFragment.getScale().y),
mGUIOptions.getCharWidth() * pictureTag.getLength()),
mGUIOptions.getLineSpacing()));
cellRow.setPosition(picFragment.getPosition());
cellRow.setFillColor(mDataHolder.getPrimaryBackgroundColor());
mRenderTexture.draw(cellRow, sf::BlendNone);
mRenderTexture.draw(picFragment);
mIsRowClean[row] = false;
}
void nvim::PictureRenderer::drawPictureLoadMessage(sf::String message, int col, int row)
{
sf::RectangleShape cellRow(sf::Vector2f(mGUIOptions.getCharWidth() * message.getSize(),
mGUIOptions.getLineSpacing()));
cellRow.setFillColor(sf::Color::Black);
cellRow.setPosition(mGUIOptions.getCharWidth() * col,
mGUIOptions.getLineSpacing() * row);
sf::Text text;
text.setString(message);
text.setFont(mGUIOptions.getFont());
text.setCharacterSize(mGUIOptions.getFontSize());
text.setPosition(cellRow.getPosition());
mRenderTexture.draw(cellRow, sf::BlendNone);
mRenderTexture.draw(text);
mIsRowClean[row] = false;
}
void nvim::PictureRenderer::cleanRow(int row)
{
if (!mIsRowClean[row])
{
sf::RectangleShape cellRow(sf::Vector2f(
mGUIOptions.getCharWidth() * mGUIOptions.cols(),
mGUIOptions.getLineSpacing()));
cellRow.setPosition(0, mGUIOptions.getLineSpacing() * row);
cellRow.setFillColor(sf::Color::Transparent);
mRenderTexture.draw(cellRow, sf::BlendNone);
mIsRowClean[row] = true;
}
}
void nvim::PictureRenderer::update()
{
for (int i = 0; i < mGUIOptions.rows(); i++)
{
const sf::String &textRow = mDataHolder.getTextAtRow(i);
//We do not want to display a picture at the row
//where the cursor is currently located.
if (mDataHolder.getCursorPosition().x == i)
{
cleanRow(i);
mTextCache[i] = "";
continue;
}
if (mTextCache[i] != textRow)
{
cleanRow(i);
//try constructing a tag
Tag pictureTag(textRow);
if (!pictureTag.isValid())
mTextCache[i] = textRow;
if (pictureTag.isValid())
{
auto requestedPicture = mPictureProvider.getPicture(
sf::String(pictureTag.getName()));
switch (requestedPicture.first)
{
case PictureProvider::PictureLoadStatus::READY:
drawPictureFragment(*requestedPicture.second, pictureTag, i);
mTextCache[i] = textRow;
break;
case PictureProvider::PictureLoadStatus::LOADING:
drawPictureLoadMessage("Loading",
pictureTag.getHorizontalPosition(),
i);
break;
case PictureProvider::PictureLoadStatus::FAILED:
drawPictureLoadMessage("Failed to load",
pictureTag.getHorizontalPosition(),
i);
break;
default:
assert(false);
break;
}
}
}
}
mRenderTexture.display();
}
void nvim::PictureRenderer::resize()
{
const auto rows = mGUIOptions.rows();
const auto cols = mGUIOptions.cols();
mTextCache.resize(0);
sf::String emptyRow;
for (int i = 0; i < rows; i++)
emptyRow += ' ';
mTextCache.resize(rows, emptyRow);
mRenderTexture.create(cols * mGUIOptions.getCharWidth(),
rows * mGUIOptions.getLineSpacing());
mRenderTexture.clear(sf::Color::Transparent);
mSprite.setTexture(mRenderTexture.getTexture(),
/*resetRect =*/ true);
mIsRowClean.resize(rows, true);
update();
}
void nvim::PictureRenderer::render(sf::RenderTarget &target, const sf::RenderStates &states) const
{
target.draw(mSprite, states);
}
|
[
"noreply@github.com"
] |
some-mthfka.noreply@github.com
|
f18a0d72859ea90385deba8371a5b93a5cdd6df5
|
56bd4faa9c00a871139c6e419fff02c8d5207cef
|
/src/muz/spacer/spacer_legacy_mev.cpp
|
0ab33c69326335f2762d0da654fb65f3209bda6c
|
[
"MIT"
] |
permissive
|
SRI-CSL/z3
|
e950f5d32477166bfefe2ab77644b31827d9a354
|
a5ce83b6ad12f44661d24e9ad91f926bfbadfba6
|
refs/heads/master
| 2020-04-12T17:17:50.276968
| 2018-12-20T23:08:33
| 2018-12-20T23:08:33
| 162,640,242
| 1
| 2
|
NOASSERTION
| 2018-12-20T23:02:31
| 2018-12-20T23:02:31
| null |
UTF-8
|
C++
| false
| false
| 24,468
|
cpp
|
/**
Copyright (c) 2017 Arie Gurfinkel
Deprecated implementation of model evaluator. To be removed.
*/
#include <sstream>
#include "arith_simplifier_plugin.h"
#include "array_decl_plugin.h"
#include "ast_pp.h"
#include "basic_simplifier_plugin.h"
#include "bv_simplifier_plugin.h"
#include "bool_rewriter.h"
#include "dl_util.h"
#include "for_each_expr.h"
#include "smt_params.h"
#include "model.h"
#include "ref_vector.h"
#include "rewriter.h"
#include "rewriter_def.h"
#include "util.h"
#include "spacer_manager.h"
#include "spacer_legacy_mev.h"
#include "spacer_util.h"
#include "arith_decl_plugin.h"
#include "expr_replacer.h"
#include "model_smt2_pp.h"
#include "scoped_proof.h"
#include "qe_lite.h"
#include "spacer_qe_project.h"
#include "model_pp.h"
#include "expr_safe_replace.h"
#include "datatype_decl_plugin.h"
#include "bv_decl_plugin.h"
namespace old {
/////////////////////////
// model_evaluator
//
void model_evaluator::assign_value(expr* e, expr* val)
{
rational r;
if (m.is_true(val)) {
set_true(e);
} else if (m.is_false(val)) {
set_false(e);
} else if (m_arith.is_numeral(val, r)) {
set_number(e, r);
} else if (m.is_value(val)) {
set_value(e, val);
} else {
IF_VERBOSE(3, verbose_stream() << "Not evaluated " << mk_pp(e, m) << "\n";);
TRACE("old_spacer", tout << "Variable is not tracked: " << mk_pp(e, m) << "\n";);
set_x(e);
}
}
void model_evaluator::setup_model(const model_ref& model)
{
m_numbers.reset();
m_values.reset();
m_model = model.get();
rational r;
unsigned sz = model->get_num_constants();
for (unsigned i = 0; i < sz; i++) {
func_decl * d = model->get_constant(i);
expr* val = model->get_const_interp(d);
expr* e = m.mk_const(d);
m_refs.push_back(e);
assign_value(e, val);
}
}
void model_evaluator::reset()
{
m1.reset();
m2.reset();
m_values.reset();
m_visited.reset();
m_numbers.reset();
m_refs.reset();
m_model = 0;
}
void model_evaluator::minimize_literals(ptr_vector<expr> const& formulas,
const model_ref& mdl, expr_ref_vector& result)
{
TRACE("old_spacer",
tout << "formulas:\n";
for (unsigned i = 0; i < formulas.size(); ++i) tout << mk_pp(formulas[i], m) << "\n";
);
expr_ref tmp(m);
ptr_vector<expr> tocollect;
setup_model(mdl);
collect(formulas, tocollect);
for (unsigned i = 0; i < tocollect.size(); ++i) {
expr* e = tocollect[i];
expr* e1, *e2;
SASSERT(m.is_bool(e));
SASSERT(is_true(e) || is_false(e));
if (is_true(e)) {
result.push_back(e);
}
// hack to break disequalities for arithmetic variables.
else if (m.is_eq(e, e1, e2) && m_arith.is_int_real(e1)) {
if (get_number(e1) < get_number(e2)) {
result.push_back(m_arith.mk_lt(e1, e2));
} else {
result.push_back(m_arith.mk_lt(e2, e1));
}
} else {
result.push_back(m.mk_not(e));
}
}
reset();
TRACE("old_spacer",
tout << "minimized model:\n";
for (unsigned i = 0; i < result.size(); ++i) tout << mk_pp(result[i].get(), m) << "\n";
);
}
void model_evaluator::process_formula(app* e, ptr_vector<expr>& todo, ptr_vector<expr>& tocollect)
{
SASSERT(m.is_bool(e));
SASSERT(is_true(e) || is_false(e));
unsigned v = is_true(e);
unsigned sz = e->get_num_args();
expr* const* args = e->get_args();
if (e->get_family_id() == m.get_basic_family_id()) {
switch (e->get_decl_kind()) {
case OP_TRUE:
break;
case OP_FALSE:
break;
case OP_EQ:
case OP_IFF:
if (args[0] == args[1]) {
SASSERT(v);
// no-op
} else if (m.is_bool(args[0])) {
todo.append(sz, args);
} else {
tocollect.push_back(e);
}
break;
case OP_DISTINCT:
tocollect.push_back(e);
break;
case OP_ITE:
if (args[1] == args[2]) {
tocollect.push_back(args[1]);
} else if (is_true(args[1]) && is_true(args[2])) {
todo.append(2, args + 1);
} else if (is_false(args[1]) && is_false(args[2])) {
todo.append(2, args + 1);
} else if (is_true(args[0])) {
todo.append(2, args);
} else {
SASSERT(is_false(args[0]));
todo.push_back(args[0]);
todo.push_back(args[2]);
}
break;
case OP_AND:
if (v) {
todo.append(sz, args);
} else {
unsigned i = 0;
for (; !is_false(args[i]) && i < sz; ++i);
if (i == sz) {
fatal_error(1);
}
VERIFY(i < sz);
todo.push_back(args[i]);
}
break;
case OP_OR:
if (v) {
unsigned i = 0;
for (; !is_true(args[i]) && i < sz; ++i);
if (i == sz) {
fatal_error(1);
}
VERIFY(i < sz);
todo.push_back(args[i]);
} else {
todo.append(sz, args);
}
break;
case OP_XOR:
case OP_NOT:
todo.append(sz, args);
break;
case OP_IMPLIES:
if (v) {
if (is_true(args[1])) {
todo.push_back(args[1]);
} else if (is_false(args[0])) {
todo.push_back(args[0]);
} else {
IF_VERBOSE(0, verbose_stream() << "Term not handled " << mk_pp(e, m) << "\n";);
UNREACHABLE();
}
} else {
todo.append(sz, args);
}
break;
default:
IF_VERBOSE(0, verbose_stream() << "Term not handled " << mk_pp(e, m) << "\n";);
UNREACHABLE();
}
} else {
tocollect.push_back(e);
}
}
void model_evaluator::collect(ptr_vector<expr> const& formulas, ptr_vector<expr>& tocollect)
{
ptr_vector<expr> todo;
todo.append(formulas);
m_visited.reset();
VERIFY(check_model(formulas));
while (!todo.empty()) {
app* e = to_app(todo.back());
todo.pop_back();
if (!m_visited.is_marked(e)) {
process_formula(e, todo, tocollect);
m_visited.mark(e, true);
}
}
m_visited.reset();
}
void model_evaluator::eval_arith(app* e)
{
rational r, r2;
#define ARG1 e->get_arg(0)
#define ARG2 e->get_arg(1)
unsigned arity = e->get_num_args();
for (unsigned i = 0; i < arity; ++i) {
expr* arg = e->get_arg(i);
if (is_x(arg)) {
set_x(e);
return;
}
SASSERT(!is_unknown(arg));
}
switch (e->get_decl_kind()) {
case OP_NUM:
VERIFY(m_arith.is_numeral(e, r));
set_number(e, r);
break;
case OP_IRRATIONAL_ALGEBRAIC_NUM:
set_x(e);
break;
case OP_LE:
set_bool(e, get_number(ARG1) <= get_number(ARG2));
break;
case OP_GE:
set_bool(e, get_number(ARG1) >= get_number(ARG2));
break;
case OP_LT:
set_bool(e, get_number(ARG1) < get_number(ARG2));
break;
case OP_GT:
set_bool(e, get_number(ARG1) > get_number(ARG2));
break;
case OP_ADD:
r = rational::zero();
for (unsigned i = 0; i < arity; ++i) {
r += get_number(e->get_arg(i));
}
set_number(e, r);
break;
case OP_SUB:
r = get_number(e->get_arg(0));
for (unsigned i = 1; i < arity; ++i) {
r -= get_number(e->get_arg(i));
}
set_number(e, r);
break;
case OP_UMINUS:
SASSERT(arity == 1);
set_number(e, -get_number(e->get_arg(0)));
break;
case OP_MUL:
r = rational::one();
for (unsigned i = 0; i < arity; ++i) {
r *= get_number(e->get_arg(i));
}
set_number(e, r);
break;
case OP_DIV:
SASSERT(arity == 2);
r = get_number(ARG2);
if (r.is_zero()) {
set_x(e);
} else {
set_number(e, get_number(ARG1) / r);
}
break;
case OP_IDIV:
SASSERT(arity == 2);
r = get_number(ARG2);
if (r.is_zero()) {
set_x(e);
} else {
set_number(e, div(get_number(ARG1), r));
}
break;
case OP_REM:
// rem(v1,v2) = if v2 >= 0 then mod(v1,v2) else -mod(v1,v2)
SASSERT(arity == 2);
r = get_number(ARG2);
if (r.is_zero()) {
set_x(e);
} else {
r2 = mod(get_number(ARG1), r);
if (r.is_neg()) { r2.neg(); }
set_number(e, r2);
}
break;
case OP_MOD:
SASSERT(arity == 2);
r = get_number(ARG2);
if (r.is_zero()) {
set_x(e);
} else {
set_number(e, mod(get_number(ARG1), r));
}
break;
case OP_TO_REAL:
SASSERT(arity == 1);
set_number(e, get_number(ARG1));
break;
case OP_TO_INT:
SASSERT(arity == 1);
set_number(e, floor(get_number(ARG1)));
break;
case OP_IS_INT:
SASSERT(arity == 1);
set_bool(e, get_number(ARG1).is_int());
break;
case OP_POWER:
set_x(e);
break;
default:
IF_VERBOSE(0, verbose_stream() << "Term not handled " << mk_pp(e, m) << "\n";);
UNREACHABLE();
break;
}
}
void model_evaluator::inherit_value(expr* e, expr* v)
{
expr* w;
SASSERT(!is_unknown(v));
SASSERT(m.get_sort(e) == m.get_sort(v));
if (is_x(v)) {
set_x(e);
} else if (m.is_bool(e)) {
SASSERT(m.is_bool(v));
if (is_true(v)) { set_true(e); }
else if (is_false(v)) { set_false(e); }
else {
TRACE("old_spacer", tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";);
set_x(e);
}
} else if (m_arith.is_int_real(e)) {
set_number(e, get_number(v));
} else if (m.is_value(v)) {
set_value(e, v);
} else if (m_values.find(v, w)) {
set_value(e, w);
} else {
TRACE("old_spacer", tout << "not inherited:\n" << mk_pp(e, m) << "\n" << mk_pp(v, m) << "\n";);
set_x(e);
}
}
void model_evaluator::eval_exprs(expr_ref_vector& es)
{
model_ref mr(m_model);
for (unsigned j = 0; j < es.size(); ++j) {
if (m_array.is_as_array(es[j].get())) {
es[j] = eval(mr, es[j].get());
}
}
}
bool model_evaluator::extract_array_func_interp(expr* a, vector<expr_ref_vector>& stores, expr_ref& else_case)
{
SASSERT(m_array.is_array(a));
TRACE("old_spacer", tout << mk_pp(a, m) << "\n";);
while (m_array.is_store(a)) {
expr_ref_vector store(m);
store.append(to_app(a)->get_num_args() - 1, to_app(a)->get_args() + 1);
eval_exprs(store);
stores.push_back(store);
a = to_app(a)->get_arg(0);
}
if (m_array.is_const(a)) {
else_case = to_app(a)->get_arg(0);
return true;
}
while (m_array.is_as_array(a)) {
func_decl* f = m_array.get_as_array_func_decl(to_app(a));
func_interp* g = m_model->get_func_interp(f);
unsigned sz = g->num_entries();
unsigned arity = f->get_arity();
for (unsigned i = 0; i < sz; ++i) {
expr_ref_vector store(m);
func_entry const* fe = g->get_entry(i);
store.append(arity, fe->get_args());
store.push_back(fe->get_result());
for (unsigned j = 0; j < store.size(); ++j) {
if (!is_ground(store[j].get())) {
TRACE("old_spacer", tout << "could not extract array interpretation: " << mk_pp(a, m) << "\n" << mk_pp(store[j].get(), m) << "\n";);
return false;
}
}
eval_exprs(store);
stores.push_back(store);
}
else_case = g->get_else();
if (!else_case) {
TRACE("old_spacer", tout << "no else case " << mk_pp(a, m) << "\n";);
return false;
}
if (!is_ground(else_case)) {
TRACE("old_spacer", tout << "non-ground else case " << mk_pp(a, m) << "\n" << mk_pp(else_case, m) << "\n";);
return false;
}
if (m_array.is_as_array(else_case)) {
model_ref mr(m_model);
else_case = eval(mr, else_case);
}
TRACE("old_spacer", tout << "else case: " << mk_pp(else_case, m) << "\n";);
return true;
}
TRACE("old_spacer", tout << "no translation: " << mk_pp(a, m) << "\n";);
return false;
}
/**
best effort evaluator of extensional array equality.
*/
void model_evaluator::eval_array_eq(app* e, expr* arg1, expr* arg2)
{
TRACE("old_spacer", tout << "array equality: " << mk_pp(e, m) << "\n";);
expr_ref v1(m), v2(m);
m_model->eval(arg1, v1);
m_model->eval(arg2, v2);
if (v1 == v2) {
set_true(e);
return;
}
sort* s = m.get_sort(arg1);
sort* r = get_array_range(s);
// give up evaluating finite domain/range arrays
if (!r->is_infinite() && !r->is_very_big() && !s->is_infinite() && !s->is_very_big()) {
TRACE("old_spacer", tout << "equality is unknown: " << mk_pp(e, m) << "\n";);
set_x(e);
return;
}
vector<expr_ref_vector> store;
expr_ref else1(m), else2(m);
if (!extract_array_func_interp(v1, store, else1) ||
!extract_array_func_interp(v2, store, else2)) {
TRACE("old_spacer", tout << "equality is unknown: " << mk_pp(e, m) << "\n";);
set_x(e);
return;
}
if (else1 != else2) {
if (m.is_value(else1) && m.is_value(else2)) {
TRACE("old_spacer", tout
<< "defaults are different: " << mk_pp(e, m) << " "
<< mk_pp(else1, m) << " " << mk_pp(else2, m) << "\n";);
set_false(e);
} else if (m_array.is_array(else1)) {
eval_array_eq(e, else1, else2);
} else {
TRACE("old_spacer", tout << "equality is unknown: " << mk_pp(e, m) << "\n";);
set_x(e);
}
return;
}
expr_ref s1(m), s2(m), w1(m), w2(m);
expr_ref_vector args1(m), args2(m);
args1.push_back(v1);
args2.push_back(v2);
for (unsigned i = 0; i < store.size(); ++i) {
args1.resize(1);
args2.resize(1);
args1.append(store[i].size() - 1, store[i].c_ptr());
args2.append(store[i].size() - 1, store[i].c_ptr());
s1 = m_array.mk_select(args1.size(), args1.c_ptr());
s2 = m_array.mk_select(args2.size(), args2.c_ptr());
m_model->eval(s1, w1);
m_model->eval(s2, w2);
if (w1 == w2) {
continue;
}
if (m.is_value(w1) && m.is_value(w2)) {
TRACE("old_spacer", tout << "Equality evaluation: " << mk_pp(e, m) << "\n";
tout << mk_pp(s1, m) << " |-> " << mk_pp(w1, m) << "\n";
tout << mk_pp(s2, m) << " |-> " << mk_pp(w2, m) << "\n";);
set_false(e);
} else if (m_array.is_array(w1)) {
eval_array_eq(e, w1, w2);
if (is_true(e)) {
continue;
}
} else {
TRACE("old_spacer", tout << "equality is unknown: " << mk_pp(e, m) << "\n";);
set_x(e);
}
return;
}
set_true(e);
}
void model_evaluator::eval_eq(app* e, expr* arg1, expr* arg2)
{
if (arg1 == arg2) {
set_true(e);
} else if (m_array.is_array(arg1)) {
eval_array_eq(e, arg1, arg2);
} else if (is_x(arg1) || is_x(arg2)) {
set_x(e);
} else if (m.is_bool(arg1)) {
bool val = is_true(arg1) == is_true(arg2);
SASSERT(val == (is_false(arg1) == is_false(arg2)));
if (val) {
set_true(e);
} else {
set_false(e);
}
} else if (m_arith.is_int_real(arg1)) {
set_bool(e, get_number(arg1) == get_number(arg2));
} else {
expr* e1 = get_value(arg1);
expr* e2 = get_value(arg2);
if (m.is_value(e1) && m.is_value(e2)) {
set_bool(e, e1 == e2);
} else if (e1 == e2) {
set_bool(e, true);
} else {
TRACE("old_spacer", tout << "not value equal:\n" << mk_pp(e1, m) << "\n" << mk_pp(e2, m) << "\n";);
set_x(e);
}
}
}
void model_evaluator::eval_basic(app* e)
{
expr* arg1, *arg2;
expr *argCond, *argThen, *argElse, *arg;
bool has_x = false;
unsigned arity = e->get_num_args();
switch (e->get_decl_kind()) {
case OP_AND:
for (unsigned j = 0; j < arity; ++j) {
expr * arg = e->get_arg(j);
if (is_false(arg)) {
set_false(e);
return;
} else if (is_x(arg)) {
has_x = true;
} else {
SASSERT(is_true(arg));
}
}
if (has_x) {
set_x(e);
} else {
set_true(e);
}
break;
case OP_OR:
for (unsigned j = 0; j < arity; ++j) {
expr * arg = e->get_arg(j);
if (is_true(arg)) {
set_true(e);
return;
} else if (is_x(arg)) {
has_x = true;
} else {
SASSERT(is_false(arg));
}
}
if (has_x) {
set_x(e);
} else {
set_false(e);
}
break;
case OP_NOT:
VERIFY(m.is_not(e, arg));
if (is_true(arg)) {
set_false(e);
} else if (is_false(arg)) {
set_true(e);
} else {
SASSERT(is_x(arg));
set_x(e);
}
break;
case OP_IMPLIES:
VERIFY(m.is_implies(e, arg1, arg2));
if (is_false(arg1) || is_true(arg2)) {
set_true(e);
} else if (arg1 == arg2) {
set_true(e);
} else if (is_true(arg1) && is_false(arg2)) {
set_false(e);
} else {
SASSERT(is_x(arg1) || is_x(arg2));
set_x(e);
}
break;
case OP_IFF:
VERIFY(m.is_iff(e, arg1, arg2));
eval_eq(e, arg1, arg2);
break;
case OP_XOR:
VERIFY(m.is_xor(e, arg1, arg2));
eval_eq(e, arg1, arg2);
if (is_false(e)) { set_true(e); }
else if (is_true(e)) { set_false(e); }
break;
case OP_ITE:
VERIFY(m.is_ite(e, argCond, argThen, argElse));
if (is_true(argCond)) {
inherit_value(e, argThen);
} else if (is_false(argCond)) {
inherit_value(e, argElse);
} else if (argThen == argElse) {
inherit_value(e, argThen);
} else if (m.is_bool(e)) {
SASSERT(is_x(argCond));
if (is_x(argThen) || is_x(argElse)) {
set_x(e);
} else if (is_true(argThen) == is_true(argElse)) {
inherit_value(e, argThen);
} else {
set_x(e);
}
} else {
set_x(e);
}
break;
case OP_TRUE:
set_true(e);
break;
case OP_FALSE:
set_false(e);
break;
case OP_EQ:
VERIFY(m.is_eq(e, arg1, arg2));
eval_eq(e, arg1, arg2);
break;
case OP_DISTINCT: {
vector<rational> values;
for (unsigned i = 0; i < arity; ++i) {
expr* arg = e->get_arg(i);
if (is_x(arg)) {
set_x(e);
return;
}
values.push_back(get_number(arg));
}
std::sort(values.begin(), values.end());
for (unsigned i = 0; i + 1 < values.size(); ++i) {
if (values[i] == values[i + 1]) {
set_false(e);
return;
}
}
set_true(e);
break;
}
default:
IF_VERBOSE(0, verbose_stream() << "Term not handled " << mk_pp(e, m) << "\n";);
UNREACHABLE();
}
}
void model_evaluator::eval_fmls(ptr_vector<expr> const& formulas)
{
ptr_vector<expr> todo(formulas);
while (!todo.empty()) {
expr * curr_e = todo.back();
if (!is_app(curr_e)) {
todo.pop_back();
continue;
}
app * curr = to_app(curr_e);
if (!is_unknown(curr)) {
todo.pop_back();
continue;
}
unsigned arity = curr->get_num_args();
for (unsigned i = 0; i < arity; ++i) {
if (is_unknown(curr->get_arg(i))) {
todo.push_back(curr->get_arg(i));
}
}
if (todo.back() != curr) {
continue;
}
todo.pop_back();
if (curr->get_family_id() == m_arith.get_family_id()) {
eval_arith(curr);
} else if (curr->get_family_id() == m.get_basic_family_id()) {
eval_basic(curr);
} else {
expr_ref vl(m);
m_model->eval(curr, vl);
assign_value(curr, vl);
}
IF_VERBOSE(35, verbose_stream() << "assigned " << mk_pp(curr_e, m)
<< (is_true(curr_e) ? "true" : is_false(curr_e) ? "false" : "unknown") << "\n";);
SASSERT(!is_unknown(curr));
}
}
bool model_evaluator::check_model(ptr_vector<expr> const& formulas)
{
eval_fmls(formulas);
bool has_x = false;
for (unsigned i = 0; i < formulas.size(); ++i) {
expr * form = formulas[i];
SASSERT(!is_unknown(form));
TRACE("spacer_verbose",
tout << "formula is " << (is_true(form) ? "true" : is_false(form) ? "false" : "unknown") << "\n" << mk_pp(form, m) << "\n";);
if (is_false(form)) {
IF_VERBOSE(0, verbose_stream() << "formula false in model: " << mk_pp(form, m) << "\n";);
UNREACHABLE();
}
if (is_x(form)) {
IF_VERBOSE(0, verbose_stream() << "formula undetermined in model: " << mk_pp(form, m) << "\n";);
TRACE("old_spacer", model_smt2_pp(tout, m, *m_model, 0););
has_x = true;
}
}
return !has_x;
}
expr_ref model_evaluator::eval_heavy(const model_ref& model, expr* fml)
{
expr_ref result(model->get_manager());
setup_model(model);
ptr_vector<expr> fmls;
fmls.push_back(fml);
eval_fmls(fmls);
if (is_false(fml)) {
result = m.mk_false();
} else if (is_true(fml) || is_x(fml)) {
result = m.mk_true();
} else if (m_arith.is_int_real(fml)) {
result = m_arith.mk_numeral(get_number(fml), m_arith.is_int(fml));
} else {
result = get_value(fml);
}
reset();
return result;
}
expr_ref model_evaluator::eval(const model_ref& model, func_decl* d)
{
SASSERT(d->get_arity() == 0);
expr_ref result(m);
if (m_array.is_array(d->get_range())) {
expr_ref e(m);
e = m.mk_const(d);
result = eval(model, e);
} else {
result = model->get_const_interp(d);
}
return result;
}
expr_ref model_evaluator::eval(const model_ref& model, expr* e)
{
expr_ref result(m);
m_model = model.get();
VERIFY(m_model->eval(e, result, true));
if (m_array.is_array(e)) {
vector<expr_ref_vector> stores;
expr_ref_vector args(m);
expr_ref else_case(m);
if (extract_array_func_interp(result, stores, else_case)) {
result = m_array.mk_const_array(m.get_sort(e), else_case);
while (!stores.empty() && stores.back().back() == else_case) {
stores.pop_back();
}
for (unsigned i = stores.size(); i > 0;) {
--i;
args.resize(1);
args[0] = result;
args.append(stores[i]);
result = m_array.mk_store(args.size(), args.c_ptr());
}
return result;
}
}
return result;
}
}
|
[
"arie.gurfinkel@uwaterloo.ca"
] |
arie.gurfinkel@uwaterloo.ca
|
56e243fc97ece22fed718d9f43f4f026d37fb888
|
448ee86f1acde912aebb4a03065cb4dad396c729
|
/bakaengine/game/scene/gameobject.h
|
06d0621a32fb11bd3594aa8710a96d71c7d93bdd
|
[] |
no_license
|
eplightning/bakaengine
|
7f9ac9f24ba688f004b65e1b8c4ca5885bdb545a
|
1c58d19fd302dba259979daec42c6ad7e3130988
|
refs/heads/master
| 2016-08-11T07:45:46.418760
| 2015-10-02T14:43:12
| 2015-10-02T14:43:12
| 43,558,706
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,142
|
h
|
#ifndef GAME_SCENE_GAMEOBJECT_H
#define GAME_SCENE_GAMEOBJECT_H
#include "bakaglobal.h"
#include <glm/vec3.hpp>
#include <glm/mat4x4.hpp>
#include "game/scene/component.h"
namespace Baka
{
class Scene;
class GameObject {
public:
explicit GameObject(Scene *scene);
virtual ~GameObject();
virtual const char* GetName();
virtual const char* GetID();
virtual VisibleComponent* GetVisibleComponent();
virtual PhysicalComponent* GetPhysicalComponent();
virtual LightComponent* GetLightComponent();
virtual bool IsActor() const;
virtual void Update(double dt);
bool IsDying(bool die = false);
protected:
Scene *scene_;
bool dying_;
};
class GameActor : public GameObject {
public:
explicit GameActor(Scene *scene);
const char* GetName() override;
const char* GetID() override;
glm::vec3& GetPosition();
glm::vec3& GetRotation();
float& GetScale();
const Mat4& GetModelMatrix() const;
bool IsActor() const override;
void UpdateModelMatrix();
protected:
virtual Mat4 CalculateModelMatrix() const;
Vec3 position_;
Vec3 rotation_;
float scale_;
Mat4 model_matrix_;
};
}
#endif
|
[
"eplightning@outlook.com"
] |
eplightning@outlook.com
|
3c118f1953ba44c1b079ec3e012753e1b0a7eafa
|
9e0b3515b9489811570035f40b2693fe2247076c
|
/TdxPlugin/winds/TDXGfcx.cpp
|
60ef3440ad8c9ed1664872c0703145022ed4b357
|
[] |
no_license
|
locustwei/WorkBack
|
8118d3f0dc61a0d5958d0878e26e6ea650f5a765
|
bd4ef7838142caddd24c77ea469ac68ed1f87498
|
refs/heads/master
| 2020-03-26T14:49:25.049620
| 2018-08-17T03:50:00
| 2018-08-17T03:50:00
| 145,006,896
| 4
| 5
| null | null | null | null |
GB18030
|
C++
| false
| false
| 3,209
|
cpp
|
/************************************************************************
股份查询窗口
************************************************************************/
#include "TDXGfcx.h"
#include <string.h>
#include <stdlib.h>
#include <commctrl.h>
#pragma warning( disable : 4244)
CTDXZjgf::CTDXZjgf(HWND hWnd):CWndHook(hWnd)
{
m_l628 = GetDlgItem(hWnd, 0x0628);
m_lst61F = GetDlgItem(hWnd, 0x061F);
}
CTDXZjgf::~CTDXZjgf(void)
{
}
BOOL CTDXZjgf::GetStatisticsValue(float& ye, float& ky, float& sz, float& yk)
{
if(m_l628==NULL)
return FALSE;
TCHAR szText[200] = {0};
GetWindowText(m_l628, szText, 200);
TCHAR szValue[20] = {0};
LPCTSTR tmp = wcsstr(szText, L"余额:");
if(!tmp)
return FALSE;
tmp += 3;
for (int i=0; tmp[i] != ' ' && tmp[i] != 0; i++){
szText[i] = tmp[i];
}
ye = _wtof(szValue);
ZeroMemory(szValue, sizeof(szValue));
tmp = wcsstr(szText, L"可用:");
if(!tmp)
return FALSE;
tmp += 3;
for (int i=0; tmp[i] != ' ' && tmp[i] != 0; i++){
szText[i] = tmp[i];
}
ky = _wtof(szValue);
ZeroMemory(szValue, sizeof(szValue));
tmp = wcsstr(szText, L"参考市值:");
if(!tmp)
return FALSE;
tmp += 5;
for (int i=0; tmp[i] != ' ' && tmp[i] != 0; i++){
szText[i] = tmp[i];
}
sz = _wtof(szValue);
ZeroMemory(szValue, sizeof(szValue));
tmp = wcsstr(szText, L"盈亏:");
if(!tmp)
return FALSE;
tmp += 3;
for (int i=0; tmp[i] != ' ' && tmp[i] != 0; i++){
szText[i] = tmp[i];
}
yk = _wtof(szValue);
return TRUE;
}
int CTDXZjgf::GetGf(PTDX_STOCK_GF pGf)
{
if(!m_lst61F)
return FALSE;
int nCount = ListView_GetItemCount(m_lst61F);
for(int i=0; i<nCount; i++){
ListView_GetItemText(m_lst61F, i, 0, pGf[i].code, 6); //
ListView_GetItemText(m_lst61F, i, 1, pGf[i].name, 4);
TCHAR szText[20] = {0};
ListView_GetItemText(m_lst61F, i, 2, szText, 20);
pGf[i].sl = _wtoi(szText);
ListView_GetItemText(m_lst61F, i, 3, szText, 20);
pGf[i].kmsl = _wtoi(szText);
ListView_GetItemText(m_lst61F, i, 4, szText, 20);
pGf[i].jmsl = _wtoi(szText);
ListView_GetItemText(m_lst61F, i, 5, szText, 20);
pGf[i].ckcbj = _wtof(szText);
ListView_GetItemText(m_lst61F, i, 6, szText, 20);
pGf[i].mrjj = _wtof(szText);
ListView_GetItemText(m_lst61F, i, 7, szText, 20);
pGf[i].dqj = _wtof(szText);
ListView_GetItemText(m_lst61F, i, 8, szText, 20);
pGf[i].zxsz = _wtof(szText);
ListView_GetItemText(m_lst61F, i, 9, szText, 20);
pGf[i].ccyk = _wtof(szText);
ListView_GetItemText(m_lst61F, i, 10, szText, 20);
pGf[i].ykbl = _wtoi(szText);
ListView_GetItemText(m_lst61F, i, 11, szText, 20);
pGf[i].djsl = _wtoi(szText);
}
return nCount;
}
int CTDXZjgf::GetZjgf(_Out_ PTDX_STOCK_ZJGF* result)
{
int nSize = 0;
PTDX_STOCK_ZJGF tmp = NULL;
int nCount = ListView_GetItemCount(m_lst61F);
nSize = sizeof(TDX_STOCK_ZJGF) + nCount*sizeof(TDX_STOCK_GF);
tmp = (PTDX_STOCK_ZJGF)malloc(nSize);
ZeroMemory(tmp, nSize);
if(!GetStatisticsValue(tmp->ye, tmp->ky, tmp->sz, tmp->yk)){
free(tmp);
return 0;
}
tmp->count = GetGf(tmp->gf);
*result = tmp;
return nSize;
}
|
[
"locustwei@7198d612-9af8-4b9f-b382-878749309fc7"
] |
locustwei@7198d612-9af8-4b9f-b382-878749309fc7
|
13090b1c0ba0e722369bca24c56536ffa62b803f
|
5adb5ac0a3d14da55b93e39c5f4ec1f20385eea3
|
/HW1/swk/merge_sort.cpp
|
e4a178b66873cf34b78095f15be27bb54abf3719
|
[] |
no_license
|
WeikunSu/Foundamentals-of-Computer-Engineering
|
b12eb964da09c1bcb8732b6aab2a326a35834da4
|
8d8113ba1bba4672320f211ab5c6d427165690b4
|
refs/heads/master
| 2020-08-23T12:19:58.468921
| 2019-10-21T17:20:21
| 2019-10-21T17:20:21
| 216,615,244
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,178
|
cpp
|
#include <iostream>
void merge(int v[], int l, int m, int h)
{
int i, j, k;
int temp[h - l + 1];
i = l;
j = m + 1;
k = 0;
while (i <= m && j <= h)
{
if (v[i] < v[j])
{
temp[k] = v[i];
i++;
k++;
}
else
{
temp[k] = v[j];
j++;
k++;
}
}
while (i <= m)
{
temp[k] = v[i];
i++;
k++;
}
while (j <= h)
{
temp[k] = v[j];
j++;
k++;
}
for (i = l; i <= h; i++)
{
v[i] = temp[i - l];
}
}
void merge_sort(int v[], int l, int h)
{
int m;
if (l < h)
{
m = (l + h) / 2;
merge_sort(v, l, m);
merge_sort(v, m+1, h);
merge(v, l, m, h);
}
}
void print_vector(int v[], int n)
{
int i;
std::cout << "vector:";
for (i = 0; i < n; i++)
std::cout << "" << v[i];
std::cout << std::endl;
}
int main()
{
int v[] = { 9, 8, 7, 6 ,5 ,4 ,3 ,2 ,1 ,0 };
print_vector(v,10);
merge_sort(v,0,9);
print_vector(v, 10);
}
|
[
"noreply@github.com"
] |
WeikunSu.noreply@github.com
|
fe3a82bae35accba8886323c3af5b5b92ff4615f
|
0d5be9442b4e78805508a0428dd1f4663cc0d902
|
/PWGGA/PHOSTasks/PHOS_Run2/AliAnalysisTaskPHOSObjectCreator.cxx
|
8fba49992c382b89af1d4a55ca4361e4db38e4b4
|
[] |
permissive
|
brinick/AliPhysics
|
32984d5206212e8f22018fd9e757199f3e092e20
|
49fb1acec903b4d6cb27efdec5fe7909c0985c82
|
refs/heads/master
| 2020-12-02T21:25:45.935213
| 2018-11-07T08:44:41
| 2018-11-07T08:44:41
| 96,315,340
| 0
| 0
|
BSD-3-Clause
| 2018-11-07T09:47:19
| 2017-07-05T12:10:43
|
C++
|
UTF-8
|
C++
| false
| false
| 33,404
|
cxx
|
#include "TF1.h"
#include "TObject.h"
#include "TObjArray.h"
#include "TClonesArray.h"
#include "TString.h"
#include "TMath.h"
#include "THashList.h"
#include "TChain.h"
#include "AliLog.h"
#include "AliAnalysisTaskSE.h"
#include "TParticle.h"
#include "AliMCEventHandler.h"
#include "AliMCEvent.h"
#include "AliStack.h"
#include "AliAODMCParticle.h"
#include "AliVCluster.h"
#include "AliVCaloCells.h"
#include "AliCaloPhoton.h"
#include "AliVEvent.h"
#include "AliESDEvent.h"
#include "AliAODEvent.h"
#include "AliPHOSGeometry.h"
#include "AliOADBContainer.h"
#include "AliMagF.h"
#include "TGeoGlobalMagField.h"
#include "AliAnalysisManager.h"
#include "AliAnalysisTaskPHOSObjectCreator.h"
ClassImp(AliAnalysisTaskPHOSObjectCreator)
//________________________________________________________________________
AliAnalysisTaskPHOSObjectCreator::AliAnalysisTaskPHOSObjectCreator(const char *name):
AliAnalysisTaskSE(name),
fOutputContainer(0x0),
fHistoMggvsEProbe(0x0),
fHistoMggvsEPassingProbe(0x0),
fEvent(0x0),
fAODEvent(0x0),
fESDEvent(0x0),
fPHOSObjectArray(NULL),
fPHOSGeo(0x0),
fNonLinCorr(0x0),
fUserNonLinCorr(0x0),
fRunNumber(0),
fUsePHOSTender(kTRUE),
fIsMC(kFALSE),
fBunchSpace(25.),
fMCArrayESD(0x0),
fMCArrayAOD(0x0),
fIsM4Excluded(kTRUE)
{
// Constructor
for(Int_t i=0;i<3;i++){
fVertex[i] = 0;
}
for(Int_t i=0;i<6;i++){
fPHOSBadMap[i] = 0;
}
//Initialize non-linrarity correction
fNonLinCorr = new TF1("nonlin","0.0241 + 1.0504*x + 0.000249*x*x",0.,100.);
fUserNonLinCorr = new TF1("usernonlin","1.",0.,100.);
// Define input and output slots here
// Input slot #0 works with a TChain
DefineInput(0, TChain::Class());
// Output slot #0 id reserved by the base class for AOD
// Output slot #1 writes into a TH1 container
DefineOutput(1, THashList::Class());
}
//________________________________________________________________________
AliAnalysisTaskPHOSObjectCreator::~AliAnalysisTaskPHOSObjectCreator()
{
//destructor
if(fPHOSObjectArray){
delete fPHOSObjectArray;
fPHOSObjectArray = 0x0;
}
if(fNonLinCorr){
delete fNonLinCorr;
fNonLinCorr = 0x0;
}
if(fUserNonLinCorr){
delete fUserNonLinCorr;
fUserNonLinCorr = 0x0;
}
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::UserCreateOutputObjects()
{
// Create histograms
// Called once
fOutputContainer = new THashList();
fOutputContainer->SetOwner(kTRUE);
const Int_t NpTgg = 101;
Double_t pTgg[NpTgg]={};
for(Int_t i=0;i<50;i++) pTgg[i] = 0.1 * i; //every 0.1 GeV/c, up to 5 GeV/c
for(Int_t i=50;i<60;i++) pTgg[i] = 0.5 * (i-50) + 5.0; //every 0.5 GeV/c, up to 10 GeV/c
for(Int_t i=60;i<NpTgg;i++) pTgg[i] = 1.0 * (i-60) + 10.0;//every 1.0 GeV/c, up to 50 GeV/c
fHistoMggvsEProbe = new TH2F("hMgg_STDCut_Probe","Probe #gamma for standard cluster cut",60,0,0.24,NpTgg-1,pTgg);
fHistoMggvsEProbe->Sumw2();
fHistoMggvsEProbe->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
fHistoMggvsEProbe->SetYTitle("E_{#gamma} (GeV)");
fHistoMggvsEPassingProbe = new TH2F("hMgg_STDCut_PassingProbe","Passing Probe #gamma for standard cluster cut",60,0,0.24,NpTgg-1,pTgg);
fHistoMggvsEPassingProbe->Sumw2();
fHistoMggvsEPassingProbe->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
fHistoMggvsEPassingProbe->SetYTitle("E_{#gamma} (GeV)");
fOutputContainer->Add(fHistoMggvsEProbe);
fOutputContainer->Add(fHistoMggvsEPassingProbe);
Init();//initialize PHOS object array
PostData(1,fOutputContainer);
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::UserExec(Option_t *option)
{
// Main loop
// Called for each event
fEvent = dynamic_cast<AliVEvent*>(InputEvent());
if(!fEvent){
AliError("event is not available.");
return;
}
//cout << "Object Creator usePHOSTender = " << fUsePHOSTender << " , fIsMC = " << fIsMC << endl;
fESDEvent = dynamic_cast<AliESDEvent*>(fEvent);
fAODEvent = dynamic_cast<AliAODEvent*>(fEvent);
if(fIsMC){
fMCArrayESD = 0x0;
fMCArrayAOD = 0x0;
if(fESDEvent){
AliVEventHandler* eventHandler = AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler();
if(eventHandler){
AliMCEventHandler* mcEventHandler = dynamic_cast<AliMCEventHandler*> (eventHandler);
if(mcEventHandler) fMCArrayESD = static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()->Stack();
}
if(!fMCArrayESD) AliError("Could not get MC Stack!");
}
else if(fAODEvent){
fMCArrayAOD = dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(AliAODMCParticle::StdBranchName()));
if(!fMCArrayAOD){
AliError("Could not retrieve MC array!");
return;
}
}
}
if(fRunNumber != fEvent->GetRunNumber()) { // Check run number
fRunNumber = fEvent->GetRunNumber();
SetGeometry();
}
const AliVVertex *vVertex = fEvent->GetPrimaryVertex();
fVertex[0] = vVertex->GetX();
fVertex[1] = vVertex->GetY();
fVertex[2] = vVertex->GetZ();
AliVCaloCells *cells = dynamic_cast<AliVCaloCells*>(fEvent->GetPHOSCells());
Int_t multClust = fEvent->GetNumberOfCaloClusters();
fPHOSObjectArray->Clear();
TLorentzVector p1,p1core;
Double_t energy=0, tof=-999, M20=0, M02=0, R2=999, coreE=0, coreR2=999;
Double_t TrackDx=0, TrackDz=0, TrackPt=0, r=999;
Int_t TrackCharge = 0;
Int_t trackindex=-1;
Int_t relId[4] = {};
Int_t module=-1, cellx=-1, cellz=-1;
Int_t digMult=0;
Float_t position[3] = {};
AliVTrack *vtrack = 0x0;
AliVCluster *cluster = 0x0;
Double_t distance=0;
Int_t inPHOS=0;
for(Int_t iclu=0; iclu<multClust; iclu++){
cluster = (AliVCluster*)fEvent->GetCaloCluster(iclu);
if(cluster->GetType() != AliVCluster::kPHOSNeutral) continue;
if(cluster->E() < 0.1) continue;//energy is set to 0 GeV in PHOS Tender, if its position is one th bad channel.//0.05 GeV is threshold of seed in a cluster by clustering algorithm.
if(cluster->GetM20() > 2.0) continue;
//printf("energy = %e , coreE = %e\n",cluster->E(),cluster->GetCoreEnergy());
distance = cluster->GetDistanceToBadChannel();//in cm.
//cout << "Ncell before = " << cluster->GetNCells() << endl;
Int_t Ncell = cluster->GetNCells();
for(Int_t i=0;i<cluster->GetNCells();i++){
Int_t absId_tmp = cluster->GetCellAbsId(i);
Double_t amp = cells->GetCellAmplitude(absId_tmp);
if(amp < 2e-6) //less than 2 keV
Ncell--;
}
//cluster->SetNCells(Ncell);
cluster->GetPosition(position);
TVector3 global1(position);
fPHOSGeo->GlobalPos2RelId(global1,relId);
module = relId[0];
cellx = relId[2];
cellz = relId[3];
if(fIsM4Excluded && module==4) continue;
if(module < 1 || 4 < module){
AliError(Form("Wrong module number %d",module));
return;
}
if(!fUsePHOSTender && !IsGoodChannel("PHOS",module,cellx,cellz)) continue;
energy = cluster->E();
digMult = cluster->GetNCells();
tof = cluster->GetTOF();
if(fUsePHOSTender){
//When PHOSTender is applied, GetM20(), GetM02() returns M20,M02 of core of cluster respectively.
M20 = cluster->GetM20();//M20 is short axis of elliptic shower shape.
M02 = cluster->GetM02();//M02 is long axis of elliptic shower shape.
R2 = cluster->GetDispersion();//full dispersion
coreE = cluster->GetCoreEnergy();
coreR2 = cluster->Chi2();//core dispersion
r = cluster->GetEmcCpvDistance();
}
else{//no tender
//When PHOSTender is NOT applied, GetM20(), GetM02() returns M20,M02 of full cluster respectively.
M20 = cluster->GetM20();//M20 is short axis of elliptic shower shape.
M02 = cluster->GetM02();//M02 is long axis of elliptic shower shape.
R2 = TestLambda(energy,M20,M02);
coreE = CoreEnergy(cluster,cells);
EvalCoreLambdas(cluster,cells,M02,M20);
coreR2 = TestCoreLambda(energy,M20,M02);
vtrack = 0x0;
if(fESDEvent){//for ESD
trackindex = cluster->GetTrackMatchedIndex();
if(trackindex > 0){
vtrack = (AliVTrack*)(fEvent->GetTrack(trackindex));
}//end of track matching
}//end of track selection in ESD
else if(fAODEvent){//for AOD
if(cluster->GetNTracksMatched() > 0){
vtrack = dynamic_cast<AliVTrack*>(cluster->GetTrackMatched(0));
}//end of track matching
}//end of AOD
if(vtrack){
TrackDx = cluster->GetTrackDx();
TrackDz = cluster->GetTrackDz();
TrackPt = vtrack->Pt();
TrackCharge = vtrack->Charge();
r = TestCPVRun2(TrackDx,TrackDz,TrackPt,TrackCharge);
}//end of track matching
else r = 999;//no matched track
}
cluster->GetMomentum(p1,fVertex);
cluster->GetMomentum(p1core,fVertex);
p1 *= fUserNonLinCorr->Eval(p1.E());
p1core *= coreE/energy * fUserNonLinCorr->Eval(coreE); //use core energy in PbPb.
if(p1.E() < 0.1) continue;//minimum energy cut after NL correciton. Note Ecore <= Efull
new((*fPHOSObjectArray)[inPHOS]) AliCaloPhoton(p1.Px(),p1.Py(),p1.Pz(),p1.E());
AliCaloPhoton * ph = (AliCaloPhoton*)fPHOSObjectArray->At(inPHOS);
ph->SetCluster(cluster);
ph->SetModule(module);
ph->SetNCells(digMult);
ph->SetTime(tof);//unit of second
ph->SetTOFBit(TMath::Abs(tof*1e+9) < fBunchSpace/2.);
ph->SetDistToBadfp(distance/2.2);//in unit of cells with floating point. 2.2 cm is crystal size
ph->SetEMCx((Double_t)position[0]);
ph->SetEMCy((Double_t)position[1]);
ph->SetEMCz((Double_t)position[2]);
ph->SetWeight(1.);
if(fIsMC){
Bool_t sure = kTRUE;
Int_t label = FindPrimary(ph,sure);
ph->SetPrimary(label);
//ph->SetPrimary(cluster->GetLabel());
}
ph->SetLambdas(M20,M02);
ph->SetNsigmaCPV(r);
ph->SetNsigmaFullDisp(TMath::Sqrt(R2));
ph->SetNsigmaCoreDisp(TMath::Sqrt(coreR2));
ph->SetMomV2(&p1core);//core energy
//printf("energy = %e , coreE = %e\n",ph->Energy(),ph->GetMomV2()->Energy());
inPHOS++;
}
EstimateSTDCutEfficiency(fPHOSObjectArray);
const Int_t Nph = fPHOSObjectArray->GetEntries();
for(Int_t iph=0;iph<Nph;iph++){
AliCaloPhoton *ph = (AliCaloPhoton*)fPHOSObjectArray->At(iph);
AliVCluster *cluster = (AliVCluster*)ph->GetCluster();
if(!PassSTDCut(cluster)){
//AliInfo("cluster is rejected by the standard cluster cut.");
fPHOSObjectArray->Remove(ph);
}
}
fPHOSObjectArray->Compress();
AliVEvent* input = InputEvent();
TObject* outO = input->FindListObject("PHOSClusterArray");
if(!outO){
fPHOSObjectArray->SetName("PHOSClusterArray");
input->AddObject(fPHOSObjectArray);
}
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::Terminate(Option_t *option)
{
//Called once at the end of the query
//fUserNonLinCorr->Draw();
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::Init()
{
//Called once at the end of the query
//if(fPHOSObjectArray != NULL){
if(fPHOSObjectArray){
//delete fPHOSObjectArray;
fPHOSObjectArray = NULL;
//fPHOSObjectArray->Clear();
}
fPHOSObjectArray = new TClonesArray("AliCaloPhoton",200);
fPHOSObjectArray->Delete();
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::InitBadMap()
{
AliOADBContainer badmapContainer(Form("phosBadMap"));
badmapContainer.InitFromFile("$ALICE_PHYSICS/OADB/PHOS/PHOSBadMaps.root","phosBadMap");
TObjArray *maps = (TObjArray*)badmapContainer.GetObject(fRunNumber,"phosBadMap");
if(!maps){
AliError(Form("Can not read Bad map for run %d. \n You may choose to use your map with ForceUsingBadMap().",fRunNumber)) ;
}
else{
AliInfo(Form("Setting PHOS bad map with name %s.",maps->GetName())) ;
for(Int_t mod=0; mod<6;mod++){
if(fPHOSBadMap[mod]) delete fPHOSBadMap[mod];
TH2I * h = (TH2I*)maps->At(mod);
if(h) fPHOSBadMap[mod]=new TH2I(*h);
}
}
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::SetGeometry()
{
// Initialize the PHOS geometry
if(fUsePHOSTender){
if(fRunNumber < 209122)//Run1
fPHOSGeo = AliPHOSGeometry::GetInstance("IHEP") ;
else//Run2
fPHOSGeo = AliPHOSGeometry::GetInstance("Run2") ;
}
else{//PHOSTender is not applied.
AliOADBContainer geomContainer("phosGeo");
if(fRunNumber < 209122)//Run1
fPHOSGeo = AliPHOSGeometry::GetInstance("IHEP") ;
else//Run2
fPHOSGeo = AliPHOSGeometry::GetInstance("Run2") ;
if(fIsMC){ //use excatly the same geometry as in simulation, stored in esd
if(fESDEvent){
for(Int_t mod=0; mod<6; mod++) {
const TGeoHMatrix * m = fESDEvent->GetPHOSMatrix(mod);
if(m){
fPHOSGeo->SetMisalMatrix(m,mod) ;
printf(".........Adding Matrix(%d), geo=%p\n",mod,fPHOSGeo);
m->Print();
}
}
}
else if(fAODEvent){ //To be fixed
geomContainer.InitFromFile("$ALICE_PHYSICS/OADB/PHOS/PHOSMCGeometry.root","PHOSMCRotationMatrixes");
TObjArray *matrixes = (TObjArray*)geomContainer.GetObject(fRunNumber,"PHOSRotationMatrixes");
for(Int_t mod=0; mod<6; mod++){
if(!matrixes->At(mod)) continue;
fPHOSGeo->SetMisalMatrix(((TGeoHMatrix*)matrixes->At(mod)),mod);
printf(".........Adding Matrix(%d), geo=%p\n",mod,fPHOSGeo);
((TGeoHMatrix*)matrixes->At(mod))->Print();
}
}
}//end of MC
else{ //Use best approaximation to real geometry
geomContainer.InitFromFile("$ALICE_PHYSICS/OADB/PHOS/PHOSGeometry.root","PHOSRotationMatrixes");
TObjArray *matrixes = (TObjArray*)geomContainer.GetObject(fRunNumber,"PHOSRotationMatrixes");
for(Int_t mod=0; mod<6; mod++){
if(!matrixes->At(mod)) continue;
fPHOSGeo->SetMisalMatrix(((TGeoHMatrix*)matrixes->At(mod)),mod);
printf(".........Adding Matrix(%d), geo=%p\n",mod,fPHOSGeo);
((TGeoHMatrix*)matrixes->At(mod))->Print();
}
}//end of real data
}
}
//________________________________________________________________________
Bool_t AliAnalysisTaskPHOSObjectCreator::IsGoodChannel(const char * det, Int_t mod, Int_t ix, Int_t iz)
{
//Check if this channel belogs to the good ones
if(strcmp(det,"PHOS")==0){
if(mod>5 || mod<1){
AliError(Form("No bad map for PHOS module %d ",mod)) ;
return kTRUE ;
}
if(!fPHOSBadMap[mod]){
AliError(Form("No Bad map for PHOS module %d",mod)) ;
return kTRUE ;
}
if(fPHOSBadMap[mod]->GetBinContent(ix,iz)>0)
return kFALSE ;
else
return kTRUE ;
}
else{
AliError(Form("Can not find bad channels for detector %s ",det)) ;
}
return kTRUE ;
}
//________________________________________________________________________
Double_t AliAnalysisTaskPHOSObjectCreator::TestCPVRun2(Double_t dx, Double_t dz, Double_t pt, Int_t charge)
{
//Parameterization of LHC15o period
//_true if neutral_
Double_t meanX=0.;
Double_t meanZ=0.;
Double_t sx = TMath::Min(5.2, 1.160 + 0.52 * TMath::Exp(-0.042 * pt*pt) + 5.1/TMath::Power(pt+0.62,3));
Double_t sz = TMath::Min(3.3, 1.10 + 0.39 * TMath::Exp(-0.027 * pt*pt) + 0.70 /TMath::Power(pt+0.223,3));
Double_t mf1 = fEvent->GetMagneticField(); //Positive for ++ and negative for --
if(mf1<0.){ //field --
meanZ = 0.077;
if(charge>0)
meanX = TMath::Min(5.8, 0.2 + 0.7 * TMath::Exp(-0.019 * pt*pt) + 34./TMath::Power(pt+1.39,3));
else
meanX = -TMath::Min(5.8, 0.1 + 0.7 * TMath::Exp(-0.014 * pt*pt) + 30./TMath::Power(pt+1.36,3));
}
else{ //Field ++
meanZ= 0.077;
if(charge>0)
meanX = -TMath::Min(5.8, 0.3 + 0.7 * TMath::Exp(-0.012 * pt*pt) + 35./TMath::Power(pt+1.43,3));
else
meanX = TMath::Min(5.8, 0.2 + 0.6 * TMath::Exp(-0.014 * pt*pt) + 28./TMath::Power(pt+1.27,3));
}
Double_t rz=(dz-meanZ)/sz ;
Double_t rx=(dx-meanX)/sx ;
return TMath::Sqrt(rx*rx+rz*rz) ;
}
//________________________________________________________________________
Double_t AliAnalysisTaskPHOSObjectCreator::TestLambda(Double_t e,Double_t l1,Double_t l2)
{
Double_t l2Mean = 1.53126+9.50835e+06/(1.+1.08728e+07*e+1.73420e+06*e*e) ;
Double_t l1Mean = 1.12365+0.123770*TMath::Exp(-e*0.246551)+5.30000e-03*e ;
Double_t l2Sigma = 6.48260e-02+7.60261e+10/(1.+1.53012e+11*e+5.01265e+05*e*e)+9.000e-03*e;
Double_t l1Sigma = 4.44719e-04+6.99839e-01/(1.+1.22497e+00*e+6.78604e-07*e*e)+9.000e-03*e;
Double_t c=-0.35-0.550*TMath::Exp(-0.390730*e) ;
Double_t R2=0.5*(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma +
0.5*(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
return R2;
}
//________________________________________________________________________
Double_t AliAnalysisTaskPHOSObjectCreator::TestCoreLambda(Double_t e, Double_t l1, Double_t l2)
{
//Evaluates if lambdas correspond to photon cluster
//Tuned using pp date
//For core radius R=4.5
Double_t l1Mean = 1.150200 + 0.097886/(1.+1.486645*e+0.000038*e*e) ;
Double_t l2Mean = 1.574706 + 0.997966*exp(-0.895075*e)-0.010666*e ;
Double_t l1Sigma = 0.100255 + 0.337177*exp(-0.517684*e)+0.001170*e ;
Double_t l2Sigma = 0.232580 + 0.573401*exp(-0.735903*e)-0.002325*e ;
Double_t c = -0.110983 -0.017353/(1.-1.836995*e+0.934517*e*e) ;
Double_t R2=0.5*(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma +
0.5*(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
return R2 ;
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::EvalCoreLambdas(AliVCluster *clu, AliVCaloCells *cells,Double_t &m02, Double_t &m20)
{
//calculate dispecrsion of the cluster in the circle with radius distanceCut around the maximum
const Double_t rCut=4.5;
const Double32_t *elist = clu->GetCellsAmplitudeFraction();
//Calculates the center of gravity in the local PHOS-module coordinates
Float_t wtot = 0;
const Int_t mulDigit=clu->GetNCells() ;
Double_t xc[mulDigit] ;
Double_t zc[mulDigit] ;
Double_t wi[mulDigit] ;
Double_t x = 0 ;
Double_t z = 0 ;
const Double_t logWeight=4.5 ;
for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
Int_t relid[4] ;
Float_t xi=0. ;
Float_t zi=0. ;
Int_t absId = clu->GetCellAbsId(iDigit) ;
fPHOSGeo->AbsToRelNumbering(absId, relid) ;
fPHOSGeo->RelPosInModule(relid, xi, zi);
xc[iDigit]=xi ;
zc[iDigit]=zi ;
Double_t ei = elist[iDigit]*cells->GetCellAmplitude(absId) ;
wi[iDigit]=0. ;
if (clu->E()>0 && ei>0) {
wi[iDigit] = TMath::Max( 0., logWeight + TMath::Log( ei / clu->E() ) ) ;
Double_t w=wi[iDigit];
x += xc[iDigit] * w ;
z += zc[iDigit] * w ;
wtot += w ;
}
}
if (wtot>0) {
x /= wtot ;
z /= wtot ;
}
wtot = 0. ;
Double_t dxx = 0.;
Double_t dzz = 0.;
Double_t dxz = 0.;
Double_t xCut = 0.;
Double_t zCut = 0.;
for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
Double_t w=wi[iDigit];
if(w>0.) {
Double_t xi= xc[iDigit] ;
Double_t zi= zc[iDigit] ;
if((xi-x)*(xi-x)+(zi-z)*(zi-z) < rCut*rCut){
xCut += w * xi ;
zCut += w * zi ;
dxx += w * xi * xi ;
dzz += w * zi * zi ;
dxz += w * xi * zi ;
wtot += w ;
}
}
}
if(wtot>0) {
xCut/= wtot ;
zCut/= wtot ;
dxx /= wtot ;
dzz /= wtot ;
dxz /= wtot ;
dxx -= xCut * xCut ;
dzz -= zCut * zCut ;
dxz -= xCut * zCut ;
m02 = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
m20 = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
}
else {
m20=m02=0.;
}
}
//________________________________________________________________________
Double_t AliAnalysisTaskPHOSObjectCreator::CoreEnergy(AliVCluster *clu, AliVCaloCells *cells)
{
//calculate energy of the cluster in the circle with radius distanceCut around the maximum
//Can not use already calculated coordinates?
//They have incidence correction...
const Double_t distanceCut =3.5;//default value
const Double_t logWeight=4.5;
const Double32_t * elist = clu->GetCellsAmplitudeFraction() ;
// Calculates the center of gravity in the local PHOS-module coordinates
Float_t wtot = 0;
const Int_t mulDigit=clu->GetNCells() ;
Double_t xc[mulDigit] ;
Double_t zc[mulDigit] ;
Double_t ei[mulDigit] ;
Double_t x = 0 ;
Double_t z = 0 ;
for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
Int_t relid[4] ;
Float_t xi ;
Float_t zi ;
fPHOSGeo->AbsToRelNumbering(clu->GetCellAbsId(iDigit), relid) ;
fPHOSGeo->RelPosInModule(relid, xi, zi);
xc[iDigit]=xi ;
zc[iDigit]=zi ;
ei[iDigit]=elist[iDigit]*cells->GetCellAmplitude(clu->GetCellsAbsId()[iDigit]);
if( fDebug >= 3 )
printf("%f ",ei[iDigit]);
if (clu->E()>0 && ei[iDigit]>0) {
Float_t w = TMath::Max( 0., logWeight + TMath::Log( ei[iDigit] / clu->E() ) ) ;
x += xc[iDigit] * w ;
z += zc[iDigit] * w ;
wtot += w ;
}
}
if (wtot>0) {
x /= wtot ;
z /= wtot ;
}
Double_t coreE=0. ;
for(Int_t iDigit=0; iDigit < mulDigit; iDigit++) {
Double_t distance = TMath::Sqrt((xc[iDigit]-x)*(xc[iDigit]-x)+(zc[iDigit]-z)*(zc[iDigit]-z)) ;
if(distance < distanceCut)
coreE += ei[iDigit] ;
}
//Apply non-linearity correction
return fNonLinCorr->Eval(coreE);
}
//________________________________________________________________________
Double_t AliAnalysisTaskPHOSObjectCreator::CoreEnergy(AliVCluster *clu)
{
//calculate energy of the cluster in the circle with radius distanceCut around the maximum
//Can not use already calculated coordinates?
//They have incidence correction...
const Double_t distanceCut =3.5 ;
const Double_t logWeight=4.5 ;
Double32_t * elist = clu->GetCellsAmplitudeFraction() ;
// Calculates the center of gravity in the local PHOS-module coordinates
Float_t wtot = 0;
Double_t xc[100]={0} ;
Double_t zc[100]={0} ;
Double_t x = 0 ;
Double_t z = 0 ;
Int_t mulDigit=TMath::Min(100,clu->GetNCells()) ;
for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
Int_t relid[4] ;
Float_t xi ;
Float_t zi ;
fPHOSGeo->AbsToRelNumbering(clu->GetCellAbsId(iDigit), relid) ;
fPHOSGeo->RelPosInModule(relid, xi, zi);
xc[iDigit]=xi ;
zc[iDigit]=zi ;
if (clu->E()>0 && elist[iDigit]>0) {
Float_t w = TMath::Max( 0., logWeight + TMath::Log( elist[iDigit] / clu->E() ) ) ;
x += xc[iDigit] * w ;
z += zc[iDigit] * w ;
wtot += w ;
}
}
if (wtot>0) {
x /= wtot ;
z /= wtot ;
}
Double_t coreE=0. ;
for(Int_t iDigit=0; iDigit < mulDigit; iDigit++) {
Double_t distance = TMath::Sqrt((xc[iDigit]-x)*(xc[iDigit]-x)+(zc[iDigit]-z)*(zc[iDigit]-z)) ;
if(distance < distanceCut)
coreE += elist[iDigit] ;
}
//Apply non-linearity correction
return coreE ;
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::EvalLambdas(AliVCluster * clu, Double_t &m02, Double_t &m20)
{
//calculate dispecrsion of the cluster in the circle with radius distanceCut around the maximum
const Double_t rCut=4.5 ;
Double32_t * elist = clu->GetCellsAmplitudeFraction() ;
// Calculates the center of gravity in the local PHOS-module coordinates
Float_t wtot = 0;
Double_t xc[100]={0} ;
Double_t zc[100]={0} ;
Double_t x = 0 ;
Double_t z = 0 ;
Int_t mulDigit=TMath::Min(100,clu->GetNCells()) ;
const Double_t logWeight=4.5 ;
for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
Int_t relid[4] ;
Float_t xi ;
Float_t zi ;
fPHOSGeo->AbsToRelNumbering(clu->GetCellAbsId(iDigit), relid) ;
fPHOSGeo->RelPosInModule(relid, xi, zi);
xc[iDigit]=xi ;
zc[iDigit]=zi ;
if (clu->E()>0 && elist[iDigit]>0) {
Float_t w = TMath::Max( 0., logWeight + TMath::Log( elist[iDigit] / clu->E() ) ) ;
x += xc[iDigit] * w ;
z += zc[iDigit] * w ;
wtot += w ;
}
}
if (wtot>0) {
x /= wtot ;
z /= wtot ;
}
wtot = 0. ;
Double_t dxx = 0.;
Double_t dzz = 0.;
Double_t dxz = 0.;
Double_t xCut = 0. ;
Double_t zCut = 0. ;
for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
if (clu->E()>0 && elist[iDigit]>0.) {
Double_t w = TMath::Max( 0., logWeight + TMath::Log( elist[iDigit] / clu->E() ) ) ;
Double_t xi= xc[iDigit] ;
Double_t zi= zc[iDigit] ;
if((xi-x)*(xi-x)+(zi-z)*(zi-z) < rCut*rCut){
xCut += w * xi ;
zCut += w * zi ;
dxx += w * xi * xi ;
dzz += w * zi * zi ;
dxz += w * xi * zi ;
wtot += w ;
}
}
}
if (wtot>0) {
xCut/= wtot ;
zCut/= wtot ;
dxx /= wtot ;
dzz /= wtot ;
dxz /= wtot ;
dxx -= xCut * xCut ;
dzz -= zCut * zCut ;
dxz -= xCut * zCut ;
m02 = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
m20 = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
}
else {
m20=m02=0.;
}
}
//________________________________________________________________________
Int_t AliAnalysisTaskPHOSObjectCreator::FindTrackMatching(Int_t mod,TVector3 *locpos, Double_t &dx, Double_t &dz, Double_t &pt,Int_t &charge)
{
//Find track with closest extrapolation to cluster
AliESDEvent *esd = fESDEvent;
AliAODEvent *aod = fAODEvent;
if(!esd && !aod){
AliError("Neither AOD nor ESD was found") ;
return -1;
}
Double_t magF =0.;
if(esd)
magF = esd->GetMagneticField();
if(aod)
magF = aod->GetMagneticField();
Double_t magSign = 1.0;
if(magF<0)magSign = -1.0;
if (!TGeoGlobalMagField::Instance()->GetField()) {
AliError("Margnetic filed was not initialized, use default") ;
AliMagF* field = new AliMagF("Maps","Maps", magSign, magSign, AliMagF::k5kG);
TGeoGlobalMagField::Instance()->SetField(field);
}
// *** Start the matching
Int_t nt = 0;
if(esd)
nt = esd->GetNumberOfTracks();
else
nt = aod->GetNumberOfTracks();
//Calculate actual distance to PHOS module
TVector3 globaPos ;
fPHOSGeo->Local2Global(mod, 0.,0., globaPos) ;
const Double_t rPHOS = globaPos.Pt() ; //Distance to center of PHOS module
const Double_t kYmax = 72.+10. ; //Size of the module (with some reserve) in phi direction
const Double_t kZmax = 64.+10. ; //Size of the module (with some reserve) in z direction
const Double_t kAlpha0=330./180.*TMath::Pi() ; //First PHOS module angular direction
const Double_t kAlpha= 20./180.*TMath::Pi() ; //PHOS module angular size
Double_t minDistance = 1.e6;
Double_t gposTrack[3] ;
Double_t bz = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->SolenoidField();
bz = TMath::Sign(0.5*kAlmost0Field,bz) + bz;
Double_t b[3];
Int_t itr=-1 ;
AliESDtrack *esdTrack=0x0 ;
AliAODTrack *aodTrack=0x0 ;
Double_t xyz[3] = {0}, pxpypz[3] = {0}, cv[21] = {0};
for (Int_t i=0; i<nt; i++) {
if(esd)
esdTrack=esd->GetTrack(i);
else
aodTrack=(AliAODTrack*)aod->GetTrack(i);
// Skip the tracks having "wrong" status (has to be checked/tuned)
if(esd){
ULong_t status = esdTrack->GetStatus();
if((status & AliESDtrack::kTPCout) == 0) continue;
}
else{
}
//Continue extrapolation from TPC outer surface
AliExternalTrackParam outerParam;
if(esdTrack){
outerParam = *(esdTrack->GetOuterParam());
}
if(aodTrack){
aodTrack->GetPxPyPz(pxpypz);
aodTrack->GetXYZ(xyz);
aodTrack->GetCovarianceXYZPxPyPz(cv);
outerParam.Set(xyz,pxpypz,cv,aodTrack->Charge());
}
Double_t z;
if(!outerParam.GetZAt(rPHOS,bz,z))
continue ;
if (TMath::Abs(z) > kZmax)
continue; // Some tracks miss the PHOS in Z
//Direction to the current PHOS module
Double_t phiMod=kAlpha0-kAlpha*mod ;
if(!outerParam.RotateParamOnly(phiMod)) continue ; //RS use faster rotation if errors are not needed
Double_t y; // Some tracks do not reach the PHOS
if (!outerParam.GetYAt(rPHOS,bz,y)) continue; // because of the bending
if(TMath::Abs(y) < kYmax){
outerParam.GetBxByBz(b) ;
outerParam.PropagateToBxByBz(rPHOS,b); // Propagate to the matching module
//outerParam.CorrectForMaterial(...); // Correct for the TOF material, if needed
outerParam.GetXYZ(gposTrack) ;
TVector3 globalPositionTr(gposTrack) ;
TVector3 localPositionTr ;
fPHOSGeo->Global2Local(localPositionTr,globalPositionTr,mod) ;
Double_t ddx = locpos->X()-localPositionTr.X();
Double_t ddz = locpos->Z()-localPositionTr.Z();
Double_t d2 = ddx*ddx + ddz*ddz;
if(d2 < minDistance) {
dx = ddx ;
dz = ddz ;
minDistance=d2 ;
itr=i ;
if(esdTrack){
pt=esdTrack->Pt() ;
charge=esdTrack->Charge() ;
}
else{
pt=aodTrack->Pt() ;
charge=aodTrack->Charge() ;
}
}
}
}//Scanned all tracks
return itr ;
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::DistanceToBadChannel(Int_t mod, TVector3 * locPos, Double_t &minDist)
{
//Check if distance to bad channel was reduced
Int_t range = minDist/2.2 +1 ; //Distance at which bad channels should be serached
Int_t relid[4]={0,0,0,0} ;
fPHOSGeo->RelPosToRelId(mod, locPos->X(), locPos->Z(), relid) ;
Int_t xmin=TMath::Max(1,relid[2]-range) ;
Int_t xmax=TMath::Min(64,relid[2]+range) ;
Int_t zmin=TMath::Max(1,relid[3]-range) ;
Int_t zmax=TMath::Min(56,relid[3]+range) ;
Float_t x=0.,z=0.;
for(Int_t ix=xmin;ix<=xmax;ix++){
for(Int_t iz=zmin;iz<=zmax;iz++){
if(fPHOSBadMap[mod] && fPHOSBadMap[mod]->GetBinContent(ix,iz)>0){ //Bad channel
Int_t relidBC[4]={mod,0,ix,iz} ;
fPHOSGeo->RelPosInModule(relidBC,x,z);
Double_t dist = TMath::Sqrt((x-locPos->X())*(x-locPos->X()) + (z-locPos->Z())*(z-locPos->Z()));
if(dist<minDist) minDist = dist;
}
}
}
}
//________________________________________________________________________
Int_t AliAnalysisTaskPHOSObjectCreator::FindPrimary(AliCaloPhoton *ph, Bool_t&sure)
{
//Finds primary and estimates if it unique one?
//First check can it be photon/electron
AliVCluster *clu = (AliVCluster*)ph->GetCluster();
const Double_t emFraction=0.9; //part of energy of cluster to be assigned to EM particle
Int_t n = clu->GetNLabels();
if(fESDEvent){
return clu->GetLabel();
}
else if(fAODEvent){
for(Int_t i=0; i<n; i++){
Int_t label = clu->GetLabelAt(i);
AliAODMCParticle *p = (AliAODMCParticle*)fMCArrayAOD->At(label);
Int_t pdg = p->PdgCode() ;
if(pdg==22 || pdg==11 || pdg == -11){
if(p->E()>emFraction*clu->E()){
sure=kTRUE ;
return label;
}
}
}
Double_t *Ekin = new Double_t[n];
for(Int_t i=0; i<n; i++){
Int_t label = clu->GetLabelAt(i);
AliAODMCParticle* p = (AliAODMCParticle*)fMCArrayAOD->At(label);
Ekin[i]=p->P() ; // estimate of kinetic energy
if(p->PdgCode()==-2212 || p->PdgCode()==-2112){
Ekin[i]+=1.8 ; //due to annihilation
}
}
Int_t iMax=0;
Double_t eMax=0.,eSubMax=0. ;
for(Int_t i=0; i<n; i++){
if(Ekin[i]>eMax){
eSubMax=eMax;
eMax=Ekin[i];
iMax=i;
}
}
if(eSubMax>0.8*eMax)//not obvious primary
sure=kFALSE;
else
sure=kTRUE;
delete[] Ekin;
return clu->GetLabelAt(iMax);
}
else{
return clu->GetLabel();
}
}
//________________________________________________________________________
Bool_t AliAnalysisTaskPHOSObjectCreator::PassSTDCut(AliVCluster *cluster)
{
if(cluster->E() > 1.0 && cluster->GetM02() < 0.1) return kFALSE;
else return kTRUE;
}
//________________________________________________________________________
void AliAnalysisTaskPHOSObjectCreator::EstimateSTDCutEfficiency(TClonesArray *array)
{
const Int_t multClust = array->GetEntriesFast();
TLorentzVector p12;
Double_t m12=0;
Double_t energy=0;
for(Int_t i1=0;i1<multClust;i1++){
AliCaloPhoton *ph1 = (AliCaloPhoton*)array->At(i1);
if(ph1->GetNsigmaCoreDisp() > 3.0) continue;
if(ph1->Energy() < 0.5) continue;
for(Int_t i2=0;i2<multClust;i2++){
AliCaloPhoton *ph2 = (AliCaloPhoton*)array->At(i2);
AliVCluster *cluster = (AliVCluster*)ph2->GetCluster();
if(i2==i1) continue;//reject same cluster combination
p12 = *ph1 + *ph2;
m12 = p12.M();
energy = ph2->Energy();
fHistoMggvsEProbe->Fill(m12,energy);
if(PassSTDCut(cluster)) fHistoMggvsEPassingProbe->Fill(m12,energy);
}//end of ph2
}//end of ph1
}
|
[
"daiki.sekihata@cern.ch"
] |
daiki.sekihata@cern.ch
|
0763d624e210ee68d1bd93f9fb60a4634d9f6977
|
e27580711cbf4beccbfeb3e7abfa33cac2d8c22f
|
/UVAtlas/isochart/meshcommon.inl
|
2da9986b8b41219af4a2506089bcf710d4f71f48
|
[
"MIT"
] |
permissive
|
wentingwei/UVAtlas
|
bb240fce703acb0badd8582ced98c7ce3f9bf98b
|
e46c4141a924e9390327b8e94e6e8c311070e731
|
refs/heads/master
| 2021-01-22T12:02:27.106814
| 2015-10-30T17:42:49
| 2015-10-30T17:42:49
| 45,894,296
| 1
| 0
| null | 2015-11-10T07:09:37
| 2015-11-10T07:09:37
| null |
UTF-8
|
C++
| false
| false
| 15,637
|
inl
|
//-------------------------------------------------------------------------------------
// UVAtlas - meshcommon.inl
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// http://go.microsoft.com/fwlink/?LinkID=512686
//-------------------------------------------------------------------------------------
// [SGSH02] SANDER P., GORTLER S., SNYDER J., HOPPE H.:
// Signal-specialized parameterization
// In Proceedings of Eurographics Workshop on Rendering 2002(2002)
namespace Isochart
{
/////////////////////////////////////////////////////////////
///////////////////////////Tool-Methods//////////////////////
/////////////////////////////////////////////////////////////
inline float CIsochartMesh::CaculateUVDistanceSquare(
DirectX::XMFLOAT2& v0,
DirectX::XMFLOAT2& v1) const
{
return (v0.x-v1.x)*(v0.x-v1.x) + (v0.y-v1.y)*(v0.y-v1.y);
}
// Calculate a face's area in the U-V space.
inline float CIsochartMesh::CalculateUVFaceArea(
ISOCHARTFACE& face) const
{
return CalculateUVFaceArea(
m_pVerts[face.dwVertexID[0]].uv,
m_pVerts[face.dwVertexID[1]].uv,
m_pVerts[face.dwVertexID[2]].uv);
}
// Caculate face area using cross multiplication
inline float CIsochartMesh::CalculateUVFaceArea(
DirectX::XMFLOAT2& v0,
DirectX::XMFLOAT2& v1,
DirectX::XMFLOAT2& v2) const
{
float fA = ((v1.x-v0.x)*(v2.y-v0.y)-(v2.x-v0.x)*(v1.y-v0.y))/2;
if (fA < 0)
{
fA = -fA;
}
return fA;
}
// Caculate parameterized chart's area
inline float CIsochartMesh::CalculateChart2DArea() const
{
float fChart2DArea = 0;
ISOCHARTFACE* pFace = m_pFaces;
for (size_t i=0; i<m_dwFaceNumber; i++)
{
fChart2DArea += CalculateUVFaceArea(*pFace);
pFace++;
}
return fChart2DArea;
}
// Caculate chart's 3D area
inline float CIsochartMesh::CalculateChart3DArea() const
{
float fChart3DArea = 0;
ISOCHARTFACE* pFace = m_pFaces;
for (size_t i=0; i<m_dwFaceNumber; i++)
{
fChart3DArea += m_baseInfo.pfFaceAreaArray[pFace->dwIDInRootMesh];
pFace++;
}
return fChart3DArea;
}
// Check if parameterization cause some edge overlapping.
inline HRESULT CIsochartMesh::IsParameterizationOverlapping(
CIsochartMesh* pMesh,
bool& bIsOverlapping)
{
ISOCHARTEDGE* pEdge1 = nullptr;
ISOCHARTEDGE* pEdge2 = nullptr;
// Collect all boundary edges
std::vector<ISOCHARTEDGE*> boundaryEdgeList;
try
{
for (size_t i=0; i < pMesh->m_edges.size(); i++)
{
pEdge1 = &(pMesh->m_edges[i]);
if (pEdge1->bIsBoundary)
{
boundaryEdgeList.push_back(pEdge1);
}
}
}
catch (std::bad_alloc&)
{
return E_OUTOFMEMORY;
}
assert(!boundaryEdgeList.empty());
for (size_t i=0; i < boundaryEdgeList.size()-1; i++)
{
pEdge1 = boundaryEdgeList[i];
for (size_t j=i+1; j<boundaryEdgeList.size(); j++)
{
pEdge2 = boundaryEdgeList[j];
// if two edges connect together, although they have
// intersection, it's not counted as overlapping
if (pEdge1->dwVertexID[0] == pEdge2->dwVertexID[0]
||pEdge1->dwVertexID[0] == pEdge2->dwVertexID[1]
||pEdge1->dwVertexID[1] == pEdge2->dwVertexID[0]
||pEdge1->dwVertexID[1] == pEdge2->dwVertexID[1])
{
continue;
}
// If two edges doesn't connect together, but have
// intersection, overlapping occurs.
if (IsochartIsSegmentsIntersect(
pMesh->m_pVerts[pEdge1->dwVertexID[0]].uv,
pMesh->m_pVerts[pEdge1->dwVertexID[1]].uv,
pMesh->m_pVerts[pEdge2->dwVertexID[0]].uv,
pMesh->m_pVerts[pEdge2->dwVertexID[1]].uv))
{
bIsOverlapping = true;
return S_OK;
}
}
}
bIsOverlapping = false;
return S_OK;
}
// Calculate the Euclid distance between to vertex on original mesh.
inline float CIsochartMesh::CalculateVextexDistance(
ISOCHARTVERTEX& v0, ISOCHARTVERTEX& v1) const
{
using namespace DirectX;
XMVECTOR pv0 = XMLoadFloat3(m_baseInfo.pVertPosition + v0.dwIDInRootMesh);
XMVECTOR pv1 = XMLoadFloat3(m_baseInfo.pVertPosition + v1.dwIDInRootMesh);
XMVECTOR v2 = pv1 - pv0;
return XMVectorGetX(XMVector3Length(v2));
}
// When performing canonical parameterization to each face, an origin,
// X-axis and Y-axis was specified. Using these information can compute
// the 2-D reflection of any point in 3-D face.
// ( In our algorithm, origin alwasy the first vertex of face)
inline void CIsochartMesh::Vertex3DTo2D(
uint32_t dwFaceIDInRootMesh,
const DirectX::XMFLOAT3* pOrg,
const DirectX::XMFLOAT3* p3D,
DirectX::XMFLOAT2* p2D)
{
using namespace DirectX;
XMFLOAT3* pAxisX
= m_baseInfo.pFaceCanonicalParamAxis
+ 2 * dwFaceIDInRootMesh;
XMFLOAT3* pAxisY = pAxisX + 1;
XMVECTOR tempVector = XMLoadFloat3(p3D) - XMLoadFloat3(pOrg);
p2D->x = XMVectorGetX(XMVector3Dot(tempVector, XMLoadFloat3(pAxisX)));
p2D->y = XMVectorGetX(XMVector3Dot(tempVector, XMLoadFloat3(pAxisY)));
}
// Caculate the signal length of two vertices in one 3D face
// See more detail of this algorithm in [SGSH02]
inline float CIsochartMesh::CalculateSignalLengthOnOneFace(
DirectX::XMFLOAT3* p3D0,
DirectX::XMFLOAT3* p3D1,
uint32_t dwFaceID)
{
using namespace DirectX;
if (INVALID_FACE_ID == dwFaceID)
{
return 0;
}
ISOCHARTFACE* pFace = m_pFaces + dwFaceID;
// 1. Calculate the 2-D reflection of 2 3D vertex
ISOCHARTVERTEX* pVertex =
m_pVerts + pFace->dwVertexID[0];
XMFLOAT3* pOrg =
m_baseInfo.pVertPosition + pVertex->dwIDInRootMesh;
XMFLOAT2 v2d0;
XMFLOAT2 v2d1;
Vertex3DTo2D(
pFace->dwIDInRootMesh,
pOrg, p3D0, &v2d0);
Vertex3DTo2D(
pFace->dwIDInRootMesh,
pOrg, p3D1, &v2d1);
// 2. Using affine transformation to calculate signal length
float fDeltaX = v2d1.x - v2d0.x;
float fDeltaY = v2d1.y - v2d0.y;
const FLOAT3* pIMT = m_baseInfo.pfIMTArray+pFace->dwIDInRootMesh;
float fLength;
fLength
= (*pIMT)[0]*fDeltaX*fDeltaX
+ (*pIMT)[2]*fDeltaY*fDeltaY
+ 2*(*pIMT)[1]*fDeltaX*fDeltaY;
fLength = IsochartSqrtf(fLength);
return fLength;
}
// When computing signal length along internal edge, two adjacent faces
// are involved, individually caculate edge's signal length on the two
// faces and use average.
inline float CIsochartMesh::CalculateEdgeSignalLength(
DirectX::XMFLOAT3* p3D0,
DirectX::XMFLOAT3* p3D1,
uint32_t dwAdjacentFaceID0,
uint32_t dwAdjacentFaceID1)
{
float fLength0;
fLength0 = CalculateSignalLengthOnOneFace(
p3D0, p3D1, dwAdjacentFaceID0);
if (INVALID_FACE_ID == dwAdjacentFaceID1)
{
return fLength0;
}
else
{
float fLength1;
fLength1 = CalculateSignalLengthOnOneFace(
p3D0, p3D1, dwAdjacentFaceID1);
return (fLength0 + fLength1) * 0.5f;
}
}
inline float CIsochartMesh::CalculateEdgeSignalLength(ISOCHARTEDGE& edge)
{
assert (INVALID_FACE_ID != edge.dwFaceID[0]);
assert (
(INVALID_FACE_ID == edge.dwFaceID[1] && edge.bIsBoundary)
||(INVALID_FACE_ID != edge.dwFaceID[1] || edge.bIsBoundary));
float fTestLength = 0;
DirectX::XMFLOAT3* pv0 =
m_baseInfo.pVertPosition + m_pVerts[edge.dwVertexID[0]].dwIDInRootMesh;
DirectX::XMFLOAT3* pv1 =
m_baseInfo.pVertPosition + m_pVerts[edge.dwVertexID[1]].dwIDInRootMesh;
fTestLength = CalculateEdgeSignalLength(
pv0, pv1, edge.dwFaceID[0], edge.dwFaceID[1]);
return fTestLength;
}
// Calculate edge's normal and signal length
inline void CIsochartMesh::CalculateChartEdgeLength()
{
for (size_t i=0; i<m_dwEdgeNumber; i++)
{
ISOCHARTEDGE& edge = m_edges[i];
edge.fLength = CalculateVextexDistance(
m_pVerts[edge.dwVertexID[0]], m_pVerts[edge.dwVertexID[1]]);
if (IsIMTSpecified())
{
edge.fSignalLength = CalculateEdgeSignalLength(edge);
}
else
{
edge.fSignalLength = 0;
}
}
}
inline void Rotate2DPoint(
DirectX::XMFLOAT2& uvOut,
const DirectX::XMFLOAT2& uvIn,
const DirectX::XMFLOAT2& center,
float fSin,
float fCos)
{
float x =
(uvIn.x-center.x)*fCos - (uvIn.y-center.y)*fSin;
float y =
(uvIn.x-center.x)*fSin + (uvIn.y-center.y)*fCos;
uvOut.x = x + center.x;
uvOut.y = y + center.y;
}
// Rotate chart around origin
inline void CIsochartMesh::RotateChart(
const DirectX::XMFLOAT2& center, float fAngle) const
{
DirectX::XMFLOAT2 tempCoordinate;
float fCos = cosf(fAngle);
float fSin = sinf(fAngle);
ISOCHARTVERTEX* pVertex = m_pVerts;
for (size_t i=0; i<m_dwVertNumber; i++)
{
Rotate2DPoint(
pVertex->uv, pVertex->uv, center, fSin, fCos);
pVertex++;
}
}
// Rotate chart boundary, get bounding box
inline void CIsochartMesh::GetRotatedChartBoundingBox(
const DirectX::XMFLOAT2& center,
float fAngle,
DirectX::XMFLOAT2& minBound,
DirectX::XMFLOAT2& maxBound) const
{
minBound.x = minBound.y = FLT_MAX;
maxBound.x = maxBound.y = -FLT_MAX;
DirectX::XMFLOAT2 tempCoordinate;
ISOCHARTVERTEX* pVertex = m_pVerts;
float fCos = cosf(fAngle);
float fSin = sinf(fAngle);
for (size_t i=0; i<m_dwVertNumber; i++)
{
if (!pVertex->bIsBoundary)
{
pVertex++;
continue;
}
Rotate2DPoint(
tempCoordinate,
pVertex->uv,
center,
fSin,
fCos);
minBound.x = std::min(tempCoordinate.x, minBound.x);
minBound.y = std::min(tempCoordinate.y, minBound.y);
maxBound.x = std::max(tempCoordinate.x, maxBound.x);
maxBound.y = std::max(tempCoordinate.y, maxBound.y);
pVertex++;
}
}
// Get the minial bounding box of current chart
inline void CIsochartMesh::CalculateChartMinimalBoundingBox(
size_t dwRotationCount,
DirectX::XMFLOAT2& minBound,
DirectX::XMFLOAT2& maxBound) const
{
using namespace DirectX;
float fMinRectArea = 0;
float fMinAngle = 0;
XMFLOAT2 tempMinBound;
XMFLOAT2 tempMaxBound;
float tempArea;
minBound.x = minBound.y = FLT_MAX;
maxBound.x = maxBound.y = -FLT_MAX;
for (size_t ii=0; ii<m_dwVertNumber; ii++)
{
const XMFLOAT2& uv = m_pVerts[ii].uv;
minBound.x = std::min(uv.x, minBound.x);
minBound.y = std::min(uv.y, minBound.y);
maxBound.x = std::max(uv.x, maxBound.x);
maxBound.y = std::max(uv.y, maxBound.y);
}
XMFLOAT2 center;
XMStoreFloat2(¢er, (XMLoadFloat2(&minBound) + XMLoadFloat2(&maxBound)) / 2);
fMinRectArea = IsochartBoxArea(minBound, maxBound);
fMinAngle = 0;
//To calculate bounding box, only need to rotate with in PI/2 around the chart's center
for (size_t dwRotID = 1; dwRotID <dwRotationCount; dwRotID++)
{
float fAngle = dwRotID* XM_PI /(dwRotationCount*2);
GetRotatedChartBoundingBox(
center, fAngle, tempMinBound, tempMaxBound);
tempArea = IsochartBoxArea(tempMinBound, tempMaxBound);
if (tempArea < fMinRectArea)
{
fMinRectArea = tempArea;
fMinAngle = fAngle;
minBound = tempMinBound;
maxBound = tempMaxBound;
}
}
if (fMinAngle > ISOCHART_ZERO_EPS)
{
RotateChart(center, fMinAngle);
}
}
inline CIsochartMesh* CIsochartMesh::CreateNewChart(
VERTEX_ARRAY& vertList,
std::vector<uint32_t>& faceList,
bool bIsSubChart) const
{
auto pChart = new (std::nothrow) CIsochartMesh(m_baseInfo, m_callbackSchemer, m_IsochartEngine);
if (!pChart)
{
return nullptr;
}
pChart->m_pFather = const_cast<CIsochartMesh* >(this);
pChart->m_bVertImportanceDone = m_bVertImportanceDone;
pChart->m_bIsSubChart = bIsSubChart;
pChart->m_fBoxDiagLen = m_fBoxDiagLen;
pChart->m_dwVertNumber = vertList.size();
pChart->m_dwFaceNumber = faceList.size();
pChart->m_pVerts = new (std::nothrow) ISOCHARTVERTEX[pChart->m_dwVertNumber];
pChart->m_pFaces = new (std::nothrow) ISOCHARTFACE[pChart->m_dwFaceNumber];
if (!pChart->m_pVerts || !pChart->m_pFaces)
{
delete pChart; // vertex and face buffer will be deleted
return nullptr; // in destructor.
}
std::unique_ptr<uint32_t []> pdwVertMap(new (std::nothrow) uint32_t[m_dwVertNumber]);
if (!pdwVertMap)
{
delete pChart;
return nullptr;
}
ISOCHARTVERTEX* pOldVertex = nullptr;
ISOCHARTVERTEX* pNewVertex = pChart->m_pVerts;
for (uint32_t i = 0; i<pChart->m_dwVertNumber; i++)
{
pOldVertex = vertList[i];
pNewVertex->dwID = i;
pNewVertex->dwIDInRootMesh = pOldVertex->dwIDInRootMesh;
pNewVertex->dwIDInFatherMesh = pOldVertex->dwID;
pNewVertex->bIsBoundary = pOldVertex->bIsBoundary;
pNewVertex->nImportanceOrder = pOldVertex->nImportanceOrder;
pdwVertMap[pOldVertex->dwID] = i;
pNewVertex++;
}
ISOCHARTFACE* pNewFace = pChart->m_pFaces;
for (uint32_t i = 0; i<pChart->m_dwFaceNumber; i++)
{
ISOCHARTFACE* pOldFace = m_pFaces + faceList[i];
pNewFace->dwID = i;
pNewFace->dwIDInRootMesh = pOldFace->dwIDInRootMesh;
pNewFace->dwIDInFatherMesh = pOldFace->dwID;
for (size_t j=0; j<3; j++)
{
pNewFace->dwVertexID[j] =
pdwVertMap[pOldFace->dwVertexID[j]];
}
pNewFace++;
}
pChart->m_bNeedToClean = m_bNeedToClean;
return pChart;
}
inline HRESULT CIsochartMesh::MoveTwoValueToHead(
std::vector<uint32_t>& list,
uint32_t dwIdx1,
uint32_t dwIdx2)
{
if (list.size() <3)
{
return S_OK;
}
// if the 2 landmark aready in head
if ((0 == dwIdx1 || 0 == dwIdx2) &&
(1 == dwIdx1 || 1 == dwIdx2))
{
return S_OK;
}
else if (0 == dwIdx1)
{
std::swap(list[1],list[dwIdx2]);
}
else if (0 == dwIdx2)
{
std::swap(list[1], list[dwIdx1]);
}
else if (1 == dwIdx1)
{
std::swap(list[0],list[dwIdx2]);
}
else if (1 == dwIdx2)
{
std::swap(list[0],list[dwIdx1]);
}
else
{
std::swap(list[0], list[dwIdx1]);
std::swap(list[1], list[dwIdx2]);
}
return S_OK;
}
}
|
[
"SND\\walbourn_cp"
] |
SND\walbourn_cp
|
cb7f24c9c803b776aef4e8adcd95c8acc69d6c90
|
7425b73c5c4301b73efee73a2a97c478e3d9c94f
|
/src/sleipnir/src/serverclient.cpp
|
1ebbc5032f750db6a5d7706a89ecb2f3f8de8a80
|
[
"CC-BY-3.0"
] |
permissive
|
mehdiAT/diseasequest-docker
|
318202ced87e5e5ed1bd609fe268ebc530c65e96
|
31943d2fafa8516b866fa13ff3d0d79989aef361
|
refs/heads/master
| 2020-05-15T01:21:21.530861
| 2018-04-16T22:42:34
| 2018-04-16T22:42:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,445
|
cpp
|
/*****************************************************************************
* This file is provided under the Creative Commons Attribution 3.0 license.
*
* You are free to share, copy, distribute, transmit, or adapt this work
* PROVIDED THAT you attribute the work to the authors listed below.
* For more information, please see the following web page:
* http://creativecommons.org/licenses/by/3.0/
*
* This file is a component of the Sleipnir library for functional genomics,
* authored by:
* Curtis Huttenhower (chuttenh@princeton.edu)
* Mark Schroeder
* Maria D. Chikina
* Olga G. Troyanskaya (ogt@princeton.edu, primary contact)
*
* If you use this library, the included executable tools, or any related
* code in your work, please cite the following publication:
* Curtis Huttenhower, Mark Schroeder, Maria D. Chikina, and
* Olga G. Troyanskaya.
* "The Sleipnir library for computational functional genomics"
*****************************************************************************/
#include "stdafx.h"
#include "serverclient.h"
#include "server.h"
namespace Sleipnir {
void* CServerClientImpl::StartRoutine( void* pArg ) {
CServerClientImpl* pClient;
pClient = (CServerClientImpl*)pArg;
pClient->StartRoutine( );
delete pClient;
return NULL; }
void CServerClientImpl::StartRoutine( ) {
do
ReadMessage( );
while( m_vecbMessage.size( ) && m_pClient->ProcessMessage( m_vecbMessage ) );
g_CatSleipnir( ).info( "Client 0x%08x disconnected", m_pClient ); }
CServerClientImpl::CServerClientImpl( SOCKET iSocket, IServerClient* pClient ) : m_iSocket(iSocket),
m_pClient(pClient) { }
CServerClientImpl::~CServerClientImpl( ) {
closesocket( m_iSocket );
m_pClient->Destroy( ); }
void CServerClientImpl::ReadMessage( ) {
unsigned char acBuffer[ c_iBuffer ];
size_t iRead, iTotal, iPrev;
m_vecbMessage.clear( );
if( !( iRead = recv( m_iSocket, (char*)acBuffer, c_iBuffer, 0 ) ) || ( iRead == -1 ) ||
( iRead < sizeof(uint32_t) ) )
return;
iTotal = *(uint32_t*)acBuffer;
m_vecbMessage.resize( max( iTotal, iPrev = iRead - sizeof(uint32_t) ) );
copy( acBuffer + sizeof(uint32_t), acBuffer + iRead, m_vecbMessage.begin( ) );
while( ( iPrev < iTotal ) && ( iRead = recv( m_iSocket, (char*)acBuffer, c_iBuffer, 0 ) ) ) {
if( ( iPrev + iRead ) >= m_vecbMessage.size( ) )
m_vecbMessage.resize( iPrev + iRead );
copy( acBuffer, acBuffer + iRead, m_vecbMessage.begin( ) + iPrev );
iPrev += iRead; } }
}
|
[
"vicyao@gmail.com"
] |
vicyao@gmail.com
|
db2b308ac3de5b31aa1a7e60bacb5f1475e861ef
|
e44283331c214e69f049d3d23b6350dbf2abbf32
|
/C++/starting c++/main.cpp
|
0f28ebff65ba46e79819c5cfdbe3df933b0b0900
|
[] |
no_license
|
Abiduddin/Competitive-Programming-Codes
|
cd2a8730998859d751e1891b4bc9bd3a790b8416
|
59b51b08c6f34c1bed941c8b86490ee9a250e5a9
|
refs/heads/master
| 2020-09-09T22:54:09.708942
| 2019-11-14T02:31:06
| 2019-11-14T02:31:06
| 221,588,892
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 170
|
cpp
|
#include <iostream>
int main()
{
int a,b,m;
std::cout<<"Enter two number"<<std::endl;
std::cin>>a>>b;
m=a+b;
std::cout<<"The sum "<<m<<std::endl;
}
|
[
"abidakash456@gmail.com"
] |
abidakash456@gmail.com
|
d15f12b01322a7dc3974a28fd5a5a5d6580ff500
|
8f17795ece2ec5ee4261daede757ae6089cdf927
|
/src/test/base32_tests.cpp
|
93b02c9ed57c4b124f2d155e79cd943728ce0a20
|
[
"MIT"
] |
permissive
|
tatsuhirosato/momentum-beta
|
67da26495c74311826d14e8b0c2d5e79cb1a883c
|
faafc58e52d2404e9087b017b9345f797a2bae6f
|
refs/heads/master
| 2016-09-05T16:02:38.976468
| 2014-01-27T22:00:47
| 2014-01-27T22:00:47
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 648
|
cpp
|
#include <boost/test/unit_test.hpp>
#include "util.h"
BOOST_AUTO_TEST_SUITE(base32_tests)
BOOST_AUTO_TEST_CASE(base32_testvectors)
{
static const std::string vstrIn[] = {"","f","fo","PMM","PMMb","PMMba","PMMbar"};
static const std::string vstrOut[] = {"","my======","mzxq====","mzxw6===","mzxw6yq=","mzxw6ytb","mzxw6ytboi======"};
for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
{
std::string strEnc = EncodeBase32(vstrIn[i]);
BOOST_CHECK(strEnc == vstrOut[i]);
std::string strDec = DecodeBase32(vstrOut[i]);
BOOST_CHECK(strDec == vstrIn[i]);
}
}
BOOST_AUTO_TEST_SUITE_END()
|
[
"luca@Host-001.homenet.telecomitalia.it"
] |
luca@Host-001.homenet.telecomitalia.it
|
6c66e7fbae190b5c1ed1bffcba0c0d38f5125cef
|
47d89cd67ce335c6125a70174938b755cd2958ef
|
/chapter15/webServer-v2.cpp
|
2403adef2ec36e4040d8bb217624bfc1959964a0
|
[] |
no_license
|
sleep-jyx/webServer
|
f351ade24526c6d20e262d682e80de50d2b980cd
|
295a233bf2c0768d2995d5978cc4b776cc42d234
|
refs/heads/main
| 2023-07-03T04:08:24.535153
| 2021-07-29T13:41:39
| 2021-07-29T13:41:39
| 390,714,596
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,737
|
cpp
|
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
#include <cassert>
#include <sys/epoll.h>
#include "locker.h"
#include "threadpool.h"
#include "http_conn.h"
#define MAX_FD 65536
#define MAX_EVENT_NUMBER 10000
extern int addfd(int epollfd, int fd, bool one_shot);
extern int removefd(int epollfd, int fd);
void addsig(int sig, void(handler)(int), bool restart = true)
{
struct sigaction sa;
memset(&sa, '\0', sizeof(sa));
sa.sa_handler = handler;
if (restart)
{
sa.sa_flags |= SA_RESTART;
}
sigfillset(&sa.sa_mask);
assert(sigaction(sig, &sa, NULL) != -1);
}
void show_error(int connfd, const char *info)
{
printf("%s", info);
send(connfd, info, strlen(info), 0);
close(connfd);
}
int main(int argc, char *argv[])
{
if (argc <= 2)
{
printf("usage: %s ip_address port_number\n", basename(argv[0]));
return 1;
}
const char *ip = argv[1];
int port = atoi(argv[2]);
addsig(SIGPIPE, SIG_IGN);
threadpool<http_conn> *pool = NULL;
try
{
pool = new threadpool<http_conn>;
printf("--debug--:创建线程池成功\n");
}
catch (...)
{
return 1;
}
http_conn *users = new http_conn[MAX_FD];
assert(users);
int user_count = 0;
int listenfd = socket(PF_INET, SOCK_STREAM, 0);
assert(listenfd >= 0);
struct linger tmp = {1, 0};
setsockopt(listenfd, SOL_SOCKET, SO_LINGER, &tmp, sizeof(tmp));
int ret = 0;
struct sockaddr_in address;
bzero(&address, sizeof(address));
address.sin_family = AF_INET;
inet_pton(AF_INET, ip, &address.sin_addr);
address.sin_port = htons(port);
ret = bind(listenfd, (struct sockaddr *)&address, sizeof(address));
assert(ret >= 0);
ret = listen(listenfd, 5);
assert(ret >= 0);
epoll_event events[MAX_EVENT_NUMBER];
int epollfd = epoll_create(5);
assert(epollfd != -1);
addfd(epollfd, listenfd, false);
http_conn::m_epollfd = epollfd;
while (true)
{
int number = epoll_wait(epollfd, events, MAX_EVENT_NUMBER, -1);
if ((number < 0) && (errno != EINTR))
{
printf("epoll failure\n");
break;
}
for (int i = 0; i < number; i++)
{
int sockfd = events[i].data.fd;
//轮询服务器
if (sockfd == listenfd)
{
printf("--debug--:主线程轮询到服务器\n");
struct sockaddr_in client_address;
socklen_t client_addrlength = sizeof(client_address);
int connfd = accept(listenfd, (struct sockaddr *)&client_address, &client_addrlength);
if (connfd < 0)
{
printf("errno is: %d\n", errno);
continue;
}
if (http_conn::m_user_count >= MAX_FD)
{
show_error(connfd, "Internal server busy");
continue;
}
//主线程创建一个HTTP服务器对象,让其处理客户请求
users[connfd].init(connfd, client_address);
}
//客户连接退出
else if (events[i].events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR))
{
printf("--debug--:有客户连接退出\n");
users[sockfd].close_conn();
}
//客户连接有请求到来,需要主线程去读
else if (events[i].events & EPOLLIN)
{
printf("--debug--:客户连接有请求到来,需要主线程去读\n");
if (users[sockfd].read())
{ //http服务器对象成功读取了客户的请求数据,将该请求数据插入到请求队列上
printf("--debug--:http服务器对象成功读取了客户的请求数据,将该请求数据插入到请求队列上\n");
pool->append(users + sockfd);
}
else
{
users[sockfd].close_conn();
}
}
//客户连接请求数据,
else if (events[i].events & EPOLLOUT)
{
printf("--debug--:客户连接请求数据\n");
if (!users[sockfd].write())
{
users[sockfd].close_conn();
}
}
else
{
}
}
}
close(epollfd);
close(listenfd);
delete[] users;
delete pool;
return 0;
}
|
[
"1608713140@qq.com"
] |
1608713140@qq.com
|
b2a024e3bec0f301c3ae5815e46784bfe4646108
|
7df8bf7b5d56941cc963a2d336bae1913fd54a8a
|
/Student Data/student.cpp
|
884e86343325258698ff34313c15d50f8a61d972
|
[] |
no_license
|
dre4stl/WGU-Project-2
|
3b72b428fd704936bd5dcea377f0c1121c28c057
|
2eb03d7763798e37b1f07518d8fa8fc29db080c1
|
refs/heads/master
| 2022-11-20T00:31:42.936412
| 2020-07-20T19:16:05
| 2020-07-20T19:16:05
| 281,204,883
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,855
|
cpp
|
//
// student.cpp
// Student Data
//
// Created by DeAundra Dyson on 7/2/20.
// Copyright © 2020 DeAundra Dyson. All rights reserved.
//
#include <iostream>
#include <iomanip>
#include "student.hpp"
#include "degree.h"
using namespace std;
Student::Student()//empty Constructor
{
this->studentID = "";
this->firstName = "";
this->lastName = "";
this->emailAddress = "";
this->age =0;
this->daystoComplete = new int [daystoCompleteCourseArraysize];
for (int i = 0; i < daystoCompleteCourseArraysize; i++) {this->daystoComplete[i] = 0;}
}
Student::Student (string ID, string fName, string lName, string eAddress, int age, int daystoComplete[])//Full Constructor
// Having trouble with the Full Constructor
/*
Student::Student(string i, string f, string l, string e, int a, int NoD[]){
this->studentID = i;
this->firstName = f;
this->lastName = l;
this->email = e;
this->age = a;
//this->numOfDays[numOfDaysArraySize] = new int tempArray[];
for (int i=0; i<3; i++){
this->numOfDays[i] = NoD[i];
}
}
string Student::getStudentID() {
return studentID;
}
void Student::setStudentID(string newStudentID){
studentID = newStudentID;
}
string Student::getFirstName() {
return firstName;
}
void Student::setFirstName(string newFirstName){
firstName = newFirstName;
}
string Student::getLastName(){
return lastName;
}
void Student::setLastName(string newLastName){
lastName = newLastName;
}
string Student::getEmail() {
return email;
}
void Student::setEmail(string newEmail) {
email = newEmail;
}
int Student::getAge() {
return age;
}
void Student::setAge(int newAge) {
age = newAge;
}
int* Student::getNumOfDays(){
return numOfDays;
}
void Student::setNumOfDays(int *nd){
for (int i = 0;i < sizeof(numOfDays)/sizeof(numOfDays[0]);i++){
numOfDays[i] = nd[i];
}
}
void Student::print() {
cout << "First Name: " << getFirstName() << "\t";
cout << "Last Name: " << getLastName() << "\t";
cout << "Age: " << getAge() << "\t";
cout << "Days in course: ";
for(int j=0; j<3; j++){
cout << getNumOfDays()[j];
if(j<2){
cout << ", ";
} else {
cout << "\t";
}
}
}
//Deconstructor
Student::~Student(){
cout << "Student Deconstructor for " << firstName << " " << lastName << endl;
cout << endl;
}
D. For the Student class, do the following:
1. Create the base class Student in the files student.h and student.cpp, which includes each of the following variables:
• student ID
• first name
• last name
• email address
• age
• array of number of days to complete each course
• degree program
Note: Degree type should be populated in subclasses only.
2. Create each of the following functions in the Student class:
a. an accessor (i.e., getter) for each instance variable from part D1
b. a mutator (i.e., setter) for each instance variable from part D1
Note: All access and changes to the instance variables of the Student class should be done through the accessor and mutator functions.
c. constructor using all of the input parameters provided in the table
d. virtual print() to print specific student data
e. destructor
f. virtual getDegreeProgram()
Note: Leave the implementation of the getDegreeProgram() function empty.
3. Create the three following classes as subclasses of Student, using the files created in part B:
• SecurityStudent
• NetworkStudent
• SoftwareStudent
Each subclass should override the getDegreeProgram() function. Each subclass should have a data member to hold the enumerated type for the degree program using the types defined in part C.
*/
|
[
"noreply@github.com"
] |
dre4stl.noreply@github.com
|
3065bc5925d62fb7c65cd47eb16d6a9c755e998e
|
26cb02ac39517585f5431bc8e042a58ba826abe9
|
/include/Dict.hh
|
3d050bdf61826b0b967b44b3e042721f987aed1f
|
[] |
no_license
|
jercheng/python_cpp_object_api
|
f4e22770869de15ef7e19267b6a2a33dea9fffaf
|
880438789757aaec429f7d025e3987b4f0ed01d8
|
refs/heads/main
| 2023-06-17T20:39:53.713137
| 2021-07-19T15:15:43
| 2021-07-19T15:15:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,377
|
hh
|
#pragma once
#include "Object.hh"
namespace Py
{
class Dict : public Object
{
public:
using Object::Object;
// construct new dictionary from key value pairs
Dict(std::initializer_list<std::pair<Str, Object>> _dict);
// Return a new dictionary that contains the same key-value pairs as p.
Dict Copy() const;
/**
@brief Iterate over mapping object other adding key-value pairs to this dictionary.
other may be a dictionary, or any object supporting PyMapping_Keys() and PyObject_GetItem().
If override is true, existing pairs in a will be replaced if a matching key is found in b,
otherwise pairs will only be added if there is not a matching key in a.
Return 0 on success or -1 if an exception was raised.
*/
int Merge(Dict other, int _override = 1);
/**
@brief This is the same as _Merge(b, 1) in C, and is similar to a.update(b) in Python except that
Update() doesn’t fall back to the iterating over a sequence of key value pairs if the second
argument has no “keys” attribute. Return 0 on success or -1 if an exception was raised.
*/
int Update(Dict other);
/**
@brief Determine if dictionary p contains key. If an item in p is matches key,
return 1, otherwise return 0. On error, return -1. This is equivalent to
the Python expression key in p.
*/
int Contains(Object key);
/**
@brief Empty an existing dictionary of all key-value pairs.
*/
void Clear();
/**
Return the object from dictionary p which has a key key. Return NULL if the
key key is not present, but without setting an exception.
Note that exceptions which occur while calling __hash__() and __eq__()
methods will get suppressed. To get error reporting use
GetItemWithError() instead.
*/
Object GetItem(Str key) const;
/*
Variant of PyDict_GetItem() that does not suppress exceptions. Return NULL
with an exception set if an exception occurred. Return NULL without an
exception set if the key wasn’t present.
*/
Object GetItemWithError(Str key) const;
/*
Insert val into the dictionary p with a key of key. key must be hashable;
if it isn’t, TypeError will be raised. Return 0 on success or -1 on failure.
This function does not steal a reference to val.
*/
int SetItem(Str key, Object new_value) const;
/*
Remove the entry in dictionary p with key key. key must be hashable;
if it isn’t, TypeError is raised. If key is not in the dictionary,
KeyError is raised. Return 0 on success or -1 on failure.
*/
int DelItem(Str key) const;
/*
Return a List containing all the items from the dictionary.
*/
List Items() const;
/*
Return a List containing all the keys from the dictionary.
*/
List Keys() const;
/*
Return a List containing all the keys from the dictionary.
*/
List Values() const;
};
}
|
[
"argmaster.world@gmail.com"
] |
argmaster.world@gmail.com
|
cc9a527b82712b86c0c112c04397fe5e5ef8f996
|
cec12808651cae020f66b95e17f73edd0c1b32fb
|
/src/Engine/Entity.cpp
|
dc583db3a3d5a8b3ee5ef7047e922bf294c47bb0
|
[] |
no_license
|
Bluest/BUJam2020
|
990cad38ff1f72f872abd4f316783d897e1a4fcc
|
bb0b161dd970cdbdd2e5fed3ab2bf54d6809f4fe
|
refs/heads/master
| 2021-03-02T03:19:05.486659
| 2020-03-13T13:48:50
| 2020-03-13T13:48:50
| 245,834,251
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 495
|
cpp
|
#include "Component.h"
#include "Entity.h"
void Entity::start()
{
for (auto it = components.begin(); it != components.end(); ++it)
{
(*it)->onStart();
}
}
void Entity::update()
{
for (auto it = components.begin(); it != components.end(); ++it)
{
(*it)->onUpdate();
}
}
void Entity::draw(SDL_Renderer* _renderer)
{
for (auto it = components.begin(); it != components.end(); ++it)
{
(*it)->onDraw(_renderer);
}
}
std::shared_ptr<Core> Entity::getCore()
{
return core.lock();
}
|
[
"oscarlh24@hotmail.com"
] |
oscarlh24@hotmail.com
|
5b2c197c870e3fd962097338d6dd3d28cc715f42
|
91db922ced8fb4899e4fc5ad20179f07d738a99f
|
/ABC/043/C.cpp
|
3ce26c08b2e99d104fecc5bc72a266b92aeabdd2
|
[] |
no_license
|
hntk03/atcoder
|
d1bb795b9b9db2a689353eedcf6b9211d923b21b
|
cd024e1b6911765ef9239a72c2e25147922fa460
|
refs/heads/master
| 2022-10-08T05:35:24.339333
| 2022-10-02T03:12:55
| 2022-10-02T03:12:55
| 162,792,776
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 495
|
cpp
|
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef vector<string> VS;
//container util
#define SORT(c) sort((c).begin(),(c).end())
//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int main(void){
int N; cin >> N;
vector<int> a(N);
REP(i,N) cin >> a[i];
int ans = 1 << 30;
FOR(i,-100,101){
int sum = 0;
REP(j,N) sum += abs((int)pow(i-a[j],2));
ans = min(ans, sum);
}
cout << ans << endl;
return 0;
}
|
[
"hntk03@gmail.com"
] |
hntk03@gmail.com
|
fd5846979a9027e46b395dd03a86e1e7097620a9
|
77861deda8b3046bdda221d3cb80b77e84b14523
|
/conv_to_oct/speedup.cpp
|
2098ec3cc5b816324681ef7c94348590cae9abf9
|
[
"BSD-2-Clause"
] |
permissive
|
WojciechMula/toys
|
b73f09212ca19f1e76bbf2afaa5ad2efcea95175
|
6110b59de45dc1ce44388b21c6437eff49a7655c
|
refs/heads/master
| 2023-08-18T12:54:25.919406
| 2023-08-05T09:20:14
| 2023-08-05T09:20:14
| 14,905,115
| 302
| 44
|
BSD-2-Clause
| 2020-04-17T17:10:42
| 2013-12-03T20:35:37
|
C++
|
UTF-8
|
C++
| false
| false
| 3,505
|
cpp
|
/*
Convert to octal representation - measure speedup over naive version
Author : Wojciech Muła
Date : 2014-09-28
License : BSD
*/
#include <string>
#include <vector>
#include <sys/time.h>
#include <cstdio>
#include "conv.h"
class measure_item_t {
uint32_t t1;
uint32_t t2;
public:
const std::string name;
public:
measure_item_t(const std::string& name)
: name(name)
{}
public:
double get_time() const {
return (t2 - t1)/1000000.0;
}
double get_speedup(const measure_item_t& other) const {
return other.get_time()/get_time();
}
void start() {
t1 = get_current_time();
}
void stop() {
t2 = get_current_time();
}
private:
uint32_t get_current_time(void) {
static struct timeval T;
gettimeofday(&T, NULL);
return (T.tv_sec * 1000000) + T.tv_usec;
}
};
typedef std::vector<measure_item_t> results_t;
// ------------------------------------------------------------------------
void print_results(const results_t& results) {
auto bar = [](int n, char c) {
while (n-- > 0) {
putchar(c);
}
putchar('\n');
};
const int terminal_width = 79;
const int convert = 10;
const int time = 10;
const int speedup = 10;
printf("| %*s | %*s | %*s |\n",
-convert, "convert",
time, "time [s]",
speedup, "speedup");
bar(terminal_width, '-');
const auto& ref = results[0];
double max_speedup = 0;
for (const auto& m: results) {
max_speedup = std::max(max_speedup, m.get_speedup(ref));
}
for (const auto& m: results) {
const int n = printf("| %*s | %*.4f | %*.2f | ",
convert, m.name.c_str(),
time, m.get_time(),
speedup, m.get_speedup(ref)
);
const double f = m.get_speedup(ref)/max_speedup;
const int k = f * (terminal_width - n);
bar(k, '#');
}
}
void csv_results(FILE* f, const results_t& results) {
fprintf(f, "\"convert\",\"time [s]\",\"speedup\"\n");
const auto& ref = results[0];
for (const auto& m: results) {
fprintf(f, "\"%s\",%.4f,%0.2f\n",
m.name.c_str(),
m.get_time(),
m.get_speedup(ref)
);
}
}
// ------------------------------------------------------------------------
template <typename F>
measure_item_t measure(F convert, int iterations, const std::string& name) {
std::printf("measure %s... ", name.c_str());
std::fflush(stdout);
measure_item_t m(name);
m.start();
uint16_t word = 0;
while (iterations-- > 0) {
convert(word & 0x0fff);
word += 33;
}
m.stop();
std::printf("ok\n");
return m;
}
results_t measure() {
const int n = 100000000;
results_t res;
prepare_single_lookup();
res.push_back(measure(to_oct_naive, n, "naive"));
res.push_back(measure(to_oct_mul, n, "mul"));
res.push_back(measure(to_oct_sse2, n, "SSE2"));
#ifdef HAVE_PDEP_INSTRUCTION
res.push_back(measure(to_oct_pdep, n, "pdep"));
#endif
res.push_back(measure(to_oct_single_lookup, n, "1 LUT"));
res.push_back(measure(to_oct_two_lookups, n, "2 LUTs"));
return res;
}
// ------------------------------------------------------------------------
int main() {
const auto res = measure();
std::puts("");
print_results(res);
FILE* f = fopen("results.csv", "wb");
if (f) {
csv_results(f, res);
fclose(f);
}
}
|
[
"wojciech_mula@poczta.onet.pl"
] |
wojciech_mula@poczta.onet.pl
|
a662aa30916fd2fb254a75e6f8ea668139db7933
|
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
|
/c++/ClickHouse/2015/8/StorageSystemMerges.cpp
|
17a6e21449fb973a385a11e580367db87c54cf1d
|
[] |
no_license
|
rosoareslv/SED99
|
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
|
a062c118f12b93172e31e8ca115ce3f871b64461
|
refs/heads/main
| 2023-02-22T21:59:02.703005
| 2021-01-28T19:40:51
| 2021-01-28T19:40:51
| 306,497,459
| 1
| 1
| null | 2020-11-24T20:56:18
| 2020-10-23T01:18:07
| null |
UTF-8
|
C++
| false
| false
| 3,704
|
cpp
|
#include <DB/Storages/StorageSystemMerges.h>
#include <DB/DataTypes/DataTypeString.h>
#include <DB/DataTypes/DataTypesNumberFixed.h>
#include <DB/Columns/ColumnString.h>
#include <DB/DataStreams/OneBlockInputStream.h>
#include <DB/Interpreters/Context.h>
#include <DB/Storages/MergeTree/MergeList.h>
namespace DB
{
StorageSystemMerges::StorageSystemMerges(const std::string & name)
: name{name}
, columns{
{ "database", new DataTypeString },
{ "table", new DataTypeString },
{ "elapsed", new DataTypeFloat64 },
{ "progress", new DataTypeFloat64 },
{ "num_parts", new DataTypeUInt64 },
{ "result_part_name", new DataTypeString },
{ "total_size_bytes_compressed", new DataTypeUInt64 },
{ "total_size_marks", new DataTypeUInt64 },
{ "bytes_read_uncompressed", new DataTypeUInt64 },
{ "rows_read", new DataTypeUInt64 },
{ "bytes_written_uncompressed", new DataTypeUInt64 },
{ "rows_written", new DataTypeUInt64 }
}
{
}
StoragePtr StorageSystemMerges::create(const std::string & name)
{
return (new StorageSystemMerges{name})->thisPtr();
}
BlockInputStreams StorageSystemMerges::read(
const Names & column_names,
ASTPtr query,
const Context & context,
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
const size_t max_block_size,
const unsigned)
{
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithTypeAndName col_database{new ColumnString, new DataTypeString, "database"};
ColumnWithTypeAndName col_table{new ColumnString, new DataTypeString, "table"};
ColumnWithTypeAndName col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"};
ColumnWithTypeAndName col_progress{new ColumnFloat64, new DataTypeFloat64, "progress"};
ColumnWithTypeAndName col_num_parts{new ColumnUInt64, new DataTypeUInt64, "num_parts"};
ColumnWithTypeAndName col_result_part_name{new ColumnString, new DataTypeString, "result_part_name"};
ColumnWithTypeAndName col_total_size_bytes_compressed{new ColumnUInt64, new DataTypeUInt64, "total_size_bytes_compressed"};
ColumnWithTypeAndName col_total_size_marks{new ColumnUInt64, new DataTypeUInt64, "total_size_marks"};
ColumnWithTypeAndName col_bytes_read_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_read_uncompressed"};
ColumnWithTypeAndName col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"};
ColumnWithTypeAndName col_bytes_written_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_written_uncompressed"};
ColumnWithTypeAndName col_rows_written{new ColumnUInt64, new DataTypeUInt64, "rows_written"};
for (const auto & merge : context.getMergeList().get())
{
col_database.column->insert(merge.database);
col_table.column->insert(merge.table);
col_elapsed.column->insert(merge.watch.elapsedSeconds());
col_progress.column->insert(merge.progress);
col_num_parts.column->insert(merge.num_parts);
col_result_part_name.column->insert(merge.result_part_name);
col_total_size_bytes_compressed.column->insert(merge.total_size_bytes_compressed);
col_total_size_marks.column->insert(merge.total_size_marks);
col_bytes_read_uncompressed.column->insert(merge.bytes_read_uncompressed);
col_rows_read.column->insert(merge.rows_read);
col_bytes_written_uncompressed.column->insert(merge.bytes_written_uncompressed);
col_rows_written.column->insert(merge.rows_written);
}
Block block{
col_database,
col_table,
col_elapsed,
col_progress,
col_num_parts,
col_result_part_name,
col_total_size_bytes_compressed,
col_total_size_marks,
col_bytes_read_uncompressed,
col_rows_read,
col_bytes_written_uncompressed,
col_rows_written
};
return BlockInputStreams{1, new OneBlockInputStream{block}};
}
}
|
[
"rodrigosoaresilva@gmail.com"
] |
rodrigosoaresilva@gmail.com
|
eff5b860a4d2dfeec90fdec4fff3752d97cdfa9b
|
66169a2be2a38aa8b5090308d43b42c63549ca94
|
/Nesis/Common/Geometry/Point2D.h
|
e96e89c5d0336457b646b564adc4367da1b4f0e6
|
[] |
no_license
|
jpoirier/x-gauges
|
6a5a3b05673aeff8632908cdfc2975a0a07f75ee
|
8261b19a9678ad27db44eb8c354f5e66bd061693
|
refs/heads/master
| 2016-09-06T11:13:27.022707
| 2011-12-19T06:54:23
| 2011-12-19T06:54:23
| 1,551,637
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,286
|
h
|
#ifndef __POINT2D_H
#define __POINT2D_H
/***************************************************************************
* *
* Copyright (C) 2006 by Kanardia d.o.o. [see www.kanardia.eu] *
* Writen by: *
* Ales Krajnc [ales.krajnc@kanardia.eu] *
* *
* Status: Open Source *
* *
* License: GPL - GNU General Public License *
* See 'COPYING.html' for more details about the license. *
* *
***************************************************************************/
/*! \file Point2D.h
\brief Declaration file for the Point2D class.
\author Ales Krajnc
\date 1.1.2006 - ported from VisualStudio code.
*/
#include <iostream>
#include <QPoint>
#include "CommonDefs.h"
#include "Tolerance.h"
// ----------------------------------------------------------------------------
//! The geometry namespace combines geometry related classes.
namespace geometry {
// ----------------------------------------------------------------------------
//! This class implements a point in 2D space. Point is based on qreal precision.
/*! It is assumed that this point lies in the X-Y plain and
positive angles are measured counterclockwise. This defines righthand
Euclidian space where Z axis seems to be missing. But it is not. Z axis
is defined by positive \b counterclockwise rotation of positive angles
(righthand rule).
The class provides operator conversions to QPoint class.
The class is member of the #geometry namespace. Related classes are
Line2D ...
*/
class Point2D
{
public:
//! Default constructor.
Point2D(qreal x=0.0, qreal y=0.0)
{ m_dX=x; m_dY=y; }
//! Construct from QPoint.
Point2D(QPoint p)
{ m_dX=p.x(); m_dY=p.y(); }
//! Construct from QPointF.
Point2D(QPointF p)
{ m_dX=p.x(); m_dY=p.y(); }
//! Copy constructor.
Point2D(const Point2D& C)
{ Copy(C); }
//! Create a copy of given point.
void Copy(const Point2D& C)
{ m_dX = C.m_dX; m_dY = C.m_dY; }
//! The assignment operator.
const Point2D& operator=(const Point2D& p)
{ Copy(p); return *this; }
//! Sets the x coordinate.
void SetX(qreal dX)
{ m_dX = dX; }
//! Sets the y coordinate.
void SetY(qreal dY)
{ m_dY = dY; }
//! Returns the x coordinate.
qreal GetX() const
{ return m_dX; }
//! Returns the y coordinate.
qreal GetY() const
{ return m_dY; }
//! Offsets the current point by a given distance.
void Move(const Point2D& p)
{ m_dX+=p.m_dX; m_dY+=p.m_dY; }
//! Rotates the point around the origin for given angle.
void Rotate(qreal dAlpha);
//! Rotates the point around given point (move, rotate, move).
void Rotate(const Point2D& p, qreal dAlpha);
//! Calculates the distance between this and given point.
qreal GetDistance(const Point2D& p) const;
//! Calculates the angle between this point and given point p.
qreal GetAngle(const Point2D& p) const;
//! The difference between this and given point p returned as a new point.
Point2D operator-(const Point2D& p) const;
//! The sum of this and given point p returned as a new point.
Point2D operator+(const Point2D& p) const;
//! Negate the point.
Point2D operator-() const
{ return Point2D(-m_dX,-m_dY); }
//! Operator that converts this point to QPoint object.
operator QPoint() const
{ return QPoint((int)(m_dX+0.5),(int)(m_dY+0.5)); }
//! Operator that converts this point to QPointF object.
operator QPointF() const
{ return QPointF(m_dX, m_dY); }
//! Adds the given coordinates to the existing coordinates. Same as #Move.
void operator+=(const Point2D& p)
{ m_dX+=p.m_dX; m_dY+=p.m_dY; }
//! Subtracts the given coordinates from the existing coordinates.
void operator-=(const Point2D& p)
{ m_dX-=p.m_dX; m_dY-=p.m_dY; }
//! Compares for equality of two points using default relative tolerance.
bool operator==(const Point2D& p) const
{ return tolerance_rel::Equal(m_dX,p.m_dX)
&& tolerance_rel::Equal(m_dY,p.m_dY);}
//! Negation of the operator ==.
bool operator!=(const Point2D& p) const
{ return !operator==(p); }
//! Returns true if the first point has smaller coordinates than given point p.
bool operator<(const Point2D& p) const
{ return m_dX<p.m_dX && m_dY<p.m_dY; }
//! Compares for equality of two points using specified tolerance.
bool IsEqual(const Point2D& p, qreal dTolerance) const
{ return tolerance_rel::Equal(m_dX,p.m_dX, dTolerance)
&& tolerance_rel::Equal(m_dY,p.m_dY, dTolerance);}
//! Serializes the point to the data binary stream.
void Serialize(QDataStream& ds);
protected:
//! X coordinate.
qreal m_dX;
//! Y coordinate.
qreal m_dY;
};
//! Outputs the Point2D object to the out stream.
inline std::ostream& operator<<(std::ostream& out, const Point2D& p)
{
out << "(" << p.GetX() << "," << p.GetY() << ")";
return out;
}
//! Writes the Point2D object to the data stream object.
inline QDataStream& operator<<(QDataStream& ds, const Point2D& p)
{
const_cast<Point2D&>(p).Serialize(ds);
return ds;
}
//! Reads the Point2D object from the data stream object.
inline QDataStream& operator>>(QDataStream& ds, Point2D& p)
{
p.Serialize(ds);
return ds;
}
// --------------------------------------------------------
//! Special binary_function that sorts points.
class Point2DSortXLess : std::binary_function<Point2D, Point2D, bool>
{
public:
Point2DSortXLess() {}
result_type operator() (first_argument_type a, second_argument_type b)
{
return (a.GetX() < b.GetX()) ? true :
(a.GetX() == b.GetX()) ? a.GetY() <b.GetY() :
false;
}
};
}
// ----------------------------------------------------------------------------
#endif // __POINT2D_H
|
[
"devnull@localhost"
] |
devnull@localhost
|
36a723901a34ed927885bb473f277b346f288acc
|
380d95bcf755f0c227130454e02b1e8698b274a2
|
/cf637/a.cpp
|
aea0d32f27f6757a31f7826d999adbda23196538
|
[] |
no_license
|
geekpradd/CP-Topicwise
|
dd590ce94d0feb6b7a7037dd54e54a4b40041e77
|
5a257676171d0c4db71125ad3e872b338202fe16
|
refs/heads/master
| 2021-05-20T09:29:35.898564
| 2020-12-25T18:54:30
| 2020-12-25T18:54:30
| 252,225,116
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 846
|
cpp
|
#include <bits/stdc++.h>
#define int long long
#define ii pair<int, int>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define E9 1000000000
using namespace std;
int power(int base, int exp){
if (exp==0)
return 1;
int res = power(base, exp/2);
res = (res*res)%MOD;
if (exp % 2)
return (res*base)%MOD;
return res;
}
int inverse(int n){
return power(n, MOD-2);
}
void solve(){
int n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
bool pos = 0;
for (int i=c-d; i<=c+d; ++i){
if (i >= n*(a-b) && i<=n*(a+b)){
pos = 1;
break;
}
}
if (pos){
cout << "Yes" << endl;
}
else {
cout << "No" << endl;
}
}
signed main(){
cin.tie(NULL); ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
int t; cin >> t;
for (int w=1; w<=t; ++w){
solve();
}
return 0;
}
|
[
"geekpradd@gmail.com"
] |
geekpradd@gmail.com
|
7e955414559caf4cf937d44214d1f6de5376fb91
|
56d4a23b9b748a864a5f1586c5aa6c09aecc8bba
|
/HW3/161044015/161044015.cpp
|
e0a7e396dc8de44d6e473b0f71bc1659df1c86ad
|
[] |
no_license
|
medineaslan/Object-Oriented-Programming
|
ed74e7a0189a10bbb2569ad1ce9318cd286f89b4
|
176eaaf9c3c86099b470383226fbf7eea207b2c1
|
refs/heads/main
| 2022-12-28T02:14:01.806796
| 2020-10-11T15:54:08
| 2020-10-11T15:54:08
| 302,982,745
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 27,407
|
cpp
|
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <string>
using namespace std;
class NPuzzle
{
public:
inline void print(){myBoard.print();} //Prints the current configuration on the screen by sending it to cout.
inline void printReport(int numberOfMovesValue){myBoard.printReport(numberOfMovesValue);} //Prints a report about how many moves have been done.
inline void readFromFile(const string fileName){myBoard.readFromFile(fileName);} //Reading from file.
inline void writeToFile(const string fileName){myBoard.writeToFile(fileName);} //Writing to file.
inline void shuffle(const int N){myBoard.shuffle(N);} //Makes N random move.
inline void reset(){myBoard.reset();} //Reset the board.
inline bool setsize(int rowValue, int columnValue){myBoard.setSize(rowValue, columnValue);} //Set the board size given values.
inline void moveRandom(){myBoard.moveRandom();} //Makes random move.
inline char moveIntelligent(){myBoard.moveIntelligent();} //Makes intelligent move.
inline bool moveForIntelligent(int tempArr[][9], char move, int controller){myBoard.moveForIntelligent(tempArr, move, controller);} //This functions works for intelligent move.
inline bool move(const char move, int controller){myBoard.move(move, controller);} //Makes a move.
inline int solvePuzzle(){myBoard.solvePuzzle();} //Makes an attempt to solve the puzzle.
inline bool issolved()const{myBoard.isSolved();} //Game over control.
inline bool isSolvable(){myBoard.isSolvable();} //Check the boards solvability.
inline void playGame(){myBoard.playGame();} //Playing game.
private:
class Board
{
public:
void print();
void readFromFile(const string fileName);
void writeToFile(const string fileName);
void reset();
bool setSize(int rowValue, int columnValue);
bool move(const char move, int controller);
bool isSolved()const;
void setFileBoardControl(bool file_board_control_value); //Setting false when reading from file.
void playGame();
void printReport(int numberOfMovesValue);
void moveRandom();
void shuffle(const int N);
char moveIntelligent();
bool moveForIntelligent(int tempArr[][9], char move, int controller);
bool isSolvable();
int solvePuzzle();
private:
void initializeBoard();
int calculate_digit_number(int number);
void create_distance_controller_array(int distance_control_array[][9]);
int find_total_distance(int distance_control_array[][9]);
bool number_of_inversion();
bool find_position_of_empty_cell();
int board[9][9];
int row;
int column;
bool file_board_control = true;
bool printFinishControl = true;
};
Board myBoard;
};
int NPuzzle :: Board :: solvePuzzle()
{
int solution_control = 1, i, random_move, escape_stuck = 1, controller = 1, moveNumber = 0;
char old_one, next_one;
if(file_board_control == 0){ //Came from file.
while(solution_control){
for(i=0; escape_stuck && solution_control == 1; i++){
next_one = moveIntelligent();
if(next_one == 'R' && old_one == 'L') //If there is a stuck.
escape_stuck = 0;
else if(next_one == 'L' && old_one == 'R')
escape_stuck = 0;
else if(next_one == 'U' && old_one == 'D')
escape_stuck = 0;
else if(next_one == 'D' && old_one == 'U')
escape_stuck = 0;
if(escape_stuck == 1){ //If there is no stuck, it makes intelligent move.
move(next_one,controller);
moveNumber++;
old_one = next_one;
print();
}
if(isSolved()){
solution_control = 0;
printFinishControl = false;
}
}
escape_stuck = 1;
for(i=0; i < 3 && solution_control == 1; i++){ //In the stuck it moves 3 times randomly.
moveRandom();
moveNumber++;
print();
if(isSolved()){
solution_control = 0;
printFinishControl = false;
}
}
}
}
else{ //If board came raandomly.
int solution_control = 1, i, random_move, escape_stuck = 1,is_valid_way =1;
char old_one, next_one;
while(solution_control){
escape_stuck = 1;
for(i=0; escape_stuck && solution_control == 1; i++){
next_one = moveIntelligent();
if(next_one == 'R' && old_one == 'L')
escape_stuck = 0;
else if(next_one == 'L' && old_one == 'R')
escape_stuck = 0;
else if(next_one == 'U' && old_one == 'D')
escape_stuck = 0;
else if(next_one == 'D' && old_one == 'U')
escape_stuck = 0;
if(escape_stuck == 1){
move(next_one,controller);
moveNumber++;
old_one = next_one;
print();
}
if(isSolved()){
solution_control = 0;
printFinishControl = false;
}
}
i=0;
while( i < 3 && solution_control == 1){
moveRandom();
moveNumber++;
i++;
print();
if(isSolved()){
solution_control = 0;
printFinishControl = false;
}
}
}
}
return moveNumber;
}
bool NPuzzle :: Board :: moveForIntelligent(int tempArr[][9], char move, int controller)
{
int i, j, row_num;
decltype(i) column_num;
row_num = row;
column_num = column;
if(move == 'R'){ //The empty cell is moved in the right direction.
for(i=0; i < row_num; i++){
for(j=0; j < column_num && controller == 1; j++){
if(tempArr[i][j] == -1){
if(j != (column_num - 1) && tempArr[i][j+1] != 0){ //If the right side does not exceed the board limit, movement is made.
int right_temp_number;
right_temp_number = tempArr[i][j+1];
tempArr[i][j+1] = -1;
tempArr[i][j] = right_temp_number;
controller = 0;
return true;
}
}
}
}
}
else if(move == 'L'){ //The empty cell is moved in the left direction.
for(i=0; i < row_num; i++){
for(j=0; j < column_num; j++){
if(tempArr[i][j] == -1){
if(j != 0 && tempArr[i][j-1] != 0){ //If the left side does not exceed the board limit, movement is made.
int left_temp_number;
left_temp_number = tempArr[i][j-1];
tempArr[i][j-1] = -1;
tempArr[i][j] = left_temp_number;
return true;
}
}
}
}
}
else if(move == 'U'){ //The empty cell is moved in the up.
for(i=0; i < row_num; i++){
for(j=0; j < column_num; j++){
if(tempArr[i][j] == -1){
if(i != 0 && tempArr[i-1][j] != 0){ //If the up side does not exceed the board limit, movement is made.
int up_temp_number;
up_temp_number = tempArr[i-1][j];
tempArr[i-1][j] = -1;
tempArr[i][j] = up_temp_number;
return true;
}
}
}
}
}
else if(move == 'D'){ //The empty cell is moved in the down.
for(i=0; i < row_num && controller == 1; i++){
for(j=0; j < column_num && controller == 1; j++){
if(tempArr[i][j] == -1){
if(i != (row_num - 1) && tempArr[i+1][j] != 0){ //If the down side does not exceed the board limit, movement is made.
int down_temp_number;
down_temp_number = tempArr[i+1][j];
tempArr[i+1][j] = -1;
tempArr[i][j] = down_temp_number;
controller = 0;
return true;
}
}
}
}
}
return false;
}
void NPuzzle :: Board :: shuffle(const int N) //Makes N times random move.
{
int i;
for(i = 0; i < N; i++){
moveRandom();
}
}
bool NPuzzle :: Board :: isSolvable() //Checking board solvability.
{
int controller_1, controller_2;
controller_1 = find_position_of_empty_cell();
controller_2 = number_of_inversion();
if(row % 2 == 0){ //If the problem_size is even
if(controller_1 == 0 && controller_2 == 0) //The empty cell must be in even row and the inversion number must be odd.
return true;
if(controller_1 == 1 && controller_2 == 1) //The empty cell must be in odd row and the inversion number must be even.
return true;
else
return false;
}
else{ //if the problem_size is odd
if(controller_2 == 1) //The number of inversion should be even.
return true;
else
return false;
}
}
bool NPuzzle :: Board :: number_of_inversion() //For check board solvability.
{
int i, inversion_controller_array[82];
decltype(i) j;
auto k=0, control = 0, inversion = 0;
for(i=0; i < row; i++){
for(j=0; j < column; j++){
inversion_controller_array[k] = board[i][j];
k++;
}
}
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(board[i][j] != -1){
for(k=control+1; k < (row * column); k++){
if(inversion_controller_array[k] != -1 && board[i][j] > inversion_controller_array[k])
inversion++;
}
}
control++;
}
}
if(inversion % 2 == 0)
return true;
else
return false;
}
bool NPuzzle :: Board :: find_position_of_empty_cell() //For check board solvability.
{
int i;
decltype(i) j;
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(board[i][j] == -1){
if(i % 2 == 0) //even row
return false;
else
return true;
}
}
}
}
char NPuzzle :: Board :: moveIntelligent() //Makes intelligent move.
{
int controller = 1, temp_arr[4] ={1, 2 ,3,4}, i, min_total_distance = 0, choose_direction = 0;
int distance_control_array[9][9], available, large_number = 10000, my_controller_array[9][9];
char my_direction;
create_distance_controller_array(distance_control_array);
available = moveForIntelligent(distance_control_array, 'R', controller);
if(available)
temp_arr[0] = find_total_distance(distance_control_array);
else
temp_arr[0] = large_number;
create_distance_controller_array(distance_control_array);
available = moveForIntelligent(distance_control_array, 'L', controller);
if(available)
temp_arr[1] = find_total_distance(distance_control_array);
else
temp_arr[1] = large_number;
create_distance_controller_array(distance_control_array);
available = moveForIntelligent(distance_control_array, 'U', controller);
if(available)
temp_arr[2] = find_total_distance(distance_control_array);
else
temp_arr[2] = large_number;
create_distance_controller_array(distance_control_array);
available = moveForIntelligent(distance_control_array, 'D', controller);
if(available)
temp_arr[3] = find_total_distance(distance_control_array);
else
temp_arr[3] = large_number;
min_total_distance = temp_arr[0];
for(i=0; i < 4; i++){
if(temp_arr[i] < min_total_distance){
min_total_distance = temp_arr[i];
choose_direction = i;
}
}
if(choose_direction == 0)
return 'R';
else if(choose_direction == 1)
return 'L';
else if(choose_direction == 2)
return 'U';
else if(choose_direction == 3)
return 'D';
}
int NPuzzle :: Board :: find_total_distance(int distance_control_array[][9])
{
if(file_board_control == 1){
int i, j;
decltype(i) division;
auto my_number = 1, final_position_i=0, final_position_j=0, total_distance = 0;
while (my_number <= row * column){ //The distance of all numbers on the map to the required positions is calculated.
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(distance_control_array[i][j] == my_number){
if(my_number % row == 0){
final_position_j = row - 1;
division = my_number / row;
final_position_i = division - 1;
}
else{
final_position_i = my_number / row;
final_position_j = (my_number % column) - 1;
}
total_distance = total_distance + abs(i - final_position_i) + abs(j - final_position_j);//Distance from numbers to locations
my_number++;
}
//The distance of the empty cell to the position it should be located is calculated.
else if(distance_control_array[i][j] == -1 && my_number == row * column){
final_position_i = row - 1;
final_position_j = column - 1;
total_distance = total_distance + abs(i - final_position_i) + abs(j - final_position_j);
my_number++;
}
}
}
}
return total_distance;
}
else{ //The distance of all numbers on the map to the required positions is calculated for board came from the file.
int i, j,k=0,a=0, number_of_elements = 0, my_number = 1;
int find_position_i[row*column], find_position_j[row*column], control=1, total_distance = 0;
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(distance_control_array[i][j] != 0)
number_of_elements++;
}
}
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(distance_control_array[i][j] != 0){
find_position_i[k] = i;
find_position_j[k] = j;
k++;
}
}
}
while(my_number <= number_of_elements){
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(distance_control_array[i][j] == my_number){
total_distance += abs(i - find_position_i[a]) + abs(j - find_position_j[a]);
a++;
my_number++;
}
else if(distance_control_array[i][j] == -1 && my_number == number_of_elements){
total_distance += abs(i - find_position_i[number_of_elements - 1]) + abs(j- find_position_j[number_of_elements - 1]);
my_number++;
}
}
}
}
return total_distance;
}
}
void NPuzzle :: Board :: create_distance_controller_array(int distance_control_array[][9])
{
int i, j;
for(i=0; i < row; i++){
for(j=0; j < column; j++){
distance_control_array[i][j] = board[i][j];
}
}
}
void NPuzzle :: Board :: moveRandom() //Makes random move.
{
bool random_moves = true;
int random;
do{
bool move_controller;
random = 1 + rand() % 4;
if(random == 1){
move_controller = move('R', 1);
if(move_controller)
random_moves = false;
}
else if(random == 2){
move_controller = move('L', 1);
if(move_controller)
random_moves = false;
}
else if(random == 3){
move_controller = move('U', 1);
if(move_controller)
random_moves = false;
}
else if(random == 4){
move_controller = move('D', 1);
if(move_controller)
random_moves = false;
}
}while(random_moves);
}
void NPuzzle :: Board :: printReport(int numberOfMovesValue)
{
cout << numberOfMovesValue << " moves have been done." << endl ;
cout << "Solution is not found." << endl;
cout << endl;
print();
}
void NPuzzle :: Board :: reset()
{
if(file_board_control){
int i=0, j=0, k;
for(k=1; k <= (row * column); k++){
if(k == (row * column)){
board[row-1][column-1] = -1;
}
else{
if(k % (row) == 0){
board[i][j] = k;
i++;
j=0;
}
else{
board[i][j] = k;
j++;
}
}
}
}
else{ //Came from file.
int my_number = 1, i, j;
for(i=0; i < row; i++){ //Takes final board.
for(j=0; j < column; j++){
if(board[i][j] != 0){
board[i][j] = my_number;
my_number++;
}
if(i == row - 1 && j == column - 1)
board[i][j] = -1;
}
}
}
print();
}
void NPuzzle :: Board :: playGame()
{
int moveNumber = 0;
auto control = 1, number_of_moves = 0, controller = 1;
bool finish = true, print_control = true, is_move, game_over;
char moveCh;
//Moves until the game is over and Q is selected.
//Move function is called according to the selected direction and movement is performed.
//As the movement is made, the number of movements is increased.
while(finish){
cout << "Your move : ";
cin >> moveCh;
if(control == 1){
if(moveCh != 'R' || moveCh != 'L' || moveCh != 'U' || moveCh != 'D' || moveCh != 'S'|| moveCh != 'I' || moveCh != 'O' || moveCh != 'T' || moveCh != 'E' || moveCh != 'V')
print_control = false;
if(moveCh == 'R'){
if(!file_board_control){
is_move = move(moveCh, controller);
if(is_move)
number_of_moves++;
control = 0;
print_control = false;
print();
}
else{
is_move = move(moveCh, controller);
if(is_move)
number_of_moves++;
control = 0;
print_control = true;
}
}
else if(moveCh == 'L'){
if(file_board_control == 0){
is_move = move(moveCh, controller);
if(is_move)
number_of_moves++;
control = 0;
print_control = false;
print();
}
else{
is_move = move(moveCh, controller);
if(is_move)
number_of_moves++;
control = 0;
print_control = true;
}
}
else if(moveCh == 'U'){
if(file_board_control == 0){
is_move = move(moveCh, controller);
if(is_move)
number_of_moves++;
control = 0;
print_control = false;
print();
}
else{
is_move = move(moveCh, controller);
if(is_move)
number_of_moves++;
control = 0;
print_control = true;
}
}
else if(moveCh == 'D'){
if(file_board_control == 0){
is_move = move(moveCh, controller);
if(is_move)
number_of_moves++;
control = 0;
print_control = false;
print();
}
else{
is_move = move(moveCh, controller);
if(is_move)
number_of_moves++;
control = 0;
print_control = true;
}
}
else if(moveCh == 'S'){ //If S motion is selected, final solution is displayed and size * size random movement is done.
int i;
reset();
int N = row*column;
shuffle(N);
print();
print_control = false;
control = 0;
number_of_moves++;
}
else if(moveCh == 'I'){ //Choose intelligent move.
char my_direction = moveIntelligent();
cout << "Intelligent move chooses " << my_direction << endl;
move(my_direction, controller);
control = 0;
number_of_moves++;
print_control = true;
}
else if(moveCh == 'T'){ //Number of moves printed.
number_of_moves++;
printReport(number_of_moves);
}
else if(moveCh == 'E'){ //Asks a file name and saves board in the file.
string save;
cout << "File name: ";
cin >> save;
writeToFile(save);
number_of_moves++;
print_control = false;
}
else if(moveCh == 'O'){ //Asks a file name and load board from the file.
string line, load_file;
cout << "File name: ";
cin >> load_file;
readFromFile(load_file);
control = 0;
number_of_moves++;
print_control = false;
}
else if(moveCh == 'V'){ //Solves problem using the new intelligent algorithm.
moveNumber = solvePuzzle();
number_of_moves = number_of_moves + moveNumber;
number_of_moves++;
}
else if(moveCh == 'Q') //If the user enters Q, the program ends.
finish = false;
}
/*After each move, it is checked whether the game is over or not.
If the game is finished the board and the necessary information is suppressed. Then the program ends.*/
game_over = isSolved();
if(game_over == true && file_board_control == true && printFinishControl == true){
print();
cout << endl;
cout << "Problem Solved!" << endl;
cout << "Total number of moves " << number_of_moves << endl;
print_control = false;
finish = false;
}
else if(game_over == true && file_board_control == false && printFinishControl == true){
if(print_control){
print();
}
cout << endl;
cout << "Problem Solved!" << endl;
cout << "Total number of moves " << number_of_moves << endl;
print_control = false;
finish = false;
}
if(game_over == true && printFinishControl == false){
cout << endl;
cout << "Problem Solved!" << endl;
cout << "Total number of moves " << number_of_moves << endl;
finish = false;
}
control = 1;
if(print_control)//The board is printed after each move.
print();
print_control = true;
}
}
void NPuzzle :: Board :: writeToFile (const string fileName)
{
int i, j;
ofstream save_file;
save_file.open(fileName.c_str());
if(file_board_control){
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(board[i][j] == -1 ){
save_file << "bb";
if(j != column - 1)
save_file << " ";
}
else{
if(board[i][j] != -1){
if(board[i][j] <= 9){
save_file << "0" << board[i][j];
}
else{
save_file << board[i][j];
}
if(j != (column-1))
save_file << " ";
}
}
}
if(i != row - 1){
save_file << endl ;
}
}
save_file << endl;
}
else{ //Came from file.
for (i=0; i < row; ++i){
for (j=0; j < column; ++j){
if(board[i][j] != -1){
int digit = calculate_digit_number(board[i][j]);
if(digit < 2){
save_file << "0" << board[i][j];
if(j != column - 1)
save_file << " ";
}
else{
save_file << board[i][j] ;
if(j != column - 1)
save_file << " ";
}
}
else{
save_file << "bb" ;
if(j != column - 1)
save_file << " ";
}
}
save_file << endl;
}
}
print();
save_file.close();
}
void NPuzzle :: Board :: readFromFile(const string fileName)
{
int my_line_number = 0, my_total_space = 0;
ifstream input_file;
string line, load_file;
load_file = fileName;
input_file.open(load_file.c_str());
while(getline(input_file,line)){ //Read lines from file
my_line_number++; // Calculate line number.
for(int i = 0; i < line.size(); ++i){
if(line.at(i) == ' ')
my_total_space++; //Calculate all spaces in the file.
}
}
input_file.close();
row = my_line_number;
column = (my_total_space / row) + 1;
input_file.open(load_file.c_str());
int i, j;
char temp_ch_array[row][column * 2];
for(i=0; i < row; i++){ //Read elements from the file.
for(j=0; j < column * 2; j++){
input_file >> temp_ch_array[i][j];
}
}
input_file.close();
for(i=0; i < row; i++){ //Convert string to integer.
for(j=0; j < column * 2; j=j+2){
char first_index, second_index;
string str_1, str_2, string_number;
int number;
first_index = temp_ch_array[i][j];
second_index = temp_ch_array[i][j + 1];
if(first_index == 'b') //Assign -1 for space.
number = -1;
else{
str_1 = str_1 + first_index;
str_2 = str_2 + second_index;
string_number = str_1 + str_2;
number = stoi(string_number);
}
board[i][j/2] = number;
}
}
setFileBoardControl(false); //file_board_control setting to false.
print();
}
int NPuzzle :: Board :: calculate_digit_number(int number)
{
int count = 0;
while(number > 0){
number = number / 10;
count++;
}
return count;
}
void NPuzzle :: Board :: setFileBoardControl(bool file_board_control_value)
{
file_board_control = file_board_control_value;
}
bool NPuzzle :: Board :: isSolved()const //Controlling game over.
{
int temp_array[82], i, j, size1;
decltype(size1) size2;
auto k = 0, game_over = 0,controller = 0;
size1 = row;
size2 = column;
if(file_board_control == true){
for(i=0; i < size1; i++){
for(j=0; j < size2; j++){
temp_array[k] = board[i][j];
k++;
}
}
for(i=0; i < (size1 * size2) - 2; i++){
if(temp_array[i] < temp_array[i+1])
game_over++;
}
if(game_over == ((size1 * size2) - 2) && temp_array[(size1 * size2) - 1] == -1)
return true;
else
return false ;
}
else{
k=0;
game_over = 0;
for(i=0; i < size1; i++){
for(j=0; j < size2; j++){
if(board[i][j] != 0){
temp_array[k] = board[i][j];
k++;
controller++;
}
}
}
for(i=0; i < controller-2; i++){
if(temp_array[i] < temp_array[i+1]){
game_over++;
}
}
if(game_over == (controller - 2) && temp_array[controller - 1] == -1)
return true;
else
return false ;
}
}
bool NPuzzle:: Board :: move(const char move, int controller)
{
///File board control false ise dosyadan okudum.
int i, j, row_num;
decltype(i) column_num;
row_num = row;
column_num = column;
if(move == 'R'){ //The empty cell is moved in the right direction.
for(i=0; i < row_num; i++){
for(j=0; j < column_num && controller == 1; j++){
if(board[i][j] == -1){
if(j != (column_num - 1) && board[i][j+1] != 0){ //If the right side does not exceed the board limit, movement is made.
int right_temp_number;
right_temp_number = board[i][j+1];
board[i][j+1] = -1;
board[i][j] = right_temp_number;
controller = 0;
return true;
}
}
}
}
}
else if(move == 'L'){ //The empty cell is moved in the left direction.
for(i=0; i < row_num; i++){
for(j=0; j < column_num; j++){
if(board[i][j] == -1){
if(j != 0 && board[i][j-1] != 0){ //If the left side does not exceed the board limit, movement is made.
int left_temp_number;
left_temp_number = board[i][j-1];
board[i][j-1] = -1;
board[i][j] = left_temp_number;
return true;
}
}
}
}
}
else if(move == 'U'){ //The empty cell is moved in the up.
for(i=0; i < row_num; i++){
for(j=0; j < column_num; j++){
if(board[i][j] == -1){
if(i != 0 && board[i-1][j] != 0){ //If the up side does not exceed the board limit, movement is made.
int up_temp_number;
up_temp_number = board[i-1][j];
board[i-1][j] = -1;
board[i][j] = up_temp_number;
return true;
}
}
}
}
}
else if(move == 'D'){ //The empty cell is moved in the down.
for(i=0; i < row_num && controller == 1; i++){
for(j=0; j < column_num && controller == 1; j++){
if(board[i][j] == -1){
if(i != (row_num - 1) && board[i+1][j] != 0){ //If the down side does not exceed the board limit, movement is made.
int down_temp_number;
down_temp_number = board[i+1][j];
board[i+1][j] = -1;
board[i][j] = down_temp_number;
controller = 0;
return true;
}
}
}
}
}
return false;
}
void NPuzzle :: Board :: print()
{
int i;
decltype(i) j;
if(file_board_control){
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(board[i][j] == -1)
cout << " \t";
else
cout << board[i][j] << "\t" ;
}
cout << endl ;
}
cout << endl;
}
else{
for (i=0; i < row; ++i) {
for (j=0; j < column; ++j) {
if(board[i][j] != -1){
int digit = calculate_digit_number(board[i][j]);
if(digit < 2)
cout << "0" << board[i][j] << " ";
else
cout << board[i][j] << " ";
}
else
cout << "bb" << " ";
}
cout << endl;
}
cout << endl;
}
}
bool NPuzzle :: Board :: setSize(int rowValue, int columnValue)
{
bool returnValue = false;
if(rowValue >= 3 && rowValue <= 9) //Problem_size should be range of 3 and 9.
{
row = rowValue;
column = columnValue;
initializeBoard();
returnValue = true;
}
return returnValue;
}
void NPuzzle :: Board :: initializeBoard()
{
int distance_control_array[9][9];
create_distance_controller_array(distance_control_array);
int i, j, k, controller_array[82];
decltype(i) random;
auto l=0,flag = 1,controller = 0;
for(i=0; i < row; i++){
for(j=0; j < column; j++){
flag = 1;
random = 1 + rand() % ((row * column));
for(k=0; k < controller; k++){
if(random == controller_array[k])
flag = 0;
}
if(flag == 1){
controller_array[l] = random;
board[i][j] = random;
controller++;
l++;
}
else if(flag == 0){
if (j == 0){
i--;
j = (column-1);
}
else
j--;
}
}
}
for(i=0; i < row; i++){
for(j=0; j < column; j++){
if(board[i][j] == (row * column))
board[i][j] = -1;
}
}
}
int main(const int argc, const char* argv[])
{
NPuzzle myPuzzle;
bool is_finish = true, solvable = true, solvable_controller = true, finish_controller = true;
int size;
char move_ch;
srand(time(NULL));
if(argv[1] == NULL){
do{
cout << "Please enter the problem size" << endl;
cin >> size;
}while(!myPuzzle.setsize(size, size));
while(solvable){ //A new board is created unless the board is resolvable and finished.
myPuzzle.setsize(size, size);
solvable_controller = myPuzzle.isSolvable();
finish_controller = myPuzzle.issolved();
if(solvable_controller == 1 && finish_controller == 0)
solvable = 0;
}
cout << "Your initial random board is" << endl;
myPuzzle.print();
myPuzzle.playGame();
}
else{
myPuzzle.readFromFile(argv[1]);
myPuzzle.playGame();
}
return 0;
}
|
[
"noreply@github.com"
] |
medineaslan.noreply@github.com
|
4869846f55b13d0929085a30c6365e74d51e5782
|
002b4d417e72855adb94c91955ba5c2b2f3fecc0
|
/00654_1_MBT.cpp
|
aff94ae02d6be3f4380897eb7be2f8943cc7b927
|
[] |
no_license
|
Zerorlis/leetcode
|
9ffd3f439b5b43845439e6af5f35dc03fe0eb643
|
2de1680b2504f2c17d8c8aa0eac15b9177a1406e
|
refs/heads/master
| 2021-08-06T06:13:05.426331
| 2020-05-19T12:59:28
| 2020-05-19T12:59:28
| 177,396,417
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 687
|
cpp
|
#include <algorithm>
#include <vector>
#include "tree.h"
using namespace std;
class Solution {
public:
TreeNode* constructMaximumBinaryTree(vector<int>& nums) {
return constructSonBinaryTree(nums.begin(), nums.end());
}
TreeNode* constructSonBinaryTree(const vector<int>::iterator& left,
const vector<int>::iterator& right) {
if (left == right) return NULL;
// find root
auto root_p = max_element(left, right);
auto root = new TreeNode(*root_p);
root->left = constructSonBinaryTree(left, root_p);
root->right = constructSonBinaryTree(++root_p, right);
return root;
}
};
|
[
"zerorlis@163.com"
] |
zerorlis@163.com
|
87d6f38ff080d1671b6a4a3313fe18abfb77b005
|
07bd511e7d1091b63f78bf832db147d12eb2df05
|
/PAT/PAT Advanced/c++/1015.cpp
|
8e0385fd8f21f55ea4accddb6b523d1395fee70a
|
[
"Apache-2.0"
] |
permissive
|
Accelerator404/Algorithm-Practice
|
18a41c4ddf2db36dbe74878047ebc756e78a79bf
|
e40a499c23a56d363c743c76ac967d9c4247a4be
|
refs/heads/master
| 2021-06-02T15:03:46.765834
| 2020-11-10T14:41:37
| 2020-11-10T14:41:37
| 114,846,820
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,572
|
cpp
|
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
//PAT Advanced 1015 Reversible Primes
long int to_decimal(long int num,int radix){
string temp = to_string(num);
unsigned long int peak = temp.length();
long int res = 0;
unsigned long int exp = peak - 1;
for (int i = 0; i < peak; ++i) {
res += (temp[i] - '0') * pow(radix,exp);
exp--;
}
return res;
}
long int to_otherRadix(long int num,int radix){
if(radix == 10)
return num;
string temp;
long int pLef;
while (num > 0){
pLef = num % radix;
num = num / radix;
temp += to_string(pLef);
}
reverse(temp.begin(),temp.end());
return strtol(temp.c_str(), nullptr,10);
}
bool isPrime(long int num){
if(num <= 1)
return false;
if(num > 2 && num%2 == 0)
return false;
long int range = sqrt(num + 1.0);
for (int i = 3; i <= range; ++i) {
if(num % i == 0)
return false;
}
return true;
}
int main() {
long int N;
while (cin >> N){
if(N < 0)
break;
int D;
cin >> D;
if(!isPrime(N)) {
cout << "No" << endl;
continue;
}
string temp = to_string(to_otherRadix(N,D));
reverse(temp.begin(),temp.end());
long int revN = to_decimal(strtol(temp.c_str(), nullptr,10),D);
if(isPrime(revN))
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
|
[
"noreply@github.com"
] |
Accelerator404.noreply@github.com
|
bea586836e8548a42b213f87184de73316bf03e8
|
0c2fb0e9ad4ae4094633a1fc56d1aface65a5f76
|
/src/fgmm/update.cpp
|
6cf39e11e3276fe1eca13f9e7b2b5f8f2d9664be
|
[] |
no_license
|
zhxinhust/motion_planner
|
6203958eb8b8196735edddc4f3f18f34523a7971
|
6e8006b1586c9d6457f18c032c6b9f6a8d683f7b
|
refs/heads/master
| 2021-05-14T18:42:22.789608
| 2018-01-22T01:35:21
| 2018-01-22T01:35:21
| 116,083,320
| 8
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,001
|
cpp
|
/*********************************************************************
FGMM: a fast(er) and light Gaussian mixture model implementation.
Copyright (C) 2010 Florent D'Halluin
Contact: florent.dhalluin@epfl.ch
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License,
version 3 as published by the Free Software Foundation.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*********************************************************************/
#include "fgmm.h"
#include "gaussian.h"
void fgmm_update(struct gmm * gmm,const float * data_point)
{
int state_i=0;
float * pxi;
float nf = 0;
float eta = .05;
float weighted_lr;
pxi = (float *) malloc( sizeof(float) * gmm->nstates);
for(;state_i<gmm->nstates;state_i++)
{
pxi[state_i] = gaussian_pdf(&gmm->gauss[state_i], data_point);
nf += pxi[state_i];
}
for(state_i=0;state_i<gmm->nstates;state_i++)
{
weighted_lr = eta * pxi[state_i]/nf;
gaussian_update(&gmm->gauss[state_i],data_point,weighted_lr);
invert_covar(&gmm->gauss[state_i]);
}
free(pxi);
}
/* winner take all approach */
void fgmm_update_wta(struct gmm * gmm,const float * data_point)
{
int state_i=0;
int the_state = 0;
float eta = .05;
float max_p = 0.;
float w = 0.;
for(;state_i<gmm->nstates;state_i++)
{
w = gaussian_pdf(&gmm->gauss[state_i], data_point);
if(w>max_p)
{
max_p = w;
the_state = state_i;
}
}
gaussian_update(&gmm->gauss[the_state],data_point,eta);
invert_covar(&gmm->gauss[the_state]);
}
|
[
"zhaoxin@hust.edu.cn"
] |
zhaoxin@hust.edu.cn
|
4e37203fb563065cf738609aef3c5d8996f5376a
|
001837bdcbfc9f902d4b82eec9cf208f37afe088
|
/bomberman.cpp
|
c3508842a2e734467d0a057894741fcfceddb6e4
|
[] |
no_license
|
inguelee/bomber
|
a3370790ad26abcc7fe33c5729b1053339266dfd
|
ca7335e851626806b91a3ca6fbb4c53a0a5dd5ae
|
refs/heads/master
| 2020-09-10T04:07:00.352066
| 2019-12-06T07:32:16
| 2019-12-06T07:32:16
| 221,644,136
| 0
| 3
| null | 2019-12-05T16:00:40
| 2019-11-14T08:08:31
|
C++
|
UHC
|
C++
| false
| false
| 8,532
|
cpp
|
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#define UP 0
#define DOWN 1
#define LEFT 2
#define RIGHT 3
#define SUBMIT 4
enum {
black,
blue,
green,
cyan,
red,
purple,
brown,
lightgray,
darkgray,
lightblue,
lightgreen,
lightcyan,
lightred,
lightpurple,
yellow,
white
};
//char tempMap[19][40];
char map[19][40] = {
{"11111111111111111111111111111111111111"},
{"1m0000000000000000110000000000000m00k1"},
{"101101011k1101011011011010111110101101"},
{"10000100010001000011000010001000100001"},
{"11110111010111011111111011101011101111"},
{"1m000100000001010000k0101m000000101000"},
{"111101011l1101011101111010110110101111"},
{"100000010001m0000000000000100010000001"},
{"111101010O010101111011101010k010101111"},
{"0001010111110101p000001010111110101000"},
{"11110100000001011111111010000000101111"},
{"10000101111101000011000010111110100001"},
{"1011m00001m000011011011m00001m00001101"},
{"10010111010111010011001011101011101001"},
{"11010001k00100010111101000100010001011"},
{"1000010001000100001100001000100k100001"},
{"10101111000111101011010111100011110101"},
{"10000000010000000011000000001000000001"},
{"11111111111111111111111111111111111111"},
};// 0 : 통로, 1 : 벽, k : 열쇠(아이템), p : 플레이어, O : 탈출구 ㅣ : 잠긴 문 r :우로 이동 몬스터
int keyControl(void);
void titleDraw(void);
int menuDraw(void);
void infoDraw(void);
void init();
void gotoxy(int, int);
void setColor(int, int);
void drawMap(int* pX, int* pY, char(*tMap)[40]);
int move(char(*tMap)[40], int* pX, int* pY, int _x, int _y, int* pKey);
void gLoop(void);
void drawUI(int pX, int pY, int pKey);
void endDraw();
//int pKey = 0;
//int playing = 1;
int main(void)
{
int menuCode;
int playing = 1;
init();
while (1)
{
setColor(white, black);
titleDraw();
menuCode = menuDraw();
if (menuCode == 0)
{
gLoop();
}
else if (menuCode == 1)
{
infoDraw();
}
else if (menuCode == 2)
{
break;
}
menuCode = 5;
system("cls");
}
gotoxy(20, 18);
printf("<게임이 종료되었습니다>");
_getch();
return 0;
}
void init()
{
system("mode con cols=63 lines=20 | title Bomber Man");
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO ConsoleCursor;
ConsoleCursor.bVisible = 0;
ConsoleCursor.dwSize = 1;
SetConsoleCursorInfo(consoleHandle, &ConsoleCursor);
}
void titleDraw(void)
{
printf("\n");
printf(" * \n");
printf(" @@@@ * @ @ @@@@ @@@@ @@@@ \n");
printf(" @ @ @@@@ @@ @@ @ @ @ @ @ \n");
printf(" @@@@ @ @ @ @ @ @ @@@@ @@@@ @@@@ \n");
printf(" @ @ @ @ @ @ @ @ @ @ @ @ \n");
printf(" @@@@ @@@@ @ @ @@@@ @@@@ @ @ \n");
printf("\n");
printf(" @ @ @ @ @ \n");
printf(" @@ @@ @ @ @@ @ \n");
printf(" @ @ @ @ @@@@@ @ @ @ \n");
printf(" @ @ @ @ @ @ @@ \n");
}
int menuDraw(void)
{
int x = 27;
int y = 14;
gotoxy(x - 2, y);
printf("> 게임시작");
gotoxy(x, y + 1);
printf("게임설명");
gotoxy(x, y + 2);
printf(" 종료 ");
while (1) {
int n = keyControl();
switch (n) {
case UP: {
if (y > 14) {
gotoxy(x - 2, y);
printf(" ");
gotoxy(x - 2, --y);
printf(">");
}
break;
}
case DOWN: {
if (y < 16) {
gotoxy(x - 2, y);
printf(" ");
gotoxy(x - 2, ++y);
printf(">");
}
break;
}
case SUBMIT: {
return y - 14;
}
}
}
}
void gotoxy(int x, int y)
{
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(consoleHandle, pos);
}
int keyControl()
{
char temp = _getch();
if (temp == 'w' || temp == 'W')
{
return UP;
}
else if (temp == 'a' || temp == 'A')
{
return LEFT;
}
else if (temp == 's' || temp == 'S')
{
return DOWN;
}
else if (temp == 'd' || temp == 'D')
{
return RIGHT;
}
else if (temp == ' ')
{
return SUBMIT;
}
}
void gLoop(void)
{
int mKey;
int pX, pY;
int pKey = 0;
int playing = 1;
char tempMap[19][40];
memcpy(tempMap, map, sizeof(tempMap));
drawMap(&pX, &pY, tempMap);
while (playing)
{
drawUI(pX, pY, pKey);
mKey = keyControl();
switch (mKey)
{
case UP:
playing = move(tempMap, &pX, &pY, 0, -1, &pKey);
break;
case DOWN:
playing = move(tempMap, &pX, &pY, 0, 1, &pKey);
break;
case RIGHT:
playing = move(tempMap, &pX, &pY, 1, 0, &pKey);
break;
case LEFT:
playing = move(tempMap, &pX, &pY, -1, 0, &pKey);
break;
case SUBMIT:
playing = 0;
}
}
//playing = 1;
}
void drawMap(int* pX, int* pY, char(*tMap)[40])
{
char temp;
system("cls");
int h, w;
for (h = 0; h < 19; h++)
{
for (w = 0; w < 40; w++)
{
temp = tMap[h][w];
if (temp == '0')
{
setColor(black, black);
printf(" ");
}
else if (temp == '1')
{
setColor(white, white);
printf("#");
}
else if (temp == 'p')
{
*pX = w;
*pY = h;
setColor(lightcyan, black);
printf("@");
}
else if (temp == 'O')
{
setColor(lightgreen, black);
printf("O");
}
else if (temp == 'k')
{
setColor(yellow, black);
printf("*");
}
else if (temp == 'l')
{
setColor(white, white);
printf("#");
}
else if (temp == 'm')
{
setColor(lightred, black);
printf("M");
}
}
printf("\n");
}
setColor(white, black);
}
void setColor(int forground, int background)
{
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); // 콘솔 핸들가져오기
int code = forground + background * 16;
SetConsoleTextAttribute(consoleHandle, code);
}
void drawUI(int pX, int pY, int pKey)
{
setColor(white, black);
gotoxy(40, 4);
printf("플레이어 위치:(%02d,%02d)", pX, pY);
setColor(yellow, black);
gotoxy(45, 8);
printf("열쇠: %d/6개", pKey);
setColor(white, black);
}
int move(char(*tMap)[40], int* pX, int* pY, int _x, int _y, int* pKey)
{
int playflag = 1;
char mapObject = tMap[*pY + _y][*pX + _x];
setColor(white, black);
if (mapObject == '0')
{
gotoxy(*pX, *pY);
printf(" ");
setColor(lightcyan, black);
gotoxy(*pX + _x, *pY + _y);
printf("@");
*pX += _x;
*pY += _y;
}
if (mapObject == 'm')
{
playflag = 0;
endDraw();
Sleep(5000);
}
else if (mapObject == 'k')
{
*pKey += 1;
tMap[*pY + _y][*pX + _x] = '0';
gotoxy(*pX + _x, *pY + _y);
printf(" ");
if (*pKey == 6)
{
tMap[6][9] = '0';
gotoxy(9, 6);
printf(" ");
setColor(lightgreen, black);
gotoxy(41, 10);
printf("탈출구가 열렸습니다");
}
}
else if (mapObject == 'O')
{
playflag = 0;
setColor(yellow, black);
gotoxy(39, 16);
printf("! 탈출을 축하드립니다 !");
Sleep(5000);
}
return playflag;
}
void infoDraw(void)
{
system("cls");
printf("\n\n");
printf(" [ 게임설명 ]\n\n");
printf(" 몬스터들을 피하거나 폭탄으로 물리쳐\n");
printf(" 열쇠를 얻어 탈출해라\n\n");
printf(" [ 조작법 ]\n\n");
printf(" 이동: W, A, S, D\n\n");
printf(" 폭탄설치: I, J, K, L\n\n");
printf(" 선택: 스페이스바\n\n\n");
printf(" 개발자: 6조(강재윤, 이유진, 이인구)\n\n");
printf(" 스페이스바를 누르면 메인화면으로 이동합니다.");
while (1) {
if (keyControl() == SUBMIT) {
break;
}
}
}
void endDraw()
{
system("cls");
printf("\n\n\n\n\n");
printf(" * * *\n");
printf(" * * *\n");
printf(" ### ### ###\n");
printf(" ##### ##### #####\n");
printf(" ### ### ###\n\n\n");
printf(" - 탈출 실패 -\n\n\n");
printf(" ! 다시 한 번 도전하세요 !");
}
|
[
"noreply@github.com"
] |
inguelee.noreply@github.com
|
f2fe25f8d989a24c525f701b376c9555d40bc44f
|
cfa7b66d7e7edf47f18367e50389909b2266e0e6
|
/Step_02/coup.cpp
|
9626a5a09d4908114a3322478764a7819e39dbcf
|
[] |
no_license
|
PITON369/Stepik_CPP_CSC
|
f98c48524e3912baf2678223a6bfac6647c6b3fa
|
59f9e8df9d2c50b245076613f675f42293bddcb6
|
refs/heads/master
| 2023-04-07T22:31:27.806785
| 2020-04-24T13:45:49
| 2020-04-24T13:45:49
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,610
|
cpp
|
//https://stepik.org/lesson/538/step/10?unit=861
/*Вам требуется написать программу, которая "переворачивает" последовательность положительных целых чисел. На вход подается последовательность разделенных пробелами положительных целых чисел. Последовательность заканчивается нулем. Требуется вывести эту последовательность в обратном порядке.
На выводе числа нужно так же разделить пробелами. Завершающий ноль — это просто индикатор конца последовательности, он не является ее частью, т.е. выводить его не нужно.
Требования к реализации: в данном задании запрещено использовать циклы, а также дополнительную память: массивы, строки или контейнеры (даже, если вы с ними уже знакомы). Вам разрешено заводить вспомогательные функции, если они вам нужны.
Подсказка: используйте рекурсию.
Sample Input:
15 26 1 42 0
Sample Output:
42 1 26 15
*/
#include <iostream>
using namespace std;
int main()
{
int n;
if (cin >> n && n)
{
main();
cout << n << " ";
}
return 0;
}
|
[
"noreply@github.com"
] |
PITON369.noreply@github.com
|
0a6f70d0795d78cb68bb6ce0fb4abe019cc63cdb
|
9d6b68e51a9f91331a12f08102d21c2acfbcfb8e
|
/lib/ArduinoJson-6.x/src/ArduinoJson/Numbers/FloatTraits.hpp
|
6f4df596a698df634d2b4fbcfe6c4c04b849ce21
|
[
"MIT"
] |
permissive
|
zekageri/MoodLamp
|
44e3328422dcaa68392095fe7d1b314c38d0413a
|
122cf89f86bb1ec71379bb19a0f1918017701a0b
|
refs/heads/main
| 2023-01-30T15:41:10.519534
| 2020-12-13T20:30:54
| 2020-12-13T20:30:54
| 309,348,870
| 1
| 1
|
MIT
| 2020-12-13T20:17:29
| 2020-11-02T11:25:11
|
C++
|
UTF-8
|
C++
| false
| false
| 4,725
|
hpp
|
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2020
// MIT License
#pragma once
#include <stddef.h> // for size_t
#include <stdint.h>
#include <ArduinoJson/Configuration.hpp>
#include <ArduinoJson/Polyfills/alias_cast.hpp>
#include <ArduinoJson/Polyfills/math.hpp>
namespace ARDUINOJSON_NAMESPACE {
template <typename T, size_t = sizeof(T)>
struct FloatTraits {};
template <typename T>
struct FloatTraits<T, 8 /*64bits*/> {
typedef uint64_t mantissa_type;
static const short mantissa_bits = 52;
static const mantissa_type mantissa_max =
(mantissa_type(1) << mantissa_bits) - 1;
typedef int16_t exponent_type;
static const exponent_type exponent_max = 308;
template <typename TExponent>
static T make_float(T m, TExponent e) {
if (e > 0) {
for (uint8_t index = 0; e != 0; index++) {
if (e & 1)
m *= positiveBinaryPowerOfTen(index);
e >>= 1;
}
} else {
e = TExponent(-e);
for (uint8_t index = 0; e != 0; index++) {
if (e & 1)
m *= negativeBinaryPowerOfTen(index);
e >>= 1;
}
}
return m;
}
static T positiveBinaryPowerOfTen(int index) {
static T factors[] = {
1e1,
1e2,
1e4,
1e8,
1e16,
forge(0x4693B8B5, 0xB5056E17), // 1e32
forge(0x4D384F03, 0xE93FF9F5), // 1e64
forge(0x5A827748, 0xF9301D32), // 1e128
forge(0x75154FDD, 0x7F73BF3C) // 1e256
};
return factors[index];
}
static T negativeBinaryPowerOfTen(int index) {
static T factors[] = {
forge(0x3FB99999, 0x9999999A), // 1e-1
forge(0x3F847AE1, 0x47AE147B), // 1e-2
forge(0x3F1A36E2, 0xEB1C432D), // 1e-4
forge(0x3E45798E, 0xE2308C3A), // 1e-8
forge(0x3C9CD2B2, 0x97D889BC), // 1e-16
forge(0x3949F623, 0xD5A8A733), // 1e-32
forge(0x32A50FFD, 0x44F4A73D), // 1e-64
forge(0x255BBA08, 0xCF8C979D), // 1e-128
forge(0x0AC80628, 0x64AC6F43) // 1e-256
};
return factors[index];
}
static T negativeBinaryPowerOfTenPlusOne(int index) {
static T factors[] = {
1e0,
forge(0x3FB99999, 0x9999999A), // 1e-1
forge(0x3F50624D, 0xD2F1A9FC), // 1e-3
forge(0x3E7AD7F2, 0x9ABCAF48), // 1e-7
forge(0x3CD203AF, 0x9EE75616), // 1e-15
forge(0x398039D6, 0x65896880), // 1e-31
forge(0x32DA53FC, 0x9631D10D), // 1e-63
forge(0x25915445, 0x81B7DEC2), // 1e-127
forge(0x0AFE07B2, 0x7DD78B14) // 1e-255
};
return factors[index];
}
static T nan() {
return forge(0x7ff80000, 0x00000000);
}
static T inf() {
return forge(0x7ff00000, 0x00000000);
}
static T highest() {
return forge(0x7FEFFFFF, 0xFFFFFFFF);
}
static T lowest() {
return forge(0xFFEFFFFF, 0xFFFFFFFF);
}
// constructs a double floating point values from its binary representation
// we use this function to workaround platforms with single precision literals
// (for example, when -fsingle-precision-constant is passed to GCC)
static T forge(uint32_t msb, uint32_t lsb) {
return alias_cast<T>((uint64_t(msb) << 32) | lsb);
}
};
template <typename T>
struct FloatTraits<T, 4 /*32bits*/> {
typedef uint32_t mantissa_type;
static const short mantissa_bits = 23;
static const mantissa_type mantissa_max =
(mantissa_type(1) << mantissa_bits) - 1;
typedef int8_t exponent_type;
static const exponent_type exponent_max = 38;
template <typename TExponent>
static T make_float(T m, TExponent e) {
if (e > 0) {
for (uint8_t index = 0; e != 0; index++) {
if (e & 1)
m *= positiveBinaryPowerOfTen(index);
e >>= 1;
}
} else {
e = -e;
for (uint8_t index = 0; e != 0; index++) {
if (e & 1)
m *= negativeBinaryPowerOfTen(index);
e >>= 1;
}
}
return m;
}
static T positiveBinaryPowerOfTen(int index) {
static T factors[] = {1e1f, 1e2f, 1e4f, 1e8f, 1e16f, 1e32f};
return factors[index];
}
static T negativeBinaryPowerOfTen(int index) {
static T factors[] = {1e-1f, 1e-2f, 1e-4f, 1e-8f, 1e-16f, 1e-32f};
return factors[index];
}
static T negativeBinaryPowerOfTenPlusOne(int index) {
static T factors[] = {1e0f, 1e-1f, 1e-3f, 1e-7f, 1e-15f, 1e-31f};
return factors[index];
}
static T forge(uint32_t bits) {
return alias_cast<T>(bits);
}
static T nan() {
return forge(0x7fc00000);
}
static T inf() {
return forge(0x7f800000);
}
static T highest() {
return forge(0x7f7fffff);
}
static T lowest() {
return forge(0xFf7fffff);
}
};
} // namespace ARDUINOJSON_NAMESPACE
|
[
"drsedate@gmail.com"
] |
drsedate@gmail.com
|
54f1ef2b37b264555d964a42601ffec5009971fb
|
26d039bffb2ba5b878184e75f7a1a55accba8229
|
/Logger.hpp
|
2c30067d2c2e96b4cfdf26851350be6b6edd605f
|
[] |
no_license
|
taylorconor/bittrader
|
56ff46997288feddb3e80fcd23bf4d8501002bf7
|
fb1d2a5ffbaec47d80e57f9985e5aa962e534c93
|
refs/heads/master
| 2021-01-15T12:19:31.800683
| 2016-03-11T10:14:03
| 2016-03-11T10:14:03
| 47,073,634
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 521
|
hpp
|
//
// Logger.hpp
// bittrader
//
// Created by Conor Taylor on 14/11/2015.
// Copyright © 2015 Conor Taylor. All rights reserved.
//
#ifndef Logger_hpp
#define Logger_hpp
#include <iostream>
#include <sstream>
#include "time.h"
using namespace std;
class Logger {
private:
static Logger *_instance;
Logger();
string timestr(int ts);
public:
static Logger *instance();
void log(string s);
void log_ts(string s);
void log_tick(int ts, double ask, double moving_average);
};
#endif /* Logger_hpp */
|
[
"taylorconor@me.com"
] |
taylorconor@me.com
|
75fc128126b2727ade19940fc63af8589163bf40
|
f8de51e1f3bbb061e905320131c5ae16889896cc
|
/chessEngine/src/OldMove.cpp
|
92d7e1dba732da8edc4789c5834e448027c9c8d5
|
[] |
no_license
|
guyKN/Chess2
|
dad62064428cdcd63dae9f076bda8921f14967a6
|
327725c7fe770215dc72ce8de1e4084179643bc4
|
refs/heads/main
| 2023-08-22T12:57:11.022884
| 2021-09-19T17:53:36
| 2021-09-19T17:53:36
| 326,276,822
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,051
|
cpp
|
//
// Created by guykn on 12/9/2020.
//
#include "OldMove.h"
#include <iostream>
#include <string>
#include <Bitboards.h>
namespace Chess {
OldMove OldMove::invalidMove(SQ_INVALID, SQ_INVALID, PIECE_INVALID, PIECE_INVALID);
std::ostream& OldMove::longNotation(std::ostream &outputStream) const {
if (!isOk()) {
outputStream << "ILLEGAL";
} else {
if (castlingType != CASTLE_NONE) {
outputStream << (isKingSide(castlingType) ? "o-o " : "o-o-o");
} else if (pieceTypeOf(srcPiece) != PIECE_TYPE_PAWN) {
outputStream << toChar(pieceTypeOf(srcPiece))
<< toString(srcSquare)
<< ((dstPiece == PIECE_NONE) ? '-' : 'x')
<< toString(dstSquare);
} else {
outputStream << Chess::toString(srcSquare)
<< ((dstPiece == PIECE_NONE) ? '-' : 'x')
<< toString(dstSquare)
<< ' ';
}
}
return outputStream;
}
bool OldMove::isOk() const {
return square_ok(srcSquare) &&
square_ok(dstSquare) &&
srcSquare != dstSquare &&
srcPiece != PIECE_NONE && pieceOk(srcPiece) &&
pieceOk(dstPiece) &&
(dstPiece == PIECE_NONE || ~playerOf(dstPiece) == playerOf(srcPiece)) &&
(pieceOk(promotionPiece)) &&
playerOf(promotionPiece) == playerOf(srcPiece) &&
(promotionPiece == srcPiece || isValidPromotion(pieceTypeOf(promotionPiece)));
}
bool OldMove::operator==(const OldMove &other) const {
return this->srcPiece == other.srcPiece &&
this->dstPiece == other.dstPiece &&
this->srcSquare == other.srcSquare &&
this->dstSquare == other.dstSquare &&
this->promotionPiece == other.promotionPiece &&
this->castlingType == other.castlingType;
}
bool OldMove::matchesMoveInput(MoveInputData moveInputData) const {
return moveInputData.src == srcSquare &&
moveInputData.dst == dstSquare;
}
OldMove::OldMove(const CastlingData &castlingData) :
srcSquare(castlingData.kingSrc),
dstSquare(castlingData.kingDst),
srcPiece(makePiece(PIECE_TYPE_KING, playerOf(castlingData.castlingType))),
dstPiece(PIECE_NONE),
promotionPiece(srcPiece),
pawnForward2Square(SQ_INVALID),
castlingType(castlingData.castlingType),
isEnPassant(false){}
const OldMove OldMove::castleMoves[NUM_CASTLE_TYPES] = {
OldMove(CastlingData::fromCastlingType(CASTLE_WHITE_KING_SIDE)),
OldMove(CastlingData::fromCastlingType(CASTLE_WHITE_QUEEN_SIDE)),
OldMove(CastlingData::fromCastlingType(CASTLE_BLACK_KING_SIDE)),
OldMove(CastlingData::fromCastlingType(CASTLE_BLACK_QUEEN_SIDE))
};
}
|
[
"guyknaan@gmail.com"
] |
guyknaan@gmail.com
|
9b4ff69f43e74dc301f2ae026f3616da805e3dca
|
25c7df49d390698b49c13c40533bfd870f547d0b
|
/game/.svn/text-base/player_workshop.h.svn-base
|
b640f4d30d0755a4f0d564601ea91ddef25b5222
|
[] |
no_license
|
xubingyue/galaxy
|
603701759b38446ffd9c1c069beb66197c0bca51
|
3ec14b2d531b2a15e0c52aac748b44a5c74033b0
|
refs/heads/master
| 2020-05-22T23:27:20.857629
| 2015-07-11T01:53:49
| 2015-07-11T01:53:49
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 2,493
|
#pragma once
#include "block.h"
#include <vector>
#include <boost/unordered_map.hpp>
using namespace std;
namespace gg
{
const static string player_workshop_db_name = "gl.player_workshop";
const static string player_workshop_counter_field = "ctr";/*生产计数器*/
const static string player_workshop_qianzhi_counter_field = "qctr";//强制生产次数 (计数器)
const static string player_workshop_last_timestamp = "lt";/*最后一次生产时间戳*/
const static string player_workshop_level_field = "lv";
const static string player_workshop_exp_field = "exp";
const static string player_workshop_total_free_count_field = "fc";
const static string player_workshop_last_auto_sale_timestamp_field = "last";//最后一次自动卖出时间
const static string player_goods_data_field = "d";
const static string player_goods_id_filed = "id";
const static string player_goods_count_field = "ct";//单个物品数量
//--- 只作为 协议返回字段
const static string player_qianzhi_cost_gold = "qzcg";//当前强制生产所需要金币
struct playerGoods
{
playerGoods(){
id = 0;
count = 0;
}
playerGoods(const int goods_type){
memset(this, 0x0, sizeof(playerGoods));
this->id = goods_type;
count = 0;
}
bool operator == (const playerGoods& goods){
return this->id == goods.id && this->count == goods.count;
}
int id;
int count;
};
class TTManager;
class playerWorkShop : public Block
{
friend class TTManager;
public:
playerWorkShop(playerData& own);
virtual bool get();
virtual bool save();
virtual void update();
virtual void autoUpdate();
int getPresentationCount();//获取免费生产次数
void addPresentation(int count);//添加免费生产次数, 函数已 insert save set 与 addPackage
int getGoodsCount();
int getQianzhiCounter();//获取强制生产计数器
void updateYield(bool is_qianzhi);
int getTotalFreeCounter(){ return total_free_counter; }
void addTotalFreeCounter();
int exp;
int level;
void addGoods(const int goods_type);//添加物品
typedef boost::unordered_map< int, playerGoods > goodsMap;
goodsMap goods_map;
void package(Json::Value& pack);
unsigned last_auto_sale_timestamp; //最后一次自动卖出物品时间
unsigned last_timestamp;//最后一次生产时间
private:
int counter;
int qianzhi_counter;
int total_free_counter;
};
}
|
[
"kelvinlyan@localhost.localdomain"
] |
kelvinlyan@localhost.localdomain
|
|
a47f95a6251e82bc0ed72c12dc0e6b083761a4d0
|
6bc873c4067f82f34c5bad570aac02d662aeaf4c
|
/pokerGameWithComputer/computerPlayerBehavior.cpp
|
b70e0f5539191c108afcf7d21892d500f488a5f5
|
[] |
no_license
|
chouguting/PokerGameWithComputer
|
5c0a5d6c40172edbf47c46cd7ea85b7d5ec2fa42
|
ce1293e400999aa69dfcac7fb26fd41c0ad16408
|
refs/heads/master
| 2021-06-12T16:47:19.098318
| 2020-04-15T15:15:11
| 2020-04-15T15:15:11
| 254,360,385
| 0
| 0
| null | null | null | null |
BIG5
|
C++
| false
| false
| 9,747
|
cpp
|
#include <cstdio>
#include "funclib.h"
/*
main idea:先把重要的牌填到handCardTemp中,不重要的先空著(例如四條中的那四張一樣的是重要的,剩下那張不重要)
等所有重要的都牌完後再把剩下牌填入TEMP,最後再複製回去手牌
*/
void sortByComPlayer(Card* handCard, int size)
{
int hasFilled[13] = {0}; //儲存Temp牌堆中該位置有沒有填入值
Card handCardTemp[13]; //暫存用手牌(把確定的牌先填進去)
int sortIndex = size - 1; //這個index會存下一個應該填值的位置
int currentRound = 0; //第幾輪
int i, j;
int sortedIdIndex = 120; //已經整理過的牌ID會暫時被改成100多,這樣sort時他們就會在後面
int currentSize = size; //目前未整理區域的大小
//三個牌敦
for (currentRound = 0; currentRound < 3; currentRound++)
{
if (currentRound > 0)
{
sort(handCard, size); //先整理牌(第一ROUND不用)
}
//printf("\n\n");
int hasStrightFlush = 0; //有沒有同花順
int hasStright = 0; //有沒有順
int hasFlush = 0; //有沒有同花
int straightFlushCardIndex[5]; //同花順位置INDEX
int straightCardIndex[5]; //順位置 INDEX
int flushCardIndex[5]; //同花位置 INDEX
int fourOfaKindIndex = 0; //四條的位置
int hasFourOfaKind = 0; //有沒有四條
int threeOfaKindIndex = 0; //三條的位置
int hasThreeOfaKind = 0; //有沒有三條
int hasPair = 0; //有沒有對子
int pairIndex = 0; //對子的位置
int hasSecondPair = 0; //有沒有第二個對子
int secondPairIndex = 0; //第二個對子的位置
//這邊都是5張牌才會出現的牌型
if (currentRound < 2)
{
//同時抓 同花順,順,同花 的位置(如果有)
for (i = currentSize - 1; i >= 4; i--)
{
/*利用indexCurrent=4填入找到的同花順,順or同花的位置
每找到一張符合的牌indexCurrent就減一
如果indexCurrent<0的話,代表以經找到五張了(代表成立)*/
int straightFlushIndexCurrent = 4;
int straightIndexCurrent = 4;
int flushIndexCurrent = 4;
//同花順順位最大,找到就不用再找順or同花了
straightFlushCardIndex[straightFlushIndexCurrent] = i;
straightFlushIndexCurrent--;
if (hasStright == 0) //已經找到順就不用再找順了
{
straightCardIndex[straightIndexCurrent] = i;
straightIndexCurrent--;
}
if (hasFlush == 0) //已經找到同花就不用再找同花了
{
flushCardIndex[flushIndexCurrent] = i;
flushIndexCurrent--;
}
int lastFaceByStraightFlush = (handCard[i].id) / 4; //數字
int lastFace = (handCard[i].id) / 4; //數字
int lastSuit = (handCard[i].id + 1) % 4; //花色
for (j = i - 1; j >= 0; j--) //從手牌尾端開始找,這樣找到的就是最大的
{
//找同花順
if (lastFaceByStraightFlush - 1 == (handCard[j].id) / 4 && lastSuit == (handCard[j].id + 1) % 4 &&
hasStrightFlush == 0)
{
straightFlushCardIndex[straightFlushIndexCurrent] = j;
straightFlushIndexCurrent--;
lastFaceByStraightFlush = (handCard[j].id) / 4;
}
if (straightFlushIndexCurrent < 0)
{
hasStrightFlush = 1;
break;
}
//找順
if (lastFace - 1 == (handCard[j].id) / 4 && hasStright == 0)
{
straightCardIndex[straightIndexCurrent] = j;
straightIndexCurrent--;
lastFace = (handCard[j].id) / 4;
}
if (straightIndexCurrent < 0)
{
hasStright = 1;
}
//找同花
if (lastSuit == (handCard[j].id + 1) % 4 && hasFlush == 0)
{
flushCardIndex[flushIndexCurrent] = j;
flushIndexCurrent--;
}
if (flushIndexCurrent < 0)
{
hasFlush = 1;
}
}
if (hasStrightFlush == 1)
{
break;
}
}
//抓四條
for (i = currentSize - 4; i >= 0; i--)
{
if (howManyOfaKind(4, handCard + i, 4) == 1)
{
hasFourOfaKind = 1;
fourOfaKindIndex = i;
break;
}
}
}
//抓一個三條
for (i = currentSize - 3; i >= 0; i--)
{
if (howManyOfaKind(3, handCard + i, 3) == 1 && howManyOfaKind(3, handCard + i + 1, 3) == 0 && i > 0)
{
hasThreeOfaKind = 1;
threeOfaKindIndex = i;
break;
}
if (howManyOfaKind(3, handCard + i, 3) == 1 && i == 0)
{
hasThreeOfaKind = 1;
threeOfaKindIndex = i;
break;
}
}
//if (hasThreeOfaKind == 1)printf("ThreeOfaKind Index:%d\n", threeOfaKindIndex);
//抓兩個對子(第一個取小的第二個取大的)
for (i = currentSize; i >= 1; i--)
{
if (hasSecondPair == 0 && hasPair == 1 && whereIsHowManyOfaKind(2, handCard, i) != -1)
{
if (whereIsHowManyOfaKind(3, handCard, i) != whereIsHowManyOfaKind(2, handCard, i))
{
hasSecondPair = 1;
secondPairIndex = pairIndex;
}
}
if (whereIsHowManyOfaKind(2, handCard, i) != -1)
{
if (hasThreeOfaKind == 1 && threeOfaKindIndex == whereIsHowManyOfaKind(2, handCard, i))
{
}
else
{
hasPair = 1;
pairIndex = whereIsHowManyOfaKind(2, handCard, i);
}
}
}
if (pairIndex == secondPairIndex)hasSecondPair = 0;
//if (hasPair == 1)printf("pair Index:%d\n", pairIndex);
//if (hasSecondPair == 1)printf("SECOND pair Index:%d\n", secondPairIndex);
//已經找完了 開始填入CardTemp
if (currentRound < 2)
{
//順位1: 同花順
if (hasStrightFlush == 1)
{
for (i = 0; i < 5; i++)
{
handCardTemp[sortIndex] = handCard[straightFlushCardIndex[i]];
hasFilled[sortIndex] = 1;
handCard[straightFlushCardIndex[i]].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
currentSize = currentSize - 5;
continue;
}
//順位2: 鐵支
if (hasFourOfaKind == 1)
{
for (i = 0; i < 4; i++)
{
handCardTemp[sortIndex] = handCard[fourOfaKindIndex + i];
hasFilled[sortIndex] = 1;
handCard[fourOfaKindIndex + i].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
currentSize = currentSize - 4;
sortIndex--; //先空一格
continue;
}
//順位3: 葫蘆
if (hasThreeOfaKind == 1 && hasPair == 1)
{
for (i = 0; i < 3; i++)
{
handCardTemp[sortIndex] = handCard[threeOfaKindIndex + i];
hasFilled[sortIndex] = 1;
handCard[threeOfaKindIndex + i].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
for (i = 0; i < 2; i++)
{
handCardTemp[sortIndex] = handCard[pairIndex + i];
hasFilled[sortIndex] = 1;
handCard[pairIndex + i].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
currentSize = currentSize - 5;
continue;
}
//順位4: 同花
if (hasFlush == 1)
{
for (i = 0; i < 5; i++)
{
handCardTemp[sortIndex] = handCard[flushCardIndex[i]];
hasFilled[sortIndex] = 1;
handCard[flushCardIndex[i]].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
currentSize = currentSize - 5;
continue;
}
//順位5: 順子
if (hasStright == 1)
{
for (i = 0; i < 5; i++)
{
handCardTemp[sortIndex] = handCard[straightCardIndex[i]];
hasFilled[sortIndex] = 1;
handCard[straightCardIndex[i]].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
currentSize = currentSize - 5;
continue;
}
}
//順位6: 三條
if (hasThreeOfaKind == 1)
{
for (i = 0; i < 3; i++)
{
handCardTemp[sortIndex] = handCard[threeOfaKindIndex + i];
hasFilled[sortIndex] = 1;
handCard[threeOfaKindIndex + i].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
currentSize = currentSize - 3;
sortIndex = sortIndex - 2; //先空兩格
continue;
}
//順位7: 兩對
if (hasPair == 1 && hasSecondPair == 1)
{
for (i = 0; i < 2; i++)
{
handCardTemp[sortIndex] = handCard[pairIndex + i];
hasFilled[sortIndex] = 1;
handCard[pairIndex + i].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
for (i = 0; i < 2; i++)
{
handCardTemp[sortIndex] = handCard[secondPairIndex + i];
hasFilled[sortIndex] = 1;
handCard[secondPairIndex + i].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1; //先空一格
}
currentSize = currentSize - 4;
sortIndex = sortIndex - 1;
continue;
}
//順位8: 對子
if (hasPair == 1)
{
if (hasSecondPair == 1)
{
pairIndex = secondPairIndex;
}
for (i = 0; i < 2; i++)
{
handCardTemp[sortIndex] = handCard[pairIndex + i];
hasFilled[sortIndex] = 1;
handCard[pairIndex + i].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
sortIndex = sortIndex - 1;
}
currentSize = currentSize - 2;
sortIndex = sortIndex - 3; //先空三格
continue;
}
//順位9: 散牌
handCardTemp[sortIndex] = handCard[currentSize - 1];
hasFilled[sortIndex] = 1;
handCard[currentSize - 1].id = sortedIdIndex;
sortIndex = sortIndex - 1;
sortedIdIndex = sortedIdIndex - 1;
currentSize = currentSize - 1;
sortIndex = sortIndex - 4; //先空四格
}
//把還沒填入的牌填進TEMP的空位裡
for (i = 0; i < 13; i++)
{
for (j = 0; j < 13; j++)
{
if (hasFilled[i] == 0 && handCard[j].id < 100)
{
handCardTemp[i] = handCard[j];
hasFilled[i] = 1;
handCard[j].id = sortedIdIndex;
sortedIdIndex = sortedIdIndex - 1;
}
}
}
//把TEMP的複製回手牌
for (i = 0; i < 13; i++)
{
handCard[i] = handCardTemp[i];
}
}
|
[
"chouguting@gmail.com"
] |
chouguting@gmail.com
|
fcd2046df4764d078b570cd569036c0897e77e07
|
9c7c488f962e0fbdb3be81eb43decf48623d63f9
|
/hw1/Frustum.cpp
|
639ee8f094b712d351bd5dab17fd12d60cba9beb
|
[] |
no_license
|
TylerSongCS/OpenGL
|
c6c0e59a07e75c357581abb206b6cb74e837ff9e
|
822309c46d9e0ce2c451aee60cb73011e80ec40b
|
refs/heads/master
| 2022-03-14T10:32:40.010227
| 2019-12-20T21:28:37
| 2019-12-20T21:28:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,631
|
cpp
|
//
// Frustum.cpp
// hw1
//
// Created by Mingxun Song on 10/29/19.
// Copyright © 2019 Mingxun Song. All rights reserved.
// Credit to Gerlits Anatoliy of https://www.gamedev.net/articles/programming/general-and-gameplay-programming/frustum-culling-r4613/
#include "Frustum.hpp"
#include <iostream>
Frustum::Frustum(){
}
Frustum::Frustum(float fovy, float aspect, float znear, float zfar){
this->fovy = fovy;
this->aspect = aspect;
this->znear = znear;
this->zfar = zfar;
projection = glm::perspective(glm::radians(fovy),aspect, znear, zfar);
}
mat4& Frustum::getProjection(){
return projection;
}
float Frustum::getFOVY(){
return fovy;
}
float Frustum::getAspect(){
return aspect;
}
float Frustum::getZNear(){
return znear;
}
float Frustum::getZFar(){
return zfar;
}
void Frustum::setFOVY(float fovy){
this->fovy = fovy;
}
void Frustum::createPlanes(vec3 eye, vec3 center, vec3 up, Plane* plane){
//cerr << "fov: " << fovy << endl;
float tang = (float) tan(radians(fovy) / 2);
float nearHeight = znear * tang;
float nearWidth = nearHeight * aspect;
float farHeight = zfar * tang;
float farWidth = farHeight * aspect;
vec3 farCenter, nearCenter, X, Y, Z, ynh, xnw, nearTopLeft, nearTopRight, nearBotLeft, nearBotRight, farTopLeft, farTopRight, farBotLeft, farBotRight;
// opposite direction of the looking direction
Z = normalize(eye - center);
//x axis of camera
X = normalize(up * Z);
//the real up vector
Y = cross(Z, X);
//Y = (Z * X);
/*if( Y == (Z * X)){
std::cerr << "true";
}else{
std::cerr << "false";
}*/
ynh = Y * (nearHeight);
xnw = X * (nearWidth);
//center of far and near planes
nearCenter = eye - Z * znear;
farCenter = eye - Z * zfar;
//4 corners of the frustum on near plane
nearTopLeft = nearCenter + Y * nearHeight - X * nearWidth;
nearTopRight = nearCenter + Y * nearHeight + X * nearWidth;
nearBotLeft = nearCenter - Y * nearHeight - X * nearWidth;
nearBotRight = nearCenter - Y * nearHeight + X * nearWidth;
//4 corners of the frustum on far plane
farTopLeft = farCenter + Y * farHeight - X * farWidth;
farTopRight = farCenter + Y * farHeight + X * farWidth;
farBotLeft = farCenter - Y * farHeight - X * farWidth;
farBotRight = farCenter - Y * farHeight + X * farWidth;
plane[TOP].set3Points(nearTopRight,nearTopLeft,farTopLeft);
plane[BOTTOM].set3Points(nearBotLeft,nearBotRight,farBotRight);
plane[LEFT].set3Points(nearTopLeft,nearBotLeft,farBotLeft);
plane[RIGHT].set3Points(nearBotRight,nearTopRight,farBotRight);
//plane[NEAR].set3Points(nearTopLeft,nearTopRight,nearBotRight);
//plane[FAR].set3Points(farTopRight,farTopLeft,farBotLeft);
vec3 aux, normal;
/*plane[NEAR].setNormal(-Z);
plane[NEAR].setPoint(nearCenter);
plane[FAR].setNormal(Z);
plane[FAR].setPoint(farCenter);
aux = nearCenter + ynh;
plane[TOP].setPoint(aux);
aux = normalize(aux - eye);
normal = cross(aux, X);
plane[TOP].setNormal(normal);
aux = nearCenter - ynh;
plane[BOTTOM].setPoint(aux);
aux = normalize(aux - eye);
normal = cross(X, aux);
plane[BOTTOM].setNormal(normal);
aux = nearCenter - xnw;
plane[LEFT].setPoint(aux);
aux = normalize(aux - eye);
normal = cross(aux, Y);
plane[LEFT].setNormal(normal);
aux = nearCenter + xnw;
plane[RIGHT].setPoint(aux);
aux = normalize(aux - eye);
normal = cross( Y, aux);
plane[RIGHT].setNormal(normal);
/*plane[NEAR].setNormal(-Z);
plane[NEAR].setPoint(nearCenter);
plane[FAR].setNormal(Z);
plane[FAR].setPoint(farCenter);
aux = nearCenter + ynh;
plane[TOP].setPoint(aux);
aux = normalize(aux - eye);
normal = aux * X;
plane[TOP].setNormal(normal);
aux = nearCenter - ynh;
plane[BOTTOM].setPoint(aux);
aux = normalize(aux - eye);
normal = X * aux;
plane[BOTTOM].setNormal(normal);
aux = nearCenter - xnw;
plane[LEFT].setPoint(aux);
aux = normalize(aux - eye);
normal = aux * Y;
plane[LEFT].setNormal(normal);
aux = nearCenter + xnw;
plane[RIGHT].setPoint(aux);
aux = normalize(aux - eye);
normal = Y * aux;
plane[RIGHT].setNormal(normal);*/
}
void Frustum::normalizePlane(vec4 &frustum_plane)
{
float magnitude = (float)sqrt(frustum_plane[A] * frustum_plane[A] + frustum_plane[B] * frustum_plane[B] + frustum_plane[C] * frustum_plane[C]);
frustum_plane[A] /= magnitude;
frustum_plane[B] /= magnitude;
frustum_plane[C] /= magnitude;
frustum_plane[D] /= magnitude;
}
void Frustum::CalculateFrustum(mat4 &view_matrix, mat4 &proj_matrix)
{
float *proj = glm::value_ptr(proj_matrix);
float *modl = glm::value_ptr(view_matrix);
float clip[16]; //clipping planes
clip[0] = modl[0] * proj[0] + modl[1] * proj[4] + modl[2] * proj[8] + modl[3] * proj[12];
clip[1] = modl[0] * proj[1] + modl[1] * proj[5] + modl[2] * proj[9] + modl[3] * proj[13];
clip[2] = modl[0] * proj[2] + modl[1] * proj[6] + modl[2] * proj[10] + modl[3] * proj[14];
clip[3] = modl[0] * proj[3] + modl[1] * proj[7] + modl[2] * proj[11] + modl[3] * proj[15];
clip[4] = modl[4] * proj[0] + modl[5] * proj[4] + modl[6] * proj[8] + modl[7] * proj[12];
clip[5] = modl[4] * proj[1] + modl[5] * proj[5] + modl[6] * proj[9] + modl[7] * proj[13];
clip[6] = modl[4] * proj[2] + modl[5] * proj[6] + modl[6] * proj[10] + modl[7] * proj[14];
clip[7] = modl[4] * proj[3] + modl[5] * proj[7] + modl[6] * proj[11] + modl[7] * proj[15];
clip[8] = modl[8] * proj[0] + modl[9] * proj[4] + modl[10] * proj[8] + modl[11] * proj[12];
clip[9] = modl[8] * proj[1] + modl[9] * proj[5] + modl[10] * proj[9] + modl[11] * proj[13];
clip[10] = modl[8] * proj[2] + modl[9] * proj[6] + modl[10] * proj[10] + modl[11] * proj[14];
clip[11] = modl[8] * proj[3] + modl[9] * proj[7] + modl[10] * proj[11] + modl[11] * proj[15];
clip[12] = modl[12] * proj[0] + modl[13] * proj[4] + modl[14] * proj[8] + modl[15] * proj[12];
clip[13] = modl[12] * proj[1] + modl[13] * proj[5] + modl[14] * proj[9] + modl[15] * proj[13];
clip[14] = modl[12] * proj[2] + modl[13] * proj[6] + modl[14] * proj[10] + modl[15] * proj[14];
clip[15] = modl[12] * proj[3] + modl[13] * proj[7] + modl[14] * proj[11] + modl[15] * proj[15];
frustum_planes[RIGHT][A] = clip[3] - clip[0];
frustum_planes[RIGHT][B] = clip[7] - clip[4];
frustum_planes[RIGHT][C] = clip[11] - clip[8];
frustum_planes[RIGHT][D] = clip[15] - clip[12];
normalizePlane(frustum_planes[RIGHT]);
frustum_planes[LEFT][A] = clip[3] + clip[0];
frustum_planes[LEFT][B] = clip[7] + clip[4];
frustum_planes[LEFT][C] = clip[11] + clip[8];
frustum_planes[LEFT][D] = clip[15] + clip[12];
normalizePlane(frustum_planes[LEFT]);
frustum_planes[BOTTOM][A] = clip[3] + clip[1];
frustum_planes[BOTTOM][B] = clip[7] + clip[5];
frustum_planes[BOTTOM][C] = clip[11] + clip[9];
frustum_planes[BOTTOM][D] = clip[15] + clip[13];
normalizePlane(frustum_planes[BOTTOM]);
frustum_planes[TOP][A] = clip[3] - clip[1];
frustum_planes[TOP][B] = clip[7] - clip[5];
frustum_planes[TOP][C] = clip[11] - clip[9];
frustum_planes[TOP][D] = clip[15] - clip[13];
normalizePlane(frustum_planes[TOP]);
frustum_planes[BACK][A] = clip[3] - clip[2];
frustum_planes[BACK][B] = clip[7] - clip[6];
frustum_planes[BACK][C] = clip[11] - clip[10];
frustum_planes[BACK][D] = clip[15] - clip[14];
normalizePlane(frustum_planes[BACK]);
frustum_planes[FRONT][A] = clip[3] + clip[2];
frustum_planes[FRONT][B] = clip[7] + clip[6];
frustum_planes[FRONT][C] = clip[11] + clip[10];
frustum_planes[FRONT][D] = clip[15] + clip[14];
normalizePlane(frustum_planes[FRONT]);
}
bool Frustum::SphereInFrustum(vec3 &pos, float &radius)
{
bool res = true;
//test all 6 frustum planes
for (int i = 0; i < 6; i++)
{
//calculate distance from sphere center to plane.
//if distance larger then sphere radius - sphere is outside frustum
if (frustum_planes[i].x * pos.x + frustum_planes[i].y * pos.y + frustum_planes[i].z * pos.z + frustum_planes[i].w <= -radius)
//res = false;
return false; //with flag works faster
}
return res;
//return true;
}
vec4* Frustum::getFustumPlanes(){
return frustum_planes;
}
|
[
"32463378+TylerSongCS@users.noreply.github.com"
] |
32463378+TylerSongCS@users.noreply.github.com
|
edeed468aae36e15118c9de6b47193a46e9719b7
|
d09945668f19bb4bc17087c0cb8ccbab2b2dd688
|
/atcoder/abc251-300/abc264/g.cpp
|
6e54f3be78fc0169b25d90032b11d347ddfcbfd5
|
[] |
no_license
|
kmjp/procon
|
27270f605f3ae5d80fbdb28708318a6557273a57
|
8083028ece4be1460150aa3f0e69bdb57e510b53
|
refs/heads/master
| 2023-09-04T11:01:09.452170
| 2023-09-03T15:25:21
| 2023-09-03T15:25:21
| 30,825,508
| 23
| 2
| null | 2023-08-18T14:02:07
| 2015-02-15T11:25:23
|
C++
|
SHIFT_JIS
|
C++
| false
| false
| 1,870
|
cpp
|
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------
int N;
ll P1[26];
ll P2[26][26];
ll P3[26][26][26];
ll dp[26][26];
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N;
FOR(i,N) {
cin>>s>>x;
FORR(c,s) c-='a';
if(s.size()==1) {
P1[s[0]]=x;
}
if(s.size()==2) {
P2[s[0]][s[1]]=x;
}
if(s.size()==3) {
P3[s[0]][s[1]][s[2]]=x;
}
}
ll ma=-1LL<<60;
//1文字
FOR(i,26) ma=max(ma,P1[i]);
//2文字
priority_queue<pair<ll,int>> Q;
FOR(y,26) FOR(x,26) {
ma=max(ma,P2[y][x]+P1[y]+P1[x]);
dp[y][x]=P2[y][x]+P1[y]+P1[x];
Q.push({-dp[y][x],y*26+x});
}
//2文字
FOR(i,26) ma=max(ma,P1[i]);
int loop=1000000;
while(Q.size()) {
loop--;
if(loop==0) {
cout<<"Infinity"<<endl;
return;
}
ll co=-Q.top().first;
int c1=Q.top().second/26;
int c2=Q.top().second%26;
Q.pop();
if(dp[c1][c2]!=co) continue;
ma=max(ma,co);
FOR(i,26) {
ll sc=co+P3[c1][c2][i]+P2[c2][i]+P1[i];
if(sc>dp[c2][i]) {
dp[c2][i]=sc;
Q.push({-sc,c2*26+i});
}
}
}
cout<<ma<<endl;
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
cout.tie(0); solve(); return 0;
}
|
[
"kmjp@users.noreply.github.com"
] |
kmjp@users.noreply.github.com
|
eccb886f4081c6806faeda4991d8ff92830bce3b
|
c16872de1c97f749987df5526f73285cc51f0044
|
/OuSns/pugixml.hpp
|
922743fdf473b1695390cf41b7011f5fc708e067
|
[] |
no_license
|
baobo5625/ousnsClient
|
65f685366a2d47ec79abc87d2eeceef0f58fbdf0
|
f998f1a314e43d51a7b460546811b41f788acc46
|
refs/heads/master
| 2021-01-20T21:23:21.209220
| 2014-12-15T07:46:40
| 2014-12-15T07:46:40
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 41,211
|
hpp
|
/**
* pugixml parser - version 1.0
* --------------------------------------------------------
* Copyright (C) 2006-2010, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at http://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/
#include"stdafx.h"
//#ifndef HEADER_PUGIXML_HPP
//#define HEADER_PUGIXML_HPP
#include "pugiconfig.hpp"
#ifndef PUGIXML_NO_STL
namespace std
{
struct bidirectional_iterator_tag;
#ifdef __SUNPRO_CC
// Sun C++ compiler has a bug which forces template argument names in forward declarations to be the same as in actual definitions
template <class _T> class allocator;
template <class _charT> struct char_traits;
template <class _charT, class _Traits> class basic_istream;
template <class _charT, class _Traits> class basic_ostream;
template <class _charT, class _Traits, class _Allocator> class basic_string;
#else
// Borland C++ compiler has a bug which forces template argument names in forward declarations to be the same as in actual definitions
template <class _Ty> class allocator;
template <class _Ty> struct char_traits;
template <class _Elem, class _Traits> class basic_istream;
template <class _Elem, class _Traits> class basic_ostream;
template <class _Elem, class _Traits, class _Ax> class basic_string;
#endif
// Digital Mars compiler has a bug which requires a forward declaration for explicit instantiation (otherwise type selection is messed up later, producing link errors)
// Also note that we have to declare char_traits as a class here, since it's defined that way
#ifdef __DMC__
template <> class char_traits<char>;
#endif
}
#endif
// Macro for deprecated features
#ifndef PUGIXML_DEPRECATED
# if defined(__GNUC__)
# define PUGIXML_DEPRECATED __attribute__((deprecated))
# elif defined(_MSC_VER) && _MSC_VER >= 1300
# define PUGIXML_DEPRECATED __declspec(deprecated)
# else
# define PUGIXML_DEPRECATED
# endif
#endif
// Include exception header for XPath
#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
# include <exception>
#endif
// If no API is defined, assume default
#ifndef PUGIXML_API
# define PUGIXML_API
#endif
// If no API for classes is defined, assume default
#ifndef PUGIXML_CLASS
# define PUGIXML_CLASS PUGIXML_API
#endif
// If no API for functions is defined, assume default
#ifndef PUGIXML_FUNCTION
# define PUGIXML_FUNCTION PUGIXML_API
#endif
#include <stddef.h>
// Character interface macros
#ifdef PUGIXML_WCHAR_MODE
# define PUGIXML_TEXT(t) L ## t
# define PUGIXML_CHAR wchar_t
#else
# define PUGIXML_TEXT(t) t
# define PUGIXML_CHAR char
#endif
namespace pugi
{
// Character type used for all internal storage and operations; depends on PUGIXML_WCHAR_MODE
typedef PUGIXML_CHAR char_t;
#ifndef PUGIXML_NO_STL
// String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
#endif
}
// The PugiXML namespace
namespace pugi
{
// Tree node types
enum xml_node_type
{
node_null, // Empty (null) node handle
node_document, // A document tree's absolute root
node_element, // Element tag, i.e. '<node/>'
node_pcdata, // Plain character data, i.e. 'text'
node_cdata, // Character data, i.e. '<![CDATA[text]]>'
node_comment, // Comment tag, i.e. '<!-- text -->'
node_pi, // Processing instruction, i.e. '<?name?>'
node_declaration, // Document declaration, i.e. '<?xml version="1.0"?>'
node_doctype // Document type declaration, i.e. '<!DOCTYPE doc>'
};
// Parsing options
// Minimal parsing mode (equivalent to turning all other flags off).
// Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
const unsigned int parse_minimal = 0x0000;
// This flag determines if processing instructions (node_pi) are added to the DOM tree. This flag is off by default.
const unsigned int parse_pi = 0x0001;
// This flag determines if comments (node_comment) are added to the DOM tree. This flag is off by default.
const unsigned int parse_comments = 0x0002;
// This flag determines if CDATA sections (node_cdata) are added to the DOM tree. This flag is on by default.
const unsigned int parse_cdata = 0x0004;
// This flag determines if plain character data (node_pcdata) that consist only of whitespace are added to the DOM tree.
// This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
const unsigned int parse_ws_pcdata = 0x0008;
// This flag determines if character and entity references are expanded during parsing. This flag is on by default.
const unsigned int parse_escapes = 0x0010;
// This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
const unsigned int parse_eol = 0x0020;
// This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
const unsigned int parse_wconv_attribute = 0x0040;
// This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
const unsigned int parse_wnorm_attribute = 0x0080;
// This flag determines if document declaration (node_declaration) is added to the DOM tree. This flag is off by default.
const unsigned int parse_declaration = 0x0100;
// This flag determines if document type declaration (node_doctype) is added to the DOM tree. This flag is off by default.
const unsigned int parse_doctype = 0x0200;
// The default parsing mode.
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
const unsigned int parse_default = parse_cdata | parse_escapes | parse_wconv_attribute | parse_eol;
// The full parsing mode.
// Nodes of all types are added to the DOM tree, character/reference entities are expanded,
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
const unsigned int parse_full = parse_default | parse_pi | parse_comments | parse_declaration | parse_doctype;
// These flags determine the encoding of input data for XML document
enum xml_encoding
{
encoding_auto, // Auto-detect input encoding using BOM or < / <? detection; use UTF8 if BOM is not found
encoding_utf8, // UTF8 encoding
encoding_utf16_le, // Little-endian UTF16
encoding_utf16_be, // Big-endian UTF16
encoding_utf16, // UTF16 with native endianness
encoding_utf32_le, // Little-endian UTF32
encoding_utf32_be, // Big-endian UTF32
encoding_utf32, // UTF32 with native endianness
encoding_wchar // The same encoding wchar_t has (either UTF16 or UTF32)
};
// Formatting flags
// Indent the nodes that are written to output stream with as many indentation strings as deep the node is in DOM tree. This flag is on by default.
const unsigned int format_indent = 0x01;
// Write encoding-specific BOM to the output stream. This flag is off by default.
const unsigned int format_write_bom = 0x02;
// Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
const unsigned int format_raw = 0x04;
// Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
const unsigned int format_no_declaration = 0x08;
// The default set of formatting flags.
// Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
const unsigned int format_default = format_indent;
// Forward declarations
struct xml_attribute_struct;
struct xml_node_struct;
class xml_node_iterator;
class xml_attribute_iterator;
class xml_tree_walker;
class xml_node;
#ifndef PUGIXML_NO_XPATH
class xpath_node;
class xpath_node_set;
class xpath_query;
class xpath_variable_set;
#endif
// Writer interface for node printing (see xml_node::print)
class PUGIXML_CLASS xml_writer
{
public:
virtual ~xml_writer() {}
// Write memory chunk into stream/file/whatever
virtual void write(const void* data, size_t size) = 0;
};
// xml_writer implementation for FILE*
class PUGIXML_CLASS xml_writer_file: public xml_writer
{
public:
// Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
xml_writer_file(void* file);
virtual void write(const void* data, size_t size);
private:
void* file;
};
struct xml_string_writer: pugi::xml_writer
{
std::string result;
virtual void write(const void* data, size_t size)
{
result += std::string(static_cast<const char*>(data), size);
}
};
#ifndef PUGIXML_NO_STL
// xml_writer implementation for streams
class PUGIXML_CLASS xml_writer_stream: public xml_writer
{
public:
// Construct writer from an output stream object
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
virtual void write(const void* data, size_t size);
private:
std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
};
#endif
// A light-weight handle for manipulating attributes in DOM tree
class PUGIXML_CLASS xml_attribute
{
friend class xml_attribute_iterator;
friend class xml_node;
private:
xml_attribute_struct* _attr;
typedef xml_attribute_struct* xml_attribute::*unspecified_bool_type;
public:
// Default constructor. Constructs an empty attribute.
xml_attribute();
// Constructs attribute from internal pointer
explicit xml_attribute(xml_attribute_struct* attr);
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
// Comparison operators (compares wrapped attribute pointers)
bool operator==(const xml_attribute& r) const;
bool operator!=(const xml_attribute& r) const;
bool operator<(const xml_attribute& r) const;
bool operator>(const xml_attribute& r) const;
bool operator<=(const xml_attribute& r) const;
bool operator>=(const xml_attribute& r) const;
// Check if attribute is empty
bool empty() const;
// Get attribute name/value, or "" if attribute is empty
const char_t* name() const;
const char_t* value() const;
// Get attribute value as a number, or 0 if conversion did not succeed or attribute is empty
int as_int() const;
unsigned int as_uint() const;
double as_double() const;
float as_float() const;
// Get attribute value as bool (returns true if first character is in '1tTyY' set), or false if attribute is empty
bool as_bool() const;
// Set attribute name/value (returns false if attribute is empty or there is not enough memory)
bool set_name(const char_t* rhs);
bool set_value(const char_t* rhs);
// Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
bool set_value(int rhs);
bool set_value(unsigned int rhs);
bool set_value(double rhs);
bool set_value(bool rhs);
// Set attribute value (equivalent to set_value without error checking)
xml_attribute& operator=(const char_t* rhs);
xml_attribute& operator=(int rhs);
xml_attribute& operator=(unsigned int rhs);
xml_attribute& operator=(double rhs);
xml_attribute& operator=(bool rhs);
// Get next/previous attribute in the attribute list of the parent node
xml_attribute next_attribute() const;
xml_attribute previous_attribute() const;
// Get hash value (unique for handles to the same object)
size_t hash_value() const;
// Get internal pointer
xml_attribute_struct* internal_object() const;
};
#ifdef __BORLANDC__
// Borland C++ workaround
bool PUGIXML_FUNCTION operator&&(const xml_attribute& lhs, bool rhs);
bool PUGIXML_FUNCTION operator||(const xml_attribute& lhs, bool rhs);
#endif
// A light-weight handle for manipulating nodes in DOM tree
class PUGIXML_CLASS xml_node
{
friend class xml_attribute_iterator;
friend class xml_node_iterator;
protected:
xml_node_struct* _root;
typedef xml_node_struct* xml_node::*unspecified_bool_type;
public:
// Default constructor. Constructs an empty node.
xml_node();
// Constructs node from internal pointer
explicit xml_node(xml_node_struct* p);
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
// Comparison operators (compares wrapped node pointers)
bool operator==(const xml_node& r) const;
bool operator!=(const xml_node& r) const;
bool operator<(const xml_node& r) const;
bool operator>(const xml_node& r) const;
bool operator<=(const xml_node& r) const;
bool operator>=(const xml_node& r) const;
// Check if node is empty.
bool empty() const;
// Get node type
xml_node_type type() const;
// Get node name/value, or "" if node is empty or it has no name/value
const char_t* name() const;
const char_t* value() const;
// Get attribute list
xml_attribute first_attribute() const;
xml_attribute last_attribute() const;
// Get children list
xml_node first_child() const;
xml_node last_child() const;
// Get next/previous sibling in the children list of the parent node
xml_node next_sibling() const;
xml_node previous_sibling() const;
// Get parent node
xml_node parent() const;
// Get root of DOM tree this node belongs to
xml_node root() const;
// Get child, attribute or next/previous sibling with the specified name
xml_node child(const char_t* name) const;
xml_attribute attribute(const char_t* name) const;
xml_node next_sibling(const char_t* name) const;
xml_node previous_sibling(const char_t* name) const;
// Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
const char_t* child_value() const;
// Get child value of child with specified name. Equivalent to child(name).child_value().
const char_t* child_value(const char_t* name) const;
// Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
bool set_name(const char_t* rhs);
bool set_value(const char_t* rhs);
// Add attribute with specified name. Returns added attribute, or empty attribute on errors.
xml_attribute append_attribute(const char_t* name);
xml_attribute prepend_attribute(const char_t* name);
xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr);
// Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
xml_attribute append_copy(const xml_attribute& proto);
xml_attribute prepend_copy(const xml_attribute& proto);
xml_attribute insert_copy_after(const xml_attribute& proto, const xml_attribute& attr);
xml_attribute insert_copy_before(const xml_attribute& proto, const xml_attribute& attr);
// Add child node with specified type. Returns added node, or empty node on errors.
xml_node append_child(xml_node_type type = node_element);
xml_node prepend_child(xml_node_type type = node_element);
xml_node insert_child_after(xml_node_type type, const xml_node& node);
xml_node insert_child_before(xml_node_type type, const xml_node& node);
// Add child element with specified name. Returns added node, or empty node on errors.
xml_node append_child(const char_t* name);
xml_node prepend_child(const char_t* name);
xml_node insert_child_after(const char_t* name, const xml_node& node);
xml_node insert_child_before(const char_t* name, const xml_node& node);
// Add a copy of the specified node as a child. Returns added node, or empty node on errors.
xml_node append_copy(const xml_node& proto);
xml_node prepend_copy(const xml_node& proto);
xml_node insert_copy_after(const xml_node& proto, const xml_node& node);
xml_node insert_copy_before(const xml_node& proto, const xml_node& node);
// Remove specified attribute
bool remove_attribute(const xml_attribute& a);
bool remove_attribute(const char_t* name);
// Remove specified child
bool remove_child(const xml_node& n);
bool remove_child(const char_t* name);
// Find attribute using predicate. Returns first attribute for which predicate returned true.
template <typename Predicate> xml_attribute find_attribute(Predicate pred) const
{
if (!_root) return xml_attribute();
for (xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
if (pred(attrib))
return attrib;
return xml_attribute();
}
// Find child node using predicate. Returns first child for which predicate returned true.
template <typename Predicate> xml_node find_child(Predicate pred) const
{
if (!_root) return xml_node();
for (xml_node node = first_child(); node; node = node.next_sibling())
if (pred(node))
return node;
return xml_node();
}
// Find node from subtree using predicate. Returns first node from subtree (depth-first), for which predicate returned true.
template <typename Predicate> xml_node find_node(Predicate pred) const
{
if (!_root) return xml_node();
xml_node cur = first_child();
while (cur._root && cur._root != _root)
{
if (pred(cur)) return cur;
if (cur.first_child()) cur = cur.first_child();
else if (cur.next_sibling()) cur = cur.next_sibling();
else
{
while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
if (cur._root != _root) cur = cur.next_sibling();
}
}
return xml_node();
}
// Find child node by attribute name/value
xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
#ifndef PUGIXML_NO_STL
// Get the absolute node path from root as a text string.
string_t path(char_t delimiter = '/') const;
#endif
// Search for a node by path consisting of node names and . or .. elements.
xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
// Recursively traverse subtree with xml_tree_walker
bool traverse(xml_tree_walker& walker);
#ifndef PUGIXML_NO_XPATH
// Select single node by evaluating XPath query. Returns first node from the resulting node set.
xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = 0) const;
xpath_node select_single_node(const xpath_query& query) const;
// Select node set by evaluating XPath query
xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
xpath_node_set select_nodes(const xpath_query& query) const;
#endif
// Print subtree using a writer object
void print(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
#ifndef PUGIXML_NO_STL
// Print subtree to stream
void print(std::basic_ostream<char, std::char_traits<char> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
void print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
#endif
// Child nodes iterators
typedef xml_node_iterator iterator;
iterator begin() const;
iterator end() const;
// Attribute iterators
typedef xml_attribute_iterator attribute_iterator;
attribute_iterator attributes_begin() const;
attribute_iterator attributes_end() const;
// Get node offset in parsed file/string (in char_t units) for debugging purposes
ptrdiff_t offset_debug() const;
// Get hash value (unique for handles to the same object)
size_t hash_value() const;
// Get internal pointer
xml_node_struct* internal_object() const;
};
#ifdef __BORLANDC__
// Borland C++ workaround
bool PUGIXML_FUNCTION operator&&(const xml_node& lhs, bool rhs);
bool PUGIXML_FUNCTION operator||(const xml_node& lhs, bool rhs);
#endif
// Child node iterator (a bidirectional iterator over a collection of xml_node)
class PUGIXML_CLASS xml_node_iterator
{
friend class xml_node;
private:
xml_node _wrap;
xml_node _parent;
xml_node_iterator(xml_node_struct* ref, xml_node_struct* parent);
public:
// Iterator traits
typedef ptrdiff_t difference_type;
typedef xml_node value_type;
typedef xml_node* pointer;
typedef xml_node& reference;
#ifndef PUGIXML_NO_STL
typedef std::bidirectional_iterator_tag iterator_category;
#endif
// Default constructor
xml_node_iterator();
// Construct an iterator which points to the specified node
xml_node_iterator(const xml_node& node);
// Iterator operators
bool operator==(const xml_node_iterator& rhs) const;
bool operator!=(const xml_node_iterator& rhs) const;
xml_node& operator*();
xml_node* operator->();
const xml_node_iterator& operator++();
xml_node_iterator operator++(int);
const xml_node_iterator& operator--();
xml_node_iterator operator--(int);
};
// Attribute iterator (a bidirectional iterator over a collection of xml_attribute)
class PUGIXML_CLASS xml_attribute_iterator
{
friend class xml_node;
private:
xml_attribute _wrap;
xml_node _parent;
xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
public:
// Iterator traits
typedef ptrdiff_t difference_type;
typedef xml_attribute value_type;
typedef xml_attribute* pointer;
typedef xml_attribute& reference;
#ifndef PUGIXML_NO_STL
typedef std::bidirectional_iterator_tag iterator_category;
#endif
// Default constructor
xml_attribute_iterator();
// Construct an iterator which points to the specified attribute
xml_attribute_iterator(const xml_attribute& attr, const xml_node& parent);
// Iterator operators
bool operator==(const xml_attribute_iterator& rhs) const;
bool operator!=(const xml_attribute_iterator& rhs) const;
xml_attribute& operator*();
xml_attribute* operator->();
const xml_attribute_iterator& operator++();
xml_attribute_iterator operator++(int);
const xml_attribute_iterator& operator--();
xml_attribute_iterator operator--(int);
};
// Abstract tree walker class (see xml_node::traverse)
class PUGIXML_CLASS xml_tree_walker
{
friend class xml_node;
private:
int _depth;
protected:
// Get current traversal depth
int depth() const;
public:
xml_tree_walker();
virtual ~xml_tree_walker();
// Callback that is called when traversal begins
virtual bool begin(xml_node& node);
// Callback that is called for each node traversed
virtual bool for_each(xml_node& node) = 0;
// Callback that is called when traversal ends
virtual bool end(xml_node& node);
};
// Parsing status, returned as part of xml_parse_result object
enum xml_parse_status
{
status_ok = 0, // No error
status_file_not_found, // File was not found during load_file()
status_io_error, // Error reading from file/stream
status_out_of_memory, // Could not allocate memory
status_internal_error, // Internal error occurred
status_unrecognized_tag, // Parser could not determine tag type
status_bad_pi, // Parsing error occurred while parsing document declaration/processing instruction
status_bad_comment, // Parsing error occurred while parsing comment
status_bad_cdata, // Parsing error occurred while parsing CDATA section
status_bad_doctype, // Parsing error occurred while parsing document type declaration
status_bad_pcdata, // Parsing error occurred while parsing PCDATA section
status_bad_start_element, // Parsing error occurred while parsing start element tag
status_bad_attribute, // Parsing error occurred while parsing element attribute
status_bad_end_element, // Parsing error occurred while parsing end element tag
status_end_element_mismatch // There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag)
};
// Parsing result
struct PUGIXML_CLASS xml_parse_result
{
// Parsing status (see xml_parse_status)
xml_parse_status status;
// Last parsed offset (in char_t units from start of input data)
ptrdiff_t offset;
// Source document encoding
xml_encoding encoding;
// Default constructor, initializes object to failed state
xml_parse_result();
// Cast to bool operator
operator bool() const;
// Get error description
const char* description() const;
};
// Document class (DOM tree root)
class PUGIXML_CLASS xml_document: public xml_node
{
private:
char_t* _buffer;
char _memory[192];
// Non-copyable semantics
xml_document(const xml_document&);
const xml_document& operator=(const xml_document&);
void create();
void destroy();
xml_parse_result load_buffer_impl(void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own);
public:
// Default constructor, makes empty document
xml_document();
// Destructor, invalidates all node/attribute handles to this document
~xml_document();
// Removes all nodes, leaving the empty document
void reset();
// Removes all nodes, then copies the entire contents of the specified document
void reset(const xml_document& proto);
#ifndef PUGIXML_NO_STL
// Load document from stream.
xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
xml_parse_result load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options = parse_default);
#endif
// Load document from zero-terminated string. No encoding conversions are applied.
xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
// Load document from file
xml_parse_result load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
xml_parse_result load_file(const wchar_t* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Load document from buffer. Copies/converts the buffer, so it may be deleted or changed after the function returns.
xml_parse_result load_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
// You should ensure that buffer data will persist throughout the document's lifetime, and free the buffer memory manually once document is destroyed.
xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
// You should allocate the buffer with pugixml allocation function; document will free the buffer when it is no longer needed (you can't use it anymore).
xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
#ifndef PUGIXML_NO_STL
// Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
void save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
void save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
#endif
// Save XML to file
bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
bool save_file(const wchar_t* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
// Get document element
xml_node document_element() const;
};
#ifndef PUGIXML_NO_XPATH
// XPath query return type
enum xpath_value_type
{
xpath_type_none, // Unknown type (query failed to compile)
xpath_type_node_set, // Node set (xpath_node_set)
xpath_type_number, // Number
xpath_type_string, // String
xpath_type_boolean // Boolean
};
// XPath parsing result
struct PUGIXML_CLASS xpath_parse_result
{
// Error message (0 if no error)
const char* error;
// Last parsed offset (in char_t units from string start)
ptrdiff_t offset;
// Default constructor, initializes object to failed state
xpath_parse_result();
// Cast to bool operator
operator bool() const;
// Get error description
const char* description() const;
};
// A single XPath variable
class PUGIXML_CLASS xpath_variable
{
friend class xpath_variable_set;
protected:
xpath_value_type _type;
xpath_variable* _next;
xpath_variable();
// Non-copyable semantics
xpath_variable(const xpath_variable&);
xpath_variable& operator=(const xpath_variable&);
public:
// Get variable name
const char_t* name() const;
// Get variable type
xpath_value_type type() const;
// Get variable value; no type conversion is performed, default value (false, NaN, empty string, empty node set) is returned on type mismatch error
bool get_boolean() const;
double get_number() const;
const char_t* get_string() const;
const xpath_node_set& get_node_set() const;
// Set variable value; no type conversion is performed, false is returned on type mismatch error
bool set(bool value);
bool set(double value);
bool set(const char_t* value);
bool set(const xpath_node_set& value);
};
// A set of XPath variables
class PUGIXML_CLASS xpath_variable_set
{
private:
xpath_variable* _data[64];
// Non-copyable semantics
xpath_variable_set(const xpath_variable_set&);
xpath_variable_set& operator=(const xpath_variable_set&);
xpath_variable* find(const char_t* name) const;
public:
// Default constructor/destructor
xpath_variable_set();
~xpath_variable_set();
// Add a new variable or get the existing one, if the types match
xpath_variable* add(const char_t* name, xpath_value_type type);
// Set value of an existing variable; no type conversion is performed, false is returned if there is no such variable or if types mismatch
bool set(const char_t* name, bool value);
bool set(const char_t* name, double value);
bool set(const char_t* name, const char_t* value);
bool set(const char_t* name, const xpath_node_set& value);
// Get existing variable by name
xpath_variable* get(const char_t* name);
const xpath_variable* get(const char_t* name) const;
};
// A compiled XPath query object
class PUGIXML_CLASS xpath_query
{
private:
void* _impl;
xpath_parse_result _result;
typedef void* xpath_query::*unspecified_bool_type;
// Non-copyable semantics
xpath_query(const xpath_query&);
xpath_query& operator=(const xpath_query&);
public:
// Construct a compiled object from XPath expression.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
// Destructor
~xpath_query();
// Get query expression return type
xpath_value_type return_type() const;
// Evaluate expression as boolean value in the specified context; performs type conversion if necessary.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
bool evaluate_boolean(const xpath_node& n) const;
// Evaluate expression as double value in the specified context; performs type conversion if necessary.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
double evaluate_number(const xpath_node& n) const;
#ifndef PUGIXML_NO_STL
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
string_t evaluate_string(const xpath_node& n) const;
#endif
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
// At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
// If PUGIXML_NO_EXCEPTIONS is defined, returns empty set instead.
size_t evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
// Evaluate expression as node set in the specified context.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
// If PUGIXML_NO_EXCEPTIONS is defined, returns empty node set instead.
xpath_node_set evaluate_node_set(const xpath_node& n) const;
// Get parsing result (used to get compilation errors in PUGIXML_NO_EXCEPTIONS mode)
const xpath_parse_result& result() const;
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
};
#ifndef PUGIXML_NO_EXCEPTIONS
// XPath exception class
class PUGIXML_CLASS xpath_exception: public std::exception
{
private:
xpath_parse_result _result;
public:
// Construct exception from parse result
explicit xpath_exception(const xpath_parse_result& result);
// Get error message
virtual const char* what() const throw();
// Get parse result
const xpath_parse_result& result() const;
};
#endif
// XPath node class (either xml_node or xml_attribute)
class PUGIXML_CLASS xpath_node
{
private:
xml_node _node;
xml_attribute _attribute;
typedef xml_node xpath_node::*unspecified_bool_type;
public:
// Default constructor; constructs empty XPath node
xpath_node();
// Construct XPath node from XML node/attribute
xpath_node(const xml_node& node);
xpath_node(const xml_attribute& attribute, const xml_node& parent);
// Get node/attribute, if any
xml_node node() const;
xml_attribute attribute() const;
// Get parent of contained node/attribute
xml_node parent() const;
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
// Comparison operators
bool operator==(const xpath_node& n) const;
bool operator!=(const xpath_node& n) const;
};
#ifdef __BORLANDC__
// Borland C++ workaround
bool PUGIXML_FUNCTION operator&&(const xpath_node& lhs, bool rhs);
bool PUGIXML_FUNCTION operator||(const xpath_node& lhs, bool rhs);
#endif
// A fixed-size collection of XPath nodes
class PUGIXML_CLASS xpath_node_set
{
public:
// Collection type
enum type_t
{
type_unsorted, // Not ordered
type_sorted, // Sorted by document order (ascending)
type_sorted_reverse // Sorted by document order (descending)
};
// Constant iterator type
typedef const xpath_node* const_iterator;
// Default constructor. Constructs empty set.
xpath_node_set();
// Constructs a set from iterator range; data is not checked for duplicates and is not sorted according to provided type, so be careful
xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
// Destructor
~xpath_node_set();
// Copy constructor/assignment operator
xpath_node_set(const xpath_node_set& ns);
xpath_node_set& operator=(const xpath_node_set& ns);
// Get collection type
type_t type() const;
// Get collection size
size_t size() const;
// Indexing operator
const xpath_node& operator[](size_t index) const;
// Collection iterators
const_iterator begin() const;
const_iterator end() const;
// Sort the collection in ascending/descending order by document order
void sort(bool reverse = false);
// Get first node in the collection by document order
xpath_node first() const;
// Check if collection is empty
bool empty() const;
private:
type_t _type;
xpath_node _storage;
xpath_node* _begin;
xpath_node* _end;
void _assign(const_iterator begin, const_iterator end);
};
#endif
#ifndef PUGIXML_NO_STL
// Convert wide string to UTF8
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >& str);
// Convert UTF8 to wide string
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >& str);
#endif
// Memory allocation function interface; returns pointer to allocated memory or NULL on failure
typedef void* (*allocation_function)(size_t size);
// Memory deallocation function interface
typedef void (*deallocation_function)(void* ptr);
// Override default memory management functions. All subsequent allocations/deallocations will be performed via supplied functions.
void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate);
// Get current memory management functions
allocation_function PUGIXML_FUNCTION get_memory_allocation_function();
deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function();
}
#if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
namespace std
{
// Workarounds for (non-standard) iterator category detection for older versions (MSVC7/IC8 and earlier)
std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_node_iterator&);
std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_attribute_iterator&);
}
#endif
#if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
namespace std
{
// Workarounds for (non-standard) iterator category detection
std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_node_iterator&);
std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_attribute_iterator&);
}
#endif
//#endif
/**
* Copyright (c) 2006-2010 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
|
[
"baobo5625@gmail.com"
] |
baobo5625@gmail.com
|
060514ae5c77fc45abea1256b5a82290a4ddda45
|
0edbcda83b7a9542f15f706573a8e21da51f6020
|
/private/inet/mshtml/msaahtml/checkbox.h
|
c7aa1c4ffe942bc815dcc0654db76d152f82d3df
|
[] |
no_license
|
yair-k/Win2000SRC
|
fe9f6f62e60e9bece135af15359bb80d3b65dc6a
|
fd809a81098565b33f52d0f65925159de8f4c337
|
refs/heads/main
| 2023-04-12T08:28:31.485426
| 2021-05-08T22:47:00
| 2021-05-08T22:47:00
| 365,623,923
| 1
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,157
|
h
|
//================================================================================
// File: CHECKBOX.H
// Date: 6/11/97
// Desc: Contains the definition of the CCheckboxAO class. This class
// implements the accessible proxy for the Trident check box control.
//
// Author: Arunj
//
//================================================================================
#ifndef __CHECKBOXAO__
#define __CHECKBOXAO__
//================================================================================
// Includes
//================================================================================
#include "optnbtn.h"
#ifdef _MSAA_EVENTS
#include "event.h"
#endif
//================================================================================
// CCheckboxAO class definition
//================================================================================
class CCheckboxAO: public COptionButtonAO
{
public:
//--------------------------------------------------
// IUnknown
//--------------------------------------------------
virtual STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
//--------------------------------------------------
// Internal IAccessible support
//--------------------------------------------------
virtual HRESULT GetAccDefaultAction( long lChild, BSTR* pbstrDefAction );
//--------------------------------------------------
// standard object methods
//--------------------------------------------------
CCheckboxAO(CTridentAO* pAOParent,CDocumentAO * pDocAO, UINT nTOMIndex,UINT nChildID,HWND hWnd);
~CCheckboxAO();
HRESULT Init(IUnknown* pTOMObjIUnk);
protected:
//--------------------------------------------------
// protected helper methods
//--------------------------------------------------
virtual HRESULT getDefaultActionString( BSTR* pbstrDefaultAction );
#ifdef _MSAA_EVENTS
//--------------------------------------------------
// Event handler implementation
//--------------------------------------------------
DECLARE_EVENT_HANDLER(ImplHTMLOptionButtonElementEvents,CEvent,DIID_HTMLOptionButtonElementEvents)
#endif
};
#endif // __CHECKBOXAO__
|
[
"ykorokhov@pace.ca"
] |
ykorokhov@pace.ca
|
b2c49b55ad13cac6dc498324b4f862618b99cc04
|
58e3add7433ba8bf9e68e2fd02b5e1ff5c075687
|
/3. Laboratorio tema de algoritmos geneticos/main.cpp
|
b42df5a2f0bea5b1adc595002351875afed517b0
|
[] |
no_license
|
Israel0806/IA-2020
|
2ce19aad57b9bba811bffa9d68f80f035bbc1670
|
1dee307c5d39a73abc69d78c7caaef6a6b1e7a59
|
refs/heads/master
| 2022-10-30T23:22:58.623054
| 2020-06-11T18:19:03
| 2020-06-11T18:19:03
| 255,120,941
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,340
|
cpp
|
#include <iostream>
#include <bits/stdc++.h>
#include <ctime>
#include <math.h>
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;
#define MAX_POPULATION 40
#define GENERATIONS 25
/*
1. Definir una representaci?n a ser usada para cada individuo de
manera que una solucion completa puede ser representada BITS
2. Definir las estrategias de substitucion, seleccion, cruzamiento y mutacion
ELEGIR LOS PADRES: Valor actual
CROSSOVER: One Point Crossover
MUTATION: Flip mutation
3. Definir la funcion de aptitud
EJECUTAR LA FUNCION f(x,y) = x^2 - 2xy + y^2
X: 0 Y: 255
MAX = 65025
4. Ajustar los siguientes parametros:
Tamanho de la poblacion: 40 individuos
Probabilidad de cruzamiento: 1.0
Probabilidad de mutacion: 0.1
Numero de generaciones: 25
*/
using namespace std;
struct Genoma {
bitset<7> valorx;
bitset<8> valory;
float aptitud;
void mutation () {
int xChanged = 0, yChanged = 0;
xChanged = rand () % 7;
yChanged = rand () % 8;
(valorx[xChanged] == 0) ? valorx.set (xChanged, 1) : valorx.set (xChanged, 0);
(valory[yChanged] == 0) ? valory.set (yChanged, 1) : valory.set (yChanged, 0);
}
};
int fitnessFunction (vector<Genoma> &gen);
bool compare_nocase (Genoma gen1, Genoma gen2);
void crossover (vector<Genoma> &gen);
vector<Genoma> proportionSelection (vector<Genoma> gen);
int showBestCase (vector<Genoma> gen);
int showPromCase (vector<Genoma> gen);
int main () {
srand (time (NULL));
int bitsX = 7, bitsY = 8;
/// generate population
//creando poblacion de X y Y
vector<Genoma> poblacion (MAX_POPULATION);
for ( int p = 0; p < MAX_POPULATION; ++p ) {
for ( int i = 0; i < bitsX; ++i )
poblacion[p].valorx[i] = rand () % 2;
for ( int i = 0; i < bitsY; ++i )
poblacion[p].valory[i] = rand () % 2;
}
int generacion = 0;
/// loop
FILE* pipe = _popen("C:/gnuplot/bin/gnuplot.exe", "w");
if (pipe != NULL)
{
fprintf(pipe, "set term win\n");
fprintf(pipe, "array A[100]\n");
fprintf(pipe, "array B[100]\n");
fprintf(pipe, "array C[100]\n");
do {
fitnessFunction (poblacion);
/// Parent selection
vector<Genoma> newPob = proportionSelection (poblacion);
/// crossover
crossover (newPob);
/// Mutation
//El 10% mutar?
for ( int i = 0; i < MAX_POPULATION * 0.1; i++ )
newPob[rand () % MAX_POPULATION].mutation ();
cout << "Generacion " << generacion << ": " << showBestCase (poblacion) << endl;
fprintf(pipe, "A[%d] = %d\n",generacion+1,generacion);
fprintf(pipe, "B[%d] = %d\n",generacion+1,showBestCase (poblacion));
fprintf(pipe, "C[%d] = %d\n",generacion+1,showPromCase (poblacion));
poblacion.clear ();
poblacion = newPob;
/// aumentar generacion
++generacion;
} while ( generacion <= GENERATIONS ); /// termination condition
cout << "Margen de error: " << ((float)showBestCase (poblacion) / 65025 * 100) -100 << "%" << endl;
fprintf(pipe, "plot sample [i=1:100] '+' using (A[i]):(B[i]) with linespoints,\\\n");
fprintf(pipe, "[i=1:100] '+' using (A[i]):(C[i]) with linespoints\n");
fprintf(pipe, "set term pngcairo\n");
fprintf(pipe, "set output \"myFile.png\"\n");
fprintf(pipe, "replot\n");
fprintf(pipe, "set term win\n");
fflush(pipe);
while(1){
}
}
else puts("Could not open the file\n");
_pclose(pipe);
return 0;
}
int showBestCase (vector<Genoma> gen) {
int index = 0;
for ( int i = 1; i < MAX_POPULATION; ++i ) {
if ( gen[index].aptitud < gen[i].aptitud )
index = i;
}
return gen[index].aptitud;
}
int showPromCase (vector<Genoma> gen) {
long index = 0;
for ( int i = 1; i < MAX_POPULATION; ++i ) {
index+=gen[i].aptitud;
}
return index/MAX_POPULATION;
}
vector<Genoma> proportionSelection (vector<Genoma> gen) {
vector<Genoma> genNuevo;
int s = fitnessFunction (gen);
int r = rand () % s;
int apuntar = 0;
for ( int i = 0; i < MAX_POPULATION; i++ ) {
while ( apuntar < r ) {
apuntar += gen[i].aptitud;
}
genNuevo.push_back (gen[i]);
apuntar = 0;
r = rand () % s;
}
return genNuevo;
}
/// metodo: cruzamiento en un punto
void crossover (vector<Genoma> &gen) {
for ( int index = 0; index < MAX_POPULATION; index += 2 ) {
int xIndex = rand () % 7;
int yIndex = rand () % 8;
for ( int i = xIndex; i < 7; ++i ) {
bitset<1> bit (gen[index + 1].valorx[i]);
gen[index].valorx[i] = gen[index + 1].valorx[i];
gen[index].valorx[i] = bit[0];
}
for ( int i = yIndex; i < 8; ++i ) {
bitset<1> bit (gen[index + 1].valorx[i]);
gen[index].valorx[i] = gen[index + 1].valorx[i];
gen[index].valorx[i] = bit[0];
}
}
}
bool compare_nocase (Genoma gen1, Genoma gen2) {
return (gen1.aptitud > gen2.aptitud);
}
/// compute fitness of all genomes
int fitnessFunction (vector<Genoma> &gen) {
int x, y, total = 0;
for ( int i = 0; i < MAX_POPULATION; ++i ) {
x = (int)gen[i].valorx.to_ulong ();
y = (int)gen[i].valory.to_ulong ();
total += gen[i].aptitud = pow (x, 2) - (2 * x * y) + pow (y, 2);
}
for ( int i = 0; i < MAX_POPULATION; i++ )
gen.push_back (gen[i]);
sort (gen.begin (), gen.end (), compare_nocase);
// gen.sort (compare_nocase);
//list<Genoma>::iterator it;
return total;
}
|
[
"noreply@github.com"
] |
Israel0806.noreply@github.com
|
49b4b36854ab73c6cd405c4b62228dc11a90bb5d
|
d10c78fd9cdd3e0cd06d1da4ec105c9d2b179b6a
|
/build/VisualStudio/AIPU/ForceSensor.h
|
620ccc34189f599b72a29782614c08c8d28c5311
|
[] |
no_license
|
sleimanf/aibot
|
95768573e65d99fd7b9c6f1cab9e57a4c6285677
|
a1c31ba89f60d54aedbbb5706e2905214fb22881
|
refs/heads/master
| 2020-05-28T08:58:36.239013
| 2014-09-01T21:39:31
| 2014-09-01T21:39:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 121
|
h
|
#pragma once
class ForceSensor
{
int Force;
public:
ForceSensor();
~ForceSensor();
bool setCurrentSensorValue();
};
|
[
"hadiesper@gmail.com"
] |
hadiesper@gmail.com
|
fdbe0397e3b64fd79912fe8d8cbcbca1e5d0bdba
|
85266696a160174b0a0708233fb6f0270bc8d7d7
|
/eos/utils/concrete-cacheable-observable.hh
|
2bd48c06131bb291bf98d96365502407d02fd7b3
|
[] |
no_license
|
dvandyk/eos
|
0596bdf978340043081b296f7d90fdb2e5a75fac
|
5e3f68989713078d010e0451bcb0049032dba6e8
|
refs/heads/master
| 2023-08-25T04:24:51.590382
| 2021-04-08T10:09:44
| 2021-05-25T14:19:00
| 46,611,195
| 0
| 1
| null | 2020-03-18T13:43:13
| 2015-11-21T10:39:59
|
C++
|
UTF-8
|
C++
| false
| false
| 13,560
|
hh
|
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
* Copyright (c) 2021 Danny van Dyk
*
* This file is part of the EOS project. EOS is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
* Public License version 2, as published by the Free Software Foundation.
*
* EOS 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., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EOS_GUARD_SRC_UTILS_CONCRETE_CACHEABLE_OBSERVABLE_HH
#define EOS_GUARD_SRC_UTILS_CONCRETE_CACHEABLE_OBSERVABLE_HH 1
#include <eos/observable-impl.hh>
#include <eos/utils/apply.hh>
#include <eos/utils/join.hh>
#include <eos/utils/tuple-maker.hh>
#include <eos/utils/wrapped_forward_iterator-impl.hh>
#include <array>
#include <functional>
#include <string>
namespace eos
{
template <typename Decay_, typename ... Args_>
class ConcreteCacheableObservable;
template <typename Decay_, typename ... Args_>
class ConcreteCachedObservable :
public Observable
{
private:
QualifiedName _name;
Parameters _parameters;
Kinematics _kinematics;
Options _options;
std::shared_ptr<Decay_> _decay;
const typename Decay_::IntermediateResult * _intermediate_result;
std::function<const typename Decay_::IntermediateResult * (const Decay_ *, const Args_ & ...)> _prepare_fn;
std::function<double (const Decay_ *, const typename Decay_::IntermediateResult *)> _evaluate_fn;
std::tuple<typename impl::ConvertTo<Args_, const char *>::Type ...> _kinematics_names;
public:
ConcreteCachedObservable(const QualifiedName & name,
const Parameters & parameters,
const Kinematics & kinematics,
const Options & options,
const std::shared_ptr<Decay_> & decay,
const typename Decay_::IntermediateResult * intermediate_result,
const std::function<const typename Decay_::IntermediateResult * (const Decay_ *, const Args_ & ...)> & prepare_fn,
const std::function<double (const Decay_ *, const typename Decay_::IntermediateResult *)> & evaluate_fn,
const std::tuple<typename impl::ConvertTo<Args_, const char *>::Type ...> & kinematics_names) :
_name(name),
_parameters(parameters),
_kinematics(kinematics),
_options(options),
_decay(decay),
_intermediate_result(intermediate_result),
_prepare_fn(prepare_fn),
_evaluate_fn(evaluate_fn),
_kinematics_names(kinematics_names)
{
uses(*_decay);
}
~ConcreteCachedObservable() = default;
virtual const QualifiedName & name() const
{
return _name;
}
virtual double evaluate() const
{
return _evaluate_fn(_decay.get(), _intermediate_result);
};
virtual Parameters parameters()
{
return _parameters;
};
virtual Kinematics kinematics()
{
return _kinematics;
};
virtual Options options()
{
return _options;
}
virtual ObservablePtr clone() const
{
return ObservablePtr(new ConcreteCacheableObservable<Decay_, Args_ ...>(_name, _parameters.clone(), _kinematics.clone(), _options, _prepare_fn, _evaluate_fn, _kinematics_names));
}
virtual ObservablePtr clone(const Parameters & parameters) const
{
return ObservablePtr(new ConcreteCacheableObservable<Decay_, Args_ ...>(_name, parameters, _kinematics.clone(), _options, _prepare_fn, _evaluate_fn, _kinematics_names));
}
};
template <typename Decay_, typename ... Args_>
class ConcreteCacheableObservable :
public CacheableObservable
{
private:
QualifiedName _name;
Parameters _parameters;
Kinematics _kinematics;
Options _options;
std::shared_ptr<Decay_> _decay;
std::function<const typename Decay_::IntermediateResult * (const Decay_ *, const Args_ & ...)> _prepare_fn;
std::function<double (const Decay_ *, const typename Decay_::IntermediateResult *)> _evaluate_fn;
std::tuple<typename impl::ConvertTo<Args_, const char *>::Type ...> _kinematics_names;
std::tuple<const Decay_ *, typename impl::ConvertTo<Args_, KinematicVariable>::Type ...> _argument_tuple;
public:
ConcreteCacheableObservable(const QualifiedName & name,
const Parameters & parameters,
const Kinematics & kinematics,
const Options & options,
const std::function<const typename Decay_::IntermediateResult * (const Decay_ *, const Args_ & ...)> & prepare_fn,
const std::function<double (const Decay_ *, const typename Decay_::IntermediateResult *)> & evaluate_fn,
const std::tuple<typename impl::ConvertTo<Args_, const char *>::Type ...> & kinematics_names) :
_name(name),
_parameters(parameters),
_kinematics(kinematics),
_options(options),
_decay(new Decay_(parameters, options)),
_prepare_fn(prepare_fn),
_evaluate_fn(evaluate_fn),
_kinematics_names(kinematics_names),
_argument_tuple(impl::TupleMaker<sizeof...(Args_)>::make(_kinematics, _kinematics_names, _decay.get()))
{
uses(*_decay);
}
~ConcreteCacheableObservable() = default;
virtual const QualifiedName & name() const
{
return _name;
}
virtual double evaluate() const
{
std::tuple<const Decay_ *, typename impl::ConvertTo<Args_, double>::Type ...> values = _argument_tuple;
const typename Decay_::IntermediateResult * intermediate_result = apply(_prepare_fn, values);
return _evaluate_fn(_decay.get(), intermediate_result);
};
virtual const CacheableObservable::IntermediateResult * prepare() const
{
std::tuple<const Decay_ *, typename impl::ConvertTo<Args_, double>::Type ...> values = _argument_tuple;
return apply(_prepare_fn, values);
}
virtual double evaluate(const CacheableObservable::IntermediateResult * intermediate_result) const
{
return _evaluate_fn(_decay.get(), static_cast<const typename Decay_::IntermediateResult *>(intermediate_result));
}
virtual Parameters parameters()
{
return _parameters;
};
virtual Kinematics kinematics()
{
return _kinematics;
};
virtual Options options()
{
return _options;
}
virtual ObservablePtr make_cached_observable(const CacheableObservable * _other) const
{
auto other = dynamic_cast<decltype(this)>(_other);
if (nullptr == other)
return { nullptr };
if (other->_parameters != this->_parameters)
return { nullptr };
if (other->_kinematics != this->_kinematics)
return { nullptr };
if (other->_options != this->_options)
return { nullptr };
/*
* The values tuple contains a pointer to the Decay_ object, which owns the persistent pointer
* to the intermediate result. We make sure to use _other->_argument tuples, to ensure that
* the correct pointer to the intermediate result is used.
*/
std::tuple<const Decay_ *, typename impl::ConvertTo<Args_, double>::Type ...> values = other->_argument_tuple;
return ObservablePtr(new ConcreteCachedObservable<Decay_, Args_ ...>(_name, _parameters, _kinematics, _options, other->_decay, apply(other->_prepare_fn, values), _prepare_fn, _evaluate_fn, _kinematics_names));
}
virtual ObservablePtr clone() const
{
return ObservablePtr(new ConcreteCacheableObservable(_name, _parameters.clone(), _kinematics.clone(), _options, _prepare_fn, _evaluate_fn, _kinematics_names));
}
virtual ObservablePtr clone(const Parameters & parameters) const
{
return ObservablePtr(new ConcreteCacheableObservable(_name, parameters, _kinematics.clone(), _options, _prepare_fn, _evaluate_fn, _kinematics_names));
}
};
template <typename Decay_, typename ... Args_>
class ConcreteCacheableObservableEntry :
public ObservableEntry
{
private:
QualifiedName _name;
std::string _latex;
std::function<const typename Decay_::IntermediateResult * (const Decay_ *, const Args_ & ...)> _prepare_fn;
std::function<double (const Decay_ *, const typename Decay_::IntermediateResult *)> _evaluate_fn;
std::tuple<typename impl::ConvertTo<Args_, const char *>::Type ...> _kinematics_names;
std::array<const std::string, sizeof...(Args_)> _kinematics_names_array;
Options _forced_options;
public:
ConcreteCacheableObservableEntry(const QualifiedName & name, const std::string & latex,
const std::function<const typename Decay_::IntermediateResult * (const Decay_ *, const Args_ & ...)> & prepare_fn,
const std::function<double (const Decay_ *, const typename Decay_::IntermediateResult *)> & evaluate_fn,
const std::tuple<typename impl::ConvertTo<Args_, const char *>::Type ...> & kinematics_names,
const Options & forced_options) :
_name(name),
_latex(latex),
_prepare_fn(prepare_fn),
_evaluate_fn(evaluate_fn),
_kinematics_names(kinematics_names),
_kinematics_names_array(impl::make_array<const std::string>(kinematics_names)),
_forced_options(forced_options)
{
}
~ConcreteCacheableObservableEntry()
{
}
virtual const QualifiedName & name() const
{
return _name;
}
virtual const std::string & latex() const
{
return _latex;
}
virtual ObservableEntry::KinematicVariableIterator begin_kinematic_variables() const
{
return _kinematics_names_array.begin();
}
virtual ObservableEntry::KinematicVariableIterator end_kinematic_variables() const
{
return _kinematics_names_array.end();
}
virtual ObservablePtr make(const Parameters & parameters, const Kinematics & kinematics, const Options & options) const
{
return ObservablePtr(new ConcreteCacheableObservable<Decay_, Args_ ...>(_name, parameters, kinematics, options + _forced_options, _prepare_fn, _evaluate_fn, _kinematics_names));
}
virtual std::ostream & insert(std::ostream & os) const
{
os << " type: cacheable observable" << std::endl;
if (sizeof...(Args_) > 0)
{
os << " kinematic variables: " << join(std::begin(_kinematics_names_array), std::end(_kinematics_names_array)) << std::endl;
}
return os;
}
};
template <typename Decay_, typename Tuple_, typename ... Args_>
ObservableEntryPtr make_concrete_cacheable_observable_entry(const QualifiedName & name, const std::string & latex,
const typename Decay_::IntermediateResult * (Decay_::* prepare_fn)(const Args_ & ...) const,
double (Decay_::* evaluate_fn)(const typename Decay_::IntermediateResult *) const,
const Tuple_ & kinematics_names,
const Options & forced_options)
{
static_assert(sizeof...(Args_) == impl::TupleSize<Tuple_>::size, "Need as many function arguments as kinematics names!");
return std::make_shared<ConcreteCacheableObservableEntry<Decay_, Args_ ...>>(name, latex,
std::function<const typename Decay_::IntermediateResult * (const Decay_ *, const Args_ & ...)>(std::mem_fn(prepare_fn)),
std::function<double (const Decay_ *, const typename Decay_::IntermediateResult *)>(std::mem_fn(evaluate_fn)),
kinematics_names, forced_options);
}
}
#endif
|
[
"danny.van.dyk@gmail.com"
] |
danny.van.dyk@gmail.com
|
58d49d145753a209805b7d5afa1fd18fb5135bfc
|
a9c12a1da0794eaf9a1d1f37ab5c404e3b95e4ec
|
/CTPServer/CTPPositionUpdated.cpp
|
3e2e55bdc51df8ed7415aed8e61641b076372a98
|
[] |
no_license
|
shzdtech/FutureXPlatform
|
37d395511d603a9e92191f55b8f8a6d60e4095d6
|
734cfc3c3d2026d60361874001fc20f00e8bb038
|
refs/heads/master
| 2021-03-30T17:49:22.010954
| 2018-06-19T13:21:53
| 2018-06-19T13:21:53
| 56,828,437
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,731
|
cpp
|
#include "CTPPositionUpdated.h"
#include "CTPUtility.h"
#include "CTPMapping.h"
#include "CTPConstant.h"
#include "../message/MessageUtility.h"
#include "CTPTradeWorkerProcessor.h"
#include "CTPWorkerProcessorID.h"
#include "../litelogger/LiteLogger.h"
#include "../dataobject/OrderDO.h"
#include "../message/DefMessageID.h"
#include "CTPAPISwitch.h"
dataobj_ptr CTPPositionUpdated::HandleResponse(const uint32_t serialId, const param_vector& rawRespParams, IRawAPI* rawAPI, const IMessageProcessor_Ptr& msgProcessor, const IMessageSession_Ptr& session)
{
if (auto pData = (CThostFtdcInvestorPositionField*)rawRespParams[0])
{
if (auto pWorkerProc = MessageUtility::WorkerProcessorPtr<CTPTradeWorkerProcessorBase>(msgProcessor))
{
auto& userId = session->getUserInfo().getUserId();
auto position_ptr = CTPUtility::ParseRawPosition(pData, userId);
LOG_DEBUG << pData->InstrumentID << ',' << pData->PositionDate << ',' << pData->PosiDirection;
pWorkerProc->UpdateSysYdPosition(userId, position_ptr);
if (!pWorkerProc->IsLoadPositionFromDB())
{
if (position_ptr->ExchangeID() == EXCHANGE_SHFE)
{
if (pData->PositionDate == THOST_FTDC_PSD_Today)
{
position_ptr = pWorkerProc->GetUserPositionContext()->UpsertPosition(userId, *position_ptr, false, false);
}
else
{
position_ptr = pWorkerProc->GetUserPositionContext()->UpsertPosition(userId, *position_ptr, true, false);
}
}
else
{
position_ptr = pWorkerProc->GetUserPositionContext()->UpsertPosition(userId, *position_ptr, false, true);
}
if (position_ptr)
pWorkerProc->DispatchUserMessage(MSG_ID_POSITION_UPDATED, 0, userId, position_ptr);
}
}
}
return nullptr;
}
|
[
"rainmilk@gmail.com"
] |
rainmilk@gmail.com
|
e936d997c65d00067631eb971a0b7d7205676fe4
|
8908b42d07771a4c50d1adae1b13481b55d6c189
|
/ConsoleJanken/StatePrepare.h
|
f786aa2f7ac38416d57a910754fd69dd9a217d62
|
[] |
no_license
|
haraki/ConsoleJanken
|
6010630647c7586138bc18107d040ff7e9e7f7bf
|
e0802f91e0b6fed18d377a570dd6ab42c347b747
|
refs/heads/master
| 2021-01-22T09:09:08.861952
| 2014-05-19T17:41:05
| 2014-05-19T17:41:05
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 803
|
h
|
//
// StatePrepare.h
// ConsoleJanken
//
// Created by 原木 正志 on 2014/04/23.
// Copyright (c) 2014年 Masashi Haraki. All rights reserved.
//
#ifndef __ConsoleJanken__StatePrepare__
#define __ConsoleJanken__StatePrepare__
#include <iostream>
#include "StateMachine.h"
class StatePrepare : public StateMachine, public SingletonState <StatePrepare>
{
public:
StatePrepare();
~StatePrepare();
int entry();
int execute();
int exit();
int eventFrame(StateContext& context, const Leap::Controller& controller);
int eventHandLost(StateContext& context, const Leap::Controller& controller);
int eventDisconnect(StateContext& context, const Leap::Controller& controller);
private:
int m_count;
};
#endif /* defined(__ConsoleJanken__StatePrepare__) */
|
[
"masa.haraki@gmail.com"
] |
masa.haraki@gmail.com
|
ddfafa69c173a85c8ed0fd583f3f6b2a79a43044
|
987adde7bd3455da593f0201b4fe0437f65b5f27
|
/src/BackEnd/IRGeneration/NameBuilder.cpp
|
fecadeada32f0c321f4c4f65ae656ba82a1057b6
|
[] |
no_license
|
xcode2010/KawaCompiler
|
d502ca2b290d8443753bb18815dcd696715baffc
|
3c1b37f86e46084d6d43bbd6771b98808006135d
|
refs/heads/master
| 2021-12-05T15:16:56.765143
| 2015-06-30T08:16:00
| 2015-06-30T08:16:00
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,100
|
cpp
|
/**
* Creator Hichara
*/
#include "NameBuilder.h"
std::string NameBuilder::buildFunctionName(std::string className,
std::string name,
std::string ret_type,
std::vector<std::string> list_type,
bool isStatic) {
std::stringstream result;
std::string tmp;
if(className == "")
return "";
if(name == "")
return "";
if(isStatic)
result << KawaEnumeration::STATIC << "_";
result << className << '.' << name << "_rt_";
result << strToKawaType(ret_type);
result << "_pt_";
if (list_type.size() == 0) {
result << "_" << KawaEnumeration::KAWA_VOID;
result.str();
}
for(std::vector<std::string>::iterator it = list_type.begin();
it != list_type.end(); ++it) {
tmp = strToKawaType((*it));;
if(tmp == "")
return "";
result << "_" << tmp;
}
return result.str();
}
std::string buidClassAdHocTableIndex(std::string className) {
std::stringstream res;
res << className << "_adHoc_index";
return res.str();
}
std::string NameBuilder::buildConstructorName(std::string className,
std::vector<std::string> list_type) {
std::string tmp;
std::stringstream result;
if(className == "")
return "";
result << KawaEnumeration::CONSTRUCTOR_PREFIX << className;
if (list_type.size() == 0) {
result << "_pt_" << KawaEnumeration::KAWA_VOID;
return result.str();
}
for(int i = 0; i < list_type.size(); i++) {
tmp = strToKawaType(list_type[i]);
result << "_pt_" << tmp;
}
return result.str();
}
std::string NameBuilder::buildSubConstructorName(std::string className,
std::vector<std::string> list_type) {
std::string tmp;
std::stringstream result;
if(className == "")
return "";
result << KawaEnumeration::SUB_CONSTRUCTOR_PREFIX << className;
if (list_type.size() == 0) {
result << "_pt_" << KawaEnumeration::KAWA_VOID;
return result.str();
}
for(int i = 0; i < list_type.size(); i++) {
tmp = strToKawaType(list_type[i]);
result << "_pt_" << tmp;
}
return result.str();
}
// L'index est suceptible d'etre le meme pour toute les tables issues de la meme famille
std::string NameBuilder::buildFunctionIndexName(std::string functionBuiltName) {
std::stringstream res;
res << KawaEnumeration::METHODE_INDEX_PREFIX << functionBuiltName;
return res.str();
}
std::string NameBuilder::buildAdHocTableName(std::string classStatic,
std::string classDynamique) {
if(classStatic == "" || classDynamique == "")
return "";
std::stringstream res;
res << KawaEnumeration::ADHOCTABLE_PREFIX << "_" << classStatic << "_" << classDynamique;
return res.str();
}
std::string NameBuilder::buildgetAdHocTableFunction(std::string staticC, std::string dynamicC) {
std::stringstream res;
res << "get_table_" << buildAdHocTableName(staticC, dynamicC);
return res.str();
}
std::string NameBuilder::buildAttributIndexName(std::string className, std::string name) {
std::stringstream res;
res << KawaEnumeration::ATTRIBUT_INDEX_PREFIX << "_" << className << "_" << name;
return res.str();
}
std::string NameBuilder::buildStaticVariableName(std::string className,
std::string name) {
std::stringstream res;
res << KawaEnumeration::STATIC << "_" << className << "_" << name;
return res.str();
}
std::string NameBuilder::buildClassTypeName(std::string className) {
if(className == "")
return "";
std::stringstream result;
result << KawaEnumeration::KAWA_CLASS_PREFIX << className;
return result.str();
}
std::string NameBuilder::buildClassStructTypeName(std::string className) {
if(className == "")
return "";
std::stringstream res;
res << KawaEnumeration::KAWA_CLASS_STRUCT_PREFIX << className;
return res.str();
}
std::string NameBuilder::strToKawaType(std::string type) {
std::stringstream result;
if(type == KawaEnumeration::FLOAT)
result << KawaEnumeration::KAWA_FLOAT;
else if(type == KawaEnumeration::INT)
result << KawaEnumeration::KAWA_INT;
else if(type == KawaEnumeration::CHAR)
result << KawaEnumeration::KAWA_CHAR;
else if(type == KawaEnumeration::DOUBLE)
result << KawaEnumeration::KAWA_DOUBLE;
else if(type == KawaEnumeration::STRING)
result << KawaEnumeration::KAWA_STRING;
else
result << buildClassTypeName(type);
return result.str();
}
std::string NameBuilder::StructNameToClass(std::string n) {
return n.substr(KawaEnumeration::KAWA_CLASS_PREFIX.length());
}
std::string NameBuilder::LLVMTypeToStr(Type* type) {
LLVMContext &c = type->getContext();
if(type == (Type*)Type::getInt32Ty(c))
return KawaEnumeration::KAWA_INT;
if(type == (Type*)Type::getInt8Ty(c))
return KawaEnumeration::KAWA_CHAR;
if(type == (Type*)Type::getVoidTy(c))
return KawaEnumeration::KAWA_VOID;
if(type == (Type*)Type::getFloatTy(c))
return KawaEnumeration::KAWA_FLOAT;
if(type == (Type*)Type::getDoubleTy(c))
return KawaEnumeration::KAWA_DOUBLE;
if(type == (Type*)Type::getInt8PtrTy(c))
return KawaEnumeration::KAWA_STRING;
if(type->isStructTy())
return KawaEnumeration::KAWA_CLASS_PREFIX + (type->getStructName()).str();
return "";
}
|
[
"adjibi004@gmail.com"
] |
adjibi004@gmail.com
|
8df8a5d86044cf10b9a089e194a574476060d8d5
|
50fe9e19ff85b0d3266f4fa186185ef72fe017ba
|
/index.ino
|
65a23647de3086e3397fad69787733a272f08130
|
[] |
no_license
|
Eduardo-LP/Cubo_de_Leds
|
df69bfa4c3e291a49cb5f6fdcb9f72fc3c255463
|
02fac057cb3ff51bbfdf611e37496ed8538d986c
|
refs/heads/master
| 2020-08-31T11:45:27.465036
| 2019-10-31T15:31:57
| 2019-10-31T15:31:57
| 218,683,031
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,997
|
ino
|
int D = 8;
int CLK = 9;
int E = 10;
void setup()
{
pinMode(D, OUTPUT);
pinMode(CLK, OUTPUT);
pinMode(E, OUTPUT);
}
void funcaoPadrao(int P, int Q ){
digitalWrite(E, LOW);
shiftOut(D, CLK, MSBFIRST, P);
shiftOut(D, CLK, MSBFIRST, Q);
digitalWrite(E, HIGH);
delay(500);
}
void efeito1(){
funcaoPadrao(0xFF, 0xB0);
funcaoPadrao(0xFF, 0xE0);
}
void efeito2(){
funcaoPadrao(0xE0, 0x70);
funcaoPadrao(0x1C, 0x70);
funcaoPadrao(0x03, 0xF0);
funcaoPadrao(0x1C, 0x70);
}
void efeito3(){
//----------------------------vai pra primeira fila----------------------------------------------------
funcaoPadrao(0x00, 0x90);
funcaoPadrao(0x01, 0x10);
funcaoPadrao(0x02, 0x10);
funcaoPadrao(0x10, 0x10);
funcaoPadrao(0x80, 0x10);
funcaoPadrao(0x40, 0x10);
funcaoPadrao(0x20, 0x10);
funcaoPadrao(0x04, 0x10);
//-----------------------------vai pra segunda fila---------------------------------------------------
funcaoPadrao(0x00, 0xA0);
funcaoPadrao(0x01, 0x20);
funcaoPadrao(0x02, 0x20);
funcaoPadrao(0x10, 0x20);
funcaoPadrao(0x80, 0x20);
funcaoPadrao(0x40, 0x20);
funcaoPadrao(0x20, 0x20);
funcaoPadrao(0x04, 0x20);
//--------------------------vai pra terceira fila----------------------------------------------------------
funcaoPadrao(0x00, 0xC0);
funcaoPadrao(0x01, 0x40);
funcaoPadrao(0x02, 0x40);
funcaoPadrao(0x10, 0x40);
funcaoPadrao(0x80, 0x40);
funcaoPadrao(0x40, 0x40);
funcaoPadrao(0x20, 0x40);
funcaoPadrao(0x04, 0x40);
//-------------------volta pelo meio---------------------------------------------------------------------
funcaoPadrao(0x08, 0x40);
funcaoPadrao(0x08, 0x20);
funcaoPadrao(0x08, 0x10);
}
void loop()
{
for(int i = 0; i <= 20; i++){
efeito1();
}
for(int i = 0; i <= 10; i++){
efeito2();
}
for(int i = 0; i <= 10; i++){
efeito3();
}
}
|
[
"noreply@github.com"
] |
Eduardo-LP.noreply@github.com
|
3823170ca2526b7b1618b236d6bca0edf090a2d9
|
3e69b159d352a57a48bc483cb8ca802b49679d65
|
/tags/release-2005-10-27/pcbnew/netlist.cpp
|
7707b586004638238f618260d1327606a22517e2
|
[] |
no_license
|
BackupTheBerlios/kicad-svn
|
4b79bc0af39d6e5cb0f07556eb781a83e8a464b9
|
4c97bbde4b1b12ec5616a57c17298c77a9790398
|
refs/heads/master
| 2021-01-01T19:38:40.000652
| 2006-06-19T20:01:24
| 2006-06-19T20:01:24
| 40,799,911
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 31,012
|
cpp
|
/************************************/
/* PCBNEW: traitement des netlistes */
/************************************/
/* Fichier NETLIST.CPP */
/*
Fonction de lecture de la netliste pour:
- Chargement modules et nouvelles connexions
- Test des modules (modules manquants ou en trop
- Recalcul du chevelu
Remarque importante:
Lors de la lecture de la netliste pour Chargement modules
et nouvelles connexions, l'identification des modules peut se faire selon
2 criteres:
- la reference (U2, R5 ..): c'est le mode normal
- le Time Stamp (Signature Temporelle), a utiliser apres reannotation
d'un schema, donc apres modification des references sans pourtant
avoir reellement modifie le schema
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#include "autorout.h"
#include "protos.h"
#define TESTONLY 1 /* ctes utilisees lors de l'appel a */
#define READMODULE 0 /* ReadNetModuleORCADPCB */
/* Structures locales */
class MODULEtoLOAD : public EDA_BaseStruct
{
public:
wxString m_LibName;
wxString m_CmpName;
public:
MODULEtoLOAD(const wxString & libname, const wxString & cmpname, int timestamp);
~MODULEtoLOAD(void){};
MODULEtoLOAD * Next(void) { return (MODULEtoLOAD *) Pnext; }
};
/* Fonctions locales : */
static void SortListModulesToLoadByLibname(int NbModules);
/* Variables locales */
static int s_NbNewModules;
static MODULEtoLOAD * s_ModuleToLoad_List;
FILE * source;
static bool ChangeExistantModule;
static bool DisplayWarning = TRUE;
static int DisplayWarningCount ;
/*****************************/
/* class WinEDA_NetlistFrame */
/*****************************/
enum id_netlist_functions
{
ID_READ_NETLIST_FILE = 1900,
ID_TEST_NETLIST,
ID_CLOSE_NETLIST,
ID_COMPILE_RATSNEST,
ID_OPEN_NELIST
};
class WinEDA_NetlistFrame: public wxDialog
{
private:
WinEDA_PcbFrame * m_Parent;
wxDC * m_DC;
wxRadioBox * m_Select_By_Timestamp;
wxRadioBox * m_DeleteBadTracks;
wxRadioBox * m_ChangeExistantModuleCtrl;
wxCheckBox * m_DisplayWarningCtrl;
wxTextCtrl * m_MessageWindow;
public:
// Constructor and destructor
WinEDA_NetlistFrame(WinEDA_PcbFrame *parent, wxDC * DC, const wxPoint & pos);
~WinEDA_NetlistFrame(void)
{
}
private:
void OnQuit(wxCommandEvent& event);
void ReadPcbNetlist(wxCommandEvent& event);
void Set_NetlisteName(wxCommandEvent& event);
bool OpenNetlistFile(wxCommandEvent& event);
int BuildListeNetModules(wxCommandEvent& event, char * BufName);
void ModulesControle(wxCommandEvent& event);
void RecompileRatsnest(wxCommandEvent& event);
int ReadListeModules(const char * RefCmp, int TimeStamp, char * NameModule);
int SetPadNetName( char * Line, MODULE * Module);
MODULE * ReadNetModule( char * Text,
int * UseFichCmp, int TstOnly);
void AddToList(const char * NameLibCmp, const char * NameCmp,int TimeStamp );
void LoadListeModules(wxDC *DC);
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(WinEDA_NetlistFrame, wxDialog)
EVT_BUTTON(ID_READ_NETLIST_FILE, WinEDA_NetlistFrame::ReadPcbNetlist)
EVT_BUTTON(ID_CLOSE_NETLIST, WinEDA_NetlistFrame::OnQuit)
EVT_BUTTON(ID_OPEN_NELIST, WinEDA_NetlistFrame::Set_NetlisteName)
EVT_BUTTON(ID_TEST_NETLIST, WinEDA_NetlistFrame::ModulesControle)
EVT_BUTTON(ID_COMPILE_RATSNEST, WinEDA_NetlistFrame::RecompileRatsnest)
END_EVENT_TABLE()
/*************************************************************************/
void WinEDA_PcbFrame::InstallNetlistFrame( wxDC * DC, const wxPoint & pos)
/*************************************************************************/
{
WinEDA_NetlistFrame * frame = new WinEDA_NetlistFrame(this, DC, pos);
frame->ShowModal(); frame->Destroy();
}
/******************************************************************/
WinEDA_NetlistFrame::WinEDA_NetlistFrame(WinEDA_PcbFrame *parent,
wxDC * DC, const wxPoint & framepos):
wxDialog(parent, -1, "", framepos, wxSize(-1, -1),
DIALOG_STYLE)
/******************************************************************/
{
wxPoint pos;
wxString number;
wxString title;
wxButton * Button;
m_Parent = parent;
SetFont(*g_DialogFont);
m_DC = DC;
Centre();
/* Mise a jour du Nom du fichier NETLISTE correspondant */
NetNameBuffer = m_Parent->m_CurrentScreen->m_FileName;
ChangeFileNameExt(NetNameBuffer, NetExtBuffer);
title = _("Netlist: ") + NetNameBuffer;
SetTitle(title);
/* Creation des boutons de commande */
pos.x = 170; pos.y = 10;
Button = new wxButton(this, ID_OPEN_NELIST,
_("Select"), pos);
Button->SetForegroundColour(*wxRED);
pos.y += Button->GetDefaultSize().y + 10;
Button = new wxButton(this, ID_READ_NETLIST_FILE,
_("Read"), pos);
Button->SetForegroundColour(wxColor(0,80,0) );
pos.y += Button->GetDefaultSize().y + 10;
Button = new wxButton(this, ID_TEST_NETLIST,
_("Module Test"), pos);
Button->SetForegroundColour(wxColor(0,80,80) );
pos.y += Button->GetDefaultSize().y + 10;
Button = new wxButton(this, ID_COMPILE_RATSNEST,
_("Compile"), pos);
Button->SetForegroundColour(wxColor(0,0,80) );
pos.y += Button->GetDefaultSize().y + 10;
Button = new wxButton(this, ID_CLOSE_NETLIST,
_("Close"), pos);
Button->SetForegroundColour(*wxBLUE);
// Options:
wxString opt_select[2] = { _("Reference"), _("Timestamp") };
pos.x = 15; pos.y = 10;
m_Select_By_Timestamp = new wxRadioBox( this, -1, _("Module Selection:"),
pos, wxDefaultSize, 2, opt_select, 1);
wxString track_select[2] = { _("Keep"), _("Delete") };
int x, y;
m_Select_By_Timestamp->GetSize(&x, &y);
pos.y += 5 + y;
m_DeleteBadTracks = new wxRadioBox(this, -1, _("Bad Tracks Deletion:"),
pos, wxDefaultSize, 2, track_select, 1);
m_DeleteBadTracks->GetSize(&x, &y);
pos.y += 5 + y;
wxString change_module_select[2] = { _("Keep"), _("Change") };
m_ChangeExistantModuleCtrl = new wxRadioBox(this, -1, _("Exchange Module:"),
pos, wxDefaultSize, 2, change_module_select, 1);
m_ChangeExistantModuleCtrl->GetSize(&x, &y);
pos.y += 15 + y;
m_DisplayWarningCtrl = new wxCheckBox(this, -1, _("Display Warnings"), pos);
m_DisplayWarningCtrl->SetValue(DisplayWarning);
m_DisplayWarningCtrl->GetSize(&x, &y);
pos.x = 5; pos.y += 10 + y;
m_MessageWindow = new wxTextCtrl(this, -1, "",
pos, wxSize(265, 120),wxTE_READONLY|wxTE_MULTILINE);
m_MessageWindow->GetSize(&x, &y);
pos.y += 10 + y;
SetClientSize(280, pos.y);
}
/**********************************************************************/
void WinEDA_NetlistFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
/**********************************************************************/
{
// true is to force the frame to close
Close(true);
}
/*****************************************************************/
void WinEDA_NetlistFrame::RecompileRatsnest(wxCommandEvent& event)
/*****************************************************************/
{
m_Parent->Compile_Ratsnest(m_DC, TRUE);
}
/***************************************************************/
bool WinEDA_NetlistFrame::OpenNetlistFile(wxCommandEvent& event)
/***************************************************************/
/*
routine de selection et d'ouverture du fichier Netlist
*/
{
wxString FullFileName;
wxString msg;
if( NetNameBuffer == "" ) /* Pas de nom specifie */
Set_NetlisteName(event);
if( NetNameBuffer == "" ) return(FALSE); /* toujours Pas de nom specifie */
FullFileName = NetNameBuffer;
source = fopen(FullFileName.GetData(),"rt");
if (source == 0)
{
msg.Printf(_("Netlist file %s not found"),FullFileName.GetData()) ;
DisplayError(this, msg) ;
return FALSE ;
}
msg.Printf("Netlist %s",FullFileName.GetData());
SetTitle(msg);
return TRUE;
}
/**************************************************************/
void WinEDA_NetlistFrame::ReadPcbNetlist(wxCommandEvent& event)
/**************************************************************/
/* mise a jour des empreintes :
corrige les Net Names, les textes, les "TIME STAMP"
Analyse les lignes:
# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
(
( 40C08647 $noname R20 4,7K {Lib=R}
( 1 VCC )
( 2 MODB_1 )
)
( 40C0863F $noname R18 4,7_k {Lib=R}
( 1 VCC )
( 2 MODA_1 )
)
}
#End
*/
{
int LineNum, State, Comment;
MODULE * Module = NULL;
D_PAD * PtPad;
char Line[256], *Text;
int UseFichCmp = 1;
wxString msg;
ChangeExistantModule = m_ChangeExistantModuleCtrl->GetSelection() == 1 ? TRUE : FALSE;
DisplayWarning = m_DisplayWarningCtrl->GetValue();
if ( DisplayWarning ) DisplayWarningCount = 8;
else DisplayWarningCount = 0;
if( ! OpenNetlistFile(event) ) return;
msg = _("Read Netlist ") + NetNameBuffer;
m_MessageWindow->AppendText(msg);
m_Parent->m_CurrentScreen->SetModify();
m_Parent->m_Pcb->m_Status_Pcb = 0 ; State = 0; LineNum = 0; Comment = 0;
s_NbNewModules = 0;
/* Premiere lecture de la netliste: etablissement de la liste
des modules a charger
*/
while( GetLine( source, Line, &LineNum) )
{
Text = StrPurge(Line);
if ( Comment ) /* Commentaires en cours */
{
if( (Text = strchr(Text,'}') ) == NULL )continue;
Comment = 0;
}
if ( *Text == '{' ) /* Commentaires */
{
Comment = 1;
if( (Text = strchr(Text,'}') ) == NULL ) continue;
}
if ( *Text == '(' ) State++;
if ( *Text == ')' ) State--;
if( State == 2 )
{
Module = ReadNetModule(Text, & UseFichCmp, TESTONLY);
continue;
}
if( State >= 3 ) /* la ligne de description d'un pad est ici non analysee */
{
State--;
}
}
/* Chargement des nouveaux modules */
if( s_NbNewModules )
{
LoadListeModules(m_DC);
// Free module list:
MODULEtoLOAD * item, *next_item;
for ( item = s_ModuleToLoad_List; item != NULL; item = next_item )
{
next_item = item->Next();
delete item;
}
s_ModuleToLoad_List = NULL;
}
/* Relecture de la netliste, tous les modules sont ici charges */
fseek(source, 0, SEEK_SET); LineNum = 0;
while( GetLine( source, Line, &LineNum) )
{
Text = StrPurge(Line);
if ( Comment ) /* Commentaires en cours */
{
if( (Text = strchr(Text,'}') ) == NULL )continue;
Comment = 0;
}
if ( *Text == '{' ) /* Commentaires */
{
Comment = 1;
if( (Text = strchr(Text,'}') ) == NULL ) continue;
}
if ( *Text == '(' ) State++;
if ( *Text == ')' ) State--;
if( State == 2 )
{
Module = ReadNetModule(Text, & UseFichCmp, READMODULE );
if( Module == NULL )
{ /* empreinte non trouvee dans la netliste */
continue ;
}
else /* Raz netnames sur pads */
{
PtPad = Module->m_Pads;
for( ; PtPad != NULL; PtPad = (D_PAD *)PtPad->Pnext )
{
PtPad->m_Netname = "";
}
}
continue;
}
if( State >= 3 )
{
if ( Module )
{
SetPadNetName( Text, Module);
}
State--;
}
}
fclose(source);
/* Mise a jour et Cleanup du circuit imprime: */
m_Parent->Compile_Ratsnest(m_DC, TRUE);
if( m_Parent->m_Pcb->m_Track )
{
if( m_DeleteBadTracks->GetSelection() == 1 )
{
wxBeginBusyCursor();;
Netliste_Controle_piste(m_Parent, m_DC, TRUE);
m_Parent->Compile_Ratsnest(m_DC, TRUE);
wxEndBusyCursor();;
}
}
Affiche_Infos_Status_Pcb(m_Parent);
}
/****************************************************************************/
MODULE * WinEDA_NetlistFrame::ReadNetModule(char * Text, int * UseFichCmp,
int TstOnly)
/****************************************************************************/
/* charge la description d'une empreinte ,netliste type PCBNEW
et met a jour le module correspondant
Si TstOnly == 0 si le module n'existe pas, il est charge
Si TstOnly != 0 si le module n'existe pas, il est ajoute a la liste des
modules a charger
Text contient la premiere ligne de la description
* UseFichCmp est un flag
si != 0, le fichier des composants .CMP sera utilise
est remis a 0 si le fichier n'existe pas
Analyse les lignes type:
( 40C08647 $noname R20 4,7K {Lib=R}
( 1 VCC )
( 2 MODB_1 )
*/
{
MODULE * Module;
char *TextTimeStamp;
char *TextNameLibMod;
char *TextValeur;
char *TextCmpName;
int TimeStamp = -1, Error = 0;
char Line[1024], NameLibCmp[256];
bool Found;
strcpy(Line,Text);
if( (TextTimeStamp = strtok(Line, " ()\t\n")) == NULL ) Error = 1;
if( (TextNameLibMod = strtok(NULL, " ()\t\n")) == NULL ) Error = 1;
if( (TextCmpName = strtok(NULL, " ()\t\n")) == NULL ) Error = 1;
if( (TextValeur = strtok(NULL, " ()\t\n")) == NULL ) Error = 1;
if( Error ) return( NULL );
sscanf(TextTimeStamp,"%X", &TimeStamp);
/* Tst si composant deja charge */
Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
MODULE * NextModule;
for( Found = FALSE; Module != NULL; Module = NextModule )
{
NextModule = (MODULE*)Module->Pnext;
if( m_Select_By_Timestamp->GetSelection() == 1 ) /* Reconnaissance par signature temporelle */
{
if( TimeStamp == Module->m_TimeStamp) Found = TRUE;
}
else /* Reconnaissance par Reference */
{
if( stricmp(TextCmpName,Module->m_Reference->GetText()) == 0 )
Found = TRUE;
}
if ( Found ) // Test si module (m_LibRef) et module specifie en netlist concordent
{
if( TstOnly != TESTONLY )
{
strcpy(NameLibCmp, TextNameLibMod);
if( *UseFichCmp )
{
if( m_Select_By_Timestamp->GetSelection() == 1 )
{ /* Reconnaissance par signature temporelle */
*UseFichCmp = ReadListeModules(NULL, TimeStamp, NameLibCmp);
}
else /* Reconnaissance par Reference */
{
*UseFichCmp = ReadListeModules(TextCmpName, 0, NameLibCmp);
}
}
if ( stricmp(Module->m_LibRef.GetData(), NameLibCmp) != 0 )
{// Module Mismatch: Current module and module specified in netlist are diff.
if ( ChangeExistantModule )
{
MODULE * NewModule =
m_Parent->Get_Librairie_Module(this, "", NameLibCmp, TRUE);
if( NewModule ) /* Nouveau module trouve : changement de module */
Module = m_Parent->Exchange_Module(this, Module, NewModule);
}
else
{
wxString msg;
msg.Printf(
_("Cmp %s: Mismatch! module is [%s] and netlist said [%s]\n"),
TextCmpName, Module->m_LibRef.GetData(), NameLibCmp);
m_MessageWindow->AppendText(msg);
if ( DisplayWarningCount > 0)
{
DisplayError(this, msg, 2);
DisplayWarningCount--;
}
}
}
}
break;
}
}
if( Module == NULL ) /* Module a charger */
{
strcpy(NameLibCmp, TextNameLibMod);
if( *UseFichCmp )
{
if( m_Select_By_Timestamp->GetSelection() == 1)
{ /* Reconnaissance par signature temporelle */
*UseFichCmp = ReadListeModules(NULL, TimeStamp, NameLibCmp);
}
else /* Reconnaissance par Reference */
{
*UseFichCmp = ReadListeModules(TextCmpName, 0, NameLibCmp);
}
}
if( TstOnly == TESTONLY)
AddToList(NameLibCmp, TextCmpName, TimeStamp);
else
{
wxString msg;
msg.Printf(_("Componant [%s] not found"), TextCmpName);
m_MessageWindow->AppendText(msg+"\n");
if (DisplayWarningCount> 0)
{
DisplayError(this, msg, 2);
DisplayWarningCount--;
}
}
return(NULL); /* Le module n'avait pas pu etre charge */
}
/* mise a jour des reperes ( nom et ref "Time Stamp") si module charge */
Module->m_Reference->m_Text = TextCmpName;
Module->m_Value->m_Text = TextValeur;
Module->m_TimeStamp = TimeStamp;
return(Module) ; /* composant trouve */
}
/********************************************************************/
int WinEDA_NetlistFrame::SetPadNetName( char * Text, MODULE * Module)
/********************************************************************/
/*
Met a jour le netname de 1 pastille, Netliste ORCADPCB
entree :
Text = ligne de netliste lue ( (pad = net) )
Module = adresse de la structure MODULE a qui appartient les pads
*/
{
D_PAD * pad;
char * TextPinName, * TextNetName;
int Error = 0;
bool trouve;
char Line[256], Msg[80];
if( Module == NULL ) return ( 0 );
strcpy( Line, Text);
if( (TextPinName = strtok(Line, " ()\t\n")) == NULL ) Error = 1;
if( (TextNetName = strtok(NULL, " ()\t\n")) == NULL ) Error = 1;
if(Error) return(0);
/* recherche du pad */
pad = Module->m_Pads; trouve = FALSE;
for( ; pad != NULL; pad = (D_PAD *)pad->Pnext )
{
if( strnicmp( TextPinName, pad->m_Padname, 4) == 0 )
{ /* trouve */
trouve = TRUE;
if( *TextNetName != '?' ) pad->m_Netname = TextNetName;
else pad->m_Netname = "";
}
}
if( !trouve && (DisplayWarningCount > 0) )
{
sprintf(Msg,_("Module [%s]: Pad [%s] not found"),
Module->m_Reference->GetText(), TextPinName);
DisplayError(this, Msg, 1);
DisplayWarningCount--;
}
return(trouve);
}
/*****************************************************/
MODULE * WinEDA_PcbFrame::ListAndSelectModuleName(void)
/*****************************************************/
/* liste les noms des modules du PCB
Retourne:
un pointeur sur le module selectionne
NULL si pas de selection
*/
{
int ii, jj, nb_empr;
MODULE * Module;
WinEDAListBox * ListBox;
const char ** ListNames = NULL;
if( m_Pcb->m_Modules == NULL )
{
DisplayError(this, _("No Modules") ) ; return(0);
}
/* Calcul du nombre des modules */
nb_empr = 0; Module = (MODULE*)m_Pcb->m_Modules;
for( ;Module != NULL; Module = (MODULE*)Module->Pnext) nb_empr++;
ListNames = (const char**) MyZMalloc( (nb_empr + 1) * sizeof(char*) );
Module = (MODULE*) m_Pcb->m_Modules;
for( ii = 0; Module != NULL; Module = (MODULE*)Module->Pnext, ii++)
{
ListNames[ii] = Module->m_Reference->GetText();
}
ListBox = new WinEDAListBox(this, _("Componants"),
ListNames, "");
ii = ListBox->ShowModal(); ListBox->Destroy();
if( ii < 0 ) /* Pas de selection */
{
Module = NULL;
}
else /* Recherche du module selectionne */
{
Module = (MODULE*) m_Pcb->m_Modules;
for( jj = 0; Module != NULL; Module = (MODULE*)Module->Pnext, jj++)
{
if( Module->m_Reference->GetText() == ListNames[ii] ) break;
}
}
free(ListNames);
return(Module);
}
/***************************************************************/
void WinEDA_NetlistFrame::ModulesControle(wxCommandEvent& event)
/***************************************************************/
/* donne la liste :
1 - des empreintes doublées sur le PCB
2 - des empreintes manquantes par rapport a la netliste
3 - des empreintes supplémentaires par rapport a la netliste
*/
#define MAX_LEN_TXT 32
{
int ii, NbModulesPcb;
MODULE * Module, * pt_aux;
int NbModulesNetListe ,nberr = 0 ;
char *ListeNetModules, * NameNetMod;
WinEDA_TextFrame * List;
/* determination du nombre des modules du PCB*/
NbModulesPcb = 0; Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
for( ;Module != NULL; Module = (MODULE*)Module->Pnext)
{
NbModulesPcb++;
}
if( NbModulesPcb == 0 )
{
DisplayError(this, _("No modules"), 10); return;
}
/* Construction de la liste des references des modules de la netliste */
NbModulesNetListe = BuildListeNetModules(event, NULL);
if( NbModulesNetListe < 0 ) return; /* fichier non trouve */
if( NbModulesNetListe == 0 )
{
DisplayError(this, _("No modules in NetList"), 10); return;
}
ii = NbModulesNetListe * (MAX_LEN_TXT + 1);
ListeNetModules = (char*)MyZMalloc ( ii );
if( NbModulesNetListe ) BuildListeNetModules(event, ListeNetModules);
List = new WinEDA_TextFrame(this, _("Check Modules"));
/* recherche des doubles */
List->Append(_("Duplicates"));
Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
for( ;Module != NULL; Module = (MODULE*)Module->Pnext)
{
pt_aux = (MODULE*)Module->Pnext;
for( ; pt_aux != NULL; pt_aux = (MODULE*)pt_aux->Pnext)
{
if( strnicmp(Module->m_Reference->GetText(),
pt_aux->m_Reference->GetText(),MAX_LEN_TXT) == 0 )
{
List->Append(Module->m_Reference->GetText());
nberr++ ;
break;
}
}
}
/* recherche des manquants par rapport a la netliste*/
List->Append(_("Lack:") );
NameNetMod = ListeNetModules;
for ( ii = 0 ; ii < NbModulesNetListe ; ii++, NameNetMod += MAX_LEN_TXT+1 )
{
Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
for( ;Module != NULL; Module = (MODULE*)Module->Pnext)
{
if( strnicmp(Module->m_Reference->GetText(), NameNetMod, MAX_LEN_TXT)
== 0 )
{
break;
}
}
if( Module == NULL )
{
List->Append(NameNetMod);
nberr++ ;
}
}
/* recherche des modules supplementaires (i.e. Non en Netliste) */
List->Append(_("Not in Netlist:") );
Module = (MODULE*) m_Parent->m_Pcb->m_Modules;
for( ;Module != NULL; Module = Module->Next())
{
NameNetMod = ListeNetModules;
for (ii = 0; ii < NbModulesNetListe ; ii++, NameNetMod += MAX_LEN_TXT+1 )
{
if( strnicmp(Module->m_Reference->GetText(), NameNetMod, MAX_LEN_TXT)
== 0 )
{
break ;/* Module trouve en netliste */
}
}
if( ii == NbModulesNetListe ) /* Module en trop */
{
List->Append(Module->m_Reference->GetText());
nberr++ ;
}
}
sprintf(cbuf, _("%d Errors"), nberr);
List->ShowModal(); List->Destroy();
MyFree(ListeNetModules);
}
/***********************************************************************************/
int WinEDA_NetlistFrame::BuildListeNetModules(wxCommandEvent& event, char * BufName)
/***********************************************************************************/
/*
charge en BufName la liste des noms des modules de la netliste,
( chaque nom est en longueur fixe, sizeof(pt_texte_ref->name) + code 0 )
retourne le nombre des modules cités dans la netliste
Si BufName == NULL: determination du nombre des Module uniquement
*/
{
int textlen;
int nb_modules_lus ;
int State, LineNum, Comment;
char Line[256], *Text, * LibModName;
if( ! OpenNetlistFile(event) ) return -1;
State = 0; LineNum = 0; Comment = 0;
nb_modules_lus = 0;
textlen = MAX_LEN_TXT;
while( GetLine( source, Line, &LineNum) )
{
Text = StrPurge(Line);
if ( Comment ) /* Commentaires en cours */
{
if( (Text = strchr(Text,'}') ) == NULL )continue;
Comment = 0;
}
if ( *Text == '{' ) /* Commentaires */
{
Comment = 1;
if( (Text = strchr(Text,'}') ) == NULL ) continue;
}
if ( *Text == '(' ) State++;
if ( *Text == ')' ) State--;
if( State == 2 )
{
int Error = 0;
if( strtok(Line, " ()\t\n") == NULL ) Error = 1; /* TimeStamp */
if( ( LibModName = strtok(NULL, " ()\t\n")) == NULL ) Error = 1; /* nom Lib */
/* Lecture du nom (reference) du composant: */
if( (Text = strtok(NULL, " ()\t\n")) == NULL ) Error = 1;
nb_modules_lus++;
if( BufName )
{
strncpy( BufName, Text, textlen ); BufName[textlen] = 0;
BufName += textlen+1;
}
continue;
}
if( State >= 3 )
{
State--; /* Lecture 1 ligne relative au Pad */
}
}
fclose(source);
return(nb_modules_lus);
}
/*****************************************************************************************/
int WinEDA_NetlistFrame::ReadListeModules(const char * RefCmp, int TimeStamp, char * NameModule)
/*****************************************************************************************/
/*
Lit le fichier .CMP donnant l'equivalence Modules / Composants
Retourne:
Si ce fichier existe:
1 et le nom module dans NameModule
-1 si module non trouve en fichier
sinon 0;
parametres d'appel:
RefCmp (NULL si selection par TimeStamp)
TimeStamp (signature temporelle si elle existe, NULL sinon)
pointeur sur le buffer recevant le nom du module
Exemple de fichier:
Cmp-Mod V01 Genere par PcbNew le 29/10/2003-13:11:6
BeginCmp
TimeStamp = 322D3011;
Reference = BUS1;
ValeurCmp = BUSPC;
IdModule = BUS_PC;
EndCmp
BeginCmp
TimeStamp = 32307DE2;
Reference = C1;
ValeurCmp = 47uF;
IdModule = CP6;
EndCmp
*/
{
wxString CmpFullFileName;
char refcurrcmp[512], idmod[512], ia[1024];
int timestamp;
char *ptcar;
FILE * FichCmp;
if( (RefCmp == NULL) && (TimeStamp == 0) ) return(0);
CmpFullFileName = NetNameBuffer;
ChangeFileNameExt(CmpFullFileName,NetCmpExtBuffer) ;
FichCmp = fopen(CmpFullFileName.GetData(),"rt");
if (FichCmp == NULL)
{
wxString msg;
msg.Printf( _("File <%s> not found, use Netlist for lib module selection"),
CmpFullFileName.GetData()) ;
DisplayError(this, cbuf, 20) ;
return(0);
}
while( fgets(ia,sizeof(ia),FichCmp) != NULL )
{
if( strnicmp(ia,"BeginCmp",8) != 0 ) continue;
/* Ici une description de 1 composant commence */
*refcurrcmp = *idmod = 0;
timestamp = -1;
while( fgets(ia,sizeof(ia),FichCmp) != NULL )
{
if( strnicmp(ia,"EndCmp",6) == 0 ) break;
if( strnicmp(ia,"Reference =",11) == 0 )
{
ptcar = ia+11;
ptcar = strtok(ptcar," =;\t\n");
if( ptcar ) strcpy(refcurrcmp,ptcar);
continue;
}
if( strnicmp(ia,"IdModule =",11) == 0 )
{
ptcar = ia+11;
ptcar = strtok(ptcar," =;\t\n");
if( ptcar ) strcpy(idmod,ptcar);
continue;
}
if( strnicmp(ia,"TimeStamp =",11) == 0 )
{
ptcar = ia+11;
ptcar = strtok(ptcar," =;\t\n");
if( ptcar ) sscanf(ptcar, "%X", ×tamp);
}
}/* Fin lecture 1 descr composant */
/* Test du Composant lu en fichier: est-il le bon */
if( RefCmp )
{
if( stricmp(RefCmp, refcurrcmp) == 0 )
{
fclose(FichCmp);
strcpy(NameModule, idmod);
return(1);
}
}
else if( TimeStamp != -1 )
{
if( TimeStamp == timestamp )
{
fclose(FichCmp);
strcpy(NameModule, idmod);
return(1);
}
}
}
fclose(FichCmp);
return(-1);
}
/***************************************************************/
void WinEDA_NetlistFrame::Set_NetlisteName(wxCommandEvent& event)
/***************************************************************/
/* Selection un nouveau nom de netliste
Affiche la liste des fichiers netlistes pour selection sur liste
*/
{
wxString fullfilename, mask("*");
mask += NetExtBuffer;
fullfilename = EDA_FileSelector( _("Netlist Selection:"),
"", /* Chemin par defaut */
NetNameBuffer, /* nom fichier par defaut */
NetExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */
this,
0,
TRUE
);
if ( fullfilename == "" ) return;
NetNameBuffer = fullfilename;
SetTitle(fullfilename);
}
/***********************************************************************************/
void WinEDA_NetlistFrame::AddToList(const char * NameLibCmp, const char * CmpName,int TimeStamp )
/************************************************************************************/
/* Fontion copiant en memoire de travail les caracteristiques
des nouveaux modules
*/
{
MODULEtoLOAD * NewMod;
NewMod = new MODULEtoLOAD(NameLibCmp, CmpName, TimeStamp);
NewMod->Pnext = s_ModuleToLoad_List;
s_ModuleToLoad_List = NewMod;
s_NbNewModules++;
}
/***************************************************************/
void WinEDA_NetlistFrame::LoadListeModules(wxDC * DC)
/***************************************************************/
/* Routine de chargement des nouveaux modules en une seule lecture des
librairies
Si un module vient d'etre charge il est duplique, ce qui evite une lecture
inutile de la librairie
*/
{
MODULEtoLOAD * ref, *cmp;
int ii;
MODULE * Module = NULL;
wxPoint OldPos = m_Parent->m_CurrentScreen->m_Curseur;
if( s_NbNewModules == 0 ) return;
SortListModulesToLoadByLibname(s_NbNewModules);
ref = cmp = s_ModuleToLoad_List;
// Calcul de la coordonnée de placement des modules:
if ( m_Parent->SetBoardBoundaryBoxFromEdgesOnly() )
{
m_Parent->m_CurrentScreen->m_Curseur.x = m_Parent->m_Pcb->m_BoundaryBox.GetRight() + 5000;
m_Parent->m_CurrentScreen->m_Curseur.y = m_Parent->m_Pcb->m_BoundaryBox.GetBottom() + 10000;
}
else
{
m_Parent->m_CurrentScreen->m_Curseur = wxPoint(0,0);
}
for( ii = 0; ii < s_NbNewModules; ii++, cmp = cmp->Next() )
{
if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) )
{ /* Nouveau Module a charger */
Module = m_Parent->Get_Librairie_Module(this, "", cmp->m_LibName, TRUE );
ref = cmp;
if ( Module == NULL ) continue;
m_Parent->Place_Module(Module, DC);
/* mise a jour des reperes ( nom et ref "Time Stamp")
si module charge */
Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = cmp->m_TimeStamp;
}
else
{ /* module deja charge, on peut le dupliquer */
MODULE * newmodule;
if ( Module == NULL ) continue; /* module non existant en libr */
newmodule = new MODULE(m_Parent->m_Pcb);
newmodule->Copy(Module);
newmodule->AddToChain(Module);
Module = newmodule;
Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = cmp->m_TimeStamp;
}
}
m_Parent->m_CurrentScreen->m_Curseur = OldPos;
}
/* Routine utilisee par qsort pour le tri des modules a charger
*/
static int SortByLibName( MODULEtoLOAD ** ref, MODULEtoLOAD ** cmp )
{
return (strcmp( (*ref)->m_LibName.GetData(), (*cmp)->m_LibName.GetData() ) );
}
/*************************************************/
void SortListModulesToLoadByLibname(int NbModules)
/**************************************************/
/* Rearrage la liste des modules List par ordre alphabetique des noms lib des modules
*/
{
MODULEtoLOAD ** base_list, * item;
int ii;
base_list = (MODULEtoLOAD **) MyMalloc( NbModules * sizeof(MODULEtoLOAD *) );
for ( ii = 0, item = s_ModuleToLoad_List; ii < NbModules; ii++ )
{
base_list[ii] = item;
item = item->Next();
}
qsort( base_list, NbModules, sizeof(MODULEtoLOAD*),
(int(*)(const void *, const void *) )SortByLibName);
// Reconstruction du chainage:
s_ModuleToLoad_List = *base_list;
for ( ii = 0; ii < NbModules-1; ii++ )
{
item = base_list[ii];
item->Pnext = base_list[ii + 1];
}
// Dernier item: Pnext = NULL:
item = base_list[ii];
item->Pnext = NULL;
free(base_list);
}
/*****************************************************************************/
MODULEtoLOAD::MODULEtoLOAD(const wxString & libname, const wxString & cmpname,
int timestamp) : EDA_BaseStruct(TYPE_NOT_INIT)
/*****************************************************************************/
{
m_LibName = libname;
m_CmpName = cmpname;
m_TimeStamp = timestamp;
}
|
[
"bokeoa@244deca0-f506-0410-ab94-f4f3571dea26"
] |
bokeoa@244deca0-f506-0410-ab94-f4f3571dea26
|
b466b2c89c8d2ddd3449bf6d3013c62e7e20aa97
|
af008dd81eda45dc54a926647efec8ac6bf6bd6b
|
/fun1/arfupt.cpp
|
4f99de181cec14c840381ed044a2bc41377c31bc
|
[] |
no_license
|
user-lmz/cmake-cpp
|
d003caa827a1deff5f403bad113b44572325f028
|
f229a8ec95655a13b3e2f1931ffb4e5c291b4e2a
|
refs/heads/master
| 2023-07-06T20:11:04.471655
| 2021-08-24T07:59:12
| 2021-08-24T07:59:12
| 339,757,218
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,441
|
cpp
|
#include <iostream>
const double * f1(const double ar[], int n);
const double * f2(const double [], int);
const double * f3(const double *, int);
int main()
{
using namespace std;
double av[3] = {1112.3, 1542.6, 2227.9};
typedef const double *(*p_fun)(const double *, int);
p_fun p1 = f1;
auto p2 = f2;
cout << "Using pointers to functions:\n";
cout << " Address Value\n";
cout << (*p1)(av,3) << ": " << *(*p1)(av,3) << endl;
cout << p2(av,3) << ": " << *p2(av,3) << endl;
p_fun pa[3] = {f1, f2, f3};
auto pb = pa;
cout << "\nUsing an array of pointers to functions:\n";
cout << " Address Value\n";
for (int i = 0; i < 3; i++)
cout << pa[i](av,3) << ": " << *pa[i](av,3) << endl;
cout << " Address Value\n";
for (int i = 0; i < 3; i++)
cout << pb[i](av,3) << ": " << *pb[i](av,3) << endl;
cout << "\nUsing an array of pointers to functions:\n";
cout << " Address Value\n";
auto pc = &pa;
cout << (*pc)[0](av,3) << ": " << *(*pc)[0](av,3) << endl;
p_fun (*pd)[3] = &pa;
const double *pdb = (*pd)[1](av,3);
cout << pdb << ": " << *pdb << endl;
cout << (*(*pd)[2])(av,3) << ": " << *(*(*pd)[2])(av,3) << endl;
return 0;
}
const double * f1(const double * ar, int n)
{
return ar;
}
const double * f2(const double ar[], int n)
{
return ar+1;
}
const double * f3(const double ar[], int n)
{
return ar+2;
}
|
[
"mingzeluo888@gmail.com"
] |
mingzeluo888@gmail.com
|
acdb4f552e8ac8a7e626dafb571d1ba656226cfc
|
8f608437957f7c9eb03f0ee00457e10282059ec8
|
/Codeforces/617B.cpp
|
7ef8cb998afd8cf9735fc65027a38ae9fe1137d6
|
[] |
no_license
|
npkhang99/Competitive-Programming
|
0ddf3cfcfc13825f7fadaf5b53fdef16ca77522f
|
1a5e3799e5855996aa56688680765511b0de7281
|
refs/heads/master
| 2023-06-28T15:17:44.489901
| 2021-07-30T05:31:15
| 2021-07-30T05:31:15
| 66,803,586
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 618
|
cpp
|
#include <iostream>
#include <stdio.h>
using namespace std;
const int N=109;
#define long long long
int n, a[N], d[N];
void xuly(){
int d[N], k=0, vt=1;
for(int i=1; i<=n; i++)
if(a[i]==1){
int vt=i; break;
}
for(int i=vt; i<=n; i++)
if(a[i]==1) d[++k]=1;
else d[k]++;
long c=1;
for(int i=1; i<=k-1; i++){
c*=d[i];
}
cout<< c<< endl;
}
int main(){
scanf("%d", &n);
int c=0;
for(int i=1; i<=n; i++){
scanf("%d", &a[i]);
if(a[i]==1) c++;
}
if(c>1) xuly();
else printf("%d\n",c);
return 0;
}
|
[
"curoa99@gmail.com"
] |
curoa99@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.