diff --git a/Plugin/Probe.cpp b/Plugin/Probe.cpp index f168e36f06a8d43412a3af6daf16c23251ee5175..0363996bb235a7f5afe7ae9e6fa417f0f878c899 100644 --- a/Plugin/Probe.cpp +++ b/Plugin/Probe.cpp @@ -119,7 +119,7 @@ PView *GMSH_ProbePlugin::execute(PView *v) double y = ProbeOptions_Number[1].def; double z = ProbeOptions_Number[2].def; int iView = (int)ProbeOptions_Number[3].def; - + PView *v1 = getView(iView, v); if(!v1) return v; @@ -163,7 +163,7 @@ PView *GMSH_ProbePlugin::execute(PView *v) } delete [] val; - + for(int i = 0; i < numSteps; i++){ double time = v1->getData()->getTime(i); data2->Time.push_back(time); @@ -171,6 +171,6 @@ PView *GMSH_ProbePlugin::execute(PView *v) data2->setName(v1->getData()->getName() + "_Probe"); data2->setFileName(v1->getData()->getName() + "_Probe.pos"); data2->finalize(); - + return v2; } diff --git a/Post/OctreePost.cpp b/Post/OctreePost.cpp index 24708dcec2d53143ec4e4222030bbfa9abdcc973..a5b73fad4b15ea342a59aadc317c76ad1ce832e0 100644 --- a/Post/OctreePost.cpp +++ b/Post/OctreePost.cpp @@ -528,6 +528,22 @@ bool OctreePost::searchVector(double x, double y, double z, double *values, return false; } +bool OctreePost::searchVectorWithTol(double x, double y, double z, double *values, + int step, double *size, double tol) +{ + bool a = searchVector(x, y, z, values, step, size); + if(!a && tol != 0.){ + double oldtol1 = element::getTolerance(); + double oldtol2 = MElement::getTolerance(); + element::setTolerance(tol); + MElement::setTolerance(tol); + a = searchVector(x, y, z, values, step, size); + element::setTolerance(oldtol1); + MElement::setTolerance(oldtol2); + } + return a; +} + bool OctreePost::searchTensor(double x, double y, double z, double *values, int step, double *size) { diff --git a/Post/OctreePost.h b/Post/OctreePost.h index 2e84709bab603988fc65120c5621995ef4f463c6..14bd3e664cf7c14389e5aead7298689f76d85e1c 100644 --- a/Post/OctreePost.h +++ b/Post/OctreePost.h @@ -47,6 +47,8 @@ class OctreePost int step=-1, double *size=0, double tol=1.e-2); bool searchVector(double x, double y, double z, double *values, int step=-1, double *size=0); + bool searchVectorWithTol(double x, double y, double z, double *values, + int step=-1, double *size=0, double tol=1.e-2); bool searchTensor(double x, double y, double z, double *values, int step=-1, double *size=0); bool searchTensorWithTol(double x, double y, double z, double *values, diff --git a/Post/PViewData.cpp b/Post/PViewData.cpp index d87e86186c10f77005decd71e61078c77b26fb6b..cb56866aa3fab8d59878ba4ae20b5a88372e370b 100644 --- a/Post/PViewData.cpp +++ b/Post/PViewData.cpp @@ -208,9 +208,23 @@ bool PViewData::searchVector(double x, double y, double z, double *values, return _octree->searchVector(x, y, z, values, step, size); } +bool PViewData::searchVectorWithTol(double x, double y, double z, double *values, + int step, double *size, double tol) +{ + if(!_octree) _octree = new OctreePost(this); + return _octree->searchVectorWithTol(x, y, z, values, step, size, tol); +} + bool PViewData::searchTensor(double x, double y, double z, double *values, int step, double *size) { if(!_octree) _octree = new OctreePost(this); return _octree->searchTensor(x, y, z, values, step, size); } + +bool PViewData::searchTensorWithTol(double x, double y, double z, double *values, + int step, double *size, double tol) +{ + if(!_octree) _octree = new OctreePost(this); + return _octree->searchTensorWithTol(x, y, z, values, step, size, tol); +} diff --git a/Post/PViewData.h b/Post/PViewData.h index 50c686e0f7ba6dedfb5b9aa3197946af04298764..660243623ad775c72e9bac81c387e9cab36ef0a9 100644 --- a/Post/PViewData.h +++ b/Post/PViewData.h @@ -106,47 +106,43 @@ class PViewData { // return the number of geometrical entities in the view virtual int getNumEntities(int step=-1){ return 0; } - // return the number of elements in the ent-th entity, or the total - // number of elements if ent < 0 + // return the number of elements in the ent-th entity, or the total number of + // elements if ent < 0 virtual int getNumElements(int step=-1, int ent=-1){ return 0; } - // return the geometrical dimension of the ele-th element in the - // ent-th entity + // return the geometrical dimension of the ele-th element in the ent-th entity virtual int getDimension(int step, int ent, int ele){ return 0; } - // return the number of nodes of the ele-th element in the ent-th - // entity + // return the number of nodes of the ele-th element in the ent-th entity virtual int getNumNodes(int step, int ent, int ele){ return 0; } - // get/set the coordinates and tag of the nod-th node from the - // ele-th element in the ent-th entity (if the node has a tag, - // getNode returns it) + // get/set the coordinates and tag of the nod-th node from the ele-th element + // in the ent-th entity (if the node has a tag, getNode returns it) virtual int getNode(int step, int ent, int ele, int nod, double &x, double &y, double &z){ return 0; } virtual void setNode(int step, int ent, int ele, int nod, double x, double y, double z); virtual void tagNode(int step, int ent, int ele, int nod, int tag){} - // return the number of components available for the ele-th element in - // the ent-th entity + // return the number of components available for the ele-th element in the + // ent-th entity virtual int getNumComponents(int step, int ent, int ele){ return 0; } - // return the number of values available for the ele-th element in - // the ent-th entity + // return the number of values available for the ele-th element in the ent-th + // entity virtual int getNumValues(int step, int ent, int ele){ return 0; } // get the idx'th value for the ele-th element in the ent-th entity virtual void getValue(int step, int ent, int ele, int idx, double &val){} - // gets/set the comp-th component (at the step-th time step) - // associated with the node-th node from the ele-th element in the - // ent-th entity + // gets/set the comp-th component (at the step-th time step) associated with + // the node-th node from the ele-th element in the ent-th entity virtual void getValue(int step, int ent, int ele, int nod, int comp, double &val){} virtual void setValue(int step, int ent, int ele, int nod, int comp, double val); - // return a scalar value (same as value for scalars, norm for - // vectors, etc.) associated with the node-th node from the ele-th - // element in the ent-th entity + // return a scalar value (same as value for scalars, norm for vectors, etc.) + // associated with the node-th node from the ele-th element in the ent-th + // entity void getScalarValue(int step, int ent, int ele, int nod, double &val, int forceNumComponents=0, int componentMap[9]=0); @@ -237,27 +233,30 @@ class PViewData { // get MElement (if view supports it) virtual MElement *getElement(int step, int entity, int element); - // 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. + // 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 step=-1, double *size=0); bool searchScalarWithTol(double x, double y, double z, double *values, int step=-1, double *size=0, double tol=1.e-2); bool searchVector(double x, double y, double z, double *values, int step=-1, double *size=0); + bool searchVectorWithTol(double x, double y, double z, double *values, + int step=-1, double *size=0, double tol=1.e-2); bool searchTensor(double x, double y, double z, double *values, int step=-1, double *size=0); + bool searchTensorWithTol(double x, double y, double z, double *values, + int step=-1, double *size=0, double tol=1.e-2); // I/O routines virtual bool writeSTL(const std::string &fileName); virtual bool writeTXT(const std::string &fileName); - virtual bool writePOS(const std::string &fileName, bool binary=false, bool parsed=true, - bool append=false); - virtual bool writeMSH(const std::string &fileName, bool binary=false, bool savemesh=true, - bool multipleView=false); + virtual bool writePOS(const std::string &fileName, bool binary=false, + bool parsed=true, bool append=false); + virtual bool writeMSH(const std::string &fileName, bool binary=false, + bool savemesh=true, bool multipleView=false); virtual bool writeMED(const std::string &fileName); virtual bool toVector(std::vector<std::vector<double> > &vec); virtual bool fromVector(const std::vector<std::vector<double> > &vec);