Skip to content

Commit

Permalink
Merge pull request #10250 from KratosMultiphysics/all/performance-unn…
Browse files Browse the repository at this point in the history
…ecessary-value-param

[Performance][Core] Adding missing references
  • Loading branch information
loumalouomega authored Sep 18, 2022
2 parents 04afc57 + 3a4bb71 commit 7397f06
Show file tree
Hide file tree
Showing 47 changed files with 98 additions and 98 deletions.
2 changes: 1 addition & 1 deletion kratos/containers/data_value_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Kratos

void DataValueContainer::Merge(
const DataValueContainer& rOther,
Flags Options)
const Flags Options)
{
const bool overwrite_values = Options.Is(OVERWRITE_OLD_VALUES);

Expand Down
2 changes: 1 addition & 1 deletion kratos/containers/data_value_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class KRATOS_API(KRATOS_CORE) DataValueContainer
mData.clear();
}

void Merge(const DataValueContainer& rOther, Flags Options);
void Merge(const DataValueContainer& rOther, const Flags Options);

///@}
///@name Access
Expand Down
4 changes: 2 additions & 2 deletions kratos/containers/flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ void Flags::load(Serializer& rSerializer)
rSerializer.load("Flags", mFlags);
}

void Flags::Set(Flags ThisFlag)
void Flags::Set(const Flags ThisFlag)
{
mIsDefined |= ThisFlag.mIsDefined;
mFlags = (mFlags & ~ThisFlag.mIsDefined) | (ThisFlag.mIsDefined & ThisFlag.mFlags);
}

