/[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

revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC revision 4346 by jfenwick, Tue Apr 2 04:46:45 2013 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2010 by University of Queensland  * Copyright (c) 2003-2013 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 since 2012 by School of Earth Sciences
13    *
14    *****************************************************************************/
15    
16    
17  #ifdef ESYS_MPI  #ifdef ESYS_MPI
18  #include "esysUtils/Esys_MPI.h"  #include "esysUtils/Esys_MPI.h"
19  #endif  #endif
 extern "C" {  
20  #include "../Dudley.h"  #include "../Dudley.h"
21  }  
22    #include <pasowrap/SystemMatrixAdapter.h>
23    #include <pasowrap/TransportProblemAdapter.h>
24    
25  #include "MeshAdapter.h"  #include "MeshAdapter.h"
26  #include "MeshAdapterFactory.h"  #include "MeshAdapterFactory.h"
 #include "SystemMatrixAdapter.h"  
 #include "TransportProblemAdapter.h"  
27    
28  #include "DudleyAdapterException.h"  #include "DudleyAdapterException.h"
29  // #include "esysUtils/EsysException.h"  // #include "esysUtils/EsysException.h"
# Line 38  extern "C" { Line 39  extern "C" {
39    
40  using namespace boost::python;  using namespace boost::python;
41    
 /**  
    \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  
   
 */  
   
42  BOOST_PYTHON_MODULE(dudleycpp)  BOOST_PYTHON_MODULE(dudleycpp)
43  {  {
44  // This feature was added in boost v1.34  // This feature was added in boost v1.34
# Line 67  BOOST_PYTHON_MODULE(dudleycpp) Line 47  BOOST_PYTHON_MODULE(dudleycpp)
47    docstring_options docopt(true, true, false);    docstring_options docopt(true, true, false);
48  #endif  #endif
49    
50      scope().attr("__doc__") = "To use this module, please import esys.dudley";  
51      
52      
53    //    //
54    // NOTE: The return_value_policy is necessary for functions that    // NOTE: The return_value_policy is necessary for functions that
55    // return pointers.    // return pointers.
# Line 114  BOOST_PYTHON_MODULE(dudleycpp) Line 97  BOOST_PYTHON_MODULE(dudleycpp)
97        arg("useElementsOnFace")=false,        arg("useElementsOnFace")=false,
98        arg("useFullElementOrder")=false,        arg("useFullElementOrder")=false,
99        arg("optimize")=false)        arg("optimize")=false)
100  ,"Creates a rectangular mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2]."  ,"Creates a tetrahedral mesh by subdividing n0 x n1 x n2 rectangular elements over the brick [0,l0] x [0,l1] x [0,l2]."
101    "We accept floating point values for n0, n1 only to ease transition of scripts to python3 when the time comes."
102  "\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"
103  ":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"
104  ":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 136  BOOST_PYTHON_MODULE(dudleycpp) Line 120  BOOST_PYTHON_MODULE(dudleycpp)
120        arg("useElementsOnFace")=false,        arg("useElementsOnFace")=false,
121        arg("useFullElementOrder")=false,        arg("useFullElementOrder")=false,
122        arg("optimize")=false)        arg("optimize")=false)
123  ,"Creates a rectangular mesh with n0 x n1 elements over the brick [0,l0] x [0,l1]."  ,"Creates a triangular mesh by subdividing n0 x n1 rectangular elements over the brick [0,l0] x [0,l1]."
124    "We accept floating point values for n0, n1 only to ease transition of scripts to python3 when the time comes."
125  "\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"
126  ":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"
127  ":param l0: length of side 0\n:param l1:\n"  ":param l0: length of side 0\n:param l1:\n"
# Line 169  BOOST_PYTHON_MODULE(dudleycpp) Line 154  BOOST_PYTHON_MODULE(dudleycpp)
154  ":return: the number of data points summed across all MPI processes\n"  ":return: the number of data points summed across all MPI processes\n"
155  ":rtype: ``int``")  ":rtype: ``int``")
156        .def("addPDEToSystem",&dudley::MeshAdapter::addPDEToSystem,        .def("addPDEToSystem",&dudley::MeshAdapter::addPDEToSystem,
157  args("mat", "rhs","A", "B", "C", "D", "X", "Y", "d", "y"),  args("mat", "rhs","A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),
158  "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"
159  ":param mat:\n:type mat: `OperatorAdapter`\n:param rhs:\n:type rhs: `Data`\n"  ":param mat:\n:type mat: `OperatorAdapter`\n:param rhs:\n:type rhs: `Data`\n"
160  ":param A:\n:type A: `Data`\n"  ":param A:\n:type A: `Data`\n"
# Line 179  args("mat", "rhs","A", "B", "C", "D", "X Line 164  args("mat", "rhs","A", "B", "C", "D", "X
164  ":param X:\n:type X: `Data`\n"  ":param X:\n:type X: `Data`\n"
165  ":param Y:\n:type Y: `Data`\n"  ":param Y:\n:type Y: `Data`\n"
166  ":param d:\n:type d: `Data`\n"  ":param d:\n:type d: `Data`\n"
167    ":param d_contact:\n:type d_contact: `Data`\n"
168    ":param y_contact:\n:type y_contact: `Data`\n"
169  )  )
170        .def("addPDEToLumpedSystem",&dudley::MeshAdapter::addPDEToLumpedSystem,        .def("addPDEToLumpedSystem",&dudley::MeshAdapter::addPDEToLumpedSystem,
171  args("mat", "D", "d"),  args("mat", "D", "d"),
172  "adds a PDE onto the lumped stiffness matrix\n\n"  "adds a PDE onto the lumped stiffness matrix\n\n"
173  ":param mat:\n:type mat: `Data`\n"  ":param mat:\n:type mat: `Data`\n"
174  ":param D:\n:type D: `Data`\n"  ":param D:\n:type D: `Data`\n"
175  ":param d:\n:type d: `Data`\n")  ":param d:\n:type d: `Data`\n"
176    ":param useHRZ:\n:type useHRZ: bool\n"
177    )
178        .def("addPDEToRHS",&dudley::MeshAdapter::addPDEToRHS,        .def("addPDEToRHS",&dudley::MeshAdapter::addPDEToRHS,
179  args("rhs", "X", "Y", "y", "y_contact"),  args("rhs", "X", "Y", "y", "y_contact"),
180  "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 193  args("rhs", "X", "Y", "y", "y_contact"), Line 182  args("rhs", "X", "Y", "y", "y_contact"),
182  ":param X:\n:type X: `Data`\n"  ":param X:\n:type X: `Data`\n"
183  ":param Y:\n:type Y: `Data`\n"  ":param Y:\n:type Y: `Data`\n"
184  ":param y:\n:type y: `Data`\n"  ":param y:\n:type y: `Data`\n"
185    ":param y_contact:\n:type y_contact: `Data`"
186  )  )
187        .def("addPDEToTransportProblem",&dudley::MeshAdapter::addPDEToTransportProblem,        .def("addPDEToTransportProblem",&dudley::MeshAdapter::addPDEToTransportProblem,
188  args( "tp", "source", "M", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),  args( "tp", "source", "M", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),
# Line 229  args("theta", "blocksize", "functionspac Line 219  args("theta", "blocksize", "functionspac
219  )  )
220        .def("getSystemMatrixTypeId",&dudley::MeshAdapter::getSystemMatrixTypeId,        .def("getSystemMatrixTypeId",&dudley::MeshAdapter::getSystemMatrixTypeId,
221  args("solver", "preconditioner", "package", "symmetry"),  args("solver", "preconditioner", "package", "symmetry"),
222  ":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 a particular solver, package, preconditioner, and symmetric matrix is used.\n"
223  ":rtype: ``int``\n"  ":rtype: ``int``\n"
224  ":param solver:\n:type solver: ``int``\n"  ":param solver:\n:type solver: ``int``\n"
225  ":param preconditioner:\n:type preconditioner: ``int``\n"  ":param preconditioner:\n:type preconditioner: ``int``\n"
# Line 238  args("solver", "preconditioner", "packag Line 228  args("solver", "preconditioner", "packag
228  )  )
229        .def("getTransportTypeId",&dudley::MeshAdapter::getTransportTypeId,        .def("getTransportTypeId",&dudley::MeshAdapter::getTransportTypeId,
230  args("solver", "preconditioner", "package", "symmetry"),  args("solver", "preconditioner", "package", "symmetry"),
231  ":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"
232  ":rtype: ``int``\n"  ":rtype: ``int``\n"
233  ":param solver:\n:type solver: ``int``\n"  ":param solver:\n:type solver: ``int``\n"
234  ":param preconditioner:\n:type preconditioner: ``int``\n"  ":param preconditioner:\n:type preconditioner: ``int``\n"
# Line 254  args("arg"), "assigns new location to th Line 244  args("arg"), "assigns new location to th
244  ":rtype: `Data`")  ":rtype: `Data`")
245        .def("getSize",&dudley::MeshAdapter::getSize,":return: the element size\n"        .def("getSize",&dudley::MeshAdapter::getSize,":return: the element size\n"
246  ":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"  
 )  
247        .def("setTagMap",&dudley::MeshAdapter::setTagMap,args("name","tag"),        .def("setTagMap",&dudley::MeshAdapter::setTagMap,args("name","tag"),
248  "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"
249  ":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 279  args("filename" ,"arg",  "metadata", "me Line 257  args("filename" ,"arg",  "metadata", "me
257        .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")
258        .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`");
259    
   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");  
260  }  }

Legend:
Removed from v.3259  
changed lines
  Added in v.4346

  ViewVC Help
Powered by ViewVC 1.1.26