<commit_before>//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "PolycrystalVoronoiVoidIC.h"

// MOOSE includes
#include "MooseMesh.h"
#include "MooseVariable.h"
#include "DelimitedFileReader.h"
#include "GrainTrackerInterface.h"
#include "PolycrystalVoronoi.h"

InputParameters
PolycrystalVoronoiVoidIC::actionParameters()
{
  InputParameters params = ::validParams<MultiSmoothCircleIC>();

  params.addRequiredParam<unsigned int>("op_num", "Number of order parameters");

  params.addParam<bool>(
      "columnar_3D", false, "3D microstructure will be columnar in the z-direction?");

  return params;
}

registerMooseObject("PhaseFieldApp", PolycrystalVoronoiVoidIC);

InputParameters
PolycrystalVoronoiVoidIC::validParams()
{
  InputParameters params = PolycrystalVoronoiVoidIC::actionParameters();
  MooseEnum structure_options("grains voids");
  params.addRequiredParam<MooseEnum>("structure_type",
                                     structure_options,
                                     "Which structure type is being initialized, grains or voids");
  params.addParam<unsigned int>("op_index",
                                0,
                                "The index for the current "
                                "order parameter, not needed if "
                                "structure_type = voids");
  params.addRequiredParam<UserObjectName>(
      "polycrystal_ic_uo", "UserObject for obtaining the polycrystal grain structure.");
  params.addParam<FileName>(
      "file_name",
      "",
      "File containing grain centroids, if file_name is provided, the centroids "
      "from the file will be used.");
  return params;
}

PolycrystalVoronoiVoidIC::PolycrystalVoronoiVoidIC(const InputParameters & parameters)
  : MultiSmoothCircleIC(parameters),
    _structure_type(getParam<MooseEnum>("structure_type")),
    _op_num(getParam<unsigned int>("op_num")),
    _op_index(getParam<unsigned int>("op_index")),
    _columnar_3D(getParam<bool>("columnar_3D")),
    _poly_ic_uo(getUserObject<PolycrystalVoronoi>("polycrystal_ic_uo")),
    _file_name(getParam<FileName>("file_name"))
{
  if (_invalue < _outvalue)
    mooseError("PolycrystalVoronoiVoidIC requires that the voids be "
               "represented with invalue > outvalue");
  if (_numbub == 0)
    mooseError("PolycrystalVoronoiVoidIC requires numbub > 0. If you want no voids to "
               "be "
               "represented, use invalue = outvalue. In general, you should use "
               "PolycrystalVoronoi to represent Voronoi grain structures without "
               "voids.");
}

void
PolycrystalVoronoiVoidIC::initialSetup()
{
  if (_op_num <= _op_index)
    mooseError("op_index is too large in CircleGrainVoidIC");
<commit_msg>Change error into a warning #19279<commit_after>//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "PolycrystalVoronoiVoidIC.h"

// MOOSE includes
#include "MooseMesh.h"
#include "MooseVariable.h"
#include "DelimitedFileReader.h"
#include "GrainTrackerInterface.h"
#include "PolycrystalVoronoi.h"

InputParameters
PolycrystalVoronoiVoidIC::actionParameters()
{
  InputParameters params = ::validParams<MultiSmoothCircleIC>();

  params.addRequiredParam<unsigned int>("op_num", "Number of order parameters");

  params.addParam<bool>(
      "columnar_3D", false, "3D microstructure will be columnar in the z-direction?");

  return params;
}

registerMooseObject("PhaseFieldApp", PolycrystalVoronoiVoidIC);

InputParameters
PolycrystalVoronoiVoidIC::validParams()
{
  InputParameters params = PolycrystalVoronoiVoidIC::actionParameters();
  MooseEnum structure_options("grains voids");
  params.addRequiredParam<MooseEnum>("structure_type",
                                     structure_options,
                                     "Which structure type is being initialized, grains or voids");
  params.addParam<unsigned int>("op_index",
                                0,
                                "The index for the current "
                                "order parameter, not needed if "
                                "structure_type = voids");
  params.addRequiredParam<UserObjectName>(
      "polycrystal_ic_uo", "UserObject for obtaining the polycrystal grain structure.");
  params.addParam<FileName>(
      "file_name",
      "",
      "File containing grain centroids, if file_name is provided, the centroids "
      "from the file will be used.");
  return params;
}

PolycrystalVoronoiVoidIC::PolycrystalVoronoiVoidIC(const InputParameters & parameters)
  : MultiSmoothCircleIC(parameters),
    _structure_type(getParam<MooseEnum>("structure_type")),
    _op_num(getParam<unsigned int>("op_num")),
    _op_index(getParam<unsigned int>("op_index")),
    _columnar_3D(getParam<bool>("columnar_3D")),
    _poly_ic_uo(getUserObject<PolycrystalVoronoi>("polycrystal_ic_uo")),
    _file_name(getParam<FileName>("file_name"))
{
  if (_invalue < _outvalue)
    mooseWarning("Detected invalue < outvalue in PolycrystalVoronoiVoidIC. Please make sure that's "
                 "the intended usage for representing voids.");
  if (_numbub == 0)
    mooseError("PolycrystalVoronoiVoidIC requires numbub > 0. If you want no voids to "
               "be "
               "represented, use invalue = outvalue. In general, you should use "
               "PolycrystalVoronoi to represent Voronoi grain structures without "
               "voids.");
}

void
PolycrystalVoronoiVoidIC::initialSetup()
{
  if (_op_num <= _op_index)
    mooseError("op_index is too large in CircleGrainVoidIC");

{'fraction_non_alphanumeric': 0.1054706752094628, 'fraction_numerical': 0.004435682602267127, 'mean_word_length': 3.421205519244735, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 32, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6884830', 'n_tokens_mistral': 1885, 'n_tokens_neox': 1855, 'n_words': 408}