1 #include "MEDPresentationScalarMap.hxx"
4 MEDPresentationScalarMap::internalGeneratePipeline()
6 PyGILState_STATE _gil_state = PyGILState_Ensure();
8 std::string cmd = std::string("import pvsimple as pvs;");
9 cmd += getRenderViewCommand(_params.viewMode); // define __view1
11 cmd += std::string("__obj1 = pvs.MEDReader(FileName='") + _fileName + std::string("');");
12 cmd += std::string("__disp1 = pvs.Show(__obj1, __view1);");
13 cmd += std::string("pvs.ColorBy(__disp1, ('") + _fieldType + std::string("', '") + _fieldName + std::string("'));");
14 cmd += std::string("__disp1.SetScalarBarVisibility(__view1, True);");
15 cmd += std::string("__disp1.RescaleTransferFunctionToDataRangeOverTime();");
16 cmd += std::string("__lut = pvs.GetColorTransferFunction('")+_fieldName+std::string("');");
17 cmd += std::string("__lut.ApplyPreset('")+getColorMapCommand(_params.colorMap)+std::string("',True);");
18 cmd += std::string("pvs.Render();");
20 //std::cerr << "Python command:" << std::endl;
21 //std::cerr << cmd << std::endl;
22 PyRun_SimpleString(cmd.c_str());
23 // Retrieve Python object for internal storage:
24 PyObject* obj = getPythonObjectFromMain("__obj1");
25 PyObject* disp = getPythonObjectFromMain("__disp1");
26 pushInternal(obj, disp);
28 PyGILState_Release(_gil_state);