/[escript]/branches/diaplayground/dudley/src/CPPAdapter/dudleycpp.cpp
ViewVC logotype

Diff of /branches/diaplayground/dudley/src/CPPAdapter/dudleycpp.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/dudley/src/CPPAdapter/dudleycpp.cpp revision 3269 by jfenwick, Wed Oct 13 03:21:50 2010 UTC branches/diaplayground/dudley/src/CPPAdapter/dudleycpp.cpp revision 5136 by caltinay, Tue Sep 9 07:13:55 2014 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2010 by University of Queensland  * Copyright (c) 2003-2014 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * http://www.uq.edu.au
 * http://www.uq.edu.au/esscc  
6  *  *
7  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
8  * Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
9  * http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
10  *  *
11  *******************************************************/  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12    * Development 2012-2013 by School of Earth Sciences
13    * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14    *
15    *****************************************************************************/
16    
17    
18  #ifdef ESYS_MPI  #ifdef ESYS_MPI
19  #include "esysUtils/Esys_MPI.h"  #include "esysUtils/Esys_MPI.h"
20  #endif  #endif
 extern "C" {  
21  #include "../Dudley.h"  #include "../Dudley.h"
22  }  
23    #include <pasowrap/SystemMatrixAdapter.h>
24    #include <pasowrap/TransportProblemAdapter.h>
25    
26  #include "MeshAdapter.h"  #include "MeshAdapter.h"
27  #include "MeshAdapterFactory.h"  #include "MeshAdapterFactory.h"
 #include "SystemMatrixAdapter.h"  
 #include "TransportProblemAdapter.h"  
28    
29  #include "DudleyAdapterException.h"  #include "DudleyAdapterException.h"
30  // #include "esysUtils/EsysException.h"  // #include "esysUtils/EsysException.h"
# Line 38  extern "C" { Line 40  extern "C" {
40    
41  using namespace boost::python;  using namespace boost::python;
42    
 /**  
    \page dudley Dudley  
    Dudley is the python module name that contains the interfaces  
    to the C++ wrapper to dudley.  
   
    \version 1.0.0  
   
    \section class_desc Class Description:  
    Data  
   
    \section class_limits Class Limitations:  
    None  
   
    \section class_conds Class Conditions of Use:  
    None  
   
    \section throws Throws:  
    None  
   
 */  
   
