From a9a5b33e09e95c21662436992f6fbed24a4ee2c9 Mon Sep 17 00:00:00 2001 From: Michel Rasquin <michel.rasquin@cenaero.be> Date: Fri, 21 Oct 2016 07:30:45 +0000 Subject: [PATCH] Fix tolerance based adaptation for ParaView plugin --- Post/adaptiveData.cpp | 16 +++++++++++----- Post/adaptiveData.h | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Post/adaptiveData.cpp b/Post/adaptiveData.cpp index 93c3ff99c4..f75b4713fe 100644 --- a/Post/adaptiveData.cpp +++ b/Post/adaptiveData.cpp @@ -8,6 +8,7 @@ #include <set> #include <algorithm> #include "adaptiveData.h" +#include "PViewDataGModel.h" #include "Plugin.h" #include "OS.h" #include "GmshDefines.h" @@ -2193,7 +2194,8 @@ template <class T> void adaptiveElements<T>::adaptForVTK(double tol, int numComp, std::vector<PCoords> &coords, - std::vector<PValues> &values) + std::vector<PValues> &values, + double &minVal, double &maxVal) { int numVertices = T::allVertices.size(); @@ -2238,8 +2240,6 @@ void adaptiveElements<T>::adaptForVTK(double tol, _interpolVal->mult(val, res); - double minVal = VAL_INF; - double maxVal = -VAL_INF; for(int i = 0; i < numVertices; i++){ minVal = std::min(minVal, res(i)); maxVal = std::max(maxVal, res(i)); @@ -2450,7 +2450,13 @@ void adaptiveElements<T>::addInViewForVTK(int step, // New variables for high order visualiztion through vtk files int numNodInsert; nodMap<T> myNodMap; - + + double minVal; + double maxVal; + PViewDataGModel* tmpPViewDataGModel = dynamic_cast<PViewDataGModel*>(in); + minVal = tmpPViewDataGModel->getMin(step); + maxVal = tmpPViewDataGModel->getMax(step); + for(int ent = 0; ent < in->getNumEntities(step); ent++){ for(int ele = 0; ele < in->getNumElements(step, ent); ele++){ if(in->skipElement(step, ent, ele) || @@ -2501,7 +2507,7 @@ void adaptiveElements<T>::addInViewForVTK(int step, break; } - adaptForVTK(myVTKData.vtkTol, numComp, coords, values);//, out->Min, out->Max, plug); + adaptForVTK(myVTKData.vtkTol, numComp, coords, values, minVal, maxVal);// ,plug); // Inside initial element, after adapt() has been called diff --git a/Post/adaptiveData.h b/Post/adaptiveData.h index d1bff7926b..bec1407023 100644 --- a/Post/adaptiveData.h +++ b/Post/adaptiveData.h @@ -628,7 +628,8 @@ class adaptiveElements { // Clone of adapt for VTK output files void adaptForVTK(double tol, int numComp, - std::vector<PCoords> &coords, std::vector<PValues> &values); + std::vector<PCoords> &coords, std::vector<PValues> &values, + double &minVal, double &maxVal); // Clone of addInView for VTK output files void addInViewForVTK(int step, PViewData *in, VTKData &myVTKData, -- GitLab