<commit_before>/*===========================================================================*\
 *                                                                           *
 *                               OpenMesh                                    *
 *      Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen      *
 *                           www.openmesh.org                                *
 *                                                                           *
 *---------------------------------------------------------------------------* 
 *  This file is part of OpenMesh.                                           *
 *                                                                           *
 *  OpenMesh is free software: you can redistribute it and/or modify         * 
 *  it under the terms of the GNU Lesser General Public License as           *
 *  published by the Free Software Foundation, either version 3 of           *
 *  the License, or (at your option) any later version with the              *
 *  following exceptions:                                                    *
 *                                                                           *
 *  If other files instantiate templates or use macros                       *
 *  or inline functions from this file, or you compile this file and         *
 *  link it with other files to produce an executable, this file does        *
 *  not by itself cause the resulting executable to be covered by the        *
 *  GNU Lesser General Public License. This exception does not however       *
 *  invalidate any other reasons why the executable file might be            *
 *  covered by the GNU Lesser General Public License.                        *
 *                                                                           *
 *  OpenMesh is distributed in the hope that it will be useful,              *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
 *  GNU Lesser General Public License for more details.                      *
 *                                                                           *
 *  You should have received a copy of the GNU LesserGeneral Public          *
 *  License along with OpenMesh.  If not,                                    *
 *  see <http://www.gnu.org/licenses/>.                                      *
 *                                                                           *
\*===========================================================================*/ 

/*===========================================================================*\
 *                                                                           *             
 *   $Revision$                                                         *
 *   $Date$                   *
 *                                                                           *
\*===========================================================================*/


//=============================================================================
//
//  Kernel Concept
//
//=============================================================================


#error this file is for documentation purposes only


//== NAMESPACES ===============================================================


