/[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 119 by jgs, Tue Apr 12 04:45:05 2005 UTC revision 147 by jgs, Fri Aug 12 01:45:47 2005 UTC
# Line 16  Line 16 
16  ******************************************************************************/  ******************************************************************************/
17    
18  #include "escript/Data/Data.h"  #include "escript/Data/Data.h"
19    #include "escript/Data/DataVariable.h"
20  #include "escript/Data/FunctionSpace.h"  #include "escript/Data/FunctionSpace.h"
21  #include "escript/Data/FunctionSpaceFactory.h"  #include "escript/Data/FunctionSpaceFactory.h"
22  #include "escript/Data/DataFactory.h"  #include "escript/Data/DataFactory.h"
# Line 31  Line 32 
32                                                                                                                                                                                                                                                                                        
33  using namespace boost::python;  using namespace boost::python;
34    
35  /**  /*! \mainpage Esys Documentation
36     @memo   *
37     escript is the python module that contains the interfaces   * \version 1.0.0
38     to the C++ side of escript.   *
39     * - \ref escript
40     @version 1.0.0   *
41     * - \ref esys_exception "Esys Exception"
42     @doc   *
43     * - \ref finley
44     Class Description:   *
45     Data   * - <a href=http://www.esscc.uq.edu.au/~cochrane/esys_python_doc/html/index.html>Python module documentation (doxygen generated)</a>
46     *
47     Class Limitations:   * - <a href=http://www.esscc.uq.edu.au/~cochrane/esys_python_doc/index.html>Python module documentation (epydoc generated)</a>
48     None   *
49     */
50     Class Conditions of Use:  
51     None  /*! \page escript Escript
52     * Escript is the python module that contains the interfaces
53     Throws:   * to the C++ side of escript.
54     None   *
55     * \version 1.0.0
56  */   *
57     * \section class_desc Class Description:
58     * Data
59     *
60     * \section class_limits Class Limitations:
61     * None
62     *
63     * \section class_conds Class Conditions of Use:
64     * None
65     *
66     * \section class_throws Throws:
67     * None
68     *
69     */
70    
71  BOOST_PYTHON_MODULE(escriptcpp)  BOOST_PYTHON_MODULE(escriptcpp)
72  {  {
# Line 81  BOOST_PYTHON_MODULE(escriptcpp) Line 95  BOOST_PYTHON_MODULE(escriptcpp)
95       .def("getX",&escript::FunctionSpace::getX)       .def("getX",&escript::FunctionSpace::getX)
96       .def("getNormal",&escript::FunctionSpace::getNormal)       .def("getNormal",&escript::FunctionSpace::getNormal)
97       .def("getSize",&escript::FunctionSpace::getSize)       .def("getSize",&escript::FunctionSpace::getSize)
98       .def("toString",&escript::FunctionSpace::toString)       .def("__str__",&escript::FunctionSpace::toString)
99       .def(self == self)       .def(self == self)
100       .def(self != self);       .def(self != self);
101    
102    //    //
103      // Interface for DataVariable
104      //
105      class_<escript::DataVariable>("DataVariable",init<>())
106        .def(init<escript::Data*>())
107        .def("evaluate",&escript::DataVariable::evaluate)
108        .def("sum",&escript::DataVariable::sum)
109        .def("diff",&escript::DataVariable::diff);
110    
111      //
112    // Interface for Data    // Interface for Data
113    //    //
114    class_<escript::Data>("Data",init<>())    class_<escript::Data>("Data",init<>())
# Line 109  BOOST_PYTHON_MODULE(escriptcpp) Line 132  BOOST_PYTHON_MODULE(escriptcpp)
132      .def("getRefValue",&escript::Data::getRefValue)      .def("getRefValue",&escript::Data::getRefValue)
133      .def("expand",&escript::Data::expand)      .def("expand",&escript::Data::expand)
134      .def("tag",&escript::Data::tag)      .def("tag",&escript::Data::tag)
135        .def("copy",&escript::Data::copy)
136    
137      .def("saveDX",&escript::Data::saveDX)      .def("saveDX",&escript::Data::saveDX)
138      .def("saveVTK",&escript::Data::saveVTK)      .def("saveVTK",&escript::Data::saveVTK)
139      .def("wherePositive",&escript::Data::wherePositive)      .def("wherePositive",&escript::Data::wherePositive)
# Line 122  BOOST_PYTHON_MODULE(escriptcpp) Line 147  BOOST_PYTHON_MODULE(escriptcpp)
147      .def("grad",&escript::Data::gradOn)      .def("grad",&escript::Data::gradOn)
148      .def("grad",&escript::Data::grad)      .def("grad",&escript::Data::grad)
149      .def("convertToNumArray",&escript::Data::convertToNumArray)      .def("convertToNumArray",&escript::Data::convertToNumArray)
150        .def("convertToNumArrayFromSampleNo",&escript::Data::convertToNumArrayFromSampleNo)
151        .def("convertToNumArrayFromDPNo",&escript::Data::convertToNumArrayFromDPNo)
152        .def("fillFromNumArray",&escript::Data::fillFromNumArray)
153      .def("archiveData",&escript::Data::archiveData)      .def("archiveData",&escript::Data::archiveData)
154      .def("extractData",&escript::Data::extractData)      .def("extractData",&escript::Data::extractData)
155      .def("integrate",&escript::Data::integrate)      .def("integrate",&escript::Data::integrate)
# Line 137  BOOST_PYTHON_MODULE(escriptcpp) Line 165  BOOST_PYTHON_MODULE(escriptcpp)
165      .def("sup",&escript::Data::sup)      .def("sup",&escript::Data::sup)
166      .def("inf",&escript::Data::inf)      .def("inf",&escript::Data::inf)
167      .def("__abs__",&escript::Data::abs)      .def("__abs__",&escript::Data::abs)
168        .def("abs",&escript::Data::abs)
169      .def("exp",&escript::Data::exp)      .def("exp",&escript::Data::exp)
170      .def("sqrt",&escript::Data::sqrt)      .def("sqrt",&escript::Data::sqrt)
171      .def("maxval",&escript::Data::maxval)      .def("maxval",&escript::Data::maxval)
172      .def("minval",&escript::Data::minval)      .def("minval",&escript::Data::minval)
173        .def("mindp",&escript::Data::mindp)
174      .def("length",&escript::Data::length)      .def("length",&escript::Data::length)
175      .def("sign",&escript::Data::sign)      .def("sign",&escript::Data::sign)
176      // following implements the python "-" negation operator      // following implements the python "-" negation operator
177      .def("__neg__",&escript::Data::neg)      .def("__neg__",&escript::Data::neg)
178        .def("neg",&escript::Data::neg)
179      // following implements the python "+" identity operator      // following implements the python "+" identity operator
180      .def("__pos__",&escript::Data::pos)      .def("__pos__",&escript::Data::pos)
181        .def("pos",&escript::Data::pos)
182      // following two functions implement the python [] operator      // following two functions implement the python [] operator
183      .def("__getitem__",&escript::Data::getItem)      .def("__getitem__",&escript::Data::getItem)
184      .def("__setitem__",&escript::Data::setItemO)      .def("__setitem__",&escript::Data::setItemO)
# Line 225  BOOST_PYTHON_MODULE(escriptcpp) Line 257  BOOST_PYTHON_MODULE(escriptcpp)
257       .def("solve",&escript::AbstractSystemMatrix::solve)       .def("solve",&escript::AbstractSystemMatrix::solve)
258       .def("of",&escript::AbstractSystemMatrix::vectorMultiply)       .def("of",&escript::AbstractSystemMatrix::vectorMultiply)
259       .def("saveMM",&escript::AbstractSystemMatrix::saveMM)       .def("saveMM",&escript::AbstractSystemMatrix::saveMM)
260         .def("saveHB",&escript::AbstractSystemMatrix::saveHB)
261       .def("setValue",&escript::AbstractSystemMatrix::setValue)       .def("setValue",&escript::AbstractSystemMatrix::setValue)
262       .def("resetSolver",&escript::AbstractSystemMatrix::resetSolver)       .def("resetSolver",&escript::AbstractSystemMatrix::resetSolver)
263       .def(self*other<escript::Data>());       .def(self*other<escript::Data>());

Legend:
Removed from v.119  
changed lines
  Added in v.147

  ViewVC Help
Powered by ViewVC 1.1.26