diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 515472f7b0ad105be45f061780fabc225f144549..dd1d23d9e67d5757590962ad11e0bc5c0608d7fa 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -822,6 +822,13 @@ std::vector<MElement*> GModel::getMeshElementsByCoord(SPoint3 &p, int dim, bool return _octree->findAll(p.x(), p.y(), p.z(), dim, strict); } +void GModel::deleteOctree() { + if (_octree) { + delete _octree; + _octree = NULL; + } +} + MVertex *GModel::getMeshVertexByTag(int n) { if(_vertexVectorCache.empty() && _vertexMapCache.empty()){ diff --git a/Geo/GModel.h b/Geo/GModel.h index cda7dc2b97f3a08403eb2267b0db29126e089398..ac63db49817ae890e9696873db7c793fd0067385 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -364,6 +364,7 @@ class GModel // access a mesh element by coordinates (using an octree search) MElement *getMeshElementByCoord(SPoint3 &p, int dim=-1, bool strict=true); std::vector<MElement*> getMeshElementsByCoord(SPoint3 &p, int dim=-1, bool strict=true); + void deleteOctree(); // access a mesh element by tag, using the element cache MElement *getMeshElementByTag(int n); diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index 3994bc0ea571448ad0197e93f5d21bc5a44734e6..0424d058c4fadc1b9d3399ce5a6646b3a79c3a91 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -803,15 +803,6 @@ void MElement::xyz2uvw(double xyz[3], double uvw[3]) const } } -void MElement::xyzTouvw(fullMatrix<double> *xu) const -{ - double _xyz[3] = {(*xu)(0,0),(*xu)(0,1),(*xu)(0,2)}, _uvw[3]; - xyz2uvw(_xyz, _uvw); - (*xu)(1,0) = _uvw[0]; - (*xu)(1,1) = _uvw[1]; - (*xu)(1,2) = _uvw[2]; -} - void MElement::movePointFromParentSpaceToElementSpace(double &u, double &v, double &w) const { if(!getParent()) return; diff --git a/Geo/MElement.h b/Geo/MElement.h index c19d8e4a4add67796c46af3d1cd04c1cfa04365e..514ff9f1925012355b739eb30912b6ba52710714 100644 --- a/Geo/MElement.h +++ b/Geo/MElement.h @@ -318,7 +318,6 @@ class MElement // invert the parametrisation virtual void xyz2uvw(double xyz[3], double uvw[3]) const; - void xyzTouvw(fullMatrix<double> *xu) const; // move point between parent and element parametric spaces virtual void movePointFromParentSpaceToElementSpace(double &u, double &v, diff --git a/Geo/MElementOctree.cpp b/Geo/MElementOctree.cpp index 360e6afb02e3fc24b119e9f51b78a75d29298402..efff71ff79647d02eaa24239aef5baf31df6713b 100644 --- a/Geo/MElementOctree.cpp +++ b/Geo/MElementOctree.cpp @@ -89,7 +89,7 @@ MElementOctree::MElementOctree(GModel *m) : _gm(m) Octree_Arrange(_octree); } -MElementOctree::MElementOctree(std::vector<MElement*> &v) : _gm(0), _elems(v) +MElementOctree::MElementOctree(const std::vector<MElement*> &v) : _gm(0), _elems(v) { SBoundingBox3d bb; for (unsigned int i = 0; i < v.size(); i++){ diff --git a/Geo/MElementOctree.h b/Geo/MElementOctree.h index a517f8b68d211f750489a2e3052a2784caf4374c..e30f57922a6199804c90ccae6924f2dad2623103 100644 --- a/Geo/MElementOctree.h +++ b/Geo/MElementOctree.h @@ -19,11 +19,10 @@ class MElementOctree{ std::vector<MElement*> _elems; public: MElementOctree(GModel *); - MElementOctree(std::vector<MElement*> &); + MElementOctree(const std::vector<MElement*> &); ~MElementOctree(); MElement *find(double x, double y, double z, int dim = -1, bool strict = false) const; Octree *getInternalOctree(){ return _octree; } std::vector<MElement *> findAll(double x, double y, double z, int dim, bool strict = false); }; - #endif diff --git a/wrappers/gmshpy/gmshGeo.i b/wrappers/gmshpy/gmshGeo.i index df1b61543492f966071800a4ff0f70bb4e6f382b..454361a278689d5b03d77a0ef93958c85a5392f1 100644 --- a/wrappers/gmshpy/gmshGeo.i +++ b/wrappers/gmshpy/gmshGeo.i @@ -25,6 +25,7 @@ #include "discreteVertex.h" #include "gmshLevelset.h" #include "MElement.h" + #include "MElementOctree.h" #include "MVertex.h" #include "MTriangle.h" #include "MTetrahedron.h" @@ -112,6 +113,8 @@ namespace std { %include "discreteRegion.h" %include "SPoint3.h" %include "MElement.h" +%ignore MElementOctree::MElementOctree(GModel*); +%include "MElementOctree.h" %ignore MVertex::x(); %ignore MVertex::y(); %ignore MVertex::z(); @@ -183,6 +186,12 @@ namespace std { $self->pnt(xi0, xi1, xi2, p); return p; } + std::vector<double> xyz2uvw(double x, double y, double z) { + double xyz[3] = {x, y, z}; + std::vector<double> uvw(3, 0.); + $self->xyz2uvw(xyz, &uvw[0]); + return uvw; + } } %extend GEdge { @@ -211,3 +220,4 @@ namespace std { $self->meshAttributes.recombine3D = 1; } } +