Commit adea34d2 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#527 Same for GlobalVector.

parent 09a52cb1
......@@ -84,7 +84,11 @@ namespace HappyHeart
const NumberingSubset& GetColNumberingSubset() const;
private:
private:
// ===========================================================================
// \attention Do not forget to update Swap() if a new data member is added!
// =============================================================================
//! Numbering subset used to describe rows.
const NumberingSubset& row_numbering_subset_;
......
......@@ -7,21 +7,29 @@
//
#include "Core/LinearAlgebra/GlobalVector.hpp"
#include "Core/NumberingSubset.hpp"
namespace HappyHeart
{
GlobalVector::GlobalVector(const NumberingSubset& numbering_subset)
: numbering_subset_(numbering_subset)
{ }
GlobalVector::GlobalVector(const GlobalVector& rhs)
: Parent(rhs)
: Parent(rhs),
numbering_subset_(rhs.numbering_subset_)
{ }
void Swap(GlobalVector& A, GlobalVector& B)
{
// \todo #527 Add assert about numbering subset!
assert(A.GetNumberingSubset() == B.GetNumberingSubset());
using Parent = GlobalVector::Parent;
......
......@@ -56,7 +56,7 @@ namespace HappyHeart
///@{
//! Constructor.
explicit GlobalVector() = default;
explicit GlobalVector(const NumberingSubset& numbering_subset);
//! Destructor.
~GlobalVector() = default;
......@@ -75,9 +75,17 @@ namespace HappyHeart
///@}
//! Numbering subset used to describe vector.
const NumberingSubset& GetNumberingSubset() const;
private:
// ===========================================================================
// \attention Do not forget to update Swap() if a new data member is added!
// =============================================================================
//! Numbering subset used to describe vector.
const NumberingSubset& numbering_subset_;
};
......
......@@ -14,7 +14,10 @@ namespace HappyHeart
{
inline const NumberingSubset& GlobalVector::GetNumberingSubset() const
{
return numbering_subset_;
}
} // namespace HappyHeart
......
......@@ -29,7 +29,7 @@ namespace HappyHeart
GlobalVectorWithNumberingSubset
::GlobalVectorWithNumberingSubset(const NumberingSubset& a_numbering_subset)
: global_vector(std::make_unique<GlobalVector>()),
: global_vector(std::make_unique<GlobalVector>(a_numbering_subset)),
numbering_subset(a_numbering_subset)
{ }
......
......@@ -46,8 +46,8 @@ namespace HappyHeart
{
current_velocity.Scale(-1., __FILE__, __LINE__);
GlobalVector diff_displ; // \todo #527 Awful! Store it once!
diff_displ.DuplicateLayout(system_solution, __FILE__, __LINE__);
std::lock_guard<std::mutex> lock(this->GetMutex());
auto& diff_displ = this->GetNonCstHelperGlobalVector<0>();
{
diff_displ.Copy(system_solution, __FILE__, __LINE__);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment