/[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 950 by gross, Tue Feb 6 07:01:11 2007 UTC revision 1718 by gross, Thu Aug 21 05:50:11 2008 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 "AbstractTransportProblem.h"
25  #include "DataVector.h"  #include "DataVector.h"
26    
27    extern "C" {
28    #include "escript/blocktimer.h"
29    }
30    
31  #include "esysUtils/esysExceptionTranslator.h"  #include "esysUtils/esysExceptionTranslator.h"
32    
33  #include <boost/python.hpp>  #include <boost/python.hpp>
# Line 71  BOOST_PYTHON_MODULE(escriptcpp) Line 78  BOOST_PYTHON_MODULE(escriptcpp)
78    def("setNumberOfThreads",escript::setNumberOfThreads);    def("setNumberOfThreads",escript::setNumberOfThreads);
79    def("getNumberOfThreads",escript::getNumberOfThreads);    def("getNumberOfThreads",escript::getNumberOfThreads);
80    def("releaseUnusedMemory",escript::releaseUnusedMemory);    def("releaseUnusedMemory",escript::releaseUnusedMemory);
81      def("blocktimer_initialize",blocktimer_initialize);
82      def("blocktimer_reportSortByName",blocktimer_reportSortByName);
83      def("blocktimer_reportSortByTime",blocktimer_reportSortByTime);
84      def("blocktimer_increment",blocktimer_increment);
85      def("blocktimer_time",blocktimer_time);
86      def("getVersion",escript::getSvnVersion);
87      def("printParallelThreadCounts",escript::printParallelThreadCnt);
88    
89    
90    //    //
91    // Interface for AbstractDomain    // Interface for AbstractDomain
92    //    //
93    class_<escript::AbstractDomain>("Domain",no_init)    class_<escript::AbstractDomain>("Domain",no_init)
94         .def("setTagMap",&escript::AbstractDomain::setTagMap)
95         .def("getTag",&escript::AbstractDomain::getTag)
96         .def("isValidTagName",&escript::AbstractDomain::isValidTagName)
97         .def("showTagNames",&escript::AbstractDomain::showTagNames)
98       .def("getX",&escript::AbstractDomain::getX)       .def("getX",&escript::AbstractDomain::getX)
99       .def("getNormal",&escript::AbstractDomain::getNormal)       .def("getNormal",&escript::AbstractDomain::getNormal)
100       .def("getSize",&escript::AbstractDomain::getSize)       .def("getSize",&escript::AbstractDomain::getSize)
101       .def("saveVTK",&escript::AbstractDomain::saveVTK)       .def("saveVTK",&escript::AbstractDomain::saveVTK)
102       .def("saveDX",&escript::AbstractDomain::saveDX)       .def("saveDX",&escript::AbstractDomain::saveDX)
103         .def("getMPISize",&escript::AbstractDomain::getMPISize)
104         .def("getMPIRank",&escript::AbstractDomain::getMPIRank)
105    
106       .def(self == self)       .def(self == self)
107       .def(self != self);       .def(self != self);
108    
# Line 94  BOOST_PYTHON_MODULE(escriptcpp) Line 115  BOOST_PYTHON_MODULE(escriptcpp)
115    //    //
116    // Interface for FunctionSpace    // Interface for FunctionSpace
117    //    //
118    class_<escript::FunctionSpace>("FunctionSpace",init<>())    class_<escript::FunctionSpace> fs_definer("FunctionSpace",init<>());
119       .def("getDim",&escript::FunctionSpace::getDim)    fs_definer.def("getDim",&escript::FunctionSpace::getDim);
120       .def("getDomain",&escript::FunctionSpace::getDomain,return_internal_reference<>())    fs_definer.def("getDomain",&escript::FunctionSpace::getDomain,
121       .def("getX",&escript::FunctionSpace::getX)                   return_internal_reference<>());
122       .def("getNormal",&escript::FunctionSpace::getNormal)    fs_definer.def("getX",&escript::FunctionSpace::getX);
123       .def("getSize",&escript::FunctionSpace::getSize)    fs_definer.def("getNormal",&escript::FunctionSpace::getNormal);
124       .def("setTags",&escript::FunctionSpace::setTags)    fs_definer.def("getSize",&escript::FunctionSpace::getSize);
125       .def("getTagFromDataPointNo",&escript::FunctionSpace::getTagFromDataPointNo)    fs_definer.def("setTags",&escript::FunctionSpace::setTags);
126       .def("__str__",&escript::FunctionSpace::toString)    fs_definer.def("getTagFromDataPointNo",
127       .def(self == self)                   &escript::FunctionSpace::getTagFromDataPointNo);
128       .def(self != self);    fs_definer.def("getReferenceIDFromDataPointNo", &escript::FunctionSpace::getReferenceIDFromDataPointNo);
129      fs_definer.def("getListOfTags",&escript::FunctionSpace::getListOfTags);
130      fs_definer.def("__str__", &escript::FunctionSpace::toString);
131      fs_definer.def(self == self);
132      fs_definer.def(self != self);
133    //    //
134    // Interface for Data    // Interface for Data
135    //    //
# Line 128  BOOST_PYTHON_MODULE(escriptcpp) Line 153  BOOST_PYTHON_MODULE(escriptcpp)
153      .def("dump",&escript::Data::dump)      .def("dump",&escript::Data::dump)
154      .def("copyWithMask",&escript::Data::copyWithMask)      .def("copyWithMask",&escript::Data::copyWithMask)
155      .def("setTaggedValue",&escript::Data::setTaggedValue)      .def("setTaggedValue",&escript::Data::setTaggedValue)
156      .def("setValueByReferenceNumber",&escript::Data::setValueByReferenceNumber)      .def("setTaggedValue",&escript::Data::setTaggedValueByName)
     .def("getValueByReferenceNumber",&escript::Data::getValueByReferenceNumber)  
157      .def("getNumberOfDataPoints",&escript::Data::getNumDataPoints)      .def("getNumberOfDataPoints",&escript::Data::getNumDataPoints)
158        .def("isExpanded",&escript::Data::isExpanded)
159        .def("isTagged",&escript::Data::isTagged)
160      .def("expand",&escript::Data::expand)      .def("expand",&escript::Data::expand)
161      .def("tag",&escript::Data::tag)      .def("tag",&escript::Data::tag)
162      .def("copy",&escript::Data::copy)      .def("copy",&escript::Data::copy)
163      .def("convertToNumArray",&escript::Data::convertToNumArray)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)
     .def("fillFromNumArray",&escript::Data::fillFromNumArray)  
     .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)  
