Deprecate filling TableIndices indices with invalid numbers.
The TableIndices constructor would just take however many indices
it was given and padded the rest with invalid unsigned ints. This
is against the spirit we usually apply everywhere else by requiring
code to be explicit about what they want to happen. It also leads
to awkward to track issues such as the one reported in #4565.
Fix this by providing TableIndices with constructors for various
numbers of arguments, and ensuring via static_asserts that the
correct constructor is the only one that can be called.
This also required a bit of working around issues in the
SymmetricTensor accessor machinery, but nothing major.
David Wells [Sat, 8 Jul 2017 18:25:06 +0000 (14:25 -0400)]
Change MappingManifold<1, spacedim> to use face manifolds.
As of db5ea0f52db we support get_manifold on 1D manifolds, so we can look up the
manifold on a 1D face in a dimension-independent way. This is a slight change
from the current behavior, but using Manifolds in 1D is a very obscure use case.
David Wells [Fri, 7 Jul 2017 23:52:28 +0000 (19:52 -0400)]
de-templatize SparsityPattern::copy_from.
This template is instantiated for only SparsityPattern and is overloaded for
DynamicSparsityPattern, so it is a bit simpler to just overload a non-template
method.
Simplify the template signature of DoFRenumbering::compute_component_wise().
We previously had two template arguments because the types of, for example,
DoFHandler::begin_active() and DoFHandler::end() are different. But this makes
no sense. Just cast the end iterator to the same type as the begin iterator.
David Wells [Fri, 7 Jul 2017 19:23:41 +0000 (15:23 -0400)]
Add a more general fallthrough attribute.
GCC7 raises implicit fallthrough warnings in a lot of places when we
compile without C++17 support. This patch adds a second check for the
GCC extension `__attribute__((fallthrough))` that works in C++11 and
C++14 and fixes these warnings.
The TODO isn't really addressed, but previous to #4560, the functions
in question simply did the wrong thing, whereas since #4560, we at
least get an ExcNotImplemented().
The DoF indices for a vertex are stored in an array where we just
collate the indices for each level. There is currently another
array that stors the offset within this array where the DoFs
for a given level start. This array is dynamically allocated,
but it is altogether unnecessary because the offsets are computable:
they are simply the number of the multigrid level times
dofs_per_vertex.
Consequently, get rid of the array and replace it by storing dofs_per_vertex.
We can then easily compute the starting offset wherever necessary, rather than
having to look it up.
The hp DoF renumbering function for the <3,3> case was unnecessarily
convoluted because it tried to look just like the functions that
deal with faces of higher dimensional cells. But we know that in <3,3>,
a hex is a cell, and so there can only be one finite element associated
with the cell. This allows simplifying a fair share of code.
Currently, the code is duplicated between the DoFHandler and the policy
class. This makes no sense, and indeed the policy class code is more
evolved, so let the former call the latter following exposing the
interface in the previous patch.
The existing code in DoFHandler looks like it did not actually support
parallel triangulations (either shared or distributed). This was
probably a bug, and consequently the implementation of the functionality
in the ParallelDistributed policy class now just throws an error.
This relates to the discussion in #4559.
The previous refactoring allows parallelizing renumbering for vertices,
cells, and faces, since these all work on mutually independent data
structures.
The 1d, 2d, and 3d implementations of these functions had most of their code
duplicated. This can be done more elegantly by instead splitting the code into
vertices, cells, and faces. The main function then becomes dimension independent,
as are the functions dealing with vertices and cells, and only the face function
requires dimensional specialization.
Make the DoFHandler a template type of the Sequential policy.
Also adjust all of the places where the class is used.
This change by itself is not useful, but will become useful when also
using the policy class from hp::DoFHandler. Similar changes will at a
later time be made for the ParallelShared and ParallelDistributed
policies.
When distributing MG DoF indices, we accidentally used 'unsigned int'
instead of 'types::global_dof_index'. That's a bug. We didn't notice
this because we never have more than 4B unknowns on one processor,
and the function was only called in the parallel context to enumerate
the DoFs on the *local* portion of the mesh, before indices were
shifted after communication with other processors. Regardless, it's
worth fixing.