David Wells [Tue, 11 Jul 2017 12:32:58 +0000 (08:32 -0400)]
Make some manifold checks in MappingQGeneric dimension independent.
As of db5ea0f52db we support get_manifold on 1D manifolds, so we can remove the
overload workaround here for 1D. This changes the behavior of this function
slightly: we now correctly calculate all_manifold_ids_are_equal = false if the
cell manifold, in 1D, does not equal one of the face (vertex) manifolds.
Note that in 2D lines are faces, so we still check all lines.
Add a test that truly tests hp::DoFHandler on shared triangulations.
In particular, extend a previously added test to really do use different
finite elements on different cells.
Comparing the output for these two tests shows that indeed
the test with different (and higher order) elements is more
accurate, as one might have surmised.
No longer store dofs_per_vertex for each MG vertex.
In #4564, I already noted that the way we store vertex DoF indices in the MG
case was not particularly efficient because we kept around a dynamically
sized 'offset' array for each vertex whose entries were computable: they were
successive multiples of dofs_per_cell. So #4564 replaces that by just storing
dofs_per_cell itself for each vertex.
But that, of course, is also wasteful: why store it once per vertex when that
will be the same number for every vertex. Rather, what this patch does is
to pass that number to the functions that access these DoF indices, so that
we can use the global fe.dofs_per_vertex instead. This saves 4 bytes per
vertex, and maybe a few cycles of CPU time on top of it.
The (hp::)DoFHandler::n_boundary_dofs() functions were specialized for
the 1d case back in the day when faces in 1d were not usable the same
way faces in 2d/3d were accessible via iterators. Because C++ doesn't
allow partial specialization of member functions, the code was also
replicated three times for the <1,1>, <1,2>, and <1,3> cases.
Fix this: We can now always use the generic approach since the necessary
iterators were added several years ago. This also fixes a bug: in <1,2>
and <1,3>, we allow triangulations to have more than 2 end points,
which the existing code was not equipped to deal with.
David Wells [Sat, 8 Jul 2017 18:48:48 +0000 (14:48 -0400)]
Reorganize the internal mapping functions.
If we want to ultimately use a unity build then we will need to avoid duplicate
function names. This commit adds a new policy for avoiding these (a namespacing
scheme) and applies the fix to the mapping classes.
In particular, do not follow an if-statement that tests '!=null_ptr' by one that
tests '==null_ptr' since this is almost impossible to understand at a short
glance.
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.