dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
std::cout << "Triangulation:"
<< "\n\t Number of active cells: "
<< triangulation.n_active_cells()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
std::cout << "Triangulation:"
<< "\n\t Number of active cells: "
<< triangulation.n_active_cells()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
std::cout << "Triangulation:"
<< "\n\t Number of active cells: "
<< triangulation.n_active_cells()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
std::cout << "Triangulation:"
<< "\n\t Number of active cells: "
<< triangulation.n_active_cells()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
std::cout << "Triangulation:"
<< "\n\t Number of active cells: "
<< triangulation.n_active_cells()
// check some things about Nedelec elements, here that
-// DoFTools::component_select and DoFTools::count_dofs_per_component
+// DoFTools::component_select and DoFTools::count_dofs_per_fe_component
// works
//
// this program is a modified version of one by Anna Schneebeli,
{
deallog << "Checking for component " << c << std::endl;
std::vector<bool> x(fe.n_components(), false);
- x[c] = true;
- IndexSet sel = DoFTools::extract_dofs(dof_handler, ComponentMask(x));
+ x[c] = true;
+ const IndexSet sel =
+ DoFTools::extract_dofs(dof_handler, ComponentMask(x));
for (unsigned int i = 0; i < sel.size(); ++i)
if (sel.is_element(i))
deallog << " DoF " << i << std::endl;
};
- std::vector<types::global_dof_index> dofs_per_component(
- fe.n_components(), static_cast<types::global_dof_index>(0));
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
deallog << "DoFs per component: ";
for (unsigned int i = 0; i < fe.n_components(); ++i)
deallog << dofs_per_component[i] << ' ';
ImposeBC<dim>::get_ready()
{
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_comp(fe.n_components());
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_comp);
+ const std::vector<types::global_dof_index> dofs_per_comp =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
// For an FESystem with Nedelec-elements as
// first component and bilinear elements as
// no grouping
{
- std::vector<types::global_dof_index> dpc(dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
print(dpc);
}
{
- std::vector<types::global_dof_index> dpc(dim + 1);
- DoFTools::count_dofs_per_block(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler);
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 0);
group[dim] = 1;
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_component(dof_handler, dpc, false, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler, false, group);
Assert(dpc.size() == 2, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 0);
group[dim] = 1;
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_block(dof_handler, dpc, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler, group);
Assert(dpc.size() == 2, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 2 * dim);
group[dim] = 0;
- std::vector<types::global_dof_index> dpc(2 * dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dpc, false, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler, false, group);
Assert(dpc.size() == 2 * dim + 1, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 2 * dim);
group[dim] = 0;
- std::vector<types::global_dof_index> dpc(2 * dim + 1);
- DoFTools::count_dofs_per_block(dof_handler, dpc, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler, group);
Assert(dpc.size() == 2 * dim + 1, ExcInternalError());
print(dpc);
}
// no grouping
{
- std::vector<types::global_dof_index> dpc(dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
print(dpc);
}
{
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_block(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler);
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 0);
group[dim] = 1;
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_component(dof_handler, dpc, false, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler, false, group);
Assert(dpc.size() == 2, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(2, 0);
group[1] = 1;
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_block(dof_handler, dpc, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler, group);
Assert(dpc.size() == 2, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 2 * dim);
group[dim] = 0;
- std::vector<types::global_dof_index> dpc(2 * dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dpc, false, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler, false, group);
Assert(dpc.size() == 2 * dim + 1, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(2, 2 * dim);
group[1] = 0;
- std::vector<types::global_dof_index> dpc(2 * dim + 1);
- DoFTools::count_dofs_per_block(dof_handler, dpc, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler, group);
Assert(dpc.size() == 2 * dim + 1, ExcInternalError());
print(dpc);
}
dof_handler.distribute_dofs(fe_system);
// count dofs per component and show them on the screen
- std::vector<types::global_dof_index> dofs_per_component(3, 0);
- std::vector<types::global_dof_index> dofs_per_component_hp(3, 0);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
- DoFTools::count_dofs_per_component(hp_dof_handler, dofs_per_component_hp);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
+ const std::vector<types::global_dof_index> dofs_per_component_hp =
+ DoFTools::count_dofs_per_fe_component(hp_dof_handler);
for (unsigned int i = 0; i < 3; i++)
{
hp_dof_handler.distribute_dofs(fe_collection);
// count dofs per component and show them on the screen
- std::vector<types::global_dof_index> dofs_per_component_hp(3, 0);
- DoFTools::count_dofs_per_component(hp_dof_handler, dofs_per_component_hp);
+ const std::vector<types::global_dof_index> dofs_per_component_hp =
+ DoFTools::count_dofs_per_fe_component(hp_dof_handler);
for (unsigned int i = 0; i < 3; i++)
{
-// Test DoFTools::count_dofs_per_block
+// Test DoFTools::count_dofs_per_fe_block
#include <deal.II/base/tensor.h>
triangulation.execute_coarsening_and_refinement();
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_block(fe.n_components());
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler);
AssertThrow(std::accumulate(dofs_per_block.begin(),
dofs_per_block.end(),
-// Test DoFTools::count_dofs_per_component
+// Test DoFTools::count_dofs_per_fe_component
#include <deal.II/base/tensor.h>
triangulation.refine_global(2);
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_component(fe.n_components());
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
Assert(std::accumulate(dofs_per_component.begin(),
dofs_per_component.end(),
-// Test DoFTools::count_dofs_per_block
+// Test DoFTools::count_dofs_per_fe_block
//
// like the test without the hp_ prefix, but for hp::DoFHandler
triangulation.execute_coarsening_and_refinement();
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_block(fe.n_components());
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler);
AssertThrow(std::accumulate(dofs_per_block.begin(),
dofs_per_block.end(),
-// Test DoFTools::count_dofs_per_component
+// Test DoFTools::count_dofs_per_fe_component
//
// like the test without the hp_ prefix, but for hp::DoFHandler
triangulation.refine_global(2);
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_component(fe.n_components());
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
Assert(std::accumulate(dofs_per_component.begin(),
dofs_per_component.end(),
deallog << "n_dofs:" << dof_handler.n_dofs() << std::endl;
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
deallog << ' ' << dofs_per_component[i];
deallog << std::endl;
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component, true);
+ dofs_per_component = DoFTools::count_dofs_per_fe_component(dof_handler, true);
for (unsigned int i = 0; i < n_components; ++i)
deallog << ' ' << dofs_per_component[i];
if (n_components > 1)
{
std::vector<unsigned int> target_component(n_components, 0U);
- dofs_per_component.resize(1);
- DoFTools::count_dofs_per_component(dof_handler,
- dofs_per_component,
- false,
- target_component);
+ dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler,
+ false,
+ target_component);
for (unsigned int i = 0;
i < std::min(n_components, (unsigned int)dofs_per_component.size());
++i)
deallog << ' ' << dofs_per_component[i];
deallog << std::endl;
- DoFTools::count_dofs_per_component(dof_handler,
- dofs_per_component,
- true,
- target_component);
+ dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler,
+ true,
+ target_component);
for (unsigned int i = 0;
i < std::min(n_components, (unsigned int)dofs_per_component.size());
++i)
target_component[i] = 1;
dofs_per_component.resize(2);
- DoFTools::count_dofs_per_component(dof_handler,
- dofs_per_component,
- false,
- target_component);
+ dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler,
+ false,
+ target_component);
for (unsigned int i = 0;
i < std::min(n_components, (unsigned int)dofs_per_component.size());
++i)
deallog << ' ' << dofs_per_component[i];
deallog << std::endl;
- DoFTools::count_dofs_per_component(dof_handler,
- dofs_per_component,
- true,
- target_component);
+ dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler,
+ true,
+ target_component);
for (unsigned int i = 0;
i < std::min(n_components, (unsigned int)dofs_per_component.size());
++i)
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
BlockSparsityPattern sp(n_components, n_components);
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int j = 0; j < n_components; ++j)
sp.block(i, j).reinit(dofs_per_component[i],
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
- BlockDynamicSparsityPattern sp(n_components, n_components);
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ BlockDynamicSparsityPattern sp(n_components, n_components);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int j = 0; j < n_components; ++j)
sp.block(i, j).reinit(dofs_per_component[i], dofs_per_component[j]);
return;
// create sparsity pattern
- BlockSparsityPattern sp(n_components, n_components);
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ BlockSparsityPattern sp(n_components, n_components);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int j = 0; j < n_components; ++j)
sp.block(i, j).reinit(dofs_per_component[i],
return;
// create sparsity pattern
- BlockDynamicSparsityPattern sp(n_components, n_components);
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ BlockDynamicSparsityPattern sp(n_components, n_components);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int j = 0; j < n_components; ++j)
sp.block(i, j).reinit(dofs_per_component[i], dofs_per_component[j]);
{
const types::global_dof_index n_dofs = dof_handler.n_dofs();
- std::vector<bool> hanging_node_dofs(n_dofs);
- DoFTools::extract_hanging_node_dofs(dof_handler, hanging_node_dofs);
+ const IndexSet hanging_node_dofs =
+ DoFTools::extract_hanging_node_dofs(dof_handler);
AffineConstraints<double> constraints;
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
constraints.close();
for (types::global_dof_index dof = 0; dof < n_dofs; ++dof)
- if (hanging_node_dofs[dof])
+ if (hanging_node_dofs.is_element(dof))
AssertThrow(constraints.is_constrained(dof), ExcInternalError());
- AssertThrow((unsigned int)std::count(hanging_node_dofs.begin(),
- hanging_node_dofs.end(),
- true) == constraints.n_constraints(),
+ AssertThrow(hanging_node_dofs.n_elements() == constraints.n_constraints(),
ExcInternalError());
output_bool_vector(hanging_node_dofs);
}
IndexSet locally_relevant_dofs;
DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs);
- std::vector<bool> is_hanging_node_constrained(n_dofs);
- DoFTools::extract_hanging_node_dofs(dof_handler, is_hanging_node_constrained);
+ const IndexSet is_hanging_node_constrained =
+ DoFTools::extract_hanging_node_dofs(dof_handler);
AffineConstraints<double> constraints(locally_relevant_dofs);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
constraints.close();
for (const auto &dof : locally_relevant_dofs)
- if (is_hanging_node_constrained[dof])
+ if (is_hanging_node_constrained.is_element(dof))
AssertThrow(constraints.is_constrained(dof), ExcInternalError());
- AssertThrow((unsigned int)(std::count(is_hanging_node_constrained.begin(),
- is_hanging_node_constrained.end(),
- true)) == constraints.n_constraints(),
+ AssertThrow(is_hanging_node_constrained.n_elements() ==
+ constraints.n_constraints(),
ExcInternalError());
deallog << "OK" << std::endl;
#include "dof_tools_common_fake_hp.h"
// check
-// DoFTools::count_dofs_per_component
+// DoFTools::count_dofs_per_fe_component
void
check_this(const DoFHandlerType &dof_handler)
{
- std::vector<types::global_dof_index> n_dofs(
- dof_handler.get_fe().n_components());
- DoFTools::count_dofs_per_component(dof_handler, n_dofs);
+ const std::vector<types::global_dof_index> n_dofs =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_dofs.size(); ++i)
deallog << n_dofs[i] << " ";
deallog << std::endl;
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
BlockSparsityPattern sp(n_components, n_components);
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int j = 0; j < n_components; ++j)
sp.block(i, j).reinit(dofs_per_component[i],
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
- BlockDynamicSparsityPattern sp(n_components, n_components);
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ BlockDynamicSparsityPattern sp(n_components, n_components);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int j = 0; j < n_components; ++j)
sp.block(i, j).reinit(dofs_per_component[i], dofs_per_component[j]);
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
BlockSparsityPattern sp(n_components, n_components);
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int j = 0; j < n_components; ++j)
sp.block(i, j).reinit(dofs_per_component[i],
// create sparsity pattern
const unsigned int n_components = dof_handler.get_fe().n_components();
- BlockDynamicSparsityPattern sp(n_components, n_components);
- std::vector<types::global_dof_index> dofs_per_component(n_components);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ BlockDynamicSparsityPattern sp(n_components, n_components);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
for (unsigned int i = 0; i < n_components; ++i)
for (unsigned int j = 0; j < n_components; ++j)
sp.block(i, j).reinit(dofs_per_component[i], dofs_per_component[j]);
//
// this particular test checks the call path to
// internal::extract_dofs_by_component from
-// DoFTools::count_dofs_per_component with argument only_once=false
+// DoFTools::count_dofs_per_fe_component with argument only_once=false
#include <deal.II/dofs/dof_handler.h>
DoFHandler<dim> dof(tr);
dof.distribute_dofs(element);
- std::vector<types::global_dof_index> count(element.n_components());
- DoFTools::count_dofs_per_component(dof, count, false);
+ const std::vector<types::global_dof_index> count =
+ DoFTools::count_dofs_per_fe_component(dof, false);
for (unsigned int d = 0; d < count.size(); ++d)
deallog << count[d] << std::endl;
//
// this particular test checks the call path to
// internal::extract_dofs_by_component from
-// DoFTools::count_dofs_per_component with argument only_once=false
+// DoFTools::count_dofs_per_fe_component with argument only_once=false
#include <deal.II/dofs/dof_tools.h>
dof.begin_active()->set_active_fe_index(1);
dof.distribute_dofs(element);
- std::vector<types::global_dof_index> count(element.n_components());
- DoFTools::count_dofs_per_component(dof, count, false);
+ const std::vector<types::global_dof_index> count =
+ DoFTools::count_dofs_per_fe_component(dof, false);
for (unsigned int d = 0; d < count.size(); ++d)
deallog << count[d] << std::endl;
//
// this particular test checks the call path to
// internal::extract_dofs_by_component from
-// DoFTools::count_dofs_per_component with argument only_once=true
+// DoFTools::count_dofs_per_fe_component with argument only_once=true
#include <deal.II/dofs/dof_handler.h>
DoFHandler<dim> dof(tr);
dof.distribute_dofs(element);
- std::vector<types::global_dof_index> count(element.n_components());
- DoFTools::count_dofs_per_component(dof, count, true);
+ const std::vector<types::global_dof_index> count =
+ DoFTools::count_dofs_per_fe_component(dof, true);
for (unsigned int d = 0; d < count.size(); ++d)
deallog << count[d] << std::endl;
//
// this particular test checks the call path to
// internal::extract_dofs_by_component from
-// DoFTools::count_dofs_per_component with argument only_once=true
+// DoFTools::count_dofs_per_fe_component with argument only_once=true
#include <deal.II/dofs/dof_tools.h>
dof.begin_active()->set_active_fe_index(1);
dof.distribute_dofs(element);
- std::vector<types::global_dof_index> count(element.n_components());
- DoFTools::count_dofs_per_component(dof, count, true);
+ const std::vector<types::global_dof_index> count =
+ DoFTools::count_dofs_per_fe_component(dof, true);
for (unsigned int d = 0; d < count.size(); ++d)
deallog << count[d] << std::endl;
}
}
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
constraints.close();
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
deallog << " Number of active cells: " << triangulation.n_active_cells()
DoFRenumbering::component_wise(dof_handler);
// total number of dof per block component
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_stress_dof = dofs_per_block[0];
const unsigned int n_gamma_dof = dofs_per_block[1];
DoFRenumbering::component_wise(dof_handler);
// total number of dof per block component
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_stress_dof = dofs_per_block[0];
const unsigned int n_gamma_dof = dofs_per_block[1];
DoFRenumbering::component_wise(dof_handler);
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_stress_dof = dofs_per_block[0];
const unsigned int n_gamma_dof = dofs_per_block[1];
DoFRenumbering::component_wise(dof_handler);
// total number of dof per block component
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_stress_dof = dofs_per_block[0];
const unsigned int n_gamma_dof = dofs_per_block[1];
stokes_dof_handler.distribute_dofs(stokes_fe);
DoFRenumbering::component_wise(stokes_dof_handler, stokes_sub_blocks);
- std::vector<types::global_dof_index> stokes_dofs_per_block(2);
- DoFTools::count_dofs_per_block(stokes_dof_handler,
- stokes_dofs_per_block,
- stokes_sub_blocks);
+ const std::vector<types::global_dof_index> stokes_dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(stokes_dof_handler, stokes_sub_blocks);
const unsigned int n_u = stokes_dofs_per_block[0],
n_p = stokes_dofs_per_block[1];
stokes_dof_handler.distribute_dofs(stokes_fe);
DoFRenumbering::component_wise(stokes_dof_handler, stokes_sub_blocks);
- std::vector<types::global_dof_index> stokes_dofs_per_block(2);
- DoFTools::count_dofs_per_block(stokes_dof_handler,
- stokes_dofs_per_block,
- stokes_sub_blocks);
+ const std::vector<types::global_dof_index> stokes_dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(stokes_dof_handler, stokes_sub_blocks);
const unsigned int n_u = stokes_dofs_per_block[0],
n_p = stokes_dofs_per_block[1];
dof_handler.distribute_dofs(fe);
DoFRenumbering::block_wise(dof_handler);
- std::vector<types::global_dof_index> dofs_per_block(fe.n_blocks());
- std::vector<unsigned int> sub_blocks(fe.n_blocks(), 0);
+ std::vector<unsigned int> sub_blocks(fe.n_blocks(), 0);
sub_blocks[1] = 1;
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, sub_blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, sub_blocks);
deallog << "size: " << dofs_per_block[0] << " " << dofs_per_block[1]
<< std::endl;
dof_handler.distribute_dofs(fe);
DoFRenumbering::block_wise(dof_handler);
- std::vector<types::global_dof_index> dofs_per_block(fe.n_blocks());
- std::vector<unsigned int> sub_blocks(fe.n_blocks(), 0);
+ std::vector<unsigned int> sub_blocks(fe.n_blocks(), 0);
sub_blocks[1] = 1;
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, sub_blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, sub_blocks);
deallog << "size: " << dofs_per_block[0] << " " << dofs_per_block[1]
<< std::endl;
// no grouping
{
- std::vector<types::global_dof_index> dpc(dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
print(dpc);
}
{
- std::vector<types::global_dof_index> dpc(dim + 1);
- DoFTools::count_dofs_per_block(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler);
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 0);
group[dim] = 1;
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_component(dof_handler, dpc, false, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler, false, group);
Assert(dpc.size() == 2, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 0);
group[dim] = 1;
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_block(dof_handler, dpc, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler, group);
Assert(dpc.size() == 2, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 2 * dim);
group[dim] = 0;
- std::vector<types::global_dof_index> dpc(2 * dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dpc, false, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler, false, group);
Assert(dpc.size() == 2 * dim + 1, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 2 * dim);
group[dim] = 0;
- std::vector<types::global_dof_index> dpc(2 * dim + 1);
- DoFTools::count_dofs_per_block(dof_handler, dpc, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler, group);
Assert(dpc.size() == 2 * dim + 1, ExcInternalError());
print(dpc);
}
// no grouping
{
- std::vector<types::global_dof_index> dpc(dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
print(dpc);
}
{
- std::vector<types::global_dof_index> dpc(dim + 1);
- DoFTools::count_dofs_per_block(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler);
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 0);
group[dim] = 1;
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_component(dof_handler, dpc, false, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler, false, group);
Assert(dpc.size() == 2, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 0);
group[dim] = 1;
- std::vector<types::global_dof_index> dpc(2);
- DoFTools::count_dofs_per_block(dof_handler, dpc, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler, group);
Assert(dpc.size() == 2, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 2 * dim);
group[dim] = 0;
- std::vector<types::global_dof_index> dpc(2 * dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dpc, false, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler, false, group);
Assert(dpc.size() == 2 * dim + 1, ExcInternalError());
print(dpc);
}
{
std::vector<unsigned int> group(dim + 1, 2 * dim);
group[dim] = 0;
- std::vector<types::global_dof_index> dpc(2 * dim + 1);
- DoFTools::count_dofs_per_block(dof_handler, dpc, group);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_block(dof_handler, group);
Assert(dpc.size() == 2 * dim + 1, ExcInternalError());
print(dpc);
}
dof_handler); // do renumberring; must be done
// right after distributing DoF !!!
DoFRenumbering::component_wise(dof_handler, block_component);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
deallog << "dofs per block: U=" << dofs_per_block[u_block]
<< " L=" << dofs_per_block[lambda_block] << std::endl;
locally_relevant_dofs = DoFTools::locally_relevant_dofs_per_subdomain(
dof_handler)[this_mpi_process];
- const unsigned int n_blocks = block_component.size();
- std::vector<types::global_dof_index> dofs_per_block(n_blocks);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ const unsigned int n_blocks = block_component.size();
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
locally_owned_partitioning.clear();
locally_relevant_partitioning.clear();
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_component(2);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
const unsigned int n_u = dofs_per_component[0], n_p = dofs_per_component[1];
BlockDynamicSparsityPattern dsp(2, 2);
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dpc(3);
- DoFTools::count_dofs_per_component(dof_handler, dpc);
+ const std::vector<types::global_dof_index> dpc =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
BlockDynamicSparsityPattern dsp(3, 3);
for (unsigned int i = 0; i < 3; ++i)
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_component(2);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
const unsigned int n_u = dofs_per_component[0], n_p = dofs_per_component[1];
BlockDynamicSparsityPattern dsp(2, 2);
block_component[comp] = 2;
} // comp
- std::vector<types::global_dof_index> dofs_per_block(
- 3, 0); // 3 blocks, count dofs:
- DoFTools::count_dofs_per_component(dh,
- dofs_per_block,
- false,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_component(dh, false, block_component);
DoFRenumbering::component_wise(dh, block_component);
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_component(2);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
const unsigned int n_u = dofs_per_component[0], n_p = dofs_per_component[1];
BlockDynamicSparsityPattern dsp(2, 2);
// Setup system
dof_handler.distribute_dofs(fe);
DoFRenumbering::component_wise(dof_handler, block_component);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
std::vector<IndexSet> partitioning(2);
partitioning[0] = complete_index_set(dofs_per_block[0]);
partitioning[1] = complete_index_set(dofs_per_block[1]);
// Setup system
dof_handler.distribute_dofs(fe);
DoFRenumbering::component_wise(dof_handler, block_component);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
locally_owned_dofs = dof_handler.locally_owned_dofs();
locally_owned_partitioning.push_back(
fe.component_mask(velocities));
}
constraints.close();
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
deallog << " Number of active cells: " << triangulation.n_active_cells()
<< std::endl
DoFTools::make_hanging_node_constraints(dof_handler_p, constraints_p);
constraints_p.close();
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- stokes_sub_blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, stokes_sub_blocks);
// std::cout << "Number of active cells: "
// << triangulation.n_active_cells()
constraints.close();
- std::vector<types::global_dof_index> dofs_per_block(dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_block);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
// std::cout << " Number of active cells: "
// << triangulation.n_active_cells()
DoFTools::make_hanging_node_constraints(dof_p, constraints_p);
constraints_p.close();
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof, dofs_per_block, stokes_sub_blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof, stokes_sub_blocks);
{
BlockDynamicSparsityPattern csp(2, 2);
constraints);
constraints.close();
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- stokes_sub_blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, stokes_sub_blocks);
{
BlockDynamicSparsityPattern csp(2, 2);
DoFTools::make_hanging_node_constraints(dof_handler_p, constraints_p);
constraints_p.close();
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- stokes_sub_blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, stokes_sub_blocks);
// std::cout << "Number of active cells: "
// << triangulation.n_active_cells()
DoFTools::make_hanging_node_constraints(dof_handler_p, constraints_p);
constraints_p.close();
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- stokes_sub_blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, stokes_sub_blocks);
// std::cout << "Number of active cells: "
// << triangulation.n_active_cells()
constraints.close();
- std::vector<types::global_dof_index> dofs_per_block(dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_block);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
// std::cout << " Number of active cells: "
// << triangulation.n_active_cells()
constraints.close();
- std::vector<types::global_dof_index> dofs_per_block(dim + 1);
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_block);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
// std::cout << " Number of active cells: "
// << triangulation.n_active_cells()
-// test DoFTools::count_dofs_per_block in parallel
+// test DoFTools::count_dofs_per_fe_block in parallel
#include <deal.II/base/tensor.h>
DoFHandler<dim> dof_handler(triangulation);
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_block(fe.n_blocks());
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler);
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
for (unsigned int i = 0; i < fe.n_blocks(); ++i)
-// Test DoFTools::count_dofs_per_block
+// Test DoFTools::count_dofs_per_fe_block
#include <deal.II/base/tensor.h>
triangulation.execute_coarsening_and_refinement();
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_block(fe.n_components());
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler);
AssertThrow(std::accumulate(dofs_per_block.begin(),
dofs_per_block.end(),
-// Test DoFTools::count_dofs_per_component
+// Test DoFTools::count_dofs_per_fe_component
#include <deal.II/base/tensor.h>
triangulation.refine_global(2);
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_component(fe.n_components());
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
AssertThrow(std::accumulate(dofs_per_component.begin(),
dofs_per_component.end(),
DoFRenumbering::component_wise(dof_handler, block_component);
std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- block_component);
+ DoFTools::count_dofs_per_fe_block(dof_handler,
+ dofs_per_block,
+ block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
std::vector<IndexSet> owned_partitioning1;
std::vector<IndexSet> relevant_partitioning1;
{
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof1, dofs_per_block);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof1);
const unsigned int n1 = dofs_per_block[0], n2 = dofs_per_block[1];
owned_partitioning1.push_back(locally_owned_dofs1.get_view(0, n1));
block_component[dim] = 1;
DoFRenumbering::component_wise(dof_handler, block_component);
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
block_component[dim] = 1;
DoFRenumbering::component_wise(dof_handler, block_component);
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
// Renumber to yield block structure
DoFRenumbering::block_wise(dof_handler);
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- resflow_sub_blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, resflow_sub_blocks);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
pcout << " Number of degrees of freedom: " << dof_handler.n_dofs() << " ("
locally_relevant_dofs = DoFTools::locally_relevant_dofs_per_subdomain(
dof_handler)[this_mpi_process];
- const unsigned int n_blocks = block_component.size();
- std::vector<types::global_dof_index> dofs_per_block(n_blocks);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+ const unsigned int n_blocks = block_component.size();
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
locally_owned_partitioning.clear();
locally_relevant_partitioning.clear();
mgdof.distribute_dofs(fe);
mgdof.distribute_mg_dofs();
DoFRenumbering::component_wise(mgdof);
- vector<types::global_dof_index> ndofs(fe.n_blocks());
- DoFTools::count_dofs_per_block(mgdof, ndofs);
+ const vector<types::global_dof_index> ndofs =
+ DoFTools::count_dofs_per_fe_block(mgdof);
+ Assert(ndofs.size() == fe.n_blocks(), ExcInternalError());
for (unsigned int l = 0; l < tr.n_levels(); ++l)
DoFRenumbering::component_wise(mgdof, l);
mgdof.distribute_dofs(fe);
mgdof.distribute_mg_dofs();
DoFRenumbering::component_wise(mgdof);
- vector<types::global_dof_index> ndofs(fe.n_blocks());
- DoFTools::count_dofs_per_block(mgdof, ndofs);
+ const vector<types::global_dof_index> ndofs =
+ DoFTools::count_dofs_per_fe_block(mgdof);
for (unsigned int l = 0; l < tr.n_levels(); ++l)
DoFRenumbering::component_wise(mgdof, l);
}
// Store sizes
- vector<types::global_dof_index> ndofs(fe.n_blocks());
- DoFTools::count_dofs_per_block(mgdof, ndofs);
+ const vector<types::global_dof_index> ndofs =
+ DoFTools::count_dofs_per_fe_block(mgdof);
std::vector<std::vector<types::global_dof_index>> mg_ndofs(
mgdof.get_triangulation().n_levels(),
std::vector<types::global_dof_index>(fe.n_blocks()));
mgdof.distribute_dofs(fe);
mgdof.distribute_mg_dofs();
DoFRenumbering::component_wise(mgdof, target_component);
- vector<types::global_dof_index> ndofs(
- *std::max_element(target_component.begin(), target_component.end()) + 1);
- DoFTools::count_dofs_per_component(mgdof, ndofs, true, target_component);
+ const vector<types::global_dof_index> ndofs =
+ DoFTools::count_dofs_per_fe_component(mgdof, true, target_component);
+ Assert(ndofs.size() ==
+ *std::max_element(target_component.begin(), target_component.end()) +
+ 1,
+ ExcInternalError());
for (unsigned int l = 0; l < tr.n_levels(); ++l)
DoFRenumbering::component_wise(mgdof, l, mg_target_component);
block_component,
block_component);
- std::vector<types::global_dof_index> dofs_per_block(3);
- DoFTools::count_dofs_per_block(mg_dof_handler,
- dofs_per_block,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(mg_dof_handler, block_component);
std::vector<std::vector<types::global_dof_index>> mg_dofs_per_block(
tr.n_levels(), std::vector<types::global_dof_index>(3));
MGTools::count_dofs_per_block(mg_dof_handler,
block_component,
block_component);
- std::vector<types::global_dof_index> dofs_per_block(3);
- DoFTools::count_dofs_per_block(mg_dof_handler,
- dofs_per_block,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(mg_dof_handler, block_component);
std::vector<std::vector<types::global_dof_index>> mg_dofs_per_block(
tr.n_levels(), std::vector<types::global_dof_index>(3));
MGTools::count_dofs_per_block(mg_dof_handler,
// // BlockVector
// std::vector<unsigned int> dofs_per_block(2);
- // DoFTools::count_dofs_per_block(dof_handler, dofs_per_block,
+ // DoFTools::count_dofs_per_fe_block(dof_handler, dofs_per_block,
// block_component); const unsigned int n_u = dofs_per_block[0],
// n_p = dofs_per_block[1];
// BlockVector<double> solution;
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
std::cout << "Triangulation:"
<< "\n\t Number of active cells: "
<< triangulation.n_active_cells()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
pcout << "Triangulation:"
<< "\n\t Number of active cells: " << triangulation.n_active_cells()
<< "\n\t Number of degrees of freedom: " << dof_handler_ref.n_dofs()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
pcout << "Triangulation:"
<< "\n\t Number of active cells: " << triangulation.n_active_cells()
<< "\n\t Number of degrees of freedom: " << dof_handler_ref.n_dofs()
dof_handler_ref.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler_ref);
DoFRenumbering::component_wise(dof_handler_ref, block_component);
- DoFTools::count_dofs_per_block(dof_handler_ref,
- dofs_per_block,
- block_component);
+ dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler_ref, block_component);
pcout << "Triangulation:"
<< "\n\t Number of active cells: " << triangulation.n_active_cells()
<< "\n\t Number of degrees of freedom: " << dof_handler_ref.n_dofs()
-// Test DoFTools::count_dofs_per_component
+// Test DoFTools::count_dofs_per_fe_component
#include <deal.II/base/tensor.h>
triangulation.refine_global(2);
dof_handler.distribute_dofs(fe);
- std::vector<types::global_dof_index> dofs_per_component(fe.n_components());
- DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
+ const std::vector<types::global_dof_index> dofs_per_component =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
Assert(std::accumulate(dofs_per_component.begin(),
dofs_per_component.end(),
0U) == dof_handler.n_dofs(),
ExcInternalError());
- unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
+ const unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
if (myid == 0)
{
deallog << "Total number of dofs: " << dof_handler.n_dofs() << std::endl;
relevant_total;
DoFTools::extract_locally_relevant_dofs(dof_handler, relevant_total);
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, blocks);
locally_owned[0] = locally_owned_total.get_view(0, dofs_per_block[0]);
locally_owned[1] =
locally_owned_total.get_view(dofs_per_block[0], dof_handler.n_dofs());
relevant_total;
DoFTools::extract_locally_relevant_dofs(dof_handler, relevant_total);
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, blocks);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, blocks);
locally_owned[0] = locally_owned_total.get_view(0, dofs_per_block[0]);
locally_owned[1] =
locally_owned_total.get_view(dofs_per_block[0], dof_handler.n_dofs());
block_component[dim] = 1;
DoFRenumbering::component_wise(dof_handler, block_component);
- std::vector<types::global_dof_index> dofs_per_block(2);
- DoFTools::count_dofs_per_block(dof_handler,
- dofs_per_block,
- block_component);
+ const std::vector<types::global_dof_index> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof_handler, block_component);
const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
{
deallog << "Number of dofs = " << dof_handler.n_dofs() << std::endl;
- std::vector<types::global_dof_index> size(dim);
- DoFTools::count_dofs_per_component(dof_handler, size);
+ const std::vector<types::global_dof_index> size =
+ DoFTools::count_dofs_per_fe_component(dof_handler);
BlockSparsityPattern b_sparsity_pattern;
SparsityPattern sparsity_pattern;