Threads::TaskGroup<void> task_group;
// loop over all possible refinement cases
- unsigned int ref_case = (isotropic_only) ?
- RefinementCase<dim>::isotropic_refinement :
- RefinementCase<dim>::cut_x;
-
- for (; ref_case <= RefinementCase<dim>::isotropic_refinement; ++ref_case)
+ for (unsigned int ref_case =
+ (isotropic_only ? RefinementCase<dim>::isotropic_refinement :
+ RefinementCase<dim>::cut_x);
+ ref_case <= RefinementCase<dim>::isotropic_refinement;
+ ++ref_case)
task_group += Threads::new_task(
&internal::FEToolsComputeEmbeddingMatricesHelper::
compute_embedding_matrices_for_refinement_case<dim, number, spacedim>,
// finally loop over all possible refinement cases
Threads::TaskGroup<> tasks;
- unsigned int ref_case = (isotropic_only) ?
- RefinementCase<dim>::isotropic_refinement :
- RefinementCase<dim>::cut_x;
- for (; ref_case <= RefinementCase<dim>::isotropic_refinement; ++ref_case)
+ for (unsigned int ref_case =
+ (isotropic_only ? RefinementCase<dim>::isotropic_refinement :
+ RefinementCase<dim>::cut_x);
+ ref_case <= RefinementCase<dim>::isotropic_refinement;
+ ++ref_case)
tasks += Threads::new_task([&, ref_case]() {
compute_one_case(ref_case, mass, matrices[ref_case - 1]);
});
// constructor of FullMatrix<dim> initializes them with size zero
prolongation.resize(RefinementCase<dim>::isotropic_refinement);
restriction.resize(RefinementCase<dim>::isotropic_refinement);
- for (unsigned int ref = RefinementCase<dim>::cut_x;
- ref < RefinementCase<dim>::isotropic_refinement + 1;
- ++ref)
- {
- prolongation[ref - 1].resize(GeometryInfo<dim>::n_children(
- RefinementCase<dim>(ref)),
- FullMatrix<double>());
- restriction[ref - 1].resize(GeometryInfo<dim>::n_children(
- RefinementCase<dim>(ref)),
- FullMatrix<double>());
- }
+ for (const unsigned int ref_case :
+ RefinementCase<dim>::all_refinement_cases())
+ if (ref_case != RefinementCase<dim>::no_refinement)
+ {
+ prolongation[ref - 1].resize(GeometryInfo<dim>::n_children(
+ RefinementCase<dim>(ref)),
+ FullMatrix<double>());
+ restriction[ref - 1].resize(GeometryInfo<dim>::n_children(
+ RefinementCase<dim>(ref)),
+ FullMatrix<double>());
+ }
if (dim == 3)
const bool isotropic_restriction_only,
const bool isotropic_prolongation_only)
{
- for (unsigned int ref_case = RefinementCase<dim>::cut_x;
- ref_case <= RefinementCase<dim>::isotropic_refinement;
- ++ref_case)
- {
- const unsigned int nc =
- GeometryInfo<dim>::n_children(RefinementCase<dim>(ref_case));
-
- for (unsigned int i = 0; i < nc; ++i)
- {
- if (this->restriction[ref_case - 1][i].m() !=
- this->n_dofs_per_cell() &&
- (!isotropic_restriction_only ||
- ref_case == RefinementCase<dim>::isotropic_refinement))
- this->restriction[ref_case - 1][i].reinit(this->n_dofs_per_cell(),
- this->n_dofs_per_cell());
- if (this->prolongation[ref_case - 1][i].m() !=
- this->n_dofs_per_cell() &&
- (!isotropic_prolongation_only ||
- ref_case == RefinementCase<dim>::isotropic_refinement))
- this->prolongation[ref_case - 1][i].reinit(this->n_dofs_per_cell(),
- this->n_dofs_per_cell());
- }
- }
+ for (const unsigned int ref_case :
+ RefinementCase<dim>::all_refinement_cases())
+ if (ref_case != RefinementCase<dim>::no_refinement)
+ {
+ const unsigned int nc =
+ GeometryInfo<dim>::n_children(RefinementCase<dim>(ref_case));
+
+ for (unsigned int i = 0; i < nc; ++i)
+ {
+ if (this->restriction[ref_case - 1][i].m() !=
+ this->n_dofs_per_cell() &&
+ (!isotropic_restriction_only ||
+ ref_case == RefinementCase<dim>::isotropic_refinement))
+ this->restriction[ref_case - 1][i].reinit(
+ this->n_dofs_per_cell(), this->n_dofs_per_cell());
+ if (this->prolongation[ref_case - 1][i].m() !=
+ this->n_dofs_per_cell() &&
+ (!isotropic_prolongation_only ||
+ ref_case == RefinementCase<dim>::isotropic_refinement))
+ this->prolongation[ref_case - 1][i].reinit(
+ this->n_dofs_per_cell(), this->n_dofs_per_cell());
+ }
+ }
}
bool
FiniteElement<dim, spacedim>::prolongation_is_implemented() const
{
- for (unsigned int ref_case = RefinementCase<dim>::cut_x;
- ref_case < RefinementCase<dim>::isotropic_refinement + 1;
- ++ref_case)
- for (unsigned int c = 0;
- c < GeometryInfo<dim>::n_children(RefinementCase<dim>(ref_case));
- ++c)
- {
- // make sure also the lazily initialized matrices are created
- get_prolongation_matrix(c, RefinementCase<dim>(ref_case));
- Assert((prolongation[ref_case - 1][c].m() == this->n_dofs_per_cell()) ||
- (prolongation[ref_case - 1][c].m() == 0),
- ExcInternalError());
- Assert((prolongation[ref_case - 1][c].n() == this->n_dofs_per_cell()) ||
- (prolongation[ref_case - 1][c].n() == 0),
- ExcInternalError());
- if ((prolongation[ref_case - 1][c].m() == 0) ||
- (prolongation[ref_case - 1][c].n() == 0))
- return false;
- }
+ for (const unsigned int ref_case :
+ RefinementCase<dim>::all_refinement_cases())
+ if (ref_case != RefinementCase<dim>::no_refinement)
+ for (unsigned int c = 0;
+ c < GeometryInfo<dim>::n_children(RefinementCase<dim>(ref_case));
+ ++c)
+ {
+ // make sure also the lazily initialized matrices are created
+ get_prolongation_matrix(c, RefinementCase<dim>(ref_case));
+ Assert((prolongation[ref_case - 1][c].m() ==
+ this->n_dofs_per_cell()) ||
+ (prolongation[ref_case - 1][c].m() == 0),
+ ExcInternalError());
+ Assert((prolongation[ref_case - 1][c].n() ==
+ this->n_dofs_per_cell()) ||
+ (prolongation[ref_case - 1][c].n() == 0),
+ ExcInternalError());
+ if ((prolongation[ref_case - 1][c].m() == 0) ||
+ (prolongation[ref_case - 1][c].n() == 0))
+ return false;
+ }
return true;
}
bool
FiniteElement<dim, spacedim>::restriction_is_implemented() const
{
- for (unsigned int ref_case = RefinementCase<dim>::cut_x;
- ref_case < RefinementCase<dim>::isotropic_refinement + 1;
- ++ref_case)
- for (unsigned int c = 0;
- c < GeometryInfo<dim>::n_children(RefinementCase<dim>(ref_case));
- ++c)
- {
- // make sure also the lazily initialized matrices are created
- get_restriction_matrix(c, RefinementCase<dim>(ref_case));
- Assert((restriction[ref_case - 1][c].m() == this->n_dofs_per_cell()) ||
- (restriction[ref_case - 1][c].m() == 0),
- ExcInternalError());
- Assert((restriction[ref_case - 1][c].n() == this->n_dofs_per_cell()) ||
- (restriction[ref_case - 1][c].n() == 0),
- ExcInternalError());
- if ((restriction[ref_case - 1][c].m() == 0) ||
- (restriction[ref_case - 1][c].n() == 0))
- return false;
- }
+ for (const unsigned int ref_case :
+ RefinementCase<dim>::all_refinement_cases())
+ if (ref_case != RefinementCase<dim>::no_refinement)
+ for (unsigned int c = 0;
+ c < GeometryInfo<dim>::n_children(RefinementCase<dim>(ref_case));
+ ++c)
+ {
+ // make sure also the lazily initialized matrices are created
+ get_restriction_matrix(c, RefinementCase<dim>(ref_case));
+ Assert((restriction[ref_case - 1][c].m() ==
+ this->n_dofs_per_cell()) ||
+ (restriction[ref_case - 1][c].m() == 0),
+ ExcInternalError());
+ Assert((restriction[ref_case - 1][c].n() ==
+ this->n_dofs_per_cell()) ||
+ (restriction[ref_case - 1][c].n() == 0),
+ ExcInternalError());
+ if ((restriction[ref_case - 1][c].m() == 0) ||
+ (restriction[ref_case - 1][c].n() == 0))
+ return false;
+ }
return true;
}
, polynomial_space(Polynomials::Legendre::generate_complete_basis(degree))
{
const unsigned int n_dofs = this->n_dofs_per_cell();
- for (unsigned int ref_case = RefinementCase<dim>::cut_x;
- ref_case < RefinementCase<dim>::isotropic_refinement + 1;
- ++ref_case)
- {
- if (dim != 2 && ref_case != RefinementCase<dim>::isotropic_refinement)
- // do nothing, as anisotropic
- // refinement is not
- // implemented so far
- continue;
-
- const unsigned int nc =
- GeometryInfo<dim>::n_children(RefinementCase<dim>(ref_case));
- for (unsigned int i = 0; i < nc; ++i)
- {
- this->prolongation[ref_case - 1][i].reinit(n_dofs, n_dofs);
- // Fill prolongation matrices with
- // embedding operators
- for (unsigned int j = 0; j < n_dofs; ++j)
- this->prolongation[ref_case - 1][i](j, j) = 1.;
- }
- }
+ for (const unsigned int ref_case :
+ RefinementCase<dim>::all_refinement_cases())
+ if (ref_case != RefinementCase<dim>::no_refinement)
+ {
+ if (dim != 2 && ref_case != RefinementCase<dim>::isotropic_refinement)
+ // do nothing, as anisotropic
+ // refinement is not
+ // implemented so far
+ continue;
+
+ const unsigned int nc =
+ GeometryInfo<dim>::n_children(RefinementCase<dim>(ref_case));
+ for (unsigned int i = 0; i < nc; ++i)
+ {
+ this->prolongation[ref_case - 1][i].reinit(n_dofs, n_dofs);
+ // Fill prolongation matrices with
+ // embedding operators
+ for (unsigned int j = 0; j < n_dofs; ++j)
+ this->prolongation[ref_case - 1][i](j, j) = 1.;
+ }
+ }
// restriction can be defined
// through projection for