Skip to content
Snippets Groups Projects
Commit 75d6a829 authored by Boris Sedji's avatar Boris Sedji
Browse files

No commit message

No commit message
parent 829af106
No related branches found
No related tags found
No related merge requests found
...@@ -249,10 +249,12 @@ void elasticitySolver::readInputFile(const std::string &fn) ...@@ -249,10 +249,12 @@ void elasticitySolver::readInputFile(const std::string &fn)
/********************* end deprecated api ****************************************/ /********************* end deprecated api ****************************************/
void elasticitySolver::addDirichletBC (int dim, int entityId, int component, double value) { #if defined (HAVE_LUA)
void elasticitySolver::addDirichletBCLua (int dim, int entityId, int component, std::string luaFunctionName, lua_State *L) {
dirichletBC diri; dirichletBC diri;
diri.g = new groupOfElements (dim, entityId); diri.g = new groupOfElements (dim, entityId);
diri._f= new simpleFunction<double>(value); diri._f= new simpleFunctionLua<double>(L, luaFunctionName,0.);
diri._comp=component; diri._comp=component;
diri._tag=entityId; diri._tag=entityId;
switch (dim) { switch (dim) {
...@@ -264,10 +266,26 @@ void elasticitySolver::addDirichletBC (int dim, int entityId, int component, dou ...@@ -264,10 +266,26 @@ void elasticitySolver::addDirichletBC (int dim, int entityId, int component, dou
allDirichlet.push_back(diri); allDirichlet.push_back(diri);
} }
void elasticitySolver::addDirichletBCLua (int dim, int entityId, int component, std::string luaFunctionName, lua_State *L) { void elasticitySolver::addNeumannBCLua (int dim, int entityId, std::string luaFunctionName, lua_State *L) {
neumannBC neu;
neu.g = new groupOfElements (dim, entityId);
neu._f= new simpleFunctionLua<SVector3>(L, luaFunctionName, SVector3(0,0,0));
neu._tag=entityId;
switch (dim) {
case 0 : neu.onWhat=BoundaryCondition::ON_VERTEX; break;
case 1 : neu.onWhat=BoundaryCondition::ON_EDGE; break;
case 2 : neu.onWhat=BoundaryCondition::ON_FACE; break;
default : return;
}
allNeumann.push_back(neu);
}
#endif
void elasticitySolver::addDirichletBC (int dim, int entityId, int component, double value) {
dirichletBC diri; dirichletBC diri;
diri.g = new groupOfElements (dim, entityId); diri.g = new groupOfElements (dim, entityId);
diri._f= new simpleFunctionLua<double>(L, luaFunctionName,0.); diri._f= new simpleFunction<double>(value);
diri._comp=component; diri._comp=component;
diri._tag=entityId; diri._tag=entityId;
switch (dim) { switch (dim) {
...@@ -279,6 +297,7 @@ void elasticitySolver::addDirichletBCLua (int dim, int entityId, int component, ...@@ -279,6 +297,7 @@ void elasticitySolver::addDirichletBCLua (int dim, int entityId, int component,
allDirichlet.push_back(diri); allDirichlet.push_back(diri);
} }
void elasticitySolver::addNeumannBC (int dim, int entityId, const std::vector<double> value) { void elasticitySolver::addNeumannBC (int dim, int entityId, const std::vector<double> value) {
if(value.size()!=3) return; if(value.size()!=3) return;
neumannBC neu; neumannBC neu;
...@@ -294,19 +313,7 @@ void elasticitySolver::addNeumannBC (int dim, int entityId, const std::vector<do ...@@ -294,19 +313,7 @@ void elasticitySolver::addNeumannBC (int dim, int entityId, const std::vector<do
allNeumann.push_back(neu); allNeumann.push_back(neu);
} }
void elasticitySolver::addNeumannBCLua (int dim, int entityId, std::string luaFunctionName, lua_State *L) {
neumannBC neu;
neu.g = new groupOfElements (dim, entityId);
neu._f= new simpleFunctionLua<SVector3>(L, luaFunctionName, SVector3(0,0,0));
neu._tag=entityId;
switch (dim) {
case 0 : neu.onWhat=BoundaryCondition::ON_VERTEX; break;
case 1 : neu.onWhat=BoundaryCondition::ON_EDGE; break;
case 2 : neu.onWhat=BoundaryCondition::ON_FACE; break;
default : return;
}
allNeumann.push_back(neu);
}
void elasticitySolver::addElasticDomain (int physical, double e, double nu){ void elasticitySolver::addElasticDomain (int physical, double e, double nu){
elasticField field; elasticField field;
...@@ -602,6 +609,9 @@ PView* elasticitySolver::buildVonMisesView(const std::string &postFileName) ...@@ -602,6 +609,9 @@ PView* elasticitySolver::buildVonMisesView(const std::string &postFileName)
} }
#endif #endif
#if defined (HAVE_LUA)
#include "Bindings.h" #include "Bindings.h"
void elasticitySolverRegisterBindings(binding *b) void elasticitySolverRegisterBindings(binding *b)
{ {
...@@ -663,3 +673,4 @@ void elasticitySolverRegisterBindings(binding *b) ...@@ -663,3 +673,4 @@ void elasticitySolverRegisterBindings(binding *b)
cm->setArgNames("model","tag",NULL); cm->setArgNames("model","tag",NULL);
} }
#endif
...@@ -55,7 +55,6 @@ struct neumannBC : public BoundaryCondition ...@@ -55,7 +55,6 @@ struct neumannBC : public BoundaryCondition
simpleFunction<SVector3> *_f; simpleFunction<SVector3> *_f;
neumannBC () : BoundaryCondition(),_f(NULL){} neumannBC () : BoundaryCondition(),_f(NULL){}
}; };
// an elastic solver ... // an elastic solver ...
class elasticitySolver class elasticitySolver
{ {
...@@ -78,12 +77,18 @@ class elasticitySolver ...@@ -78,12 +77,18 @@ class elasticitySolver
elasticitySolver(int tag) : _tag(tag),LagSpace(0),pAssembler(0),LagrangeMultiplierSpace(0) {} elasticitySolver(int tag) : _tag(tag),LagSpace(0),pAssembler(0),LagrangeMultiplierSpace(0) {}
elasticitySolver(GModel *model, int tag); elasticitySolver(GModel *model, int tag);
void addDirichletBC (int dim, int entityId, int component, double value); void addDirichletBC (int dim, int entityId, int component, double value);
void addDirichletBCLua (int dim, int entityId, int component, std::string luaFunctionName, lua_State *L);
void addNeumannBC (int dim, int entityId, const std::vector<double> value); void addNeumannBC (int dim, int entityId, const std::vector<double> value);
void addNeumannBCLua (int dim, int entityId, std::string luaFunctionName, lua_State *L);
void addElasticDomain (int tag, double e, double nu); void addElasticDomain (int tag, double e, double nu);
#if defined (HAVE_LUA)
void addDirichletBCLua (int dim, int entityId, int component, std::string luaFunctionName, lua_State *L);
void addNeumannBCLua (int dim, int entityId, std::string luaFunctionName, lua_State *L);
#endif
virtual ~elasticitySolver() virtual ~elasticitySolver()
{ {
if (LagSpace) delete LagSpace; if (LagSpace) delete LagSpace;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment