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

#531 Introduce a CRTP to provide GetRowNumberingSubset() and GetColNumberingSubset() interface.

parent cb644a5c
......@@ -16,7 +16,7 @@ transient = {
-- Maximum time, if set to zero run a case.
-- Expected format: VALUE
-- Constraint: v >= 0.
timeMax = 40.
timeMax = 1.
}
-- NumberingSubset1
......
......@@ -225,8 +225,6 @@
BE4CD12F1A89F5FE00EEDB5F /* State.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE4CD12C1A89F5FE00EEDB5F /* State.cpp */; };
BE4CD1301A89F5FE00EEDB5F /* State.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE4CD12D1A89F5FE00EEDB5F /* State.hpp */; };
BE4CD1311A89F5FE00EEDB5F /* State.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE4CD12E1A89F5FE00EEDB5F /* State.hxx */; };
BE4DDE8F1AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE4DDE871AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hpp */; };
BE4DDE901AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE4DDE881AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hxx */; };
BE4DDE941AE1332900D60CCC /* GlobalVariationalOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE4DDE8C1AE1332900D60CCC /* GlobalVariationalOperator.cpp */; };
BE4DDE951AE1332900D60CCC /* GlobalVariationalOperator.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE4DDE8D1AE1332900D60CCC /* GlobalVariationalOperator.hpp */; };
BE4DDE961AE1332900D60CCC /* GlobalVariationalOperator.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE4DDE8E1AE1332900D60CCC /* GlobalVariationalOperator.hxx */; };
......@@ -274,6 +272,13 @@
BE699CFD1AF2539E009CBF44 /* ScalarDivVectorial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE699CFA1AF2539E009CBF44 /* ScalarDivVectorial.cpp */; };
BE6AAE6B1AF7590F00D420CB /* NumberingSubset.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE681AF7590F00D420CB /* NumberingSubset.hpp */; };
BE6AAE6C1AF7590F00D420CB /* NumberingSubset.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE691AF7590F00D420CB /* NumberingSubset.hxx */; };
BE6AAE721AF76F2F00D420CB /* NumberingSubsetSubMatrix.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE6F1AF76F2F00D420CB /* NumberingSubsetSubMatrix.hpp */; };
BE6AAE731AF76F2F00D420CB /* NumberingSubsetSubMatrix.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE701AF76F2F00D420CB /* NumberingSubsetSubMatrix.hxx */; };
BE6AAE781AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6AAE751AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.cpp */; };
BE6AAE791AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE761AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hpp */; };
BE6AAE7A1AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE771AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hxx */; };
BE6AAE871AF7726600D420CB /* NumberingSubsetForMatrix.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE841AF7726600D420CB /* NumberingSubsetForMatrix.hpp */; };
BE6AAE881AF7726600D420CB /* NumberingSubsetForMatrix.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE851AF7726600D420CB /* NumberingSubsetForMatrix.hxx */; };
BE6AE0CB1AE631C6006DF2BA /* VariationalFormulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6AE0C81AE631C6006DF2BA /* VariationalFormulation.cpp */; };
BE6BE4E31A665A90009AC2F3 /* IOFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6BE4E01A665A90009AC2F3 /* IOFormat.cpp */; };
BE6C215F19AF2FDB00CC674B /* libUtilities.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEA8A379177AD4FE009436C9 /* libUtilities.a */; };
......@@ -1920,8 +1925,6 @@
BE4CD12C1A89F5FE00EEDB5F /* State.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = State.cpp; sourceTree = "<group>"; };
BE4CD12D1A89F5FE00EEDB5F /* State.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = State.hpp; sourceTree = "<group>"; };
BE4CD12E1A89F5FE00EEDB5F /* State.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = State.hxx; sourceTree = "<group>"; };
BE4DDE871AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalMatrixOrVectorPropertiesStorage.hpp; sourceTree = "<group>"; };
BE4DDE881AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalMatrixOrVectorPropertiesStorage.hxx; sourceTree = "<group>"; };
BE4DDE8C1AE1332900D60CCC /* GlobalVariationalOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GlobalVariationalOperator.cpp; sourceTree = "<group>"; };
BE4DDE8D1AE1332900D60CCC /* GlobalVariationalOperator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalVariationalOperator.hpp; sourceTree = "<group>"; };
BE4DDE8E1AE1332900D60CCC /* GlobalVariationalOperator.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = GlobalVariationalOperator.hxx; sourceTree = "<group>"; };
......@@ -2016,6 +2019,13 @@
BE699CFA1AF2539E009CBF44 /* ScalarDivVectorial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScalarDivVectorial.cpp; sourceTree = "<group>"; };
BE6AAE681AF7590F00D420CB /* NumberingSubset.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubset.hpp; sourceTree = "<group>"; };
BE6AAE691AF7590F00D420CB /* NumberingSubset.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubset.hxx; sourceTree = "<group>"; };
BE6AAE6F1AF76F2F00D420CB /* NumberingSubsetSubMatrix.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubsetSubMatrix.hpp; sourceTree = "<group>"; };
BE6AAE701AF76F2F00D420CB /* NumberingSubsetSubMatrix.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubsetSubMatrix.hxx; sourceTree = "<group>"; };
BE6AAE751AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubMatrixForNumberingSubsetPair.cpp; sourceTree = "<group>"; };
BE6AAE761AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SubMatrixForNumberingSubsetPair.hpp; sourceTree = "<group>"; };
BE6AAE771AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SubMatrixForNumberingSubsetPair.hxx; sourceTree = "<group>"; };
BE6AAE841AF7726600D420CB /* NumberingSubsetForMatrix.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubsetForMatrix.hpp; sourceTree = "<group>"; };
BE6AAE851AF7726600D420CB /* NumberingSubsetForMatrix.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubsetForMatrix.hxx; sourceTree = "<group>"; };
BE6AE0C81AE631C6006DF2BA /* VariationalFormulation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VariationalFormulation.cpp; sourceTree = "<group>"; };
BE6AE0C91AE631C6006DF2BA /* VariationalFormulation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = VariationalFormulation.hpp; sourceTree = "<group>"; };
BE6AE0CA1AE631C6006DF2BA /* VariationalFormulation.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = VariationalFormulation.hxx; sourceTree = "<group>"; };
......@@ -3283,6 +3293,7 @@
BE4B47021AE107730078955C /* LocalVariationalOperator.cpp */,
BE4B47031AE107730078955C /* LocalVariationalOperator.hpp */,
BE4B47041AE107730078955C /* LocalVariationalOperator.hxx */,
BE6AAE6D1AF76EA600D420CB /* Crtp */,
);
path = LocalVariationalOperator;
sourceTree = "<group>";
......@@ -3307,20 +3318,10 @@
BE4DDE8D1AE1332900D60CCC /* GlobalVariationalOperator.hpp */,
BE4DDE8E1AE1332900D60CCC /* GlobalVariationalOperator.hxx */,
BEA3FA811AF10CD000D3F871 /* Impl */,
BE4DDE861AE1332900D60CCC /* Crtp */,
);
path = Private;
sourceTree = "<group>";
};
BE4DDE861AE1332900D60CCC /* Crtp */ = {
isa = PBXGroup;
children = (
BE4DDE871AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hpp */,
BE4DDE881AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hxx */,
);
path = Crtp;
sourceTree = "<group>";
};
BE4FC35018F2A6CA007B6DED /* Exceptions */ = {
isa = PBXGroup;
children = (
......@@ -3492,6 +3493,7 @@
BE6462231AEE199900D5162A /* NumberingSubset.hpp */,
BE6462241AEE199900D5162A /* NumberingSubset.hxx */,
BE64622F1AEE1AC600D5162A /* LinearAlgebra */,
BE6AAE811AF7724300D420CB /* Crtp */,
BE6462251AEE199900D5162A /* Private */,
BE968B6917AB94A100995748 /* InputParameter */,
);
......@@ -3660,6 +3662,35 @@
path = Crtp;
sourceTree = "<group>";
};
BE6AAE6D1AF76EA600D420CB /* Crtp */ = {
isa = PBXGroup;
children = (
BE6AAE6F1AF76F2F00D420CB /* NumberingSubsetSubMatrix.hpp */,
BE6AAE701AF76F2F00D420CB /* NumberingSubsetSubMatrix.hxx */,
BE6AAE741AF76FCC00D420CB /* Private */,
);
path = Crtp;
sourceTree = "<group>";
};
BE6AAE741AF76FCC00D420CB /* Private */ = {
isa = PBXGroup;
children = (
BE6AAE751AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.cpp */,
BE6AAE761AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hpp */,
BE6AAE771AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hxx */,
);
path = Private;
sourceTree = "<group>";
};
BE6AAE811AF7724300D420CB /* Crtp */ = {
isa = PBXGroup;
children = (
BE6AAE841AF7726600D420CB /* NumberingSubsetForMatrix.hpp */,
BE6AAE851AF7726600D420CB /* NumberingSubsetForMatrix.hxx */,
);
path = Crtp;
sourceTree = "<group>";
};
BE7027F91A5FC55700E11393 /* XCodeTemplates */ = {
isa = PBXGroup;
children = (
......@@ -5142,6 +5173,7 @@
BE90DED71A24903700CCAFDE /* TransientParameters.hxx in Headers */,
BE90DED81A24903700CCAFDE /* Transient.hpp in Headers */,
BE6AAE6B1AF7590F00D420CB /* NumberingSubset.hpp in Headers */,
BE6AAE871AF7726600D420CB /* NumberingSubsetForMatrix.hpp in Headers */,
BE2E0CCB1ABAFBA800B543E8 /* Mesh.hpp in Headers */,
BE90DED61A24903700CCAFDE /* TransientParameters.hpp in Headers */,
BE4053EB1AC172580024D5F9 /* FEltSpace.hpp in Headers */,
......@@ -5178,6 +5210,7 @@
BE4054201AC1C16A0024D5F9 /* Unknown.hpp in Headers */,
BEF282811A850DEC00857342 /* InitialCondition.hpp in Headers */,
BEDAC3DC1AD8108E00AA2156 /* NumberingSubset.hpp in Headers */,
BE6AAE881AF7726600D420CB /* NumberingSubsetForMatrix.hxx in Headers */,
BE6AAE6C1AF7590F00D420CB /* NumberingSubset.hxx in Headers */,
BE90DEE01A24903700CCAFDE /* Force.hpp in Headers */,
BE40541B1AC1C14D0024D5F9 /* Unknown.hxx in Headers */,
......@@ -5238,7 +5271,6 @@
BE90E15A1A2491AE00CCAFDE /* ComponentFactory.hpp in Headers */,
BE2B66461A2778C700E80864 /* Spectral.hxx in Headers */,
BE2B66611A2778C700E80864 /* RefFEltInLocalNumbering.hxx in Headers */,
BE4DDE8F1AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hpp in Headers */,
BE4054041AC196480024D5F9 /* FEltSpace.hpp in Headers */,
BE90E1191A2491AE00CCAFDE /* Unknown.hpp in Headers */,
BE90E0971A2491AE00CCAFDE /* GradOnGradientBasedElasticityTensor.hpp in Headers */,
......@@ -5248,6 +5280,7 @@
BE90E0771A2491AE00CCAFDE /* AttributeProcessorHelper.hxx in Headers */,
BE90E0A31A2491AE00CCAFDE /* ElasticityHelper.hpp in Headers */,
BE90E1511A2491AE00CCAFDE /* Comp23.hpp in Headers */,
BE6AAE721AF76F2F00D420CB /* NumberingSubsetSubMatrix.hpp in Headers */,
BE90E0B21A2491AE00CCAFDE /* Helper.hpp in Headers */,
BE2B66531A2778C700E80864 /* ElementaryDataStorage.hxx in Headers */,
BE90E0BA1A2491AE00CCAFDE /* Helper.hpp in Headers */,
......@@ -5327,6 +5360,7 @@
BEB917111AD3D37A0096A3D9 /* UnknownAndNumberingSubset.hxx in Headers */,
BE90E0871A2491AE00CCAFDE /* GradPhiGradPhi.hxx in Headers */,
BE90E10C1A2491AE00CCAFDE /* Triangle.hpp in Headers */,
BE6AAE791AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hpp in Headers */,
BEB03EAE1A3601EF00E99AAC /* Force.hpp in Headers */,
BE86A9EF1A385C9B003B211D /* SegmentP2.hpp in Headers */,
BE2B66641A2778C700E80864 /* RefFEltSpace.hxx in Headers */,
......@@ -5357,7 +5391,6 @@
BE2B66581A2778C700E80864 /* BasicRefFEltFactory.hpp in Headers */,
BE2B66451A2778C700E80864 /* Spectral.hpp in Headers */,
BE2B664C1A2778C700E80864 /* TriangleP1.hpp in Headers */,
BE4DDE901AE1332900D60CCC /* GlobalMatrixOrVectorPropertiesStorage.hxx in Headers */,
BE90E0FA1A2491AE00CCAFDE /* LocalFEltSpace.hpp in Headers */,
BE2B663A1A2778C700E80864 /* ElementaryData.hxx in Headers */,
BE90E1161A2491AE00CCAFDE /* GaussQuadratureFormula.hpp in Headers */,
......@@ -5366,8 +5399,10 @@
BE90E06D1A2491AE00CCAFDE /* ComputeMatrixPattern.hpp in Headers */,
BE2B66371A2778C700E80864 /* BasicRefFElt.hxx in Headers */,
BE5CA7C21ADBC5BD00758CD2 /* MatrixPattern.hxx in Headers */,
BE6AAE731AF76F2F00D420CB /* NumberingSubsetSubMatrix.hxx in Headers */,
BE90E1051A2491AE00CCAFDE /* GaussQuadratureFormula.hpp in Headers */,
BE2B664A1A2778C700E80864 /* TetrahedronP2.hpp in Headers */,
BE6AAE7A1AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.hxx in Headers */,
BE90E1491A2491AE00CCAFDE /* Comp12.hpp in Headers */,
BE90E0AF1A2491AE00CCAFDE /* InvariantManager.hpp in Headers */,
BE90E0AA1A2491AE00CCAFDE /* CiarletGeymonat.hxx in Headers */,
......@@ -6327,6 +6362,7 @@
BE90E1071A2491AE00CCAFDE /* Point.cpp in Sources */,
BE8F0E2D1A80FF2E00D81C9F /* TransientSource.cpp in Sources */,
13EDDEC81AB03E1B00A1E8F9 /* PointP1.cpp in Sources */,
BE6AAE781AF76FFC00D420CB /* SubMatrixForNumberingSubsetPair.cpp in Sources */,
BE90E1181A2491AE00CCAFDE /* Unknown.cpp in Sources */,
BE2B66421A2778C700E80864 /* QuadrangleQ2c.cpp in Sources */,
BE699CFD1AF2539E009CBF44 /* ScalarDivVectorial.cpp in Sources */,
......
//
// NumberingSubsetForMatrix.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 04/05/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef _HAPPY_HEART__CORE__CRTP__NUMBERING_SUBSET_FOR_MATRIX_HPP_
# define _HAPPY_HEART__CORE__CRTP__NUMBERING_SUBSET_FOR_MATRIX_HPP_
namespace HappyHeart
{
// ============================
// Forward declarations.
// ============================
class NumberingSubset;
// ============================
// End of forward declarations.
// ============================
namespace Crtp
{
/*!
* \brief This Crtp add two data attributes (const references to row and column numbering subsets) and accessors
* to them.
*/
template<class DerivedT>
class NumberingSubsetForMatrix
{
public:
/// \name Special members.
///@{
//! Constructor.
explicit NumberingSubsetForMatrix(const NumberingSubset& row_numbering_subset,
const NumberingSubset& col_numbering_subset);
//! Destructor.
~NumberingSubsetForMatrix() = default;
//! Copy constructor.
NumberingSubsetForMatrix(const NumberingSubsetForMatrix&);
//! Move constructor.
NumberingSubsetForMatrix(NumberingSubsetForMatrix&&) = default;
//! Copy affectation.
NumberingSubsetForMatrix& operator=(const NumberingSubsetForMatrix&) = default;
//! Move affectation.
NumberingSubsetForMatrix& operator=(NumberingSubsetForMatrix&&) = default;
///@}
//! Numbering subset used to describe rows.
const NumberingSubset& GetRowNumberingSubset() const;
//! Numbering subset used to describe columns.
const NumberingSubset& GetColNumberingSubset() const;
private:
//! Numbering subset used to describe rows.
const NumberingSubset& row_numbering_subset_;
//! Numbering subset used to describe columns.
const NumberingSubset& col_numbering_subset_;
};
} //namespace Crtp
} // namespace HappyHeart
# include "Core/Crtp/NumberingSubsetForMatrix.hxx"
#endif // _HAPPY_HEART__CORE__CRTP__NUMBERING_SUBSET_FOR_MATRIX_HPP_
//
// NumberingSubsetForMatrix.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 04/05/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef _HAPPY_HEART__CORE__CRTP__NUMBERING_SUBSET_FOR_MATRIX_HXX_
# define _HAPPY_HEART__CORE__CRTP__NUMBERING_SUBSET_FOR_MATRIX_HXX_
namespace HappyHeart
{
namespace Crtp
{
template<class DerivedT>
NumberingSubsetForMatrix<DerivedT>::NumberingSubsetForMatrix(const NumberingSubset& row_numbering_subset,
const NumberingSubset& col_numbering_subset)
: row_numbering_subset_(row_numbering_subset),
col_numbering_subset_(col_numbering_subset)
{ }
template<class DerivedT>
NumberingSubsetForMatrix<DerivedT>::NumberingSubsetForMatrix(const NumberingSubsetForMatrix<DerivedT>& rhs)
: row_numbering_subset_(rhs.row_numbering_subset_),
col_numbering_subset_(rhs.col_numbering_subset_)
{ }
template<class DerivedT>
inline const NumberingSubset& NumberingSubsetForMatrix<DerivedT>::GetRowNumberingSubset() const
{
return row_numbering_subset_;
}
template<class DerivedT>
inline const NumberingSubset& NumberingSubsetForMatrix<DerivedT>::GetColNumberingSubset() const
{
return col_numbering_subset_;
}
} //namespace Crtp
} // namespace HappyHeart
#endif // _HAPPY_HEART__CORE__CRTP__NUMBERING_SUBSET_FOR_MATRIX_HXX_
......@@ -17,28 +17,26 @@ namespace HappyHeart
GlobalMatrix::GlobalMatrix(const NumberingSubset& row_numbering_subset,
const NumberingSubset& col_numbering_subset)
: row_numbering_subset_(row_numbering_subset),
col_numbering_subset_(col_numbering_subset)
: Crtp::NumberingSubsetForMatrix<GlobalMatrix>(row_numbering_subset, col_numbering_subset)
{ }
GlobalMatrix::GlobalMatrix(const GlobalMatrix& rhs)
: Parent(rhs),
row_numbering_subset_(rhs.row_numbering_subset_),
col_numbering_subset_(rhs.col_numbering_subset_)
: PetscParent(rhs),
NumberingSubsetParent(rhs)
{ }
void Swap(GlobalMatrix& A, GlobalMatrix& B)
{
// We swap the content of two matrices that share the same numbering subsets.
assert(A.GetColNumberingSubset() == B.GetColNumberingSubset());
assert(A.GetRowNumberingSubset() == B.GetRowNumberingSubset());
using Parent = GlobalMatrix::Parent;
using Parent = GlobalMatrix::PetscParent;
Swap(static_cast<Parent&>(A), static_cast<Parent&>(B));
}
......
......@@ -14,6 +14,8 @@
# include "ThirdParty/Wrappers/Petsc/Matrix/Matrix.hpp"
# include "Core/Crtp/NumberingSubsetForMatrix.hpp"
namespace HappyHeart
{
......@@ -37,7 +39,8 @@ namespace HappyHeart
* \brief Class which encapsulates both the Petsc matrix and the numbering subsets used to described its
* rows and columns.
*/
class GlobalMatrix final : public Wrappers::Petsc::Matrix
class GlobalMatrix final : public Wrappers::Petsc::Matrix,
public Crtp::NumberingSubsetForMatrix<GlobalMatrix>
{
public:
......@@ -49,7 +52,11 @@ namespace HappyHeart
using vector_unique_ptr = std::vector<unique_ptr>;
//! Alias to parent.
using Parent = Wrappers::Petsc::Matrix;
using PetscParent = Wrappers::Petsc::Matrix;
//! Alias to other parent.
using NumberingSubsetParent = Crtp::NumberingSubsetForMatrix<GlobalMatrix>;
public:
......@@ -77,25 +84,13 @@ namespace HappyHeart
///@}
//! Numbering subset used to describe rows.
const NumberingSubset& GetRowNumberingSubset() const;
//! Numbering subset used to describe columns.
const NumberingSubset& GetColNumberingSubset() const;
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_;
//! Numbering subset used to describe columns.
const NumberingSubset& col_numbering_subset_;
};
......@@ -112,8 +107,8 @@ namespace HappyHeart
* \brief Declared but do not defined: we do not want to be able to do this but we also want to avoid the
* 'slicing effect' (i.e. attributes of child class ignored entirely).
*/
void Swap(GlobalMatrix& A, GlobalMatrix::Parent& B);
void Swap(GlobalMatrix::Parent& A, GlobalMatrix& B);
void Swap(GlobalMatrix& A, GlobalMatrix::PetscParent& B);
void Swap(GlobalMatrix::PetscParent& A, GlobalMatrix& B);
......
......@@ -14,16 +14,7 @@ namespace HappyHeart
{
inline const NumberingSubset& GlobalMatrix::GetRowNumberingSubset() const
{
return row_numbering_subset_;
}
inline const NumberingSubset& GlobalMatrix::GetColNumberingSubset() const
{
return col_numbering_subset_;
}
} // namespace HappyHeart
......
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__NumberingSubset__HPP
# define __HappyHeart__NumberingSubset__HPP
#ifndef _HAPPY_HEART__CORE__PRIVATE__NUMBERING_SUBSET_HPP_
# define _HAPPY_HEART__CORE__PRIVATE__NUMBERING_SUBSET_HPP_
# include <memory>
# include <vector>
......@@ -112,4 +112,4 @@ namespace HappyHeart
# include "Core/Private/NumberingSubset.hxx"
#endif /* defined(__HappyHeart__NumberingSubset__HPP) */
#endif // _HAPPY_HEART__CORE__PRIVATE__NUMBERING_SUBSET_HPP_
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__NumberingSubset__HXX
# define __HappyHeart__NumberingSubset__HXX
#ifndef _HAPPY_HEART__CORE__PRIVATE__NUMBERING_SUBSET_HXX_
# define _HAPPY_HEART__CORE__PRIVATE__NUMBERING_SUBSET_HXX_
namespace HappyHeart
......@@ -84,4 +84,4 @@ namespace HappyHeart
} // namespace HappyHeart
#endif /* defined(__HappyHeart__NumberingSubset__HXX) */
#endif // _HAPPY_HEART__CORE__PRIVATE__NUMBERING_SUBSET_HXX_
//
// NumberingSubsetSubMatrix.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 04/05/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__LOCAL_VARIATIONAL_OPERATOR__CRTP__NUMBERING_SUBSET_SUB_MATRIX_HPP_
# define _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__LOCAL_VARIATIONAL_OPERATOR__CRTP__NUMBERING_SUBSET_SUB_MATRIX_HPP_
# include "Utilities/MatrixOrVector.hpp"
namespace HappyHeart
{
namespace Crtp
{
template<class DerivedT>
class NumberingSubsetSubMatrix
{
public:
/// \name Special members.
///@{
//! Constructor.
explicit NumberingSubsetSubMatrix() = default;
//! Destructor.
~NumberingSubsetSubMatrix() = default;
//! Copy constructor.
NumberingSubsetSubMatrix(const NumberingSubsetSubMatrix&) = default;
//! Move constructor.
NumberingSubsetSubMatrix(NumberingSubsetSubMatrix&&) = default;
//! Copy affectation.
NumberingSubsetSubMatrix& operator=(const NumberingSubsetSubMatrix&) = default;
//! Move affectation.
NumberingSubsetSubMatrix& operator=(NumberingSubsetSubMatrix&&) = default;
///@}
private:
//!
LocalMatrix sub_matrix_;
};
} //namespace Crtp
} // namespace HappyHeart
# include "FiniteElement/Operators/LocalVariationalOperator/Crtp/NumberingSubsetSubMatrix.hxx"
#endif // _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__LOCAL_VARIATIONAL_OPERATOR__CRTP__NUMBERING_SUBSET_SUB_MATRIX_HPP_
//
// NumberingSubsetSubMatrix.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 04/05/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__LOCAL_VARIATIONAL_OPERATOR__CRTP__NUMBERING_SUBSET_SUB_MATRIX_HXX_
# define _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__LOCAL_VARIATIONAL_OPERATOR__CRTP__NUMBERING_SUBSET_SUB_MATRIX_HXX_
namespace HappyHeart
{
namespace Crtp
{
} //namespace Crtp
} // namespace HappyHeart
#endif // _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__LOCAL_VARIATIONAL_OPERATOR__CRTP__NUMBERING_SUBSET_SUB_MATRIX_HXX_
//
// SubMatrixForNumberingSubsetPair.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 04/05/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#include "FiniteElement/Operators/LocalVariationalOperator/Crtp/Private/SubMatrixForNumberingSubsetPair.hpp"