<commit_before>//----------------------------  grid_refinement.cc  ---------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------  grid_refinement.cc  ---------------------------

#include <lac/vector.h>
#include <lac/petsc_vector.h>

#include <grid/grid_refinement.h>
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
#include <grid/tria.h>

#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <fstream>



namespace 
{
  template <typename number>
  inline
  number
  max_element (const Vector<number> &criteria)
  {
    return *std::max_element(criteria.begin(), criteria.end());
  }

  

  template <typename number>
  inline
  number
  min_element (const Vector<number> &criteria)
  {
    return *std::min_element(criteria.begin(), criteria.end());
  }


  
  PetscScalar
  max_element (const PETScWrappers::VectorBase &criteria)
  {
                                     // this is horribly slow (since we have
                                     // to get the array of values from PETSc
                                     // in every iteration), but works
    PetscScalar m = 0;
    for (unsigned int i=0; i<criteria.size(); ++i)
      m = std::max (m, criteria(i));
    return m;
  }



  PetscScalar
  min_element (const PETScWrappers::VectorBase &criteria)
  {
                                     // this is horribly slow (since we have
                                     // to get the array of values from PETSc
                                     // in every iteration), but works
    PetscScalar m = criteria(0);
    for (unsigned int i=1; i<criteria.size(); ++i)
      m = std::min (m, criteria(i));
    return m;
  }
}


template <class Vector>
void GridRefinement::qsort_index (const Vector              &a,
                                  std::vector<unsigned int> &ind,
                                  int                        l,
                                  int                        r)
{
  int i,j;
  typename Vector::value_type v;
  
  if (r<=l)
    return;

  v = a(ind[r]);<commit_msg>Add forgotten guards.<commit_after>//----------------------------  grid_refinement.cc  ---------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------  grid_refinement.cc  ---------------------------

#include <lac/vector.h>
#include <lac/petsc_vector.h>

#include <grid/grid_refinement.h>
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
#include <grid/tria.h>

#include <numeric>
#include <algorithm>
#include <cmath>
#include <functional>
#include <fstream>



namespace 
{
  template <typename number>
  inline
  number
  max_element (const Vector<number> &criteria)
  {
    return *std::max_element(criteria.begin(), criteria.end());
  }

  

  template <typename number>
  inline
  number
  min_element (const Vector<number> &criteria)
  {
    return *std::min_element(criteria.begin(), criteria.end());
  }


#ifdef DEAL_II_USE_PETSC  
  PetscScalar
  max_element (const PETScWrappers::VectorBase &criteria)
  {
                                     // this is horribly slow (since we have
                                     // to get the array of values from PETSc
                                     // in every iteration), but works
    PetscScalar m = 0;
    for (unsigned int i=0; i<criteria.size(); ++i)
      m = std::max (m, criteria(i));
    return m;
  }


  PetscScalar
  min_element (const PETScWrappers::VectorBase &criteria)
  {
                                     // this is horribly slow (since we have
                                     // to get the array of values from PETSc
                                     // in every iteration), but works
    PetscScalar m = criteria(0);
    for (unsigned int i=1; i<criteria.size(); ++i)
      m = std::min (m, criteria(i));
    return m;
  }
#endif
}


template <class Vector>
void GridRefinement::qsort_index (const Vector              &a,
                                  std::vector<unsigned int> &ind,
                                  int                        l,
                                  int                        r)
{
  int i,j;
  typename Vector::value_type v;
  
  if (r<=l)
    return;

  v = a(ind[r]);
{'fraction_non_alphanumeric': 0.14860997547015536, 'fraction_numerical': 0.013082583810302535, 'mean_word_length': 1.5902593965060878, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '666535', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1386, 'n_words': 408}