/[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 595 by gross, Tue Mar 14 23:52:45 2006 UTC revision 964 by gross, Tue Feb 13 05:10:26 2007 UTC
# Line 1  Line 1 
1  //$Id$  //$Id$
2  /*=============================================================================  /*
3     ************************************************************
4   ******************************************************************************   *          Copyright 2006 by ACcESS MNRF                   *
5   *                                                                            *   *                                                          *
6   *       COPYRIGHT ACcESS 2004 -  All Rights Reserved                         *   *              http://www.access.edu.au                    *
7   *                                                                            *   *       Primary Business: Queensland, Australia            *
8   * This software is the property of ACcESS.  No part of this code             *   *  Licensed under the Open Software License version 3.0    *
9   * may be copied in any form or by any means without the expressed written    *   *     http://www.opensource.org/licenses/osl-3.0.php       *
10   * consent of ACcESS.  Copying, use or modification of this software          *   *                                                          *
11   * by any unauthorised person is illegal unless that                          *   ************************************************************
12   * person has a software license agreement with ACcESS.                       *  */
  *                                                                            *  
  ******************************************************************************  
   
 ******************************************************************************/  
13    
14  #include "Data.h"  #include "Data.h"
 #include "DataVariable.h"  
15  #include "FunctionSpace.h"  #include "FunctionSpace.h"
16  #include "FunctionSpaceFactory.h"  #include "FunctionSpaceFactory.h"
17  #include "DataFactory.h"  #include "DataFactory.h"
# Line 24  Line 19 
19  #include "AbstractDomain.h"  #include "AbstractDomain.h"
20  #include "Utils.h"  #include "Utils.h"
21  #include "AbstractSystemMatrix.h"  #include "AbstractSystemMatrix.h"
22    #include "DataVector.h"
23    
24  #include "esysExceptionTranslator.h"  #include "esysUtils/esysExceptionTranslator.h"
25    
26  #include <boost/python.hpp>  #include <boost/python.hpp>
27  #include <boost/python/module.hpp>  #include <boost/python/module.hpp>
# Line 74  BOOST_PYTHON_MODULE(escriptcpp) Line 70  BOOST_PYTHON_MODULE(escriptcpp)
70  {  {
71    def("setNumberOfThreads",escript::setNumberOfThreads);    def("setNumberOfThreads",escript::setNumberOfThreads);
72    def("getNumberOfThreads",escript::getNumberOfThreads);    def("getNumberOfThreads",escript::getNumberOfThreads);
73      def("releaseUnusedMemory",escript::releaseUnusedMemory);
74    
75    
76    //    //
77    // Interface for AbstractDomain    // Interface for AbstractDomain
# Line 102  BOOST_PYTHON_MODULE(escriptcpp) Line 100  BOOST_PYTHON_MODULE(escriptcpp)
100       .def("getX",&escript::FunctionSpace::getX)       .def("getX",&escript::FunctionSpace::getX)
101       .def("getNormal",&escript::FunctionSpace::getNormal)       .def("getNormal",&escript::FunctionSpace::getNormal)
102       .def("getSize",&escript::FunctionSpace::getSize)       .def("getSize",&escript::FunctionSpace::getSize)
103         .def("setTags",&escript::FunctionSpace::setTags)
104       .def("getTagFromDataPointNo",&escript::FunctionSpace::getTagFromDataPointNo)       .def("getTagFromDataPointNo",&escript::FunctionSpace::getTagFromDataPointNo)
105       .def("__str__",&escript::FunctionSpace::toString)       .def("__str__",&escript::FunctionSpace::toString)
106       .def(self == self)       .def(self == self)
# Line 122  BOOST_PYTHON_MODULE(escriptcpp) Line 121  BOOST_PYTHON_MODULE(escriptcpp)
121      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())
122      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())
123      .def("isEmpty",&escript::Data::isEmpty)      .def("isEmpty",&escript::Data::isEmpty)
124        .def("isProtected",&escript::Data::isProtected)
125        .def("setProtection",&escript::Data::setProtection)
126      .def("getShape",&escript::Data::getShapeTuple)      .def("getShape",&escript::Data::getShapeTuple)
127      .def("getRank",&escript::Data::getDataPointRank)      .def("getRank",&escript::Data::getDataPointRank)
128        .def("dump",&escript::Data::dump)
129      .def("copyWithMask",&escript::Data::copyWithMask)      .def("copyWithMask",&escript::Data::copyWithMask)
130      .def("setTaggedValue",&escript::Data::setTaggedValue)      .def("setTaggedValue",&escript::Data::setTaggedValue)
131      .def("setRefValue",&escript::Data::setRefValue)      .def("getNumberOfDataPoints",&escript::Data::getNumDataPoints)
     .def("getRefValue",&escript::Data::getRefValue)  
132      .def("expand",&escript::Data::expand)      .def("expand",&escript::Data::expand)
133      .def("tag",&escript::Data::tag)      .def("tag",&escript::Data::tag)
134      .def("copy",&escript::Data::copy)      .def("copy",&escript::Data::copy)
135      .def("convertToNumArray",&escript::Data::convertToNumArray)      .def("convertToNumArray",&escript::Data::convertToNumArray)
     .def("convertToNumArrayFromSampleNo",&escript::Data::convertToNumArrayFromSampleNo)  
     .def("convertToNumArrayFromDPNo",&escript::Data::convertToNumArrayFromDPNo)  
136      .def("fillFromNumArray",&escript::Data::fillFromNumArray)      .def("fillFromNumArray",&escript::Data::fillFromNumArray)
137        .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)
138        .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)
139        .def("getValueOfDataPoint",&escript::Data::getValueOfDataPoint)
140        .def("getValueOfGlobalDataPoint",&escript::Data::getValueOfGlobalDataPoint)
141      .def("interpolate",&escript::Data::interpolate)      .def("interpolate",&escript::Data::interpolate)
142      .def("mindp",&escript::Data::mindp)      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)
143      .def("saveDX",&escript::Data::saveDX)      .def("saveDX",&escript::Data::saveDX)
144      .def("saveVTK",&escript::Data::saveVTK)      .def("saveVTK",&escript::Data::saveVTK)
145      .def("getTagNumber",&escript::Data::getTagNumber)      .def("getTagNumber",&escript::Data::getTagNumber)
# Line 150  BOOST_PYTHON_MODULE(escriptcpp) Line 153  BOOST_PYTHON_MODULE(escriptcpp)
153      .def("_trace",&escript::Data::trace)      .def("_trace",&escript::Data::trace)
154      .def("_maxval",&escript::Data::maxval)      .def("_maxval",&escript::Data::maxval)
155      .def("_minval",&escript::Data::minval)      .def("_minval",&escript::Data::minval)
156      .def("_wherePositive",&escript::Data::wherePositive,(arg("tol")=0.0))      .def("_wherePositive",&escript::Data::wherePositive)
157      .def("_whereNegative",&escript::Data::whereNegative,(arg("tol")=0.0))      .def("_whereNegative",&escript::Data::whereNegative)
158      .def("_whereNonNegative",&escript::Data::whereNonNegative,(arg("tol")=0.0))      .def("_whereNonNegative",&escript::Data::whereNonNegative)
159      .def("_whereNonPositive",&escript::Data::whereNonPositive,(arg("tol")=0.0))      .def("_whereNonPositive",&escript::Data::whereNonPositive)
160      .def("_whereZero",&escript::Data::whereZero,(arg("tol")=0.0))      .def("_whereZero",&escript::Data::whereZero,(arg("tol")=0.0))
161      .def("_whereNonZero",&escript::Data::whereNonZero,(arg("tol")=0.0))      .def("_whereNonZero",&escript::Data::whereNonZero,(arg("tol")=0.0))
162        .def("_erf",&escript::Data::erf)
163      .def("_sin",&escript::Data::sin)      .def("_sin",&escript::Data::sin)
164      .def("_cos",&escript::Data::cos)      .def("_cos",&escript::Data::cos)
165      .def("_tan",&escript::Data::tan)      .def("_tan",&escript::Data::tan)
# Line 173  BOOST_PYTHON_MODULE(escriptcpp) Line 177  BOOST_PYTHON_MODULE(escriptcpp)
177      .def("_log10",&escript::Data::log10)      .def("_log10",&escript::Data::log10)
178      .def("_log",&escript::Data::log)      .def("_log",&escript::Data::log)
179      .def("_sign",&escript::Data::sign)      .def("_sign",&escript::Data::sign)
180        .def("_symmetric",&escript::Data::symmetric)
181        .def("_nonsymmetric",&escript::Data::nonsymmetric)
182        .def("_trace",&escript::Data::trace)
183        .def("_swap_axes",&escript::Data::swapaxes)
184      .def("_eigenvalues",&escript::Data::eigenvalues)      .def("_eigenvalues",&escript::Data::eigenvalues)
185      .def("_eigenvalues_and_eigenvectors",&escript::Data::eigenvalues_and_eigenvectors,(arg("tol")=1.e-13))      .def("_eigenvalues_and_eigenvectors",&escript::Data::eigenvalues_and_eigenvectors,(arg("tol")=1.e-13))
186      // functions returning a single real number:      // functions returning a single real number:
# Line 194  BOOST_PYTHON_MODULE(escriptcpp) Line 202  BOOST_PYTHON_MODULE(escriptcpp)
202      // following two functions implement the python ** operator      // following two functions implement the python ** operator
203      .def("__pow__",&escript::Data::powO)      .def("__pow__",&escript::Data::powO)
204      .def("__pow__",&escript::Data::powD)      .def("__pow__",&escript::Data::powD)
205        .def("__rpow__",&escript::Data::rpowO)
206      // NOTE:: The order of these declarations is important. Anything      // NOTE:: The order of these declarations is important. Anything
207      // declared before the generic declaration isn't found so the generic      // declared before the generic declaration isn't found so the generic
208      // version will be called.      // version will be called.
# Line 239  BOOST_PYTHON_MODULE(escriptcpp) Line 248  BOOST_PYTHON_MODULE(escriptcpp)
248    //    //
249    // Factory methods for Data    // Factory methods for Data
250    //    //
251      def("load",escript::load);
252    def("Scalar",escript::Scalar,    def("Scalar",escript::Scalar,
253        (arg("value")=0.0,        (arg("value")=0.0,
254         arg("what")=escript::FunctionSpace(),         arg("what")=escript::FunctionSpace(),
# Line 261  BOOST_PYTHON_MODULE(escriptcpp) Line 271  BOOST_PYTHON_MODULE(escriptcpp)
271         arg("expanded")=false));         arg("expanded")=false));
272    
273    //    //
274      // Binary operators
275      //
276      def("C_GeneralTensorProduct",escript::C_GeneralTensorProduct,
277          (arg("arg0")=escript::Data(),
278           arg("arg1")=escript::Data(),
279           arg("axis_offset")=0,
280           arg("transpose")=0));
281    
282      //
283    // Interface for AbstractSystemMatrix    // Interface for AbstractSystemMatrix
284    //    //
285    class_<escript::AbstractSystemMatrix>("Operator",init<>())    class_<escript::AbstractSystemMatrix>("Operator",init<>())

Legend:
Removed from v.595  
changed lines
  Added in v.964

  ViewVC Help
Powered by ViewVC 1.1.26