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

clean up

parent ea9b366f
Branches
Tags
No related merge requests found
/* $Id: Views.cpp,v 1.10 2000-11-27 17:13:39 geuzaine Exp $ */ /* $Id: Views.cpp,v 1.11 2000-11-27 17:34:00 geuzaine Exp $ */
#include "Gmsh.h" #include "Gmsh.h"
#include "Views.h" #include "Views.h"
...@@ -103,20 +103,17 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name, ...@@ -103,20 +103,17 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
if(ActualView->NbSP){ if(ActualView->NbSP){
nb = List_Nbr(ActualView->SP) / ActualView->NbSP ; nb = List_Nbr(ActualView->SP) / ActualView->NbSP ;
for(i = 0 ; i < List_Nbr(ActualView->SP) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->SP) ; i+=nb)
Stat_ScalarSimplex(1, (double*)List_Pointer(ActualView->SP,i), Stat_ScalarSimplex(1, nb-3, (double*)List_Pointer(ActualView->SP,i+3));
nb-3, (double*)List_Pointer(ActualView->SP,i+3));
} }
if(ActualView->NbVP){ if(ActualView->NbVP){
nb = List_Nbr(ActualView->VP) / ActualView->NbVP ; nb = List_Nbr(ActualView->VP) / ActualView->NbVP ;
for(i = 0 ; i < List_Nbr(ActualView->VP) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->VP) ; i+=nb)
Stat_VectorSimplex(1, (double*)List_Pointer(ActualView->VP,i), Stat_VectorSimplex(1, nb-3, (double*)List_Pointer(ActualView->VP,i+3));
nb-3, (double*)List_Pointer(ActualView->VP,i+3));
} }
if(ActualView->NbTP){ if(ActualView->NbTP){
nb = List_Nbr(ActualView->TP) / ActualView->NbTP ; nb = List_Nbr(ActualView->TP) / ActualView->NbTP ;
for(i = 0 ; i < List_Nbr(ActualView->TP) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->TP) ; i+=nb)
Stat_TensorSimplex(1, (double*)List_Pointer(ActualView->TP,i), Stat_TensorSimplex(1, nb-3, (double*)List_Pointer(ActualView->TP,i+3));
nb-3, (double*)List_Pointer(ActualView->TP,i+3));
} }
// Lines // Lines
...@@ -124,20 +121,17 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name, ...@@ -124,20 +121,17 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
if(ActualView->NbSL){ if(ActualView->NbSL){
nb = List_Nbr(ActualView->SL) / ActualView->NbSL ; nb = List_Nbr(ActualView->SL) / ActualView->NbSL ;
for(i = 0 ; i < List_Nbr(ActualView->SL) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->SL) ; i+=nb)
Stat_ScalarSimplex(2, (double*)List_Pointer(ActualView->SL,i), Stat_ScalarSimplex(2, nb-6, (double*)List_Pointer(ActualView->SL,i+6));
nb-6, (double*)List_Pointer(ActualView->SL,i+6));
} }
if(ActualView->NbVL){ if(ActualView->NbVL){
nb = List_Nbr(ActualView->VL) / ActualView->NbVL ; nb = List_Nbr(ActualView->VL) / ActualView->NbVL ;
for(i = 0 ; i < List_Nbr(ActualView->VL) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->VL) ; i+=nb)
Stat_VectorSimplex(2, (double*)List_Pointer(ActualView->VL,i), Stat_VectorSimplex(2, nb-6, (double*)List_Pointer(ActualView->VL,i+6));
nb-6, (double*)List_Pointer(ActualView->VL,i+6));
} }
if(ActualView->NbTL){ if(ActualView->NbTL){
nb = List_Nbr(ActualView->TL) / ActualView->NbTL ; nb = List_Nbr(ActualView->TL) / ActualView->NbTL ;
for(i = 0 ; i < List_Nbr(ActualView->TL) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->TL) ; i+=nb)
Stat_TensorSimplex(2, (double*)List_Pointer(ActualView->TL,i), Stat_TensorSimplex(2, nb-6, (double*)List_Pointer(ActualView->TL,i+6));
nb-6, (double*)List_Pointer(ActualView->TL,i+6));
} }
// Triangles // Triangles
...@@ -145,20 +139,17 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name, ...@@ -145,20 +139,17 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
if(ActualView->NbST){ if(ActualView->NbST){
nb = List_Nbr(ActualView->ST) / ActualView->NbST ; nb = List_Nbr(ActualView->ST) / ActualView->NbST ;
for(i = 0 ; i < List_Nbr(ActualView->ST) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->ST) ; i+=nb)
Stat_ScalarSimplex(3, (double*)List_Pointer(ActualView->ST,i), Stat_ScalarSimplex(3, nb-9, (double*)List_Pointer(ActualView->ST,i+9));
nb-9, (double*)List_Pointer(ActualView->ST,i+9));
} }
if(ActualView->NbVT){ if(ActualView->NbVT){
nb = List_Nbr(ActualView->VT) / ActualView->NbVT ; nb = List_Nbr(ActualView->VT) / ActualView->NbVT ;
for(i = 0 ; i < List_Nbr(ActualView->VT) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->VT) ; i+=nb)
Stat_VectorSimplex(3, (double*)List_Pointer(ActualView->VT,i), Stat_VectorSimplex(3, nb-9, (double*)List_Pointer(ActualView->VT,i+9));
nb-9, (double*)List_Pointer(ActualView->VT,i+9));
} }
if(ActualView->NbTT){ if(ActualView->NbTT){
nb = List_Nbr(ActualView->TT) / ActualView->NbTT ; nb = List_Nbr(ActualView->TT) / ActualView->NbTT ;
for(i = 0 ; i < List_Nbr(ActualView->TT) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->TT) ; i+=nb)
Stat_TensorSimplex(3, (double*)List_Pointer(ActualView->TT,i), Stat_TensorSimplex(3, nb-9, (double*)List_Pointer(ActualView->TT,i+9));
nb-9, (double*)List_Pointer(ActualView->TT,i+9));
} }
// Tetrahedra // Tetrahedra
...@@ -166,20 +157,17 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name, ...@@ -166,20 +157,17 @@ void EndView(int AddInUI, int Number, char *FileName, char *Name,
if(ActualView->NbSS){ if(ActualView->NbSS){
nb = List_Nbr(ActualView->SS) / ActualView->NbSS ; nb = List_Nbr(ActualView->SS) / ActualView->NbSS ;
for(i = 0 ; i < List_Nbr(ActualView->SS) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->SS) ; i+=nb)
Stat_ScalarSimplex(4, (double*)List_Pointer(ActualView->SS,i), Stat_ScalarSimplex(4, nb-12, (double*)List_Pointer(ActualView->SS,i+12));
nb-12, (double*)List_Pointer(ActualView->SS,i+12));
} }
if(ActualView->NbVS){ if(ActualView->NbVS){
nb = List_Nbr(ActualView->VS) / ActualView->NbVS ; nb = List_Nbr(ActualView->VS) / ActualView->NbVS ;
for(i = 0 ; i < List_Nbr(ActualView->VS) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->VS) ; i+=nb)
Stat_VectorSimplex(4, (double*)List_Pointer(ActualView->VS,i), Stat_VectorSimplex(4, nb-12, (double*)List_Pointer(ActualView->VS,i+12));
nb-12, (double*)List_Pointer(ActualView->VS,i+12));
} }
if(ActualView->NbTS){ if(ActualView->NbTS){
nb = List_Nbr(ActualView->TS) / ActualView->NbTS ; nb = List_Nbr(ActualView->TS) / ActualView->NbTS ;
for(i = 0 ; i < List_Nbr(ActualView->TS) ; i+=nb) for(i = 0 ; i < List_Nbr(ActualView->TS) ; i+=nb)
Stat_TensorSimplex(4, (double*)List_Pointer(ActualView->TS,i), Stat_TensorSimplex(4, nb-12, (double*)List_Pointer(ActualView->TS,i+12));
nb-12, (double*)List_Pointer(ActualView->TS,i+12));
} }
// Dummy time values if using old parsed format... // Dummy time values if using old parsed format...
...@@ -290,11 +278,8 @@ void CopyViewOptions(Post_View *src, Post_View *dest){ ...@@ -290,11 +278,8 @@ void CopyViewOptions(Post_View *src, Post_View *dest){
/* S t a t _ X X X S i m p l e x */ /* S t a t _ X X X S i m p l e x */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
void Stat_ScalarSimplex(int nbnod, double *coord, int N, double *V){ void Stat_ScalarSimplex(int nbnod, int N, double *V){
int i; int i;
double *X, *Y, *Z;
X = &coord[0] ; Y = &coord[nbnod] ; Z = &coord[2*nbnod] ;
if(!NbPoints && !NbLines && !NbTriangles && !NbTetrahedra){ if(!NbPoints && !NbLines && !NbTriangles && !NbTetrahedra){
ActualView->Min = V[0]; ActualView->Min = V[0];
...@@ -317,12 +302,9 @@ void Stat_ScalarSimplex(int nbnod, double *coord, int N, double *V){ ...@@ -317,12 +302,9 @@ void Stat_ScalarSimplex(int nbnod, double *coord, int N, double *V){
} }
} }
void Stat_VectorSimplex(int nbnod, double *coord, int N, double *V){ void Stat_VectorSimplex(int nbnod, int N, double *V){
double l0; double l0;
int i; int i;
double *X, *Y, *Z;
X = &coord[0] ; Y = &coord[nbnod] ; Z = &coord[2*nbnod] ;
if(!NbPoints && !NbLines && !NbTriangles && !NbTetrahedra){ if(!NbPoints && !NbLines && !NbTriangles && !NbTetrahedra){
l0 = sqrt(DSQR(V[0])+DSQR(V[1])+DSQR(V[2])); l0 = sqrt(DSQR(V[0])+DSQR(V[1])+DSQR(V[2]));
...@@ -349,7 +331,7 @@ void Stat_VectorSimplex(int nbnod, double *coord, int N, double *V){ ...@@ -349,7 +331,7 @@ void Stat_VectorSimplex(int nbnod, double *coord, int N, double *V){
} }
} }
void Stat_TensorSimplex(int nbnod, double *coord, int N, double *v){ void Stat_TensorSimplex(int nbnod, int N, double *v){
Msg(ERROR, "Tensor Field Views not Implemented Yet"); Msg(ERROR, "Tensor Field Views not Implemented Yet");
} }
......
/* $Id: Views.h,v 1.8 2000-11-27 14:23:18 geuzaine Exp $ */ /* $Id: Views.h,v 1.9 2000-11-27 17:34:00 geuzaine Exp $ */
#ifndef _VIEWS_H_ #ifndef _VIEWS_H_
#define _VIEWS_H_ #define _VIEWS_H_
...@@ -78,9 +78,9 @@ void FreeView(Post_View *v); ...@@ -78,9 +78,9 @@ void FreeView(Post_View *v);
void Read_View(FILE *file, char *filename); void Read_View(FILE *file, char *filename);
void CopyViewOptions(Post_View *src, Post_View *dest); void CopyViewOptions(Post_View *src, Post_View *dest);
void Stat_ScalarSimplex(int nbnod, double *coord, int N, double *v); void Stat_ScalarSimplex(int nbnod, int N, double *v);
void Stat_VectorSimplex(int nbnod, double *coord, int N, double *v); void Stat_VectorSimplex(int nbnod, int N, double *v);
void Stat_TensorSimplex(int nbnod, double *coord, int N, double *v); void Stat_TensorSimplex(int nbnod, int N, double *v);
int BGMWithView (Post_View *ErrView); int BGMWithView (Post_View *ErrView);
int CreateBGM(Post_View *ErrView, int OptiMethod, double Degree, int CreateBGM(Post_View *ErrView, int OptiMethod, double Degree,
......
/* $Id: 3D_BGMesh.cpp,v 1.10 2000-11-27 10:58:56 geuzaine Exp $ */ /* $Id: 3D_BGMesh.cpp,v 1.11 2000-11-27 17:34:00 geuzaine Exp $ */
#include "Gmsh.h" #include "Gmsh.h"
#include "Mesh.h" #include "Mesh.h"
...@@ -221,7 +221,7 @@ int BGMWithView (Post_View * ErrView){ ...@@ -221,7 +221,7 @@ int BGMWithView (Post_View * ErrView){
double ErrorInView (Post_View * ErrView, int *n){ double ErrorInView (Post_View * ErrView, int *n){
double e, tot=0.0, *X, *Y, *Z, *Val; double e, tot=0.0, *Val;
int i, j=0, nb; int i, j=0, nb;
if(ErrView == NULL){ if(ErrView == NULL){
...@@ -232,9 +232,6 @@ double ErrorInView (Post_View * ErrView, int *n){ ...@@ -232,9 +232,6 @@ double ErrorInView (Post_View * ErrView, int *n){
if(ErrView->NbST){ if(ErrView->NbST){
nb = List_Nbr(ErrView->ST) / ErrView->NbST ; nb = List_Nbr(ErrView->ST) / ErrView->NbST ;
for(i = 0 ; i < List_Nbr(ErrView->ST) ; i+=nb){ for(i = 0 ; i < List_Nbr(ErrView->ST) ; i+=nb){
X = (double*)List_Pointer_Fast(ErrView->ST,i);
Y = (double*)List_Pointer_Fast(ErrView->ST,i+3);
Z = (double*)List_Pointer_Fast(ErrView->ST,i+6);
Val = (double*)List_Pointer_Fast(ErrView->ST,i+9); Val = (double*)List_Pointer_Fast(ErrView->ST,i+9);
e = (Val[0] + Val[1] + Val[2]) / 3. ; e = (Val[0] + Val[1] + Val[2]) / 3. ;
tot += e * e; tot += e * e;
...@@ -245,9 +242,6 @@ double ErrorInView (Post_View * ErrView, int *n){ ...@@ -245,9 +242,6 @@ double ErrorInView (Post_View * ErrView, int *n){
if(ErrView->NbSS){ if(ErrView->NbSS){
nb = List_Nbr(ErrView->SS) / ErrView->NbSS ; nb = List_Nbr(ErrView->SS) / ErrView->NbSS ;
for(i = 0 ; i < List_Nbr(ErrView->SS) ; i+=nb){ for(i = 0 ; i < List_Nbr(ErrView->SS) ; i+=nb){
X = (double*)List_Pointer_Fast(ErrView->SS,i);
Y = (double*)List_Pointer_Fast(ErrView->SS,i+3);
Z = (double*)List_Pointer_Fast(ErrView->SS,i+8);
Val = (double*)List_Pointer_Fast(ErrView->SS,i+12); Val = (double*)List_Pointer_Fast(ErrView->SS,i+12);
e = (Val[0] + Val[1] + Val[2] + Val[3]) * 0.25 ; e = (Val[0] + Val[1] + Val[2] + Val[3]) * 0.25 ;
tot += e * e; tot += e * e;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment