diff --git a/Mesh/BackgroundMesh.cpp b/Mesh/BackgroundMesh.cpp index 97ce00058903f6d33457d5c1c1431ee52d676ad0..ba854148177145f6a3f998824000fd5e5ba73ee9 100644 --- a/Mesh/BackgroundMesh.cpp +++ b/Mesh/BackgroundMesh.cpp @@ -719,44 +719,42 @@ void backgroundMesh::updateSizes(GFace *_gf) } } -double backgroundMesh::operator() (double u, double v, double w) const +double backgroundMesh::operator() (double x, double y, double z) const { - double uv[3] = {u, v, w}; - double uv2[3]; - // return 1.0; - MElement *e = _octree->find(u, v, w, 2, true); + double xyz[3] = {x, y, z}; + double uv[3]; + MElement *e = _octree->find(x, y, z, 2, true); if (!e) { - Msg::Error("cannot find %g %g", u, v); + Msg::Error("cannot find %g %g %g", x, y, z); return -1000.0;//0.4; } - e->xyz2uvw(uv, uv2); + e->xyz2uvw(xyz, uv); std::map<MVertex*,double>::const_iterator itv1 = _sizes.find(e->getVertex(0)); std::map<MVertex*,double>::const_iterator itv2 = _sizes.find(e->getVertex(1)); std::map<MVertex*,double>::const_iterator itv3 = _sizes.find(e->getVertex(2)); - return itv1->second * (1-uv2[0]-uv2[1]) + itv2->second * uv2[0] + itv3->second * uv2[1]; + return itv1->second * (1-uv[0]-uv[1]) + itv2->second * uv[0] + itv3->second * uv[1]; } -double backgroundMesh::getAngle(double u, double v, double w) const +double backgroundMesh::getAngle(double x, double y, double z) const { - double uv[3] = {u, v, w}; - double uv2[3]; - // return 1.0; - MElement *e = _octree->find(u, v, w, 2, true); + double xyz[3] = {x, y, z}; + double uv[3]; + MElement *e = _octree->find(x, y, z, 2, true); if (!e) { - Msg::Error("cannot find %g %g", u, v); + Msg::Error("cannot find %g %g %g", x, y, z); return 0.0; } - e->xyz2uvw(uv, uv2); + e->xyz2uvw(xyz, uv); std::map<MVertex*,double>::const_iterator itv1 = _angles.find(e->getVertex(0)); std::map<MVertex*,double>::const_iterator itv2 = _angles.find(e->getVertex(1)); std::map<MVertex*,double>::const_iterator itv3 = _angles.find(e->getVertex(2)); - double cos4 = cos (4*itv1->second) * (1-uv2[0]-uv2[1]) + - cos (4*itv2->second) * uv2[0] + - cos (4*itv3->second) * uv2[1] ; - double sin4 = sin (4*itv1->second) * (1-uv2[0]-uv2[1]) + - sin (4*itv2->second) * uv2[0] + - sin (4*itv3->second) * uv2[1] ; + double cos4 = cos (4*itv1->second) * (1-uv[0]-uv[1]) + + cos (4*itv2->second) * uv[0] + + cos (4*itv3->second) * uv[1] ; + double sin4 = sin (4*itv1->second) * (1-uv[0]-uv[1]) + + sin (4*itv2->second) * uv[0] + + sin (4*itv3->second) * uv[1] ; double angle = atan2(sin4,cos4)/4.0; crossField2d::normalizeAngle (angle); diff --git a/Mesh/BackgroundMesh.h b/Mesh/BackgroundMesh.h index a8981b80b8a0bd0c18ec49a8cae1d3e12769677a..85b21450dde0efec2e8686403b177ce1f7be7bd2 100644 --- a/Mesh/BackgroundMesh.h +++ b/Mesh/BackgroundMesh.h @@ -54,8 +54,8 @@ class backgroundMesh : public simpleFunction<double> void propagate1dMesh(GFace *); void propagatecrossField(GFace *); void updateSizes(GFace *); - double operator () (double u, double v, double w) const; - double getAngle(double u, double v, double w) const ; + double operator () (double x, double y, double z) const; // returns mesh size + double getAngle(double x, double y, double z) const ; void print(const std::string &filename, GFace *gf, const std::map<MVertex*, double>&) const; void print(const std::string &filename, GFace *gf, int choice = 0) const