コード例 #1
0
// -------------------------------------------------------------
// NonlinearSolverImplementation::p_configure
// -------------------------------------------------------------
void
NonlinearSolverImplementation::p_configure(utility::Configuration::CursorPtr props)
{
  if (props) {
    p_solutionTolerance = props->get("SolutionTolerance", p_solutionTolerance);
    p_functionTolerance = props->get("FunctionTolerance", p_functionTolerance);
    p_maxIterations = props->get("MaxIterations", p_maxIterations);
  }
}
コード例 #2
0
  /// Specialized way to configure from property tree
  void p_configure(utility::Configuration::CursorPtr props)
  {
    if (props) {
      p_solutionTolerance = props->get("SolutionTolerance", p_solutionTolerance);
      p_relativeTolerance = props->get("RelativeTolerance", p_relativeTolerance);
      p_maxIterations = props->get("MaxIterations", p_maxIterations);

      p_doSerial = props->get("ForceSerial", p_doSerial);
      p_constSerialMatrix = props->get("SerialMatrixConstant", p_constSerialMatrix);

      // SerialOnly has no effect unless parallel
      p_doSerial = (p_doSerial && (this->processor_size() > 1));

      p_guessZero = props->get("InitialGuessZero", p_guessZero);
    }
  }
コード例 #3
0
/** 
 * 
 * 
 * @param comm 
 * @param props 
 * 
 * @return PETSc options prefix to use
 */
void
PETScConfigurable::p_processOptions(utility::Configuration::CursorPtr props)
{
  if (!props) return;

  p_prefix = props->get(p_prefixKey, p_generatePrefix(p_comm));
  if (*p_prefix.rbegin() != '_') {
    p_prefix.append("_");
  }

  std::string optsorig, optsmod, optsfmt;
  optsorig = props->get(p_optionsKey, "");

  boost::char_separator<char> sep(" \t\f\n\r\v", "");
  boost::tokenizer<boost::char_separator<char> > 
    opttok(optsorig, sep);
  boost::tokenizer<boost::char_separator<char> >::iterator o;
  for (o = opttok.begin(); o != opttok.end(); ++o) {
    optsfmt.append(*o);
    optsfmt.append(" ");
    optsmod.append(prefixOptionMaybe(p_prefix, *o));
    optsmod.append(" ");
  }

  if (verbose) {
    std::cout << "p_processOptions:  in: " << optsorig << std::endl;
    std::cout << "p_processOptions: fmt: " << optsfmt << std::endl;
    std::cout << "p_processOptions: out: " << optsmod << std::endl;
  }
  p_loadedOptions = optsmod;

  PetscErrorCode ierr(0);
  try {
    ierr = PetscOptionsInsertString(
#if PETSC_VERSION_GE(3,7,0)
                                    NULL,
#endif
                                    p_loadedOptions.c_str()); CHKERRXX(ierr);
  } catch (const PETSC_EXCEPTION_TYPE& e) {
    throw PETScException(ierr, e);
  }
  return;
}