// on which components of the
// FESystem we want to impose
// Dirichlet BC.
- std::vector<bool> component_mask(2);
+ ComponentMask component_mask(2, false);
// Dirichlet-BC for the
// Q1-Component
- component_mask[0] = true;
+ component_mask.set(0, true);
// no Dirichlet-BC for the
// DG-component
- component_mask[1] = false;
+ component_mask.set(1, false);
// This is just for the final
// output-test
ImposeBC<dim>::test_extract_boundary_DoFs()
{
std::map<types::global_dof_index, double> boundary_values;
- std::vector<bool> bc_component_select(dim + 1);
+ ComponentMask bc_component_select(dim + 1, false);
// extract boundary DoFs for the Nedelec-component
// and impose zero boundary condition
- bc_component_select[0] = true;
- bc_component_select[1] = true;
- bc_component_select[2] = false;
+ bc_component_select.set(0, true);
+ bc_component_select.set(1, true);
+ bc_component_select.set(2, false);
const std::set<types::boundary_id> boundary_ids = {0};
const IndexSet ned_boundary_dofs =
ImposeBC<dim>::test_interpolate_BC()
{
std::map<types::global_dof_index, double> boundary_values;
- std::vector<bool> bc_component_select(dim + 1, false);
+ ComponentMask bc_component_select(dim + 1, false);
// impose inhomogeneous boundary condition
// on the scalar variable
- bc_component_select.back() = true;
+ bc_component_select.set(dim, true);
VectorTools::interpolate_boundary_values(dof_handler,
0,
neumann_bc,
v,
this_error,
- std::vector<bool>(),
+ ComponentMask(),
nullptr,
MultithreadInfo::n_threads(),
subdomain);
neumann_bc,
v,
this_error,
- std::vector<bool>(),
+ ComponentMask(),
nullptr,
MultithreadInfo::n_threads(),
numbers::invalid_unsigned_int,
dof_handler.distribute_dofs(fe);
DoFRenumbering::component_wise(dof_handler);
- std::vector<bool> mask(2, true);
- mask[1] = false;
+ ComponentMask mask(2, true);
+ mask.set(1, false);
AffineConstraints<double> cm;
DoFTools::make_periodicity_constraints(
dof_handler.begin(0)->face(0),
system_rhs.reinit(dof_handler.n_dofs());
const IndexSet boundary_dofs =
- DoFTools::extract_boundary_dofs(dof_handler, std::vector<bool>(1, true));
+ DoFTools::extract_boundary_dofs(dof_handler, ComponentMask(1, true));
const unsigned int first_boundary_dof = *boundary_dofs.begin();
neumann_bc,
v,
this_error,
- std::vector<bool>(),
+ ComponentMask(),
nullptr,
MultithreadInfo::n_threads(),
subdomain);
for (unsigned int int_mask = 0; int_mask < (1U << element.n_components());
++int_mask)
{
- std::vector<bool> component_mask(element.n_components());
+ ComponentMask component_mask(element.n_components(), false);
for (unsigned int c = 0; c < element.n_components(); ++c)
- component_mask[c] = (int_mask & (1 << c));
+ component_mask.set(c, (int_mask & (1 << c)));
std::vector<std::vector<bool>> constant_modes;
DoFTools::extract_constant_modes(dof, component_mask, constant_modes);
FindBug<dim>::dirichlet_conditions()
{
std::map<types::global_dof_index, double> dirichlet_dofs;
- std::vector<bool> component_mask(dim + 1, false);
- component_mask[dim] = true;
+ ComponentMask component_mask(dim + 1, false);
+ component_mask.set(dim, true);
// This is just for the final
// output-test
{
constraints.clear();
- std::vector<bool> component_mask(dim + 1, true);
- component_mask[dim] = false;
+ ComponentMask component_mask(dim + 1, true);
+ component_mask.set(dim, false);
DoFTools::make_hanging_node_constraints(dof_handler, constraints);
system_rhs.reinit(dof_handler.n_dofs());
const IndexSet boundary_dofs =
- DoFTools::extract_boundary_dofs(dof_handler, std::vector<bool>(1, true));
+ DoFTools::extract_boundary_dofs(dof_handler, ComponentMask(1, true));
const unsigned int first_boundary_dof = *boundary_dofs.begin();
constraints.clear();
{
const IndexSet boundary_dofs =
- DoFTools::extract_boundary_dofs(dof_handler, std::vector<bool>(1, true));
+ DoFTools::extract_boundary_dofs(dof_handler, ComponentMask(1, true));
unsigned int first_nboundary_dof = 0;
while (boundary_dofs.is_element(first_nboundary_dof))
AffineConstraints<double> cm(relevant_set);
DoFTools::make_hanging_node_constraints(dofh, cm);
- std::vector<bool> velocity_mask(dim + 1, true);
+ ComponentMask velocity_mask(dim + 1, true);
- velocity_mask[dim] = false;
+ velocity_mask.set(dim, false);
VectorTools::interpolate_boundary_values(
dofh, 0, Functions::ZeroFunction<dim>(dim + 1), cm, velocity_mask);
dofh.distribute_dofs(fe);
IndexSet boundary_dofs =
- DoFTools::extract_boundary_dofs(dofh, std::vector<bool>(1, true));
+ DoFTools::extract_boundary_dofs(dofh, ComponentMask(1, true));
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
boundary_dofs.write(deallog.get_file_stream());
if (myid == 0)
for (unsigned int c = 0; c < fe.n_components(); ++c)
{
- std::vector<bool> mask(fe.n_components(), false);
- mask[c] = true;
+ ComponentMask mask(fe.n_components(), false);
+ mask.set(c, true);
std::vector<std::vector<bool>> constant_modes;
DoFTools::extract_constant_modes(dofh, mask, constant_modes);
if (myid == 0)
for (unsigned int c = 0; c < fe.n_components(); ++c)
{
- std::vector<bool> mask(fe.n_components(), false);
- mask[c] = true;
+ ComponentMask mask(fe.n_components(), false);
+ mask.set(c, true);
std::vector<std::vector<bool>> constant_modes;
DoFTools::extract_constant_modes(dofh, mask, constant_modes);
// extract constant modes and print
if (myid == 0)
{
- std::vector<bool> mask(fe.n_components(), true);
+ ComponentMask mask(fe.n_components(), true);
std::vector<std::vector<bool>> constant_modes;
DoFTools::extract_constant_modes(dofh, mask, constant_modes);
if (myid == 0)
{
- std::vector<bool> mask(1, true);
+ ComponentMask mask(1, true);
std::vector<std::vector<bool>> constant_modes;
DoFTools::extract_constant_modes(dofh, mask, constant_modes);
AffineConstraints<double> cm(relevant_set);
DoFTools::make_hanging_node_constraints(dofh, cm);
- std::vector<bool> velocity_mask(dim + 1, true);
+ ComponentMask velocity_mask(dim + 1, true);
- velocity_mask[dim] = false;
+ velocity_mask.set(dim, false);
VectorTools::interpolate_boundary_values(
dofh, 0, Functions::ZeroFunction<dim>(dim + 1), cm, velocity_mask);
deallog << "Interpolated boundary values" << std::endl;
std::map<types::global_dof_index, double> interpolated_bv;
VectorTools::interpolate_boundary_values(
- mapping, dof, function_map, interpolated_bv, std::vector<bool>());
+ mapping, dof, function_map, interpolated_bv, ComponentMask());
write_map(interpolated_bv);
deallog << "Projected boundary values" << std::endl;
dofh.distribute_dofs(fe);
IndexSet boundary_dofs =
- DoFTools::extract_boundary_dofs(dofh, std::vector<bool>(1, true));
+ DoFTools::extract_boundary_dofs(dofh, ComponentMask(1, true));
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
boundary_dofs.write(deallog.get_file_stream());
TrilinosWrappers::PreconditionAMG preconditioner;
TrilinosWrappers::PreconditionAMG::AdditionalData data;
DoFTools::extract_constant_modes(dof_handler,
- std::vector<bool>(1, true),
+ ComponentMask(1, true),
data.constant_modes);
data.smoother_sweeps = 2;
{
deallog << "Interpolated boundary values" << std::endl;
std::map<types::global_dof_index, double> interpolated_bv;
VectorTools::interpolate_boundary_values(
- mapping, dof, function_map, interpolated_bv, std::vector<bool>());
+ mapping, dof, function_map, interpolated_bv, ComponentMask());
write_map(interpolated_bv);
// project boundary values
deallog << "Interpolated boundary values" << std::endl;
std::map<types::global_dof_index, std::complex<double>> interpolated_bv;
VectorTools::interpolate_boundary_values(
- mapping, dof, function_map, interpolated_bv, std::vector<bool>());
+ mapping, dof, function_map, interpolated_bv, ComponentMask());
write_map(interpolated_bv);
// project boundary values
deallog << "Interpolated boundary values" << std::endl;
std::map<types::global_dof_index, std::complex<double>> interpolated_bv;
VectorTools::interpolate_boundary_values(
- mappings, dof, function_map, interpolated_bv, std::vector<bool>());
+ mappings, dof, function_map, interpolated_bv, ComponentMask());
write_map(interpolated_bv);
}