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


C++ shared_ptr::CountFaces方法代码示例

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


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

示例1: assert

const std::vector<boost::shared_ptr<ribi::trim::Cell>> ribi::trim::CellFactory::CreateTestCube() const noexcept
{
    const boost::shared_ptr<Template> my_template {
        Template::CreateTest(1)
    };
    assert(my_template->CountFaces() == 2);
    const int n_layers = 2;
    const boost::shared_ptr<CellsCreator> cells_creator {
        CellsCreatorFactory().Create(my_template,n_layers,1.0 * boost::units::si::meter)
    };
    const std::vector<boost::shared_ptr<Cell>> cells { cells_creator->GetCells() };

    assert(cells.size() == 2 && "A cube consists out of two prisms");
    assert(cells[0]->GetFaces().size() == 8 && "A prism consists out of 8 faces");
    assert(cells[1]->GetFaces().size() == 8 && "A prism consists out of 8 faces");
#ifndef NDEBUG
    for (int i=0; i!=2; ++i)
    {
        const std::vector<boost::shared_ptr<Face>> faces { cells[i]->GetFaces() };
        for (const auto face: faces)
        {
            assert(face);
            assert(face->GetPoints().size() == 3);
        }
    }
#endif

    return cells;
}
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:29,代码来源:trianglemeshcellfactory.cpp

示例2: assert

std::vector<boost::shared_ptr<ribi::trim::Cell>> ribi::trim::CellFactory::CreateTestCube(
  const CreateVerticalFacesStrategy strategy
) const noexcept
{
  const boost::shared_ptr<Template> my_template {
    Template::CreateTest(1)
  };
  assert(my_template);
  assert(my_template->CountFaces() == 2);
  const int n_cell_layers = 1;
  const bool verbose{false};
  const boost::shared_ptr<CellsCreator> cells_creator {
    CellsCreatorFactory().Create(
      my_template,
      n_cell_layers,
      1.0 * boost::units::si::meter,
      strategy,
      verbose
    )
  };
  const std::vector<boost::shared_ptr<Cell>> cells { cells_creator->GetCells() };

  assert(cells.size() == 2 && "A cube consists out of two prisms");
  #ifndef NDEBUG
  for (int i=0; i!=2; ++i)
  {
    const std::vector<boost::shared_ptr<Face>> faces { cells[i]->GetFaces() };
    for (const auto& face: faces)
    {
      assert(face);
      assert(face->GetPoints().size() == 3 || face->GetPoints().size() == 4);
    }
  }
  #endif

  return cells;
}
开发者ID:richelbilderbeek,项目名称:RibiClasses,代码行数:37,代码来源:trianglemeshcellfactory.cpp

示例3: test_timer

void ribi::trim::CellsCreator::Test() noexcept
{
  {
    static bool is_tested{false};
    if (is_tested) return;
    is_tested = true;
  }
  CellFactory();
  FaceFactory();

  const TestTimer test_timer(__func__,__FILE__,1.0);
  const bool verbose{false};

  /*
  if (testing_depth > 1)
  {
    if (verbose) { TRACE("Trying out to build cells from the hardest testing templates"); }
    {
      //This is the longest test by far
      //const TestTimer test_timer(boost::lexical_cast<std::string>(__LINE__),__FILE__,1.0);
      for (CreateVerticalFacesStrategy strategy: CreateVerticalFacesStrategies().GetAll())
      {
        const boost::shared_ptr<Template> my_template {
          Template::CreateTest(3)
        };

        const int n_cell_layers = 2;
        const boost::shared_ptr<CellsCreator> cells_creator {
          CellsCreatorFactory().Create(
            my_template,
            n_cell_layers,
            1.0 * boost::units::si::meter,
            strategy,
            verbose
          )
        };
        const std::vector<boost::shared_ptr<Cell>> cells { cells_creator->GetCells() };
        assert(cells.size() > 0);
      }
    }
  }
  */
  if (verbose) { TRACE("Specific: check if a Face really loses its neighbour: remove a prism from a cube"); }
  {
    //const TestTimer test_timer(boost::lexical_cast<std::string>(__LINE__),__FILE__,1.0);
    for (CreateVerticalFacesStrategy strategy: CreateVerticalFacesStrategies().GetAll())
    {
      //Create a 2x1 cell block
      const boost::shared_ptr<Template> my_template {
        Template::CreateTest(1)
      };
      assert(my_template->CountFaces() == 2);
      const int n_cell_layers = 1;
      const boost::shared_ptr<CellsCreator> cells_creator {
        CellsCreatorFactory().Create(
          my_template,
          n_cell_layers,
          1.0 * boost::units::si::meter,
          strategy,
          verbose
        )
      };
      const std::vector<boost::shared_ptr<Cell>> cells { cells_creator->GetCells() };
      assert(cells.size() == 2);
      const std::vector<boost::shared_ptr<Face>> faces_1 { cells[0]->GetFaces() };
      const std::vector<boost::shared_ptr<Face>> faces_2 { cells[1]->GetFaces() };
      //Find the one/two Faces that have a neighbour
      {
        const int n_faces_with_neighbour {
          static_cast<int>(
            std::count_if(faces_1.begin(),faces_1.end(),
              [](const boost::shared_ptr<Face> face)
              {
                return face->GetNeighbour().get();
              }
            )
          )
        };
        assert(
             (strategy == CreateVerticalFacesStrategy::one_face_per_square
               && n_faces_with_neighbour == 1)
          || (strategy == CreateVerticalFacesStrategy::two_faces_per_square
               && n_faces_with_neighbour == 2)
        );
      }
      {
        const int n_faces_with_neighbour {
          static_cast<int>(
            std::count_if(faces_2.begin(),faces_2.end(),
              [](const boost::shared_ptr<Face> face)
              {
                return face->GetNeighbour().get();
              }
            )
          )
        };
        assert(
             (strategy == CreateVerticalFacesStrategy::one_face_per_square
               && n_faces_with_neighbour == 1)
          || (strategy == CreateVerticalFacesStrategy::two_faces_per_square
//.........这里部分代码省略.........
开发者ID:richelbilderbeek,项目名称:RibiClasses,代码行数:101,代码来源:trianglemeshcellscreator.cpp


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