diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 2e14e19279c162ae8d53b5b96edac258674ce376..441725dc4eaf3647e23135a842b487621829045e 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -9,6 +9,7 @@ #include "Geo.h" #include "GModel.h" #include "Numeric.h" +#include "HighOrder.h" #include "Context.h" #include "OpenFile.h" #include "CommandLine.h" @@ -31,10 +32,6 @@ #include "Draw.h" #endif -// KH: modify grid order after reading -extern Context_T CTX; -extern void SetOrderN(GModel *m, int order, bool linear, bool incomplete); -// end KH #define SQU(a) ((a)*(a)) static void FinishUpBoundingBox() @@ -350,10 +347,8 @@ int MergeFile(std::string fileName, bool warnIfMissing) #if !defined(HAVE_NO_POST) if(status > 1) status = PView::readMSH(fileName); #endif - // KH - modify mesh order after reading - if (CTX.mesh.order > 1) SetOrderN(GModel::current(),CTX.mesh.order,false,false); - // end - KH - + if(CTX::instance()->mesh.order > 1) + SetOrderN(GModel::current(), CTX::instance()->mesh.order, false, false); } #if !defined(HAVE_NO_POST) else if(!strncmp(header, "$PostFormat", 11) || diff --git a/Geo/GEdge.cpp b/Geo/GEdge.cpp index 44b3a04127f80f29ae830165e2fb1ef5bbdc88a5..0f96fc49a05f1733654120753fc4aee5bbb75038 100644 --- a/Geo/GEdge.cpp +++ b/Geo/GEdge.cpp @@ -14,14 +14,12 @@ #include "GEdge.h" #include "GFace.h" #include "MElement.h" +#include "Context.h" #if !defined(HAVE_GMSH_EMBEDDED) #include "GaussLegendre1D.h" -#include "Context.h" #endif -extern Context_T CTX; - GEdge::GEdge(GModel *model, int tag, GVertex *_v0, GVertex *_v1) : GEntity(model, tag), _tooSmall(false), v0(_v0), v1(_v1) { @@ -194,8 +192,8 @@ double GEdge::length(const double &u0, const double &u1, const int nbQuadPoints) #endif } -GPoint GEdge::closestPoint(const SPoint3 & q,double& t) const { - +GPoint GEdge::closestPoint(const SPoint3 & q,double& t) const +{ double tolerance = 1.e-12; double dist = 1.; @@ -233,20 +231,15 @@ GPoint GEdge::closestPoint(const SPoint3 & q,double& t) const { return point(t); } - -#include <iostream> - - -double GEdge::parFromPoint(const SVector3& Q) const { +double GEdge::parFromPoint(const SVector3 &Q) const +{ double t; - bool success = XYZToU(Q,t); + bool success = XYZToU(Q, t); return t; } -bool GEdge::XYZToU(const SVector3& Q,double &u, const double relax) const +bool GEdge::XYZToU(const SVector3 &Q, double &u, const double relax) const { - - const double Precision = 1.e-8; const int MaxIter = 25; const int NumInitGuess = 11; @@ -262,10 +255,10 @@ bool GEdge::XYZToU(const SVector3& Q,double &u, const double relax) const double init[NumInitGuess]; - for (int i=0;i<NumInitGuess;i++) init[i] = uMin + (uMax-uMin)/(NumInitGuess-1)*i; + for (int i = 0; i < NumInitGuess; i++) + init[i] = uMin + (uMax - uMin) / (NumInitGuess - 1) * i; for(int i = 0; i < NumInitGuess; i++){ - u = init[i]; double uNew = u; err = 1.0; @@ -274,9 +267,9 @@ bool GEdge::XYZToU(const SVector3& Q,double &u, const double relax) const SVector3 dPQ = P - Q; err2 = dPQ.norm(); - if (err2 < 1.e-8 * CTX.lc) return true; + if (err2 < 1.e-8 * CTX::instance()->lc) return true; - while(iter++ < MaxIter && err2 > 1e-8 * CTX.lc) { + while(iter++ < MaxIter && err2 > 1e-8 * CTX::instance()->lc) { SVector3 der = firstDer(u); uNew = u - relax * dot(dPQ,der) / dot(der,der); uNew = std::min(uMax,std::max(uMin,uNew)); @@ -288,14 +281,16 @@ bool GEdge::XYZToU(const SVector3& Q,double &u, const double relax) const u = uNew; } - if (err2 < 1e-8 * CTX.lc) return true; + if (err2 < 1e-8 * CTX::instance()->lc) return true; } if(relax > 1.e-2) { - Msg::Info("point %g %g %g on edge %d : Relaxation factor = %g", Q.x(), Q.y(), Q.z(), 0.75 * relax); + Msg::Info("point %g %g %g on edge %d : Relaxation factor = %g", + Q.x(), Q.y(), Q.z(), 0.75 * relax); return XYZToU(Q, u, 0.75 * relax); } - Msg::Error("Could not converge reparametrisation of point (%e,%e,%e) on edge %d",Q.x(),Q.y(),Q.z(),tag()); + Msg::Error("Could not converge reparametrisation of point (%e,%e,%e) on edge %d", + Q.x(), Q.y(), Q.z(), tag()); return false; } diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index 09e443a9bd34dde8d7059a36f232d6f0e50ef4dd..af27314835f27437dda6cde9b4db281d37b167a2 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -99,9 +99,6 @@ static void createElementMSH(GModel *m, int num, int type, int physical, if(part) m->getMeshPartitions().insert(part); } - -// extern void printDistortion(GModel *m, const char *nm,double& minR,double& maxR); - int GModel::readMSH(const std::string &name) { FILE *fp = fopen(name.c_str(), "rb"); @@ -218,7 +215,6 @@ int GModel::readMSH(const std::string &name) if(fread(uv, sizeof(double), 1, fp) != 1) return 0; if(swap) SwapBytes((char*)uv, sizeof(double), 1); } - Msg::Warning("Creating edge vertex \n"); newVertex = new MEdgeVertex(xyz[0], xyz[1], xyz[2], ge, uv[0], -1.0, num); } else if (iClasDim == 2){ @@ -390,13 +386,6 @@ int GModel::readMSH(const std::string &name) storePhysicalTagsInEntities(this, i, physicals[i]); fclose(fp); - - char nm[256] = "distorzione.pos"; - - double minR; - double maxR; - - // printDistortion(this,nm,minR,maxR); return postpro ? 2 : 1; } diff --git a/Geo/MVertex.h b/Geo/MVertex.h index d2fcfb5596e1269c1cf98991549517b799d10cff..72ec064b919b2ee49ba1f4235e3ee5d83e07210a 100644 --- a/Geo/MVertex.h +++ b/Geo/MVertex.h @@ -10,7 +10,6 @@ #include <set> #include "SPoint2.h" #include "SPoint3.h" -#include "GmshMessage.h" class GEntity; class GEdge; diff --git a/Mesh/HighOrder.cpp b/Mesh/HighOrder.cpp index 907122278a035a06d0115487ac07541a503a5acd..64107668f1db3dcfe4146f54db99e9c2734174cc 100644 --- a/Mesh/HighOrder.cpp +++ b/Mesh/HighOrder.cpp @@ -1036,7 +1036,7 @@ void SetOrderN(GModel *m, int order, bool linear, bool incomplete) setHighOrder(*it, edgeVertices, faceVertices, linear, incomplete, nPts, displ2D, displ3D); - Msg::StatusBar(1, true, "Finished meshing order %d...", order); + Msg::StatusBar(1, true, "Done meshing order %d", order); // now we smooth mesh the internal vertices of the faces // we do that model face by model face