Add computation of eigenvectors of rank-2 symmetric tensor.
This commit adds functions that compute the eigenvectors (and associated
eigenvalues) of a rank-2 symmetric tensor using one of threee methods:
1. Transformation to tridiagonal form and using the QL algorithm with
implicit shifting.
2. A hybrid algorithm that preferentially uses an analytical approach
and falls back to the QL algorithm if the computation is deemed
to be inaccurate.
3. The (robust but expensive) Jacobi algorithm.
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.
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.
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.