本文整理汇总了C++中s0函数的典型用法代码示例。如果您正苦于以下问题:C++ s0函数的具体用法?C++ s0怎么用?C++ s0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s0函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: d0
void StokesPreconditioner::vmult (Vector<double> &dst,
const Vector<double> &src) const
{
int n_dof_v = Ax->n();
int n_dof_p = Q->n();
Vector<double> d0(n_dof_v);
Vector<double> d1(n_dof_v);
Vector<double> s0(n_dof_v);
Vector<double> s1(n_dof_v);
for (int i = 0; i < n_dof_v; ++i)
s0(i) = src(i);
for (int i = 0; i < n_dof_v; ++i)
s1(i) = src(n_dof_v + i);
for (int i = 0; i < n_dof_p; ++i)
dst(2 * n_dof_v + i) = src(2 * n_dof_v + i) / (*Q).diag_element(i);
AMGx.solve(d0, s0, 1e-8, 1, 1);
AMGy.solve(d1, s1, 1e-8, 1, 1);
for (int i = 0; i < n_dof_v; ++i)
dst(i) = d0(i);
for (int i = 0; i < n_dof_v; ++i)
dst(n_dof_v + i) = d1(i);
};
开发者ID:wuwuyiyirong5,项目名称:Research,代码行数:28,代码来源:preconditioner.cpp
示例2: test_disconnect_equal
static void
test_disconnect_equal()
{
boost::signals2::signal<void ()> s0;
connections[0] = s0.connect(remove_connection(0));
connections[1] = s0.connect(remove_connection(1));
connections[2] = s0.connect(remove_connection(2));
connections[3] = s0.connect(remove_connection(3));
std::cout << "Deleting 2" << std::endl;
test_output = "";
s0(); std::cout << std::endl;
BOOST_CHECK(test_output == "0123");
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
connections[2].disconnect();
#else
s0.disconnect(remove_connection(2));
#endif
test_output = "";
s0(); std::cout << std::endl;
BOOST_CHECK(test_output == "013");
}
开发者ID:avasopht,项目名称:boost_1_55_0-llvm,代码行数:26,代码来源:deletion_test.cpp
示例3: checkPolyline
void checkPolyline(const vector<T3DPointD> &p)
{
int ret;
if (p.size() < 3)
return;
TPointD p1;
TPointD p2;
int pointSize = (int)p.size() - 1;
for (int i = 0; i < pointSize; i++) {
for (int j = i + 1; j < pointSize; j++) {
vector<DoublePair> res;
p1 = TPointD(p[i].x, p[i].y);
p2 = TPointD(p[i + 1].x, p[i + 1].y);
TSegment s0(p1, p2);
p1 = TPointD(p[j].x, p[j].y);
p2 = TPointD(p[j + 1].x, p[j + 1].y);
TSegment s1(p1, p2);
ret = intersect(s0, s1, res);
if (ret)
assert(
(ret == 1) &&
(areAlmostEqual(res[0].first, 1) ||
areAlmostEqual(res[0].first, 0)) &&
(areAlmostEqual(res[0].second, 1) ||
areAlmostEqual(res[0].second, 0)));
}
}
p1 = TPointD(p.back().x, p.back().y);
p2 = TPointD(p[0].x, p[0].y);
TSegment s0(p1, p2);
for (int j = 0; j < pointSize; j++) {
vector<DoublePair> res;
p1 = TPointD(p[j].x, p[j].y);
p2 = TPointD(p[j + 1].x, p[j + 1].y);
TSegment s1(p1, p2);
ret = intersect(s0, s1, res);
if (ret)
assert(
(ret == 1) &&
(areAlmostEqual(res[0].first, 1) ||
areAlmostEqual(res[0].first, 0)) &&
(areAlmostEqual(res[0].second, 1) ||
areAlmostEqual(res[0].second, 0)));
}
}
开发者ID:AmEv7Fam,项目名称:opentoonz,代码行数:59,代码来源:tregion.cpp
示例4: s0
void CAstar::Astar(CAstarNode*& result)
{
CAstarNode s0(m_hgevStart,0,CalculateH(m_hgevStart),NULL);
//open表中插入起点
m_vOpenList.push_back(s0);
make_heap(m_vOpenList.begin(),m_vOpenList.end());
// CAstarNode* min;
while(!m_vOpenList.empty())
{
//pop出堆顶节点
pop_heap(m_vOpenList.begin(),m_vOpenList.end(),cmpAstarNode);
result = new CAstarNode(m_vOpenList.back().m_hgevCoordinate,m_vOpenList.back().m_nG,
m_vOpenList.back().m_nH, m_vOpenList.back().m_pParent);
//若节点是目标节点,则返回
if(result->m_hgevCoordinate == m_hgevGoal)
{
// memcpy(result,&min,sizeof(CAstarNode));
return ;
}
m_vOpenList.pop_back();
// make_heap(m_vOpenList.begin(),m_vOpenList.end());
//扩展该节点
ExtendNode(result);
// make_heap(m_vOpenList.begin(),m_vOpenList.end());
m_vClosedList.push_back(*result);
}
result = NULL;
}
开发者ID:xiaohuajiao,项目名称:Demo,代码行数:32,代码来源:CAstar.cpp
示例5: weak_1
// Copy weak, access via shared
void weak_1()
{
assert_ck(0, 0);
{
shared_test s0(test_behavior::init());
assert_ck(1, 0);
weak_test w0(s0);
assert_ck(1, 0);
auto w1(w0);
assert_ck(1, 0);
assert(!w0.expired());
assert(w0.use_count() == 1);
assert(!w1.expired());
assert(w1.use_count() == 1);
assert(w0.lock().get() == w1.lock().get());
}
assert_ck(1, 1);
}
开发者ID:SuperV1234,项目名称:vrm_core,代码行数:26,代码来源:weak.cpp
示例6: Test
void Test() {
std::string str('x', 4);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: constructor parameters are probably swapped [misc-string-constructor]
std::wstring wstr(L'x', 4);
// CHECK-MESSAGES: [[@LINE-1]]:16: warning: constructor parameters are probably swapped
std::string s0(0, 'x');
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: constructor creating an empty string
std::string s1(-4, 'x');
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: negative value used as length parameter
std::string s2(0x1000000, 'x');
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: suspicious large length parameter
std::string q0("test", 0);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: constructor creating an empty string
std::string q1(kText, -4);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: negative value used as length parameter
std::string q2("test", 200);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: length is bigger then string literal size
std::string q3(kText, 200);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: length is bigger then string literal size
std::string q4(kText2, 200);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: length is bigger then string literal size
std::string q5(kText3, 0x1000000);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: suspicious large length parameter
}
开发者ID:falho,项目名称:clang-tools-extra,代码行数:25,代码来源:misc-string-constructor.cpp
示例7: test_2
void test_2()
{
// Test bounding_box() for Point_2
Point_2 p0 (1, 2);
Point_2 p1 (2, 1);
std::vector<Point_2> pts;
pts.push_back(p0);
pts.push_back(p0);
pts.push_back(p1);
assert( CGAL::bounding_box(pts.begin(), pts.end())
== K::Iso_rectangle_2(p0, p1));
#if 0 // Does not work yet
// Test bounding_box() for Segment_2
Segment_2 s0 (p0, p1);
Segment_2 s1 (p0, p0);
std::vector<Segment_2> segs;
segs.push_back(s0);
segs.push_back(s0);
segs.push_back(s1);
assert( CGAL::bounding_box(segs.begin(), segs.end())
== K::Iso_rectangle_2(p0, p1));
#endif
}
开发者ID:Asuzer,项目名称:cgal,代码行数:28,代码来源:test_bounding_box.cpp
示例8: s0
Float SoftCylinderPairScore::evaluate_index(
kernel::Model *m, const kernel::ParticleIndexPair &pip,
DerivativeAccumulator *da) const {
atom::Bond b[2] = {atom::Bond(m, pip[0]), atom::Bond(m, pip[1])};
core::XYZR d[2][2] = {
{core::XYZR(b[0].get_bonded(0)), core::XYZR(b[0].get_bonded(1))},
{core::XYZR(b[1].get_bonded(0)), core::XYZR(b[1].get_bonded(1))}};
algebra::Segment3D s0(d[0][0].get_coordinates(), d[0][1].get_coordinates());
algebra::Segment3D s1(d[1][0].get_coordinates(), d[1][1].get_coordinates());
algebra::Segment3D ss = algebra::get_shortest_segment(s0, s1);
if (ss.get_length() < d[0][0].get_radius() + d[1][0].get_radius()) {
double diff = d[0][0].get_radius() + d[1][0].get_radius() - ss.get_length();
double score = .5 * k_ * square(diff);
if (da) {
double deriv = k_ * diff;
algebra::Vector3D v = ss.get_point(1) - ss.get_point(0);
algebra::Vector3D uv = v.get_unit_vector();
algebra::Vector3D duv = deriv * uv;
d[0][0].add_to_derivatives(-duv, *da);
d[0][1].add_to_derivatives(-duv, *da);
d[1][0].add_to_derivatives(duv, *da);
d[1][1].add_to_derivatives(duv, *da);
}
return score;
} else {
return 0;
}
}
开发者ID:newtonjoo,项目名称:imp,代码行数:29,代码来源:SoftCylinderPairScore.cpp
示例9: main
int main() {
Direction d = D;
Direction u = U;
Shift s0(d, 1);
Shift s1(d, 0);
std::vector<Shift> shifts;
s0.string_vec.push_back(0);
s0.string_vec.push_back(1);
s0.string_vec.push_back(0);
s0.string_vec.push_back(3);
s1.string_vec.push_back(0);
s1.string_vec.push_back(1);
s1.string_vec.push_back(0);
s1.string_vec.push_back(3);
if (s0 < s1) {
std::cout << "s0 < s1\n";
} else {
std::cout << "s0 > s1\n";
}
shifts.push_back(s0);
shifts.push_back(s1);
std::sort(shifts.begin(), shifts.end());
for (Shift s : shifts) {
std::cout << "id: " << s.id << ", str: ";
for (int i = 0; i < 4; i++) {
std::cout << s.string_vec[i] << " ";
}
std::cout << "\n";
}
}
开发者ID:comfortablejohn,项目名称:threes,代码行数:35,代码来源:test.cpp
示例10: _BRSHA256Compress
static void _BRSHA256Compress(uint32_t *r, uint32_t *x)
{
static const uint32_t k[] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
};
int i;
uint32_t a = r[0], b = r[1], c = r[2], d = r[3], e = r[4], f = r[5], g = r[6], h = r[7], t1, t2, w[64];
for (i = 0; i < 16; i++) w[i] = be32(x[i]);
for (; i < 64; i++) w[i] = s3(w[i - 2]) + w[i - 7] + s2(w[i - 15]) + w[i - 16];
for (i = 0; i < 64; i++) {
t1 = h + s1(e) + ch(e, f, g) + k[i] + w[i];
t2 = s0(a) + maj(a, b, c);
h = g, g = f, f = e, e = d + t1, d = c, c = b, b = a, a = t1 + t2;
}
r[0] += a, r[1] += b, r[2] += c, r[3] += d, r[4] += e, r[5] += f, r[6] += g, r[7] += h;
var_clean(&a, &b, &c, &d, &e, &f, &g, &h, &t1, &t2);
mem_clean(w, sizeof(w));
}
开发者ID:sinetek,项目名称:vertwallet-core,代码行数:29,代码来源:BRCrypto.c
示例11: formula_s0
PyObject* formula_s0(PyObject* self, PyObject* args)
{
float a, b, c, d, e, f;
if (!PyArg_ParseTuple(args, "ffffff", &a, &b, &c, &d, &e, &f))
return NULL;
return Py_BuildValue("f", s0(a,b,c,d,e,f));
}
开发者ID:ymizoguchi,项目名称:Python_and_C,代码行数:7,代码来源:formulaWrapper.c
示例12: main
int main()
{
void h0(float, float);
void e0(float, float);
void s0(float, float);
float a, b, c;
printf("请输入a,b,c:");
scanf("%f,%f,%f", &a, &b, &c);
printf("方程为:%5.2fx*x+%5.2fx+%5.2f=0\n", a, b, c);
Delta = b*b - 4 * a*c;
printf("结果是:\n");
if (Delta > 0)
{
h0(a, b);
printf("x1=%f\nx2=%f\n", x1, x2);
}
else if (Delta < 0)
{
s0(a, b);
printf("x1=%f+%fi\nx2=%f-%fi\n", m, n, m, n);
}
else
{
e0(a, b);
printf("x1=x2=%f\n", x1);
}
return 0;
}
开发者ID:2015CLanguage,项目名称:Homework7,代码行数:28,代码来源:14151133_武世杰_7_2.c
示例13: main
int main()
{
/* Value constructor */
cv::Scalar s0(10); // (10,0,0,0)
cv::Scalar s(0.5,1.25,2.75,3.0);
std::cout << "s0(10) " << s0 << std::endl;
std::cout << "s(0.5,1.25,2.75,3.0) " << s << std::endl;
/* Element-wise mult */
cv::Scalar prod = s.mul(cv::Scalar(6.5, 7.5, 8.5, 9.5));
std::cout << "prod: " << prod << std::endl;
/* (Quaternion) conjugation */
std::cout << "s conj: " << s.conj() << std::endl;
/* (Quaternion) real test */
if (s0.isReal()) std::cout << s0 << " is real" << std::endl;
else std::cout << s0 << " is not real." << std::endl;
/* (Quaternion) real test */
if (s.isReal()) std::cout << s << " is real" << std::endl;
else std::cout << s << " is not real." << std::endl;
}
开发者ID:SanferD,项目名称:Learn-OpenCV,代码行数:25,代码来源:ScalarClass.cpp
示例14: print_table
void print_table(str s, const Ptable& T) {
printf("%s", s.c_str()); printf("\n");
int l = T.size();
if (l==0) {
printf(" ! Empty table\n");
return;
}
int c = T[0].size();
for (int i=0; i<l; i++) {
if (T[i].size()!=c) {
printf(" ! Table has different number of columns depending to the lines\n");
return;
}
}
str s0(" ",10);
const char* space = s0.c_str();
printf("%s", space);
for (int j=0; j<c; j++) printf("%11d",j);
printf("\n");
for (int i=0; i<l; i++) {
printf("%4d",i);
for (int j=0; j<c; j++) printf("%11s",p2s(T[i][j]).c_str());
printf("\n");
}
printf("\n");
}
开发者ID:angelajburden,项目名称:fiberassign,代码行数:26,代码来源:misc.cpp
示例15: s0
string parser::preprocess_input(istream &stream)
{
streampos start = stream.tellg();
stream.seekg(0, ios::end);
streampos end = stream.tellg();
size_t file_size = end - start;
stream.seekg(start, ios::beg);
char bom_test[3];
static const char * BOM = "\xEF\xBB\xBF";
stream.read(bom_test, 3u);
if (strncmp(bom_test, BOM, 3u) == 0) {
// Matched BOM, keep stream position to prevent its reading
file_size -= 3u;
}
else {
// Seek stream back
stream.seekg(start, ios::beg);
}
char * buffer = new char[file_size + 1];
stream.read(buffer, file_size);
buffer[file_size] = '\0';
string s0(buffer);
delete[] buffer;
string s1 = fix_corrupted_data(s0);
return s1;
}
开发者ID:woronin,项目名称:kumir2,代码行数:26,代码来源:parser.cpp
示例16: weak_6
// Decrement weak count
void weak_6()
{
assert_ck(0, 0);
{
shared_test s0(test_behavior::init());
assert_ck(1, 0);
assert(s0.use_count() == 1);
weak_test w0(s0);
assert(s0.use_count() == 1);
assert(!w0.expired());
{
weak_test w1(w0);
assert(s0.use_count() == 1);
assert(!w0.expired());
assert(!w1.expired());
}
assert(s0.use_count() == 1);
assert(!w0.expired());
}
assert_ck(1, 1);
}
开发者ID:SuperV1234,项目名称:vrm_core,代码行数:29,代码来源:weak.cpp
示例17: expandWord
int expandWord(unsigned int test[]) {
int i;
for(i=16;i<64;i++)
test[i] = (s1(test[i-2])) + test[i-7] + (s0(test[i-15])) + test[i-16];
return 0;
}
开发者ID:jethroFloyd,项目名称:hashColl,代码行数:7,代码来源:minefield.c
示例18: parsePattern
static int parsePattern(std::wstring str, TilePattern* pat) {
pat->rows.clear();
pat->heights.clear();
std::vector<std::wstring> rowStrings = std::vector<std::wstring>();
tokenize(str, rowStrings, L"/");
for (int i=0; i<rowStrings.size(); i++) {
std::vector<std::wstring> row = std::vector<std::wstring>();
tokenize(rowStrings[i], row, L",");
if (row.size() < 3)
return FALSE;
double offset, height, width;
std::wstringstream s0(row[0]);
s0 >> offset;
std::wstringstream s1(row[1]);
s1 >> height;
TileRow r = TileRow(offset);
for (int j=2; j<row.size(); j++) {
std::wstringstream sn(row[j]);
sn >> width;
r.tiles.push_back(width);
}
pat->rows.push_back(r);
pat->heights.push_back((float)height);
}
return TRUE;
}
开发者ID:Bercon,项目名称:BerconMaps,代码行数:35,代码来源:tile.cpp
示例19: s0
void HPoly
(
ActionSeg & Act,
ElFifo<Pt2dr> & f,
Pt2dr dir,
REAL esp
)
{
REAL omax = -1e50;
REAL omin = 1e50;
SegComp s0 (Pt2dr(0,0),dir);
for (INT k=0; k<f.nb() ; k++)
{
REAL ord = s0.ordonnee(f[k]);
ElSetMax(omax,ord);
ElSetMin(omin,ord);
}
for (REAL ord = round_up(omin/esp) *esp; ord<omax; ord += esp)
{
Pt2dr p0 = s0.from_rep_loc(Pt2dr(0.0,ord));
ClipSeg(Act,f,Seg2d(p0,p0+s0.tangente()));
}
}
开发者ID:archeos,项目名称:micmac-archeos,代码行数:27,代码来源:basic.cpp
示例20: insert_test
bool insert_test( )
{
bool rc = true;
std::string s0( "INSERTED" );
std::string s1( "Hello, World!" );
s1.insert( 2, s0 );
if( s1 != "HeINSERTEDllo, World!" || s1.size( ) != 21 || INSANE( s1 ) ) {
FAIL
}
std::string s2( "Hello, World!" );
s2.insert( 0, s0 );
if( s2 != "INSERTEDHello, World!" || s2.size( ) != 21 || INSANE( s2 ) ) {
FAIL
}
std::string s3( "Hello, World!" );
s3.insert( 13, s0 );
if( s3 != "Hello, World!INSERTED" || s3.size( ) != 21 || INSANE( s3 ) ) {
FAIL
}
std::string s4( "Hello, World!" );
s4.insert( 0, s0, 2, 2 );
if( s4 != "SEHello, World!" || s4.size( ) != 15 || INSANE( s4 ) ) {
FAIL
}
std::string s5( "Hello, World!" );
s5.insert( 0, s0, 2, 128 );
if( s5 != "SERTEDHello, World!" || s5.size( ) != 19 || INSANE( s5 ) ) {
FAIL
}
// Do multiple insertions to verify reallocations.
// This should probably also be done for the other insert methods as well.
std::string s6( "Hello" );
char input = 'a';
for( int i = 0; i < 10; ++i ) {
std::string::iterator p = s6.insert( s6.begin( ), input );
if( *p != input ) FAIL;
if( s6.size( ) != 6 + i ) FAIL;
if( INSANE( s6 ) ) FAIL;
++input;
}
if( s6 != "jihgfedcbaHello" ) FAIL;
std::string s7( "Hello, World!" );
s7.insert( s7.end( ), 3, 'z' );
if( s7 != "Hello, World!zzz" || s7.size( ) != 16 || INSANE( s7 ) ) {
FAIL
}
// Need to test other insert methods.
return( rc );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:58,代码来源:string01.cpp
注:本文中的s0函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论