コード例 #1
0
ribi::foam::Files ribi::foam::Mesh::CreateFiles() const noexcept
{
  boost::shared_ptr<BoundaryFile> boundary {
    CreateBoundary()
  };
  assert(boundary);
  boost::shared_ptr<FacesFile> faces {
    CreateFaces()
  };
  assert(faces);
  boost::shared_ptr<NeighbourFile> neighbour {
    CreateNeighbour()
  };
  assert(neighbour);
  boost::shared_ptr<OwnerFile> owner {
    CreateOwner()
  };
  assert(owner);
  boost::shared_ptr<PointsFile> points {
    CreatePoints()
  };
  assert(points);
  const Files f(
    boundary,
    faces,
    neighbour,
    owner,
    points
  );
  return f;
}
コード例 #2
0
ファイル: Cube.cpp プロジェクト: dalton/mosesdecoder
void Cube::CreateNeighbours(const std::vector<int> &coordinates)
{
  // Create a copy of the origin coordinates that will be adjusted for
  // each neighbour.
  std::vector<int> tmpCoordinates(coordinates);

  // Create each neighbour along the vertex beam dimensions.
  for (std::size_t i = 0; i < coordinates.size()-1; ++i) {
    int x = coordinates[i];
    if (m_bundle.beams[i]->size() > x+1) {
      ++tmpCoordinates[i];
      CreateNeighbour(tmpCoordinates);
      --tmpCoordinates[i];
    }
  }
  // Create the neighbour along the translation dimension.
  int x = coordinates.back();
  if (m_bundle.translations->GetSize() > x+1) {
    ++tmpCoordinates.back();
    CreateNeighbour(tmpCoordinates);
    --tmpCoordinates.back();
  }
}