namespace OpenMesh {
namespace Concepts {


//== CLASS DEFINITION =========================================================


/** \ingroup mesh_concepts_group
    This class describes the minimum interface a mesh kernel
    has to implement (because the resulting mesh will rely on
    this interface).

    This is the template class the actually holds the mesh kernel
    implementation. All functions marked as internal should only be used
    by the mesh class (that inherits the kernel). The mesh may then
    provide wrapper functions that provide the same functionality.

    \todo Check, if the member list is complete.
*/
template <class FinalMeshItems> class KernelT
{
public:

  /// \name Mesh Items
  //@{

  /// Derive this type from the FinalMeshItems
  typedef typename FinalMeshItems::Vertex             Vertex;
  typedef typename FinalMeshItems::Halfedge           Halfedge;
  typedef typename FinalMeshItems::Edge               Edge;
  typedef typename FinalMeshItems::Face               Face;
  typedef typename FinalMeshItems::Point              Point;
  typedef typename FinalMeshItems::Scalar             Scalar;
  typedef typename FinalMeshItems::Normal             Normal;
  typedef typename FinalMeshItems::Color              Color;
  typedef typename FinalMeshItems::TexCoord           TexCoord;
  typedef typename FinalMeshItems::VertexHandle       VertexHandle;
  typedef typename FinalMeshItems::HalfedgeHandle     HalfedgeHandle;
  typedef typename FinalMeshItems::EdgeHandle         EdgeHandle;
  typedef typename FinalMeshItems::FaceHandle         FaceHandle;

  //@}


  /// \name Kernel Iterators
  //@{
  /// This type depends on the container type in use.
  typedef SomeIterator KernelVertexIter;
  typedef SomeIterator KernelConstVertexIter;
  typedef SomeIterator KernelEdgeIter;
  typedef SomeIterator KernelConstEdgeIter;
  typedef SomeIterator KernelFaceIter;
  typedef SomeIterator KernelConstFaceIter;
  //@}

  /// \name Constructor/Destructor
  //@{
  /// Default constructor
  KernelT() {}

  /// Destructor
  ~KernelT();
  //@}

  /// Assignment operator
  KernelT& operator=(const KernelT& _rhs);


  /** Reserve memory for vertices, edges, faces.
   *
   *  Reserve memory for the mesh items vertices, edges, faces.  Use
   *  this method if you can estimate the memory consumption, for
   *  instance in algorithm expanding the mesh. Depending on the
   *  underlying array type you might be better of using this method,
   *  then letting the array type decide when to increase the
   *  capacity. For instance the STL vector class \c std::vector (used
   *  in the supplied ArrayKernelT) doubles the capacity if it is
   *  exhausted. This might lead to an memory allocation exception,
   *  though an smaller increment would be enough.
   */
  void reserve( unsigned int _n_vertices,
		unsigned int _n_edges,
		unsigned int _n_faces );


  /// \name Handle -> Item.
  //@{
  /// Translate handle to item (see also OpenMesh::PolyMeshT::deref())
  const Vertex& vertex(VertexHandle _h) const { return deref(_h); }
  Vertex& vertex(VertexHandle _h) { return deref(_h); }
  const Halfedge& halfedge(HalfedgeHandle _h) const { return deref(_h); }
  Halfedge& halfedge(HalfedgeHandle _h) { return deref(_h); }
  const Edge& edge(EdgeHandle _h) const { return deref(_h); }
  Edge& edge(EdgeHandle _h) { return deref(_h); }
  const Face& face(FaceHandle _h) const { return deref(_h); }
  Face& face(FaceHandle _h) { return deref(_h); }
  //@}


  /// \name Item -> Handle
  //@{
  /// Translate item to handle
  VertexHandle handle(const Vertex& _v) const;
  HalfedgeHandle handle(const Halfedge& _he) const;
  EdgeHandle handle(const Edge& _e) const;
  FaceHandle handle(const Face& _f) const;
  //@}


  /// \name Get the i'th item
  //@{
  /// Get the i'th item
  VertexHandle   vertex_handle(unsigned int _i) const;
  HalfedgeHandle halfedge_handle(unsigned int _i) const;
  EdgeHandle     edge_handle(unsigned int _i) const;
  FaceHandle     face_handle(unsigned int _i) const;
  //@}


  /// \name Delete items
  //@{
  /// Delete all items, i.e. clear all item containers.
  void clear();
  /** Remove all items that are marked as deleted from the
      corresponding containers.
      \note Needs the Attributes::Status attribute
      \note This function may not be implemented for all kernels.
  */
  void garbage_collection();

  /** Remove the last vertex imidiately, i.e. call pop_back() for the
      VertexContainer.
  */
  void remove_last_vertex() { vertices_.pop_back(); }
  /** Remove the last edge imidiately, i.e. call pop_back() for the
      EdgeContainer. Used e.g. by the add_face() method of PolyMeshT<commit_msg>Updated docu for garbage collection<commit_after>/*===========================================================================*\
 *                                                                           *
 *                               OpenMesh                                    *
 *      Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen      *
 *                           www.openmesh.org                                *
 *                                                                           *
 *---------------------------------------------------------------------------* 
 *  This file is part of OpenMesh.                                           *
 *                                                                           *
 *  OpenMesh is free software: you can redistribute it and/or modify         * 
 *  it under the terms of the GNU Lesser General Public License as           *
 *  published by the Free Software Foundation, either version 3 of           *
 *  the License, or (at your option) any later version with the              *
 *  following exceptions:                                                    *
 *                                                                           *
 *  If other files instantiate templates or use macros                       *
 *  or inline functions from this file, or you compile this file and         *
 *  link it with other files to produce an executable, this file does        *
 *  not by itself cause the resulting executable to be covered by the        *
 *  GNU Lesser General Public License. This exception does not however       *
 *  invalidate any other reasons why the executable file might be            *
 *  covered by the GNU Lesser General Public License.                        *
 *                                                                           *
 *  OpenMesh is distributed in the hope that it will be useful,              *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
 *  GNU Lesser General Public License for more details.                      *
 *                                                                           *
 *  You should have received a copy of the GNU LesserGeneral Public          *
 *  License along with OpenMesh.  If not,                                    *
 *  see <http://www.gnu.org/licenses/>.                                      *
 *                                                                           *
\*===========================================================================*/ 

/*===========================================================================*\
 *                                                                           *             
 *   $Revision$                                                         *
 *   $Date$                   *
 *                                                                           *
\*===========================================================================*/


//=============================================================================
//
//  Kernel Concept
//
//=============================================================================


#error this file is for documentation purposes only


//== NAMESPACES ===============================================================


namespace OpenMesh {
namespace Concepts {


//== CLASS DEFINITION =========================================================


/** \ingroup mesh_concepts_group
    This class describes the minimum interface a mesh kernel
    has to implement (because the resulting mesh will rely on
    this interface).

    This is the template class the actually holds the mesh kernel
    implementation. All functions marked as internal should only be used
    by the mesh class (that inherits the kernel). The mesh may then
    provide wrapper functions that provide the same functionality.

    \todo Check, if the member list is complete.
*/
template <class FinalMeshItems> class KernelT
{
public:

  /// \name Mesh Items
  //@{

  /// Derive this type from the FinalMeshItems
  typedef typename FinalMeshItems::Vertex             Vertex;
  typedef typename FinalMeshItems::Halfedge           Halfedge;
  typedef typename FinalMeshItems::Edge               Edge;
  typedef typename FinalMeshItems::Face               Face;
  typedef typename FinalMeshItems::Point              Point;
  typedef typename FinalMeshItems::Scalar             Scalar;
  typedef typename FinalMeshItems::Normal             Normal;
  typedef typename FinalMeshItems::Color              Color;
  typedef typename FinalMeshItems::TexCoord           TexCoord;
  typedef typename FinalMeshItems::VertexHandle       VertexHandle;
  typedef typename FinalMeshItems::HalfedgeHandle     HalfedgeHandle;
  typedef typename FinalMeshItems::EdgeHandle         EdgeHandle;
  typedef typename FinalMeshItems::FaceHandle         FaceHandle;

  //@}


  /// \name Kernel Iterators
  //@{
  /// This type depends on the container type in use.
  typedef SomeIterator KernelVertexIter;
  typedef SomeIterator KernelConstVertexIter;
  typedef SomeIterator KernelEdgeIter;
  typedef SomeIterator KernelConstEdgeIter;
  typedef SomeIterator KernelFaceIter;
  typedef SomeIterator KernelConstFaceIter;
  //@}

  /// \name Constructor/Destructor
  //@{
  /// Default constructor
  KernelT() {}

  /// Destructor
  ~KernelT();
  //@}

  /// Assignment operator
  KernelT& operator=(const KernelT& _rhs);


  /** Reserve memory for vertices, edges, faces.
   *
   *  Reserve memory for the mesh items vertices, edges, faces.  Use
   *  this method if you can estimate the memory consumption, for
   *  instance in algorithm expanding the mesh. Depending on the
   *  underlying array type you might be better of using this method,
   *  then letting the array type decide when to increase the
   *  capacity. For instance the STL vector class \c std::vector (used
   *  in the supplied ArrayKernelT) doubles the capacity if it is
   *  exhausted. This might lead to an memory allocation exception,
   *  though an smaller increment would be enough.
   */
  void reserve( unsigned int _n_vertices,
		unsigned int _n_edges,
		unsigned int _n_faces );


  /// \name Handle -> Item.
  //@{
  /// Translate handle to item (see also OpenMesh::PolyMeshT::deref())
  const Vertex& vertex(VertexHandle _h) const { return deref(_h); }
  Vertex& vertex(VertexHandle _h) { return deref(_h); }
  const Halfedge& halfedge(HalfedgeHandle _h) const { return deref(_h); }
  Halfedge& halfedge(HalfedgeHandle _h) { return deref(_h); }
  const Edge& edge(EdgeHandle _h) const { return deref(_h); }
  Edge& edge(EdgeHandle _h) { return deref(_h); }
  const Face& face(FaceHandle _h) const { return deref(_h); }
  Face& face(FaceHandle _h) { return deref(_h); }
  //@}


  /// \name Item -> Handle
  //@{
  /// Translate item to handle
  VertexHandle handle(const Vertex& _v) const;
  HalfedgeHandle handle(const Halfedge& _he) const;
  EdgeHandle handle(const Edge& _e) const;
  FaceHandle handle(const Face& _f) const;
  //@}


  /// \name Get the i'th item
  //@{
  /// Get the i'th item
  VertexHandle   vertex_handle(unsigned int _i) const;
  HalfedgeHandle halfedge_handle(unsigned int _i) const;
  EdgeHandle     edge_handle(unsigned int _i) const;
  FaceHandle     face_handle(unsigned int _i) const;
  //@}


  /// \name Delete items
  //@{
  /// Delete all items, i.e. clear all item containers.
  void clear();
  /** Remove all items that are marked as deleted from the
      corresponding containers.
      \note All handles (and indices) to any entity (face, vertex,
            edge, halfedge) created before garbage collection  
            will be out of sync with the mesh, do not use them anymore!
      \note Needs the Attributes::Status attribute
      \note This function may not be implemented for all kernels.
  */
  void garbage_collection();

  /** Remove the last vertex imidiately, i.e. call pop_back() for the
      VertexContainer.
  */
  void remove_last_vertex() { vertices_.pop_back(); }
  /** Remove the last edge imidiately, i.e. call pop_back() for the
      EdgeContainer. Used e.g. by the add_face() method of PolyMeshT
{'fraction_non_alphanumeric': 0.14523911317412813, 'fraction_numerical': 0.001099370915531668, 'mean_word_length': 1.8650918635170604, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 74, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2069250', 'n_tokens_mistral': 3771, 'n_tokens_neox': 3536, 'n_words': 1402}