diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 87efec18eea866133f83201ea1ecba86ec92de55..3ec1ad7930870166d5a51dbbe03a2f2396481ef7 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -815,8 +815,9 @@ MVertex *GModel::getMeshVertexByTag(int n) return _vertexMapCache[n]; } -MVertex* GModel::getMeshVertexByCoordinates(double x, double y, double z, double tol){ - if(_vertexVectorCache.empty() && _vertexMapCache.empty()){ +MVertex* GModel::getMeshVertexByCoordinates(double x, double y, double z, double tol) +{ + if(_vertexVectorCache.empty() && _vertexMapCache.empty()){ Msg::Debug("Rebuilding mesh vertex cache"); _vertexVectorCache.clear(); _vertexMapCache.clear(); @@ -840,23 +841,23 @@ MVertex* GModel::getMeshVertexByCoordinates(double x, double y, double z, double } } - for (int i=1; i< _vertexVectorCache.size(); i++){ - MVertex* v = _vertexVectorCache[i]; - double l = sqrt((v->x() -x)*(v->x()-x)+ (v->y()-y)*(v->y()-y)+ (v->z()-z)*(v->z()-z)); - if (l<tol) return v; - }; + for (unsigned int i = 1; i< _vertexVectorCache.size(); i++){ + MVertex* v = _vertexVectorCache[i]; + double l = sqrt((v->x() -x)*(v->x()-x)+ (v->y()-y)*(v->y()-y)+ (v->z()-z)*(v->z()-z)); + if (l < tol) return v; + } - for (std::map<int,MVertex*>::iterator it = _vertexMapCache.begin(); it!= _vertexMapCache.end(); it++){ - MVertex* v = it->second; - double l = sqrt((v->x() -x)*(v->x()-x)+ (v->y()-y)*(v->y()-y)+ (v->z()-z)*(v->z()-z)); - if (l<tol) return v; - }; + for (std::map<int,MVertex*>::iterator it = _vertexMapCache.begin(); it!= _vertexMapCache.end(); it++){ + MVertex* v = it->second; + double l = sqrt((v->x() -x)*(v->x()-x)+ (v->y()-y)*(v->y()-y)+ (v->z()-z)*(v->z()-z)); + if (l < tol) return v; + } - MVertex* v = new MVertex(x,y,z); - _vertexVectorCache.push_back(v); - _vertexMapCache[v->getNum()] = v; + MVertex* v = new MVertex(x,y,z); + _vertexVectorCache.push_back(v); + _vertexMapCache[v->getNum()] = v; - return v; + return v; }; void GModel::getMeshVerticesForPhysicalGroup(int dim, int num, std::vector<MVertex*> &v) diff --git a/Mesh/meshGFaceLloyd.cpp b/Mesh/meshGFaceLloyd.cpp index eb3cd1cf2023283353d83f926cf5a655355d77c6..1d65c95fc3a18aa9fdbfa5b28727598c5e46e84e 100644 --- a/Mesh/meshGFaceLloyd.cpp +++ b/Mesh/meshGFaceLloyd.cpp @@ -368,7 +368,6 @@ void callback(const alglib::real_1d_array& x,double& func,alglib::real_1d_array& } void verification(alglib::real_1d_array& x,void* ptr){ - int num; int index; int dimension; double e; @@ -376,36 +375,34 @@ void verification(alglib::real_1d_array& x,void* ptr){ double R,L,U,D; wrapper* w; DocRecord* pointer; - + w = static_cast<wrapper*>(ptr); dimension = w->get_dimension(); - pointer = w->get_triangulator(); - num = pointer->numPoints; srand(time(NULL)); index = rand()%(dimension/2); e = 0.0000001; - + alglib::real_1d_array grad; grad.setlength(dimension); - + x[index] = x[index] + e; callback(x,R,grad,ptr); x[index] = x[index] - e; - + x[index] = x[index] - e; callback(x,L,grad,ptr); x[index] = x[index] + e; - + x[index + dimension/2] = x[index + dimension/2] + e; callback(x,U,grad,ptr); x[index + dimension/2] = x[index + dimension/2] - e; - + x[index + dimension/2] = x[index + dimension/2] - e; callback(x,D,grad,ptr); x[index + dimension/2] = x[index + dimension/2] + e; - + callback(x,func,grad,ptr); - + printf("%f %f\n",(R-L)/(2.0*e),(U-D)/(2.0*e)); printf("%f %f\n",grad[index],grad[index + dimension/2]); } @@ -419,7 +416,7 @@ smoothing::smoothing(int param1,int param2){ void smoothing::optimize_face(GFace* gf){ if(gf->getNumMeshElements()==0 || gf->getCompound()) return; - + std::set<MVertex*> all; // get all the points of the face ... @@ -531,7 +528,7 @@ void smoothing::optimize_face(GFace* gf){ /*if(num_interior>1){ verification(x,&w); - }*/ + }*/ if(num_interior>1){ minlbfgscreate(2*num_interior,4,x,state); @@ -580,19 +577,19 @@ void smoothing::optimize_face(GFace* gf){ int option; option = gf->getMeshingAlgo(); gf->setMeshingAlgo(ALGO_2D_MESHADAPT); - + gf->additionalVertices = mesh_vertices; meshGFace mesher; mesher(gf); - + gf->mesh_vertices.insert(gf->mesh_vertices.begin(),gf->additionalVertices.begin(),gf->additionalVertices.end()); //? gf->additionalVertices.clear(); - gf->setMeshingAlgo(option); - + gf->setMeshingAlgo(option); + free(initial_conditions); free(variables_scales); - + backgroundMesh::unset(); } diff --git a/Numeric/BasisFactory.cpp b/Numeric/BasisFactory.cpp index 356fdec336895600f244742ec6e725891b9282d4..298371ee08d59cab0b2fe9c461bef1cd7ecba23d 100644 --- a/Numeric/BasisFactory.cpp +++ b/Numeric/BasisFactory.cpp @@ -53,7 +53,9 @@ const nodalBasis* BasisFactory::getNodalBasis(int tag) std::pair<std::map<int, nodalBasis*>::const_iterator, bool> inserted; +#if defined(_OPENMP) #pragma omp critical +#endif { inserted = fs.insert(std::make_pair(tag, F)); diff --git a/Numeric/MetricBasis.cpp b/Numeric/MetricBasis.cpp index 657fb42ef150c18e439276339b99528250f862eb..127b80ab69d34685db92ae88afe403f399ea608e 100644 --- a/Numeric/MetricBasis.cpp +++ b/Numeric/MetricBasis.cpp @@ -29,10 +29,6 @@ namespace { { if (n < k || k < 0) { Msg::Error("Wrong argument for combination. n %d k %d", n, k); - int a[2]; - int e = 0; - for (int i = 0; i < 10000000; ++i) e+=a[i]; - Msg::Info("%d",e); return 1; } @@ -347,7 +343,7 @@ void MetricCoefficient::interpolate(const double *uvw, double *minmaxQ) int order = _bezier->getOrder(); - int dimSimplex; + int dimSimplex = 0; fullMatrix<double> exponents; double bezuvw[3]; switch (_element->getType()) { @@ -513,7 +509,7 @@ double MetricCoefficient::getBoundRmin(double tol, int which) Msg::Info("> numSubdivision %d", __numSubdivision); int last = __numSub.size(); while (--last > 0 && __numSub[last] == 0); - for (unsigned int i = 0; i < last+1; ++i) { + for (int i = 0; i < last+1; ++i) { Msg::Info("> depth %d: %d", i, __numSub[i]); } Msg::Info("RETURNING %g after subdivision", tt); @@ -756,13 +752,13 @@ void MetricCoefficient::_computeRmin2( return; } - double a1, a0; + double a1; //, a0; { double p = -1./2; double q = -minJ-1/factor2; a1 = cubicCardanoRoot(p, q); //plus grand => -1 q = -minJ+1/factor2; - a0 = cubicCardanoRoot(p, q); //plus petit => 1 + //a0 = cubicCardanoRoot(p, q); //plus petit => 1 } double mina; @@ -1042,12 +1038,12 @@ void MetricCoefficient::_minJ2P3(const fullMatrix<double> &coeff, //Msg::Warning("sizes %d %d", _ineqJ2.size(), _ineqP3.size()); int count = 0; while (itJ != _ineqJ2.end() && itP != _ineqP3.end()) { - if (count >= _ineqJ2.size()) Msg::Fatal("aaargh"); + if (count >= (int)_ineqJ2.size()) Msg::Fatal("aaargh"); if (itJ->first != itP->first) Msg::Fatal("not same hash %d %d", itJ->first, itP->first); double num = 0; //Msg::Info("sizej %d", itJ->second.size()); - for (int l = 0; l < itJ->second.size(); ++l) { + for (unsigned int l = 0; l < itJ->second.size(); ++l) { const int i = itJ->second[l].i; const int j = itJ->second[l].j; num += itJ->second[l].val * jac(i) * jac(j); @@ -1055,7 +1051,7 @@ void MetricCoefficient::_minJ2P3(const fullMatrix<double> &coeff, double den = 0; //Msg::Info("sizep %d", itP->second.size()); - for (int l = 0; l < itP->second.size(); ++l) { + for (unsigned int l = 0; l < itP->second.size(); ++l) { const int i = itP->second[l].i; const int j = itP->second[l].j; const int k = itP->second[l].k; diff --git a/contrib/gmm/gmm_precond_diagonal.h b/contrib/gmm/gmm_precond_diagonal.h index e3f74c6ffaf63afc3aef30d539e77953d10998d5..f6dee5a9ef4d6fdef4736d13d257d2eebd1931e5 100644 --- a/contrib/gmm/gmm_precond_diagonal.h +++ b/contrib/gmm/gmm_precond_diagonal.h @@ -91,9 +91,9 @@ namespace gmm { void transposed_mult(const diagonal_precond<Matrix>& P,const V1 &v1,V2 &v2) { mult(P, v1, v2); } - + // # define DIAG_LEFT_MULT_SQRT - + template <typename Matrix, typename V1, typename V2> inline void left_mult(const diagonal_precond<Matrix>& P, const V1 &v1, V2 &v2) { GMM_ASSERT2(P.diag.size() == vect_size(v2), "dimensions mismatch"); @@ -112,10 +112,10 @@ namespace gmm { template <typename Matrix, typename V1, typename V2> inline void right_mult(const diagonal_precond<Matrix>& P, const V1 &v1, V2 &v2) { - typedef typename linalg_traits<Matrix>::value_type T; + //typedef typename linalg_traits<Matrix>::value_type T; GMM_ASSERT2(P.diag.size() == vect_size(v2), "dimensions mismatch"); copy(v1, v2); -# ifdef DIAG_LEFT_MULT_SQRT +# ifdef DIAG_LEFT_MULT_SQRT for (size_type i= 0; i < P.diag.size(); ++i) v2[i] *= gmm::sqrt(P.diag[i]); # endif } @@ -127,5 +127,5 @@ namespace gmm { } -#endif +#endif