/[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 698 by gross, Fri Mar 31 04:52:55 2006 UTC revision 1137 by gross, Thu May 10 08:11:31 2007 UTC
# Line 19  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 "esysUtils/esysExceptionTranslator.h"  #include "esysUtils/esysExceptionTranslator.h"
25    
# Line 69  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
78    //    //
79    class_<escript::AbstractDomain>("Domain",no_init)    class_<escript::AbstractDomain>("Domain",no_init)
80         .def("__str__",&escript::AbstractDomain::str)
81         .def("setTagMap",&escript::AbstractDomain::setTagMap)
82         .def("getTag",&escript::AbstractDomain::getTag)
83         .def("isValidTagName",&escript::AbstractDomain::isValidTagName)
84         .def("showTagNames",&escript::AbstractDomain::showTagNames)
85       .def("getX",&escript::AbstractDomain::getX)       .def("getX",&escript::AbstractDomain::getX)
86       .def("getNormal",&escript::AbstractDomain::getNormal)       .def("getNormal",&escript::AbstractDomain::getNormal)
87       .def("getSize",&escript::AbstractDomain::getSize)       .def("getSize",&escript::AbstractDomain::getSize)
# Line 97  BOOST_PYTHON_MODULE(escriptcpp) Line 105  BOOST_PYTHON_MODULE(escriptcpp)
105       .def("getX",&escript::FunctionSpace::getX)       .def("getX",&escript::FunctionSpace::getX)
106       .def("getNormal",&escript::FunctionSpace::getNormal)       .def("getNormal",&escript::FunctionSpace::getNormal)
107       .def("getSize",&escript::FunctionSpace::getSize)       .def("getSize",&escript::FunctionSpace::getSize)
108         .def("setTags",&escript::FunctionSpace::setTags)
109       .def("getTagFromDataPointNo",&escript::FunctionSpace::getTagFromDataPointNo)       .def("getTagFromDataPointNo",&escript::FunctionSpace::getTagFromDataPointNo)
110       .def("__str__",&escript::FunctionSpace::toString)       .def("__str__",&escript::FunctionSpace::str)
111       .def(self == self)       .def(self == self)
112       .def(self != self);       .def(self != self);
113    //    //
# Line 113  BOOST_PYTHON_MODULE(escriptcpp) Line 122  BOOST_PYTHON_MODULE(escriptcpp)
122      .def(init<const escript::Data&>())      .def(init<const escript::Data&>())
123      // 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
124      // reference. In this case return_internal_reference.      // reference. In this case return_internal_reference.
125      .def("__str__",&escript::Data::toString)      .def("__str__",&escript::Data::str)
126      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())
127      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())
128      .def("isEmpty",&escript::Data::isEmpty)      .def("isEmpty",&escript::Data::isEmpty)
129        .def("isProtected",&escript::Data::isProtected)
130        .def("setProtection",&escript::Data::setProtection)
131      .def("getShape",&escript::Data::getShapeTuple)      .def("getShape",&escript::Data::getShapeTuple)
132      .def("getRank",&escript::Data::getDataPointRank)      .def("getRank",&escript::Data::getDataPointRank)
133        .def("dump",&escript::Data::dump)
134      .def("copyWithMask",&escript::Data::copyWithMask)      .def("copyWithMask",&escript::Data::copyWithMask)
135      .def("setTaggedValue",&escript::Data::setTaggedValue)      .def("setTaggedValue",&escript::Data::setTaggedValue)
136      .def("setRefValue",&escript::Data::setRefValue)      .def("setTaggedValue",&escript::Data::setTaggedValueByName)
137      .def("getRefValue",&escript::Data::getRefValue)      .def("getNumberOfDataPoints",&escript::Data::getNumDataPoints)
138      .def("expand",&escript::Data::expand)      .def("expand",&escript::Data::expand)
139      .def("tag",&escript::Data::tag)      .def("tag",&escript::Data::tag)
140      .def("copy",&escript::Data::copy)      .def("copy",&escript::Data::copy)
141      .def("convertToNumArray",&escript::Data::convertToNumArray)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)
142      .def("convertToNumArrayFromSampleNo",&escript::Data::convertToNumArrayFromSampleNo)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)
143      .def("convertToNumArrayFromDPNo",&escript::Data::convertToNumArrayFromDPNo)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)
144      .def("fillFromNumArray",&escript::Data::fillFromNumArray)      .def("getValueOfDataPoint",&escript::Data::getValueOfDataPoint)
145        .def("getValueOfGlobalDataPoint",&escript::Data::getValueOfGlobalDataPoint)
146        .def("setToZero",&escript::Data::setToZero)
147      .def("interpolate",&escript::Data::interpolate)      .def("interpolate",&escript::Data::interpolate)
148      .def("mindp",&escript::Data::mindp)      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)
149      .def("saveDX",&escript::Data::saveDX)      .def("saveDX",&escript::Data::saveDX)
150      .def("saveVTK",&escript::Data::saveVTK)      .def("saveVTK",&escript::Data::saveVTK)
151      .def("getTagNumber",&escript::Data::getTagNumber)      .def("getTagNumber",&escript::Data::getTagNumber)
# Line 151  BOOST_PYTHON_MODULE(escriptcpp) Line 165  BOOST_PYTHON_MODULE(escriptcpp)
165      .def("_whereNonPositive",&escript::Data::whereNonPositive)      .def("_whereNonPositive",&escript::Data::whereNonPositive)
166      .def("_whereZero",&escript::Data::whereZero,(arg("tol")=0.0))      .def("_whereZero",&escript::Data::whereZero,(arg("tol")=0.0))
167      .def("_whereNonZero",&escript::Data::whereNonZero,(arg("tol")=0.0))      .def("_whereNonZero",&escript::Data::whereNonZero,(arg("tol")=0.0))
168        .def("_erf",&escript::Data::erf)
169      .def("_sin",&escript::Data::sin)      .def("_sin",&escript::Data::sin)
170      .def("_cos",&escript::Data::cos)      .def("_cos",&escript::Data::cos)
171      .def("_tan",&escript::Data::tan)      .def("_tan",&escript::Data::tan)
# Line 168  BOOST_PYTHON_MODULE(escriptcpp) Line 183  BOOST_PYTHON_MODULE(escriptcpp)
183      .def("_log10",&escript::Data::log10)      .def("_log10",&escript::Data::log10)
184      .def("_log",&escript::Data::log)      .def("_log",&escript::Data::log)
185      .def("_sign",&escript::Data::sign)      .def("_sign",&escript::Data::sign)
186        .def("_symmetric",&escript::Data::symmetric)
187        .def("_nonsymmetric",&escript::Data::nonsymmetric)
188        .def("_trace",&escript::Data::trace)
189        .def("_swap_axes",&escript::Data::swapaxes)
190      .def("_eigenvalues",&escript::Data::eigenvalues)      .def("_eigenvalues",&escript::Data::eigenvalues)
191      .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))
192      // functions returning a single real number:      // functions returning a single real number:
# Line 189  BOOST_PYTHON_MODULE(escriptcpp) Line 208  BOOST_PYTHON_MODULE(escriptcpp)
208      // following two functions implement the python ** operator      // following two functions implement the python ** operator
209      .def("__pow__",&escript::Data::powO)      .def("__pow__",&escript::Data::powO)
210      .def("__pow__",&escript::Data::powD)      .def("__pow__",&escript::Data::powD)
211        .def("__rpow__",&escript::Data::rpowO)
212      // NOTE:: The order of these declarations is important. Anything      // NOTE:: The order of these declarations is important. Anything
213      // declared before the generic declaration isn't found so the generic      // declared before the generic declaration isn't found so the generic
214      // version will be called.      // version will be called.
# Line 223  BOOST_PYTHON_MODULE(escriptcpp) Line 243  BOOST_PYTHON_MODULE(escriptcpp)
243    // Factory methods for function space    // Factory methods for function space
244    //    //
245    def("ContinuousFunction",escript::continuousFunction);    def("ContinuousFunction",escript::continuousFunction);
246      def("ReducedContinuousFunction",escript::reducedContinuousFunction);
247    def("Function",escript::function);    def("Function",escript::function);
248      def("ReducedFunction",escript::reducedFunction);
249    def("FunctionOnBoundary",escript::functionOnBoundary);    def("FunctionOnBoundary",escript::functionOnBoundary);
250      def("ReducedFunctionOnBoundary",escript::reducedFunctionOnBoundary);
251    def("FunctionOnContactZero",escript::functionOnContactZero);    def("FunctionOnContactZero",escript::functionOnContactZero);
252      def("ReducedFunctionOnContactZero",escript::reducedFunctionOnContactZero);
253    def("FunctionOnContactOne",escript::functionOnContactOne);    def("FunctionOnContactOne",escript::functionOnContactOne);
254      def("ReducedFunctionOnContactOne",escript::reducedFunctionOnContactOne);
255    def("Solution",escript::solution);    def("Solution",escript::solution);
256    def("ReducedSolution",escript::reducedSolution);    def("ReducedSolution",escript::reducedSolution);
257    def("DiracDeltaFunction",escript::diracDeltaFunction);    def("DiracDeltaFunction",escript::diracDeltaFunction);
# Line 234  BOOST_PYTHON_MODULE(escriptcpp) Line 259  BOOST_PYTHON_MODULE(escriptcpp)
259    //    //
260    // Factory methods for Data    // Factory methods for Data
261    //    //
262      def("load",escript::load);
263      def("loadIsConfigured",escript::loadConfigured);
264    def("Scalar",escript::Scalar,    def("Scalar",escript::Scalar,
265        (arg("value")=0.0,        (arg("value")=0.0,
266         arg("what")=escript::FunctionSpace(),         arg("what")=escript::FunctionSpace(),
# Line 256  BOOST_PYTHON_MODULE(escriptcpp) Line 283  BOOST_PYTHON_MODULE(escriptcpp)
283         arg("expanded")=false));         arg("expanded")=false));
284    
285    //    //
286      // Binary operators
287      //
288      def("C_GeneralTensorProduct",escript::C_GeneralTensorProduct,
289          (arg("arg0")=escript::Data(),
290           arg("arg1")=escript::Data(),
291           arg("axis_offset")=0,
292           arg("transpose")=0));
293    
294      //
295    // Interface for AbstractSystemMatrix    // Interface for AbstractSystemMatrix
296    //    //
297    class_<escript::AbstractSystemMatrix>("Operator",init<>())    class_<escript::AbstractSystemMatrix>("Operator",init<>())

Legend:
Removed from v.698  
changed lines
  Added in v.1137

  ViewVC Help
Powered by ViewVC 1.1.26