reinit(const IndexSet &local_constraints = IndexSet());
/**
- * Determines if we can store a constraint for the given @p line_index. This
+ * Determines if we can store a constraint for the given @p line_n. This
* routine only matters in the distributed case and checks if the IndexSet
* allows storage of this line. Always returns true if not in the
* distributed case.
*/
bool
- can_store_line(const size_type line_index) const;
+ can_store_line(const size_type line_n) const;
/**
* Return the index set describing locally relevant lines if any are
* function simply returns without doing anything.
*/
void
- add_line(const size_type line);
+ add_line(const size_type line_n);
/**
* Call the first add_line() function for every index <code>i</code> for
* twice.
*/
void
- add_entry(const size_type line, const size_type column, const number value);
+ add_entry(const size_type line_n, const size_type column, const number value);
/**
* Add a whole series of entries, denoted by pairs of column indices and
const std::vector<std::pair<size_type, number>> &col_val_pairs);
/**
- * Set an inhomogeneity to the constraint line <i>i</i>, according to the
+ * Set an inhomogeneity to the constraint line @p line_n, according to the
* discussion in the general class description.
*
* @note the line needs to be added with one of the add_line() calls first.
*/
void
- set_inhomogeneity(const size_type line, const number value);
+ set_inhomogeneity(const size_type line_n, const number value);
/**
* Close the filling of entries. Since the lines of a matrix of this type
n_constraints() const;
/**
- * Return whether the degree of freedom with number @p index is a
+ * Return whether the degree of freedom with number @p line_n is a
* constrained one.
*
* Note that if close() was called before, then this function is
* have to perform a linear search through all entries.
*/
bool
- is_constrained(const size_type index) const;
+ is_constrained(const size_type line_n) const;
/**
* Return whether the dof is constrained, and whether it is constrained to
* with a weight different from one.
*/
bool
- is_identity_constrained(const size_type index) const;
+ is_identity_constrained(const size_type line_n) const;
/**
* Return whether the two given degrees of freedom are linked by an equality
* <code>index2=index1</code>.
*/
bool
- are_identity_constrained(const size_type index1,
- const size_type index2) const;
+ are_identity_constrained(const size_type line_n_1,
+ const size_type line_n_2) const;
/**
* Return the maximum number of other dofs that one dof is constrained to.
* and a zero pointer in case the dof is not constrained.
*/
const std::vector<std::pair<size_type, number>> *
- get_constraint_entries(const size_type line) const;
+ get_constraint_entries(const size_type line_n) const;
/**
* Return the value of the inhomogeneity stored in the constrained dof @p
- * line. Unconstrained dofs also return a zero value.
+ * line_n. Unconstrained dofs also return a zero value.
*/
number
- get_inhomogeneity(const size_type line) const;
+ get_inhomogeneity(const size_type line_n) const;
/**
* Print the constraints represented by the current object to the
bool sorted;
/**
- * Internal function to calculate the index of line @p line in the vector
+ * Internal function to calculate the index of line @p line_n in the vector
* lines_cache using local_lines.
*/
size_type
- calculate_line_index(const size_type line) const;
+ calculate_line_index(const size_type line_n) const;
/**
* This function actually implements the local_to_global function for
template <typename number>
inline void
-AffineConstraints<number>::add_line(const size_type line)
+AffineConstraints<number>::add_line(const size_type line_n)
{
Assert(sorted == false, ExcMatrixIsClosed());
// handlers and we constrain a degree of freedom whose number we don't have
// locally. if we don't abort here the program will try to allocate several
// terabytes of memory to resize the various arrays below :-)
- Assert(line != numbers::invalid_size_type, ExcInternalError());
- const size_type line_index = calculate_line_index(line);
+ Assert(line_n != numbers::invalid_size_type, ExcInternalError());
+ const size_type line_index = calculate_line_index(line_n);
// check whether line already exists; it may, in which case we can just quit
- if (is_constrained(line))
+ if (is_constrained(line_n))
return;
// if necessary enlarge vector of existing entries for cache
// push a new line to the end of the list
lines.emplace_back();
- lines.back().index = line;
+ lines.back().index = line_n;
lines.back().inhomogeneity = 0.;
lines_cache[line_index] = lines.size() - 1;
}
template <typename number>
inline void
-AffineConstraints<number>::add_entry(const size_type line,
+AffineConstraints<number>::add_entry(const size_type line_n,
const size_type column,
const number value)
{
Assert(sorted == false, ExcMatrixIsClosed());
- Assert(line != column,
+ Assert(line_n != column,
ExcMessage("Can't constrain a degree of freedom to itself"));
// Ensure that the current line is present in the cache:
- const size_type line_index = calculate_line_index(line);
+ const size_type line_index = calculate_line_index(line_n);
Assert(line_index < lines_cache.size(),
ExcMessage("The current AffineConstraints does not contain the line "
"for the current entry. Call AffineConstraints::add_line "
Assert(lines_cache[line_index] != numbers::invalid_size_type,
ExcInternalError());
Assert(!local_lines.size() || local_lines.is_element(column),
- ExcColumnNotStoredHere(line, column));
+ ExcColumnNotStoredHere(line_n, column));
ConstraintLine *line_ptr = &lines[lines_cache[line_index]];
- Assert(line_ptr->index == line, ExcInternalError());
+ Assert(line_ptr->index == line_n, ExcInternalError());
for (const auto &p : line_ptr->entries)
if (p.first == column)
{
Assert(std::abs(p.second - value) < 1.e-14,
- ExcEntryAlreadyExists(line, column, p.second, value));
+ ExcEntryAlreadyExists(line_n, column, p.second, value));
return;
}
template <typename number>
inline void
-AffineConstraints<number>::set_inhomogeneity(const size_type line,
+AffineConstraints<number>::set_inhomogeneity(const size_type line_n,
const number value)
{
- const size_type line_index = calculate_line_index(line);
+ const size_type line_index = calculate_line_index(line_n);
Assert(line_index < lines_cache.size() &&
lines_cache[line_index] != numbers::invalid_size_type,
ExcMessage("call add_line() before calling set_inhomogeneity()"));
template <typename number>
inline bool
AffineConstraints<number>::is_inhomogeneously_constrained(
- const size_type index) const
+ const size_type line_n) const
{
// check whether the entry is constrained. could use is_constrained, but
// that means computing the line index twice
- const size_type line_index = calculate_line_index(index);
+ const size_type line_index = calculate_line_index(line_n);
if (line_index >= lines_cache.size() ||
lines_cache[line_index] == numbers::invalid_size_type)
return false;
template <typename number>
inline const std::vector<std::pair<types::global_dof_index, number>> *
-AffineConstraints<number>::get_constraint_entries(const size_type line) const
+AffineConstraints<number>::get_constraint_entries(const size_type line_n) const
{
// check whether the entry is constrained. could use is_constrained, but
// that means computing the line index twice
- const size_type line_index = calculate_line_index(line);
+ const size_type line_index = calculate_line_index(line_n);
if (line_index >= lines_cache.size() ||
lines_cache[line_index] == numbers::invalid_size_type)
return nullptr;
template <typename number>
inline number
-AffineConstraints<number>::get_inhomogeneity(const size_type line) const
+AffineConstraints<number>::get_inhomogeneity(const size_type line_n) const
{
// check whether the entry is constrained. could use is_constrained, but
// that means computing the line index twice
- const size_type line_index = calculate_line_index(line);
+ const size_type line_index = calculate_line_index(line_n);
if (line_index >= lines_cache.size() ||
lines_cache[line_index] == numbers::invalid_size_type)
return 0;
template <typename number>
inline types::global_dof_index
-AffineConstraints<number>::calculate_line_index(const size_type line) const
+AffineConstraints<number>::calculate_line_index(const size_type line_n) const
{
// IndexSet is unused (serial case)
if (!local_lines.size())
- return line;
+ return line_n;
- Assert(local_lines.is_element(line), ExcRowNotStoredHere(line));
+ Assert(local_lines.is_element(line_n), ExcRowNotStoredHere(line_n));
- return local_lines.index_within_set(line);
+ return local_lines.index_within_set(line_n);
}
template <typename number>
inline bool
-AffineConstraints<number>::can_store_line(size_type line_index) const
+AffineConstraints<number>::can_store_line(size_type line_n) const
{
- return !local_lines.size() || local_lines.is_element(line_index);
+ return !local_lines.size() || local_lines.is_element(line_n);
}
template <typename number>
// Helper to return a ConstraintLine object that belongs to row @p row.
// If @p row is not constrained or not stored locally, return an empty
// constraint object that would correspond to a zero constraints
- auto get_line = [&](const size_type row) -> ConstraintLine {
- const size_type line_index = calculate_line_index(row);
+ auto get_line = [&](const size_type line_n) -> ConstraintLine {
+ const size_type line_index = calculate_line_index(line_n);
if (line_index >= lines_cache.size() ||
lines_cache[line_index] == numbers::invalid_size_type)
{
- const ConstraintLine empty = {row, {}, 0.0};
+ const ConstraintLine empty = {line_n, {}, 0.0};
return empty;
}
else
template <typename number>
bool
-AffineConstraints<number>::is_identity_constrained(const size_type index) const
+AffineConstraints<number>::is_identity_constrained(const size_type line_n) const
{
- if (is_constrained(index) == false)
+ if (is_constrained(line_n) == false)
return false;
- const ConstraintLine &p = lines[lines_cache[calculate_line_index(index)]];
- Assert(p.index == index, ExcInternalError());
+ const ConstraintLine &line = lines[lines_cache[calculate_line_index(line_n)]];
+ Assert(line.index == line_n, ExcInternalError());
// return if an entry for this line was found and if it has only one
// entry equal to 1.0
- return (p.entries.size() == 1) && (p.entries[0].second == number(1.0));
+ return (line.entries.size() == 1) && (line.entries[0].second == number(1.0));
}
template <typename number>
bool
AffineConstraints<number>::are_identity_constrained(
- const size_type index1,
- const size_type index2) const
+ const size_type line_n_1,
+ const size_type line_n_2) const
{
- if (is_constrained(index1) == true)
+ if (is_constrained(line_n_1) == true)
{
- const ConstraintLine &p =
- lines[lines_cache[calculate_line_index(index1)]];
- Assert(p.index == index1, ExcInternalError());
+ const ConstraintLine &line =
+ lines[lines_cache[calculate_line_index(line_n_1)]];
+ Assert(line.index == line_n_1, ExcInternalError());
// return if an entry for this line was found and if it has only one
// entry equal to 1.0 and that one is index2
- return ((p.entries.size() == 1) && (p.entries[0].first == index2) &&
- (p.entries[0].second == number(1.0)));
+ return ((line.entries.size() == 1) &&
+ (line.entries[0].first == line_n_2) &&
+ (line.entries[0].second == number(1.0)));
}
- else if (is_constrained(index2) == true)
+ else if (is_constrained(line_n_2) == true)
{
- const ConstraintLine &p =
- lines[lines_cache[calculate_line_index(index2)]];
- Assert(p.index == index2, ExcInternalError());
+ const ConstraintLine &line =
+ lines[lines_cache[calculate_line_index(line_n_2)]];
+ Assert(line.index == line_n_2, ExcInternalError());
// return if an entry for this line was found and if it has only one
- // entry equal to 1.0 and that one is index1
- return ((p.entries.size() == 1) && (p.entries[0].first == index1) &&
- (p.entries[0].second == number(1.0)));
+ // entry equal to 1.0 and that one is line_n_1
+ return ((line.entries.size() == 1) &&
+ (line.entries[0].first == line_n_1) &&
+ (line.entries[0].second == number(1.0)));
}
else
return false;