If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit 3be1d928 authored by Tobias WEBER's avatar Tobias WEBER

added external plugin system

parent 10cabe44
......@@ -52,6 +52,9 @@ set(CMAKE_CXX_STANDARD 11)
add_definitions(-std=c++11 -D_GLIBCXX_USE_CXX11_ABI)
#add_definitions(-fPIC)
# for application plugins
add_definitions("-DBUILD_APPLI")
if(BUILD_FOR_MINGW)
# stuff needed by mingw
......@@ -93,6 +96,7 @@ find_package(Threads REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui OpenGL Svg REQUIRED)
find_package(PNG REQUIRED)
find_package(Qwt REQUIRED)
find_package(Julia)
find_package(Minuit2)
find_package(ZLIB)
find_package(BZip2)
......@@ -193,16 +197,27 @@ include_directories("${BZIP2_INCLUDE_DIR}")
# py scripting support
if(Python3_Interpreter_FOUND AND Python3_Development_FOUND)
message("Enabling py scripting support.")
add_definitions(-DUSE_PY)
include_directories("${Python3_INCLUDE_DIRS}")
else()
message("Disabling py scripting support.")
add_definitions(-DNO_PY)
endif()
# jl scripting support
if(Julia_FOUND)
message("Enabling jl scripting support.")
add_definitions(-DUSE_JL)
include_directories("${Julia_INCLUDE_DIRS}")
else()
message("Disabling jl scripting support.")
add_definitions(-DNO_JL)
endif()
# fitting support
if(Minuit2_FOUND)
message("Enabling fitting support.")
......@@ -388,30 +403,58 @@ endif()
if(USE_PLUGINS)
# -----------------------------------------------------------------------------
# build plugins
# -----------------------------------------------------------------------------
add_library(pymod SHARED
if(Python3_Interpreter_FOUND AND Python3_Development_FOUND)
#add_library(takinmod_py SHARED
add_executable(takinmod_py
tools/monteconvo/sqw_py.cpp tools/monteconvo/sqwbase.cpp
tlibs/log/log.cpp
tlibs/math/rand.cpp
)
target_link_libraries(pymod
target_link_libraries(takinmod_py
Boost::iostreams Boost::system Boost::filesystem
Boost::python37 ${Python3_LIBRARIES}
Threads::Threads ${Rt_LIBRARIES}
)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_custom_command(TARGET pymod POST_BUILD
COMMAND strip -v $<TARGET_FILE:pymod>
MAIN_DEPENDENCY pymod
add_custom_command(TARGET takinmod_py POST_BUILD
COMMAND strip -v $<TARGET_FILE:takinmod_py>
MAIN_DEPENDENCY takinmod_py
)
endif()
# -----------------------------------------------------------------------------
endif()
if(Julia_FOUND)
#add_library(takinmod_jl SHARED
add_executable(takinmod_jl
tools/monteconvo/sqw_jl.cpp tools/monteconvo/sqwbase.cpp
tlibs/log/log.cpp
tlibs/math/rand.cpp
)
target_link_libraries(takinmod_jl
Boost::iostreams Boost::system Boost::filesystem
${Julia_LIBRARIES}
Threads::Threads ${Rt_LIBRARIES}
)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_custom_command(TARGET takinmod_jl POST_BUILD
COMMAND strip -v $<TARGET_FILE:takinmod_jl>
MAIN_DEPENDENCY takinmod_jl
)
endif()
endif()
# -----------------------------------------------------------------------------
......@@ -499,6 +542,14 @@ if(USE_PLUGINS)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/plugins DESTINATION share/takin COMPONENT takinplugins)
endif()
if(Python3_Interpreter_FOUND AND Python3_Development_FOUND)
install(TARGETS takinmod_py DESTINATION bin COMPONENT apptakinmod_py)
endif()
if(Julia_FOUND)
install(TARGETS takinmod_jl DESTINATION bin COMPONENT apptakinmod_jl)
endif()
install(DIRECTORY ${PROJECT_SOURCE_DIR}/examples ${PROJECT_SOURCE_DIR}/doc
DESTINATION share/takin COMPONENT takindata1)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/res/data ${PROJECT_SOURCE_DIR}/res/doc ${PROJECT_SOURCE_DIR}/res/icons
......
find_path(Clipper_INCLUDE_DIRS
NAMES clipper.h
PATH_SUFFIXES clipper
HINTS /usr/include/clipper /usr/local/include/clipper /opt/local/include/clipper
HINTS /usr/local/include/clipper /usr/local/include /usr/include/clipper /usr/include /opt/local/include/clipper /opt/local/include
DOC "Clipper include directories"
)
find_library(Clipper_LIBRARIES
NAMES libclipper-core.so
HINTS /usr/lib64/ /usr/lib/ /usr/local/lib64 /usr/local/lib /opt/local/lib
HINTS /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /opt/local/lib /usr/lib32 /usr/local/lib32
DOC "Clipper library"
)
......
find_library(Dl_LIBRARIES
NAMES libdl.so
HINTS /usr/lib64/ /usr/lib/ /usr/local/lib64 /usr/local/lib /opt/local/lib
HINTS /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /opt/local/lib /usr/lib32 /usr/local/lib32
DOC "DL library"
)
......
find_path(Julia_INCLUDE_DIRS
NAMES julia.h
HINTS /usr/local/include /usr/local/include/julia /usr/include /usr/include/julia /opt/local/include /opt/local/include/julia
DOC "Julia include directories"
)
list(APPEND Julia_INCLUDE_DIRS "${Julia_INCLUDE_DIRS}/..")
find_library(Julia_LIBRARIES
NAMES julia
HINTS /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /opt/local/lib /usr/lib32 /usr/local/lib32
DOC "Julia libraries"
)
if(Julia_INCLUDE_DIRS AND Julia_LIBRARIES)
set(Julia_FOUND 1)
message("Julia include directories: ${Julia_INCLUDE_DIRS}")
message("Julia library: ${Julia_LIBRARIES}")
else()
set(Julia_FOUND 0)
message("Error: Julia could not be found!")
endif()
find_path(QWT_INCLUDE_DIRS
NAMES qwt.h
PATH_SUFFIXES qwt6-qt5 qwt-qt5 qwt6 qwt
HINTS /usr/include /usr/local/include /opt/local/include
HINTS /usr/local/include /usr/include /opt/local/include
DOC "Qwt include directories"
)
......@@ -10,7 +10,7 @@ list(APPEND QWT_INCLUDE_DIRS "${QWT_INCLUDE_DIRS}/..")
find_library(QWT_LIBRARIES
NAMES qwt6-qt5 qwt-qt5 qwt6 qwt
HINTS /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /usr/lib32 /usr/local/lib32
HINTS /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /opt/local/lib /usr/lib32 /usr/local/lib32
DOC "Qwt libraries"
)
......
find_library(Rt_LIBRARIES
NAMES librt.so
HINTS /usr/lib64/ /usr/lib/ /usr/local/lib64 /usr/local/lib /opt/local/lib
HINTS /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /opt/local/lib /usr/lib32 /usr/local/lib32
DOC "RT library"
)
......@@ -16,7 +16,7 @@ endif()
find_library(Mp_LIBRARIES
NAMES libgomp.so libgomp.so.1
HINTS /usr/lib64/ /usr/lib/ /usr/local/lib64 /usr/local/lib /opt/local/lib
HINTS /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /opt/local/lib /usr/lib32 /usr/local/lib32
DOC "MP library"
)
......
......@@ -153,7 +153,7 @@ else
endif
ifeq ($(USE_PLUGINS), 1)
DEFINES += -DUSE_PLUGINS
DEFINES += -DUSE_PLUGINS -DBUILD_PLUGIN
else
DEFINES += -DNO_PLUGINS
endif
......
......@@ -13,8 +13,12 @@
using t_real = t_real_reso;
static const char* pcModIdent = "jl";
static const char* pcModName = "Julia Model";
#define MAX_PARAM_VAL_SIZE 128
extern "C" void jl_init__threading();
......@@ -361,15 +365,14 @@ SqwBase* SqwJl::shallow_copy() const
// ----------------------------------------------------------------------------
// SO interface
#ifdef BUILD_PLUGIN
#include <boost/dll/alias.hpp>
#include "sqw_proc.h"
#include "sqw_proc_impl.h"
#include "libs/version.h"
static const char* pcModIdent = "jl";
static const char* pcModName = "Julia Model";
std::tuple<std::string, std::string, std::string> sqw_info()
{
//tl::log_info("In ", __func__, ".");
......@@ -404,4 +407,39 @@ BOOST_DLL_ALIAS(sqw_construct, takin_sqw);
// alternate raw construction interface
//BOOST_DLL_ALIAS(sqw_construct_raw, takin_sqw_new);
//BOOST_DLL_ALIAS(sqw_destruct_raw, takin_sqw_del);
#endif
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// external program
#ifdef BUILD_APPLI
#include "sqw_proc.h"
#include "sqw_proc_impl.h"
#include "libs/version.h"
int main(int argc, char** argv)
{
if(argc <= 2)
{
std::cout << "#\n# This is a Takin plugin module.\n#\n";
std::cout << "module_ident: " << pcModIdent << "\n";
std::cout << "module_name: " << pcModName << "\n";
std::cout << "required_takin_version: " << TAKIN_VER << "\n";
std::cout.flush();
return 0;
}
const char* pcCfgFile = argv[1];
const char* pcSharedMem = argv[2];
SqwProc<SqwJl> proc(pcCfgFile, SqwProcStartMode::START_CHILD, pcSharedMem);
return 0;
}
#endif
// ----------------------------------------------------------------------------
......@@ -16,12 +16,22 @@
#include <boost/interprocess/ipc/message_queue.hpp>
enum class SqwProcStartMode
{
START_PARENT_CREATE_CHILD,
START_PARENT_FORK_CHILD,
START_CHILD
};
template<class t_sqw>
class SqwProc : public SqwBase
{
private:
std::size_t m_iRefCnt = 0;
protected:
mutable std::shared_ptr<std::mutex> m_pmtx;
......@@ -32,9 +42,11 @@ protected:
std::shared_ptr<boost::interprocess::message_queue> m_pmsgIn, m_pmsgOut;
void *m_pSharedPars = nullptr;
public:
SqwProc();
SqwProc(const char* pcCfg);
SqwProc(const char* pcCfg, SqwProcStartMode mode=SqwProcStartMode::START_PARENT_FORK_CHILD,
const char* pcProcMemName = nullptr, const char* pcProcExecName = nullptr);
explicit SqwProc(const std::string& strCfg);
virtual ~SqwProc();
......
......@@ -10,6 +10,7 @@
#include "sqw_proc.h"
#include "tlibs/string/string.h"
#include "tlibs/file/file.h"
#include "tlibs/log/log.h"
#include "tlibs/math/rand.h"
......@@ -103,6 +104,7 @@ static void pars_to_str(t_sh_str& str, const std::vector<SqwBase::t_var>& vec)
try
{
str.clear();
//str.reserve(PARAM_MEM*0.9);
std::size_t iLenTotal = 0;
for(const SqwBase::t_var& var : vec)
......@@ -194,6 +196,7 @@ enum class ProcMsgTypes
READY,
};
struct ProcMsg
{
ProcMsgTypes ty = ProcMsgTypes::NOP;
......@@ -201,10 +204,9 @@ struct ProcMsg
t_real dParam1, dParam2, dParam3, dParam4;
t_real dRet;
bool bRet;
t_sh_str *pPars = nullptr;
};
static void msg_send(ipr::message_queue& msgqueue, const ProcMsg& msg)
{
try
......@@ -217,6 +219,7 @@ static void msg_send(ipr::message_queue& msgqueue, const ProcMsg& msg)
}
}
static ProcMsg msg_recv(ipr::message_queue& msgqueue)
{
ProcMsg msg;
......@@ -245,16 +248,20 @@ static ProcMsg msg_recv(ipr::message_queue& msgqueue)
template<class t_sqw>
static void child_proc(ipr::message_queue& msgToParent, ipr::message_queue& msgFromParent,
const char* pcCfg)
const char* pcCfg, void* pSharedPars)
{
std::unique_ptr<t_sqw> pSqw(new t_sqw(pcCfg));
// tell parent that pSqw is inited
ProcMsg msgReady;
msgReady.ty = ProcMsgTypes::READY;
pid_t pid = getpid();
msgReady.dRet = *((double*)&pid);
msgReady.bRet = pSqw->IsOk();
msg_send(msgToParent, msgReady);
t_sh_str *pPars = static_cast<t_sh_str*>(pSharedPars);
while(1)
{
ProcMsg msg = msg_recv(msgFromParent);
......@@ -265,8 +272,7 @@ static void child_proc(ipr::message_queue& msgToParent, ipr::message_queue& msgF
case ProcMsgTypes::DISP: // dispersion
{
msgRet.ty = msg.ty;
msgRet.pPars = msg.pPars; // use provided pointer to shared mem
disp_to_str(*msgRet.pPars, pSqw->disp(msg.dParam1, msg.dParam2, msg.dParam3));
disp_to_str(*pPars, pSqw->disp(msg.dParam1, msg.dParam2, msg.dParam3));
msg_send(msgToParent, msgRet);
break;
}
......@@ -280,14 +286,13 @@ static void child_proc(ipr::message_queue& msgToParent, ipr::message_queue& msgF
case ProcMsgTypes::GET_VARS: // get variables
{
msgRet.ty = msg.ty;
msgRet.pPars = msg.pPars; // use provided pointer to shared mem
pars_to_str(*msgRet.pPars, pSqw->GetVars());
pars_to_str(*pPars, pSqw->GetVars());
msg_send(msgToParent, msgRet);
break;
}
case ProcMsgTypes::SET_VARS: // set variables
{
pSqw->SetVars(str_to_pars(*msg.pPars));
pSqw->SetVars(str_to_pars(*pPars));
msgRet.ty = ProcMsgTypes::READY;
msgRet.bRet = 1;
msg_send(msgToParent, msgRet);
......@@ -311,6 +316,8 @@ static void child_proc(ipr::message_queue& msgToParent, ipr::message_queue& msgF
}
}
}
tl::log_debug("Child process ", getpid(), " message loop has ended.");
}
......@@ -330,48 +337,90 @@ SqwProc<t_sqw>::SqwProc()
* create sub-process
*/
template<class t_sqw>
SqwProc<t_sqw>::SqwProc(const char* pcCfg)
SqwProc<t_sqw>::SqwProc(const char* pcCfg, SqwProcStartMode mode,
const char* pcProcMemName, const char* pcProcExecName)
: m_pmtx(std::make_shared<std::mutex>()),
m_strProcName(tl::rand_name<std::string>(8))
{
++m_iRefCnt;
// if a process name is given (e.g. for the child process), use it
if(pcProcMemName)
m_strProcName = pcProcMemName;
try
{
tl::log_debug("Creating process memory \"", "takin_sqw_proc_*_", m_strProcName, "\".");
if(mode == SqwProcStartMode::START_PARENT_CREATE_CHILD || mode == SqwProcStartMode::START_PARENT_FORK_CHILD)
{
tl::log_debug("Creating process memory \"", "takin_sqw_proc_*_", m_strProcName, "\".");
m_pMem = std::make_shared<ipr::managed_shared_memory>(ipr::create_only,
("takin_sqw_proc_mem_" + m_strProcName).c_str(), PARAM_MEM);
m_pSharedPars = static_cast<void*>(m_pMem->construct<t_sh_str>
(("takin_sqw_proc_params_" + m_strProcName).c_str())
(t_sh_str_alloc(m_pMem->get_segment_manager())));
m_pMem = std::make_shared<ipr::managed_shared_memory>(ipr::create_only,
("takin_sqw_proc_mem_" + m_strProcName).c_str(), PARAM_MEM);
m_pSharedPars = static_cast<void*>(m_pMem->construct<t_sh_str>
(("takin_sqw_proc_params_" + m_strProcName).c_str())
(t_sh_str_alloc(m_pMem->get_segment_manager())));
m_pmsgIn = std::make_shared<ipr::message_queue>(ipr::create_only,
("takin_sqw_proc_in_" + m_strProcName).c_str(), MSG_QUEUE_SIZE, sizeof(ProcMsg));
m_pmsgOut = std::make_shared<ipr::message_queue>(ipr::create_only,
("takin_sqw_proc_out_" + m_strProcName).c_str(), MSG_QUEUE_SIZE, sizeof(ProcMsg));
m_pmsgIn = std::make_shared<ipr::message_queue>(ipr::create_only,
("takin_sqw_proc_in_" + m_strProcName).c_str(), MSG_QUEUE_SIZE, sizeof(ProcMsg));
m_pmsgOut = std::make_shared<ipr::message_queue>(ipr::create_only,
("takin_sqw_proc_out_" + m_strProcName).c_str(), MSG_QUEUE_SIZE, sizeof(ProcMsg));
m_pidChild = fork();
if(m_pidChild < 0)
{
tl::log_err("Cannot fork process.");
return;
if(mode == SqwProcStartMode::START_PARENT_FORK_CHILD)
{
m_pidChild = fork();
if(m_pidChild < 0)
{
tl::log_err("Cannot fork process.");
return;
}
else if(m_pidChild == 0)
{
child_proc<t_sqw>(*m_pmsgIn, *m_pmsgOut, pcCfg, m_pSharedPars);
exit(0);
return;
}
}
else if(mode == SqwProcStartMode::START_PARENT_CREATE_CHILD)
{
if(!tl::file_exists(pcProcExecName))
{
tl::log_err("Child process file \"", pcProcExecName, "\" does not exist.");
return;
}
// start child process
std::system((std::string(pcProcExecName)
+ std::string(" \"") + pcCfg + std::string("\" ")
+ m_strProcName + " &").c_str());
}
tl::log_debug("Waiting for client to become ready...");
ProcMsg msgReady = msg_recv(*m_pmsgIn);
if(mode == SqwProcStartMode::START_PARENT_CREATE_CHILD)
m_pidChild = *((pid_t*)&msgReady.dRet);
if(!msgReady.bRet)
tl::log_err("Client ", m_pidChild, " reports failure.");
else
tl::log_debug("Client ", m_pidChild, " is ready.");
m_bOk = msgReady.bRet;
}
else if(m_pidChild == 0)
else if(mode == SqwProcStartMode::START_CHILD)
{
child_proc<t_sqw>(*m_pmsgIn, *m_pmsgOut, pcCfg);
exit(0);
return;
m_pMem = std::make_shared<ipr::managed_shared_memory>(ipr::open_only,
("takin_sqw_proc_mem_" + m_strProcName).c_str());
m_pSharedPars = static_cast<void*>(m_pMem->find<t_sh_str>
(("takin_sqw_proc_params_" + m_strProcName).c_str()).first);
m_pmsgIn = std::make_shared<ipr::message_queue>(ipr::open_only,
("takin_sqw_proc_in_" + m_strProcName).c_str());
m_pmsgOut = std::make_shared<ipr::message_queue>(ipr::open_only,
("takin_sqw_proc_out_" + m_strProcName).c_str());
m_pidChild = 0;
child_proc<t_sqw>(*m_pmsgIn, *m_pmsgOut, pcCfg, m_pSharedPars);
}
tl::log_debug("Waiting for client ", m_pidChild, " to become ready...");
ProcMsg msgReady = msg_recv(*m_pmsgIn);
if(!msgReady.bRet)
tl::log_err("Client ", m_pidChild, " reports failure.");
else
tl::log_debug("Client ", m_pidChild, " is ready.");
m_bOk = msgReady.bRet;
}
catch(const std::exception& ex)
{
......@@ -403,6 +452,7 @@ SqwProc<t_sqw>::~SqwProc()
if(m_pMem.use_count() > 1)
return;
// shut down the parent process
try
{
if(m_pmsgOut)
......@@ -449,11 +499,12 @@ SqwProc<t_sqw>::disp(t_real dh, t_real dk, t_real dl) const
msg.dParam1 = dh;
msg.dParam2 = dk;
msg.dParam3 = dl;
msg.pPars = static_cast<decltype(msg.pPars)>(m_pSharedPars);
msg_send(*m_pmsgOut, msg);
t_sh_str *pPars = static_cast<t_sh_str*>(m_pSharedPars);
ProcMsg msgDisp = msg_recv(*m_pmsgIn);
return str_to_disp(*msgDisp.pPars);
return str_to_disp(*pPars);
}
......@@ -503,11 +554,12 @@ std::vector<SqwBase::t_var> SqwProc<t_sqw>::GetVars() const
ProcMsg msg;
msg.ty = ProcMsgTypes::GET_VARS;
msg.pPars = static_cast<decltype(msg.pPars)>(m_pSharedPars);
msg_send(*m_pmsgOut, msg);
t_sh_str *pPars = static_cast<t_sh_str*>(m_pSharedPars);
ProcMsg msgRet = msg_recv(*m_pmsgIn);
return str_to_pars(*msg.pPars);
return str_to_pars(*pPars);
}
......@@ -519,11 +571,12 @@ void SqwProc<t_sqw>::SetVars(const std::vector<SqwBase::t_var>& vecVars)
{
std::lock_guard<std::mutex> lock(*m_pmtx);
t_sh_str *pPars = static_cast<t_sh_str*>(m_pSharedPars);
ProcMsg msg;
msg.ty = ProcMsgTypes::SET_VARS;
msg.pPars = static_cast<decltype(msg.pPars)>(m_pSharedPars);
pars_to_str(*msg.pPars, vecVars);
//tl::log_debug("Message string: ", *msg.pPars);
pars_to_str(*pPars, vecVars);
//tl::log_debug("Message string: ", *pPars);
msg_send(*m_pmsgOut, msg);
ProcMsg msgRet = msg_recv(*m_pmsgIn);
......
......@@ -3,6 +3,9 @@
* @author Tobias Weber <tobias.weber@tum.de>
* @date aug-2015
* @license GPLv2
*
* test:
* g++ -DBUILD_APPLI -I. -I/usr/include/python3.7m -o tst tools/monteconvo/sqw_py.cpp tlibs/log/log.cpp tlibs/math/rand.cpp tools/monteconvo/sqwbase.cpp -lboost_system -lboost_filesystem -lboost_python37 -lpython3.7m -lrt -lpthread
*/
#include "sqw_py.h"
......@@ -14,6 +17,9 @@
using t_real = t_real_reso;
static const char* pcModIdent = "py";
static const char* pcModName = "Python Model";
#define MAX_PARAM_VAL_SIZE 128
......@@ -349,18 +355,17 @@ SqwBase* SqwPy::shallow_copy() const
// ----------------------------------------------------------------------------
// SO interface
#ifdef BUILD_PLUGIN
#include <boost/dll/alias.hpp>
#include "sqw_proc.h"
#include "sqw_proc_impl.h"
#include "libs/version.h"
static const char* pcModIdent = "py";
static const char* pcModName = "Python Model";
std::tuple<std::string, std::string, std::string> sqw_info()
{
//tl::log_info("In ", __func__, ".");
......@@ -397,4 +402,40 @@ BOOST_DLL_ALIAS(sqw_construct, takin_sqw);
// alternate raw construction interface
//BOOST_DLL_ALIAS(sqw_construct_raw, takin_sqw_new);
//BOOST_DLL_ALIAS(sqw_destruct_raw, takin_sqw_del);
#endif
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// external program
#ifdef BUILD_APPLI
#include "sqw_proc.h"
#include "sqw_proc_impl.h"
#include "libs/version.h"
int main(int argc, char** argv)
{
if(argc <= 2)
{
std::cout << "#\n# This is a Takin plugin module.\n#\n";
std::cout << "module_ident: " << pcModIdent << "\n";
std::cout << "module_name: " << pcModName << "\n";
std::cout << "required_takin_version: " << TAKIN_VER << "\n";
std::cout.flush();
return 0;
}
const char* pcCfgFile = argv[1];
const char* pcSharedMem = argv[2];
SqwProc<SqwPy> proc(pcCfgFile, SqwProcStartMode::START_CHILD, pcSharedMem);
return 0;
}
#endif
// ----------------------------------------------------------------------------
This diff is collapsed.
/**
* dummy S(q,w) model
* @author Tobias Weber <tobias.weber@tum.de>
* @date 8-apr-2020
* @license GPLv2
*/
#ifndef __MCONV_SQW_DUMMY_H__
#define __MCONV_SQW_DUMMY_H__
#include "sqwbase.h"
class SqwNull : public SqwBase
{
public:
SqwNull() {}
SqwNull(const char*) {}
~SqwNull() {}
virtual std::tuple<std::vector<t_real_reso>, std::vector<t_real_reso>>
disp(t_real_reso dh, t_real_reso dk, t_real_reso dl) const override
{
return std::make_tuple(std::vector<t_real_reso>{}, std::vector<t_real_reso>{});
}
virtual t_real_reso operator()(t_real_reso dh, t_real_reso dk, t_real_reso dl, t_real_reso dE) const override
{
return t_real_reso{0};
}
virtual bool IsOk() const override
{
return 1;
}
virtual std::vector<t_var> GetVars() const override
{
return std::vector<t_var>{};
}
virtual const std::vector<t_var_fit>& GetFitVars() const override
{
static std::vector<t_var_fit> vec;
return vec;
}
virtual void SetVars(const std::vector<t_var>& vars) override
{
}
virtual void SetFitVars(const std::vector<t_var_fit>& vecFit) override
{
}
virtual bool SetVarIfAvail(const std::string& strKey, const std::string& strNewVal) override
{
return 1;
}
virtual const SqwBase& operator=(const SqwBase& sqw) override
{
return *this;
}