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

#370 - #528 Give classes the canonical members; add final keyword when relevant.

parent 811730ff
......@@ -22,19 +22,18 @@ namespace HappyHeart
GlobalMatrix::GlobalMatrix(const GlobalMatrix& rhs)
: Petscparent(rhs),
NumberingSubsetparent(rhs)
: petsc_parent(rhs),
numbering_subset_parent(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::Petscparent;
using parent = GlobalMatrix::petsc_parent;
Swap(static_cast<parent&>(A), static_cast<parent&>(B));
}
......
......@@ -52,10 +52,10 @@ namespace HappyHeart
using vector_unique_ptr = std::vector<unique_ptr>;
//! Alias to parent.
using Petscparent = Wrappers::Petsc::Matrix;
using petsc_parent = Wrappers::Petsc::Matrix;
//! Alias to other parent.
using NumberingSubsetparent = Crtp::NumberingSubsetForMatrix<GlobalMatrix>;
using numbering_subset_parent = Crtp::NumberingSubsetForMatrix<GlobalMatrix>;
public:
......@@ -74,13 +74,13 @@ namespace HappyHeart
GlobalMatrix(const GlobalMatrix&);
//! Move constructor.
GlobalMatrix(GlobalMatrix&&) = default;
GlobalMatrix(GlobalMatrix&&) = delete;
//! Copy affectation.
GlobalMatrix& operator=(const GlobalMatrix&) = default;
GlobalMatrix& operator=(const GlobalMatrix&) = delete;
//! Move affectation.
GlobalMatrix& operator=(GlobalMatrix&&) = default;
GlobalMatrix& operator=(GlobalMatrix&&) = delete;
///@}
......@@ -107,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::Petscparent& B);
void Swap(GlobalMatrix::Petscparent& A, GlobalMatrix& B);
void Swap(GlobalMatrix& A, GlobalMatrix::petsc_parent& B);
void Swap(GlobalMatrix::petsc_parent& A, GlobalMatrix& B);
......
......@@ -21,7 +21,7 @@ namespace HappyHeart
NumberingSubset::NumberingSubset(unsigned int id)
: UniqueIdparent(id)
: unique_id_parent(id)
{ }
......
......@@ -21,15 +21,24 @@ namespace HappyHeart
{
// ============================
// Forward declarations.
// ============================
namespace Private
{
// Forward declaration.
class NumberingSubsetManager;
} // namespace Private
// ============================
// End of forward declarations.
// ============================
/*!
......@@ -49,7 +58,7 @@ namespace HappyHeart
using vector_const_shared_ptr = std::vector<const_shared_ptr>;
//! Alias for the parent.
using UniqueIdparent = Crtp::UniqueId<NumberingSubset, UniqueIdNS::AssignationMode::manual>;
using unique_id_parent = Crtp::UniqueId<NumberingSubset, UniqueIdNS::AssignationMode::manual>;
//! Friendship!
friend class Private::NumberingSubsetManager;
......
......@@ -20,12 +20,35 @@ namespace HappyHeart
class TransientParameters
{
public:
//! Convenient alias.
using self = TransientParameters;
//! Alias to unique_ptr.
using unique_ptr = std::unique_ptr<TransientParameters>;
///! \name Special members.
///@{
//! Default constructor. Initialize() must be called afterward!
explicit TransientParameters();
//! Destructor.
~TransientParameters() = default;
//! Copy constructor.
TransientParameters(const self&) = delete;
//! Move constructor.
TransientParameters(self&&) = delete;
//! Copy affectation.
self& operator=(const self&) = delete;
//! Move affectation.
self& operator=(self&&) = delete;
///@}
template<class InputParameterDataT>
void Initialize(const InputParameterDataT& input_parameter_data);
......
......@@ -32,6 +32,22 @@ namespace HappyHeart
//! Constructor.
explicit ComponentManager(const std::string& name, std::bitset<3> is_activated);
//! Destructor
~ComponentManager() = default;
//! Copy constructor.
ComponentManager(const ComponentManager&) = delete;
//! Move constructor.
ComponentManager(ComponentManager&&) = delete;
//! Copy affectation.
ComponentManager& operator=(const ComponentManager&) = delete;
//! Move affectation.
ComponentManager& operator=(ComponentManager&&) = delete;
//! Returns the name of the component.
const std::string& Name() const;
......
......@@ -25,7 +25,7 @@ namespace HappyHeart
* This class is still relatively close to its counterpart in Felisce; a move heavy refactoring is not excluded at all.
*
*/
class DirichletBoundaryCondition
class DirichletBoundaryCondition final
{
public:
......
......@@ -38,7 +38,21 @@ namespace HappyHeart
//! Constructor.
explicit TComponentManager();
//! Destructor
~TComponentManager() = default;
//! Copy constructor.
TComponentManager(const TComponentManager&) = delete;
//! Move constructor.
TComponentManager(TComponentManager&&) = delete;
//! Copy affectation.
TComponentManager& operator=(const TComponentManager&) = delete;
//! Move affectation.
TComponentManager& operator=(TComponentManager&&) = delete;
};
......
......@@ -25,7 +25,7 @@ namespace HappyHeart
{
class FiniteElt
class FiniteElt final
{
public:
......
......@@ -46,7 +46,7 @@ namespace HappyHeart
const unsigned int unique_id,
UnknownAndNumberingSubset::vector_const_shared_ptr&& unknown_list)
: Crtp::HappyHeartMpi<FEltSpace>(god_of_dof_ptr->MpiHappyHeart()),
UniqueIdparent(unique_id),
unique_id_parent(unique_id),
finite_elt_storage_(nullptr),
dimension_(ExtractDimensionFromDomain(domain)),
god_of_dof_(god_of_dof_ptr),
......
......@@ -35,7 +35,11 @@ namespace HappyHeart
{
// Forward declaration.
// ============================
// Forward declarations.
// ============================
class GeometricMeshRegion;
class Domain;
class GodOfDof;
......@@ -49,6 +53,11 @@ namespace HappyHeart
} // namespace Private
// ============================
// End of forward declarations.
// ============================
/*!
......@@ -74,7 +83,7 @@ namespace HappyHeart
using vector_unique_ptr = std::vector<unique_ptr>;
//! Convenient alias to one of the parent.
using UniqueIdparent = Crtp::UniqueId<FEltSpace, UniqueIdNS::AssignationMode::manual>;
using unique_id_parent = Crtp::UniqueId<FEltSpace, UniqueIdNS::AssignationMode::manual>;
/*!
* Friendship to a private class, which needs to use GetNonCstFiniteEltStorage().
......
......@@ -33,9 +33,9 @@ namespace HappyHeart
class GodOfDofManager;
class GodOfDof : public std::enable_shared_from_this<GodOfDof>,
public Crtp::HappyHeartMpi<GodOfDof>,
public Crtp::UniqueId<GodOfDof, UniqueIdNS::AssignationMode::manual>
class GodOfDof final : public std::enable_shared_from_this<GodOfDof>,
public Crtp::HappyHeartMpi<GodOfDof>,
public Crtp::UniqueId<GodOfDof, UniqueIdNS::AssignationMode::manual>
{
public:
......@@ -47,7 +47,7 @@ namespace HappyHeart
using vector_shared_ptr = std::vector<shared_ptr>;
//! Convenient alias to one of the parent.
using UniqueIdparent = Crtp::UniqueId<GodOfDof, UniqueIdNS::AssignationMode::manual>;
using unique_id_parent = Crtp::UniqueId<GodOfDof, UniqueIdNS::AssignationMode::manual>;
//! Name of the class.
static const std::string& ClassName();
......
......@@ -19,7 +19,7 @@ namespace HappyHeart
const InputParameterDataT& input_parameter_data,
GeometricMeshRegion& mesh)
: Crtp::HappyHeartMpi<GodOfDof>(mpi),
UniqueIdparent(mesh.GetUniqueId()),
unique_id_parent(mesh.GetUniqueId()),
mesh_(mesh)
{
ReadBoundaryConditionList(input_parameter_data);
......
......@@ -37,7 +37,7 @@ namespace HappyHeart
* For instance it is more convenient to get at once the vector to feed Petsc functions rather than building
* it every time by iterating over all boundary condition dofs.
*/
class BoundaryConditionListForNumberingSubset
class BoundaryConditionListForNumberingSubset final
{
public:
......
......@@ -19,10 +19,19 @@ namespace HappyHeart
{
// Forward declaration (the most important line in the whole file here...)
// ============================
// Forward declarations.
// ============================
class GodOfDof;
// ============================
// End of forward declarations.
// ============================
namespace Private
{
......
......@@ -28,9 +28,17 @@
namespace HappyHeart
{
// Forward declaration.
// ============================
// Forward declarations.
// ============================
class DirichletBoundaryCondition;
// ============================
// End of forward declarations.
// ============================
namespace Private
{
......
......@@ -28,10 +28,18 @@ namespace HappyHeart
{
// ============================
// Forward declarations.
// ============================
class CreateNodeListHelper;
// ============================
// End of forward declarations.
// ============================
......
......@@ -21,7 +21,11 @@
namespace HappyHeart
{
// Forward declaration.
// ============================
// Forward declarations.
// ============================
class Domain;
......@@ -33,6 +37,18 @@ namespace HappyHeart
struct ReduceToProcessorWise;
} // namespace Private
// ============================
// End of forward declarations.
// ============================
namespace Private
{
namespace FEltSpaceNS
{
......
......@@ -26,8 +26,17 @@
namespace HappyHeart
{
// Forward declaration.
// ============================
// Forward declarations.
// ============================
class LocalFEltSpace;
// ============================
// End of forward declarations.
// ============================
namespace Private
......@@ -46,6 +55,22 @@ namespace HappyHeart
//! Constructor.
AttributeProcessorHelper(unsigned int Nprocessor);
//! Destructor.
~AttributeProcessorHelper() = default;
//! Copy constructor.
AttributeProcessorHelper(const AttributeProcessorHelper&) = delete;
//! Move constructor.
AttributeProcessorHelper(AttributeProcessorHelper&&) = delete;
//! Copy affectation.
AttributeProcessorHelper& operator=(const AttributeProcessorHelper&) = delete;
//! Move affectation.
AttributeProcessorHelper& operator=(AttributeProcessorHelper&&) = delete;
/*!
* \brief Determine which processor takes the current finite element group.
*
......
......@@ -54,7 +54,7 @@ namespace HappyHeart
* in the Private namespace.
*
*/
struct ComputeDofIndexesHelper
struct ComputeDofIndexesHelper final
{
......
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