<commit_before>#include "spline.h"
#include "solve_system.h"
#include "JacobiMethod.h"
#include "omp.h"
#include <iostream>
#include <assert.h>
#include <stdlib.h>

static Point **m_generatePoints(Point **, int, int, int);
static void fillA(float *, Point *, int);
static void fillb(float *, Point *, int);
static CubicCurve* generateSpline(Point* pts, int numPoints);
Point* solveSpline(CubicCurve *, int, int);

/**
 * Checks that numSets, numPoints, and granularity are all above zero.
 * If granularity is 1, we just return the start points unchanged.
 * Otherwise, we generate points.
 */
Point** generatePoints(Point ** start, int numSets, int numPoints, int gran) {
   assert(numSets > 0);
   assert(numPoints > 0);
   assert(gran > 0);

   if (gran == 1) {
      return start;
   }
   else {
      return m_generatePoints(start, numSets, numPoints, gran);
   }
}

static Point** m_generatePoints(Point** start, int numSets, int numPoints, int gran) {
   CubicCurve** cc = new CubicCurve*[numSets];
   Point** pts = new Point*[numSets];

#pragma omp parallel for
   for (int i = 0; i < numSets; i++) {
      cc[i] = generateSpline(start[i], numPoints);
      pts[i] = solveSpline(cc[i], numPoints - 1, gran);

      delete [] cc[i];
   }

   delete [] cc;
   return pts;
}

/**<commit_msg>Turn off dynamic thread count selection<commit_after>#include "spline.h"
#include "solve_system.h"
#include "JacobiMethod.h"
#include "omp.h"
#include <iostream>
#include <assert.h>
#include <stdlib.h>

static Point **m_generatePoints(Point **, int, int, int);
static void fillA(float *, Point *, int);
static void fillb(float *, Point *, int);
static CubicCurve* generateSpline(Point* pts, int numPoints);
Point* solveSpline(CubicCurve *, int, int);

/**
 * Checks that numSets, numPoints, and granularity are all above zero.
 * If granularity is 1, we just return the start points unchanged.
 * Otherwise, we generate points.
 */
Point** generatePoints(Point ** start, int numSets, int numPoints, int gran) {
   assert(numSets > 0);
   assert(numPoints > 0);
   assert(gran > 0);

   if (gran == 1) {
      return start;
   }
   else {
      return m_generatePoints(start, numSets, numPoints, gran);
   }
}

static Point** m_generatePoints(Point** start, int numSets, int numPoints, int gran) {
   CubicCurve** cc = new CubicCurve*[numSets];
   Point** pts = new Point*[numSets];

   if (getenv("OMP_NUM_THREADS") != NULL) {
      std::cout << std::endl << "Turning off dynamic thread count. Num threads set to "
           << getenv("OMP_NUM_THREADS") << std::endl;
      omp_set_dynamic(0);
   }

#pragma omp parallel for
   for (int i = 0; i < numSets; i++) {
      cc[i] = generateSpline(start[i], numPoints);
      pts[i] = solveSpline(cc[i], numPoints - 1, gran);

      delete [] cc[i];
   }

   delete [] cc;
   return pts;
}

/**
{'fraction_non_alphanumeric': 0.14492242595204513, 'fraction_numerical': 0.005289139633286318, 'mean_word_length': 3.824829931972789, 'pattern_counts': {'":': 0, '<': 19, '<?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': '3173837', 'n_tokens_mistral': 998, 'n_tokens_neox': 961, 'n_words': 290}