<commit_before>#!/usr/bin/env python

import math
import numpy
import vtk

class CoarsenSurface:

    def __init__(self, pdata):
        """
        Constructor
        @param pdata vtkPolyData instance
        """
        self.polydata = vtk.vtkPolyData()
        self.polydata.DeepCopy(pdata)
        self.points = self.polydata.GetPoints()

        self.polydata.BuildLinks()

        self.pointData = self.polydata.GetPointData()
        self.numPointData = self.pointData.GetNumberOfArrays()


    def getVtkPolyData(self):
        """
        Get the vtkPolyData instance associated with the grid
        @return vtkPolyData instance
        """
        return self.polydata

    def coarsen(self, min_cell_area = 1.e-10):
        """
        Coarsen surface by removing very small cells
        @param min_cell_area cell area tolerance
        @note operation is in place
        """

        points = self.polydata.GetPoints()
<commit_msg> + sorting of the cells<commit_after>#!/usr/bin/env python

import math
import numpy
import vtk

class CoarsenSurface:

    def __init__(self, pdata):
        """
        Constructor
        @param pdata vtkPolyData instance
        """
        self.polydata = vtk.vtkPolyData()
        self.polydata.DeepCopy(pdata)
        self.points = self.polydata.GetPoints()

        self.polydata.BuildLinks()

        self.pointData = self.polydata.GetPointData()
        self.numPointData = self.pointData.GetNumberOfArrays()

        # compute the area of each cell
        polys = self.polydata.GetPolys()
        numPolys = polys.GetNumberOfCells()
        self.polyAreas = numpy.zeros((numPolys,), numpy.float64)
        polys.InitTraversal()
        ptIds = vtk.vtkIdList()
        for polyId in range(numPolys):
            polys.GetNextCell(ptIds)
            self.polyAreas[polyId] = self.getPolygonArea(ptIds)

        # sort the cell by deacreasing cell areas
        self.sortedPolyIndices = numpy.fliplr([numpy.argsort(self.polyAreas)])[0]


    def getVtkPolyData(self):
        """
        Get the vtkPolyData instance associated with the grid
        @return vtkPolyData instance
        """
        return self.polydata

    def coarsen(self, min_cell_area = 1.e-10):
        """
        Coarsen surface by removing very small cells
        @param min_cell_area cell area tolerance
        @note operation is in place
        """

        points = self.polydata.GetPoints()

{'fraction_non_alphanumeric': 0.09012345679012346, 'fraction_numerical': 0.003703703703703704, 'mean_word_length': 2.2895805142083896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1047704', 'n_tokens_mistral': 741, 'n_tokens_neox': 716, 'n_words': 168}