/[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 699 by gross, Fri Mar 31 06:27:56 2006 UTC revision 1313 by ksteube, Tue Sep 25 01:44:26 2007 UTC
# Line 1  Line 1 
1  //$Id$  
2  /*  /* $Id$ */
3   ************************************************************  
4   *          Copyright 2006 by ACcESS MNRF                   *  /*******************************************************
5   *                                                          *   *
6   *              http://www.access.edu.au                    *   *           Copyright 2003-2007 by ACceSS MNRF
7   *       Primary Business: Queensland, Australia            *   *       Copyright 2007 by University of Queensland
8   *  Licensed under the Open Software License version 3.0    *   *
9   *     http://www.opensource.org/licenses/osl-3.0.php       *   *                http://esscc.uq.edu.au
10   *                                                          *   *        Primary Business: Queensland, Australia
11   ************************************************************   *  Licensed under the Open Software License version 3.0
12  */   *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16  #include "Data.h"  #include "Data.h"
17  #include "FunctionSpace.h"  #include "FunctionSpace.h"
# Line 19  Line 21 
21  #include "AbstractDomain.h"  #include "AbstractDomain.h"
22  #include "Utils.h"  #include "Utils.h"
23  #include "AbstractSystemMatrix.h"  #include "AbstractSystemMatrix.h"
24    #include "DataVector.h"
25    
26    extern "C" {
27    #include "escript/blocktimer.h"
28    }
29    
30  #include "esysUtils/esysExceptionTranslator.h"  #include "esysUtils/esysExceptionTranslator.h"
31    
# Line 69  BOOST_PYTHON_MODULE(escriptcpp) Line 76  BOOST_PYTHON_MODULE(escriptcpp)
76  {  {
77    def("setNumberOfThreads",escript::setNumberOfThreads);    def("setNumberOfThreads",escript::setNumberOfThreads);
78    def("getNumberOfThreads",escript::getNumberOfThreads);    def("getNumberOfThreads",escript::getNumberOfThreads);
79      def("releaseUnusedMemory",escript::releaseUnusedMemory);
80      def("blocktimer_initialize",blocktimer_initialize);
81      def("blocktimer_reportSortByName",blocktimer_reportSortByName);
82      def("blocktimer_reportSortByTime",blocktimer_reportSortByTime);
83      def("blocktimer_increment",blocktimer_increment);
84      def("blocktimer_time",blocktimer_time);
85      def("getVersion",escript::getSvnVersion);
86    
87    
88    //    //
89    // Interface for AbstractDomain    // Interface for AbstractDomain
90    //    //
91    class_<escript::AbstractDomain>("Domain",no_init)    class_<escript::AbstractDomain>("Domain",no_init)
92         .def("setTagMap",&escript::AbstractDomain::setTagMap)
93         .def("getTag",&escript::AbstractDomain::getTag)
94         .def("isValidTagName",&escript::AbstractDomain::isValidTagName)
95         .def("showTagNames",&escript::AbstractDomain::showTagNames)
96       .def("getX",&escript::AbstractDomain::getX)       .def("getX",&escript::AbstractDomain::getX)
97       .def("getNormal",&escript::AbstractDomain::getNormal)       .def("getNormal",&escript::AbstractDomain::getNormal)
98       .def("getSize",&escript::AbstractDomain::getSize)       .def("getSize",&escript::AbstractDomain::getSize)
99       .def("saveVTK",&escript::AbstractDomain::saveVTK)       .def("saveVTK",&escript::AbstractDomain::saveVTK)
100       .def("saveDX",&escript::AbstractDomain::saveDX)       .def("saveDX",&escript::AbstractDomain::saveDX)
101         .def("getMPISize",&escript::AbstractDomain::getMPISize)
102         .def("getMPIRank",&escript::AbstractDomain::getMPIRank)
103    
104       .def(self == self)       .def(self == self)
105       .def(self != self);       .def(self != self);
106    
# Line 97  BOOST_PYTHON_MODULE(escriptcpp) Line 119  BOOST_PYTHON_MODULE(escriptcpp)
119       .def("getX",&escript::FunctionSpace::getX)       .def("getX",&escript::FunctionSpace::getX)
120       .def("getNormal",&escript::FunctionSpace::getNormal)       .def("getNormal",&escript::FunctionSpace::getNormal)
121       .def("getSize",&escript::FunctionSpace::getSize)       .def("getSize",&escript::FunctionSpace::getSize)
122         .def("setTags",&escript::FunctionSpace::setTags)
123       .def("getTagFromDataPointNo",&escript::FunctionSpace::getTagFromDataPointNo)       .def("getTagFromDataPointNo",&escript::FunctionSpace::getTagFromDataPointNo)
124       .def("__str__",&escript::FunctionSpace::toString)       .def("__str__",&escript::FunctionSpace::toString)
125       .def(self == self)       .def(self == self)
# Line 117  BOOST_PYTHON_MODULE(escriptcpp) Line 140  BOOST_PYTHON_MODULE(escriptcpp)
140      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())
141      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())
142      .def("isEmpty",&escript::Data::isEmpty)      .def("isEmpty",&escript::Data::isEmpty)
143        .def("isProtected",&escript::Data::isProtected)
144        .def("setProtection",&escript::Data::setProtection)
145      .def("getShape",&escript::Data::getShapeTuple)      .def("getShape",&escript::Data::getShapeTuple)
146      .def("getRank",&escript::Data::getDataPointRank)      .def("getRank",&escript::Data::getDataPointRank)
147        .def("dump",&escript::Data::dump)
148      .def("copyWithMask",&escript::Data::copyWithMask)      .def("copyWithMask",&escript::Data::copyWithMask)
149      .def("setTaggedValue",&escript::Data::setTaggedValue)      .def("setTaggedValue",&escript::Data::setTaggedValue)
150      .def("setRefValue",&escript::Data::setRefValue)      .def("setTaggedValue",&escript::Data::setTaggedValueByName)
151      .def("getRefValue",&escript::Data::getRefValue)      .def("getNumberOfDataPoints",&escript::Data::getNumDataPoints)
152        .def("isExpanded",&escript::Data::isExpanded)
153        .def("isTagged",&escript::Data::isTagged)
154      .def("expand",&escript::Data::expand)      .def("expand",&escript::Data::expand)
155      .def("tag",&escript::Data::tag)      .def("tag",&escript::Data::tag)
156      .def("copy",&escript::Data::copy)      .def("copy",&escript::Data::copy)
157      .def("convertToNumArray",&escript::Data::convertToNumArray)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)
158      .def("convertToNumArrayFromSampleNo",&escript::Data::convertToNumArrayFromSampleNo)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)
159      .def("convertToNumArrayFromDPNo",&escript::Data::convertToNumArrayFromDPNo)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)
160      .def("fillFromNumArray",&escript::Data::fillFromNumArray)      .def("getValueOfDataPoint",&escript::Data::getValueOfDataPoint)
161        .def("getValueOfGlobalDataPoint",&escript::Data::getValueOfGlobalDataPoint)
162        .def("setToZero",&escript::Data::setToZero)
163      .def("interpolate",&escript::Data::interpolate)      .def("interpolate",&escript::Data::interpolate)
164      .def("mindp",&escript::Data::mindp)      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)
165      .def("saveDX",&escript::Data::saveDX)      .def("saveDX",&escript::Data::saveDX)
166      .def("saveVTK",&escript::Data::saveVTK)      .def("saveVTK",&escript::Data::saveVTK)
167      .def("getTagNumber",&escript::Data::getTagNumber)      .def("getTagNumber",&escript::Data::getTagNumber)
# Line 151  BOOST_PYTHON_MODULE(escriptcpp) Line 181  BOOST_PYTHON_MODULE(escriptcpp)
181      .def("_whereNonPositive",&escript::Data::whereNonPositive)      .def("_whereNonPositive",&escript::Data::whereNonPositive)
182      .def("_whereZero",&escript::Data::whereZero,(arg("tol")=0.0))      .def("_whereZero",&escript::Data::whereZero,(arg("tol")=0.0))
183      .def("_whereNonZero",&escript::Data::whereNonZero,(arg("tol")=0.0))      .def("_whereNonZero",&escript::Data::whereNonZero,(arg("tol")=0.0))
184        .def("_erf",&escript::Data::erf)
185      .def("_sin",&escript::Data::sin)      .def("_sin",&escript::Data::sin)
186      .def("_cos",&escript::Data::cos)      .def("_cos",&escript::Data::cos)
187      .def("_tan",&escript::Data::tan)      .def("_tan",&escript::Data::tan)
# Line 168  BOOST_PYTHON_MODULE(escriptcpp) Line 199  BOOST_PYTHON_MODULE(escriptcpp)
199      .def("_log10",&escript::Data::log10)      .def("_log10",&escript::Data::log10)
200      .def("_log",&escript::Data::log)      .def("_log",&escript::Data::log)
201      .def("_sign",&escript::Data::sign)      .def("_sign",&escript::Data::sign)
202        .def("_symmetric",&escript::Data::symmetric)
203        .def("_nonsymmetric",&escript::Data::nonsymmetric)
204        .def("_trace",&escript::Data::trace)
205        .def("_swap_axes",&escript::Data::swapaxes)
206      .def("_eigenvalues",&escript::Data::eigenvalues)      .def("_eigenvalues",&escript::Data::eigenvalues)
207      .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))
208      // functions returning a single real number:      // functions returning a single real number:
# Line 224  BOOST_PYTHON_MODULE(escriptcpp) Line 259  BOOST_PYTHON_MODULE(escriptcpp)
259    // Factory methods for function space    // Factory methods for function space
260    //    //
261    def("ContinuousFunction",escript::continuousFunction);    def("ContinuousFunction",escript::continuousFunction);
262      def("ReducedContinuousFunction",escript::reducedContinuousFunction);
263    def("Function",escript::function);    def("Function",escript::function);
264      def("ReducedFunction",escript::reducedFunction);
265    def("FunctionOnBoundary",escript::functionOnBoundary);    def("FunctionOnBoundary",escript::functionOnBoundary);
266      def("ReducedFunctionOnBoundary",escript::reducedFunctionOnBoundary);
267    def("FunctionOnContactZero",escript::functionOnContactZero);    def("FunctionOnContactZero",escript::functionOnContactZero);
268      def("ReducedFunctionOnContactZero",escript::reducedFunctionOnContactZero);
269    def("FunctionOnContactOne",escript::functionOnContactOne);    def("FunctionOnContactOne",escript::functionOnContactOne);
270      def("ReducedFunctionOnContactOne",escript::reducedFunctionOnContactOne);
271    def("Solution",escript::solution);    def("Solution",escript::solution);
272    def("ReducedSolution",escript::reducedSolution);    def("ReducedSolution",escript::reducedSolution);
273    def("DiracDeltaFunction",escript::diracDeltaFunction);    def("DiracDeltaFunction",escript::diracDeltaFunction);
# Line 235  BOOST_PYTHON_MODULE(escriptcpp) Line 275  BOOST_PYTHON_MODULE(escriptcpp)
275    //    //
276    // Factory methods for Data    // Factory methods for Data
277    //    //
278      def("load",escript::load);
279      def("loadIsConfigured",escript::loadConfigured);
280    def("Scalar",escript::Scalar,    def("Scalar",escript::Scalar,
281        (arg("value")=0.0,        (arg("value")=0.0,
282         arg("what")=escript::FunctionSpace(),         arg("what")=escript::FunctionSpace(),
# Line 257  BOOST_PYTHON_MODULE(escriptcpp) Line 299  BOOST_PYTHON_MODULE(escriptcpp)
299         arg("expanded")=false));         arg("expanded")=false));
300    
301    //    //
302      // Binary operators
303      //
304      def("C_GeneralTensorProduct",escript::C_GeneralTensorProduct,
305          (arg("arg0")=escript::Data(),
306           arg("arg1")=escript::Data(),
307           arg("axis_offset")=0,
308           arg("transpose")=0));
309    
310      //
311    // Interface for AbstractSystemMatrix    // Interface for AbstractSystemMatrix
312    //    //
313    class_<escript::AbstractSystemMatrix>("Operator",init<>())    class_<escript::AbstractSystemMatrix>("Operator",init<>())

Legend:
Removed from v.699  
changed lines
  Added in v.1313

  ViewVC Help
Powered by ViewVC 1.1.26