Skip to content

Commit

Permalink
Merge pull request #13505 from peterrum/ac_is_closed
Browse files Browse the repository at this point in the history
Add AffineConstraints::is_closed()
  • Loading branch information
peterrum committed Mar 8, 2022
2 parents 21aaeb8 + 23a8fd7 commit a5d36df
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/deal.II/lac/affine_constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,22 @@ class AffineConstraints : public Subscriptor
void
close();

/**
* Check if the function close() was called or there are no
* constraints locally, which is normally the case if a dummy
* AffineConstraints was created for the DG case.
*/
bool
is_closed() const;

/**
* Check if the function close() was called or there are no
* constraints globally, which is normally the case if a dummy
* AffineConstraints was created for the DG case.
*/
bool
is_closed(const MPI_Comm &comm) const;

/**
* Merge the constraints represented by the object given as argument into
* the constraints represented by this object. Both objects may or may not
Expand Down
17 changes: 17 additions & 0 deletions include/deal.II/lac/affine_constraints.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,23 @@ AffineConstraints<number>::close()



template <typename number>
bool
AffineConstraints<number>::is_closed() const
{
return sorted || (n_constraints() == 0);
}



template <typename number>
bool
AffineConstraints<number>::is_closed(const MPI_Comm &comm) const
{
return Utilities::MPI::min(static_cast<unsigned int>(is_closed()), comm) == 1;
}


template <typename number>
void
AffineConstraints<number>::merge(
Expand Down

0 comments on commit a5d36df

Please sign in to comment.