Skip to content

Commit

Permalink
[GeoMechanicsApplication] Fix constructor destructor code smells in c…
Browse files Browse the repository at this point in the history
…ustom elements (#12249)
  • Loading branch information
rfaasse authored Apr 5, 2024
1 parent 6370d5d commit 7bf35ed
Show file tree
Hide file tree
Showing 27 changed files with 46 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwSmallStrainFICElement

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/// Default Constructor
UPwSmallStrainFICElement(IndexType NewId = 0) : UPwSmallStrainElement<TDim, TNumNodes>(NewId) {}
explicit UPwSmallStrainFICElement(IndexType NewId = 0)
: UPwSmallStrainElement<TDim, TNumNodes>(NewId)
{
}

/// Constructor using an array of nodes
UPwSmallStrainFICElement(IndexType NewId, const NodesArrayType& ThisNodes, std::unique_ptr<StressStatePolicy> pStressStatePolicy)
Expand All @@ -78,8 +80,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwSmallStrainFICElement
{
}

/// Destructor
~UPwSmallStrainFICElement() override {}
~UPwSmallStrainFICElement() = default;

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwSmallStrainInterfaceElement
using UPwBaseElement<TDim, TNumNodes>::CalculateDerivativesOnInitialConfiguration;
using UPwBaseElement<TDim, TNumNodes>::mThisIntegrationMethod;

/// Default Constructor
UPwSmallStrainInterfaceElement(IndexType NewId = 0) : UPwBaseElement<TDim, TNumNodes>(NewId) {}
explicit UPwSmallStrainInterfaceElement(IndexType NewId = 0)
: UPwBaseElement<TDim, TNumNodes>(NewId)
{
}

/// Constructor using an array of nodes
UPwSmallStrainInterfaceElement(IndexType NewId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwSmallStrainLinkInterfaceElement
{
}

// Destructor
~UPwSmallStrainLinkInterfaceElement() override {}
~UPwSmallStrainLinkInterfaceElement() = default;

//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwUpdatedLagrangianFICElement
{
}

/// Destructor
~UPwUpdatedLagrangianFICElement() override {}
~UPwUpdatedLagrangianFICElement() = default;

/**
* @brief Creates a new element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwUpdatedLagrangianElement
{
}

/// Destructor
~UPwUpdatedLagrangianElement() override {}
~UPwUpdatedLagrangianElement() = default;

int Check(const ProcessInfo& rCurrentProcessInfo) const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) DrainedUPwSmallStrainElement

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/// Default Constructor
DrainedUPwSmallStrainElement(IndexType NewId = 0)
explicit DrainedUPwSmallStrainElement(IndexType NewId = 0)
: UPwSmallStrainElement<TDim, TNumNodes>(NewId)
{
}
Expand Down Expand Up @@ -81,8 +80,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) DrainedUPwSmallStrainElement
{
}

/// Destructor
~DrainedUPwSmallStrainElement() override {}
~DrainedUPwSmallStrainElement() = default;

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Element::Pointer Create(IndexType NewId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoCableElement : public GeoTrussEle
using GeoTrussElement<TDim, TNumNodes>::mInternalStressesFinalizedPrevious;
using GeoTrussElement<TDim, TNumNodes>::mInternalStresses;

GeoCableElement(){};
GeoCableElement() = default;
GeoCableElement(IndexType NewId, GeometryType::Pointer pGeometry);
GeoCableElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ Element::Pointer GeoCrBeamElement2D2N::Create(IndexType NewId,
return Kratos::make_intrusive<GeoCrBeamElement2D2N>(NewId, pGeom, pProperties);
}

//----------------------------------------------------------------------------------------------------
GeoCrBeamElement2D2N::~GeoCrBeamElement2D2N() {}

//----------------------------------------------------------------------------------------------------
void GeoCrBeamElement2D2N::InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoCrBeamElement2D2N : public CrBeam
using EquationIdVectorType = BaseType::EquationIdVectorType;
using DofsVectorType = BaseType::DofsVectorType;

GeoCrBeamElement2D2N(){};
GeoCrBeamElement2D2N() = default;
GeoCrBeamElement2D2N(IndexType NewId, GeometryType::Pointer pGeometry);
GeoCrBeamElement2D2N(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

~GeoCrBeamElement2D2N() override;
~GeoCrBeamElement2D2N() = default;

/**
* @brief Creates a new element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ Element::Pointer GeoCrBeamElement3D2N::Create(IndexType NewId,
return Kratos::make_intrusive<GeoCrBeamElement3D2N>(NewId, pGeom, pProperties);
}

//----------------------------------------------------------------------------------------------------
GeoCrBeamElement3D2N::~GeoCrBeamElement3D2N() {}

//-------------------------------------------------------------------------------------------------
void GeoCrBeamElement3D2N::Initialize(const ProcessInfo& rCurrentProcessInfo)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoCrBeamElement3D2N : public CrBeam
using EquationIdVectorType = BaseType::EquationIdVectorType;
using DofsVectorType = BaseType::DofsVectorType;

GeoCrBeamElement3D2N(){};
GeoCrBeamElement3D2N() = default;
GeoCrBeamElement3D2N(IndexType NewId, GeometryType::Pointer pGeometry);
GeoCrBeamElement3D2N(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

~GeoCrBeamElement3D2N() override;
~GeoCrBeamElement3D2N() = default;

/**
* @brief Creates a new element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ Element::Pointer GeoCrBeamElementLinear2D2N::Create(IndexType NewI
return Kratos::make_intrusive<GeoCrBeamElementLinear2D2N>(NewId, pGeom, pProperties);
}

//-------------------------------------------------------------------------------------------------
GeoCrBeamElementLinear2D2N::~GeoCrBeamElementLinear2D2N() {}

//----------------------------------------------------------------------------------------
void GeoCrBeamElementLinear2D2N::ResetConstitutiveLaw()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoCrBeamElementLinear2D2N : public
NodesArrayType const& ThisNodes,
PropertiesType::Pointer pProperties) const override;

~GeoCrBeamElementLinear2D2N() override;
~GeoCrBeamElementLinear2D2N() = default;

void Initialize(const ProcessInfo& rCurrentProcessInfo) override;

Expand All @@ -97,7 +97,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoCrBeamElementLinear2D2N : public
void ResetConstitutiveLaw() override;

protected:
GeoCrBeamElementLinear2D2N(){};
GeoCrBeamElementLinear2D2N() = default;

Vector mInternalGlobalForcesFinalized = ZeroVector(msElementSize);
Vector mInternalGlobalForcesFinalizedPrevious = ZeroVector(msElementSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "custom_elements/geo_cr_beam_element_linear_3D2N.hpp"
#include "custom_utilities/static_condensation_utility.h"
#include "geo_mechanics_application_variables.h"
#include "geo_mechanics_application_variables.h"
#include "includes/define.h"

namespace Kratos
Expand Down Expand Up @@ -53,9 +52,6 @@ Element::Pointer GeoCrBeamElementLinear3D2N::Create(IndexType NewI
return Kratos::make_intrusive<GeoCrBeamElementLinear3D2N>(NewId, pGeom, pProperties);
}

//-------------------------------------------------------------------------------------------------
GeoCrBeamElementLinear3D2N::~GeoCrBeamElementLinear3D2N() = default;

//----------------------------------------------------------------------------------------
void GeoCrBeamElementLinear3D2N::ResetConstitutiveLaw()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoCrBeamElementLinear3D2N : public
using EquationIdVectorType = BaseType::EquationIdVectorType;
using DofsVectorType = BaseType::DofsVectorType;

GeoCrBeamElementLinear3D2N(){};
GeoCrBeamElementLinear3D2N() = default;
GeoCrBeamElementLinear3D2N(IndexType NewId, GeometryType::Pointer pGeometry);
GeoCrBeamElementLinear3D2N(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

~GeoCrBeamElementLinear3D2N() override;
~GeoCrBeamElementLinear3D2N() = default;

/**
* @brief Creates a new element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoCurvedBeamElement

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/// Default Constructor
GeoCurvedBeamElement(IndexType NewId = 0) : GeoStructuralBaseElement<TDim, TNumNodes>(NewId) {}
explicit GeoCurvedBeamElement(IndexType NewId = 0)
: GeoStructuralBaseElement<TDim, TNumNodes>(NewId)
{
}

/// Constructor using an array of nodes
GeoCurvedBeamElement(IndexType NewId, const NodesArrayType& ThisNodes)
Expand All @@ -85,8 +87,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoCurvedBeamElement
mThisIntegrationMethod = this->GetIntegrationMethod();
}

/// Destructor
virtual ~GeoCurvedBeamElement() {}
~GeoCurvedBeamElement() = default;

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoLinearTrussElement

using GeoTrussElementBase<TDim, TNumNodes>::mpConstitutiveLaw;

GeoLinearTrussElement(){};
GeoLinearTrussElement() = default;
GeoLinearTrussElement(IndexType NewId, GeometryType::Pointer pGeometry);
GeoLinearTrussElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoTrussElementLinearBase

using GeoTrussElementBase<TDim, TNumNodes>::mpConstitutiveLaw;

GeoTrussElementLinearBase(){};
GeoTrussElementLinearBase() = default;
GeoTrussElementLinearBase(IndexType NewId, GeometryType::Pointer pGeometry);
GeoTrussElementLinearBase(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoStructuralBaseElement : public El

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/// Default Constructor
GeoStructuralBaseElement(IndexType NewId = 0) : Element(NewId) {}
explicit GeoStructuralBaseElement(IndexType NewId = 0) : Element(NewId) {}

/// Constructor using an array of nodes
GeoStructuralBaseElement(IndexType NewId, const NodesArrayType& ThisNodes)
Expand All @@ -56,8 +55,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoStructuralBaseElement : public El
mThisIntegrationMethod = this->GetIntegrationMethod();
}

/// Destructor
virtual ~GeoStructuralBaseElement() {}
~GeoStructuralBaseElement() = default;

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoTrussElement : public GeoTrussEle

KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(GeoTrussElement);

GeoTrussElement(){};
GeoTrussElement() = default;
GeoTrussElement(IndexType NewId, GeometryType::Pointer pGeometry);
GeoTrussElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoTrussElementBase : public Element
using FullDofMatrixType = BoundedMatrix<double, TDim * TNumNodes, TDim * TNumNodes>;
using FullDofVectorType = BoundedVector<double, TDim * TNumNodes>;

GeoTrussElementBase(){};
GeoTrussElementBase() = default;
GeoTrussElementBase(IndexType NewId, GeometryType::Pointer pGeometry);
GeoTrussElementBase(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SteadyStatePwElement : public Transi

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/// Default Constructor
SteadyStatePwElement(IndexType NewId = 0) : BaseType(NewId) {}
explicit SteadyStatePwElement(IndexType NewId = 0) : BaseType(NewId) {}

/// Constructor using an array of nodes
SteadyStatePwElement(IndexType NewId, const NodesArrayType& ThisNodes, std::unique_ptr<StressStatePolicy> pStressStatePolicy)
Expand All @@ -78,8 +77,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SteadyStatePwElement : public Transi
{
}

/// Destructor
~SteadyStatePwElement() override {}
~SteadyStatePwElement() = default;

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SteadyStatePwInterfaceElement

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/// Default Constructor
SteadyStatePwInterfaceElement(IndexType NewId = 0)
explicit SteadyStatePwInterfaceElement(IndexType NewId = 0)
: TransientPwInterfaceElement<TDim, TNumNodes>(NewId)
{
}
Expand Down Expand Up @@ -87,8 +86,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SteadyStatePwInterfaceElement
{
}

/// Destructor
~SteadyStatePwInterfaceElement() override {}
~SteadyStatePwInterfaceElement() = default;

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SteadyStatePwPipingElement

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/// Default Constructor
SteadyStatePwPipingElement(IndexType NewId = 0)
explicit SteadyStatePwPipingElement(IndexType NewId = 0)
: SteadyStatePwInterfaceElement<TDim, TNumNodes>(NewId)
{
}
Expand Down Expand Up @@ -87,8 +86,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SteadyStatePwPipingElement
{
}

/// Destructor
~SteadyStatePwPipingElement() override {}
~SteadyStatePwPipingElement() = default;

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) TransientPwElement : public UPwSmall

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

/// Default Constructor
TransientPwElement(IndexType NewId = 0) : BaseType(NewId) {}
explicit TransientPwElement(IndexType NewId = 0) : BaseType(NewId) {}

/// Constructor using an array of nodes
TransientPwElement(IndexType NewId, const NodesArrayType& ThisNodes, std::unique_ptr<StressStatePolicy> pStressStatePolicy)
Expand All @@ -78,8 +77,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) TransientPwElement : public UPwSmall
{
}

/// Destructor
~TransientPwElement() override {}
~TransientPwElement() = default;

///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) TransientPwInterfaceElement
using InterfaceElementVariables = typename BaseType::InterfaceElementVariables;
using SFGradAuxVariables = typename BaseType::SFGradAuxVariables;

/// Default Constructor
TransientPwInterfaceElement(IndexType NewId = 0)
explicit TransientPwInterfaceElement(IndexType NewId = 0)
: UPwSmallStrainInterfaceElement<TDim, TNumNodes>(NewId)
{
}
Expand Down Expand Up @@ -82,7 +81,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) TransientPwInterfaceElement
{
}

~TransientPwInterfaceElement() override = default;
~TransientPwInterfaceElement() = default;
TransientPwInterfaceElement(const TransientPwInterfaceElement&) = delete;
TransientPwInterfaceElement& operator=(const TransientPwInterfaceElement&) = delete;
TransientPwInterfaceElement(TransientPwInterfaceElement&&) = delete;
Expand Down
Loading

0 comments on commit 7bf35ed

Please sign in to comment.