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

Detect when we have zero lc and fix it (+ send an error message)
parent b25143ae
No related branches found
No related tags found
No related merge requests found
// $Id: BackgroundMesh.cpp,v 1.26 2007-10-10 08:49:34 remacle Exp $ // $Id: BackgroundMesh.cpp,v 1.27 2007-11-08 19:29:50 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -182,21 +182,26 @@ double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double ...@@ -182,21 +182,26 @@ double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double
double l3 = CTX.lc; double l3 = CTX.lc;
double l4 = lc_field.empty() ? MAX_LC : lc_field(X, Y, Z); double l4 = lc_field.empty() ? MAX_LC : lc_field(X, Y, Z);
// use the field unconstrained by other characteristic lengths double lc;
if(!lc_field.empty() && !CTX.mesh.constrained_bgmesh)
return l4 * CTX.mesh.lc_factor;
if(!lc_field.empty() && !CTX.mesh.constrained_bgmesh){
// use the fields unconstrained by other characteristic lengths
lc = l4 * CTX.mesh.lc_factor;
}
else{
if(CTX.mesh.lc_from_curvature && ge->dim() < 3) if(CTX.mesh.lc_from_curvature && ge->dim() < 3)
l1 = LC_MVertex_CURV(ge, U, V); l1 = LC_MVertex_CURV(ge, U, V);
if(ge->dim() < 2) if(ge->dim() < 2)
l2 = LC_MVertex_PNTS(ge, U, V); l2 = LC_MVertex_PNTS(ge, U, V);
lc = std::min(std::min(std::min(l1, l2), l3), l4) * CTX.mesh.lc_factor;
}
// printf("l1 = %12.5E l2 = %12.5E l4 = %12.5E\n",l1,l2,l4); if(lc <= 0.){
Msg(GERROR, "Incorrect char. length lc = %g: using default instead", lc);
double lc = std::min(std::min(std::min(l1, l2), l3), l4); return l3 * CTX.mesh.lc_factor;
}
return lc * CTX.mesh.lc_factor; return lc;
} }
// we extend the 1d mesh in surfaces if no background mesh exists // we extend the 1d mesh in surfaces if no background mesh exists
...@@ -205,7 +210,7 @@ double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double ...@@ -205,7 +210,7 @@ double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double
bool Extend1dMeshIn2dSurfaces() bool Extend1dMeshIn2dSurfaces()
{ {
if(lc_field.empty()) return true; if(lc_field.empty()) return true;
if ( CTX.mesh.constrained_bgmesh == true) return true; if(CTX.mesh.constrained_bgmesh) return true;
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment