Skip to content
Snippets Groups Projects
Commit 81926f63 authored by Marie Wilmet's avatar Marie Wilmet
Browse files

Cas test BloodFlow 1D (Aorta+Bifurcation) .lua et .py

parent bdd62177
No related branches found
No related tags found
No related merge requests found
...@@ -599,27 +599,26 @@ class functionLua : public function { ...@@ -599,27 +599,26 @@ class functionLua : public function {
#endif #endif
// functionC // functionC
void functionC::buildLibraryFromFile(const std::string cfilename, const std::string libfilename) {
void functionC::buildLibrary(std::string code, std::string filename)
{
//todo use CMAKE_CXX_COMPILER
//todo use clean temporary file names
//todo work on windows :-)
//todo if DG_BUILD_DIR is not defined, use the directory used at compilation time
FILE *tmpSrc = fopen("_tmpSrc.cpp","w");
fprintf(tmpSrc, "%s\n",code.c_str());
fclose(tmpSrc);
FILE *tmpMake = fopen("_tmpMake","w"); FILE *tmpMake = fopen("_tmpMake","w");
fprintf(tmpMake, "include $(DG_BUILD_DIR)/CMakeFiles/dg.dir/flags.make\n" fprintf(tmpMake, "include $(DG_BUILD_DIR)/CMakeFiles/dg.dir/flags.make\n"
"%s : %s\n" "%s : %s\n"
"\tg++ -fPIC -shared -o $@ $(CXX_FLAGS) $(CXX_DEFINES) $<\n", "\tg++ -fPIC -shared -o $@ $(CXX_FLAGS) $(CXX_DEFINES) $<\n",
filename.c_str(), "_tmpSrc.cpp"); libfilename.c_str(), cfilename.c_str());
fclose(tmpMake); fclose(tmpMake);
if(system("make -f _tmpMake")) if(system("make -f _tmpMake"))
Msg::Error("make command failed\n"); Msg::Error("make command failed\n");
UnlinkFile("_tmpSrc.cpp");
UnlinkFile("_tmpMake.cpp"); UnlinkFile("_tmpMake.cpp");
} }
void functionC::buildLibrary(std::string code, std::string filename)
{
FILE *tmpSrc = fopen("_tmpSrc.cpp","w");
fprintf(tmpSrc, "%s\n",code.c_str());
fclose(tmpSrc);
buildLibraryFromFile("_tmpSrc.cpp", filename);
UnlinkFile("_tmpSrc.cpp");
}
void functionC::call (dataCacheMap *m, fullMatrix<double> &val) void functionC::call (dataCacheMap *m, fullMatrix<double> &val)
{ {
switch (args.size()) { switch (args.size()) {
......
...@@ -285,6 +285,7 @@ class functionC : public function { ...@@ -285,6 +285,7 @@ class functionC : public function {
void (*callback)(void); void (*callback)(void);
public: public:
static void buildLibrary(std::string code, std::string filename) ; static void buildLibrary(std::string code, std::string filename) ;
static void buildLibraryFromFile(const std::string cfilename, const std::string libfilename);
void call (dataCacheMap *m, fullMatrix<double> &val) ; void call (dataCacheMap *m, fullMatrix<double> &val) ;
functionC (std::string file, std::string symbol, int nbCol, functionC (std::string file, std::string symbol, int nbCol,
std::vector<const function *> dependencies); std::vector<const function *> dependencies);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment