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

add line elements in octree + little nicer Probe drawing
parent 4fddfb0f
No related branches found
No related tags found
No related merge requests found
// $Id: OctreePost.cpp,v 1.15 2005-03-04 19:08:38 geuzaine Exp $
// $Id: OctreePost.cpp,v 1.16 2005-12-17 22:26:44 geuzaine Exp $
//
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
//
......@@ -63,6 +63,12 @@ static void centroid(int n, double *X, double *Y, double *Z, double *c)
c[2] *= oc;
}
void linBB(void *a, double *min, double *max)
{
double *X = (double*) a, *Y = &X[2], *Z = &X[4];
minmax(2, X, Y, Z, min, max);
}
void triBB(void *a, double *min, double *max)
{
double *X = (double*) a, *Y = &X[3], *Z = &X[6];
......@@ -99,6 +105,14 @@ void pyrBB(void *a, double *min, double *max)
minmax(5, X, Y, Z, min, max);
}
int linInEle(void *a, double *x)
{
double *X = (double*) a, *Y = &X[2], *Z = &X[4], uvw[3];
line lin(X, Y, Z);
lin.xyz2uvw(x, uvw);
return lin.isInside(uvw[0], uvw[1], uvw[2]);
}
int triInEle(void *a, double *x)
{
double *X = (double*) a, *Y = &X[3], *Z = &X[6], uvw[3];
......@@ -147,6 +161,12 @@ int pyrInEle(void *a, double *x)
return pyr.isInside(uvw[0], uvw[1], uvw[2]);
}
void linCentroid(void *a, double *x)
{
double *X = (double*) a, *Y = &X[2], *Z = &X[4];
centroid(2, X, Y, Z, x);
}
void triCentroid(void *a, double *x)
{
double *X = (double*) a, *Y = &X[3], *Z = &X[6];
......@@ -214,6 +234,16 @@ OctreePost::OctreePost(Post_View *v)
const int maxElePerBucket = 100; // memory vs. speed trade-off
SL = Octree_Create(maxElePerBucket, min, size, linBB, linCentroid, linInEle);
addListOfStuff(SL, v->SL, 6 + 2 * v->NbTimeStep);
Octree_Arrange(SL);
VL = Octree_Create(maxElePerBucket, min, size, linBB, linCentroid, linInEle);
addListOfStuff(VL, v->VL, 6 + 6 * v->NbTimeStep);
Octree_Arrange(VL);
TL = Octree_Create(maxElePerBucket, min, size, linBB, linCentroid, linInEle);
addListOfStuff(TL, v->TL, 6 + 18 * v->NbTimeStep);
Octree_Arrange(TL);
ST = Octree_Create(maxElePerBucket, min, size, triBB, triCentroid, triInEle);
addListOfStuff(ST, v->ST, 9 + 3 * v->NbTimeStep);
Octree_Arrange(ST);
......@@ -323,6 +353,7 @@ bool OctreePost::searchScalar(double x, double y, double z, double *values,
if(getValue(Octree_Search(P, SY), 3, 5, 1, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, ST), 2, 3, 1, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, SQ), 2, 4, 1, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, SL), 1, 2, 1, P, timestep, values, size_elem)) return true;
return false;
}
......@@ -345,6 +376,7 @@ bool OctreePost::searchVector(double x, double y, double z, double *values,
if(getValue(Octree_Search(P, VY), 3, 5, 3, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, VT), 2, 3, 3, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, VQ), 2, 4, 3, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, VL), 1, 2, 3, P, timestep, values, size_elem)) return true;
return false;
}
......@@ -367,6 +399,7 @@ bool OctreePost::searchTensor(double x, double y, double z, double *values,
if(getValue(Octree_Search(P, TY), 3, 5, 9, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, TT), 2, 3, 9, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, TQ), 2, 4, 9, P, timestep, values, size_elem)) return true;
if(getValue(Octree_Search(P, TL), 1, 2, 9, P, timestep, values, size_elem)) return true;
return false;
}
......@@ -26,6 +26,7 @@ class Post_View;
class OctreePost
{
Octree *SL, *VL, *TL;
Octree *ST, *VT, *TT;
Octree *SQ, *VQ, *TQ;
Octree *SS, *VS, *TS;
......@@ -38,11 +39,11 @@ class OctreePost
public :
OctreePost(Post_View *);
~OctreePost();
// search for the value of the View at point
// x, y, z. Values is interpolated linearly in
// the post element. If several time steps
// are present, they are all interpolated unless
// time step is set to a different value than -1.
// search for the value of the View at point x, y, z. Values are
// interpolated using standard first order shape functions in the
// post element. If several time steps are present, they are all
// interpolated unless time step is set to a different value than
// -1.
bool searchScalar(double x, double y, double z, double *values,
int timestep = -1, double *size_elem = 0);
bool searchVector(double x, double y, double z, double *values,
......
// $Id: Probe.cpp,v 1.10 2005-03-09 02:19:09 geuzaine Exp $
// $Id: Probe.cpp,v 1.11 2005-12-17 22:26:44 geuzaine Exp $
//
// Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
//
......@@ -86,6 +86,7 @@ void GMSH_ProbePlugin::draw()
glVertex3d(x,y,z-d); glVertex3d(x,y,z+d);
glEnd();
}
Draw_Point(1, CTX.point_size, &x, &y, &z, 1);
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment