예제 #1
0
파일: ConsoleUtils.C 프로젝트: Biyss/moose
std::string
outputSystemInformationHelper(const System & system)
{
  std::stringstream oss;
  oss << std::left;

  if (system.n_dofs())
  {
    oss << std::setw(console_field_width) << "  Num DOFs: " << system.n_dofs() << '\n'
        << std::setw(console_field_width) << "  Num Local DOFs: " << system.n_local_dofs() << '\n';

    std::streampos begin_string_pos = oss.tellp();
    std::streampos curr_string_pos = begin_string_pos;
    oss << std::setw(console_field_width) << "  Variables: ";
    for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
    {
      const VariableGroup &vg_description (system.variable_group(vg));

      if (vg_description.n_variables() > 1) oss << "{ ";
      for (unsigned int vn=0; vn<vg_description.n_variables(); vn++)
      {
        oss << "\"" << vg_description.name(vn) << "\" ";
        curr_string_pos = oss.tellp();
        insertNewline(oss, begin_string_pos, curr_string_pos);
      }

      if (vg_description.n_variables() > 1) oss << "} ";
    }
    oss << '\n';

    begin_string_pos = oss.tellp();
    curr_string_pos = begin_string_pos;
    oss << std::setw(console_field_width) << "  Finite Element Types: ";
#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
    for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
    {
      oss << "\""
          << libMesh::Utility::enum_to_string<FEFamily>(system.get_dof_map().variable_group(vg).type().family)
          << "\" ";
      curr_string_pos = oss.tellp();
      insertNewline(oss, begin_string_pos, curr_string_pos);
    }
    oss << '\n';
#else
    for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
    {
      oss << "\""
          << libMesh::Utility::enum_to_string<FEFamily>(system.get_dof_map().variable_group(vg).type().family)
          << "\", \""
          << libMesh::Utility::enum_to_string<FEFamily>(system.get_dof_map().variable_group(vg).type().radial_family)
          << "\" ";
      curr_string_pos = oss.tellp();
      insertNewline(oss, begin_string_pos, curr_string_pos);
    }
    oss << '\n';

    begin_string_pos = oss.tellp();
    curr_string_pos = begin_string_pos;
    oss << std::setw(console_field_width) << "  Infinite Element Mapping: ";
    for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
    {
      oss << "\""
          << libMesh::Utility::enum_to_string<InfMapType>(system.get_dof_map().variable_group(vg).type().inf_map)
          << "\" ";
      curr_string_pos = oss.tellp();
      insertNewline(oss, begin_string_pos, curr_string_pos);
    }
    oss << '\n';
#endif

    begin_string_pos = oss.tellp();
    curr_string_pos = begin_string_pos;
    oss << std::setw(console_field_width) << "  Approximation Orders: ";
    for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
    {
#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
      oss << "\""
          << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().order)
          << "\" ";
#else
      oss << "\""
          << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().order)
          << "\", \""
          << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().radial_order)
          << "\" ";
#endif
      curr_string_pos = oss.tellp();
      insertNewline(oss, begin_string_pos, curr_string_pos);
    }
    oss << "\n\n";
  }

  return oss.str();
}
예제 #2
0
void
Console::outputSystemInformation()
{

  std::stringstream oss;

  // Framework information
  oss << _app.getSysInfo();

  oss << std::left << "\n"
      << "Parallelism:\n"
      << std::setw(_field_width) << "  Num Processors: "       << static_cast<std::size_t>(libMesh::n_processors()) << '\n'
      << std::setw(_field_width) << "  Num Threads: "         << static_cast<std::size_t>(libMesh::n_threads()) << '\n'
      << '\n';

  MooseMesh & moose_mesh = _problem_ptr->mesh();
  MeshBase & mesh = moose_mesh.getMesh();
  oss << "Mesh: " << '\n'
      << std::setw(_field_width) << "  Distribution: " << (moose_mesh.isParallelMesh() ? "parallel" : "serial")
      << (moose_mesh.isDistributionForced() ? " (forced) " : "") << '\n'
      << std::setw(_field_width) << "  Mesh Dimension: " << mesh.mesh_dimension() << '\n'
      << std::setw(_field_width) << "  Spatial Dimension: " << mesh.spatial_dimension() << '\n'
      << std::setw(_field_width) << "  Nodes:" << '\n'
      << std::setw(_field_width) << "    Total:" << mesh.n_nodes() << '\n'
      << std::setw(_field_width) << "    Local:" << mesh.n_local_nodes() << '\n'
      << std::setw(_field_width) << "  Elems:" << '\n'
      << std::setw(_field_width) << "    Total:" << mesh.n_elem() << '\n'
      << std::setw(_field_width) << "    Local:" << mesh.n_local_elem() << '\n'
      << std::setw(_field_width) << "  Num Subdomains: "       << static_cast<std::size_t>(mesh.n_subdomains()) << '\n'
      << std::setw(_field_width) << "  Num Partitions: "       << static_cast<std::size_t>(mesh.n_partitions()) << '\n';
  if (libMesh::n_processors() > 1 && moose_mesh.partitionerName() != "")
    oss << std::setw(_field_width) << "  Partitioner: "       << moose_mesh.partitionerName()
        << (moose_mesh.isPartitionerForced() ? " (forced) " : "")
        << '\n';
  oss << '\n';

  EquationSystems & eq = _problem_ptr->es();
  unsigned int num_systems = eq.n_systems();
  for (unsigned int i=0; i<num_systems; ++i)
  {
    const System & system = eq.get_system(i);
    if (system.system_type() == "TransientNonlinearImplicit")
      oss <<  "Nonlinear System:" << '\n';
    else if (system.system_type() == "TransientExplicit")
      oss << "Auxiliary System:" << '\n';
    else
      oss << std::setw(_field_width) << system.system_type() << '\n';

    if (system.n_dofs())
    {
      oss << std::setw(_field_width) << "  Num DOFs: " << system.n_dofs() << '\n'
          << std::setw(_field_width) << "  Num Local DOFs: " << system.n_local_dofs() << '\n';

      std::streampos begin_string_pos = oss.tellp();
      std::streampos curr_string_pos = begin_string_pos;
      oss << std::setw(_field_width) << "  Variables: ";
      for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
      {
        const VariableGroup &vg_description (system.variable_group(vg));

        if (vg_description.n_variables() > 1) oss << "{ ";
        for (unsigned int vn=0; vn<vg_description.n_variables(); vn++)
        {
          oss << "\"" << vg_description.name(vn) << "\" ";
          curr_string_pos = oss.tellp();
          insertNewline(oss, begin_string_pos, curr_string_pos);
        }

        if (vg_description.n_variables() > 1) oss << "} ";
      }
      oss << '\n';

      begin_string_pos = oss.tellp();
      curr_string_pos = begin_string_pos;
      oss << std::setw(_field_width) << "  Finite Element Types: ";
#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
      for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
      {
        oss << "\""
            << libMesh::Utility::enum_to_string<FEFamily>(system.get_dof_map().variable_group(vg).type().family)
            << "\" ";
        curr_string_pos = oss.tellp();
        insertNewline(oss, begin_string_pos, curr_string_pos);
      }
      oss << '\n';
#else
      for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
      {
        oss << "\""
            << libMesh::Utility::enum_to_string<FEFamily>(system.get_dof_map().variable_group(vg).type().family)
            << "\", \""
            << libMesh::Utility::enum_to_string<FEFamily>(system.get_dof_map().variable_group(vg).type().radial_family)
            << "\" ";
        curr_string_pos = oss.tellp();
        insertNewline(oss, begin_string_pos, curr_string_pos);
      }
      oss << '\n';

      begin_string_pos = oss.tellp();
      curr_string_pos = begin_string_pos;
      oss << std::setw(_field_width) << "  Infinite Element Mapping: ";
      for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
      {
        oss << "\""
            << libMesh::Utility::enum_to_string<InfMapType>(system.get_dof_map().variable_group(vg).type().inf_map)
            << "\" ";
        curr_string_pos = oss.tellp();
        insertNewline(oss, begin_string_pos, curr_string_pos);
      }
      oss << '\n';
#endif

      begin_string_pos = oss.tellp();
      curr_string_pos = begin_string_pos;
      oss << std::setw(_field_width) << "  Approximation Orders: ";
      for (unsigned int vg=0; vg<system.n_variable_groups(); vg++)
      {
#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
        oss << "\""
            << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().order)
            << "\" ";
#else
        oss << "\""
            << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().order)
            << "\", \""
            << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().radial_order)
            << "\" ";
#endif
        curr_string_pos = oss.tellp();
        insertNewline(oss, begin_string_pos, curr_string_pos);
      }
      oss << "\n\n";
    }
    else
      oss << "   *** EMPTY ***\n\n";
  }

  oss << "Execution Information:\n"
      << std::setw(_field_width) << "  Executioner: " << demangle(typeid(*_app.getExecutioner()).name()) << '\n';

  std::string time_stepper = _app.getExecutioner()->getTimeStepperName();
  if (time_stepper != "")
    oss << std::setw(_field_width) << "  TimeStepper: " << time_stepper << '\n';

  oss << std::setw(_field_width) << "  Solver Mode: " << Moose::stringify<Moose::SolveType>(_problem_ptr->solverParams()._type) << '\n';
  oss << '\n';

  oss.flush();

  // Output the information
  if (_write_screen)
    Moose::out << oss.str();

  if (_write_file)
    _file_output_stream << oss.str();
}