Mentions légales du service

Skip to content
Snippets Groups Projects
Commit adea34d2 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#527 Same for GlobalVector.

parent 09a52cb1
Branches
Tags
No related merge requests found
...@@ -84,7 +84,11 @@ namespace HappyHeart ...@@ -84,7 +84,11 @@ namespace HappyHeart
const NumberingSubset& GetColNumberingSubset() const; 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. //! Numbering subset used to describe rows.
const NumberingSubset& row_numbering_subset_; const NumberingSubset& row_numbering_subset_;
......
...@@ -7,21 +7,29 @@ ...@@ -7,21 +7,29 @@
// //
#include "Core/LinearAlgebra/GlobalVector.hpp" #include "Core/LinearAlgebra/GlobalVector.hpp"
#include "Core/NumberingSubset.hpp"
namespace HappyHeart namespace HappyHeart
{ {
GlobalVector::GlobalVector(const NumberingSubset& numbering_subset)
: numbering_subset_(numbering_subset)
{ }
GlobalVector::GlobalVector(const GlobalVector& rhs) GlobalVector::GlobalVector(const GlobalVector& rhs)
: Parent(rhs) : Parent(rhs),
numbering_subset_(rhs.numbering_subset_)
{ } { }
void Swap(GlobalVector& A, GlobalVector& B) void Swap(GlobalVector& A, GlobalVector& B)
{ {
// \todo #527 Add assert about numbering subset! assert(A.GetNumberingSubset() == B.GetNumberingSubset());
using Parent = GlobalVector::Parent; using Parent = GlobalVector::Parent;
......
...@@ -56,7 +56,7 @@ namespace HappyHeart ...@@ -56,7 +56,7 @@ namespace HappyHeart
///@{ ///@{
//! Constructor. //! Constructor.
explicit GlobalVector() = default; explicit GlobalVector(const NumberingSubset& numbering_subset);
//! Destructor. //! Destructor.
~GlobalVector() = default; ~GlobalVector() = default;
...@@ -75,9 +75,17 @@ namespace HappyHeart ...@@ -75,9 +75,17 @@ namespace HappyHeart
///@} ///@}
//! Numbering subset used to describe vector.
const NumberingSubset& GetNumberingSubset() const;
private: 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 ...@@ -14,7 +14,10 @@ namespace HappyHeart
{ {
inline const NumberingSubset& GlobalVector::GetNumberingSubset() const
{
return numbering_subset_;
}
} // namespace HappyHeart } // namespace HappyHeart
......
...@@ -29,7 +29,7 @@ namespace HappyHeart ...@@ -29,7 +29,7 @@ namespace HappyHeart
GlobalVectorWithNumberingSubset GlobalVectorWithNumberingSubset
::GlobalVectorWithNumberingSubset(const NumberingSubset& a_numbering_subset) ::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) numbering_subset(a_numbering_subset)
{ } { }
......
...@@ -46,8 +46,8 @@ namespace HappyHeart ...@@ -46,8 +46,8 @@ namespace HappyHeart
{ {
current_velocity.Scale(-1., __FILE__, __LINE__); current_velocity.Scale(-1., __FILE__, __LINE__);
GlobalVector diff_displ; // \todo #527 Awful! Store it once! std::lock_guard<std::mutex> lock(this->GetMutex());
diff_displ.DuplicateLayout(system_solution, __FILE__, __LINE__); auto& diff_displ = this->GetNonCstHelperGlobalVector<0>();
{ {
diff_displ.Copy(system_solution, __FILE__, __LINE__); diff_displ.Copy(system_solution, __FILE__, __LINE__);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment