本文整理汇总了C++中EquationSystems::print_info方法的典型用法代码示例。如果您正苦于以下问题:C++ EquationSystems::print_info方法的具体用法?C++ EquationSystems::print_info怎么用?C++ EquationSystems::print_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EquationSystems
的用法示例。
在下文中一共展示了EquationSystems::print_info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_compare
/**
* everything that is identical for the systems, and
* should _not_ go into EquationSystems::compare(),
* can go in this do_compare().
*/
bool do_compare (EquationSystems & les,
EquationSystems & res,
double threshold,
bool verbose)
{
if (verbose)
{
libMesh::out << "********* LEFT SYSTEM *********" << std::endl;
les.print_info ();
libMesh::out << "********* RIGHT SYSTEM *********" << std::endl;
res.print_info ();
libMesh::out << "********* COMPARISON PHASE *********" << std::endl
<< std::endl;
}
/**
* start comparing
*/
bool result = les.compare(res, threshold, verbose);
if (verbose)
{
libMesh::out << "********* FINISHED *********" << std::endl;
}
return result;
}
示例2: main
int main (int argc, char** argv)
{
LibMeshInit init(argc, argv);
if (argc < 4)
libMesh::out << "Usage: ./prog -d DIM filename" << std::endl;
// Variables to get us started
const unsigned int dim = atoi(argv[2]);
std::string meshname (argv[3]);
// declare a mesh...
Mesh mesh(init.comm(), dim);
// Read a mesh
mesh.read(meshname);
GMVIO(mesh).write ("out_0.gmv");
mesh.elem(0)->set_refinement_flag (Elem::REFINE);
MeshRefinement mesh_refinement (mesh);
mesh_refinement.refine_and_coarsen_elements ();
mesh_refinement.uniformly_refine (2);
mesh.print_info();
// Set up the equation system(s)
EquationSystems es (mesh);
LinearImplicitSystem& primary =
es.add_system<LinearImplicitSystem>("primary");
primary.add_variable ("U", FIRST);
primary.add_variable ("V", FIRST);
primary.get_dof_map()._dof_coupling->resize(2);
(*primary.get_dof_map()._dof_coupling)(0,0) = 1;
(*primary.get_dof_map()._dof_coupling)(1,1) = 1;
primary.attach_assemble_function(assemble);
es.init ();
es.print_info ();
primary.get_dof_map().print_dof_constraints ();
// call the solver.
primary.solve ();
GMVIO(mesh).write_equation_systems ("out_1.gmv",
es);
// Refine uniformly
mesh_refinement.uniformly_refine (1);
es.reinit ();
// Write out the projected solution
GMVIO(mesh).write_equation_systems ("out_2.gmv",
es);
// Solve again. Output the refined solution
primary.solve ();
GMVIO(mesh).write_equation_systems ("out_3.gmv",
es);
return 0;
}
示例3: assemble_and_solve
void assemble_and_solve(MeshBase & mesh,
EquationSystems & equation_systems)
{
mesh.print_info();
LinearImplicitSystem & system =
equation_systems.add_system<LinearImplicitSystem> ("Poisson");
unsigned int u_var = system.add_variable("u", FIRST, LAGRANGE);
system.attach_assemble_function (assemble_poisson);
// the cube has boundaries IDs 0, 1, 2, 3, 4 and 5
std::set<boundary_id_type> boundary_ids;
for (int j = 0; j<6; ++j)
boundary_ids.insert(j);
// Create a vector storing the variable numbers which the BC applies to
std::vector<unsigned int> variables(1);
variables[0] = u_var;
ZeroFunction<> zf;
DirichletBoundary dirichlet_bc(boundary_ids,
variables,
&zf);
system.get_dof_map().add_dirichlet_boundary(dirichlet_bc);
equation_systems.init();
equation_systems.print_info();
#ifdef LIBMESH_ENABLE_AMR
MeshRefinement mesh_refinement(mesh);
mesh_refinement.refine_fraction() = 0.7;
mesh_refinement.coarsen_fraction() = 0.3;
mesh_refinement.max_h_level() = 5;
const unsigned int max_r_steps = 2;
for (unsigned int r_step=0; r_step<=max_r_steps; r_step++)
{
system.solve();
if (r_step != max_r_steps)
{
ErrorVector error;
KellyErrorEstimator error_estimator;
error_estimator.estimate_error(system, error);
libMesh::out << "Error estimate\nl2 norm = "
<< error.l2_norm()
<< "\nmaximum = "
<< error.maximum()
<< std::endl;
mesh_refinement.flag_elements_by_error_fraction (error);
mesh_refinement.refine_and_coarsen_elements();
equation_systems.reinit();
}
}
#else
system.solve();
#endif
}