[ck2cti] Fix to work with Cython module when called from Matlab or C++
This commit is contained in:
parent
721f0266be
commit
8a58b12698
1 changed files with 8 additions and 5 deletions
|
|
@ -150,11 +150,14 @@ void ck2cti(const std::string& in_file, const std::string& thermo_file,
|
|||
stringstream output_stream;
|
||||
|
||||
ostream& pyin = python.in();
|
||||
pyin << "if True:\n"; // Use this so that the rest is a single block
|
||||
pyin << " import sys\n";
|
||||
pyin << " sys.stderr = sys.stdout\n";
|
||||
pyin << " import ck2cti\n";
|
||||
pyin << " ck2cti.Parser().convertMech(r'" << in_file << "',";
|
||||
pyin << "if True:\n" << // Use this so that the rest is a single block
|
||||
" import sys\n" <<
|
||||
" sys.stderr = sys.stdout\n" <<
|
||||
" try:\n" <<
|
||||
" from cantera import ck2cti\n" << // Cython module
|
||||
" except ImportError:\n" <<
|
||||
" import ck2cti\n" << // legacy Python module
|
||||
" ck2cti.Parser().convertMech(r'" << in_file << "',";
|
||||
if (thermo_file != "" && thermo_file != "-") {
|
||||
pyin << " thermoFile=r'" << thermo_file << "',";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue