1 // Copyright (C) 2021-2024 CEA, EDF
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 # new mechanism introduced in Python 3.8+ about DLL resolution
25 def __add_dll_directory__(path):
26 paths = [ p.replace("\\\\", "\\").replace("/", "\\") for p in sys.path]
27 if not path in paths and os.path.exists(path):
28 os.add_dll_directory(path)
30 print("DEBUG: directory is already present in {}".format(path))
34 if platform.system() == "Windows":
36 if sys.version_info > (3,8) :
39 _dll_exposed = os.getenv("KERNEL_DLLs_Exposed", "")
40 if _dll_exposed == "" :
41 print("INFO: Exposing DLL directories")
42 __add_dll_directory__(os.path.join(os.getenv("KERNEL_ROOT_DIR"), "lib", "salome"))
43 __add_dll_directory__(os.path.join(os.getenv("GUI_ROOT_DIR"), "lib", "salome"))
44 __add_dll_directory__(os.path.join(os.getenv("GUI_ROOT_DIR"), "lib", "salome"))
45 __add_dll_directory__(os.path.join(os.getenv("PTHREAD_ROOT_DIR"), "lib" ))
46 __add_dll_directory__(os.path.join(os.getenv("PRODUCT_ROOT_DIR"), "W64", "lib" ))
47 __add_dll_directory__(os.path.join(os.getenv("PRODUCT_ROOT_DIR"), "W64", "bin" ))
48 __add_dll_directory__(os.getenv("OMNIORB_BIN_DIR"))
49 os.environ["KERNEL_DLLs_Exposed"] = "1"
51 print("FATAL: Exception raise while trying to expose DLLs")
55 #include "KernelBasis.hxx"
56 #include "HeatMarcel.hxx"
57 #include "libSALOMELog.hxx"
58 #include "Monitoring.hxx"
59 using namespace SALOME;
67 %template(dvec) std::vector<double>;
74 catch(std::exception& e)
76 SWIG_exception(SWIG_SystemError, e.what() );
80 SWIG_exception(SWIG_UnknownError, "Unknown exception");
84 %rename (HeatMarcel) HeatMarcelSwig;
87 void setSSLMode(bool sslMode);
90 void setGUIMode(bool guiMode);
92 std::string getIOROfEmbeddedNS();
93 void setIOROfEmbeddedNS(const std::string& ior);
95 double GetTimeAdjustmentCst();
97 long LaunchMonitoring(const std::string& pyScriptToEvaluate);
99 void StopMonitoring(long pid);
101 bool VerbosityActivated();
103 void SetVerbosityActivated(bool flag);
109 bool IsWarningLevel();
113 void WriteInStdout(const std::string& msg);
115 void WriteInStderr(const std::string& msg);
117 %rename (SetVerbosityLevel) SetVerbosityLevelSwig;
118 %rename (VerbosityLevel) VerbosityLevelSwig;
122 PyObject *HeatMarcelSwig(double timeAjustment, unsigned int nbThreads = 0)
124 double timeInS = 0.0;
125 long double piVal = HeatMarcel(timeAjustment,timeInS,nbThreads);
126 PyObject *ret(PyTuple_New(2));
127 PyTuple_SetItem(ret,0,SWIG_From_double((double)piVal));
128 PyTuple_SetItem(ret,1,SWIG_From_double(timeInS));
132 std::vector<double> ReadFloatsInFileSwig(const std::string& fileName)
134 std::vector<double> ret;
137 ret = SALOME::ReadFloatsInFile( fileName );
139 catch(std::exception& e) { }
143 void SetVerbosityLevelSwig(const std::string& level)
145 SetVerbosityLevelStr(level);
148 std::string VerbosityLevelSwig()
150 return VerbosityLevelStr();
155 def ReadFloatsInFile( fileName ):
156 ret = ReadFloatsInFileSwig( fileName )