Commit 8efd6ddf authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#527 Remove special classes that paired numbering subsets with global linear...

#527 Remove special classes that paired numbering subsets with global linear algebra, given that now it is a feature of linear algebra.
parent 91688a5f
......@@ -22,8 +22,7 @@ lm5_cpp.content.txt
*.o
# Scons configuration file
Sources/build_configuration_clang.py
Sources/build_configuration_gcc.py
Sources/build_configuration_*
.sconsign-network.dblite
# Latex
......
......@@ -303,17 +303,11 @@
BE86B21D1AE90F6B00406F5B /* GlobalVectorStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE86B21A1AE90F6B00406F5B /* GlobalVectorStorage.cpp */; };
BE86B21E1AE90F6B00406F5B /* GlobalVectorStorage.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE86B21B1AE90F6B00406F5B /* GlobalVectorStorage.hpp */; };
BE86B21F1AE90F6B00406F5B /* GlobalVectorStorage.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE86B21C1AE90F6B00406F5B /* GlobalVectorStorage.hxx */; };
BE86B2231AE90F7300406F5B /* GlobalVectorWithNumberingSubset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE86B2201AE90F7300406F5B /* GlobalVectorWithNumberingSubset.cpp */; };
BE86B2241AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE86B2211AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hpp */; };
BE86B2251AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE86B2221AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hxx */; };
BE87A4EE1A6FEFF100E92902 /* InitHappyHeart.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE87A4EB1A6FEFF100E92902 /* InitHappyHeart.hpp */; };
BE87A4EF1A6FEFF100E92902 /* InitHappyHeart.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE87A4EC1A6FEFF100E92902 /* InitHappyHeart.hxx */; };
BE8D2D451AE8EFC200F1EC63 /* GlobalMatrixStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8D2D421AE8EFC200F1EC63 /* GlobalMatrixStorage.cpp */; };
BE8D2D461AE8EFC200F1EC63 /* GlobalMatrixStorage.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE8D2D431AE8EFC200F1EC63 /* GlobalMatrixStorage.hpp */; };
BE8D2D471AE8EFC200F1EC63 /* GlobalMatrixStorage.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE8D2D441AE8EFC200F1EC63 /* GlobalMatrixStorage.hxx */; };
BE8D2D4C1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8D2D491AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.cpp */; };
BE8D2D4D1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE8D2D4A1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hpp */; };
BE8D2D4E1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE8D2D4B1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hxx */; };
BE8F0E2A1A80FCE400D81C9F /* TransientSource.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE8F0E271A80FCE400D81C9F /* TransientSource.hxx */; };
BE8F0E2D1A80FF2E00D81C9F /* TransientSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8F0E251A80FCE400D81C9F /* TransientSource.cpp */; };
BE8F0E311A80FFED00D81C9F /* TransientSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE8F0E2E1A80FFED00D81C9F /* TransientSource.cpp */; };
......@@ -2084,17 +2078,11 @@
BE86B21A1AE90F6B00406F5B /* GlobalVectorStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlobalVectorStorage.cpp; sourceTree = "<group>"; };
BE86B21B1AE90F6B00406F5B /* GlobalVectorStorage.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalVectorStorage.hpp; sourceTree = "<group>"; };
BE86B21C1AE90F6B00406F5B /* GlobalVectorStorage.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalVectorStorage.hxx; sourceTree = "<group>"; };
BE86B2201AE90F7300406F5B /* GlobalVectorWithNumberingSubset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlobalVectorWithNumberingSubset.cpp; sourceTree = "<group>"; };
BE86B2211AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalVectorWithNumberingSubset.hpp; sourceTree = "<group>"; };
BE86B2221AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalVectorWithNumberingSubset.hxx; sourceTree = "<group>"; };
BE87A4EB1A6FEFF100E92902 /* InitHappyHeart.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InitHappyHeart.hpp; sourceTree = "<group>"; };
BE87A4EC1A6FEFF100E92902 /* InitHappyHeart.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InitHappyHeart.hxx; sourceTree = "<group>"; };
BE8D2D421AE8EFC200F1EC63 /* GlobalMatrixStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlobalMatrixStorage.cpp; sourceTree = "<group>"; };
BE8D2D431AE8EFC200F1EC63 /* GlobalMatrixStorage.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalMatrixStorage.hpp; sourceTree = "<group>"; };
BE8D2D441AE8EFC200F1EC63 /* GlobalMatrixStorage.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalMatrixStorage.hxx; sourceTree = "<group>"; };
BE8D2D491AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlobalMatrixWithNumberingSubsetPair.cpp; sourceTree = "<group>"; };
BE8D2D4A1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalMatrixWithNumberingSubsetPair.hpp; sourceTree = "<group>"; };
BE8D2D4B1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalMatrixWithNumberingSubsetPair.hxx; sourceTree = "<group>"; };
BE8F0E251A80FCE400D81C9F /* TransientSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransientSource.cpp; sourceTree = "<group>"; };
BE8F0E261A80FCE400D81C9F /* TransientSource.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TransientSource.hpp; sourceTree = "<group>"; };
BE8F0E271A80FCE400D81C9F /* TransientSource.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TransientSource.hxx; sourceTree = "<group>"; };
......@@ -3783,19 +3771,6 @@
path = MacroEncapsulation;
sourceTree = "<group>";
};
BE8D2D481AE8EFE300F1EC63 /* Impl */ = {
isa = PBXGroup;
children = (
BE8D2D491AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.cpp */,
BE8D2D4A1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hpp */,
BE8D2D4B1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hxx */,
BE86B2201AE90F7300406F5B /* GlobalVectorWithNumberingSubset.cpp */,
BE86B2211AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hpp */,
BE86B2221AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hxx */,
);
path = Impl;
sourceTree = "<group>";
};
BE8F0E381A8110EE00D81C9F /* GlobalVariationalOperator.xctemplate */ = {
isa = PBXGroup;
children = (
......@@ -4998,7 +4973,6 @@
BE86B21A1AE90F6B00406F5B /* GlobalVectorStorage.cpp */,
BE86B21B1AE90F6B00406F5B /* GlobalVectorStorage.hpp */,
BE86B21C1AE90F6B00406F5B /* GlobalVectorStorage.hxx */,
BE8D2D481AE8EFE300F1EC63 /* Impl */,
);
path = Private;
sourceTree = "<group>";
......@@ -5583,14 +5557,10 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
BE8D2D4E1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hxx in Headers */,
BE8D2D471AE8EFC200F1EC63 /* GlobalMatrixStorage.hxx in Headers */,
BE86B2241AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hpp in Headers */,
BE86B21F1AE90F6B00406F5B /* GlobalVectorStorage.hxx in Headers */,
BE86B21E1AE90F6B00406F5B /* GlobalVectorStorage.hpp in Headers */,
BE8D2D461AE8EFC200F1EC63 /* GlobalMatrixStorage.hpp in Headers */,
BE86B2251AE90F7300406F5B /* GlobalVectorWithNumberingSubset.hxx in Headers */,
BE8D2D4D1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.hpp in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -6529,8 +6499,6 @@
buildActionMask = 2147483647;
files = (
BE8D2D451AE8EFC200F1EC63 /* GlobalMatrixStorage.cpp in Sources */,
BE86B2231AE90F7300406F5B /* GlobalVectorWithNumberingSubset.cpp in Sources */,
BE8D2D4C1AE8F00B00F1EC63 /* GlobalMatrixWithNumberingSubsetPair.cpp in Sources */,
BE86B21D1AE90F6B00406F5B /* GlobalVectorStorage.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......
......@@ -42,23 +42,48 @@ namespace HappyHeart
}
bool NumberingSubsetEqual(const GlobalMatrix& lhs, const GlobalMatrix& rhs)
namespace GlobalMatrixNS
{
return lhs.GetRowNumberingSubset() == rhs.GetRowNumberingSubset()
&& lhs.GetColNumberingSubset() == rhs.GetColNumberingSubset();
}
bool NumberingSubsetLess(const GlobalMatrix& lhs, const GlobalMatrix& rhs)
{
const auto& lhs_row_subset = lhs.GetRowNumberingSubset();
const auto& rhs_row_subset = rhs.GetRowNumberingSubset();
if (lhs_row_subset == rhs_row_subset)
return lhs.GetColNumberingSubset() < rhs.GetColNumberingSubset();
return lhs_row_subset < rhs_row_subset;
}
bool EqualByNumberingSubset::operator()(const GlobalMatrix& lhs, const GlobalMatrix& rhs) const noexcept
{
return lhs.GetRowNumberingSubset() == rhs.GetRowNumberingSubset()
&& lhs.GetColNumberingSubset() == rhs.GetColNumberingSubset();
}
bool LessByNumberingSubset::operator()(const GlobalMatrix& lhs, const GlobalMatrix& rhs) const noexcept
{
const auto& lhs_row_subset = lhs.GetRowNumberingSubset();
const auto& rhs_row_subset = rhs.GetRowNumberingSubset();
if (lhs_row_subset == rhs_row_subset)
{
return lhs.GetColNumberingSubset() < rhs.GetColNumberingSubset();
}
return lhs_row_subset < rhs_row_subset;
}
FindIfCondition::FindIfCondition(const NumberingSubset& row_numbering_subset,
const NumberingSubset& col_numbering_subset)
: row_numbering_subset_(row_numbering_subset),
col_numbering_subset_(col_numbering_subset)
{ }
bool FindIfCondition::operator()(const GlobalMatrix::unique_ptr& rhs) const noexcept
{
assert(!(!rhs));
return rhs->GetRowNumberingSubset() == row_numbering_subset_
&& rhs->GetColNumberingSubset() == col_numbering_subset_;
}
} // namespace GlobalMatrixNS
} // namespace HappyHeart
......@@ -98,29 +98,7 @@ namespace HappyHeart
};
/*!
* \brief Returns true when two GlobalMatrices share the same numbering subsets.
*
* This is intended to be used in containers in which at most one GlobalMatrix with (row_numbering_subset,
* col_numbering_subset) may be found.
*/
bool NumberingSubsetEqual(const GlobalMatrix& lhs, const GlobalMatrix& rhs);
/*!
* \brief operator< for the numbering subsets.
*
* Row subset are compared first, and in case of equality columns ones are looked at.
*
* This is intended to be used in containers in which at most one GlobalMatrix with (row_numbering_subset,
* col_numbering_subset) may be found.
*/
bool NumberingSubsetLess(const GlobalMatrix& lhs, const GlobalMatrix& rhs);
/*!
* \brief Swap two matrices.
*
......@@ -160,6 +138,107 @@ namespace HappyHeart
*/
using GlobalMatrixWithCoefficient = std::pair<GlobalMatrix&, double>;
namespace GlobalMatrixNS
{
/*!
* \brief Returns true when two GlobalMatrices share the same numbering subsets.
*
* This is intended to be used in containers in which at most one GlobalMatrix with (row_numbering_subset,
* col_numbering_subset) may be found.
*
* It is a struct with a functor for possible use in STL algorithm.
*/
struct EqualByNumberingSubset
{
//! Prototype to compare direcly objects.
bool operator()(const GlobalMatrix& lhs, const GlobalMatrix& rhs) const noexcept;
//! Prototype to compare objects shielded by unique_ptr.
bool operator()(GlobalMatrix::unique_ptr lhs, GlobalMatrix::unique_ptr rhs) const noexcept;
};
/*!
* \brief Yields the unary condition required to find with std::find_if a GlobalMatrix in a list provided
* its numbering subsets are given.
*
* To find the GlobalMatrix in global_matrix_list_ with row_ns and col_ns the syntax is:
*
* \code
* auto it = std::find_if(global_matrix_list_.cbegin(),
* global_matrix_list_.cend(),
* GlobalMatrixNS::FindIfCondition(row_ns, col_ns));
* \endcode
*/
class FindIfCondition
{
public:
//! Constructor.
FindIfCondition(const NumberingSubset& row_numbering_subset,
const NumberingSubset& col_numbering_subset);
//! Destructor.
~FindIfCondition() = default;
//! Copy constructor.
FindIfCondition(const FindIfCondition&) = delete;
//! Move constructor.
FindIfCondition(FindIfCondition&&) = default;
//! Copy affectation.
FindIfCondition& operator=(const FindIfCondition&) = delete;
//! Move affectation.
FindIfCondition& operator=(FindIfCondition&&) = delete;
//! Prototype to compare objects shielded by unique_ptr.
bool operator()(const GlobalMatrix::unique_ptr& rhs) const noexcept;
private:
//! Numbering subset used to describe rows.
const NumberingSubset& row_numbering_subset_;
//! Numbering subset used to describe columns.
const NumberingSubset& col_numbering_subset_;
};
/*!
* \brief operator< for the numbering subsets.
*
* Row subset are compared first, and in case of equality columns ones are looked at.
*
* This is intended to be used in containers in which at most one GlobalMatrix with (row_numbering_subset,
* col_numbering_subset) may be found.
*
* It is a struct with a functor for possible use in STL algorithm.
*/
struct LessByNumberingSubset
{
//! Prototype to compare direcly objects.
bool operator()(const GlobalMatrix& lhs, const GlobalMatrix& rhs) const noexcept;
};
} // namespace GlobalMatrixNS
......
......@@ -26,6 +26,24 @@ namespace HappyHeart
}
namespace GlobalMatrixNS
{
inline bool EqualByNumberingSubset
::operator()(GlobalMatrix::unique_ptr lhs, GlobalMatrix::unique_ptr rhs) const noexcept
{
assert(!(!lhs));
assert(!(!rhs));
return operator()(*lhs, *rhs);
}
} // namespace GlobalMatrixNS
} // namespace HappyHeart
......
......@@ -39,16 +39,23 @@ namespace HappyHeart
bool NumberingSubsetEqual(const GlobalVector& lhs, const GlobalVector& rhs)
namespace GlobalVectorNS
{
return lhs.GetNumberingSubset() == rhs.GetNumberingSubset();
}
bool NumberingSubsetLess(const GlobalVector& lhs, const GlobalVector& rhs)
{
return lhs.GetNumberingSubset()< rhs.GetNumberingSubset();
}
FindIfCondition::FindIfCondition(const NumberingSubset& numbering_subset)
: numbering_subset_(numbering_subset)
{ }
bool FindIfCondition::operator()(const GlobalVector::unique_ptr& rhs) const noexcept
{
assert(!(!rhs));
return rhs->GetNumberingSubset() == numbering_subset_;
}
} // namespace GlobalVectorNS
......
......@@ -90,25 +90,6 @@ namespace HappyHeart
};
/*!
* \brief Returns true when two GlobalVectors share the same numbering subset.
*
* This is intended to be used in containers in which at most one GlobalVector with a given numbering
* subset may be found.
*/
bool NumberingSubsetEqual(const GlobalVector& lhs, const GlobalVector& rhs);
/*!
* \brief operator< for the numbering subsets.
*
* This is intended to be used in containers in which at most one GlobalVector with a given numbering
* subset may be found.
*/
bool NumberingSubsetLess(const GlobalVector& lhs, const GlobalVector& rhs);
/*!
* \brief Swap two vectors.
*
......@@ -145,6 +126,61 @@ namespace HappyHeart
* \endcode
*/
using GlobalVectorWithCoefficient = std::pair<GlobalVector&, double>;
namespace GlobalVectorNS
{
/*!
* \brief Yields the unary condition required to find with std::find_if a GlobalVector in a list provided
* its numbering subsets are given.
*
* To find the GlobalVector in global_matrix_list_ with numbering subset ns the syntax is:
*
* \code
* auto it = std::find_if(global_matrix_list_.cbegin(),
* global_matrix_list_.cend(),
* GlobalVectorNS::FindIfCondition(rns));
* \endcode
*/
class FindIfCondition
{
public:
//! Constructor.
FindIfCondition(const NumberingSubset& numbering_subset);
//! Destructor.
~FindIfCondition() = default;
//! Copy constructor.
FindIfCondition(const FindIfCondition&) = delete;
//! Move constructor.
FindIfCondition(FindIfCondition&&) = default;
//! Copy affectation.
FindIfCondition& operator=(const FindIfCondition&) = delete;
//! Move affectation.
FindIfCondition& operator=(FindIfCondition&&) = delete;
//! Prototype to compare objects shielded by unique_ptr.
bool operator()(const GlobalVector::unique_ptr& rhs) const noexcept;
private:
//! Numbering subset used to describe the vector..
const NumberingSubset& numbering_subset_;
};
} // namespace GlobalVectorNS
......
......@@ -18,8 +18,8 @@ namespace HappyHeart
{
return numbering_subset_;
}
} // namespace HappyHeart
......
......@@ -29,18 +29,12 @@ namespace HappyHeart
auto it = std::find_if(storage.cbegin(),
storage.cend(),
[&row_numbering_subset, &col_numbering_subset](const auto& item_ptr)
{
assert(!(!item_ptr));
const auto& item = *item_ptr;
return item.row_numbering_subset == row_numbering_subset
&& item.col_numbering_subset == col_numbering_subset;
});
GlobalMatrixNS::FindIfCondition(row_numbering_subset, col_numbering_subset));
assert(it != storage.cend());
assert(!(!(*it)->global_matrix));
return *(*it)->global_matrix;
assert(!(!*it));
return *(*it);
}
......@@ -48,8 +42,8 @@ namespace HappyHeart
const NumberingSubset& col_numbering_subset)
{
auto&& new_item =
std::make_unique<Impl::GlobalMatrixWithNumberingSubsetPair>(row_numbering_subset,
col_numbering_subset);
std::make_unique<GlobalMatrix>(row_numbering_subset,
col_numbering_subset);
auto& storage = GetNonCstStorage();
storage.emplace_back(std::move(new_item));
......@@ -58,7 +52,7 @@ namespace HappyHeart
AssertNoDuplicate();
# endif // NDEBUG
return *(storage.back()->global_matrix);
return *(storage.back());
}
......@@ -72,8 +66,8 @@ namespace HappyHeart
{
assert(!(!ptr));
auto check = id_list.insert({
ptr->row_numbering_subset.GetUniqueId(),
ptr->col_numbering_subset.GetUniqueId()
ptr->GetRowNumberingSubset().GetUniqueId(),
ptr->GetColNumberingSubset().GetUniqueId()
});
assert(check.second && "A given unique Id should be present only once!");
......
......@@ -12,7 +12,7 @@
# include <memory>
# include <vector>
# include "FormulationSolver/Private/Impl/GlobalMatrixWithNumberingSubsetPair.hpp"
# include "Core/LinearAlgebra/GlobalMatrix.hpp"
namespace HappyHeart
......@@ -93,10 +93,10 @@ namespace HappyHeart
private:
//! Access to the internal storage.
const Impl::GlobalMatrixWithNumberingSubsetPair::vector_unique_ptr& GetStorage() const;
const GlobalMatrix::vector_unique_ptr& GetStorage() const;
//! Non constant access to the internal storage.
Impl::GlobalMatrixWithNumberingSubsetPair::vector_unique_ptr& GetNonCstStorage();
GlobalMatrix::vector_unique_ptr& GetNonCstStorage();
# ifndef NDEBUG
void AssertNoDuplicate() const;
......@@ -108,7 +108,7 @@ namespace HappyHeart
private:
//! List of all global matrices with the numbering subsets used to find them.
Impl::GlobalMatrixWithNumberingSubsetPair::vector_unique_ptr storage_;
GlobalMatrix::vector_unique_ptr storage_;
};
......
......@@ -26,14 +26,14 @@ namespace HappyHeart
}
inline const Impl::GlobalMatrixWithNumberingSubsetPair::vector_unique_ptr& GlobalMatrixStorage
inline const GlobalMatrix::vector_unique_ptr& GlobalMatrixStorage
::GetStorage() const
{
return storage_;
}
inline Impl::GlobalMatrixWithNumberingSubsetPair::vector_unique_ptr& GlobalMatrixStorage
inline GlobalMatrix::vector_unique_ptr& GlobalMatrixStorage
::GetNonCstStorage()
{
return storage_;
......
......@@ -8,6 +8,8 @@
#include <set>
#include "Utilities/Containers/PointerComparison.hpp"
#include "Core/NumberingSubset.hpp"
#include "FormulationSolver/Private/GlobalVectorStorage.hpp"
......@@ -27,23 +29,19 @@ namespace HappyHeart
auto it = std::find_if(storage.cbegin(),
storage.cend(),
[&numbering_subset](const auto& item_ptr)
{
assert(!(!item_ptr));
const auto& item = *item_ptr;
return item.numbering_subset == numbering_subset;
});
GlobalVectorNS::FindIfCondition(numbering_subset)
);
assert(it != storage.cend());
assert(!(!((*it)->global_vector)));
return *((*it)->global_vector);
assert(!(!*it));
return *(*it);
}
GlobalVector& GlobalVectorStorage::NewVector(const NumberingSubset& numbering_subset)
{
auto&& new_item =
std::make_unique<Impl::GlobalVectorWithNumberingSubset>(numbering_subset);
std::make_unique<GlobalVector>(numbering_subset);
auto& storage = GetNonCstStorage();
storage.emplace_back(std::move(new_item));
......@@ -52,7 +50,7 @@ namespace HappyHeart
AssertNoDuplicate();
# endif // NDEBUG
return *(storage.back()->global_vector);
return *(storage.back());
}