Skip to content

Commit

Permalink
Reformatted the code of GeoMechanicsApplication using Clang-Format (#…
Browse files Browse the repository at this point in the history
…12728)

Reformatted the code of GeoMechanicsApplication using Clang-Format 17.0.5. This commit concludes a series of commits which aimed at having a consistent format for C++ code applied to the entire code base of GeoMechanicsApplication.
  • Loading branch information
avdg81 authored Oct 7, 2024
1 parent 3bee8b4 commit 7bccabd
Show file tree
Hide file tree
Showing 80 changed files with 1,223 additions and 1,286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ f051af1a6a180c67b27c0deb29062999629ededc
8776deb6c34974b51c2cf2c53d347bf55ec583d6
57b174d2b9da0ac60e846c505665c2dcb2dad370
597907cd537d4c520caa768e069fb02f812f8360
c56daf06cf952115e17bfde5a104d88e4650e7ec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Condition::Pointer UPwLysmerAbsorbingCondition<TDim, TNumNodes>::Create(IndexTyp

template <unsigned int TDim, unsigned int TNumNodes>
void UPwLysmerAbsorbingCondition<TDim, TNumNodes>::CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix,
const ProcessInfo& rCurrentProcessInfo)
const ProcessInfo& rCurrentProcessInfo)
{
ElementMatrixType stiffness_matrix;

Expand All @@ -41,7 +41,6 @@ void UPwLysmerAbsorbingCondition<TDim, TNumNodes>::CalculateLeftHandSide(MatrixT
this->AddLHS(rLeftHandSideMatrix, stiffness_matrix);
}


template <unsigned int TDim, unsigned int TNumNodes>
void UPwLysmerAbsorbingCondition<TDim, TNumNodes>::CalculateLocalSystem(MatrixType& rLhsMatrix,
VectorType& rRightHandSideVector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwLysmerAbsorbingCondition
void CalculateRightHandSide(VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;

/**
* @brief Calculates LHS stiffness part of absorbing boundary
* @param rLeftHandSideMatrix Global left hand side matrix
* @param rCurrentProcessInfo Current process information
*/
void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix,
const ProcessInfo& rCurrentProcessInfo) override;
* @brief Calculates LHS stiffness part of absorbing boundary
* @param rLeftHandSideMatrix Global left hand side matrix
* @param rCurrentProcessInfo Current process information
*/
void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix, const ProcessInfo& rCurrentProcessInfo) override;

/**
* @brief Calculates LHS Damping part of absorbing boundary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ void GeoLinearElasticLaw::CalculateMaterialResponsePK2(ConstitutiveLaw::Paramete
<< "The GeoLinearElasticLaw needs an element provided strain" << std::endl;

KRATOS_ERROR_IF(!rValues.IsSetStrainVector() || rValues.GetStrainVector().size() != GetStrainSize())
<< "Constitutive laws in the geomechanics application need a valid provided strain"
<< std::endl;
<< "Constitutive laws in the geomechanics application need a valid provided strain" << std::endl;

if (r_options.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR)) {
CalculateElasticMatrix(rValues.GetConstitutiveMatrix(), rValues);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,7 @@ void SmallStrainUDSM3DLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::Para
<< "The GeoLinearElasticLaw needs an element provided strain" << std::endl;

KRATOS_ERROR_IF(!rValues.IsSetStrainVector() || rValues.GetStrainVector().size() != GetStrainSize())
<< "Constitutive laws in the geomechanics application need a valid provided strain"
<< std::endl;
<< "Constitutive laws in the geomechanics application need a valid provided strain" << std::endl;

if (rOptions.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR)) {
// Constitutive matrix (D matrix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void SmallStrainUMAT3DLaw::CalculateMaterialResponseCauchy(ConstitutiveLaw::Para
const Flags& rOptions = rValues.GetOptions();

KRATOS_DEBUG_ERROR_IF(rOptions.IsNot(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN))
<< "The GeoLinearElasticLaw needs an element provided strain" << std::endl;
<< "The GeoLinearElasticLaw needs an element provided strain" << std::endl;

KRATOS_ERROR_IF(!rValues.IsSetStrainVector() || rValues.GetStrainVector().size() != GetStrainSize())
<< "Constitutive laws in the geomechanics application need a valid provided strain" << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Kratos::BoundedMatrix<double, 8, 8> GetExtrapolationMatrixFor3D8NElement()
return result;
}

}
} // namespace

namespace Kratos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "custom_elements/U_Pw_small_strain_interface_element.hpp"
#include "custom_utilities/constitutive_law_utilities.hpp"
#include "custom_utilities/transport_equation_utilities.hpp"
#include <custom_utilities/stress_strain_utilities.h>
#include "includes/cfd_variables.h"
#include <custom_utilities/stress_strain_utilities.h>

namespace Kratos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) UPwSmallStrainInterfaceElement : pub
void CalculateOnIntegrationPoints(const Variable<array_1d<double, 3>>& rVariable,
std::vector<array_1d<double, 3>>& rValues,
const ProcessInfo& rCurrentProcessInfo) override;

using UPwBaseElement::CalculateOnIntegrationPoints;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoTrussElement : public GeoTrussEle
Vector mInternalStressesFinalizedPrevious = ZeroVector(mStressVectorSize);

public:
using BaseType = GeoTrussElementBase<TDim, TNumNodes>;
using GeometryType = Element::GeometryType;
using NodesArrayType = Element::NodesArrayType;
using PropertiesType = Element::PropertiesType;
using IndexType = Element::IndexType;
using SizeType = Element::SizeType;
using MatrixType = Element::MatrixType;
using VectorType = Element::VectorType;
using BaseType = GeoTrussElementBase<TDim, TNumNodes>;
using GeometryType = Element::GeometryType;
using NodesArrayType = Element::NodesArrayType;
using PropertiesType = Element::PropertiesType;
using IndexType = Element::IndexType;
using SizeType = Element::SizeType;
using MatrixType = Element::MatrixType;
using VectorType = Element::VectorType;

using GeoTrussElementBase<TDim, TNumNodes>::mpConstitutiveLaw;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@
namespace Kratos
{

ActivateModelPartOperation::ActivateModelPartOperation(
Model& rModel,
const Parameters rSettings)
: Operation()
, mpModelPart(&rModel.GetModelPart(rSettings["model_part_name"].GetString()))
{}

Operation::Pointer ActivateModelPartOperation::Create(
Model &rModel,
Parameters Parameters) const
ActivateModelPartOperation::ActivateModelPartOperation(Model& rModel, const Parameters rSettings)
: Operation(), mpModelPart(&rModel.GetModelPart(rSettings["model_part_name"].GetString()))
{
}

Operation::Pointer ActivateModelPartOperation::Create(Model& rModel, Parameters Parameters) const
{
return Kratos::make_shared<ActivateModelPartOperation>(rModel, Parameters);
}
Expand All @@ -57,4 +53,4 @@ void ActivateModelPartOperation::Execute()
KRATOS_CATCH("")
}

}
} // namespace Kratos
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) ActivateModelPartOperation : public
/// @brief Model-parameters constructor.
/// @param rModel Reference to the model container
/// @param rSettings Input settings
ActivateModelPartOperation(
Model& rModel,
const Parameters rSettings);
ActivateModelPartOperation(Model& rModel, const Parameters rSettings);

/// Destructor
~ActivateModelPartOperation() override = default;
Expand All @@ -82,9 +80,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) ActivateModelPartOperation : public
///@name Operations
///@{

Operation::Pointer Create(
Model& rModel,
Parameters ThisParameters) const override;
Operation::Pointer Create(Model& rModel, Parameters ThisParameters) const override;

void Execute() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@
namespace Kratos
{

DeactivateModelPartOperation::DeactivateModelPartOperation(
Model& rModel,
const Parameters rSettings)
: Operation()
, mpModelPart(&rModel.GetModelPart(rSettings["model_part_name"].GetString()))
{}
DeactivateModelPartOperation::DeactivateModelPartOperation(Model& rModel, const Parameters rSettings)
: Operation(), mpModelPart(&rModel.GetModelPart(rSettings["model_part_name"].GetString()))
{
}

Operation::Pointer DeactivateModelPartOperation::Create(
Model &rModel,
Parameters Parameters) const
Operation::Pointer DeactivateModelPartOperation::Create(Model& rModel, Parameters Parameters) const
{
return Kratos::make_shared<DeactivateModelPartOperation>(rModel, Parameters);
}
Expand All @@ -49,9 +45,8 @@ void DeactivateModelPartOperation::Execute()
VariableUtils().SetFlag(ACTIVE, false, mpModelPart->Elements());

// Reset the elements' constitutive law (e.g., excavation)
block_for_each(mpModelPart->Elements(), [](Element &rElement) {
rElement.ResetConstitutiveLaw();
});
block_for_each(mpModelPart->Elements(),
[](Element& rElement) { rElement.ResetConstitutiveLaw(); });

// Deactivate the nodes of the model part
VariableUtils().SetFlag(ACTIVE, false, mpModelPart->Nodes());
Expand All @@ -62,4 +57,4 @@ void DeactivateModelPartOperation::Execute()
KRATOS_CATCH("")
}

}
} // namespace Kratos
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) DeactivateModelPartOperation : publi
/// @brief Model-parameters constructor.
/// @param rModel Reference to the model container
/// @param rSettings Input settings
DeactivateModelPartOperation(
Model& rModel,
const Parameters rSettings);
DeactivateModelPartOperation(Model& rModel, const Parameters rSettings);

/// Destructor
~DeactivateModelPartOperation() override = default;
Expand All @@ -82,9 +80,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) DeactivateModelPartOperation : publi
///@name Operations
///@{

Operation::Pointer Create(
Model& rModel,
Parameters ThisParameters) const override;
Operation::Pointer Create(Model& rModel, Parameters ThisParameters) const override;

void Execute() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

// Project includes
#include "custom_processes/apply_c_phi_reduction_process.h"
#include "utilities/math_utils.h"
#include "includes/model_part.h"
#include "utilities/math_utils.h"

namespace Kratos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

#include "includes/kratos_flags.h"
#include "includes/kratos_parameters.h"
#include "includes/model_part.h"
#include "includes/table.h"
#include "processes/process.h"
#include "includes/model_part.h"

#include "geo_mechanics_application_variables.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class NewmarkQuasistaticUPwScheme : public GeneralizedNewmarkScheme<TSparseSpace
{
}


protected:
inline void UpdateVariablesDerivatives(ModelPart& rModelPart) override
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include "includes/ublas_interface.h"

#include <algorithm>
#include <vector>
#include <cstdlib>
#include <vector>

namespace Kratos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ std::unique_ptr<IntegrationScheme> MakeLobattoIntegrationScheme(std::size_t Numb
return std::make_unique<LobattoIntegrationScheme>(NumberOfPoints);
}

std::vector<std::size_t> SupportedNumbersOfPointsForLobattoIntegration()
{
return {2, 3};
}
std::vector<std::size_t> SupportedNumbersOfPointsForLobattoIntegration() { return {2, 3}; }

double SumOfWeights(const Geo::IntegrationPointVectorType& rIntegrationPoints)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ using namespace Kratos;
class StubConstitutiveLaw : public ConstitutiveLaw
{
public:
SizeType GetStrainSize() const override
{
return 4;
}
SizeType GetStrainSize() const override { return 4; }
};

class StubElement : public Element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

namespace flow_stubs
{
void emptyProgress(double progress) {}
void emptyLog(const char* log) {}
bool emptyCancel() {
return false;
}
}
void emptyProgress(double progress) {}

void emptyLog(const char* log) {}

bool emptyCancel() { return false; }
} // namespace flow_stubs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace flow_stubs
{
void emptyProgress(double progress);
void emptyLog(const char* log);
bool emptyCancel();
}
void emptyProgress(double progress);
void emptyLog(const char* log);
bool emptyCancel();
} // namespace flow_stubs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ KratosGeoMechanicsFastSuite::KratosGeoMechanicsFastSuite() : KratosCoreFastSuite
this->ImportApplicationIntoKernel(mpLinearSolversApp);
}

KratosGeoMechanicsFastSuiteWithoutKernel::KratosGeoMechanicsFastSuiteWithoutKernel() : KratosCoreFastSuiteWithoutKernel()
KratosGeoMechanicsFastSuiteWithoutKernel::KratosGeoMechanicsFastSuiteWithoutKernel()
: KratosCoreFastSuiteWithoutKernel()
{
// clang-format off
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(DISPLACEMENT)
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(VELOCITY)
KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ACCELERATION)
Expand All @@ -41,9 +43,11 @@ KratosGeoMechanicsFastSuiteWithoutKernel::KratosGeoMechanicsFastSuiteWithoutKern

KRATOS_REGISTER_VARIABLE(CAUCHY_STRESS_VECTOR)
KRATOS_REGISTER_VARIABLE(CAUCHY_STRESS_TENSOR)
// clang-format on
}

KratosGeoMechanicsIntegrationSuite::KratosGeoMechanicsIntegrationSuite() : KratosCoreFastSuite()
KratosGeoMechanicsIntegrationSuite::KratosGeoMechanicsIntegrationSuite()
: KratosCoreFastSuite()
{
mpGeoApp = std::make_shared<KratosGeoMechanicsApplication>();
this->ImportApplicationIntoKernel(mpGeoApp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class KratosGeoMechanicsFastSuite : public KratosCoreFastSuite
KratosGeoMechanicsFastSuite();

private:
std::shared_ptr<KratosGeoMechanicsApplication> mpGeoApp;
std::shared_ptr<KratosLinearSolversApplication> mpLinearSolversApp;
std::shared_ptr<KratosGeoMechanicsApplication> mpGeoApp;
std::shared_ptr<KratosLinearSolversApplication> mpLinearSolversApp;
};

class KratosGeoMechanicsFastSuiteWithoutKernel : public KratosCoreFastSuiteWithoutKernel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
// Main authors: Richard Faasse
//


#include "stub_input_utility.h"

namespace Kratos {
namespace Kratos
{

StubInputUtility::StubInputUtility(const std::string& rParameterJsonString) :
mParameterJsonString{rParameterJsonString}
StubInputUtility::StubInputUtility(const std::string& rParameterJsonString)
: mParameterJsonString{rParameterJsonString}
{
}

Expand All @@ -35,12 +35,8 @@ void StubInputUtility::AddMaterialsFromFile(const std::filesystem::path& rMateri
++mNumberOfMaterialCalls;
}

int StubInputUtility::NumberOfReadCalls() const {
return mNumberOfReadCalls;
}
int StubInputUtility::NumberOfReadCalls() const { return mNumberOfReadCalls; }

int StubInputUtility::NumberOfMaterialCalls() const {
return mNumberOfMaterialCalls;
}
int StubInputUtility::NumberOfMaterialCalls() const { return mNumberOfMaterialCalls; }

} // Kratos
} // namespace Kratos
Loading

0 comments on commit 7bccabd

Please sign in to comment.