/[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 1796 by jfenwick, Wed Sep 17 01:45:46 2008 UTC revision 2005 by jfenwick, Mon Nov 10 01:21:39 2008 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  #include "Data.h"  #include "Data.h"
16  #include "FunctionSpace.h"  #include "FunctionSpace.h"
# Line 23  Line 22 
22  #include "AbstractSystemMatrix.h"  #include "AbstractSystemMatrix.h"
23  #include "AbstractTransportProblem.h"  #include "AbstractTransportProblem.h"
24  #include "DataVector.h"  #include "DataVector.h"
25    #include "paso/Paso_MPI.h"
26    #include "EscriptParams.h"
27    
28    
29  extern "C" {  extern "C" {
30  #include "escript/blocktimer.h"  #include "escript/blocktimer.h"
# Line 36  extern "C" { Line 38  extern "C" {
38  #include <boost/python/object.hpp>  #include <boost/python/object.hpp>
39  #include <boost/python/tuple.hpp>  #include <boost/python/tuple.hpp>
40  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
41    #include <boost/smart_ptr.hpp>
42    
43  using namespace boost::python;  using namespace boost::python;
44    
# Line 85  BOOST_PYTHON_MODULE(escriptcpp) Line 88  BOOST_PYTHON_MODULE(escriptcpp)
88    def("blocktimer_time",blocktimer_time);    def("blocktimer_time",blocktimer_time);
89    def("getVersion",escript::getSvnVersion);    def("getVersion",escript::getSvnVersion);
90    def("printParallelThreadCounts",escript::printParallelThreadCnt);    def("printParallelThreadCounts",escript::printParallelThreadCnt);
91      def("getMPISizeWorld",escript::getMPISizeWorld);
92      def("getMPIRankWorld",escript::getMPIRankWorld);
93    
94    
95    //    //
96    // Interface for AbstractDomain    // Interface for AbstractDomain
97    //    //
98    class_<escript::AbstractDomain>("Domain",no_init)    class_<escript::AbstractDomain, escript::Domain_ptr>("Domain",no_init)
99       .def("setTagMap",&escript::AbstractDomain::setTagMap)       .def("setTagMap",&escript::AbstractDomain::setTagMap)
100       .def("getTag",&escript::AbstractDomain::getTag)       .def("getTag",&escript::AbstractDomain::getTag)
101       .def("isValidTagName",&escript::AbstractDomain::isValidTagName)       .def("isValidTagName",&escript::AbstractDomain::isValidTagName)
102       .def("showTagNames",&escript::AbstractDomain::showTagNames)       .def("showTagNames",&escript::AbstractDomain::showTagNames)
103       .def("getX",&escript::AbstractDomain::getX)       .def("getX",&escript::AbstractDomain::getX)
104         .def("getDim",&escript::AbstractDomain::getDim)
105       .def("getNormal",&escript::AbstractDomain::getNormal)       .def("getNormal",&escript::AbstractDomain::getNormal)
106       .def("getSize",&escript::AbstractDomain::getSize)       .def("getSize",&escript::AbstractDomain::getSize)
107       .def("saveVTK",&escript::AbstractDomain::saveVTK)       .def("saveVTK",&escript::AbstractDomain::saveVTK)
108       .def("saveDX",&escript::AbstractDomain::saveDX)       .def("saveDX",&escript::AbstractDomain::saveDX)
109       .def("getMPISize",&escript::AbstractDomain::getMPISize)       .def("getMPISize",&escript::AbstractDomain::getMPISize)
110       .def("getMPIRank",&escript::AbstractDomain::getMPIRank)       .def("getMPIRank",&escript::AbstractDomain::getMPIRank)
111         .def("MPIBarrier",&escript::AbstractDomain::MPIBarrier)
112         .def("onMasterProcessor",&escript::AbstractDomain::onMasterProcessor)
113    
114       .def(self == self)       .def(self == self)
115       .def(self != self);       .def(self != self);
# Line 110  BOOST_PYTHON_MODULE(escriptcpp) Line 118  BOOST_PYTHON_MODULE(escriptcpp)
118    // Interface for AbstractContinuousDomain    // Interface for AbstractContinuousDomain
119    //    //
120    class_<escript::AbstractContinuousDomain, bases<escript::AbstractDomain> >("ContinuousDomain",no_init)    class_<escript::AbstractContinuousDomain, bases<escript::AbstractDomain> >("ContinuousDomain",no_init)
121         .def("getSystemMatrixTypeId",&escript::AbstractContinuousDomain::getSystemMatrixTypeId);         .def("getSystemMatrixTypeId",&escript::AbstractContinuousDomain::getSystemMatrixTypeId)
122           .def("getTransportTypeId",&escript::AbstractContinuousDomain::getTransportTypeId);
123    
124    //    //
125    // Interface for FunctionSpace    // Interface for FunctionSpace
126    //    //
127    class_<escript::FunctionSpace> fs_definer("FunctionSpace",init<>());    class_<escript::FunctionSpace> fs_definer("FunctionSpace",init<>());
128    fs_definer.def("getDim",&escript::FunctionSpace::getDim);    fs_definer.def("getDim",&escript::FunctionSpace::getDim);
129    fs_definer.def("getDomain",&escript::FunctionSpace::getDomain,  //   fs_definer.def("getDomain",&escript::FunctionSpace::getDomain,
130                   return_internal_reference<>());  //                  return_internal_reference<>());
131      fs_definer.def("getDomain",&escript::FunctionSpace::getDomainPython);
132    fs_definer.def("getX",&escript::FunctionSpace::getX);    fs_definer.def("getX",&escript::FunctionSpace::getX);
133    fs_definer.def("getNormal",&escript::FunctionSpace::getNormal);    fs_definer.def("getNormal",&escript::FunctionSpace::getNormal);
134    fs_definer.def("getSize",&escript::FunctionSpace::getSize);    fs_definer.def("getSize",&escript::FunctionSpace::getSize);
# Line 133  BOOST_PYTHON_MODULE(escriptcpp) Line 143  BOOST_PYTHON_MODULE(escriptcpp)
143    //    //
144    // Interface for Data    // Interface for Data
145    //    //
146    class_<escript::Data>("Data","TEST DOCUMENTATION",init<>())    class_<escript::Data>("Data","TEST DOCUMENTATION",init<>() )
147      // various constructors for Data objects      // various constructors for Data objects
148      .def(init<const numeric::array&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))      .def(init<const numeric::array&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))
149      .def(init<const object&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))      .def(init<const object&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))
# Line 143  BOOST_PYTHON_MODULE(escriptcpp) Line 153  BOOST_PYTHON_MODULE(escriptcpp)
153      // 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
154      // reference. In this case return_internal_reference.      // reference. In this case return_internal_reference.
155      .def("__str__",&escript::Data::toString)      .def("__str__",&escript::Data::toString)
156      .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())  //     .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())
157      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_internal_reference<>())      .def("getDomain",&escript::Data::getDomainPython)
158        .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_value_policy<copy_const_reference>())
159      .def("isEmpty",&escript::Data::isEmpty)      .def("isEmpty",&escript::Data::isEmpty)
160      .def("isProtected",&escript::Data::isProtected)      .def("isProtected",&escript::Data::isProtected)
161      .def("setProtection",&escript::Data::setProtection)      .def("setProtection",&escript::Data::setProtection)
# Line 157  BOOST_PYTHON_MODULE(escriptcpp) Line 168  BOOST_PYTHON_MODULE(escriptcpp)
168      .def("getNumberOfDataPoints",&escript::Data::getNumDataPoints)      .def("getNumberOfDataPoints",&escript::Data::getNumDataPoints)
169      .def("isExpanded",&escript::Data::isExpanded)      .def("isExpanded",&escript::Data::isExpanded)
170      .def("isTagged",&escript::Data::isTagged)      .def("isTagged",&escript::Data::isTagged)
171        .def("isConstant",&escript::Data::isConstant)
172        .def("isLazy",&escript::Data::isLazy)
173        .def("isReady",&escript::Data::isReady)
174      .def("expand",&escript::Data::expand)      .def("expand",&escript::Data::expand)
175      .def("tag",&escript::Data::tag)      .def("tag",&escript::Data::tag)
176        .def("resolve",&escript::Data::resolve)
177      .def("copy",&escript::Data::copy)      .def("copy",&escript::Data::copy)
178        .def("copy",&escript::Data::copySelf,return_value_policy<manage_new_object>())
179        .def("delay",&escript::Data::delay)
180      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)
181      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)
182      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)
# Line 331  BOOST_PYTHON_MODULE(escriptcpp) Line 348  BOOST_PYTHON_MODULE(escriptcpp)
348       .def("setInitialValue",&escript::AbstractTransportProblem::setInitialValue)       .def("setInitialValue",&escript::AbstractTransportProblem::setInitialValue)
349       .def("insertConstraint",&escript::AbstractTransportProblem::insertConstraint)       .def("insertConstraint",&escript::AbstractTransportProblem::insertConstraint)
350       .def("reset",&escript::AbstractTransportProblem::resetTransport)       .def("reset",&escript::AbstractTransportProblem::resetTransport)
351       .def("getSafeTimeStepSize",&escript::AbstractTransportProblem::getSafeTimeStepSize);       .def("resetValues",&escript::AbstractTransportProblem::resetTransport)
352         .def("getSafeTimeStepSize",&escript::AbstractTransportProblem::getSafeTimeStepSize)
353         .def("getUnlimitedTimeStepSize",&escript::AbstractTransportProblem::getUnlimitedTimeStepSize);
354    
355      // Functions to modify global parameters
356      def("setEscriptParamInt",escript::setEscriptParamInt,
357          (arg("value")=0));
358      def("getEscriptParamInt",escript::getEscriptParamInt,
359          (arg("sentinel")=0));
360    
361    
362    //    //
363    // Register esysExceptionTranslator    // Register esysExceptionTranslator

Legend:
Removed from v.1796  
changed lines
  Added in v.2005

  ViewVC Help
Powered by ViewVC 1.1.26