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

Generalized the smoothing of post-processing views (quads, etc.)
parent 330b1fab
No related branches found
No related tags found
No related merge requests found
// $Id: Views.cpp,v 1.82 2002-11-16 08:29:14 geuzaine Exp $ // $Id: Views.cpp,v 1.83 2002-12-02 05:58:37 geuzaine Exp $
// //
// Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
// //
...@@ -959,14 +959,11 @@ public : ...@@ -959,14 +959,11 @@ public :
mycont c; mycont c;
}; };
void smooth_list (List_T *SS , double *min, double *max, void generate_connectivities (List_T *SS , int NbTimeStep, int nbvert, int nb,
int NbTimeStep, int nbvert, int nb,
mycont & connectivities){ mycont & connectivities){
double *x,*y,*z,*v; double *x,*y,*z,*v;
int i,j,k; int i,j,k;
double *vals = new double[NbTimeStep]; double vals[NbTimeStep];
*min = VAL_INF;
*max = -VAL_INF;
for(i = 0 ; i < List_Nbr(SS) ; i+=nb){ for(i = 0 ; i < List_Nbr(SS) ; i+=nb){
x = (double*)List_Pointer_Fast(SS,i); x = (double*)List_Pointer_Fast(SS,i);
...@@ -983,12 +980,22 @@ void smooth_list (List_T *SS , double *min, double *max, ...@@ -983,12 +980,22 @@ void smooth_list (List_T *SS , double *min, double *max,
connectivities.insert(xyz); connectivities.insert(xyz);
} }
else{ else{
xyzv *xx = (xyzv*) &(*it); // a little weird ... becaus we know that // a little weird ... because we know that this will not
// this will not destroy the set ordering // destroy the set ordering
xyzv *xx = (xyzv*) &(*it);
xx->update(NbTimeStep,vals); xx->update(NbTimeStep,vals);
} }
} }
} }
}
void smooth_list (List_T *SS , double *min, double *max,
int NbTimeStep, int nbvert, int nb,
mycont & connectivities){
double *x,*y,*z,*v;
int i,j,k;
*min = VAL_INF;
*max = -VAL_INF;
for(i = 0 ; i < List_Nbr(SS) ; i+=nb){ for(i = 0 ; i < List_Nbr(SS) ; i+=nb){
x = (double*)List_Pointer_Fast(SS,i); x = (double*)List_Pointer_Fast(SS,i);
...@@ -1007,25 +1014,51 @@ void smooth_list (List_T *SS , double *min, double *max, ...@@ -1007,25 +1014,51 @@ void smooth_list (List_T *SS , double *min, double *max,
} }
} }
} }
delete [] vals;
} }
void Post_View :: smooth (){ void Post_View :: smooth (){
xyzv::eps = CTX.lc * 1.e-8; xyzv::eps = CTX.lc * 1.e-8;
int nb;
if(NbSS){ if(NbSL || NbST || NbSQ || NbSS || NbSH || NbSI || NbSY){
mycont conSS; mycont con;
Msg(INFO,"Smoothing scalar tetrahedra in view..."); int nbl=0, nbt=0, nbq=0, nbs=0, nbh=0, nbi=0, nby=0;
nb = List_Nbr(SS) / NbSS ; Msg(INFO,"Smoothing scalar primitives in view...");
smooth_list (SS , &Min, &Max, NbTimeStep, 4, nb, conSS); if(NbSL){
Msg(INFO,"...done"); nbt = List_Nbr(SL) / NbSL ;
generate_connectivities(SL , NbTimeStep, 2, nbl, con);
} }
if(NbST){ if(NbST){
mycont conST; nbt = List_Nbr(ST) / NbST ;
Msg(INFO,"Smoothing scalar triangles in view..."); generate_connectivities(ST , NbTimeStep, 3, nbt, con);
nb = List_Nbr(ST) / NbST ; }
smooth_list (ST , &Min, &Max, NbTimeStep, 3, nb, conST); if(NbSQ){
nbq = List_Nbr(SQ) / NbSQ ;
generate_connectivities(SQ , NbTimeStep, 4, nbq, con);
}
if(NbSS){
nbs = List_Nbr(SS) / NbSS ;
generate_connectivities(SS , NbTimeStep, 4, nbs, con);
}
if(NbSH){
nbh = List_Nbr(SH) / NbSH ;
generate_connectivities(SH , NbTimeStep, 8, nbh, con);
}
if(NbSI){
nbi = List_Nbr(SI) / NbSI ;
generate_connectivities(SI , NbTimeStep, 6, nbi, con);
}
if(NbSY){
nby = List_Nbr(SY) / NbSY ;
generate_connectivities(SY , NbTimeStep, 5, nby, con);
}
if(nbl) smooth_list(SL , &Min, &Max, NbTimeStep, 2, nbl, con);
if(nbt) smooth_list(ST , &Min, &Max, NbTimeStep, 3, nbt, con);
if(nbq) smooth_list(SQ , &Min, &Max, NbTimeStep, 4, nbq, con);
if(nbs) smooth_list(SS , &Min, &Max, NbTimeStep, 4, nbs, con);
if(nbh) smooth_list(SH , &Min, &Max, NbTimeStep, 8, nbh, con);
if(nbi) smooth_list(SI , &Min, &Max, NbTimeStep, 6, nbi, con);
if(nby) smooth_list(SY , &Min, &Max, NbTimeStep, 5, nby, con);
Msg(INFO,"...done"); Msg(INFO,"...done");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment