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

prepare cut plane in post + fx vector adaptiveView

parent 2ede7dee
No related branches found
No related tags found
No related merge requests found
......@@ -180,10 +180,6 @@ class Context_T {
int color_carousel;
int use_cut_plane, cut_plane_draw_intersect, cut_plane_only_volume;
double cut_planea, cut_planeb, cut_planec, cut_planed;
double evalCutPlane (double x, double y, double z)
{
return cut_planea * x + cut_planeb * y + cut_planec * z + cut_planed;
}
int save_all, save_groups_of_nodes, stl_binary, msh_binary, bdf_field_format;
int smooth_normals, reverse_all_normals;
double angle_smooth_normals;
......
// $Id: Mesh.cpp,v 1.222 2008-06-12 11:52:00 geuzaine Exp $
// $Id: Mesh.cpp,v 1.223 2008-06-27 13:50:35 geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
......@@ -92,13 +92,19 @@ static unsigned int getColorByElement(MElement *ele)
return CTX.color.fg;
}
static double evalCutPlane(double x, double y, double z)
{
return CTX.mesh.cut_planea * x + CTX.mesh.cut_planeb * y +
CTX.mesh.cut_planec * z + CTX.mesh.cut_planed;
}
static double intersectCutPlane(MElement *ele)
{
MVertex *v = ele->getVertex(0);
double val = CTX.mesh.evalCutPlane(v->x(), v->y(), v->z());
double val = evalCutPlane(v->x(), v->y(), v->z());
for(int i = 1; i < ele->getNumVertices(); i++){
v = ele->getVertex(i);
if(val * CTX.mesh.evalCutPlane(v->x(), v->y(), v->z()) <= 0)
if(val * evalCutPlane(v->x(), v->y(), v->z()) <= 0)
return 0.; // the element intersects the cut plane
}
return val;
......
// $Id: Post.cpp,v 1.169 2008-06-25 07:58:54 geuzaine Exp $
// $Id: Post.cpp,v 1.170 2008-06-27 13:50:35 geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
......@@ -279,15 +279,24 @@ static void changeCoordinates(PView *p, int ient, int iele, int numNodes,
}
}
/*
static double evalCutPlane(double x, double y, double z)
{
return CTX.mesh.cut_planea * x + CTX.mesh.cut_planeb * y +
CTX.mesh.cut_planec * z + CTX.mesh.cut_planed;
}
static double intersectCutPlane(int numNodes, double xyz[NMAX][3])
{
double val = CTX.mesh.evalCutPlane(xyz[0][0], xyz[0][1], xyz[0][2]);
double val = evalCutPlane(xyz[0][0], xyz[0][1], xyz[0][2]);
for(int i = 1; i < numNodes; i++){
if(val * CTX.mesh.evalCutPlane(xyz[i][0], xyz[i][1], xyz[i][2]) <= 0)
if(val * evalCutPlane(xyz[i][0], xyz[i][1], xyz[i][2]) <= 0)
return 0.; // the element intersects the cut plane
}
return val;
}
*/
static void addOutlinePoint(PView *p, double xyz[NMAX][3], unsigned int color,
bool pre, int i0=0)
......
......@@ -149,6 +149,7 @@ class PViewData {
// number of edges
void setInterpolationScheme(int type, List_T *coef, List_T *pol,
List_T *coefGeo=0, List_T *polGeo=0);
inline bool haveInterpolationScheme(){ return !_interpolation.empty(); }
int getInterpolationScheme(int type, std::vector<List_T*> &p);
// Smoothes the data in the view (makes it C0)
......
// $Id: PViewDataList.cpp,v 1.27 2008-06-27 08:41:50 remacle Exp $
// $Id: PViewDataList.cpp,v 1.28 2008-06-27 13:50:35 geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
......@@ -215,10 +215,10 @@ void PViewDataList::_stat(List_T *list, int nbcomp, int nbelm, int nbnod, int nb
// compute statistics for element lists
if(!nbelm) return;
if(haveInterpolationScheme()){
std::vector<List_T *> is;
if (getInterpolationScheme (nbedg,is) == 4) {
if(getInterpolationScheme(nbedg, is) == 4)
nbnod = List_Nbr(is[2]);
// printf("nbnod = %d\n",nbnod);
}
int nbval = nbcomp * nbnod;
......@@ -273,10 +273,10 @@ void PViewDataList::_stat(List_T *list, int nbcomp, int nbelm, int nbnod, int nb
void PViewDataList::_setLast(int ele, int dim, int nbnod, int nbcomp, int nbedg,
List_T *list, int nblist)
{
if(haveInterpolationScheme()){
std::vector<List_T *> is;
if (getInterpolationScheme (nbedg,is) == 4) {
if(getInterpolationScheme(nbedg, is) == 4)
nbnod = List_Nbr(is[2]);
// printf("hey hey : nbnod = %d\n",nbnod);
}
_lastDimension = dim;
......
......@@ -1036,14 +1036,13 @@ void adaptiveElements<T>::initWithLowResolution(PViewData *data, int step)
}
}
else if(numComp == 3){
const int offset = numVal/3;
for(int i = 0; i < offset ; i++){
for(int i = 0; i < numVal / 3; i++){
double val[3];
// adaptation of the visualization mesh bases on the norm
// squared of the vector
data->getValue(step, ent, ele, i, val[0]);
data->getValue(step, ent, ele, i + offset, val[1]);
data->getValue(step, ent, ele, i + 2*offset, val[2]);
data->getValue(step, ent, ele, 3 * i, val[0]);
data->getValue(step, ent, ele, 3 * i + 1, val[1]);
data->getValue(step, ent, ele, 3 * i + 2, val[2]);
(*_val)(k, i) = (val[0] * val[0] + val[1] * val[1] + val[2] * val[2]);
(*_valX)(k, i) = val[0];
(*_valY)(k, i) = val[1];
......@@ -1226,9 +1225,6 @@ adaptiveData::adaptiveData(PViewData *data)
*/
_outData = new PViewDataList(true);
// The number of nodes is supposed to be fixed in an adaptive view
// This number depends on the
int numComp = _inData->getNumComponents(0, 0, 0);
std::vector<List_T*> p;
if(_inData->getNumLines() && _inData->getInterpolationScheme(1, p) >= 2){
......
......@@ -297,6 +297,7 @@ class adaptiveElements {
~adaptiveElements();
void initWithLowResolution(PViewData *data, int step);
void changeResolution(int level, double tol, GMSH_Post_Plugin *plug=0);
// The number of nodes is supposed to be fixed in an adaptive view
inline int getNumNodes () const {return _coefsGeom ? _coefsGeom->size1() : T::numNodes;}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment