<commit_before>/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkCellInterface.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef __itkCellInterface_h
#define __itkCellInterface_h

#include "itkObject.h"
#include "itkObjectFactory.h"
#include <map>
#include "itkCellInterfaceVisitor.h"
#include "itkAutoPointer.h"


// Define a macro for CellInterface sub-classes to use
// to define the Accept and GetTopologyId virtuals used
// by the MultiVisitor class
#define itkCellVisitMacro(TopologyId) \
  static int GetTopologyId() {return TopologyId;}\
  virtual void Accept(unsigned long cellid, typename CellInterface<PixelType, CellTraits>::MultiVisitor* mv)\
    {\
      CellInterfaceVisitor<PixelType, CellTraits>::Pointer v = mv->GetVisitor(TopologyId);\
      if(v)\
        {\
        v->VisitFromCell(cellid, this);\
        }\
    }



// Define a macro for the common typedefs required by the 
// classes deriving form CellInterface (included).
// This wouldn't be necessary if SGI compilers 
// were able to inherit types.
#define itkCellCommonTypedefs( celltype ) \
  typedef celltype                  Self;   \
  typedef AutoPointer<const Self>   ConstSelfAutoPointer;  \
  typedef AutoPointer<Self>         SelfAutoPointer;   \
  typedef Self *                    RawPointer;        \
  typedef const Self *              ConstRawPointer;   \
  SelfAutoPointer   New(void) {                        \
                SelfAutoPointer ptr( new celltype );   \
                ptr.TakeOwnership();                   \
                return ptr;                            \
                };                                     \


// Define a macro for the common typedefs required by the 
// classes deriving form CellInterface (excluded).
// This wouldn't be necessary if SGI compilers 
// were able to inherit types.
#define itkCellInheritedTypedefs( superclassArg ) \
  typedef superclassArg                                Superclass; \
  typedef typename Superclass::PixelType               PixelType;  \
  typedef typename Superclass::CellType                CellType;  \
  typedef typename Superclass::CellAutoPointer         CellAutoPointer;  \
  typedef typename Superclass::CellConstAutoPointer    CellConstAutoPointer;  \
  typedef typename Superclass::CellRawPointer          CellRawPointer;  \
  typedef typename Superclass::CellConstRawPointer     CellConstRawPointer;  \
  typedef typename Superclass::CellTraits              CellTraits;  \
  typedef typename Superclass::CoordRepType            CoordRepType;  \
  typedef typename Superclass::InterpolationWeightType InterpolationWeightType; \
  typedef typename Superclass::PointIdentifier         PointIdentifier; \
  typedef typename Superclass::PointIdIterator         PointIdIterator; \
  typedef typename Superclass::PointIdConstIterator    PointIdConstIterator; \
  typedef typename Superclass::CellIdentifier          CellIdentifier; \
  typedef typename Superclass::CellFeatureIdentifier   CellFeatureIdentifier; \
  typedef typename Superclass::CellFeatureIdentifier   CellFeatureCount; \
  typedef typename Superclass::PointType               PointType; \
  typedef typename Superclass::PointsContainer         PointsContainer; \
  typedef typename Superclass::UsingCellsContainer     UsingCellsContainer; \
  typedef typename Superclass::CellGeometry            CellGeometry;  \
  enum { PointDimension = Superclass::PointDimension };
 



namespace itk
{

/** \class CellInterface
 * Define an abstract interface for cells.  Actual cell types derive from
 * this class.
 *
 * Extra information in cells that are actually boundaries between other
 * cells is provided in the CellBoundary wrapper.
 *
 * Template parameters for Cell:
 *
 * TPixelType = The type stored with an entity (cell, point, or boundary).
 *
 * TCellTraits = Type information for cell.
 *
 * \ingroup MeshObjects
 */
template <
  typename TPixelType,
  typename TCellTraits
  >
class CellInterface
{
public:

  /** Standard class typedefs. */
  itkCellCommonTypedefs(CellInterface);

   /** Save the PixelType template parameter. */
  typedef TPixelType                                PixelType;
  
  /** Save the CellTraits template parameter. */
  typedef TCellTraits                                 CellTraits;

  /** Save type information for this cell. */
  typedef typename CellTraits::CoordRepType            CoordRepType;
  typedef typename CellTraits::InterpolationWeightType InterpolationWeightType;
  typedef typename CellTraits::PointIdentifier         PointIdentifier;
  typedef typename CellTraits::PointIdIterator         PointIdIterator;
  typedef typename CellTraits::PointIdConstIterator    PointIdConstIterator;
  typedef typename CellTraits::CellIdentifier          CellIdentifier;
  typedef typename CellTraits::CellFeatureIdentifier   CellFeatureIdentifier;
  typedef typename CellTraits::PointType               PointType;
  typedef typename CellTraits::PointsContainer         PointsContainer;
  typedef typename CellTraits::UsingCellsContainer     UsingCellsContainer;
    
