const std::vector<boost::shared_ptr<ribi::Coordinat3D> >
  ribi::foam::Mesh::CreatePoints(const Files& files)
{
  std::vector<boost::shared_ptr<ribi::Coordinat3D> > v;
  assert(files.GetPoints());
  for (const PointsFileItem& item: files.GetPoints()->GetItems())
  {
    static_assert(std::is_same<PointsFileItem,Point>(),
      "Point is a typedef for PointsFileItem"
    );
    const boost::shared_ptr<ribi::Coordinat3D> p {
      new ribi::Coordinat3D(item.GetCoordinat())

    };
    assert(p);
    v.push_back(p);
  }
  return v;
}
ribi::foam::Mesh::Mesh(
  const std::vector<boost::shared_ptr<Boundary>>& boundaries,
  const std::vector<boost::shared_ptr<Cell>>& cells,
  const std::vector<boost::shared_ptr<Face>>& faces,
  const std::vector<boost::shared_ptr<ribi::Coordinat3D>>& points
  )
  : m_boundaries(boundaries),
    m_cells(cells),
    m_faces(faces),
    m_points(points)
{
  #ifndef NDEBUG
  Test();
  for (const boost::shared_ptr<Face> face: m_faces)
  {
    assert(face);
    assert(face->GetOwner());
    assert( (face->GetNeighbour() || !face->GetNeighbour() )
      && "internalMesh faces have a neighbour, defaultWall faces don't"
    );
  }
  #endif

  if (!AreFacesOrdered())
  {
    std::cout << "Reordering faces" << std::endl;
    ReorderFaces();
  }

  #ifndef NDEBUG
  assert(AreFacesOrdered());
  const Files f(this->CreateFiles());
  assert(f.GetFaces()->GetItems().size() == faces.size());
  assert(f.GetBoundary()->GetItems().size() == boundaries.size());
  assert(f.GetPoints()->GetItems().size() == points.size());
  #endif

}