From 5a046214202d0aa8b1b9abc947a1f962ba0470f0 Mon Sep 17 00:00:00 2001 From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be> Date: Tue, 16 Feb 2010 16:18:02 +0000 Subject: [PATCH] bindings for dgSlopeLimite (no bool in lua) --- Common/LuaBindings.cpp | 3 +++ Solver/TESTCASES/RayleighTaylor.lua | 2 +- Solver/dgLimiter.cpp | 11 ++++++----- Solver/dgLimiter.h | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Common/LuaBindings.cpp b/Common/LuaBindings.cpp index 71157cadbc..f0e3bc9df3 100644 --- a/Common/LuaBindings.cpp +++ b/Common/LuaBindings.cpp @@ -20,6 +20,7 @@ #include "dgConservationLawWaveEquation.h" #include "dgRungeKutta.h" #include "dgSystemOfEquations.h" +#include "dgLimiter.h" extern "C" { #include "lua.h" @@ -282,6 +283,8 @@ binding::binding(){ DocRecord::registerBindings(this); GEntity::registerBindings(this); GFace::registerBindings(this); + dgLimiter::registerBindings(this); + dgSlopeLimiter::registerBindings(this); } binding *binding::_instance=NULL; #endif diff --git a/Solver/TESTCASES/RayleighTaylor.lua b/Solver/TESTCASES/RayleighTaylor.lua index f51fe544d9..04c9f18298 100644 --- a/Solver/TESTCASES/RayleighTaylor.lua +++ b/Solver/TESTCASES/RayleighTaylor.lua @@ -72,7 +72,7 @@ law:addBoundaryCondition('Top',law:newOutsideValueBoundary(FS)) GC=dgGroupCollection(myModel,2,order) solution=dgDofContainer(GC,4) solution:L2Projection(FS) -limiter=dgSlopeLimiter(law) +limiter = dgSlopeLimiter(law) -- limiter:apply(solution) GC:buildGroupsOfInterfaces(myModel,2,order) diff --git a/Solver/dgLimiter.cpp b/Solver/dgLimiter.cpp index b21fd1b797..518674751d 100644 --- a/Solver/dgLimiter.cpp +++ b/Solver/dgLimiter.cpp @@ -4,7 +4,7 @@ #include "function.h" //---------------------------------------------------------------------------------- -bool dgSlopeLimiter::apply ( dgDofContainer *solution) +int dgSlopeLimiter::apply ( dgDofContainer *solution) { dgGroupCollection *groups=solution->getGroups(); solution->scatter(); @@ -118,7 +118,7 @@ bool dgSlopeLimiter::apply ( dgDofContainer *solution) } } } - return true; + return 1; } #include "Bindings.h" @@ -127,9 +127,9 @@ void dgLimiter::registerBindings(binding *b) { classBinding *cb = b->addClass<dgLimiter>("dgLimiter"); cb->setDescription("Parent class for limiters"); methodBinding *cm; -// cm = cb->addMethod("apply",&dgLimiter::apply); -// cm->setArgNames("solution",NULL); -// cm->setDescription("apply the limiter on the solution"); + cm = cb->addMethod("apply",&dgLimiter::apply); + cm->setArgNames("solution",NULL); + cm->setDescription("apply the limiter on the solution"); } void dgSlopeLimiter::registerBindings(binding *b) { @@ -139,5 +139,6 @@ void dgSlopeLimiter::registerBindings(binding *b) { cm = cb->setConstructor<dgSlopeLimiter,dgConservationLaw *>(); cm->setDescription("A new explicit slope limiter"); cm->setArgNames("law",NULL); + cb->setParentClass<dgLimiter>(); } diff --git a/Solver/dgLimiter.h b/Solver/dgLimiter.h index f0c115337f..5e4072beae 100644 --- a/Solver/dgLimiter.h +++ b/Solver/dgLimiter.h @@ -13,14 +13,14 @@ protected: dgConservationLaw *_claw; public: dgLimiter (dgConservationLaw *claw) : _claw(claw) {} - virtual bool apply ( dgDofContainer *sol)=0; + virtual int apply ( dgDofContainer *sol)=0; static void registerBindings(binding *b); }; class dgSlopeLimiter : public dgLimiter{ public : dgSlopeLimiter (dgConservationLaw *claw) : dgLimiter (claw) {} - virtual bool apply ( dgDofContainer *solution); + virtual int apply ( dgDofContainer *solution); static void registerBindings(binding *b); }; -- GitLab