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

branches/domexper/dudley/src/CPPAdapter/dudleycpp.cpp revision 3114 by jfenwick, Fri Aug 27 05:26:25 2010 UTC trunk/dudley/src/CPPAdapter/dudleycpp.cpp revision 3981 by jfenwick, Fri Sep 21 02:47:54 2012 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2010 by University of Queensland  * Copyright (c) 2003-2012 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 PASO_MPI  #ifdef ESYS_MPI
18  #include <mpi.h>  #include "esysUtils/Esys_MPI.h"
 #include "paso/Paso_MPI.h"  
19  #endif  #endif
20  extern "C" {  extern "C" {
21  #include "../Dudley.h"  #include "../Dudley.h"
22  }  }
23    
24    #include <pasowrap/SystemMatrixAdapter.h>
25    #include <pasowrap/TransportProblemAdapter.h>
26    
27  #include "MeshAdapter.h"  #include "MeshAdapter.h"
28  #include "MeshAdapterFactory.h"  #include "MeshAdapterFactory.h"
 #include "SystemMatrixAdapter.h"  
 #include "TransportProblemAdapter.h"  
29    
30  #include "DudleyAdapterException.h"  #include "DudleyAdapterException.h"
31  // #include "esysUtils/EsysException.h"  // #include "esysUtils/EsysException.h"
# Line 115  BOOST_PYTHON_MODULE(dudleycpp) Line 117  BOOST_PYTHON_MODULE(dudleycpp)
117        arg("useElementsOnFace")=false,        arg("useElementsOnFace")=false,
118        arg("useFullElementOrder")=false,        arg("useFullElementOrder")=false,
119        arg("optimize")=false)        arg("optimize")=false)
120  ,"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]."
121    "We accept floating point values for n0, n1 only to ease transition of scripts to python3 when the time comes."
122  "\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"
123  ":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"
124  ":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 137  BOOST_PYTHON_MODULE(dudleycpp) Line 140  BOOST_PYTHON_MODULE(dudleycpp)
140        arg("useElementsOnFace")=false,        arg("useElementsOnFace")=false,
141        arg("useFullElementOrder")=false,        arg("useFullElementOrder")=false,
142        arg("optimize")=false)        arg("optimize")=false)
143  ,"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]."
144    "We accept floating point values for n0, n1 only to ease transition of scripts to python3 when the time comes."
145  "\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"
146  ":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"
147  ":param l0: length of side 0\n:param l1:\n"  ":param l0: length of side 0\n:param l1:\n"
# Line 152  BOOST_PYTHON_MODULE(dudleycpp) Line 156  BOOST_PYTHON_MODULE(dudleycpp)
156  ":param optimize: Enable optimisation of node labels\n:type optimize: ``bool``"  ":param optimize: Enable optimisation of node labels\n:type optimize: ``bool``"
157  );  );
158    
   def("Merge",dudley::meshMerge,args("meshList")  
 //       ,return_value_policy<manage_new_object>());  
 ,"Merges a list of meshes into one mesh.\n\n:rtype: `Domain`"  
   );  
   
   def("GlueFaces",dudley::glueFaces,  
       (arg("meshList"),arg("safetyFactor")=0.2,  
       arg("tolerance")=1.e-8,  
       arg("optimize")=true)  
 //       ,return_value_policy<manage_new_object>());  
 ,"Detects matching faces in the mesh, removes them from the mesh and joins the elements touched by the face elements."  
     );  
   
   def("JoinFaces",dudley::joinFaces,  
       (arg("meshList"), arg("safetyFactor")=0.2,  
       arg("tolerance")=1.e-8,  
       arg("optimize")=true)  
 //       ,return_value_policy<manage_new_object>());  
 ,"Detects matching faces in the mesh and replaces them by joint elements."  
     );  
   
   
159    class_<dudley::MeshAdapter, bases<escript::AbstractContinuousDomain> >    class_<dudley::MeshAdapter, bases<escript::AbstractContinuousDomain> >
160        ("MeshAdapter","A concrete class representing a domain. For more details, please consult the c++ documentation.",init<optional <Dudley_Mesh*> >())        ("MeshAdapter","A concrete class representing a domain. For more details, please consult the c++ documentation.",init<optional <Dudley_Mesh*> >())
161        .def(init<const dudley::MeshAdapter&>())        .def(init<const dudley::MeshAdapter&>())
# Line 192  BOOST_PYTHON_MODULE(dudleycpp) Line 174  BOOST_PYTHON_MODULE(dudleycpp)
174  ":return: the number of data points summed across all MPI processes\n"  ":return: the number of data points summed across all MPI processes\n"
175  ":rtype: ``int``")  ":rtype: ``int``")
176        .def("addPDEToSystem",&dudley::MeshAdapter::addPDEToSystem,        .def("addPDEToSystem",&dudley::MeshAdapter::addPDEToSystem,
177  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"),
178  "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"
179  ":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"
180  ":param A:\n:type A: `Data`\n"  ":param A:\n:type A: `Data`\n"
# Line 202  args("mat", "rhs","A", "B", "C", "D", "X Line 184  args("mat", "rhs","A", "B", "C", "D", "X
184  ":param X:\n:type X: `Data`\n"  ":param X:\n:type X: `Data`\n"
185  ":param Y:\n:type Y: `Data`\n"  ":param Y:\n:type Y: `Data`\n"
186  ":param d:\n:type d: `Data`\n"  ":param d:\n:type d: `Data`\n"
187    ":param d_contact:\n:type d_contact: `Data`\n"
188    ":param y_contact:\n:type y_contact: `Data`\n"
189  )  )
190        .def("addPDEToLumpedSystem",&dudley::MeshAdapter::addPDEToLumpedSystem,        .def("addPDEToLumpedSystem",&dudley::MeshAdapter::addPDEToLumpedSystem,
191  args("mat", "D", "d"),  args("mat", "D", "d"),
192  "adds a PDE onto the lumped stiffness matrix\n\n"  "adds a PDE onto the lumped stiffness matrix\n\n"
193  ":param mat:\n:type mat: `Data`\n"  ":param mat:\n:type mat: `Data`\n"
194  ":param D:\n:type D: `Data`\n"  ":param D:\n:type D: `Data`\n"
195  ":param d:\n:type d: `Data`\n")  ":param d:\n:type d: `Data`\n"
196    ":param useHRZ:\n:type useHRZ: bool\n"
197    )
198        .def("addPDEToRHS",&dudley::MeshAdapter::addPDEToRHS,        .def("addPDEToRHS",&dudley::MeshAdapter::addPDEToRHS,
199  args("rhs", "X", "Y", "y", "y_contact"),  args("rhs", "X", "Y", "y", "y_contact"),
200  "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 303  args("filename" ,"arg",  "metadata", "me Line 289  args("filename" ,"arg",  "metadata", "me
289        .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")
290        .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`");
291    
   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");  
292  }  }

Legend:
Removed from v.3114  
changed lines
  Added in v.3981

  ViewVC Help
Powered by ViewVC 1.1.26