void Flags::Set(Flags ThisFlag, bool value)
void Flags::Set(const Flags ThisFlag, bool value)
{
mIsDefined |= ThisFlag.mIsDefined;
mFlags = (mFlags & ~ThisFlag.mIsDefined) | (ThisFlag.mIsDefined * BlockType(value));
Expand Down
8 changes: 4 additions & 4 deletions kratos/containers/flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,17 @@ class KRATOS_API(KRATOS_CORE) Flags
///@name Operations
///@{

void Set(Flags ThisFlag);
void Set(const Flags ThisFlag);

void Set(Flags ThisFlag, bool Value);
void Set(const Flags ThisFlag, bool Value);

void Reset(Flags ThisFlag)
void Reset(const Flags ThisFlag)
{
mIsDefined &= (~ThisFlag.mIsDefined);
mFlags &= (~ThisFlag.mIsDefined); // I want to put to zero the ones are set regardless to their value. Pooyan.
}

void Flip(Flags ThisFlag)
void Flip(const Flags ThisFlag)
{
mIsDefined |= ThisFlag.mIsDefined;
mFlags ^= (ThisFlag.mIsDefined); // I want to flip the ones are set in this flags regardless to their value. Pooyan.
Expand Down
8 changes: 4 additions & 4 deletions kratos/containers/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ void Model::Reset()
mRootModelPartMap.clear();
}

void Model::CreateRootModelPart(const std::string ModelPartName, ModelPart::IndexType NewBufferSize)
void Model::CreateRootModelPart(const std::string& ModelPartName, ModelPart::IndexType NewBufferSize)
{
auto p_var_list = Kratos::make_intrusive<VariablesList>();

ModelPart* p_model_part = new ModelPart(ModelPartName, NewBufferSize, p_var_list, *this );
mRootModelPartMap[ModelPartName] = std::unique_ptr<ModelPart>(p_model_part); // note that i create it separately since Model is friend of ModelPart but unique_ptr is not
}

ModelPart& Model::CreateModelPart( const std::string ModelPartName, ModelPart::IndexType NewBufferSize )
ModelPart& Model::CreateModelPart( const std::string& ModelPartName, ModelPart::IndexType NewBufferSize )
{
KRATOS_TRY

Expand All @@ -77,7 +77,7 @@ ModelPart& Model::CreateModelPart( const std::string ModelPartName, ModelPart::I
KRATOS_CATCH("")
}

void Model::DeleteModelPart( const std::string ModelPartName )
void Model::DeleteModelPart( const std::string& ModelPartName )
{
KRATOS_TRY

Expand All @@ -90,7 +90,7 @@ void Model::DeleteModelPart( const std::string ModelPartName )
KRATOS_CATCH("")
}

void Model::RenameModelPart( const std::string OldName, const std::string NewName )
void Model::RenameModelPart( const std::string& OldName, const std::string& NewName )
{
KRATOS_TRY

Expand Down
8 changes: 4 additions & 4 deletions kratos/containers/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,22 @@ class KRATOS_API(KRATOS_CORE) Model final
* @param ModelPartName The name of the new model part to be created
* @param NewBufferSize The size of the buffer of the new model part created
*/
ModelPart& CreateModelPart( const std::string ModelPartName, IndexType NewBufferSize=1 );
ModelPart& CreateModelPart( const std::string& ModelPartName, IndexType NewBufferSize=1 );

/**
* @brief This method deletes a modelpart with a given name
* @details Raises a warning in case the model part does not exists
* @param ModelPartName The name of the model part to be removed
*/
void DeleteModelPart( const std::string ModelPartName );
void DeleteModelPart( const std::string& ModelPartName );

/**
* @brief This method renames a modelpart with a given name
* @details Raises an error in case the model part does not exists as root model part
* @param OldName The name of the model part to be renamed
* @param NewName The new name for the model part to be renamed
*/
void RenameModelPart( const std::string OldName, const std::string NewName );
void RenameModelPart( const std::string& OldName, const std::string& NewName );

/**
* @brief This method returns a model part given a certain name
Expand Down Expand Up @@ -259,7 +259,7 @@ class KRATOS_API(KRATOS_CORE) Model final
* @param ModelPartName The name of the new model part to be created
* @param NewBufferSize The size of the buffer of the new model part created
*/
void CreateRootModelPart(const std::string ModelPartName, ModelPart::IndexType NewBufferSize);
void CreateRootModelPart(const std::string& ModelPartName, ModelPart::IndexType NewBufferSize);

///@}
///@name Private Access
Expand Down
4 changes: 2 additions & 2 deletions kratos/geometries/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class Geometry
}

/// Standard Constructor with a Name
Geometry(std::string GeometryName)
Geometry(const std::string& GeometryName)
: mId(GenerateId(GeometryName))
, mpGeometryData(&GeometryDataInstance())
{
Expand Down Expand Up @@ -323,7 +323,7 @@ class Geometry
}

Geometry(
std::string GeometryName,
const std::string& GeometryName,
const PointsArrayType& ThisPoints,
GeometryData const* pThisGeometryData = &GeometryDataInstance())
: mId(GenerateId(GeometryName))
Expand Down
2 changes: 1 addition & 1 deletion kratos/geometries/oriented_bounding_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ void OrientedBoundingBox<TDim>::RotateNode2D(array_1d<double, 3>& rCoords) const
template<std::size_t TDim>
void OrientedBoundingBox<TDim>::RotateNode3D(
array_1d<double, 3>& rCoords,
BoundedMatrix<double, 4, 4> rInvertedRotationMatrix
const BoundedMatrix<double, 4, 4>& rInvertedRotationMatrix
) const
{
array_1d<double, 4> old_coords;
Expand Down
2 changes: 1 addition & 1 deletion kratos/geometries/oriented_bounding_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class KRATOS_API(KRATOS_CORE) OrientedBoundingBox
*/
void RotateNode3D(
array_1d<double, 3>& rCoords,
BoundedMatrix<double, 4, 4> rInvertedRotationMatrix
const BoundedMatrix<double, 4, 4>& rInvertedRotationMatrix
) const;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class QuadraturePointSurfaceInVolumeGeometry
QuadraturePointSurfaceInVolumeGeometry(
const PointsArrayType& ThisPoints,
GeometryShapeFunctionContainerType& ThisGeometryShapeFunctionContainer,
TangentMatrixType LocalTangents )
const TangentMatrixType& LocalTangents )
: BaseType(ThisPoints, ThisGeometryShapeFunctionContainer)
{
KRATOS_ERROR_IF( mLocalTangents.size1() != LocalTangents.size1() || mLocalTangents.size2() != LocalTangents.size2() )
Expand All @@ -81,7 +81,7 @@ class QuadraturePointSurfaceInVolumeGeometry
QuadraturePointSurfaceInVolumeGeometry(
const PointsArrayType& ThisPoints,
GeometryShapeFunctionContainerType& ThisGeometryShapeFunctionContainer,
TangentMatrixType LocalTangents,
const TangentMatrixType& LocalTangents,
GeometryType* pGeometryParent)
: BaseType(ThisPoints, ThisGeometryShapeFunctionContainer, pGeometryParent)
{
Expand Down
2 changes: 1 addition & 1 deletion kratos/includes/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class KRATOS_API(KRATOS_CORE) Kernel {
*/
void InitializeApplication(KratosApplication& NewApplication) {}

bool IsImported(std::string ApplicationName) const;
bool IsImported(const std::string& ApplicationName) const;

static bool IsDistributedRun();

Expand Down
2 changes: 1 addition & 1 deletion kratos/includes/kratos_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class KRATOS_API(KRATOS_CORE) KratosApplication {
///@{

/// Default constructor.
explicit KratosApplication(const std::string ApplicationName);
explicit KratosApplication(const std::string& ApplicationName);

KratosApplication() = delete;

Expand Down
2 changes: 1 addition & 1 deletion kratos/includes/properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Properties : public IndexedObject
explicit Properties(IndexType NewId = 0) : BaseType(NewId), mData(), mTables(), mSubPropertiesList() {}

/// Default of properties with subproperties
explicit Properties(IndexType NewId, SubPropertiesContainerType SubPropertiesList) : BaseType(NewId), mData(), mTables(), mSubPropertiesList(SubPropertiesList) {}
explicit Properties(IndexType NewId, const SubPropertiesContainerType& SubPropertiesList) : BaseType(NewId), mData(), mTables(), mSubPropertiesList(SubPropertiesList) {}

/// Copy constructor.
Properties(const Properties& rOther) : BaseType(rOther), mData(rOther.mData), mTables(rOther.mTables), mSubPropertiesList(rOther.mSubPropertiesList) {}
Expand Down
2 changes: 1 addition & 1 deletion kratos/includes/serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ class KRATOS_API(KRATOS_CORE) Serializer
return msRegisteredObjectsName;
}

void Set(Flags ThisFlag)
void Set(const Flags ThisFlag)
{
mFlags.Set(ThisFlag);
}
Expand Down
2 changes: 1 addition & 1 deletion kratos/input_output/cad_json_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace Kratos
}

void CadJsonOutput::GetBrepSurfaceParameters(
const typename ModelPart::GeometryIterator rGeometryIterator, Parameters& rBrepsParameters, IndexType EchoLevel) {
const typename ModelPart::GeometryIterator& rGeometryIterator, Parameters& rBrepsParameters, IndexType EchoLevel) {
const auto& r_aux_geometry = *rGeometryIterator;
const BrepSurfaceType r_brep_surface_geom = dynamic_cast<const BrepSurfaceType&>(r_aux_geometry);
Parameters face_parameters;
Expand Down
2 changes: 1 addition & 1 deletion kratos/input_output/cad_json_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class KRATOS_API(KRATOS_CORE) CadJsonOutput

/// Returns the paramaters/json of a specific brep_surface
static void GetBrepSurfaceParameters(
const typename ModelPart::GeometryIterator rGeometryIterator, Parameters& rBrepsParameters, IndexType EchoLevel);
const typename ModelPart::GeometryIterator& rGeometryIterator, Parameters& rBrepsParameters, IndexType EchoLevel);

/// Returns the paramaters/json of a loop - typically from a brep_surface
static void GetBoundaryLoopParameters(
Expand Down
4 changes: 2 additions & 2 deletions kratos/input_output/logger_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ class KRATOS_API(KRATOS_CORE) LoggerOutput
return mCategory;
}

void SetOption(Kratos::Flags ThisFlag, bool Value) {
void SetOption(const Kratos::Flags ThisFlag, bool Value) {
mOptions.Set(ThisFlag, Value);
}

bool GetOption(Kratos::Flags ThisFlag) {
bool GetOption(const Kratos::Flags ThisFlag) {
return mOptions.Is(ThisFlag);
}

Expand Down
2 changes: 1 addition & 1 deletion kratos/input_output/logger_table_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ namespace Kratos
this->GetStream() << "" << std::endl;
}
}
std::string LoggerTableOutput::Centered(int width, const std::string str)
std::string LoggerTableOutput::Centered(int width, const std::string& str)
{
int len = str.length();
if(width < len) { return str; }
Expand Down
2 changes: 1 addition & 1 deletion kratos/input_output/logger_table_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class KRATOS_API(KRATOS_CORE) LoggerTableOutput : public LoggerOutput

void WriteHashLine();
void WriteTableLine();
std::string Centered(int width, const std::string str);
std::string Centered(int width, const std::string& str);
void StripLabels(std::string& inLabel, std::string& outGlobalLabel, std::string& outColumnLabel);

///@}
Expand Down
2 changes: 1 addition & 1 deletion kratos/input_output/vtk_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ void VtkOutput::WritePropertiesIdsToFile(
template<typename TContainerType>
void VtkOutput::WriteIdsToFile(
const TContainerType& rContainer,
const std::string DataName,
const std::string& DataName,
std::ofstream& rFileStream) const
{
rFileStream << DataName << " 1 "
Expand Down
2 changes: 1 addition & 1 deletion kratos/input_output/vtk_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ class KRATOS_API(KRATOS_CORE) VtkOutput : public IO
template<typename TContainerType>
void WriteIdsToFile(
const TContainerType& rContainer,
const std::string DataName,
const std::string& DataName,
std::ofstream& rFileStream) const;


Expand Down
4 changes: 2 additions & 2 deletions kratos/integration/integration_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ namespace Kratos
}

IntegrationInfo::IntegrationInfo(
std::vector<SizeType> NumberOfIntegrationPointsPerSpanVector,
std::vector<QuadratureMethod> ThisQuadratureMethodVector)
const std::vector<SizeType>& NumberOfIntegrationPointsPerSpanVector,
const std::vector<QuadratureMethod>& ThisQuadratureMethodVector)
: mNumberOfIntegrationPointsPerSpanVector(NumberOfIntegrationPointsPerSpanVector),
mQuadratureMethodVector(ThisQuadratureMethodVector)
{
Expand Down
4 changes: 2 additions & 2 deletions kratos/integration/integration_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class KRATOS_API(KRATOS_CORE) IntegrationInfo : public Flags
QuadratureMethod ThisQuadratureMethod = QuadratureMethod::GAUSS);

IntegrationInfo(
std::vector<SizeType> NumberOfIntegrationPointsPerSpanVector,
std::vector<QuadratureMethod> ThisQuadratureMethodVector);
const std::vector<SizeType>& NumberOfIntegrationPointsPerSpanVector,
const std::vector<QuadratureMethod>& ThisQuadratureMethodVector);

///@}
///@name Dimension
Expand Down
2 changes: 1 addition & 1 deletion kratos/modeler/edge_swapping_2d_modeler.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class EdgeSwapping2DModeler : public Modeler

/** An auxiliary method for writing the mesh for GiD for debugging purpose
*/
void WriteMesh(ModelPart& rThisModelPart, std::string Filename)
void WriteMesh(ModelPart& rThisModelPart, const std::string& Filename)
{
std::ofstream temp_file(Filename.c_str());

Expand Down
2 changes: 1 addition & 1 deletion kratos/mpi/includes/mpi_communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ template<OperationType TOperation> struct Operation
}

template<class TNodesArrayType>
void PrintNodesId(TNodesArrayType& rNodes, std::string Tag, int color)
void PrintNodesId(TNodesArrayType& rNodes, const std::string& Tag, int color)
{
int rank = mrDataCommunicator.Rank();
std::cout << Tag << rank << " with color " << color << ":";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ElementConnectivityType ElementConnectivities()
return connectivities;
}

ElementConnectivityType ElementConnectivities(const std::vector<DistTestingInternals::IndexType> bounds)
ElementConnectivityType ElementConnectivities(const std::vector<DistTestingInternals::IndexType>& bounds)
{
KRATOS_TRY
ElementConnectivityType all_connectivities = ElementConnectivities();
Expand Down
6 changes: 3 additions & 3 deletions kratos/processes/apply_constant_scalarvalue_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class ApplyConstantScalarValueProcess : public Process
const Variable<double>& rVariable,
const double double_value,
std::size_t mesh_id,
Flags options
const Flags options
) : Process(options) , mr_model_part(model_part),mdouble_value(double_value), mint_value(0), mbool_value(false),mmesh_id(mesh_id)
{
KRATOS_TRY;
Expand All @@ -146,7 +146,7 @@ class ApplyConstantScalarValueProcess : public Process
const Variable< int >& rVariable,
const int int_value,
std::size_t mesh_id,
Flags options
const Flags options
) : Process(options) , mr_model_part(model_part),mdouble_value(0.0), mint_value(int_value), mbool_value(false),mmesh_id(mesh_id)
{
KRATOS_TRY;
Expand Down Expand Up @@ -174,7 +174,7 @@ class ApplyConstantScalarValueProcess : public Process
const Variable< bool >& rVariable,
const bool bool_value,
std::size_t mesh_id,
Flags options
const Flags options
) : Process(options) , mr_model_part(model_part),mdouble_value(0.0), mint_value(0), mbool_value(bool_value),mmesh_id(mesh_id)
{
KRATOS_TRY;
Expand Down
4 changes: 2 additions & 2 deletions kratos/processes/apply_constant_vectorvalue_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ class ApplyConstantVectorValueProcess : public Process
ApplyConstantVectorValueProcess(ModelPart& model_part,
const Variable< array_1d<double, 3 > >& rVariable,
const double modulus,
const Vector direction,
const Vector& direction,
std::size_t mesh_id,
Flags options
const Flags options
) : Process(options) , mr_model_part(model_part), mmodulus(modulus),mdirection(direction),mmesh_id(mesh_id)
{
KRATOS_TRY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class CalculateEmbeddedNodalVariableFromSkinProcess : public Process
const Variable<TVarType> &rEmbeddedNodalVariable,
const double GradientPenaltyCoefficient = 0.0,
const unsigned int BufferPosition = 0,
const std::string AuxPartName = "IntersectedElementsModelPart",
const std::string& AuxPartName = "IntersectedElementsModelPart",
const std::size_t EchoLevel = 0)
: Process()
, mEchoLevel(EchoLevel)
Expand Down
2 changes: 1 addition & 1 deletion kratos/processes/check_skin_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CheckSkinProcess
/// Constructor for CheckSkinProcess Process
CheckSkinProcess(
ModelPart& rModelPart,
Flags Options
const Flags Options
): Process(Options),
mrModelPart(rModelPart)
{
Expand Down
2 changes: 1 addition & 1 deletion kratos/processes/entity_erase_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ KRATOS_CREATE_LOCAL_FLAG(EntitiesEraseProcessFlags, ERASE_ALL_ENTITIES, 1);
template<class TEntity>
EntitiesEraseProcess<TEntity>::EntitiesEraseProcess(
ModelPart& rModelPart,
Flags Options
const Flags Options
)
: mrModelPart(rModelPart),
mrOptions(Options)
Expand Down
Loading

0 comments on commit 7397f06

Please sign in to comment.