15 const std::string fname = __FUNCTION__;
17 std::vector<double> response(num_groups, 0.0);
24 lua_pushstring(L,
"x");
25 lua_pushnumber(L, vec.x);
28 lua_pushstring(L,
"y");
29 lua_pushnumber(L, vec.y);
32 lua_pushstring(L,
"z");
33 lua_pushnumber(L, vec.z);
41 response.assign(num_groups, 1.0);
51 if (not lua_isfunction(L, -1))
52 throw std::logic_error(fname +
" attempted to access lua-function, " +
54 " could not be retrieved.");
62 std::vector<double> lua_return;
63 if (lua_pcall(L,2,1,0) == 0)
65 LuaCheckTableValue(fname, L, -1);
66 const size_t table_length = lua_rawlen(L, -1);
67 lua_return.reserve(table_length);
68 for (
size_t i=0; i<table_length; ++i)
70 lua_pushinteger(L,
static_cast<lua_Integer
>(i)+1);
72 lua_return.push_back(lua_tonumber(L,-1));
77 throw std::logic_error(fname +
" attempted to call lua-function, " +
83 if (lua_return.size() > response.size())
84 throw std::logic_error(fname +
" Call lua-function, " +
86 std::to_string(response.size()) +
87 " which is greater than the number of groups " +
88 std::to_string(num_groups) +
".");
90 for (
size_t g=0; g<num_groups; ++g)
91 response[g] = lua_return[g];
static chi::Console & console
lua_State *& GetConsoleState()
const std::string lua_functional
std::vector< double > GetMGResponse(const chi_mesh::Cell &cell, size_t num_groups) const