#1292 Fixed CppCheck Issues in GeoMech

This commit is contained in:
Jacob Støren
2017-03-06 11:20:28 +01:00
parent c22c2c9a00
commit c7c01e346c
10 changed files with 22 additions and 50 deletions
@@ -26,6 +26,8 @@
class RigFemFaceComparator
{
public:
RigFemFaceComparator() : m_minMainFaceNodeIdx(INT_MAX), m_faceIdxToMinMainFaceNodeIdx(0) {}
void setMainFace(const int* elmNodes, const int * localFaceIndices, int faceNodeCount)
{
m_canonizedMainFaceIdxes.resize(faceNodeCount);
@@ -27,7 +27,7 @@ class RigFemPart;
class RigFemPartGrid : public cvf::StructGridInterface
{
public:
RigFemPartGrid(const RigFemPart* femPart);
explicit RigFemPartGrid(const RigFemPart* femPart);
virtual ~RigFemPartGrid();
virtual bool ijkFromCellIndex(size_t cellIndex, size_t* i, size_t* j, size_t* k) const;
@@ -535,15 +535,11 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateMeanStressSEM(in
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * sa11 = nullptr;
RigFemScalarResultFrames * sa22 = nullptr;
RigFemScalarResultFrames * sa33 = nullptr;
sa11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S11"));
RigFemScalarResultFrames * sa11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S11"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
sa22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S22"));
RigFemScalarResultFrames * sa22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S22"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
sa33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S33"));
RigFemScalarResultFrames * sa33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S33"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -581,12 +577,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSFI(int partInde
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * se1Frames = nullptr;
RigFemScalarResultFrames * se3Frames = nullptr;
se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
RigFemScalarResultFrames * se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3"));
RigFemScalarResultFrames * se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -617,7 +610,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSFI(int partInde
}
else
{
dstFrameData[vIdx] = ((cohPrFricAngle + 0.5*(se1Data[vIdx] + se3Data[vIdx])) * sin(m_frictionAngleRad)) / (0.5*(se1Data[vIdx] - se3Data[vIdx]));
dstFrameData[vIdx] = ((cohPrFricAngle + 0.5*(se1Data[vIdx] + se3Data[vIdx])) * sinFricAng ) / (0.5*(se1Data[vIdx] - se3Data[vIdx]));
}
}
@@ -638,12 +631,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDSM(int partInde
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * se1Frames = nullptr;
RigFemScalarResultFrames * se3Frames = nullptr;
se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
RigFemScalarResultFrames * se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3"));
RigFemScalarResultFrames * se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -690,10 +680,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateFOS(int partInde
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * dsmFrames = nullptr;
RigFemScalarResultFrames * se3Frames = nullptr;
dsmFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "DSM"));
RigFemScalarResultFrames * dsmFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "DSM"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -730,17 +717,12 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateMeanStressSTM(in
caf::ProgressInfo frameCountProgress(this->frameCount() * 4, "");
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * st11 = nullptr;
RigFemScalarResultFrames * st22 = nullptr;
RigFemScalarResultFrames * st33 = nullptr;
st11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S11"));
RigFemScalarResultFrames * st11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S11"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
st22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S22"));
RigFemScalarResultFrames * st22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S22"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
st33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S33"));
RigFemScalarResultFrames * st33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S33"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -2109,7 +2091,6 @@ RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPar
if ( closestLocalNode >= 0 )
{
float scalarValue = std::numeric_limits<float>::infinity();
int nodeIdx = elmentConn[closestLocalNode];
m_closestElementNodeResIdx = static_cast<int>(femPart->elementNodeResultIdx(elementIndex, closestLocalNode));
@@ -2138,7 +2119,6 @@ RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPar
int closestLocalElmNode = -1;
{
RigElementType elmType = femPart->elementType(elementIndex);
int faceCount = RigFemTypes::elmentFaceCount(elmType);
const int* elmNodeIndices = femPart->connectivities(elementIndex);
int faceNodeCount = 0;
const int* localElmNodeIndicesForFace = RigFemTypes::localElmNodeIndicesForFace(elmType, m_face, &faceNodeCount);
@@ -28,7 +28,7 @@
class RigFemScalarResultFrames: public cvf::Object
{
public:
RigFemScalarResultFrames(int frameCount);
explicit RigFemScalarResultFrames(int frameCount);
virtual ~RigFemScalarResultFrames();
void enableAsSingleFrameResult();
@@ -35,7 +35,7 @@ class RigFemPartResultsCollection;
class RigGeoMechCaseData: public cvf::Object
{
public:
RigGeoMechCaseData(const std::string& fileName);
explicit RigGeoMechCaseData(const std::string& fileName);
~RigGeoMechCaseData();
bool openAndReadFemParts(std::string* errorMessage);