<commit_before>/****************************************************************/
/*               DO NOT MODIFY THIS HEADER                      */
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*           (c) 2010 Battelle Energy Alliance, LLC             */
/*                   ALL RIGHTS RESERVED                        */
/*                                                              */
/*          Prepared by Battelle Energy Alliance, LLC           */
/*            Under Contract No. DE-AC07-05ID14517              */
/*            With the U. S. Department of Energy               */
/*                                                              */
/*            See COPYRIGHT for full restrictions               */
/****************************************************************/

#include "MaxQpsThread.h"

#include "FEProblem.h"

// libmesh includes
#include "libmesh/threads.h"
#include LIBMESH_INCLUDE_UNORDERED_SET
LIBMESH_DEFINE_HASH_POINTERS

MaxQpsThread::MaxQpsThread(FEProblem & fe_problem) :
    _fe_problem(fe_problem),
    _max(0)
{
}

// Splitting Constructor
MaxQpsThread::MaxQpsThread(MaxQpsThread & x, Threads::split /*split*/) :
    _fe_problem(x._fe_problem),
    _max(x._max)
{
}

void
MaxQpsThread::operator() (const ConstElemRange & range)
{
  ParallelUniqueId puid;
  _tid = puid.id;

  Assembly & assembly = _fe_problem.assembly(_tid);

  for (ConstElemRange::const_iterator elem_it = range.begin() ; elem_it != range.end(); ++elem_it)
  {
    const Elem * elem = *elem_it;

    assembly.reinit(elem);

    unsigned int qps = assembly.qPoints().size();

    if (qps > _max)
      _max = qps;
  }
}

void
MaxQpsThread::join(const MaxQpsThread & y)
{
  if (y._max > _max)
    _max = y._max;
}
<commit_msg>Short circuit reinitt closes #4312<commit_after>/****************************************************************/
/*               DO NOT MODIFY THIS HEADER                      */
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*           (c) 2010 Battelle Energy Alliance, LLC             */
/*                   ALL RIGHTS RESERVED                        */
/*                                                              */
/*          Prepared by Battelle Energy Alliance, LLC           */
/*            Under Contract No. DE-AC07-05ID14517              */
/*            With the U. S. Department of Energy               */
/*                                                              */
/*            See COPYRIGHT for full restrictions               */
/****************************************************************/

#include "MaxQpsThread.h"

#include "FEProblem.h"

// libmesh includes
#include "libmesh/threads.h"
#include LIBMESH_INCLUDE_UNORDERED_SET
LIBMESH_DEFINE_HASH_POINTERS

MaxQpsThread::MaxQpsThread(FEProblem & fe_problem) :
    _fe_problem(fe_problem),
    _max(0)
{
}

// Splitting Constructor
MaxQpsThread::MaxQpsThread(MaxQpsThread & x, Threads::split /*split*/) :
    _fe_problem(x._fe_problem),
    _max(x._max)
{
}

void
MaxQpsThread::operator() (const ConstElemRange & range)
{
  ParallelUniqueId puid;
  _tid = puid.id;

  Assembly & assembly = _fe_problem.assembly(_tid);

  // For short circuiting reinit
  std::set<ElemType> seen_it;
  for (ConstElemRange::const_iterator elem_it = range.begin() ; elem_it != range.end(); ++elem_it)
  {
    const Elem * elem = *elem_it;

    // Only reinit if the element type has not previously been seen
    if (seen_it.insert(elem->type()).second)
    {
      assembly.reinit(elem);

      unsigned int qps = assembly.qPoints().size();

      if (qps > _max)
        _max = qps;
    }
  }
}

void
MaxQpsThread::join(const MaxQpsThread & y)
{
  if (y._max > _max)
    _max = y._max;
}

{'fraction_non_alphanumeric': 0.16791140870460983, 'fraction_numerical': 0.008241050733968582, 'mean_word_length': 1.8124547429398987, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6939107', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1060, 'n_words': 239}