Skip to content
Snippets Groups Projects
Commit 77ac0b7e authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix BDF small field export on Windows (apparently Windows does not conform
to ANSI C and uses 3 digits in %e instead of 2)
parent 76180afe
No related branches found
No related tags found
No related merge requests found
// $Id: MVertex.cpp,v 1.15 2007-09-04 13:47:01 remacle Exp $ // $Id: MVertex.cpp,v 1.16 2007-09-21 16:22:51 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -118,6 +118,16 @@ static void double_to_char8(double val, char *str){ ...@@ -118,6 +118,16 @@ static void double_to_char8(double val, char *str){
sprintf(str, "%f", val); sprintf(str, "%f", val);
else else
sprintf(str, "%.1E", val); sprintf(str, "%.1E", val);
#if defined(WIN32)
// Windows uses 3 digits in the exponent (which apparently does not
// conform with ANSI C): remove the extra 0
if(strlen(str) == 9 && (str[4] == 'E' || str[5] == 'E')){
str[6] = str[7];
str[7] = str[8];
}
#endif
str[8] = '\0'; str[8] = '\0';
} }
...@@ -157,28 +167,25 @@ MVertex::linearSearch(std::set<MVertex*, MVertexLessThanLexicographic> &pos) ...@@ -157,28 +167,25 @@ MVertex::linearSearch(std::set<MVertex*, MVertexLessThanLexicographic> &pos)
return pos.end(); return pos.end();
} }
void parametricCoordinates ( const MVertex*ver, const GFace *gf, double &u, double &v) void parametricCoordinates(const MVertex *ver, const GFace *gf, double &u, double &v)
{ {
GEntity *ge = ver->onWhat(); GEntity *ge = ver->onWhat();
if (ge->dim() == 2) if(ge->dim() == 2){
{ ver->getParameter(0, u);
ver->getParameter ( 0,u); ver->getParameter(1, v);
ver->getParameter ( 1,v); }
} else if(ge->dim() == 1){
else if (ge->dim() == 1) double t;
{ ver->getParameter(0, t);
double t; GEdge *ged = dynamic_cast<GEdge*>(ge);
ver->getParameter ( 0,t); SPoint2 p = ged->reparamOnFace((GFace*)gf, t, 1);
GEdge *ged = dynamic_cast<GEdge*> (ge); u = p.x();
SPoint2 p = ged->reparamOnFace ( (GFace*)gf , t , 1); v = p.y();
u =p.x(); }
v =p.y(); else{
} GVertex *gver = dynamic_cast<GVertex*>(ge);
else SPoint2 p = gver->reparamOnFace((GFace*)gf, 1);
{ u = p.x();
GVertex *gver = dynamic_cast<GVertex*> (ge); v = p.y();
SPoint2 p = gver->reparamOnFace ( (GFace*)gf , 1); }
u =p.x();
v =p.y();
}
} }
...@@ -141,6 +141,6 @@ class MFaceVertex : public MVertex{ ...@@ -141,6 +141,6 @@ class MFaceVertex : public MVertex{
virtual bool setParameter(int i, double par){ if(!i) _u = par; else _v = par; return true; } virtual bool setParameter(int i, double par){ if(!i) _u = par; else _v = par; return true; }
}; };
void parametricCoordinates ( const MVertex*ver, const GFace *gf, double &u, double &v); void parametricCoordinates(const MVertex *ver, const GFace *gf, double &u, double &v);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment