diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index cd38f56bf837c2d86a545acd62ddc2a3d2d5ee19..5301cfa503737069a28d6724eec18fe3a3a1000f 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -355,12 +355,12 @@ int MergeFile(std::string fileName, bool warnIfMissing) !strncmp(header, "$PARA", 5) || !strncmp(header, "$ELM", 4) || !strncmp(header, "$MeshFormat", 11) || !strncmp(header, "$Comments", 9)) { // mesh matcher - if(CTX::instance()->geom.matchGeomAndMesh && !GModel::current()->empty()){ - GModel* tmp2 = GModel::current(); + if(CTX::instance()->geom.matchGeomAndMesh && !GModel::current()->empty()) { + GModel* tmp2 = GModel::current(); GModel* tmp = new GModel(); tmp->readMSH(fileName); if(GeomMeshMatcher::instance()->match(tmp2, tmp)) - fileName = "out.msh"; + fileName = "out.msh"; delete tmp; } status = GModel::current()->readMSH(fileName); @@ -368,9 +368,9 @@ int MergeFile(std::string fileName, bool warnIfMissing) if(status > 1) status = PView::readMSH(fileName); #endif #if defined(HAVE_MESH) - if(CTX::instance()->mesh.order > 1) + if(CTX::instance()->mesh.order > 1) SetOrderN(GModel::current(), CTX::instance()->mesh.order, - CTX::instance()->mesh.secondOrderLinear, + CTX::instance()->mesh.secondOrderLinear, CTX::instance()->mesh.secondOrderIncomplete); #endif } diff --git a/Geo/GEntity.h b/Geo/GEntity.h index 9f30f257bdd3528f8aac0eeb8012be17c6b9d1f0..084d7b7b2fa28b9a25c97df74e49fb7ef5931ea8 100644 --- a/Geo/GEntity.h +++ b/Geo/GEntity.h @@ -185,6 +185,24 @@ class GEntity { // vertices that bound this entity. virtual std::list<GVertex*> vertices() const { return std::list<GVertex*>(); } + // for python, temporary solution while iterator are not binded + std::vector<GRegion*> bindingsGetRegions() { + std::list<GRegion*> r = regions(); // NOTE : two-line to dont create two different lists with diff pointers + return std::vector<GRegion*> (r.begin(), r.end()); + } + std::vector<GFace*> bindingsGetFaces() { + std::list<GFace*> f = faces(); + return std::vector<GFace*> (f.begin(), f.end()); + } + std::vector<GEdge*> bindingsGetEdges() { + std::list<GEdge*> e = edges(); + return std::vector<GEdge*> (e.begin(), e.end()); + } + std::vector<GVertex*> bindingsGetVertices() { + std::list<GVertex*> v = vertices(); + return std::vector<GVertex*> (v.begin(), v.end()); + } + // underlying geometric representation of this entity. virtual GeomType geomType() const { return Unknown; } diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp index 16279317d05a17cd59c634977005570ca563f1d6..162722383564440741892e65f1881753404ba24c 100644 --- a/Geo/MElement.cpp +++ b/Geo/MElement.cpp @@ -18,7 +18,7 @@ #include "MPyramid.h" #include "MElementCut.h" #include "GEntity.h" -#include "GFace.h" +//#include "GFace.h" ?? #include "StringUtils.h" #include "Numeric.h" #include "Context.h" diff --git a/Geo/MElement.h b/Geo/MElement.h index ae035be37199200eb2add8d566b3bd265446d5ed..943b5ca5eb3fa85c72411f56ed25d926847e033d 100644 --- a/Geo/MElement.h +++ b/Geo/MElement.h @@ -18,7 +18,7 @@ #include "JacobianBasis.h" #include "Gauss.h" -class GFace; +//class GFace; ?? // A mesh element. class MElement diff --git a/Solver/function.cpp b/Solver/function.cpp index 7982e1ceb62774395b0d4f9878c642aed2e47a34..f11579954a1bfbd3e991c801cb10b98eef989f00 100644 --- a/Solver/function.cpp +++ b/Solver/function.cpp @@ -103,7 +103,7 @@ class functionNormals : public function { static functionNormals *_instance; // constructor is private only 1 instance can exists, call get to // access the instance - functionNormals() : function(3){} + functionNormals() : function(3){} //TODO TOFIX : set to zero, but not display the error (in function.h) public: void call(dataCacheMap *m, fullMatrix<double> &sol) { @@ -300,7 +300,7 @@ dataCacheDouble *dataCacheMap::get(const function *f, dataCacheDouble *caller, b replaceCache.map = rMap; r->functionReplaceCaches.push_back (replaceCache); } - ((function*)f)->registerInDataCacheMap(this, r); + ((function*)f)->registerInDataCacheMap(this, r); // set if dofFunction(Gradient) as neededDof in dgDataCM } // update the dependency tree @@ -539,6 +539,37 @@ function *functionProdNew(const function *f0, const function *f1) return new functionProd (f0, f1); } +// functionQuotient + +class functionQuotient : public function { + public: + fullMatrix<double> _f0, _f1; + void call(dataCacheMap *m, fullMatrix<double> &val) + { + for (int i = 0; i < val.size1(); i++) + for (int j = 0; j < val.size2(); j++) + val(i, j)= _f0(i, j) / _f1(i, j); + } + functionQuotient(const function *f0, const function *f1) : function(f0->getNbCol()) + { + if (f0->getNbCol() != f1->getNbCol()) { + Msg::Error("trying to compute product of 2 functions of different sizes: %d %d\n", + f0->getNbCol(), f1->getNbCol()); + throw; + } + setArgument (_f0, f0); + setArgument (_f1, f1); + } +}; + +function *functionQuotientNew (const function *f0, const function *f1) +{ + return new functionQuotient (f0, f1); +} + + + + // functionExtractComp class functionExtractComp : public function { diff --git a/Solver/function.h b/Solver/function.h index 33ca8605116d298b9e8bee53267d0bcd51ab1e7a..ea4f7d009911a7e049152ee380540bf88a3abfd7 100644 --- a/Solver/function.h +++ b/Solver/function.h @@ -298,6 +298,7 @@ function *functionLevelsetSmoothNew (const function *f0, const double valMin, co function *functionSumNew (const function *f0, const function *f1); function *functionMinusNew (const function *f0, const function *f1); function *functionProdNew (const function *f0, const function *f1); +function *functionQuotientNew (const function *f0, const function *f1); function *functionScaleNew (const function *f0, const double s); function *functionExtractCompNew (const function *f0, const int iComp); function *functionCatCompNew(std::vector<const function *> fArray); diff --git a/gmshpy/gmshGeo.i b/gmshpy/gmshGeo.i index e49b8641b710db4e3ad0e8c7b08f7af02b5b34e8..a80d05dd6990302eb1a6e89adfe36b05eadd033e 100644 --- a/gmshpy/gmshGeo.i +++ b/gmshpy/gmshGeo.i @@ -28,6 +28,7 @@ #include "MLine.h" #include "MEdge.h" #include "MFace.h" + #include "MPoint.h" #include "SVector3.h" #include "SPoint3.h" #include "SPoint2.h" @@ -69,6 +70,7 @@ namespace std { %include "MLine.h" %include "MEdge.h" %include "MFace.h" +%include "MPoint.h" %include "SVector3.h" %include "SPoint3.h" %include "SPoint2.h"