<commit_before>// C++ includes
#include <iostream>
#include <string>
#include <math.h>


// Local Includes
#include "elem.h"
#include "fe.h"
#include "libmesh.h"
#include "mesh.h"
#include "perf_log.h"
#include "quadrature_gauss.h"
#include "tecplot_io.h"
#include "tree.h"
#include "xdr_io.h"



int main (int argc, char** argv)
{
  libMesh::init (argc, argv);

  
  {  
    PerfLog perf_log("main()");
    
    const unsigned int dim = 3;
  
    if (argc < 6)
      {
	std::cerr << "Usage: " << argv[0] 
		  << " ivar m0.mesh m1.mesh s0.soln s1.soln"
		  << std::endl;
	
	error();
      }

    // declare the coarse and fine meshes.
    Mesh mesh_coarse(dim);
    Mesh mesh_fine(dim);

    // Read the coarse mesh
    {
      std::cout << "Reading Mesh " << argv[2] << std::endl;
      mesh_coarse.read(argv[2]);
      mesh_coarse.print_info();
      std::cout << std::endl;
    }
    // Read the fine mesh
    {
      std::cout << "Reading Mesh " << argv[3] << std::endl;
      mesh_fine.read(argv[3]);
      mesh_fine.print_info();
      std::cout << std::endl;
    }


    std::vector<Number> coarse_solution;
    std::vector<Number> fine_solution;
    std::vector<std::string> coarse_var_names;
    std::vector<std::string> fine_var_names;
  
    // Read the coarse solution
    {
      std::cout << "Reading Soln " << argv[4] << std::endl;
      XdrIO(mesh_coarse,true).read_mgf_soln(std::string(argv[4]),
					    coarse_solution,
					    coarse_var_names);
    }

    // Read the fine solution
    {
      std::cout << "Reading Soln " << argv[5] << std::endl;
      XdrIO(mesh_fine,true).read_mgf_soln(std::string(argv[5]),
					  fine_solution,
					  fine_var_names);
    }

  
    assert (fine_var_names == coarse_var_names);


    std::vector<Number>      diff_solution  (fine_solution.size());
    std::vector<std::string> diff_var_names (fine_var_names);

    // Declare an Octree.
    perf_log.start_event("octree build");
    Trees::OctTree octree_coarse(mesh_coarse,100);
    perf_log.stop_event("octree build");
  
    std::cout << "n_active_bins() = " << octree_coarse.n_active_bins() << std::endl;

    // sanity check.  Make sure that we can find all the element
    // centroids and all the mesh nodes!
    /*
      for (unsigned int e=0; e<mesh_coarse.n_elem(); e++)
      {
      std::cout << "looking for centroid of element " << e << std::endl;
      const Elem* elem = octree_coarse.find_element(mesh_coarse.elem(e)->centroid(mesh_coarse));

      assert (elem != NULL);
      }
      for (unsigned int n=0; n<mesh_coarse.n_nodes(); n++)
      {
      std::cout << "looking for node " << n << std::endl;<commit_msg>Switch to LegacyXdrIO<commit_after>// C++ includes
#include <iostream>
#include <string>
#include <math.h>


// Local Includes
#include "elem.h"
#include "fe.h"
#include "libmesh.h"
#include "mesh.h"
#include "perf_log.h"
#include "quadrature_gauss.h"
#include "tecplot_io.h"
#include "tree.h"
#include "legacy_xdr_io.h"



int main (int argc, char** argv)
{
  libMesh::init (argc, argv);

  
  {  
    PerfLog perf_log("main()");
    
    const unsigned int dim = 3;
  
    if (argc < 6)
      {
	std::cerr << "Usage: " << argv[0] 
		  << " ivar m0.mesh m1.mesh s0.soln s1.soln"
		  << std::endl;
	
	error();
      }

    // declare the coarse and fine meshes.
    Mesh mesh_coarse(dim);
    Mesh mesh_fine(dim);

    // Read the coarse mesh
    {
      std::cout << "Reading Mesh " << argv[2] << std::endl;
      mesh_coarse.read(argv[2]);
      mesh_coarse.print_info();
      std::cout << std::endl;
    }
    // Read the fine mesh
    {
      std::cout << "Reading Mesh " << argv[3] << std::endl;
      mesh_fine.read(argv[3]);
      mesh_fine.print_info();
      std::cout << std::endl;
    }


    std::vector<Number> coarse_solution;
    std::vector<Number> fine_solution;
    std::vector<std::string> coarse_var_names;
    std::vector<std::string> fine_var_names;
  
    // Read the coarse solution
    {
      std::cout << "Reading Soln " << argv[4] << std::endl;
      LegacyXdrIO(mesh_coarse,true).read_mgf_soln(std::string(argv[4]),
					          coarse_solution,
					          coarse_var_names);
    }

    // Read the fine solution
    {
      std::cout << "Reading Soln " << argv[5] << std::endl;
      LegacyXdrIO(mesh_fine,true).read_mgf_soln(std::string(argv[5]),
					        fine_solution,
					        fine_var_names);
    }

  
    assert (fine_var_names == coarse_var_names);


    std::vector<Number>      diff_solution  (fine_solution.size());
    std::vector<std::string> diff_var_names (fine_var_names);

    // Declare an Octree.
    perf_log.start_event("octree build");
    Trees::OctTree octree_coarse(mesh_coarse,100);
    perf_log.stop_event("octree build");
  
    std::cout << "n_active_bins() = " << octree_coarse.n_active_bins() << std::endl;

    // sanity check.  Make sure that we can find all the element
    // centroids and all the mesh nodes!
    /*
      for (unsigned int e=0; e<mesh_coarse.n_elem(); e++)
      {
      std::cout << "looking for centroid of element " << e << std::endl;
      const Elem* elem = octree_coarse.find_element(mesh_coarse.elem(e)->centroid(mesh_coarse));

      assert (elem != NULL);
      }
      for (unsigned int n=0; n<mesh_coarse.n_nodes(); n++)
      {
      std::cout << "looking for node " << n << std::endl;
{'fraction_non_alphanumeric': 0.15845663982019104, 'fraction_numerical': 0.0074920397078104516, 'mean_word_length': 2.838964773544213, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 23, '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': '5280600', 'n_tokens_mistral': 2050, 'n_tokens_neox': 1905, 'n_words': 397}