/[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 284 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 285 by gross, Thu Dec 1 06:40:04 2005 UTC
# Line 29  Line 29 
29  #include <boost/python/def.hpp>  #include <boost/python/def.hpp>
30  #include <boost/python/object.hpp>  #include <boost/python/object.hpp>
31  #include <boost/python/tuple.hpp>  #include <boost/python/tuple.hpp>
32                                                                                                                                              #include <boost/python/numeric.hpp>
33    
34  using namespace boost::python;  using namespace boost::python;
35    
36  /*! \mainpage Esys Documentation  /*! \mainpage Esys Documentation
# Line 122  BOOST_PYTHON_MODULE(escriptcpp) Line 123  BOOST_PYTHON_MODULE(escriptcpp)
123      .def(init<const escript::Data&>())      .def(init<const escript::Data&>())
124      // Note for Lutz, Need to specify the call policy in order to return a      // Note for Lutz, Need to specify the call policy in order to return a
125      // reference. In this case return_internal_reference.      // reference. In this case return_internal_reference.
126      .def("toString",&escript::Data::toString)      .def("__str__",&escript::Data::toString)
127      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())
128      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())
129      .def("isEmpty",&escript::Data::isEmpty)      .def("isEmpty",&escript::Data::isEmpty)
# Line 135  BOOST_PYTHON_MODULE(escriptcpp) Line 136  BOOST_PYTHON_MODULE(escriptcpp)
136      .def("expand",&escript::Data::expand)      .def("expand",&escript::Data::expand)
137      .def("tag",&escript::Data::tag)      .def("tag",&escript::Data::tag)
138      .def("copy",&escript::Data::copy)      .def("copy",&escript::Data::copy)
     .def("saveDX",&escript::Data::saveDX)  
     .def("saveVTK",&escript::Data::saveVTK)  
     .def("wherePositive",&escript::Data::wherePositive)  
     .def("whereNegative",&escript::Data::whereNegative)  
     .def("whereNonNegative",&escript::Data::whereNonNegative)  
     .def("whereNonPositive",&escript::Data::whereNonPositive)  
     .def("whereZero",&escript::Data::whereZero)  
     .def("whereNonZero",&escript::Data::whereNonZero)  
     // Unary functions for Data  
     .def("interpolate",&escript::Data::interpolate)  
     .def("grad",&escript::Data::gradOn)  
     .def("grad",&escript::Data::grad)  
139      .def("convertToNumArray",&escript::Data::convertToNumArray)      .def("convertToNumArray",&escript::Data::convertToNumArray)
140      .def("convertToNumArrayFromSampleNo",&escript::Data::convertToNumArrayFromSampleNo)      .def("convertToNumArrayFromSampleNo",&escript::Data::convertToNumArrayFromSampleNo)
141      .def("convertToNumArrayFromDPNo",&escript::Data::convertToNumArrayFromDPNo)      .def("convertToNumArrayFromDPNo",&escript::Data::convertToNumArrayFromDPNo)
142      .def("fillFromNumArray",&escript::Data::fillFromNumArray)      .def("fillFromNumArray",&escript::Data::fillFromNumArray)
143        .def("interpolate",&escript::Data::interpolate)
144        .def("mindp",&escript::Data::mindp)
145    
146        .def("saveDX",&escript::Data::saveDX)
147        .def("saveVTK",&escript::Data::saveVTK)
148      .def("getTagNumber",&escript::Data::getTagNumber)      .def("getTagNumber",&escript::Data::getTagNumber)
149      .def("archiveData",&escript::Data::archiveData)      .def("archiveData",&escript::Data::archiveData)
150      .def("extractData",&escript::Data::extractData)      .def("extractData",&escript::Data::extractData)
151      .def("integrate",&escript::Data::integrate)      // Unary functions for Data
152      .def("transpose",&escript::Data::transpose)      .def("_interpolate",&escript::Data::interpolate)
153      .def("trace",&escript::Data::trace)      .def("_grad",&escript::Data::gradOn)
154      .def("sin",&escript::Data::sin)      .def("_grad",&escript::Data::grad)
155      .def("cos",&escript::Data::cos)      .def("_transpose",&escript::Data::transpose)
156      .def("tan",&escript::Data::tan)      .def("_trace",&escript::Data::trace)
157      .def("asin",&escript::Data::asin)      .def("_maxval",&escript::Data::maxval)
158      .def("acos",&escript::Data::acos)      .def("_minval",&escript::Data::minval)
159      .def("atan",&escript::Data::atan)      .def("_wherePositive",&escript::Data::wherePositive)
160      .def("sinh",&escript::Data::sinh)      .def("_whereNegative",&escript::Data::whereNegative)
161      .def("cosh",&escript::Data::cosh)      .def("_whereNonNegative",&escript::Data::whereNonNegative)
162      .def("tanh",&escript::Data::tanh)      .def("_whereNonPositive",&escript::Data::whereNonPositive)
163      .def("asinh",&escript::Data::asinh)      .def("_whereZero",&escript::Data::whereZero)
164      .def("acosh",&escript::Data::acosh)      .def("_whereNonZero",&escript::Data::whereNonZero)
165      .def("atanh",&escript::Data::atanh)      .def("_sin",&escript::Data::sin)
166      .def("log",&escript::Data::log)      .def("_cos",&escript::Data::cos)
167      .def("ln",&escript::Data::ln)      .def("_tan",&escript::Data::tan)
168      .def("Lsup",&escript::Data::Lsup)      .def("_asin",&escript::Data::asin)
169      .def("Linf",&escript::Data::Lsup)      .def("_acos",&escript::Data::acos)
170      .def("sup",&escript::Data::sup)      .def("_atan",&escript::Data::atan)
171      .def("inf",&escript::Data::inf)      .def("_sinh",&escript::Data::sinh)
172        .def("_cosh",&escript::Data::cosh)
173        .def("_tanh",&escript::Data::tanh)
174        .def("_asinh",&escript::Data::asinh)
175        .def("_acosh",&escript::Data::acosh)
176        .def("_atanh",&escript::Data::atanh)
177        .def("_exp",&escript::Data::exp)
178        .def("_sqrt",&escript::Data::sqrt)
179        .def("_log10",&escript::Data::log10)
180        .def("_log",&escript::Data::log)
181        .def("_sign",&escript::Data::sign)
182        // functions returning a single real number:
183        .def("_Lsup",&escript::Data::Lsup)
184        .def("_sup",&escript::Data::sup)
185        .def("_inf",&escript::Data::inf)
186        .def("_integrate",&escript::Data::integrate)
187    
188        // following implements the python abs operator
189      .def("__abs__",&escript::Data::abs)      .def("__abs__",&escript::Data::abs)
     .def("abs",&escript::Data::abs)  
     .def("exp",&escript::Data::exp)  
     .def("sqrt",&escript::Data::sqrt)  
     .def("maxval",&escript::Data::maxval)  
     .def("minval",&escript::Data::minval)  
     .def("mindp",&escript::Data::mindp)  
     .def("length",&escript::Data::length)  
     .def("sign",&escript::Data::sign)  
190      // following implements the python "-" negation operator      // following implements the python "-" negation operator
191      .def("__neg__",&escript::Data::neg)      .def("__neg__",&escript::Data::neg)
     .def("neg",&escript::Data::neg)  
192      // following implements the python "+" identity operator      // following implements the python "+" identity operator
193      .def("__pos__",&escript::Data::pos)      .def("__pos__",&escript::Data::pos)
     .def("pos",&escript::Data::pos)  
194      // following two functions implement the python [] operator      // following two functions implement the python [] operator
195      .def("__getitem__",&escript::Data::getItem)      .def("__getitem__",&escript::Data::getItem)
196      .def("__setitem__",&escript::Data::setItemO)      .def("__setitem__",&escript::Data::setItemO)
# Line 200  BOOST_PYTHON_MODULE(escriptcpp) Line 201  BOOST_PYTHON_MODULE(escriptcpp)
201      // NOTE:: The order of these declarations is important. Anything      // NOTE:: The order of these declarations is important. Anything
202      // declared before the generic declaration isn't found so the generic      // declared before the generic declaration isn't found so the generic
203      // version will be called.      // version will be called.
     .def(self += other<object>())  
     .def(self += self)  
204      .def(self + other<object>())      .def(self + other<object>())
205      .def(other<object>() + self)      .def(other<object>() + self)
206      .def(self + self)      .def(self + self)
207      .def(self -= other<object>())      .def(self += other<object>())
208      .def(self -= self)      .def(self += self)
209    
210      .def(self - other<object>())      .def(self - other<object>())
211      .def(other<object>() - self)      .def(other<object>() - self)
212      .def(self - self)      .def(self - self)
213      .def(self *= other<object>())      .def(self -= other<object>())
214      .def(self *= self)      .def(self -= self)
215    
216      .def(self * other<object>())      .def(self * other<object>())
217      .def(other<object>() * self)      .def(other<object>() * self)
218      .def(self * self)      .def(self * self)
219      .def(self /= other<object>())      .def(self *= other<object>())
220      .def(self /= self)      .def(self *= self)
221    
222      .def(self / other<object>())      .def(self / other<object>())
223      .def(other<object>() / self)      .def(other<object>() / self)
224      .def(self / self)      .def(self / self)
225        .def(self /= other<object>())
226        .def(self /= self)
227      // Need scope resolution due to a bug either in the compiler or      // Need scope resolution due to a bug either in the compiler or
228      // the boost code. This calls operator << for Data.      // the boost code. This calls operator << for Data.
229      .def(self_ns::str(self));      .def(self_ns::str(self));

Legend:
Removed from v.284  
changed lines
  Added in v.285

  ViewVC Help
Powered by ViewVC 1.1.26