<commit_before>#include "phBubble.h"
#include "phInput.h"
#include <apfMesh.h>
#include <apf.h>

namespace ph {

struct Bubble {
  int id;
  apf::Vector3 center;
  double radius;
};

typedef std::vector<Bubble> Bubbles;

void readBubbles(Bubbles& bubbles)
{
  (void)bubbles; //silence clang warning while development is done
  /* open file, read content, etc... */
}

void setBubbleScalars(apf::Mesh* m, apf::MeshEntity* v,
    Bubbles& bubbles, double* sol)
{
  apf::Vector3 v_center;
  m->getPoint(v, 0, v_center);
  /* search through bubbles, etc... */
  sol[5] = 42;
  sol[6] = 42;
}

void initBubbles(apf::Mesh* m, Input& in)
{
  Bubbles bubbles;
  readBubbles(bubbles);
  assert(in.ensa_dof >= 7);
  apf::NewArray<double> s(in.ensa_dof);
  apf::Field* f = m->findField("solution");
  apf::MeshIterator* it = m->begin(0);<commit_msg>Implementation of the routine readBubbles, passed tests successfully.<commit_after>#include <PCU.h>
#include "phBubble.h"
#include "phInput.h"
#include <apfMesh.h>
#include <apf.h>
#include <stdio.h>

namespace ph {

struct Bubble {
  int id;
  apf::Vector3 center;
  double radius;
};

typedef std::vector<Bubble> Bubbles;

void readBubbles(Bubbles& bubbles)
{
  char bubblefname[256];
  FILE *filebubble;
  Bubble readbubble;

  sprintf(bubblefname,"bubbles.inp");
  if (!PCU_Comm_Self())
    printf("reading bubbles info from %s\n",bubblefname);

  filebubble = fopen(bubblefname, "r");
  assert(filebubble != NULL); 
  while(1)
  {
    fscanf(filebubble, "%d %lf %lf %lf %lf", &readbubble.id, &readbubble.center[0], &readbubble.center[1], &readbubble.center[2], &readbubble.radius);
    if(feof(filebubble)) break;
    bubbles.push_back(readbubble);
  }
  fclose(filebubble);

  if (!PCU_Comm_Self())
    printf("%lu bubbles found in %s\n", bubbles.size(), bubblefname);

// Debug
/*
  for(unsigned long i=0; i<bubbles.size(); i++)
  {
    printf("%d %lf %lf %lf %lf\n", bubbles[i].id, bubbles[i].center[0], bubbles[i].center[1], bubbles[i].center[2], bubbles[i].radius);
  }
*/

}

void setBubbleScalars(apf::Mesh* m, apf::MeshEntity* v,
    Bubbles& bubbles, double* sol)
{
  apf::Vector3 v_center;
  m->getPoint(v, 0, v_center);
  /* search through bubbles, etc... */
  sol[5] = 42;
  sol[6] = 42;
}

void initBubbles(apf::Mesh* m, Input& in)
{
  Bubbles bubbles;
  readBubbles(bubbles);
  assert(in.ensa_dof >= 7);
  apf::NewArray<double> s(in.ensa_dof);
  apf::Field* f = m->findField("solution");
  apf::MeshIterator* it = m->begin(0);
{'fraction_non_alphanumeric': 0.1747885622231172, 'fraction_numerical': 0.013290374546919049, 'mean_word_length': 4.507760532150776, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 21, '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': '6156463', 'n_tokens_mistral': 1052, 'n_tokens_neox': 999, 'n_words': 211}