* implements an algorithm that determines those DoFs that need this
* sign change for a given cell.
*/
+ template <int spacedim>
void
get_face_sign_change_rt(const dealii::Triangulation<1>::cell_iterator &,
- const unsigned int,
- std::vector<double> &face_sign)
+ const FiniteElement<1, spacedim> &,
+ const std::vector<MappingType> &,
+ std::vector<double> &)
{
// nothing to do in 1d
- std::fill(face_sign.begin(), face_sign.end(), 1.0);
}
+ // template<int spacedim>
void
get_face_sign_change_rt(
const dealii::Triangulation<2>::cell_iterator &cell,
- const unsigned int dofs_per_face,
+ const FiniteElement<2, 2> & fe,
+ const std::vector<MappingType> & mapping_type,
std::vector<double> & face_sign)
{
const unsigned int dim = 2;
const unsigned int spacedim = 2;
- // Default is no sign
- // change. I.e. multiply by one.
- std::fill(face_sign.begin(), face_sign.end(), 1.0);
-
for (unsigned int f = GeometryInfo<dim>::faces_per_cell / 2;
f < GeometryInfo<dim>::faces_per_cell;
++f)
const unsigned int nn = cell->neighbor_face_no(f);
if (nn < GeometryInfo<dim>::faces_per_cell / 2)
- for (unsigned int j = 0; j < dofs_per_face; ++j)
+ for (unsigned int j = 0; j < fe.dofs_per_face; ++j)
{
- Assert(f * dofs_per_face + j < face_sign.size(),
+ const unsigned int cell_j = fe.face_to_cell_index(j, f);
+ // something in FiniteElement or FiniteElementData base
+ // classes
+
+ Assert(f * fe.dofs_per_face + j < face_sign.size(),
+ ExcInternalError());
+ Assert(mapping_type.size() == 1 ||
+ cell_j < mapping_type.size(),
ExcInternalError());
// TODO: This is probably only going to work for those
// elements for which all dofs are face dofs
- face_sign[f * dofs_per_face + j] = -1.0;
+ if ((mapping_type.size() > 1 ?
+ mapping_type[cell_j] :
+ mapping_type[0]) == mapping_raviart_thomas)
+ face_sign[f * fe.dofs_per_face + j] = -1.0;
}
}
}
+ template <int spacedim>
void
get_face_sign_change_rt(
const dealii::Triangulation<3>::cell_iterator & /*cell*/,
- const unsigned int /*dofs_per_face*/,
- std::vector<double> &face_sign)
+ const FiniteElement<3, spacedim> & /*fe*/,
+ const std::vector<MappingType> & /*mapping_type*/,
+ std::vector<double> & /*face_sign*/)
{
- std::fill(face_sign.begin(), face_sign.end(), 1.0);
// TODO: think about what it would take here
}
+
+
+ template <int spacedim>
void
get_face_sign_change_nedelec(
const dealii::Triangulation<1>::cell_iterator & /*cell*/,
- const unsigned int /*dofs_per_face*/,
- std::vector<double> &face_sign)
+ const FiniteElement<1, spacedim> & /*fe*/,
+ const std::vector<MappingType> & /*mapping_type*/,
+ std::vector<double> & /*face_sign*/)
{
// nothing to do in 1d
- std::fill(face_sign.begin(), face_sign.end(), 1.0);
}
+ template <int spacedim>
void
get_face_sign_change_nedelec(
const dealii::Triangulation<2>::cell_iterator & /*cell*/,
- const unsigned int /*dofs_per_face*/,
- std::vector<double> &face_sign)
+ const FiniteElement<2, spacedim> & /*fe*/,
+ const std::vector<MappingType> & /*mapping_type*/,
+ std::vector<double> & /*face_sign*/)
{
- std::fill(face_sign.begin(), face_sign.end(), 1.0);
// TODO: think about what it would take here
}
+ template <int spacedim>
void
get_face_sign_change_nedelec(
const dealii::Triangulation<3>::cell_iterator &cell,
- const unsigned int /*dofs_per_face*/,
- std::vector<double> &face_sign)
+ const FiniteElement<3, spacedim> & /*fe*/,
+ const std::vector<MappingType> &mapping_type,
+ std::vector<double> & face_sign)
{
const unsigned int dim = 3;
- std::fill(face_sign.begin(), face_sign.end(), 1.0);
// TODO: This is probably only going to work for those elements for
// which all dofs are face dofs
for (unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
- if (!(cell->line_orientation(l)))
+ if (!(cell->line_orientation(l)) & mapping_type[0] == mapping_nedelec)
face_sign[l] = -1.0;
}
} // namespace
: FiniteElement<dim, spacedim>(fe_data,
restriction_is_additive_flags,
nonzero_components)
- , mapping_type(MappingType::mapping_none)
+ , mapping_type({MappingType::mapping_none})
, poly_space(PolynomialType(degree))
{
cached_point(0) = -1;
// between two faces.
std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
- if (mapping_type == mapping_raviart_thomas)
- internal::FE_PolyTensor::get_face_sign_change_rt(cell,
- this->dofs_per_face,
- fe_data.sign_change);
- else if (mapping_type == mapping_nedelec)
- internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
- this->dofs_per_face,
- fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_rt(cell,
+ *this,
+ this->mapping_type,
+ fe_data.sign_change);
+
+ internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
+ *this,
+ this->mapping_type,
+ fe_data.sign_change);
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
+ MappingType mapping_type =
+ (this->mapping_type.size() > 1 ? this->mapping_type[i] :
+ this->mapping_type[0]);
+
const unsigned int first =
output_data.shape_function_to_row_table[i * this->n_components() +
this->get_nonzero_components(i)
// on the neighborhood between two faces.
std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
- if (mapping_type == mapping_raviart_thomas)
- internal::FE_PolyTensor::get_face_sign_change_rt(cell,
- this->dofs_per_face,
- fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_rt(cell,
+ *this,
+ this->mapping_type,
+ fe_data.sign_change);
- else if (mapping_type == mapping_nedelec)
- internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
- this->dofs_per_face,
- fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
+ *this,
+ this->mapping_type,
+ fe_data.sign_change);
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
+ const MappingType mapping_type =
+ (this->mapping_type.size() > 1 ? this->mapping_type[i] :
+ this->mapping_type[0]);
+
const unsigned int first =
output_data.shape_function_to_row_table[i * this->n_components() +
this->get_nonzero_components(i)
// on the neighborhood between two faces.
std::fill(fe_data.sign_change.begin(), fe_data.sign_change.end(), 1.0);
- if (mapping_type == mapping_raviart_thomas)
- internal::FE_PolyTensor::get_face_sign_change_rt(cell,
- this->dofs_per_face,
- fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_rt(cell,
+ *this,
+ this->mapping_type,
+ fe_data.sign_change);
- else if (mapping_type == mapping_nedelec)
- internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
- this->dofs_per_face,
- fe_data.sign_change);
+ internal::FE_PolyTensor::get_face_sign_change_nedelec(cell,
+ *this,
+ this->mapping_type,
+ fe_data.sign_change);
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
+ MappingType mapping_type =
+ (this->mapping_type.size() > 1 ? this->mapping_type[i] :
+ this->mapping_type[0]);
+
const unsigned int first =
output_data.shape_function_to_row_table[i * this->n_components() +
this->get_nonzero_components(i)
{
UpdateFlags out = update_default;
- switch (mapping_type)
+ for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
- case mapping_none:
- {
- if (flags & update_values)
- out |= update_values;
-
- if (flags & update_gradients)
- out |= update_gradients | update_values |
- update_jacobian_pushed_forward_grads;
-
- if (flags & update_hessians)
- out |= update_hessians | update_values | update_gradients |
- update_jacobian_pushed_forward_grads |
- update_jacobian_pushed_forward_2nd_derivatives;
- break;
- }
+ MappingType mapping_type =
+ (this->mapping_type.size() > 1 ? this->mapping_type[i] :
+ this->mapping_type[0]);
- case mapping_raviart_thomas:
- case mapping_piola:
+ switch (mapping_type)
{
- if (flags & update_values)
- out |= update_values | update_piola;
-
- if (flags & update_gradients)
- out |= update_gradients | update_values | update_piola |
- update_jacobian_pushed_forward_grads |
- update_covariant_transformation |
- update_contravariant_transformation;
-
- if (flags & update_hessians)
- out |= update_hessians | update_piola | update_values |
- update_gradients | update_jacobian_pushed_forward_grads |
- update_jacobian_pushed_forward_2nd_derivatives |
- update_covariant_transformation;
-
- break;
- }
+ case mapping_none:
+ {
+ if (flags & update_values)
+ out |= update_values;
+
+ if (flags & update_gradients)
+ out |= update_gradients | update_values |
+ update_jacobian_pushed_forward_grads;
+
+ if (flags & update_hessians)
+ out |= update_hessians | update_values | update_gradients |
+ update_jacobian_pushed_forward_grads |
+ update_jacobian_pushed_forward_2nd_derivatives;
+ break;
+ }
+ case mapping_raviart_thomas:
+ case mapping_piola:
+ {
+ if (flags & update_values)
+ out |= update_values | update_piola;
+
+ if (flags & update_gradients)
+ out |= update_gradients | update_values | update_piola |
+ update_jacobian_pushed_forward_grads |
+ update_covariant_transformation |
+ update_contravariant_transformation;
+
+ if (flags & update_hessians)
+ out |= update_hessians | update_piola | update_values |
+ update_gradients | update_jacobian_pushed_forward_grads |
+ update_jacobian_pushed_forward_2nd_derivatives |
+ update_covariant_transformation;
+
+ break;
+ }
- case mapping_contravariant:
- {
- if (flags & update_values)
- out |= update_values | update_piola;
-
- if (flags & update_gradients)
- out |= update_gradients | update_values |
- update_jacobian_pushed_forward_grads |
- update_covariant_transformation |
- update_contravariant_transformation;
-
- if (flags & update_hessians)
- out |= update_hessians | update_piola | update_values |
- update_gradients | update_jacobian_pushed_forward_grads |
- update_jacobian_pushed_forward_2nd_derivatives |
- update_covariant_transformation;
-
- break;
- }
- case mapping_nedelec:
- case mapping_covariant:
- {
- if (flags & update_values)
- out |= update_values | update_covariant_transformation;
+ case mapping_contravariant:
+ {
+ if (flags & update_values)
+ out |= update_values | update_piola;
+
+ if (flags & update_gradients)
+ out |= update_gradients | update_values |
+ update_jacobian_pushed_forward_grads |
+ update_covariant_transformation |
+ update_contravariant_transformation;
+
+ if (flags & update_hessians)
+ out |= update_hessians | update_piola | update_values |
+ update_gradients | update_jacobian_pushed_forward_grads |
+ update_jacobian_pushed_forward_2nd_derivatives |
+ update_covariant_transformation;
+
+ break;
+ }
- if (flags & update_gradients)
- out |= update_gradients | update_values |
- update_jacobian_pushed_forward_grads |
- update_covariant_transformation;
+ case mapping_nedelec:
+ case mapping_covariant:
+ {
+ if (flags & update_values)
+ out |= update_values | update_covariant_transformation;
- if (flags & update_hessians)
- out |= update_hessians | update_values | update_gradients |
- update_jacobian_pushed_forward_grads |
- update_jacobian_pushed_forward_2nd_derivatives |
- update_covariant_transformation;
+ if (flags & update_gradients)
+ out |= update_gradients | update_values |
+ update_jacobian_pushed_forward_grads |
+ update_covariant_transformation;
- break;
- }
+ if (flags & update_hessians)
+ out |= update_hessians | update_values | update_gradients |
+ update_jacobian_pushed_forward_grads |
+ update_jacobian_pushed_forward_2nd_derivatives |
+ update_covariant_transformation;
- default:
- {
- Assert(false, ExcNotImplemented());
+ break;
+ }
+
+ default:
+ {
+ Assert(false, ExcNotImplemented());
+ }
}
}