void Opzione<dim>::setup_system() { dof_handler.distribute_dofs(fe); std::cout << " Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl; constraints.clear(); DoFTools::make_hanging_node_constraints (dof_handler, constraints); constraints.close(); CompressedSparsityPattern c_sparsity(dof_handler.n_dofs()); DoFTools::make_sparsity_pattern (dof_handler, c_sparsity, constraints, false); sparsity_pattern.copy_from(c_sparsity); dd_matrix.reinit(sparsity_pattern); fd_matrix.reinit(sparsity_pattern); ff_matrix.reinit(sparsity_pattern); system_matrix.reinit(sparsity_pattern); system_M2.reinit(sparsity_pattern); typename Triangulation<dim>::cell_iterator cell = triangulation.begin (), endc = triangulation.end(); for (; cell!=endc; ++cell) for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell;++face) if (cell->face(face)->at_boundary()) cell->face(face)->set_boundary_indicator (0); cout<< "Controlling Boundary indicators\n"; vector<types::boundary_id> info; info=triangulation.get_boundary_indicators(); cout<< "Number of Boundaries: " << info.size()<< endl; cout<< "which are"<< endl; for (unsigned int i=0; i<info.size();++i) cout<< info[i] << endl; solution.reinit(dof_handler.n_dofs()); system_rhs.reinit(dof_handler.n_dofs()); grid_points=triangulation.get_vertices(); }
void set_periodicity_constraints( typename Triangulation<dim>::active_cell_iterator &cell) { double epsilon = 0.000001; for (unsigned f = 0; f < GeometryInfo<dim>::faces_per_cell; f++) { if (cell->face(f)->at_boundary()) { if (Utils::equals_double(cell->face(f)->center()[0], left_boundary_x, epsilon) || Utils::equals_double(cell->face(f)->center()[0], right_boundary_x, epsilon)) { cell->face(f)->set_boundary_id(1); } } } }
void Opzione<dim>::setup_system() { dof_handler.distribute_dofs(fe); std::cout << " Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl; CompressedSparsityPattern c_sparsity(dof_handler.n_dofs()); DoFTools::make_sparsity_pattern (dof_handler, c_sparsity); sparsity_pattern.copy_from(c_sparsity); dd_matrix.reinit(sparsity_pattern); fd_matrix.reinit(sparsity_pattern); ff_matrix.reinit(sparsity_pattern); system_matrix.reinit(sparsity_pattern); system_M2.reinit(sparsity_pattern); solution.reinit(dof_handler.n_dofs()); system_rhs.reinit(dof_handler.n_dofs()); typename Triangulation<dim>::cell_iterator cell = triangulation.begin (), endc = triangulation.end(); for (; cell!=endc; ++cell) for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell;++face) if (cell->face(face)->at_boundary()) { if ((std::fabs(cell->face(face)->center()(0) - Smin) < toll) || (std::fabs(cell->face(face)->center()(1) - Amax) < toll)) cell->face(face)->set_boundary_indicator (0); if ((std::fabs(cell->face(face)->center()(0) - Smax) < toll) || (std::fabs(cell->face(face)->center()(1) - Amin) < toll)) cell->face(face)->set_boundary_indicator (1); } }