Commit 1333fcc7 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#527 Same process for GlobalMatrix.

parent 3866a1a3
......@@ -13,6 +13,21 @@ namespace HappyHeart
{
GlobalMatrix::GlobalMatrix(const GlobalMatrix& rhs)
: Parent(rhs)
{ }
void Swap(GlobalMatrix& A, GlobalMatrix& B)
{
// \todo #527 Add assert about numbering subset!
using Parent = GlobalMatrix::Parent;
Swap(static_cast<Parent&>(A), static_cast<Parent&>(B));
}
} // namespace HappyHeart
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__GlobalMatrix__HPP
# define __HappyHeart__GlobalMatrix__HPP
#ifndef _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_MATRIX_HPP_
# define _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_MATRIX_HPP_
# include <memory>
# include <vector>
......@@ -18,15 +18,74 @@
namespace HappyHeart
{
class GlobalMatrix : public Wrappers::Petsc::Matrix
{
public:
//! Alias to unique pointer.
using unique_ptr = std::unique_ptr<GlobalMatrix>;
struct GlobalMatrix : public Wrappers::Petsc::Matrix
{
//! Alias to vector of unique pointers.
using vector_unique_ptr = std::vector<unique_ptr>;
//! Alias to parent.
using Parent = Wrappers::Petsc::Matrix;
public:
/// \name Special members.
///@{
//! Constructor.
explicit GlobalMatrix() = default;
//! Destructor.
~GlobalMatrix() = default;
//! Copy constructor.
GlobalMatrix(const GlobalMatrix&);
//! Move constructor.
GlobalMatrix(GlobalMatrix&&) = default;
//! Copy affectation.
GlobalMatrix& operator=(const GlobalMatrix&) = default;
//! Move affectation.
GlobalMatrix& operator=(GlobalMatrix&&) = default;
///@}
private:
};
/*!
* \brief Swap two matrices.
*
* The Petsc content of the matrices is swapped; however the numbering subsets must be the same on both ends
* (we expect here to swap only matrices with same structure).
*/
void Swap(GlobalMatrix& A, GlobalMatrix& B);
/*!
* \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);
/*!
* \brief Useful typedef to avoid cluttering the main programs with too low-level C++.
*
......@@ -47,51 +106,7 @@ namespace HappyHeart
*/
using GlobalMatrixWithCoefficient = std::pair<GlobalMatrix&, double>;
// class GlobalMatrix
// {
//
// public:
//
// //! Alias to unique pointer.
// using unique_ptr = std::unique_ptr<GlobalMatrix>;
//
// //! Alias to vector of unique pointers.
// using vector_unique_ptr = std::vector<unique_ptr>;
//
// public:
//
// /// \name Special members.
// ///@{
//
// //! Constructor.
// explicit GlobalMatrix() = default;
//
// //! Destructor.
// ~GlobalMatrix() = default;
//
// //! Copy constructor.
// GlobalMatrix(const GlobalMatrix&) = default;
//
// //! Move constructor.
// GlobalMatrix(GlobalMatrix&&) = default;
//
// //! Copy affectation.
// GlobalMatrix& operator=(const GlobalMatrix&) = default;
//
// //! Move affectation.
// GlobalMatrix& operator=(GlobalMatrix&&) = default;
//
// ///@}
//
// private:
//
//
//
// };
} // namespace HappyHeart
......@@ -100,4 +115,4 @@ namespace HappyHeart
# include "Core/LinearAlgebra/GlobalMatrix.hxx"
#endif /* defined(__HappyHeart__GlobalMatrix__HPP) */
#endif // _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_MATRIX_HPP_
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__GlobalMatrix__HXX
#define __HappyHeart__GlobalMatrix__HXX
#ifndef _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_MATRIX_HXX_
# define _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_MATRIX_HXX_
namespace HappyHeart
......@@ -20,4 +20,4 @@ namespace HappyHeart
} // namespace HappyHeart
#endif /* defined(__HappyHeart__GlobalMatrix__HXX) */
#endif // _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_MATRIX_HXX_
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__GlobalVector__HPP
# define __HappyHeart__GlobalVector__HPP
#ifndef _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_VECTOR_HPP_
# define _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_VECTOR_HPP_
# include <memory>
# include <vector>
......@@ -75,8 +75,8 @@ namespace HappyHeart
/*!
* \brief Declare but do not define: we do not want to be able to do this but we also want to avoid the
* 'slicing effect' (attributes of child class ignored entirely).
* \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(GlobalVector& A, GlobalVector::Parent& B);
void Swap(GlobalVector::Parent& A, GlobalVector& B);
......@@ -110,4 +110,4 @@ namespace HappyHeart
# include "Core/LinearAlgebra/GlobalVector.hxx"
#endif /* defined(__HappyHeart__GlobalVector__HPP) */
#endif // _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_VECTOR_HPP_
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__GlobalVector__HXX
#define __HappyHeart__GlobalVector__HXX
#ifndef _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_VECTOR_HXX_
# define _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_VECTOR_HXX_
namespace HappyHeart
......@@ -20,4 +20,4 @@ namespace HappyHeart
} // namespace HappyHeart
#endif /* defined(__HappyHeart__GlobalVector__HXX) */
#endif // _HAPPY_HEART__CORE__LINEAR_ALGEBRA__GLOBAL_VECTOR_HXX_
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