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

- better fallback when outside the octree
- disable bgm when optimizing in netgen
parent f52fb269
No related branches found
No related tags found
No related merge requests found
// $Id: 3D_BGMesh.cpp,v 1.40 2006-01-28 18:44:19 geuzaine Exp $
// $Id: 3D_BGMesh.cpp,v 1.41 2006-01-28 19:53:18 geuzaine Exp $
//
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
//
......@@ -30,18 +30,20 @@ extern Mesh *THEM;
extern Context_T CTX;
static OctreePost *BGM_OCTREE = NULL;
static double BGM_MAX = 0.;
int BGMWithView(Post_View * ErrView)
{
if(BGM_OCTREE) delete BGM_OCTREE;
BGM_OCTREE = new OctreePost(ErrView);
BGM_MAX = ErrView->Max;
Create_BgMesh(ONFILE, .2, THEM);
return 1 ;
}
double Lc_XYZ(double X, double Y, double Z, Mesh * m)
{
double l;
double l, fact[6] = {0.001, 0.005, 0.01, 0.05, 0.1, 0.5};
switch (m->BGM.Typ) {
case FUNCTION:
......@@ -52,7 +54,18 @@ double Lc_XYZ(double X, double Y, double Z, Mesh * m)
l = m->BGM.lc;
break;
case ONFILE:
BGM_OCTREE->searchScalar(X, Y, Z, &l, 0);
if(!BGM_OCTREE->searchScalar(X, Y, Z, &l, 0)){
for(int i = 0; i < 6; i++){
double eps = CTX.lc * fact[i];
if(BGM_OCTREE->searchScalar(X + eps, Y, Z, &l, 0)) break;
if(BGM_OCTREE->searchScalar(X - eps, Y, Z, &l, 0)) break;
if(BGM_OCTREE->searchScalar(X, Y + eps, Z, &l, 0)) break;
if(BGM_OCTREE->searchScalar(X, Y - eps, Z, &l, 0)) break;
if(BGM_OCTREE->searchScalar(X, Y, Z + eps, &l, 0)) break;
if(BGM_OCTREE->searchScalar(X, Y, Z - eps, &l, 0)) break;
}
}
if(l <= 0) l = BGM_MAX;
break;
case WITHPOINTS:
Msg(GERROR, "We should never call Lc_XYZ with BGM.Typ == WITHPOINTS!");
......@@ -61,7 +74,7 @@ double Lc_XYZ(double X, double Y, double Z, Mesh * m)
}
if(l <= 0.){
Msg(WARNING, "Characteristic length <= 0: setting to LC/10");
Msg(WARNING, "Characteristic length <= 0 at point (%g,%g,%g)", X, Y, Z);
l = CTX.lc / 10.;
}
......
// $Id: 3D_Mesh_Netgen.cpp,v 1.18 2006-01-06 00:34:26 geuzaine Exp $
// $Id: 3D_Mesh_Netgen.cpp,v 1.19 2006-01-28 19:53:18 geuzaine Exp $
//
// Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
//
......@@ -312,7 +312,11 @@ void Optimize_Netgen(Mesh *m)
Msg(STATUS2, "Optimize volume mesh...");
double t1 = Cpu();
Degre1(); // cleanup 2nd order vertices, if any
// cleanup 2nd order vertices, if any
Degre1();
// make sure we don't use any fancy background mesh
Create_BgMesh(WITHPOINTS, .2, m);
List_T *list = Tree2List(m->Volumes);
for(int i = 0; i < List_Nbr(list); i++){
......
$Id: VERSIONS,v 1.355 2006-01-28 05:26:43 geuzaine Exp $
$Id: VERSIONS,v 1.356 2006-01-28 19:53:18 geuzaine Exp $
New since 1.62: post-processing views can now also be exported as
meshes; small bug fixes and enhancements.
New since 1.62: post-processing views can now also be exported as
meshes; speedup generation of meshes w/ background characteristic
length fields from post-pro views; small bug fixes and enhancements.
New in 1.62: new option to draw color gradients in the background;
enhanced perspective projection mode; new "lasso" selection mode (same
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment