initial import
This commit is contained in:
parent
de7c965da8
commit
52e2c4c6c0
3 changed files with 61 additions and 0 deletions
11
Cantera/cxx/writelog.cpp
Normal file
11
Cantera/cxx/writelog.cpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include <string>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
void writelog(const string& s) {
|
||||
cout << s;
|
||||
}
|
||||
|
||||
}
|
||||
25
Cantera/matlab/cantera/private/write.cpp
Normal file
25
Cantera/matlab/cantera/private/write.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
#include "mex.h"
|
||||
#include <string>
|
||||
|
||||
static std::string ss = "disp('";
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
void writelog(const std::string& s) {
|
||||
char ch = s[0];
|
||||
int n = 0;
|
||||
while (ch != '\0') {
|
||||
if (ch =='\n') {
|
||||
ss += " ');";
|
||||
mexEvalString(ss.c_str());
|
||||
ss = "disp('";
|
||||
}
|
||||
else
|
||||
ss += ch;
|
||||
n++;
|
||||
ch = s[n];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
25
Cantera/python/src/writelog.cpp
Normal file
25
Cantera/python/src/writelog.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "Python.h"
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
static std::string ss = "print \"";
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
void writelog(const string& s) {
|
||||
char ch = s[0];
|
||||
int n = 0;
|
||||
while (ch != '\0') {
|
||||
if (ch =='\n') {
|
||||
ss += "\"";
|
||||
PyRun_SimpleString((char *)ss.c_str());
|
||||
ss = "print \"";
|
||||
}
|
||||
else
|
||||
ss += ch;
|
||||
n++;
|
||||
ch = s[n];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue