DoFTools::make_hanging_node_constraints(dof, constraints);
constraints.close();
- std::vector<unsigned int> dofs_per_block(fe.n_blocks());
- DoFTools::count_dofs_per_block(dof, dofs_per_block);
+ const std::vector<unsigned int> dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(dof);
BlockDynamicSparsityPattern dsp(fe.n_blocks(), fe.n_blocks());
for (unsigned int i = 0; i < fe.n_blocks(); ++i)
// The next thing is that we want to figure out the sizes of these blocks
// so that we can allocate an appropriate amount of space. To this end, we
- // call the DoFTools::count_dofs_per_component() function that
+ // call the DoFTools::count_dofs_per_fe_component() function that
// counts how many shape functions are non-zero for a particular vector
// component. We have <code>dim+1</code> vector components, and
- // DoFTools::count_dofs_per_component() will count how many shape functions
- // belong to each of these components.
+ // DoFTools::count_dofs_per_fe_component() will count how many shape
+ // functions belong to each of these components.
//
// There is one problem here. As described in the documentation of that
// function, it <i>wants</i> to put the number of $x$-velocity shape
// the vector and matrix block sizes, as well as create output.
//
// @note If you find this concept difficult to understand, you may
- // want to consider using the function DoFTools::count_dofs_per_block()
+ // want to consider using the function DoFTools::count_dofs_per_fe_block()
// instead, as we do in the corresponding piece of code in step-22.
// You might also want to read up on the difference between
// @ref GlossBlock "blocks" and @ref GlossComponent "components"
// in the glossary.
- std::vector<types::global_dof_index> dofs_per_component(dim + 1);
- 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[dim];
dof_handler.distribute_dofs(fe);
DoFRenumbering::component_wise(dof_handler);
- std::vector<types::global_dof_index> dofs_per_component(dim + 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[dim],
n_s = dofs_per_component[dim + 1];
// In analogy to step-20, we count the dofs in the individual components.
// We could do this in the same way as there, but we want to operate on
// the block structure we used already for the renumbering: The function
- // <code>DoFTools::count_dofs_per_block</code> does the same as
- // <code>DoFTools::count_dofs_per_component</code>, but now grouped as
+ // <code>DoFTools::count_dofs_per_fe_block</code> does the same as
+ // <code>DoFTools::count_dofs_per_fe_component</code>, but now grouped as
// velocity and pressure block via <code>block_component</code>.
- 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];
const unsigned int n_p = dofs_per_block[1];
temperature_constraints.close();
}
- 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],
temperature_dof_handler.distribute_dofs(temperature_fe);
- 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],
}
- std::vector<types::global_dof_index> darcy_dofs_per_block(2);
- DoFTools::count_dofs_per_block(darcy_dof_handler,
- darcy_dofs_per_block,
- darcy_block_component);
+ const std::vector<types::global_dof_index> darcy_dofs_per_block =
+ DoFTools::count_dofs_per_fe_block(darcy_dof_handler,
+ darcy_block_component);
const unsigned int n_u = darcy_dofs_per_block[0],
n_p = darcy_dofs_per_block[1],
n_s = saturation_dof_handler.n_dofs();
dof_handler.distribute_dofs(fe);
DoFRenumbering::Cuthill_McKee(dof_handler);
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::cout << "Triangulation:"
<< "\n\t Number of active cells: "
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];
{
the same (here, <code>2*dim+1</code>). This makes all sorts of
things possible since a uniform description allows for code
re-use. For example, counting degrees of freedom per vector
- component (DoFTools::count_dofs_per_component), sorting degrees of
+ component (DoFTools::count_dofs_per_fe_component), sorting degrees of
freedom by component (DoFRenumbering::component_wise), subsequent
partitioning of matrices and vectors into blocks and many other
functions work as they always did without the need to add special
stokes_sub_blocks[dim] = 1;
DoFRenumbering::component_wise(dof_handler, stokes_sub_blocks);
- 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);
- const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
+ const unsigned int n_u = dofs_per_block[0];
+ const unsigned int n_p = dofs_per_block[1];
pcout << " Number of degrees of freedom: " << dof_handler.n_dofs() << " ("
<< n_u << '+' << n_p << ')' << 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 unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];
+ 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];
+ const unsigned int n_p = dofs_per_block[1];
{
constraints.clear();
block_component[dim] = 1;
DoFRenumbering::component_wise(dof_handler, block_component);
- dofs_per_block.resize(2);
- 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);
unsigned int dof_u = dofs_per_block[0];
unsigned int dof_p = dofs_per_block[1];