164      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)
165        .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)
166      .def("getValueOfDataPoint",&escript::Data::getValueOfDataPoint)      .def("getValueOfDataPoint",&escript::Data::getValueOfDataPoint)
167      .def("getValueOfGlobalDataPoint",&escript::Data::getValueOfGlobalDataPoint)      .def("getValueOfGlobalDataPoint",&escript::Data::getValueOfGlobalDataPoint)
168        .def("setToZero",&escript::Data::setToZero)
169      .def("interpolate",&escript::Data::interpolate)      .def("interpolate",&escript::Data::interpolate)
170      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)
171      .def("saveDX",&escript::Data::saveDX)      .def("saveDX",&escript::Data::saveDX)
# Line 239  BOOST_PYTHON_MODULE(escriptcpp) Line 265  BOOST_PYTHON_MODULE(escriptcpp)
265    // Factory methods for function space    // Factory methods for function space
266    //    //
267    def("ContinuousFunction",escript::continuousFunction);    def("ContinuousFunction",escript::continuousFunction);
268      def("ReducedContinuousFunction",escript::reducedContinuousFunction);
269    def("Function",escript::function);    def("Function",escript::function);
270      def("ReducedFunction",escript::reducedFunction);
271    def("FunctionOnBoundary",escript::functionOnBoundary);    def("FunctionOnBoundary",escript::functionOnBoundary);
272      def("ReducedFunctionOnBoundary",escript::reducedFunctionOnBoundary);
273    def("FunctionOnContactZero",escript::functionOnContactZero);    def("FunctionOnContactZero",escript::functionOnContactZero);
274      def("ReducedFunctionOnContactZero",escript::reducedFunctionOnContactZero);
275    def("FunctionOnContactOne",escript::functionOnContactOne);    def("FunctionOnContactOne",escript::functionOnContactOne);
276      def("ReducedFunctionOnContactOne",escript::reducedFunctionOnContactOne);
277    def("Solution",escript::solution);    def("Solution",escript::solution);
278    def("ReducedSolution",escript::reducedSolution);    def("ReducedSolution",escript::reducedSolution);
279    def("DiracDeltaFunction",escript::diracDeltaFunction);    def("DiracDeltaFunction",escript::diracDeltaFunction);
# Line 251  BOOST_PYTHON_MODULE(escriptcpp) Line 282  BOOST_PYTHON_MODULE(escriptcpp)
282    // Factory methods for Data    // Factory methods for Data
283    //    //
284    def("load",escript::load);    def("load",escript::load);
285      def("loadIsConfigured",escript::loadConfigured);
286    def("Scalar",escript::Scalar,    def("Scalar",escript::Scalar,
287        (arg("value")=0.0,        (arg("value")=0.0,
288         arg("what")=escript::FunctionSpace(),         arg("what")=escript::FunctionSpace(),
# Line 292  BOOST_PYTHON_MODULE(escriptcpp) Line 324  BOOST_PYTHON_MODULE(escriptcpp)
324       .def("saveHB",&escript::AbstractSystemMatrix::saveHB)       .def("saveHB",&escript::AbstractSystemMatrix::saveHB)
325       .def("resetValues",&escript::AbstractSystemMatrix::resetValues)       .def("resetValues",&escript::AbstractSystemMatrix::resetValues)
326       .def(self*other<escript::Data>());       .def(self*other<escript::Data>());
327      //
328      // Interface for AbstractTransportProblem
329      //
330      class_<escript::AbstractTransportProblem>("TransportProblem",init<>())
331         .def("isEmpty",&escript::AbstractTransportProblem::isEmpty)
332         .def("solve",&escript::AbstractTransportProblem::solve)
333         .def("setInitialValue",&escript::AbstractTransportProblem::setInitialValue)
334         .def("insertConstraint",&escript::AbstractTransportProblem::insertConstraint)
335         .def("reset",&escript::AbstractTransportProblem::resetTransport)
336         .def("getSafeTimeStepSize",&escript::AbstractTransportProblem::getSafeTimeStepSize);
337    
338    //    //
339    // Register esysExceptionTranslator    // Register esysExceptionTranslator

Legend:
Removed from v.950  
changed lines
  Added in v.1718

  ViewVC Help
Powered by ViewVC 1.1.26