/[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 2308 by gross, Mon Mar 16 01:20:56 2009 UTC revision 2548 by jfenwick, Mon Jul 20 06:20:06 2009 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*******************************************************
3  *  *
4  * Copyright (c) 2003-2008 by University of Queensland  * Copyright (c) 2003-2009 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * Earth Systems Science Computational Center (ESSCC)
6  * http://www.uq.edu.au/esscc  * http://www.uq.edu.au/esscc
7  *  *
# Line 24  Line 24 
24  #include "DataVector.h"  #include "DataVector.h"
25  #include "paso/Paso_MPI.h"  #include "paso/Paso_MPI.h"
26  #include "EscriptParams.h"  #include "EscriptParams.h"
27    #include "TestDomain.h"
28    
29    
30  extern "C" {  extern "C" {
# Line 46  using namespace boost::python; Line 47  using namespace boost::python;
47    
48  /*! \mainpage Esys Documentation  /*! \mainpage Esys Documentation
49   *   *
50   * \version 1.0.0   * \version 2.9.0
51   *   *
52   * - \ref escript   * - \ref escript
53   *   *
# Line 62  using namespace boost::python; Line 63  using namespace boost::python;
63   * Escript is the python module that contains the interfaces   * Escript is the python module that contains the interfaces
64   * to the C++ side of escript.   * to the C++ side of escript.
65   *   *
66   * \version 1.0.0   *
67   *   *
68   * \section class_desc Class Description:   * \section class_desc Class Description:
69   * Data   * Data
# Line 101  BOOST_PYTHON_MODULE(escriptcpp) Line 102  BOOST_PYTHON_MODULE(escriptcpp)
102    def("printParallelThreadCounts",escript::printParallelThreadCnt);    def("printParallelThreadCounts",escript::printParallelThreadCnt);
103    def("getMPISizeWorld",escript::getMPISizeWorld);    def("getMPISizeWorld",escript::getMPISizeWorld);
104    def("getMPIRankWorld",escript::getMPIRankWorld);    def("getMPIRankWorld",escript::getMPIRankWorld);
105      def("MPIBarrierWorld",escript::MPIBarrierWorld);
106    def("getMPIWorldMax",escript::getMPIWorldMax);    def("getMPIWorldMax",escript::getMPIWorldMax);
107    def("getMachinePrecision",escript::getMachinePrecision);    def("getMachinePrecision",escript::getMachinePrecision);
108    def("getMaxFloat",escript::getMaxFloat);    def("getMaxFloat",escript::getMaxFloat);
# Line 108  BOOST_PYTHON_MODULE(escriptcpp) Line 110  BOOST_PYTHON_MODULE(escriptcpp)
110    // Interface for AbstractDomain    // Interface for AbstractDomain
111    //    //
112    class_<escript::AbstractDomain, escript::Domain_ptr>("Domain","Base class for all domains.",no_init)    class_<escript::AbstractDomain, escript::Domain_ptr>("Domain","Base class for all domains.",no_init)
113         .def("getStatus",&escript::AbstractDomain::getStatus)
114       .def("setTagMap",&escript::AbstractDomain::setTagMap)       .def("setTagMap",&escript::AbstractDomain::setTagMap)
115       .def("getTag",&escript::AbstractDomain::getTag)       .def("getTag",&escript::AbstractDomain::getTag)
116       .def("isValidTagName",&escript::AbstractDomain::isValidTagName)       .def("isValidTagName",&escript::AbstractDomain::isValidTagName)
# Line 117  BOOST_PYTHON_MODULE(escriptcpp) Line 120  BOOST_PYTHON_MODULE(escriptcpp)
120       .def("getNormal",&escript::AbstractDomain::getNormal)       .def("getNormal",&escript::AbstractDomain::getNormal)
121       .def("getSize",&escript::AbstractDomain::getSize)       .def("getSize",&escript::AbstractDomain::getSize)
122       .def("saveVTK",&escript::AbstractDomain::saveVTK)       .def("saveVTK",&escript::AbstractDomain::saveVTK)
123         .def("dump",&escript::AbstractDomain::dump)
124       .def("saveDX",&escript::AbstractDomain::saveDX)       .def("saveDX",&escript::AbstractDomain::saveDX)
125       .def("getMPISize",&escript::AbstractDomain::getMPISize)       .def("getMPISize",&escript::AbstractDomain::getMPISize)
126       .def("getMPIRank",&escript::AbstractDomain::getMPIRank)       .def("getMPIRank",&escript::AbstractDomain::getMPIRank)
# Line 133  BOOST_PYTHON_MODULE(escriptcpp) Line 137  BOOST_PYTHON_MODULE(escriptcpp)
137         .def("getSystemMatrixTypeId",&escript::AbstractContinuousDomain::getSystemMatrixTypeId)         .def("getSystemMatrixTypeId",&escript::AbstractContinuousDomain::getSystemMatrixTypeId)
138         .def("getTransportTypeId",&escript::AbstractContinuousDomain::getTransportTypeId);         .def("getTransportTypeId",&escript::AbstractContinuousDomain::getTransportTypeId);
139    
140    
141      //
142      // Interface for TestDomain
143      //
144      class_ <escript::TestDomain, bases<escript::AbstractDomain> >("TestDomain", "Test Class for domains with no structure. May be removed from future releases without notice.", init<int,int>());
145    
146      // This is the only python visible way to get a TestDomain
147      def("getTestDomainFunctionSpace",&escript::getTestDomainFunctionSpace, "For testing only. May be removed without notice.");
148    
149    //    //
150    // Interface for FunctionSpace    // Interface for FunctionSpace
151    //    //
# Line 157  BOOST_PYTHON_MODULE(escriptcpp) Line 170  BOOST_PYTHON_MODULE(escriptcpp)
170    //    //
171    class_<escript::Data>("Data","Represents a collection of datapoints. It is used to store the values of a function. For more details please consult the c++ class documentation.",init<>() )    class_<escript::Data>("Data","Represents a collection of datapoints. It is used to store the values of a function. For more details please consult the c++ class documentation.",init<>() )
172      // various constructors for Data objects      // various constructors for Data objects
 //    .def(init<const numeric::array&, optional<const escript::FunctionSpace&, bool> >(args("value","what","expand")))  
173      .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")))
174      .def(init<const double, const tuple&, optional<const escript::FunctionSpace&, bool> >(args("value","shape","what","expand")))      .def(init<const double, const tuple&, optional<const escript::FunctionSpace&, bool> >(args("value","shape","what","expand")))
175      .def(init<const escript::Data&, const escript::FunctionSpace&>(args("value","what")))      .def(init<const escript::Data&, const escript::FunctionSpace&>(args("value","what")))
# Line 165  BOOST_PYTHON_MODULE(escriptcpp) Line 177  BOOST_PYTHON_MODULE(escriptcpp)
177      // 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
178      // reference. In this case return_internal_reference.      // reference. In this case return_internal_reference.
179      .def("__str__",&escript::Data::toString)      .def("__str__",&escript::Data::toString)
 //     .def("getDomain",&escript::Data::getDomain,return_internal_reference<>())  
180      .def("getDomain",&escript::Data::getDomainPython)      .def("getDomain",&escript::Data::getDomainPython)
181      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_value_policy<copy_const_reference>())      .def("getFunctionSpace",&escript::Data::getFunctionSpace,return_value_policy<copy_const_reference>())
182      .def("isEmpty",&escript::Data::isEmpty)      .def("isEmpty",&escript::Data::isEmpty)
# Line 174  BOOST_PYTHON_MODULE(escriptcpp) Line 185  BOOST_PYTHON_MODULE(escriptcpp)
185      .def("getShape",&escript::Data::getShapeTuple)      .def("getShape",&escript::Data::getShapeTuple)
186      .def("getRank",&escript::Data::getDataPointRank)      .def("getRank",&escript::Data::getDataPointRank)
187      .def("dump",&escript::Data::dump)      .def("dump",&escript::Data::dump)
188        .def("toListOfTuples",&escript::Data::toListOfTuples, (arg("scalarastuple")=true))
189      .def("copyWithMask",&escript::Data::copyWithMask)      .def("copyWithMask",&escript::Data::copyWithMask)
190      .def("setTaggedValue",&escript::Data::setTaggedValue)      .def("setTaggedValue",&escript::Data::setTaggedValue)
191      .def("setTaggedValue",&escript::Data::setTaggedValueByName)      .def("setTaggedValue",&escript::Data::setTaggedValueByName)
# Line 192  BOOST_PYTHON_MODULE(escriptcpp) Line 204  BOOST_PYTHON_MODULE(escriptcpp)
204      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToPyObject)
205      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPointToArray)
206      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)      .def("setValueOfDataPoint",&escript::Data::setValueOfDataPoint)
     .def("getValueOfDataPoint",&escript::Data::getValueOfDataPoint)  
207      .def("getTupleForDataPoint",&escript::Data::getValueOfDataPointAsTuple)      .def("getTupleForDataPoint",&escript::Data::getValueOfDataPointAsTuple)
     .def("getValueOfGlobalDataPoint",&escript::Data::getValueOfGlobalDataPoint)  
208      .def("getTupleForGlobalDataPoint",&escript::Data::getValueOfGlobalDataPointAsTuple)      .def("getTupleForGlobalDataPoint",&escript::Data::getValueOfGlobalDataPointAsTuple)
209      .def("setToZero",&escript::Data::setToZero)      .def("setToZero",&escript::Data::setToZero)
210      .def("interpolate",&escript::Data::interpolate)      .def("interpolate",&escript::Data::interpolate)
211      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)      .def("minGlobalDataPoint",&escript::Data::minGlobalDataPoint)
212        .def("maxGlobalDataPoint",&escript::Data::maxGlobalDataPoint)
213      .def("saveDX",&escript::Data::saveDX)      .def("saveDX",&escript::Data::saveDX)
214      .def("saveVTK",&escript::Data::saveVTK)      .def("saveVTK",&escript::Data::saveVTK)
215      .def("getTagNumber",&escript::Data::getTagNumber)      .def("getTagNumber",&escript::Data::getTagNumber)
# Line 244  BOOST_PYTHON_MODULE(escriptcpp) Line 255  BOOST_PYTHON_MODULE(escriptcpp)
255      .def("_Lsup",&escript::Data::Lsup)      .def("_Lsup",&escript::Data::Lsup)
256      .def("_sup",&escript::Data::sup)      .def("_sup",&escript::Data::sup)
257      .def("_inf",&escript::Data::inf)      .def("_inf",&escript::Data::inf)
     .def("_integrate",&escript::Data::integrate)  
258      .def("_integrateToTuple",&escript::Data::integrateToTuple)      .def("_integrateToTuple",&escript::Data::integrateToTuple)
259    
260      // following implements the python abs operator      // following implements the python abs operator
# Line 378  BOOST_PYTHON_MODULE(escriptcpp) Line 388  BOOST_PYTHON_MODULE(escriptcpp)
388    // Register esysExceptionTranslator    // Register esysExceptionTranslator
389    //    //
390    register_exception_translator<esysUtils::EsysException>(&esysUtils::esysExceptionTranslator);    register_exception_translator<esysUtils::EsysException>(&esysUtils::esysExceptionTranslator);
   
391  }  }

Legend:
Removed from v.2308  
changed lines
  Added in v.2548

  ViewVC Help
Powered by ViewVC 1.1.26