Skip to content
Snippets Groups Projects
Commit 2c6ccd7c authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

*** empty log message ***

parent 82531b29
No related branches found
No related tags found
No related merge requests found
// $Id: Iso.cpp,v 1.1 2001-08-07 21:00:43 remacle Exp $
// $Id: Iso.cpp,v 1.2 2001-08-09 13:27:41 remacle Exp $
#include "Gmsh.h"
#include "Mesh.h"
......@@ -261,3 +261,24 @@ void CutLine1D(double *X, double *Y, double *Z, double *Val,
}
void gradSimplex (double *x, double *y, double *z, double *v, double *grad){
/*
p = p1 * (1-u-v-w) + p2 u + p3 v + p4 w
*/
double mat[3][3];
double det,b[3];
mat[0][0] = x[1]-x[0];
mat[1][0] = x[2]-x[0];
mat[2][0] = x[3]-x[0];
mat[0][1] = y[1]-y[0];
mat[1][1] = y[2]-y[0];
mat[2][1] = y[3]-y[0];
mat[0][2] = z[1]-z[0];
mat[1][2] = z[2]-z[0];
mat[2][2] = z[3]-z[0];
b[0] = v[1]-v[0];
b[1] = v[2]-v[0];
b[2] = v[3]-v[0];
sys3x3 (mat, b, grad, &det);
}
#ifndef _ISO_H_
#define _ISO_H_
void gradSimplex (double *x, double *y, double *z, double *v, double *grad);
void CutTriangle1D (double *X, double *Y, double *Z, double *Val,
double V, double Vmin, double Vmax,
double *Xp, double *Yp, double *Zp, int *nb);
......
......@@ -5,34 +5,12 @@
#include "Draw.h"
#include "Iso.h"
#include "Context.h"
#include "Numeric.h"
#include "Views.h"
extern Context_T CTX;
// compute the gradient of a linear interpolation in a tetrahedron
void gradSimplex (double *x, double *y, double *z, double *v, double *grad){
/*
p = p1 * (1-u-v-w) + p2 u + p3 v + p4 w
*/
double mat[3][3];
double det,b[3];
mat[0][0] = x[1]-x[0];
mat[1][0] = x[2]-x[0];
mat[2][0] = x[3]-x[0];
mat[0][1] = y[1]-y[0];
mat[1][1] = y[2]-y[0];
mat[2][1] = y[3]-y[0];
mat[0][2] = z[1]-z[0];
mat[1][2] = z[2]-z[0];
mat[2][2] = z[3]-z[0];
b[0] = v[1]-v[0];
b[1] = v[2]-v[0];
b[2] = v[3]-v[0];
sys3x3 (mat, b, grad, &det);
}
void EnhanceSimplexPolygon (Post_View *View,
int nb, // nb of points in polygon
......
// $Id: LevelsetPlugin.cpp,v 1.11 2001-08-06 11:00:26 geuzaine Exp $
// $Id: LevelsetPlugin.cpp,v 1.12 2001-08-09 13:27:41 remacle Exp $
#include "LevelsetPlugin.h"
#include "List.h"
#include "Views.h"
#include "Iso.h"
/// Includes are basdly designed, i prefer forward decls.
void prodve (double a[3], double b[3], double c[3]);
void prosca (double a[3], double b[3], double *c);
void norme (double a[3]);
int sys3x3 (double mat[3][3], double b[3], double res[3], double *det);
GMSH_LevelsetPlugin::GMSH_LevelsetPlugin()
{
processed = 0;
......@@ -33,6 +39,7 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v)
a cut of the actual view with a levelset.
*/
int k,i,nb,edtet[6][2] = {{0,1},{0,2},{0,3},{1,2},{1,3},{2,3}};
double Xpi[6],Ypi[6],Zpi[6];
Post_View *View;
// for all scalar simplices
......@@ -90,6 +97,28 @@ Post_View *GMSH_LevelsetPlugin::execute (Post_View *v)
for(k=1;k<4;k++)List_Add(View->ST, &myVals[k %4]);
View->NbST++;
}
double v1[3] = {Xp[2]-Xp[0],Yp[2]-Yp[0],Zp[2]-Zp[0]};
double v2[3] = {Xp[1]-Xp[0],Yp[1]-Yp[0],Zp[1]-Zp[0]};
double gr[3];
double n[3],xx;
prodve(v1,v2,n);
norme(n);
gradSimplex(X,Y,Z,VAL,gr);
prosca(gr,n,&xx);
if(xx > 0){
for(i=0;i<nb;i++){
Xpi[i] = Xp[i];
Ypi[i] = Yp[i];
Zpi[i] = Zp[i];
}
for(i=0;i<nb;i++){
Xp[i] = Xpi[nb-i-1];
Yp[i] = Ypi[nb-i-1];
Zp[i] = Zpi[nb-i-1];
}
}
}
char name[1024],filename[1024];
......
# $Id: Makefile,v 1.12 2001-08-07 21:00:10 remacle Exp $
# $Id: Makefile,v 1.13 2001-08-09 13:27:41 remacle Exp $
#
# Makefile for "libAdapt.a"
#
......@@ -11,7 +11,7 @@ RM = rm
RANLIB = ranlib
LIB = ../lib/libPlugin.a
INCLUDE = -I../Common -I../Graphics -I../DataStr
INCLUDE = -I../Common -I../Graphics -I../DataStr -I../Mesh
C_FLAGS = -g -Wall
OS_FLAGS =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment