/[escript]/trunk/escript/src/escriptcpp.cpp
ViewVC logotype

Diff of /trunk/escript/src/escriptcpp.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2064 by jfenwick, Thu Nov 20 04:06:34 2008 UTC revision 2308 by gross, Mon Mar 16 01:20:56 2009 UTC
# Line 27  Line 27 
27    
28    
29  extern "C" {  extern "C" {
30  #include "escript/blocktimer.h"  #include "esysUtils/blocktimer.h"
31  }  }
32    
33  #include "esysUtils/esysExceptionTranslator.h"  #include "esysUtils/esysExceptionTranslator.h"
34    
35    #include <boost/version.hpp>
36  #include <boost/python.hpp>  #include <boost/python.hpp>
37  #include <boost/python/module.hpp>  #include <boost/python/module.hpp>
38  #include <boost/python/def.hpp>  #include <boost/python/def.hpp>
# Line 53  using namespace boost::python; Line 54  using namespace boost::python;
54   *   *
55   * - \ref finley   * - \ref finley
56   *   *
57   * - <a href=http://iservo.edu.au/esys/epydoc/index.html>Python module documentation (epydoc generated)</a>   * - <a href="../../epydoc/index.html">Python module documentation (epydoc generated)</a>
58   *   *
59   */   */
60    
# Line 80  using namespace boost::python; Line 81  using namespace boost::python;
81  BOOST_PYTHON_MODULE(escriptcpp)  BOOST_PYTHON_MODULE(escriptcpp)
82  {  {
83  // This feature was added in boost v1.34  // This feature was added in boost v1.34
84  #if ((BOOST_VERSION/100)%1000 > 33) || (BOOST_VERSION/100000 >1)  #if ((BOOST_VERSION/100)%1000 > 34) || (BOOST_VERSION/100000 >1)
85  //#if ((BOOST_VERSION/100)%1000) > 33  //#if ((BOOST_VERSION/100)%1000) > 34
86    // params are: bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures    // params are: bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures
87      #if BOOST_VERSION > 103399
88    docstring_options docopt(true, true, false);    docstring_options docopt(true, true, false);
89      #endif
90  #endif  #endif
91    
92    def("setNumberOfThreads",escript::setNumberOfThreads);    def("setNumberOfThreads",escript::setNumberOfThreads);
# Line 98  BOOST_PYTHON_MODULE(escriptcpp) Line 101  BOOST_PYTHON_MODULE(escriptcpp)
101    def("printParallelThreadCounts",escript::printParallelThreadCnt);    def("printParallelThreadCounts",escript::printParallelThreadCnt);
102    def("getMPISizeWorld",escript::getMPISizeWorld);    def("getMPISizeWorld",escript::getMPISizeWorld);
103    def("getMPIRankWorld",escript::getMPIRankWorld);    def("getMPIRankWorld",escript::getMPIRankWorld);
104      def("getMPIWorldMax",escript::getMPIWorldMax);
105      def("getMachinePrecision",escript::getMachinePrecision);
106      def("getMaxFloat",escript::getMaxFloat);
107    //    //
108    // Interface for AbstractDomain    // Interface for AbstractDomain
109    //    //
# Line 153  BOOST_PYTHON_MODULE(escriptcpp) Line 157  BOOST_PYTHON_MODULE(escriptcpp)
157    //    //
158    class_<escript::Data>("Data","Represents a collection of datapoints. It is used to store the values of a function. For more details please consult the c++ class documentation.",init<>() )    class_<escript::Data>("Data","Represents a collection of datapoints. It is used to store the values of a function. For more details please consult the c++ class documentation.",init<>() )
159      // various constructors for Data objects      // various constructors for Data objects
160      .def(init<const numeric::array&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))  //    .def(init<const numeric::array&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))
161      .def(init<const object&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))      .def(init<const object&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))
162      .def(init<const double, const tuple&, optional<const escript::FunctionSpace&, bool> >(args("value","shape","what","expand")))      .def(init<const double, const tuple&, optional<const escript::FunctionSpace&, bool> >(args("value","shape","what","expand")))
163      .def(init<const escript::Data&, const escript::FunctionSpace&>(args("value","what")))      .def(init<const escript::Data&, const escript::FunctionSpace&>(args("value","what")))
# Line 183  BOOST_PYTHON_MODULE(escriptcpp) Line 187  BOOST_PYTHON_MODULE(escriptcpp)
187      .def("tag",&escript::Data::tag)      .def("tag",&escript::Data::tag)
188      .def("resolve",&escript::Data::resolve)      .def("resolve",&escript::Data::resolve)
189      .def("copy",&escript::Data::copy)      .def("copy",&escript::Data::copy)
190      .def("copy",&escript::Data::copySelf,return_value_policy<manage_new_object>())      .def("copy",&escript::Data::copySelf)
191      .def("delay",&escript::Data::delay)      .def("delay",&escript::Data::delay)
192      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)
193      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)
194      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)
195      .def("getValueOfDataPoint",&escript::Data::getValueOfDataPoint)      .def("getValueOfDataPoint",&escript::Data::getValueOfDataPoint)
196        .def("getTupleForDataPoint",&escript::Data::getValueOfDataPointAsTuple)
197      .def("getValueOfGlobalDataPoint",&escript::Data::getValueOfGlobalDataPoint)      .def("getValueOfGlobalDataPoint",&escript::Data::getValueOfGlobalDataPoint)
198        .def("getTupleForGlobalDataPoint",&escript::Data::getValueOfGlobalDataPointAsTuple)
199      .def("setToZero",&escript::Data::setToZero)      .def("setToZero",&escript::Data::setToZero)
200      .def("interpolate",&escript::Data::interpolate)      .def("interpolate",&escript::Data::interpolate)
201      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)
# Line 239  BOOST_PYTHON_MODULE(escriptcpp) Line 245  BOOST_PYTHON_MODULE(escriptcpp)
245      .def("_sup",&escript::Data::sup)      .def("_sup",&escript::Data::sup)
246      .def("_inf",&escript::Data::inf)      .def("_inf",&escript::Data::inf)
247      .def("_integrate",&escript::Data::integrate)      .def("_integrate",&escript::Data::integrate)
248        .def("_integrateToTuple",&escript::Data::integrateToTuple)
249    
250      // following implements the python abs operator      // following implements the python abs operator
251      .def("__abs__",&escript::Data::abs)      .def("__abs__",&escript::Data::abs)
# Line 365  BOOST_PYTHON_MODULE(escriptcpp) Line 372  BOOST_PYTHON_MODULE(escriptcpp)
372        (arg("value")=0));        (arg("value")=0));
373    def("getEscriptParamInt",escript::getEscriptParamInt,    def("getEscriptParamInt",escript::getEscriptParamInt,
374        (arg("sentinel")=0));        (arg("sentinel")=0));
375      def("listEscriptParams",escript::listEscriptParams);
376    
377    //    //
378    // Register esysExceptionTranslator    // Register esysExceptionTranslator

Legend:
Removed from v.2064  
changed lines
  Added in v.2308

  ViewVC Help
Powered by ViewVC 1.1.26