diff --git a/Common/Context.h b/Common/Context.h index cd9f0e69c1d3316746517b1c97bf45d10cbb8c60..169e5478dbcd6c0efbd8dc8dd4e3565034bb990d 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -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; diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp index 535d2ada902db34238540b91cea8746a4f611aee..93d27de4d88e1ad31a3554d3dc69676c56d0f4e5 100644 --- a/Graphics/Mesh.cpp +++ b/Graphics/Mesh.cpp @@ -1,4 +1,4 @@ -// $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; diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index 4157718dc8ce7dfd28f458d8f97f5c3680fcaf2f..02a486dd5301d634c6198877d9b62ec763e95a46 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $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) diff --git a/Post/PViewData.h b/Post/PViewData.h index 5e01ed472e6da27bd4d9869825f86121b999236c..d67dbec19c0d9701c74962810667c41b09765a78 100644 --- a/Post/PViewData.h +++ b/Post/PViewData.h @@ -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) diff --git a/Post/PViewDataList.cpp b/Post/PViewDataList.cpp index 3623a539fd9f0716f62394b3feecb8db4f65489b..1e0e38e25a62208dc560beee9322a3997d73df82 100644 --- a/Post/PViewDataList.cpp +++ b/Post/PViewDataList.cpp @@ -1,4 +1,4 @@ -// $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; - std::vector<List_T *> is; - if (getInterpolationScheme (nbedg,is) == 4) { - nbnod = List_Nbr(is[2]); - // printf("nbnod = %d\n",nbnod); + if(haveInterpolationScheme()){ + std::vector<List_T *> is; + if(getInterpolationScheme(nbedg, is) == 4) + nbnod = List_Nbr(is[2]); } 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) { - std::vector<List_T *> is; - if (getInterpolationScheme (nbedg,is) == 4) { - nbnod = List_Nbr(is[2]); - // printf("hey hey : nbnod = %d\n",nbnod); + if(haveInterpolationScheme()){ + std::vector<List_T *> is; + if(getInterpolationScheme(nbedg, is) == 4) + nbnod = List_Nbr(is[2]); } _lastDimension = dim; diff --git a/Post/adaptiveData.cpp b/Post/adaptiveData.cpp index d0f4791b80e56e2c3fcf9ab86b1a0cc045cdcce5..2b0c8d1758a9a0705549233b56137b9c705142b5 100644 --- a/Post/adaptiveData.cpp +++ b/Post/adaptiveData.cpp @@ -1014,7 +1014,7 @@ void adaptiveElements<T>::initWithLowResolution(PViewData *data, int step) if(data->skipElement(step, ent, ele) || data->getNumEdges(step, ent, ele) != T::numEdges) continue; if(numVal != data->getNumValues(step, ent, ele)){ - Msg::Error("Wrong number of values (%d) in element %d (expecting %d)", numVal, ele,data->getNumValues(step, ent, ele)); + Msg::Error("Wrong number of values (%d) in element %d (expecting %d)", numVal, ele, data->getNumValues(step, ent, ele)); continue; } if(numNodes != data->getNumNodes(step, ent, ele)){ @@ -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){ diff --git a/Post/adaptiveData.h b/Post/adaptiveData.h index 1257d1177059611a149d8ae0972f9fe71b0faba2..e1809451083d5f4ac5b994a7edcebfa06b3f7731 100644 --- a/Post/adaptiveData.h +++ b/Post/adaptiveData.h @@ -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;} };