Skip to content
Snippets Groups Projects
Commit eb34e0a6 authored by Emilie Marchandise's avatar Emilie Marchandise
Browse files

Added some bindings for lua function liftAndDrag for NS

parent 7c3d193b
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@
#include "luaFunction.h"
#include "function.h"
#include "GModel.h"
#include "GPoint.h"
#include "Bindings.h"
#include "GmshMessage.h"
#include "Options.h"
......@@ -405,6 +406,7 @@ binding::binding()
GFace::registerBindings(this);
GRegion::registerBindings(this);
GModel::registerBindings(this);
GPoint::registerBindings(this);
MElement::registerBindings(this);
MVertex::registerBindings(this);
MTriangle::registerBindings(this);
......
......@@ -5,7 +5,7 @@
set(SRC
GEntity.cpp STensor3.cpp
GVertex.cpp GEdge.cpp GFace.cpp GRegion.cpp
GVertex.cpp GEdge.cpp GFace.cpp GRegion.cpp GPoint.cpp
GEdgeLoop.cpp GEdgeCompound.cpp GFaceCompound.cpp GRegionCompound.cpp
gmshVertex.cpp gmshEdge.cpp gmshFace.cpp gmshRegion.cpp gmshSurface.cpp
OCCVertex.cpp OCCEdge.cpp OCCFace.cpp OCCRegion.cpp
......
......@@ -389,4 +389,13 @@ void GEdge::registerBindings(binding *b)
mb = cb->addMethod("addLine", &GEdge::addLine);
mb->setDescription("insert a line mesh element");
mb->setArgNames("line", NULL);
mb = cb->addMethod("getLowBound", &GEdge::getLowBound);
mb->setDescription("get the lower bound of the parametrization of the Edge");
mb = cb->addMethod("getHighBound", &GEdge::getHighBound);
mb->setDescription("get the lower bound of the parametrization of the Edge");
//mb = cb->addMethod("point", &GEdge::point);
//mb->setDescription("returns the GPoint for a given double parameter");
//mb->setArgNames("double", NULL);
}
......@@ -178,6 +178,16 @@ class GEdge : public GEntity {
// gluing
void replaceEndingPoints(GVertex *, GVertex *);
//get bounds
inline double getLowBound() const {
Range<double> bounds = parBounds(0);
return bounds.low();
}
inline double getHighBound() const {
Range<double> bounds = parBounds(0);
return bounds.high();
}
struct {
char Method;
double coeffTransfinite;
......
......@@ -107,6 +107,7 @@ void GEntity::registerBindings(binding *b)
mb = cb->addMethod("addPhysicalEntity", &GEntity::addPhysicalEntity);
mb->setArgNames("physicalGroupId",NULL);
mb->setDescription("add this element to a physical group.");
}
......
......@@ -247,6 +247,8 @@ GEdge *GModel::getEdgeByTag(int n) const
return 0;
}
GVertex *GModel::getVertexByTag(int n) const
{
GEntity tmp((GModel*)this, n);
......@@ -257,6 +259,21 @@ GVertex *GModel::getVertexByTag(int n) const
return 0;
}
//we should have dynamic cast to GEdge* instead of returning GEntity*
std::vector<GEntity*> GModel::getEdgesByStringTag(const std::string tag)
{
std::vector<GEntity*> allEdges;
std::map<int, std::vector<GEntity*> > physicalGroups[4];
this->getPhysicalGroups(physicalGroups);
allEdges = physicalGroups[1][this->getPhysicalNumber(1,tag)];
}
GEdge *GModel::getFirstEdgeByStringTag(const std::string tag)
{
std::vector<GEntity*> allEdges = this->getEdgesByStringTag(tag);
return (GEdge*)allEdges[0];
}
void GModel::remove(GRegion *r)
{
riter it = std::find(firstRegion(), lastRegion(), r);
......@@ -2700,4 +2717,8 @@ void GModel::registerBindings(binding *b)
cm->setDescription("Assigns partition tags to boundary elements. Should be called "
"only after the partitions have been assigned");
cm->setArgNames("createGhostCells",NULL);
cm = cb->addMethod("getFirstEdgeByStringTag", &GModel::getFirstEdgeByStringTag);
cm->setDescription("return the first edge of the physical line with given tag.");
cm->setArgNames("string tag",NULL);
}
......@@ -209,6 +209,12 @@ class GModel
GEdge *getEdgeByTag(int n) const;
GVertex *getVertexByTag(int n) const;
//Emi- we should return vector of GEdges instead
std::vector<GEntity*> getEdgesByStringTag(const std::string tag) ;
//Emi - I do not know how to bind std::vector in lua so I return only first edge
//and used Compound Line to have a unique GEdge
GEdge *getFirstEdgeByStringTag(const std::string tag) ;
// for lua bindings, temporary solution while iterator are not binded
std::vector<GRegion*> bindingsGetRegions();
std::vector<GFace*> bindingsGetFaces();
......
......@@ -9,6 +9,7 @@
#include <math.h>
class GEntity;
class binding;
class GPoint
{
......@@ -54,6 +55,8 @@ class GPoint
}
bool succeeded() const{ return success; }
bool setNoSuccess(){ success = false; return success; }
static void registerBindings(binding *b);
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment