From 9eb8e68ddc2b2a787da94e03bc1e44fc6f102bb2 Mon Sep 17 00:00:00 2001 From: Van Dung Nguyen <vdg.nguyen@gmail.com> Date: Thu, 12 Nov 2020 15:56:46 +0100 Subject: [PATCH] all returns must be provided --- .../materialLaw/mlawAnisotropicStoch.cpp | 6 ++--- NonLinearSolver/modelReduction/Clustering.cpp | 3 +++ .../modelReduction/modelReduction.cpp | 1 + NonLinearSolver/nlsolver/cutMeshByBox.cpp | 22 +++++++++---------- NonLinearSolver/nlsolver/meshModification.cpp | 10 ++++----- .../periodicBC/pbcCreateConstraints.cpp | 2 ++ dgshell/src/shellLocalBasis.cpp | 1 + 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/NonLinearSolver/materialLaw/mlawAnisotropicStoch.cpp b/NonLinearSolver/materialLaw/mlawAnisotropicStoch.cpp index 7824e84b3..0d614963b 100644 --- a/NonLinearSolver/materialLaw/mlawAnisotropicStoch.cpp +++ b/NonLinearSolver/materialLaw/mlawAnisotropicStoch.cpp @@ -24,7 +24,7 @@ mlawAnisotropicStoch::mlawAnisotropicStoch(const int num, const double rho, cons FILE *Props = fopen(propName, "r"); if ( Props != NULL ){ - fscanf(Props, "%d %d\n", &nxy[0], &nxy[1]); + int okf = fscanf(Props, "%d %d\n", &nxy[0], &nxy[1]); bool resizeFlag = _ExMat.resize(nxy[0], nxy[1], true); resizeFlag = _EyMat.resize(nxy[0], nxy[1], true); @@ -36,12 +36,12 @@ mlawAnisotropicStoch::mlawAnisotropicStoch(const int num, const double rho, cons resizeFlag = _MUxyMat.resize(nxy[0], nxy[1], true); resizeFlag = _MUxzMat.resize(nxy[0], nxy[1], true); resizeFlag = _MUyzMat.resize(nxy[0], nxy[1], true); - fscanf(Props, "%lf %lf\n", &_dx, &_dy); + okf = fscanf(Props, "%lf %lf\n", &_dx, &_dy); if (resizeFlag){ for(int i=0; i<nxy[0]; i++){ for(int j=0;j<nxy[1];j++){ - fscanf(Props, "%lf %lf %lf %lf %lf %lf %lf %lf %lf\n", &Anisoprop[0], &Anisoprop[1],&Anisoprop[2], + okf = fscanf(Props, "%lf %lf %lf %lf %lf %lf %lf %lf %lf\n", &Anisoprop[0], &Anisoprop[1],&Anisoprop[2], &Anisoprop[3],&Anisoprop[4],&Anisoprop[5],&Anisoprop[6],&Anisoprop[7],&Anisoprop[8]); _ExMat.set(i, j, Anisoprop[0]); diff --git a/NonLinearSolver/modelReduction/Clustering.cpp b/NonLinearSolver/modelReduction/Clustering.cpp index b1aa0bb34..7af74d485 100644 --- a/NonLinearSolver/modelReduction/Clustering.cpp +++ b/NonLinearSolver/modelReduction/Clustering.cpp @@ -75,6 +75,7 @@ int Clustering::getMaterialLawNumberIncluster(int cluster) const if (itF == _clusterMaterialMap.end()) { Msg::Error("material law for cluster %d cannot be found",cluster); + return 0; } else { @@ -806,6 +807,8 @@ const STensor3& Clustering::getEigenStrain(int cluster) const if (itF == _allEigenStrains.end()) { Msg::Error("eigven strain for cluster %d is not found",cluster); + static STensor3 a; + return a; } else { diff --git a/NonLinearSolver/modelReduction/modelReduction.cpp b/NonLinearSolver/modelReduction/modelReduction.cpp index cc6d9fd61..73bb6852f 100644 --- a/NonLinearSolver/modelReduction/modelReduction.cpp +++ b/NonLinearSolver/modelReduction/modelReduction.cpp @@ -22,6 +22,7 @@ const materialLaw* ReductionTFA::getMaterialLaw(int cluster) const { return itMat->second; } + return NULL; } void ReductionTFA::initializeClusterMaterialMap(const std::map<int,materialLaw*> &maplaw) diff --git a/NonLinearSolver/nlsolver/cutMeshByBox.cpp b/NonLinearSolver/nlsolver/cutMeshByBox.cpp index a08024b75..2554a880e 100644 --- a/NonLinearSolver/nlsolver/cutMeshByBox.cpp +++ b/NonLinearSolver/nlsolver/cutMeshByBox.cpp @@ -373,7 +373,7 @@ void cutMeshByBox::write_MSH2(std::string filename){ fprintf(fp, "%d\n", numnodes); for (elementGroup::vertexContainer::const_iterator it = _gVolume->vbegin(); it!= _gVolume->vend(); it++){ MVertex* v = it->second; - fprintf(fp, "%d %f %f %f\n",v->getNum(),v->x(),v->y(),v->z()); + int okf = fprintf(fp, "%ld %f %f %f\n",v->getNum(),v->x(),v->y(),v->z()); } fprintf(fp, "$EndNodes\n"); fprintf(fp, "$Elements\n"); @@ -633,14 +633,14 @@ void cutMeshByLevelSet::write_MSH2(elementGroup* g, const std::string filename) fprintf(fp, "$Nodes\n"); - fprintf(fp, "%d\n", g->vsize()); + fprintf(fp, "%ld\n", g->vsize()); for (elementGroup::vertexContainer::const_iterator it = g->vbegin(); it!= g->vend(); it++){ MVertex* v = it->second; - fprintf(fp, "%d %f %f %f\n",v->getNum(),v->x(),v->y(),v->z()); + fprintf(fp, "%ld %f %f %f\n",v->getNum(),v->x(),v->y(),v->z()); } fprintf(fp, "$EndNodes\n"); fprintf(fp, "$Elements\n"); - fprintf(fp, "%d\n", g->size()); + fprintf(fp, "%ld\n", g->size()); for (elementGroup::elementContainer::const_iterator it = g->begin(); it!= g->end(); it++){ @@ -733,10 +733,10 @@ void cutMeshByLevelSet::cut(const std::string inputModel, const levelSet* gl, co fprintf(fp, "$Nodes\n"); - fprintf(fp, "%d\n", allActiveVertices.size()); + fprintf(fp, "%ld\n", allActiveVertices.size()); for (std::set<MVertex*>::iterator it = allActiveVertices.begin(); it!= allActiveVertices.end(); it++){ MVertex* v = *it; - fprintf(fp, "%d %f %f %f\n",v->getNum(),v->x(),v->y(),v->z()); + fprintf(fp, "%ld %f %f %f\n",v->getNum(),v->x(),v->y(),v->z()); } fprintf(fp, "$EndNodes\n"); @@ -754,9 +754,9 @@ void cutMeshByLevelSet::cut(const std::string inputModel, const levelSet* gl, co if (abs(phys)> maxphys) maxphys = abs(phys); for (elementGroup::elementContainer::const_iterator ite = grCut.begin(); ite != grCut.end(); ite++){ MElement* ele = ite->second; - fprintf(fp,"%d %d 2 %d %d",ele->getNum(),ele->getTypeForMSH(),phys,phys); + fprintf(fp,"%ld %d 2 %d %d",ele->getNum(),ele->getTypeForMSH(),phys,phys); for (int i=0; i< ele->getNumVertices(); i++){ - fprintf(fp," %d", ele->getVertex(i)->getNum()); + fprintf(fp," %ld", ele->getVertex(i)->getNum()); } fprintf(fp,"\n"); } @@ -765,9 +765,9 @@ void cutMeshByLevelSet::cut(const std::string inputModel, const levelSet* gl, co for (std::set<MElement*>::iterator ite = intersectionElements.begin(); ite != intersectionElements.end(); ite++){ MElement* ele = *ite; - fprintf(fp,"%d %d 2 %d %d",ele->getNum(),ele->getTypeForMSH(),maxphys+1,maxphys+1); + fprintf(fp,"%ld %d 2 %d %d",ele->getNum(),ele->getTypeForMSH(),maxphys+1,maxphys+1); for (int i=0; i< ele->getNumVertices(); i++){ - fprintf(fp," %d", ele->getVertex(i)->getNum()); + fprintf(fp," %ld", ele->getVertex(i)->getNum()); } fprintf(fp,"\n"); } @@ -781,4 +781,4 @@ void cutMeshByLevelSet::cut(const std::string inputModel, const levelSet* gl, co std::string bFile = "boundary_"+inputModel; write_MSH2(&allBoundaryElements,bFile); -}; \ No newline at end of file +}; diff --git a/NonLinearSolver/nlsolver/meshModification.cpp b/NonLinearSolver/nlsolver/meshModification.cpp index 6e4838f55..12cb3bb4c 100644 --- a/NonLinearSolver/nlsolver/meshModification.cpp +++ b/NonLinearSolver/nlsolver/meshModification.cpp @@ -125,10 +125,10 @@ void makePhysicalByBox::write_MSH2(const std::map<int, elementGroup>& gMap, con fprintf(fp, "$MeshFormat\n2.2 0 8\n$EndMeshFormat\n"); fprintf(fp, "$Nodes\n"); - fprintf(fp, "%d\n", allVertices.size()); + fprintf(fp, "%ld\n", allVertices.size()); for (std::set<MVertex*>::const_iterator it = allVertices.begin(); it!= allVertices.end(); it++){ MVertex* v = *it; - fprintf(fp, "%d %f %f %f\n",v->getNum(),v->x(),v->y(),v->z()); + fprintf(fp, "%ld %f %f %f\n",v->getNum(),v->x(),v->y(),v->z()); } fprintf(fp, "$EndNodes\n"); fprintf(fp, "$Elements\n"); @@ -136,7 +136,7 @@ void makePhysicalByBox::write_MSH2(const std::map<int, elementGroup>& gMap, con for (std::map<int, elementGroup>::const_iterator itg = gMap.begin(); itg!= gMap.end(); itg++) { const elementGroup* g = &(itg->second); - Msg::Info("num of eelement in gr %d = %d",itg->first,g->size()); + Msg::Info("num of eelement in gr %d = %ld",itg->first,g->size()); for (elementGroup::elementContainer::const_iterator it = g->begin(); it!= g->end(); it++){ MElement* ele = it->second; ele->writeMSH2(fp,2.2,0,0,itg->first+1,itg->first+1); @@ -187,7 +187,7 @@ void makePhysicalByBox::run(const std::string inputMeshFile, const std::string o } } - Msg::Info("pass hare box size = %d",allBox.size()); + Msg::Info("pass hare box size = %ld",allBox.size()); // get all elemeents from model GModel pModel; @@ -258,4 +258,4 @@ void makePhysicalByBox::run(const std::string inputMeshFile, const std::string o } write_MSH2(allG,outputMeshFile); -}; \ No newline at end of file +}; diff --git a/NonLinearSolver/periodicBC/pbcCreateConstraints.cpp b/NonLinearSolver/periodicBC/pbcCreateConstraints.cpp index 31375d468..aa21db585 100644 --- a/NonLinearSolver/periodicBC/pbcCreateConstraints.cpp +++ b/NonLinearSolver/periodicBC/pbcCreateConstraints.cpp @@ -4205,6 +4205,8 @@ SPoint3 pbcConstraintElementGroup::getRootPoint(){ } else{ Msg::Error("getRootPoint has not been implemented for %d D problems",_solver->getMicroBC()->getDim()); + static SPoint3 pt(0.,0.,0.); + return pt; } } }; diff --git a/dgshell/src/shellLocalBasis.cpp b/dgshell/src/shellLocalBasis.cpp index 3065252d1..5c52994d0 100644 --- a/dgshell/src/shellLocalBasis.cpp +++ b/dgshell/src/shellLocalBasis.cpp @@ -429,6 +429,7 @@ nonLinearShellLocalBasisBulk& nonLinearShellLocalBasisBulk::operator=(const she _detJ[i]= src->_detJ[i]; _detJ0[i]=src->_detJ0[i]; } + return *this; } void nonLinearShellLocalBasisBulk::set(MElement *ele, const std::vector<TensorialTraits<double>::GradType> &Grads, const std::vector<TensorialTraits<double>::HessType> &Hess, -- GitLab