当前位置: 首页>>代码示例>>C++>>正文


C++ Simplex::set_next_check方法代码示例

本文整理汇总了C++中Simplex::set_next_check方法的典型用法代码示例。如果您正苦于以下问题:C++ Simplex::set_next_check方法的具体用法?C++ Simplex::set_next_check怎么用?C++ Simplex::set_next_check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Simplex的用法示例。


在下文中一共展示了Simplex::set_next_check方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: check_methods

void DelTess::check_methods() {
    // first step: setup known large tetrahedron
    cout << "Setting up test volume..." << endl;
    Vec origin(0.5, 0.5, 0.5);
    _container = new CubicBox(origin, 1.);
    Vec anchor(-2., -2., -2.);
    Vec sides(10., 10., 10.);
    _box12 = Cuboid(anchor, sides);
    // manually add ghosts (because the ghost positions changed)
    _points.push_back(new VorGen(-2., -2., -2.));
    _points.push_back(new VorGen(8., 0., 0.));
    _points.push_back(new VorGen(0., 8., 0.));
    _points.push_back(new VorGen(0., 0., 8.));
    _points[0]->set_p12(get_p12(_points[0]->get_position()));
    _points[1]->set_p12(get_p12(_points[1]->get_position()));
    _points[2]->set_p12(get_p12(_points[2]->get_position()));
    _points[3]->set_p12(get_p12(_points[3]->get_position()));
    Simplex* tetrahedron = new Simplex(0, 1, 2, 3, _points);
    Simplex* ghosttetrahedron = new Simplex(0, 1, 2, 3, _points);
    _simplices.push_back(ghosttetrahedron);
    _simplices.push_back(tetrahedron);
    tetrahedron->set_next_check(0);
    tetrahedron->set_previous_check(0);
    _lastindex = 1;
    // set id's of ghost particles
    // the order and position of the points is determined by the CubicBox
    // we expect them to be:
    // 1 --> (-2., -2., -2.)
    // 2 --> ( 8.,  0.,  0.)
    // 4 --> ( 0.,  8.,  0.)
    // 8 --> ( 0.,  0.,  8.)
    _points[0]->set_id(1);
    _points[1]->set_id(2);
    _points[2]->set_id(4);
    _points[3]->set_id(8);
    // check for normal insertion algorithm
    cout << "Checking basic algorithm..." << endl;
    VorGen* A = new VorGen(2., 2., 2.);
    A->set_id(16);
    _points.push_back(A);
    add_point(4);
    int result[128][65];
    int faces[128][65];
    // g0g1g2A
    result[23][1] = 30;
    result[23][2] = 29;
    result[23][4] = 27;
    result[23][16] = -1;
    faces[23][1] = 8;
    faces[23][2] = 8;
    faces[23][4] = 8;
    faces[23][16] = -1;
    // g0g1g3A
    result[27][1] = 30;
    result[27][2] = 29;
    result[27][8] = 23;
    result[27][16] = -1;
    faces[27][1] = 4;
    faces[27][2] = 4;
    faces[27][8] = 4;
    faces[27][16] = -1;
    // g0g2g3A
    result[29][1] = 30;
    result[29][4] = 27;
    result[29][8] = 23;
    result[29][16] = -1;
    faces[29][1] = 2;
    faces[29][4] = 2;
    faces[29][8] = 2;
    faces[29][16] = -1;
    // g1g2g3A
    result[30][2] = 29;
    result[30][4] = 27;
    result[30][8] = 23;
    result[30][16] = -1;
    faces[30][2] = 1;
    faces[30][4] = 1;
    faces[30][8] = 1;
    faces[30][16] = -1;
    // we need to set the relations for these checks to work
    set_relations();
    for(unsigned int i = 0; i < 4; i++) {
        VorGen* P = _points[i];
        list<Simplex*> simplices = P->get_tetrahedra();
        for(list<Simplex*>::iterator s = simplices.begin();
            s != simplices.end(); s++) {
            unsigned int* Pidx = (*s)->get_vorgens();
            VorGen* PP[4] = {_points[Pidx[0]], _points[Pidx[1]],
                             _points[Pidx[2]], _points[Pidx[3]]};
            unsigned int sum = (*s)->get_idsum(_points);
            for(unsigned int i = 0; i < 4; i++) {
                if(!(*s)->get_ngb(i)) {
                    my_assert(result[sum][PP[i]->get_id()] == -1,
                              "incorrect NULL neighbour!");
                    my_assert(faces[sum][PP[i]->get_id()] == -1,
                              "NULL neighbour has ngbface!");
                } else {
                    my_assert(result[sum][PP[i]->get_id()] ==
                                      static_cast<int>(
                                              _simplices[(*s)->get_ngb(i)]
//.........这里部分代码省略.........
开发者ID:JackieXie168,项目名称:shadowfax,代码行数:101,代码来源:testDelTess.cpp


注:本文中的Simplex::set_next_check方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。