  /** Save the dimension from the template parameters. */
  enum { PointDimension = CellTraits::PointDimension };

  /** An iterator through the UsingCellsContainer. */
  typedef typename UsingCellsContainer::iterator  UsingCellsContainerIterator;

  /** Give this and all derived classes quick access to the base cell type. */
  typedef CellInterface         CellType;
  typedef SelfAutoPointer       CellAutoPointer;
  typedef ConstSelfAutoPointer  CellConstAutoPointer;
  typedef RawPointer            CellRawPointer;
  typedef ConstRawPointer       CellConstRawPointer;
  
  /** A useful rename. */
  typedef CellFeatureIdentifier  CellFeatureCount;

  /**  Cell Visitor interfaces */
  enum CellGeometry {VERTEX_CELL=0, LINE_CELL, TRIANGLE_CELL, QUADRILATERAL_CELL, 
        POLYGON_CELL, TETRAHEDRON_CELL, HEXAHEDRON_CELL, QUADRATIC_EDGE_CELL, 
        LAST_ITK_CELL, MAX_ITK_CELLS=255};

  static int GetNextUserCellId(); // never return > MAX_INTERFACE

  /** \brief A visitor that can visit different cell types in a mesh.
   * CellInterfaceVisitor instances can be registered for each
   * type of cell that needs to be visited.
   *
   * \ingroup MeshAccess */
  class MultiVisitor : public LightObject
  { 
  public:
    /**  Visitor type, because VisualC++ 6.0 does not like
     *  Visitor being a nested type of CellInterfaceVisitor   */
    typedef CellInterfaceVisitor<TPixelType, TCellTraits> VisitorType;

    /** Standard class typedefs.   */
    typedef MultiVisitor       Self;
    typedef SmartPointer<Self>  Pointer;
      <commit_msg>ENH: enum types added for QUADRATIC_CELL and QUADRATIC_TRIANGLE_CELL<commit_after>/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkCellInterface.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef __itkCellInterface_h
#define __itkCellInterface_h

#include "itkObject.h"
#include "itkObjectFactory.h"
#include <map>
#include "itkCellInterfaceVisitor.h"
#include "itkAutoPointer.h"


// Define a macro for CellInterface sub-classes to use
// to define the Accept and GetTopologyId virtuals used
// by the MultiVisitor class
#define itkCellVisitMacro(TopologyId) \
  static int GetTopologyId() {return TopologyId;}\
  virtual void Accept(unsigned long cellid, typename CellInterface<PixelType, CellTraits>::MultiVisitor* mv)\
    {\
      CellInterfaceVisitor<PixelType, CellTraits>::Pointer v = mv->GetVisitor(TopologyId);\
      if(v)\
        {\
        v->VisitFromCell(cellid, this);\
        }\
    }



// Define a macro for the common typedefs required by the 
// classes deriving form CellInterface (included).
// This wouldn't be necessary if SGI compilers 
// were able to inherit types.
#define itkCellCommonTypedefs( celltype ) \
  typedef celltype                  Self;   \
  typedef AutoPointer<const Self>   ConstSelfAutoPointer;  \
  typedef AutoPointer<Self>         SelfAutoPointer;   \
  typedef Self *                    RawPointer;        \
  typedef const Self *              ConstRawPointer;   \
  SelfAutoPointer   New(void) {                        \
                SelfAutoPointer ptr( new celltype );   \
                ptr.TakeOwnership();                   \
                return ptr;                            \
                };                                     \


// Define a macro for the common typedefs required by the 
// classes deriving form CellInterface (excluded).
// This wouldn't be necessary if SGI compilers 
// were able to inherit types.
#define itkCellInheritedTypedefs( superclassArg ) \
  typedef superclassArg                                Superclass; \
  typedef typename Superclass::PixelType               PixelType;  \
  typedef typename Superclass::CellType                CellType;  \
  typedef typename Superclass::CellAutoPointer         CellAutoPointer;  \
  typedef typename Superclass::CellConstAutoPointer    CellConstAutoPointer;  \
  typedef typename Superclass::CellRawPointer          CellRawPointer;  \
  typedef typename Superclass::CellConstRawPointer     CellConstRawPointer;  \
  typedef typename Superclass::CellTraits              CellTraits;  \
  typedef typename Superclass::CoordRepType            CoordRepType;  \
  typedef typename Superclass::InterpolationWeightType InterpolationWeightType; \
  typedef typename Superclass::PointIdentifier         PointIdentifier; \
  typedef typename Superclass::PointIdIterator         PointIdIterator; \
  typedef typename Superclass::PointIdConstIterator    PointIdConstIterator; \
  typedef typename Superclass::CellIdentifier          CellIdentifier; \
  typedef typename Superclass::CellFeatureIdentifier   CellFeatureIdentifier; \
  typedef typename Superclass::CellFeatureIdentifier   CellFeatureCount; \
  typedef typename Superclass::PointType               PointType; \
  typedef typename Superclass::PointsContainer         PointsContainer; \
  typedef typename Superclass::UsingCellsContainer     UsingCellsContainer; \
  typedef typename Superclass::CellGeometry            CellGeometry;  \
  enum { PointDimension = Superclass::PointDimension };
 



namespace itk
{

/** \class CellInterface
 * Define an abstract interface for cells.  Actual cell types derive from
 * this class.
 *
 * Extra information in cells that are actually boundaries between other
 * cells is provided in the CellBoundary wrapper.
 *
 * Template parameters for Cell:
 *
 * TPixelType = The type stored with an entity (cell, point, or boundary).
 *
 * TCellTraits = Type information for cell.
 *
 * \ingroup MeshObjects
 */
template <
  typename TPixelType,
  typename TCellTraits
  >
class CellInterface
{
public:

