<commit_before>// This file is part of the dune-gdt project:
//   https://github.com/dune-community/dune-gdt
// Copyright 2010-2016 dune-gdt developers and contributors. All rights reserved.
// License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// Authors:
//   <NAME>  (2016)

#include <stdio.h>
#include <stdlib.h>
#include <utility>
#include <vector>
#include <iostream>

#include "config.h"

#include <dune/xt/common/exceptions.hh>
#include <dune/xt/common/string.hh>
#include <dune/xt/common/parallel/threadmanager.hh>

#include <dune/xt/grid/information.hh>
#include <dune/xt/grid/gridprovider.hh>

#include <dune/xt/la/container/common.hh>
#include <dune/xt/la/container/eigen.hh>
#include <dune/xt/la/container/istl.hh>

#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/gmshwriter.hh>

#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#endif

#include <dune/gdt/discretefunction/datahandle.hh>
#include <dune/gdt/discretefunction/default.hh>
#include <dune/gdt/local/fluxes/interfaces.hh>
#include <dune/gdt/local/fluxes/entropybased.hh>
#include <dune/gdt/operators/fv.hh>
#include <dune/gdt/spaces/fv/product.hh>
#include <dune/gdt/timestepper/factory.hh>
#include <dune/gdt/timestepper/fractional-step.hh>
#include <dune/gdt/timestepper/implicit-rungekutta.hh>
#include <dune/gdt/test/hyperbolic/problems/fokkerplanck/sourcebeam.hh>
#include <dune/gdt/test/hyperbolic/problems/fokkerplanck/planesource.hh>
#include <dune/gdt/test/hyperbolic/problems/fokkerplanck/pointsource.hh>

struct cmp_pair_struct
{
  template <class Pair1, class Pair2>
  bool operator()(const Pair1& a, const Pair2& b)
  {
    return a.position()[0] < b.position()[0];
  }
};