43  BOOST_PYTHON_MODULE(dudleycpp)  BOOST_PYTHON_MODULE(dudleycpp)
44  {  {
45  // This feature was added in boost v1.34  // This feature was added in boost v1.34
# Line 67  BOOST_PYTHON_MODULE(dudleycpp) Line 48  BOOST_PYTHON_MODULE(dudleycpp)
48    docstring_options docopt(true, true, false);    docstring_options docopt(true, true, false);
49  #endif  #endif
50    
51      scope().attr("__doc__") = "To use this module, please import esys.dudley";  
52      
53      
54    //    //
55    // NOTE: The return_value_policy is necessary for functions that    // NOTE: The return_value_policy is necessary for functions that
56    // return pointers.    // return pointers.
57    //    //
58    register_exception_translator<dudley::DudleyAdapterException>(&(esysUtils::esysExceptionTranslator));    register_exception_translator<dudley::DudleyAdapterException>(&(esysUtils::RuntimeErrorTranslator));
59    
60    def("LoadMesh",dudley::loadMesh,    def("LoadMesh",dudley::loadMesh,
61        (arg("fileName")="file.nc"),":rtype: `Domain`"        (arg("fileName")="file.nc"),":rtype: `Domain`"
# Line 105  BOOST_PYTHON_MODULE(dudleycpp) Line 89  BOOST_PYTHON_MODULE(dudleycpp)
89  ":param useMacroElements: Enable the usage of macro elements instead of second order elements.\n:type useMacroElements: ``bool``"  ":param useMacroElements: Enable the usage of macro elements instead of second order elements.\n:type useMacroElements: ``bool``"
90  );  );
91    
92    def ("Brick",dudley::brick,    def ("__Brick_driver",dudley::brick_driver,
93          arg("args"),
94    /*      
95        (arg("n0")=1,arg("n1")=1,arg("n2")=1,        (arg("n0")=1,arg("n1")=1,arg("n2")=1,
96        arg("order")=1,        arg("order")=1,
97        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,        arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,
# Line 114  BOOST_PYTHON_MODULE(dudleycpp) Line 100  BOOST_PYTHON_MODULE(dudleycpp)
100        arg("useElementsOnFace")=false,        arg("useElementsOnFace")=false,
101        arg("useFullElementOrder")=false,        arg("useFullElementOrder")=false,
102        arg("optimize")=false)        arg("optimize")=false)
103  ,"Creates a rectangular mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2]."  */      
104    "Creates a tetrahedral mesh by subdividing n0 x n1 x n2 rectangular elements over the brick [0,l0] x [0,l1] x [0,l2]."
105    "We accept floating point values for n0, n1 only to ease transition of scripts to python3 when the time comes."
106  "\n\n:param n0:\n:type n0:\n:param n1:\n:type n1:\n:param n2:\n:type n2:\n"  "\n\n:param n0:\n:type n0:\n:param n1:\n:type n1:\n:param n2:\n:type n2:\n"
107  ":param order: =1, =-1 or =2 gives the order of shape function. If -1 macro elements of order 1 are used.\n"  ":param order: =1, =-1 or =2 gives the order of shape function. If -1 macro elements of order 1 are used.\n"
108  ":param l0: length of side 0\n:param l1:\n:param l2:\n"  ":param l0: length of side 0\n:param l1:\n:param l2:\n"
# Line 128  BOOST_PYTHON_MODULE(dudleycpp) Line 116  BOOST_PYTHON_MODULE(dudleycpp)
116  ":param optimize: Enable optimisation of node labels\n:type optimize: ``bool``"  ":param optimize: Enable optimisation of node labels\n:type optimize: ``bool``"
117  );  );
118    
119    def ("Rectangle",dudley::rectangle,    def ("__Rectangle_driver",dudley::rectangle_driver,
120          arg("args"),
121    /*      
122        (arg("n0")=1,arg("n1")=1,arg("order")=1,        (arg("n0")=1,arg("n1")=1,arg("order")=1,
123        arg("l0")=1.0,arg("l1")=1.0,        arg("l0")=1.0,arg("l1")=1.0,
124        arg("periodic0")=false,arg("periodic1")=false,        arg("periodic0")=false,arg("periodic1")=false,
# Line 136  BOOST_PYTHON_MODULE(dudleycpp) Line 126  BOOST_PYTHON_MODULE(dudleycpp)
126        arg("useElementsOnFace")=false,        arg("useElementsOnFace")=false,
127        arg("useFullElementOrder")=false,        arg("useFullElementOrder")=false,
128        arg("optimize")=false)        arg("optimize")=false)
129  ,"Creates a rectangular mesh with n0 x n1 elements over the brick [0,l0] x [0,l1]."  */      
130    "Creates a triangular mesh by subdividing n0 x n1 rectangular elements over the brick [0,l0] x [0,l1]."
131    "We accept floating point values for n0, n1 only to ease transition of scripts to python3 when the time comes."
132  "\n\n:param n0:\n:type n0:\n:param n1:\n:type n1:\n"  "\n\n:param n0:\n:type n0:\n:param n1:\n:type n1:\n"
133  ":param order: =1, =-1 or =2 gives the order of shape function. If -1 macro elements of order 1 are used.\n"  ":param order: =1, =-1 or =2 gives the order of shape function. If -1 macro elements of order 1 are used.\n"
134  ":param l0: length of side 0\n:param l1:\n"  ":param l0: length of side 0\n:param l1:\n"
# Line 187  args("mat", "D", "d"), Line 179  args("mat", "D", "d"),
179  "adds a PDE onto the lumped stiffness matrix\n\n"  "adds a PDE onto the lumped stiffness matrix\n\n"
180  ":param mat:\n:type mat: `Data`\n"  ":param mat:\n:type mat: `Data`\n"
181  ":param D:\n:type D: `Data`\n"  ":param D:\n:type D: `Data`\n"
182  ":param d:\n:type d: `Data`\n")  ":param d:\n:type d: `Data`\n"
183    ":param useHRZ:\n:type useHRZ: bool\n"
184    )
185        .def("addPDEToRHS",&dudley::MeshAdapter::addPDEToRHS,        .def("addPDEToRHS",&dudley::MeshAdapter::addPDEToRHS,
186  args("rhs", "X", "Y", "y", "y_contact"),  args("rhs", "X", "Y", "y", "y_contact"),
187  "adds a PDE onto the stiffness matrix mat and a rhs\n\n"  "adds a PDE onto the stiffness matrix mat and a rhs\n\n"
# Line 231  args("theta", "blocksize", "functionspac Line 225  args("theta", "blocksize", "functionspac
225  ":param type:\n:type type: ``int``\n"  ":param type:\n:type type: ``int``\n"
226  )  )
227        .def("getSystemMatrixTypeId",&dudley::MeshAdapter::getSystemMatrixTypeId,        .def("getSystemMatrixTypeId",&dudley::MeshAdapter::getSystemMatrixTypeId,
228  args("solver", "preconditioner", "package", "symmetry"),  args("options"),
229  ":return: the identifier of the matrix type to be used for the global stiffness matrix when a particular solver, package, perconditioner, and symmetric matrix is used.\n"  ":return: the identifier of the matrix type to be used for the global stiffness matrix when particular solver options are used.\n"
230  ":rtype: ``int``\n"  ":rtype: ``int``\n"
231  ":param solver:\n:type solver: ``int``\n"  ":param options:\n:type options: `SolverBuddy`\n"
 ":param preconditioner:\n:type preconditioner: ``int``\n"  
 ":param package:\n:type package: ``int``\n"  
 ":param symmetry:\n:type symmetry: ``int``\n"  
232  )  )
233        .def("getTransportTypeId",&dudley::MeshAdapter::getTransportTypeId,        .def("getTransportTypeId",&dudley::MeshAdapter::getTransportTypeId,
234  args("solver", "preconditioner", "package", "symmetry"),  args("solver", "preconditioner", "package", "symmetry"),
235  ":return: the identifier of the transport problem type to be used when a particular solver, perconditioner, package and symmetric matrix is used.\n"  ":return: the identifier of the transport problem type to be used when a particular solver, preconditioner, package and symmetric matrix is used.\n"
236  ":rtype: ``int``\n"  ":rtype: ``int``\n"
237  ":param solver:\n:type solver: ``int``\n"  ":param solver:\n:type solver: ``int``\n"
238  ":param preconditioner:\n:type preconditioner: ``int``\n"  ":param preconditioner:\n:type preconditioner: ``int``\n"
# Line 257  args("arg"), "assigns new location to th Line 248  args("arg"), "assigns new location to th
248  ":rtype: `Data`")  ":rtype: `Data`")
249        .def("getSize",&dudley::MeshAdapter::getSize,":return: the element size\n"        .def("getSize",&dudley::MeshAdapter::getSize,":return: the element size\n"
250  ":rtype: `Data`")  ":rtype: `Data`")
       .def("saveDX",&dudley::MeshAdapter::saveDX,args("filename" ,"arg"),  
 "Saves a dictonary of Data objects to an OpenDX input file. The keywords are used as identifier"  
 "\n\n:param filename: \n:type filename: ``string``\n"  
 "\n:param arg: \n:type arg: ``dict``\n")  
       .def("saveVTK",&dudley::MeshAdapter::saveVTK,  
 args("filename" ,"arg",  "metadata", "metadata_schema"),  
 "Saves a dictonary of Data objects to an VTK XML input file. The keywords are used as identifier"  
 "\n\n:param filename:\n:type filename: ``string``\n"  
 ":param arg:\n:type arg: ``dict``\n"  
 ":param metadata:\n:type metadata: ``string``\n"  
 ":param metadata_schema:\n:type metadata_schema: ``string``\n"  
 )  
251        .def("setTagMap",&dudley::MeshAdapter::setTagMap,args("name","tag"),        .def("setTagMap",&dudley::MeshAdapter::setTagMap,args("name","tag"),
252  "Give a tag number a name.\n\n:param name: Name for the tag\n:type name: ``string``\n"  "Give a tag number a name.\n\n:param name: Name for the tag\n:type name: ``string``\n"
253  ":param tag: numeric id\n:type tag: ``int``\n:note: Tag names must be unique within a domain")  ":param tag: numeric id\n:type tag: ``int``\n:note: Tag names must be unique within a domain")
# Line 282  args("filename" ,"arg",  "metadata", "me Line 261  args("filename" ,"arg",  "metadata", "me
261        .def("MPIBarrier",&dudley::MeshAdapter::MPIBarrier,"Wait until all processes have reached this point")        .def("MPIBarrier",&dudley::MeshAdapter::MPIBarrier,"Wait until all processes have reached this point")
262        .def("onMasterProcessor",&dudley::MeshAdapter::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");        .def("onMasterProcessor",&dudley::MeshAdapter::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");
263    
   class_<dudley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >  
       ("OperatorAdapter","A concrete class representing an operator. For more details, please see the c++ documentation.", no_init)  
       .def("print_matrix_info",&dudley::SystemMatrixAdapter::Print_Matrix_Info,(arg("full")=false),"prints information about a system matrix")  
       .def("nullifyRowsAndCols",&dudley::SystemMatrixAdapter::nullifyRowsAndCols)  
       .def("resetValues",&dudley::SystemMatrixAdapter::resetValues, "resets the matrix entries")  
       .def("saveMM",&dudley::SystemMatrixAdapter::saveMM,args("fileName"),  
 "writes the matrix to a file using the Matrix Market file format")  
       .def("saveHB",&dudley::SystemMatrixAdapter::saveHB, args("filename"),  
 "writes the matrix to a file using the Harwell-Boeing file format");  
   
   class_<dudley::TransportProblemAdapter, bases<escript::AbstractTransportProblem> >  
       ("TransportProblemAdapter","",no_init)  
       .def("getSafeTimeStepSize",&dudley::TransportProblemAdapter::getSafeTimeStepSize)  
       .def("getUnlimitedTimeStepSize",&dudley::TransportProblemAdapter::getUnlimitedTimeStepSize)  
       .def("resetTransport",&dudley::TransportProblemAdapter::resetTransport,  
 "resets the transport operator typically as they have been updated");  
264  }  }

Legend:
Removed from v.3269  
changed lines
  Added in v.5136

  ViewVC Help
Powered by ViewVC 1.1.26