Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: address some code analysis issues #3456

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/coreComponents/constitutive/ExponentialRelation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,19 +421,19 @@ class ExponentialRelation
private:

/// variable shift
T m_x0;
T m_x0{};

/// variable shift
T m_w0;
T m_w0{};

/// scaling coefficient
T m_y0;
T m_y0{};

/// exponential coefficient
T m_alpha;
T m_alpha{};

/// exponential coefficient
T m_beta;
T m_beta{};

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void PhillipsBrineViscosityUpdate::compute( real64 const & pressure,
using Deriv = constitutive::multifluid::DerivativeOffset;

// compute the viscosity of pure water as a function of temperature
real64 dPureWaterVisc_dTemperature;
real64 dPureWaterVisc_dTemperature = 0.0;
real64 const pureWaterVisc = m_waterViscosityTable.compute( &temperature, &dPureWaterVisc_dTemperature );

// then compute the brine viscosity, accounting for the presence of salt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void ElasticIsotropicPressureDependentUpdates::smallStrainUpdate( localIndex con
real64 eps_v_elastic;
real64 oldElasticStrainVol;
real64 oldElasticStrainDev;
real64 bulkModulus = -p0/Cr;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reassigned below, down in the code

real64 bulkModulus;

for( localIndex i=0; i<6; ++i )
{
Expand Down
1 change: 0 additions & 1 deletion src/coreComponents/dataRepository/xmlWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ size_t findAttribute( string const & attName, string const & xmlBuffer, size_t c
{
return candidatePos;
}
searchStart = candidatePos + attName.size();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used

}
}
catch( std::regex_error const & )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ dataRepository::Group const * HistoryCollectionBase::getTargetObject( DomainPart
}
else
{
string const targetTokensStr = stringutilities::join( targetTokens.begin(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used

targetTokens.begin()+pathLevel,
'/' );
GEOS_THROW( targetTokens[pathLevel] << " not found in path " <<
objectPath << std::endl << targetGroup->dumpSubGroupsNames(),
std::domain_error );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ class ConformingVirtualElementOrder1 final : public FiniteElementBase
{}

/// The number of support points.
localIndex numSupportPoints;
localIndex numSupportPoints{};
/// The quadrature weight.
real64 quadratureWeight;
real64 quadratureWeight{};
/// Array holding the integral mean of basis functions in the first @ref numSupportPoints
/// positions.
real64 basisFunctionsIntegralMean[MAXCELLNODES];
real64 basisFunctionsIntegralMean[MAXCELLNODES]{};
/// The stabilization matrix. Valid values will be in the upper left @ref numSupportPoints x
/// @ref numSupportPoints block.
real64 stabilizationMatrix[MAXCELLNODES][MAXCELLNODES];
real64 stabilizationMatrix[MAXCELLNODES][MAXCELLNODES]{};
/// Array holding the integral mean of derivatives of basis functions in the first @ref
/// numSupportPoints position of the first dimension.
real64 basisDerivativesIntegralMean[MAXCELLNODES][3];
real64 basisDerivativesIntegralMean[MAXCELLNODES][3]{};
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#ifndef GEOS_MESH_UTILITIES_STRUCTUREDGRIDUTILITIES_HPP
#define GEOS_MESH_UTILITIES_STRUCTUREDGRIDUTILITIES_HPP

#include "common/logger/Logger.hpp"
#include "common/GeosxMacros.hpp"
#include <vector>

/**
* @file StructuredGridUtilities.hpp
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,7 @@ bool SolidMechanicsLagrangeContact::updateConfiguration( DomainPartition & domai

bool SolidMechanicsLagrangeContact::isFractureAllInStickCondition( DomainPartition const & domain ) const
{
globalIndex numStick, numNewSlip, numSlip, numOpen;
globalIndex numStick = 0, numNewSlip = 0, numSlip = 0, numOpen = 0;
forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &,
MeshLevel const & mesh,
arrayView1d< string const > const & )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ struct ComputeRotationMatricesKernel
forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k )
{

localIndex const & f0 = elemsToFaces[k][0];
localIndex const & f1 = elemsToFaces[k][1];
localIndex const f0 = elemsToFaces[k][0];
localIndex const f1 = elemsToFaces[k][1];

real64 Nbar[3];
Nbar[0] = faceNormal[f0][0] - faceNormal[f1][0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class SolutionScalingAndCheckingKernelBase

StackVariables( real64 _localMinVal )
:
localRow( -1 ),
Copy link
Contributor

@MelReyCG MelReyCG Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question: why -1 instead of 0? (=> localRow())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 to force it to crash when something goes wrong

localMinVal( _localMinVal )
{ }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASE_RESIDUALNORMKERNEL_HPP

#include "physicsSolvers/PhysicsSolverBaseKernels.hpp"
#include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp"
#include "mesh/ElementSubRegionBase.hpp"

namespace geos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::setupCoupling( DomainPartition
regions.emplace_back( region.getName() );
} );

dispMeshTargets[std::make_pair( meshBodyName, solidDiscretizationName )] = std::move( regions );
presMeshTargets[std::make_pair( meshBodyName, flowDiscretizationName )] = std::move( regions );
dispMeshTargets[std::make_pair( meshBodyName, solidDiscretizationName )] = regions;
presMeshTargets[std::make_pair( meshBodyName, flowDiscretizationName )] = regions;
Comment on lines +406 to +407
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did the previous code worked?? Good catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think using moved is a big deal here but better not to use it

} );

dofManager.addCoupling( solidMechanics::totalDisplacement::key(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ real64 AcousticWaveEquationSEM::explicitStepInternal( real64 const & time_n,

GEOS_LOG_RANK_0_IF( dt < epsilonLoc, "Warning! Value for dt: " << dt << "s is smaller than local threshold: " << epsilonLoc );

real64 dtCompute;
real64 dtCompute = 0.0;
forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &,
MeshLevel & mesh,
arrayView1d< string const > const & regionNames )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ real64 ElasticWaveEquationSEM::explicitStepInternal( real64 const & time_n,

GEOS_LOG_RANK_0_IF( dt < epsilonLoc, "Warning! Value for dt: " << dt << "s is smaller than local threshold: " << epsilonLoc );

real64 dtCompute;
real64 dtCompute = 0.0;
forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &,
MeshLevel & mesh,
arrayView1d< string const > const & regionNames )
Expand Down
Loading