Ejemplo n.º 1
0
void
OutputBase::initAvailableLists()
{
  /* This flag is set to true if any postprocessor has the 'outputs' parameter set, it is then used
     to produce an warning if postprocessor output is disabled*/
  bool has_limited_pps = false;

  // Get a reference to the storage of the postprocessors
  ExecStore<PostprocessorWarehouse> & warehouse = _problem_ptr->getPostprocessorWarehouse();

  // Possible execution type flags
  ExecFlagType types[] = { EXEC_TIMESTEP, EXEC_TIMESTEP_BEGIN, EXEC_INITIAL, EXEC_JACOBIAN, EXEC_RESIDUAL, EXEC_CUSTOM };

  // Loop through each of the execution flags
  for (unsigned int i = 0; i < LENGTHOF(types); i++)
  {
    // Loop through each of the postprocessors
    for (std::vector<Postprocessor *>::const_iterator postprocessor_it = warehouse(types[i])[0].all().begin();
         postprocessor_it != warehouse(types[i])[0].all().end();
         ++postprocessor_it)
    {
      // Store the name in the available postprocessors
      Postprocessor *pps = *postprocessor_it;
      _postprocessor.available.push_back(pps->PPName());

      // Extract the list of outputs
      std::set<OutputName> pps_outputs = pps->getOutputs();

      // Hide the postprocessor if 'none' is used within the 'outputs' parameter
      if (!pps_outputs.empty() && ( pps_outputs.find("none") != pps_outputs.end() || pps_outputs.find(_name) == pps_outputs.end() ) )
        _postprocessor.hide.push_back(pps->PPName());

      // Check that the output object allows postprocessor output
      if ( pps_outputs.find(_name) != pps_outputs.end() )
      {
        if (!isParamValid("output_postprocessors"))
          mooseWarning("Postprocessor '" << pps->PPName()
                       << "' has requested to be output by the '" << _name
                       << "' outputter, but postprocessor output is not support by this type of outputter.");
      }

      // Set the flag state for postprocessors that utilize 'outputs' parameter
      if (!pps_outputs.empty())
        has_limited_pps = true;
    }
  }

  // Produce the warning when 'outputs' is used, but postprocessor output is disable
  if (has_limited_pps && isParamValid("output_postprocessors") && getParam<bool>("output_postprocessors") == false)
    mooseWarning("A Postprocessor utilizes the 'outputs' parameter; however, postprocessor output is disable for the '" << _name << "' outputter.");

  // Get a list of the available variables
  std::vector<VariableName> variables = _problem_ptr->getVariableNames();

  // Loop through the variables and store the names in the correct available lists
  for (std::vector<VariableName>::const_iterator it = variables.begin(); it != variables.end(); ++it)
  {
    if (_problem_ptr->hasVariable(*it))
    {
      MooseVariable & var = _problem_ptr->getVariable(0, *it);
      const FEType type = var.feType();
      if (type.order == CONSTANT)
        _nonlinear_elemental.available.push_back(*it);
      else
        _nonlinear_nodal.available.push_back(*it);
    }

    else if (_problem_ptr->hasScalarVariable(*it))
      _scalar.available.push_back(*it);
  }
}
Ejemplo n.º 2
0
void
Output::initAvailableLists()
{
  /* This flag is set to true if any postprocessor has the 'outputs' parameter set, it is then used
     to produce an warning if postprocessor output is disabled*/
  bool has_limited_pps = false;

  // Get a reference to the storage of the postprocessors
  ExecStore<PostprocessorWarehouse> & warehouse = _problem_ptr->getPostprocessorWarehouse();

  // Loop through each of the execution flags
  for (unsigned int i = 0; i < Moose::exec_types.size(); i++)
  {
    // Loop through each of the postprocessors
    for (std::vector<Postprocessor *>::const_iterator postprocessor_it = warehouse(Moose::exec_types[i])[0].all().begin();
         postprocessor_it != warehouse(Moose::exec_types[i])[0].all().end();
         ++postprocessor_it)
    {
      // Store the name in the available postprocessors
      Postprocessor *pps = *postprocessor_it;
      _postprocessor.available.push_back(pps->PPName());

      // Extract the list of outputs
      std::set<OutputName> pps_outputs = pps->getOutputs();

      // Check that the outputs are valid
      _app.getOutputWarehouse().checkOutputs(pps_outputs);

      /* Hide the postprocessor if:
       *  (1) The "outputs" parameter is NOT empty and
       *  (1) 'all' is NOT found in the 'outputs' parameter and
       *  (2) 'none' is used within the 'outputs' parameter or
       *  (3) this output object name is not found in the list of output names
       */
      if ( !pps_outputs.empty() && pps_outputs.find("all") == pps_outputs.end() &&
           (pps_outputs.find("none") != pps_outputs.end() || pps_outputs.find(_name) == pps_outputs.end()) )
        _postprocessor.hide.push_back(pps->PPName());

      // Check that the output object allows postprocessor output, account for "all" keyword (if it is present assume "all" was desired)
      if ( pps_outputs.find(_name) != pps_outputs.end() || pps_outputs.find("all") != pps_outputs.end() )
      {
        if (!isParamValid("output_postprocessors"))
          mooseWarning("Postprocessor '" << pps->PPName()
                       << "' has requested to be output by the '" << _name
                       << "' output, but postprocessor output is not support by this type of output object.");
      }

      // Set the flag state for postprocessors that utilize 'outputs' parameter
      if (!pps_outputs.empty() && pps_outputs.find("all") == pps_outputs.end())
        has_limited_pps = true;
    }
  }

  // Produce the warning when 'outputs' is used, but postprocessor output is disable
  if (has_limited_pps && isParamValid("output_postprocessors") && getParam<bool>("output_postprocessors") == false)
    mooseWarning("A Postprocessor utilizes the 'outputs' parameter; however, postprocessor output is disable for the '" << _name << "' output object.");

  // Get a list of the available variables
  std::vector<VariableName> variables = _problem_ptr->getVariableNames();

  // Loop through the variables and store the names in the correct available lists
  for (std::vector<VariableName>::const_iterator it = variables.begin(); it != variables.end(); ++it)
  {
    if (_problem_ptr->hasVariable(*it))
    {
      MooseVariable & var = _problem_ptr->getVariable(0, *it);
      const FEType type = var.feType();
      if (type.order == CONSTANT)
        _nonlinear_elemental.available.push_back(*it);
      else
        _nonlinear_nodal.available.push_back(*it);
    }

    else if (_problem_ptr->hasScalarVariable(*it))
      _scalar.available.push_back(*it);
  }
}