From c4de3fbeb8e8132002e8a69e948b70a45fdc51ab Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 2 Jun 2009 07:47:33 +0000 Subject: [PATCH] avoid crash when not using adaptive drawing on high-order views --- Geo/GModel.cpp | 2 +- Graphics/drawPost.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 9b525febb8..8bae76f4ea 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -66,7 +66,7 @@ GModel::~GModel() GModel *GModel::current(int index) { if(list.empty()){ - Msg::Error("No current model available: creating one"); + Msg::Warning("No current model available: creating one"); new GModel(); } if(index >= 0) _current = index; diff --git a/Graphics/drawPost.cpp b/Graphics/drawPost.cpp index 06615c6bc8..4135b3f3a1 100644 --- a/Graphics/drawPost.cpp +++ b/Graphics/drawPost.cpp @@ -947,6 +947,14 @@ static void addElementsInArrays(PView *p, bool preprocessNormalsOnly) if(opt->skipElement(numEdges)) continue; int numComp = data->getNumComponents(opt->timeStep, ent, i); int numNodes = data->getNumNodes(opt->timeStep, ent, i); + if(numNodes > 20){ + Msg::Error("Should never draw view with > 20 nodes per element: adapt?"); + continue; + } + if(numComp > 9){ + Msg::Error("Should never draw view with > 9 components: adapt?"); + continue; + } for(int j = 0; j < numNodes; j++){ data->getNode(opt->timeStep, ent, i, j, xyz[j][0], xyz[j][1], xyz[j][2]); for(int k = 0; k < numComp; k++) -- GitLab