int main(int argc, char** argv)
{
  const size_t num_refinements = 0;
  const auto poly = CGALWrapper::create_octaeder_spherical_triangulation(num_refinements);

  typedef typename CGALWrapper::VertexHandleType VertexHandleType;
  typedef typename CGALWrapper::FacetHandleType FacetHandleType;
  std::vector<VertexHandleType> vertices(poly.size_of_vertices());
  std::vector<FacetHandleType> facets(poly.size_of_facets());
  const auto vertices_it_end = poly.vertices_end();
  size_t index = 0;
  //  for (auto vertices_it = poly.vertices_begin(); vertices_it != vertices_it_end; ++vertices_it, ++index)
  //    vertices[index] = vertices_it;


  Dune::QuadratureRule<double, 3> quadrature_rule;
  index = 0;
  const auto facets_it_end = poly.facets_end();
  for (auto facets_it = poly.facets_begin(); facets_it != facets_it_end; ++facets_it, ++index) {
    facets[index] = facets_it;
    Dune::XT::Common::FieldVector<Dune::XT::Common::FieldVector<double, 3>, 3> vertices;
    auto halfedge_circ = facets_it->facet_begin();
    auto halfedge_circ_begin = halfedge_circ;
    size_t ii = 0;
    do {
      const auto& point = halfedge_circ->vertex()->point();
      vertices[ii] = Dune::XT::Common::FieldVector<double, 3>({point.x(), point.y(), point.z()});
    } while (++ii, ++halfedge_circ != halfedge_circ_begin);
    for (auto&& quad_point : Dune::GDT::Hyperbolic::Problems::get_quadrature_points(vertices, 4))
      quadrature_rule.push_back(quad_point);
  } // iterate over faces


  size_t num_threads = 1;
  size_t num_save_steps = 1000;
  std::string grid_size("100"), overlap_size("1");
  bool visualize = true;
  for (int i = 1; i < argc; ++i) {
    if (std::string(argv[i]) == "-num_threads") {
      if (i + 1 < argc) {
        num_threads = Dune::XT::Common::from_string<size_t>(argv[++i]);
      } else {
        std::cerr << "-num_threads option requires one argument." << std::endl;
        return 1;
      }
    } else if (std::string(argv[i]) == "-num_save_steps") {
      if (i + 1 < argc) {
        num_save_steps = Dune::XT::Common::from_string<size_t>(argv[++i]);
      } else {
        std::cerr << "-num_save_steps option requires one argument." << std::endl;
        return 1;
      }
    } else if (std::string(argv[i]) == "-grid_size") {
      if (i + 1 < argc) {
        grid_size = argv[++i];
      } else {
        std::cerr << "-grid_size option requires one argument." << std::endl;
        return 1;
      }
    } else if (std::string(argv[i]) == "-overlap_size") {
      if (i + 1 < argc) {
        overlap_size = argv[++i];
      } else {
        std::cerr << "-overlap_size option requires one argument." << std::endl;
        return 1;
      }
    } else if (std::string(argv[i]) == "--no_visualization") {
      visualize = false;
    } else {
      std::cerr << "Unknown option " << std::string(argv[i]) << std::endl;
      return 1;
    }
  }

  DXTC_CONFIG.set("threading.partition_factor", 1u, true);
  Dune::XT::Common::threadManager().set_max_threads(num_threads);

  using namespace Dune::GDT;<commit_msg>[entropytest] use shared memory parallelization together with MPI<commit_after>// This file is part of the dune-gdt project:
//   https://github.com/dune-community/dune-gdt
// Copyright 2010-2016 dune-gdt developers and contributors. All rights reserved.
// License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// Authors:
//   <NAME>  (2016)

#include <stdio.h>
#include <stdlib.h>
#include <utility>
#include <vector>
#include <iostream>

#include "config.h"

#include <dune/xt/common/exceptions.hh>
#include <dune/xt/common/string.hh>
#include <dune/xt/common/parallel/threadmanager.hh>

#include <dune/xt/grid/information.hh>
#include <dune/xt/grid/gridprovider.hh>

#include <dune/xt/la/container/common.hh>
#include <dune/xt/la/container/eigen.hh>
#include <dune/xt/la/container/istl.hh>

#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/gmshwriter.hh>

#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#endif

#include <dune/gdt/discretefunction/datahandle.hh>
#include <dune/gdt/discretefunction/default.hh>
#include <dune/gdt/local/fluxes/interfaces.hh>
#include <dune/gdt/local/fluxes/entropybased.hh>
#include <dune/gdt/operators/fv.hh>
#include <dune/gdt/spaces/fv/product.hh>
#include <dune/gdt/timestepper/factory.hh>
#include <dune/gdt/timestepper/fractional-step.hh>
#include <dune/gdt/timestepper/implicit-rungekutta.hh>
#include <dune/gdt/test/hyperbolic/problems/fokkerplanck/sourcebeam.hh>
#include <dune/gdt/test/hyperbolic/problems/fokkerplanck/planesource.hh>
#include <dune/gdt/test/hyperbolic/problems/fokkerplanck/pointsource.hh>

struct cmp_pair_struct
{
  template <class Pair1, class Pair2>
  bool operator()(const Pair1& a, const Pair2& b)
  {
    return a.position()[0] < b.position()[0];
  }
};

int main(int argc, char** argv)
{
  const size_t num_refinements = 0;
  const auto poly = CGALWrapper::create_octaeder_spherical_triangulation(num_refinements);

  typedef typename CGALWrapper::VertexHandleType VertexHandleType;
  typedef typename CGALWrapper::FacetHandleType FacetHandleType;
  std::vector<VertexHandleType> vertices(poly.size_of_vertices());
  std::vector<FacetHandleType> facets(poly.size_of_facets());
  const auto vertices_it_end = poly.vertices_end();
  size_t index = 0;
  //  for (auto vertices_it = poly.vertices_begin(); vertices_it != vertices_it_end; ++vertices_it, ++index)
  //    vertices[index] = vertices_it;


  Dune::QuadratureRule<double, 3> quadrature_rule;
  index = 0;
  const auto facets_it_end = poly.facets_end();
  for (auto facets_it = poly.facets_begin(); facets_it != facets_it_end; ++facets_it, ++index) {
    facets[index] = facets_it;
    Dune::XT::Common::FieldVector<Dune::XT::Common::FieldVector<double, 3>, 3> vertices;
    auto halfedge_circ = facets_it->facet_begin();
    auto halfedge_circ_begin = halfedge_circ;
    size_t ii = 0;
    do {
      const auto& point = halfedge_circ->vertex()->point();
      vertices[ii] = Dune::XT::Common::FieldVector<double, 3>({point.x(), point.y(), point.z()});
    } while (++ii, ++halfedge_circ != halfedge_circ_begin);
    for (auto&& quad_point : Dune::GDT::Hyperbolic::Problems::get_quadrature_points(vertices, 4))
      quadrature_rule.push_back(quad_point);
  } // iterate over faces


  size_t num_threads = 1;
  size_t num_save_steps = 1000;
  std::string grid_size("100"), overlap_size("1");
  bool visualize = true;
  for (int i = 1; i < argc; ++i) {
    if (std::string(argv[i]) == "-num_threads") {
      if (i + 1 < argc) {
        num_threads = Dune::XT::Common::from_string<size_t>(argv[++i]);
      } else {
        std::cerr << "-num_threads option requires one argument." << std::endl;
        return 1;
      }
    } else if (std::string(argv[i]) == "-num_save_steps") {
      if (i + 1 < argc) {
        num_save_steps = Dune::XT::Common::from_string<size_t>(argv[++i]);
      } else {
        std::cerr << "-num_save_steps option requires one argument." << std::endl;
        return 1;
      }
    } else if (std::string(argv[i]) == "-grid_size") {
      if (i + 1 < argc) {
        grid_size = argv[++i];
      } else {
        std::cerr << "-grid_size option requires one argument." << std::endl;
        return 1;
      }
    } else if (std::string(argv[i]) == "-overlap_size") {
      if (i + 1 < argc) {
        overlap_size = argv[++i];
      } else {
        std::cerr << "-overlap_size option requires one argument." << std::endl;
        return 1;
      }
    } else if (std::string(argv[i]) == "--no_visualization") {
      visualize = false;
    } else {
      std::cerr << "Unknown option " << std::string(argv[i]) << std::endl;
      return 1;
    }
  }

  DXTC_CONFIG.set("threading.partition_factor", 1u, true);
  Dune::XT::Common::threadManager().set_max_threads(num_threads);

  using namespace Dune::GDT;
#define USE_SMP_PARALLEL 1
{'fraction_non_alphanumeric': 0.15977071391349662, 'fraction_numerical': 0.010317873892652422, 'mean_word_length': 3.995314940135346, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 85, 'https://': 2, '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': '4711228', 'n_tokens_mistral': 3632, 'n_tokens_neox': 3472, 'n_words': 651}