* @{
*/
- /**
- * Re-distribute the elements of the vector @p condensed to @p uncondensed.
- * It is the user's responsibility to guarantee that all entries of @p
- * uncondensed be zero!
- *
- * This function undoes the action of @p condense somehow, but it should be
- * noted that it is not the inverse of @p condense.
- *
- * The @p VectorType may be a Vector<float>, Vector<double>,
- * BlockVector<tt><...></tt>, a PETSc or Trilinos vector wrapper class, or
- * any other type having the same interface.
- */
- template <class VectorType>
- void distribute (const VectorType &condensed,
- VectorType &uncondensed) const;
-
/**
* Re-distribute the elements of the vector in-place. The @p VectorType may
* be a Vector<float>, Vector<double>, BlockVector<tt><...></tt>, a PETSc or
-template<class VectorType>
-void
-ConstraintMatrix::distribute (const VectorType &condensed,
- VectorType &uncondensed) const
-{
- Assert (sorted == true, ExcMatrixNotClosed());
- AssertDimension (condensed.size()+n_constraints(), uncondensed.size());
-
- // store for each line of the new vector
- // its old line number before
- // distribution. If the shift is
- // -1, this line was condensed away
- std::vector<int> old_line;
-
- old_line.reserve (uncondensed.size());
-
- std::vector<ConstraintLine>::const_iterator next_constraint = lines.begin();
- size_type shift = 0;
- size_type n_rows = uncondensed.size();
-
- if (next_constraint == lines.end())
- // if no constraint is to be handled
- for (size_type row=0; row!=n_rows; ++row)
- old_line.push_back (row);
- else
- for (size_type row=0; row!=n_rows; ++row)
- if (row == next_constraint->line)
- {
- // this line is constrained
- old_line.push_back (-1);
- // note that @p lines is ordered
- ++shift;
- ++next_constraint;
- if (next_constraint == lines.end())
- // nothing more to do; finish rest
- // of loop
- {
- for (size_type i=row+1; i<n_rows; ++i)
- old_line.push_back (i-shift);
- break;
- }
- }
- else
- old_line.push_back (row-shift);
-
-
- next_constraint = lines.begin();
- // note: in this loop we need not check
- // whether @p next_constraint is a valid
- // iterator, since @p next_constraint is
- // only evaluated so often as there are
- // entries in new_line[*] which tells us
- // which constraints exist
- for (size_type line=0; line<uncondensed.size(); ++line)
- if (old_line[line] != -1)
- // line was not condensed away
- uncondensed(line) = condensed(old_line[line]);
- else
- {
- // line was condensed away,
- // create it newly. first set
- // it to zero
- uncondensed(line) = next_constraint->inhomogeneity;
- // then add the different
- // contributions
- for (size_type i=0; i<next_constraint->entries.size(); ++i)
- uncondensed(line) += (condensed(old_line[next_constraint->entries[i].first]) *
- next_constraint->entries[i].second);
- ++next_constraint;
- };
-}
-
-
namespace internal
{
namespace
distribute_local_to_global<VectorType > (const Vector<double> &, \
const std::vector<ConstraintMatrix::size_type> &, \
VectorType &, \
- const FullMatrix<double> &) const; \
- template void ConstraintMatrix::distribute<VectorType >(const VectorType &condensed,\
- VectorType &uncondensed) const
+ const FullMatrix<double> &) const
#define PARALLEL_VECTOR_FUNCTIONS(VectorType) \
template void ConstraintMatrix:: \
template void ConstraintMatrix::condense<T<S> >(T<S> &vec) const;
template void ConstraintMatrix::distribute_local_to_global<T<S> > (
const Vector<double>&, const std::vector<types::global_dof_index> &, T<S> &, const FullMatrix<double>&) const;
- template void ConstraintMatrix::distribute<T<S> >(const T<S> &, T<S> &) const;
template void ConstraintMatrix::set_zero<T<S> >(T<S> &) const;
}
template void ConstraintMatrix::condense<parallel::distributed::T<S> >(parallel::distributed::T<S> &vec) const;
template void ConstraintMatrix::distribute_local_to_global<parallel::distributed::T<S> > (
const Vector<double>&, const std::vector<types::global_dof_index> &, parallel::distributed::T<S> &, const FullMatrix<double>&) const;
- template void ConstraintMatrix::distribute<parallel::distributed::T<S> >(const parallel::distributed::T<S> &, parallel::distributed::T<S> &) const;
template void ConstraintMatrix::set_zero<parallel::distributed::T<S> >(parallel::distributed::T<S> &) const;
}
template void ConstraintMatrix::condense<V >(V&vec) const;
template void ConstraintMatrix::distribute_local_to_global<V > (
const Vector<double>&, const std::vector<types::global_dof_index> &, V&, const FullMatrix<double>&) const;
- template void ConstraintMatrix::distribute<V >(const V&, V&) const;
template void ConstraintMatrix::set_zero<V >(V&) const;
}