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

  Program:   Visualization Library
  Module:    LinkList.hh
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

This file is part of the Visualization Library. No part of this file or its 
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.

Copyright (c) <NAME>, <NAME>, <NAME> 1993, 1994 

=========================================================================*/
// .NAME vlLinkList - object represents upward pointers from points to list of cells using each point
// .SECTION Description
// vlLinkList is a supplemental object to CellArray and CellList to allow
// access from points to cells using the points. LinkList is a collection 
// of Links, each link represents a dynamic list of cell id's using the 
// point. The information provided by this object can be used to determine 
// neighbors and construct other local topological information.

#ifndef __vlLinkList_h
#define __vlLinkList_h

#include "RefCount.hh"
class vlDataSet;

struct vlLink {
    unsigned short ncells;
    int *cells;
};

class vlLinkList : public vlRefCount 
{
public:
  vlLinkList():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
  vlLinkList(int sz, int ext=1000);
  ~vlLinkList();
  char *GetClassName() {return "vlLinkList";};

  vlLink &GetLink(int ptId);
  unsigned short GetNcells(int ptId);
  int *GetCells(int ptId);
  void IncrementLinkCount(int ptId);
  void AllocateLinks(int n);
  void InsertCellReference(int ptId, unsigned short pos, int cellId);
  void InsertNextCellReference(int ptId, int cellId);
  void BuildLinks(vlDataSet *data);

  void DeletePoint(int ptId);
  void RemoveCellReference(int cellId, int ptId);
  void ResizeCellList(int ptId, int size);

  void Squeeze();
  void Reset();

private:
  vlLink *Array;   // pointer to data
  int Size;       // allocated size of data
  int MaxId;     // maximum index inserted thus far
  int Extend;     // grow array by this point
  vlLink *Resize(int sz);  // function to resize data
};

// Description:
// Get a link structure given a point id.
inline vlLink &vlLinkList::GetLink(int ptId) {return this->Array[ptId];};

// Description:
// Get the number of cells using this point.
inline unsigned short vlLinkList::GetNcells(int ptId) 
{
  return this->Array[ptId].ncells;
}

// Description:
// Return a list of cell ids using the point.
inline int *vlLinkList::GetCells(int ptId) {return this->Array[ptId].cells;};

// Description:<commit_msg>mods to name vlLink<commit_after>/*=========================================================================

  Program:   Visualization Library
  Module:    LinkList.hh
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

This file is part of the Visualization Library. No part of this file or its 
contents may be copied, reproduced or altered in any way without the express
written consent of the authors.

Copyright (c) <NAME>, <NAME>, <NAME> 1993, 1994 

=========================================================================*/
// .NAME vlLinkList - object represents upward pointers from points to list of cells using each point
// .SECTION Description
// vlLinkList is a supplemental object to CellArray and CellList to allow
// access from points to cells using the points. LinkList is a collection 
// of Links, each link represents a dynamic list of cell id's using the 
// point. The information provided by this object can be used to determine 
// neighbors and construct other local topological information.

#ifndef __vlLinkList_h
#define __vlLinkList_h

#include "RefCount.hh"
class vlDataSet;

struct _vlLink_s {
    unsigned short ncells;
    int *cells;
};

class vlLinkList : public vlRefCount 
{
public:
  vlLinkList():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
  vlLinkList(int sz, int ext=1000);
  ~vlLinkList();
  char *GetClassName() {return "vlLinkList";};

  _vlLink_s &GetLink(int ptId);
  unsigned short GetNcells(int ptId);
  int *GetCells(int ptId);
  void IncrementLinkCount(int ptId);
  void AllocateLinks(int n);
  void InsertCellReference(int ptId, unsigned short pos, int cellId);
  void InsertNextCellReference(int ptId, int cellId);
  void BuildLinks(vlDataSet *data);

  void DeletePoint(int ptId);
  void RemoveCellReference(int cellId, int ptId);
  void ResizeCellList(int ptId, int size);

  void Squeeze();
  void Reset();

private:
  _vlLink_s *Array;   // pointer to data
  int Size;       // allocated size of data
  int MaxId;     // maximum index inserted thus far
  int Extend;     // grow array by this point
  _vlLink_s *Resize(int sz);  // function to resize data
};

// Description:
// Get a link structure given a point id.
inline _vlLink_s &vlLinkList::GetLink(int ptId) {return this->Array[ptId];};

// Description:
// Get the number of cells using this point.
inline unsigned short vlLinkList::GetNcells(int ptId) 
{
  return this->Array[ptId].ncells;
}

// Description:
// Return a list of cell ids using the point.
inline int *vlLinkList::GetCells(int ptId) {return this->Array[ptId].cells;};

// Description:
{'fraction_non_alphanumeric': 0.14849368318756073, 'fraction_numerical': 0.006997084548104956, 'mean_word_length': 4.251020408163265, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5131286', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1483, 'n_words': 570}