  /** Standard class typedefs. */
  itkCellCommonTypedefs(CellInterface);

   /** Save the PixelType template parameter. */
  typedef TPixelType                                PixelType;
  
  /** Save the CellTraits template parameter. */
  typedef TCellTraits                                 CellTraits;

  /** Save type information for this cell. */
  typedef typename CellTraits::CoordRepType            CoordRepType;
  typedef typename CellTraits::InterpolationWeightType InterpolationWeightType;
  typedef typename CellTraits::PointIdentifier         PointIdentifier;
  typedef typename CellTraits::PointIdIterator         PointIdIterator;
  typedef typename CellTraits::PointIdConstIterator    PointIdConstIterator;
  typedef typename CellTraits::CellIdentifier          CellIdentifier;
  typedef typename CellTraits::CellFeatureIdentifier   CellFeatureIdentifier;
  typedef typename CellTraits::PointType               PointType;
  typedef typename CellTraits::PointsContainer         PointsContainer;
  typedef typename CellTraits::UsingCellsContainer     UsingCellsContainer;
    
  /** Save the dimension from the template parameters. */
  enum { PointDimension = CellTraits::PointDimension };

  /** An iterator through the UsingCellsContainer. */
  typedef typename UsingCellsContainer::iterator  UsingCellsContainerIterator;

  /** Give this and all derived classes quick access to the base cell type. */
  typedef CellInterface         CellType;
  typedef SelfAutoPointer       CellAutoPointer;
  typedef ConstSelfAutoPointer  CellConstAutoPointer;
  typedef RawPointer            CellRawPointer;
  typedef ConstRawPointer       CellConstRawPointer;
  
  /** A useful rename. */
  typedef CellFeatureIdentifier  CellFeatureCount;

  /**  Cell Visitor interfaces */
  enum CellGeometry {VERTEX_CELL=0, LINE_CELL, TRIANGLE_CELL, QUADRILATERAL_CELL, 
        POLYGON_CELL, TETRAHEDRON_CELL, HEXAHEDRON_CELL, 
        QUADRATIC_EDGE_CELL, QUADRATIC_TRIANGLE_CELL,
        LAST_ITK_CELL, MAX_ITK_CELLS=255};

  static int GetNextUserCellId(); // never return > MAX_INTERFACE

  /** \brief A visitor that can visit different cell types in a mesh.
   * CellInterfaceVisitor instances can be registered for each
   * type of cell that needs to be visited.
   *
   * \ingroup MeshAccess */
  class MultiVisitor : public LightObject
  { 
  public:
    /**  Visitor type, because VisualC++ 6.0 does not like
     *  Visitor being a nested type of CellInterfaceVisitor   */
    typedef CellInterfaceVisitor<TPixelType, TCellTraits> VisitorType;

    /** Standard class typedefs.   */
    typedef MultiVisitor       Self;
    typedef SmartPointer<Self>  Pointer;
      
{'fraction_non_alphanumeric': 0.08514769102759673, 'fraction_numerical': 0.0013867702121758425, 'mean_word_length': 3.08005657708628, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2464294', 'n_tokens_mistral': 3786, 'n_tokens_neox': 3562, 'n_words': 1102}