/[escript]/trunk/ripley/src/ripleycpp.cpp
ViewVC logotype

Diff of /trunk/ripley/src/ripleycpp.cpp

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

branches/ripleygmg_from_3668/ripley/src/ripleycpp.cpp revision 3670 by caltinay, Wed Nov 16 02:21:18 2011 UTC trunk/ripley/src/ripleycpp.cpp revision 4357 by caltinay, Thu Apr 11 06:07:14 2013 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2011 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  #include <ripley/RipleyDomainFactory.h>  #include <ripley/Brick.h>
17    #include <ripley/Rectangle.h>
18  #include <esysUtils/esysExceptionTranslator.h>  #include <esysUtils/esysExceptionTranslator.h>
19    
20  #include <boost/python.hpp>  #include <boost/python.hpp>
# Line 22  Line 25 
25    
26  using namespace boost::python;  using namespace boost::python;
27    
28  /**  namespace ripley {
29     \page ripley Ripley  
30     Ripley is the python module name that contains the interfaces  escript::Data readBinaryGrid(std::string filename, escript::FunctionSpace fs,
31     to the C++ wrapper to ripley.          const object& pyFirst, const object& pyNum, const object& pyMultiplier,
32            const object& pyShape, double fill=0.)
33    {
34        int dim=fs.getDim();
35        std::vector<int> first(dim), numValues(dim), multiplier(dim), shape;
36    
37        if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {
38            if (len(pyFirst)==dim) {
39                for (int i=0; i<dim; i++) {
40                    first[i]=extract<int>(pyFirst[i]);
41                }
42            } else
43                throw RipleyException("Argument 'first' has wrong length");
44        } else
45            throw RipleyException("Argument 'first' must be a tuple or list");
46    
47        if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {
48            if (len(pyNum)==dim) {
49                for (int i=0; i<dim; i++) {
50                    numValues[i]=extract<int>(pyNum[i]);
51                }
52            } else
53                throw RipleyException("Argument 'numValues' has wrong length");
54        } else
55            throw RipleyException("Argument 'numValues' must be a tuple or list");
56    
57        if (extract<tuple>(pyShape).check() || extract<list>(pyShape).check()) {
58            for (int i=0; i<len(pyShape); i++) {
59                shape.push_back(extract<int>(pyShape[i]));
60            }
61        } else
62            throw RipleyException("Argument 'shape' must be a tuple or list");
63    
64        if (extract<tuple>(pyMultiplier).check() || extract<list>(pyMultiplier).check()) {
65            if (len(pyMultiplier)==dim) {
66                for (int i=0; i<dim; i++) {
67                    multiplier[i]=extract<int>(pyMultiplier[i]);
68                }
69            } else
70                throw RipleyException("Argument 'multiplier' has wrong length");
71        } else
72            throw RipleyException("Argument 'multiplier' must be a tuple or list");
73    
74        const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
75        if (!dom)
76            throw RipleyException("Function space must be on a ripley domain");
77    
78    
79        escript::Data res(fill, shape, fs, true);
80    
81        dom->readBinaryGrid(res, filename, first, numValues, multiplier);
82        return res;
83    }
84    
85    escript::Data readNcGrid(std::string filename, std::string varname,
86            escript::FunctionSpace fs, const object& pyFirst, const object& pyNum,
87            const object& pyMultiplier, const object& pyShape, double fill=0.)
88    {
89        int dim=fs.getDim();
90        std::vector<int> first(dim), numValues(dim), multiplier(dim), shape;
91    
92        if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {
93            if (len(pyFirst)==dim) {
94                for (int i=0; i<dim; i++) {
95                    first[i]=extract<int>(pyFirst[i]);
96                }
97            } else
98                throw RipleyException("Argument 'first' has wrong length");
99        } else
100            throw RipleyException("Argument 'first' must be a tuple or list");
101    
102        if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {
103            if (len(pyNum)==dim) {
104                for (int i=0; i<dim; i++) {
105                    numValues[i]=extract<int>(pyNum[i]);
106                }
107            } else
108                throw RipleyException("Argument 'numValues' has wrong length");
109        } else
110            throw RipleyException("Argument 'numValues' must be a tuple or list");
111    
112        if (extract<tuple>(pyMultiplier).check() || extract<list>(pyMultiplier).check()) {
113            if (len(pyMultiplier)==dim) {
114                for (int i=0; i<dim; i++) {
115                    multiplier[i]=extract<int>(pyMultiplier[i]);
116                }
117            } else
118                throw RipleyException("Argument 'multiplier' has wrong length");
119        } else
120            throw RipleyException("Argument 'multiplier' must be a tuple or list");
121    
122        if (extract<tuple>(pyShape).check() || extract<list>(pyShape).check()) {
123            for (int i=0; i<len(pyShape); i++) {
124                shape.push_back(extract<int>(pyShape[i]));
125            }
126        } else
127            throw RipleyException("Argument 'shape' must be a tuple or list");
128    
129        const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
130        if (!dom)
131            throw RipleyException("Function space must be on a ripley domain");
132    
133    
134        escript::Data res(fill, shape, fs, true);
135    
136        dom->readNcGrid(res, filename, varname, first, numValues, multiplier);
137        return res;
138    }
139    
140    // These wrappers are required to make the shared pointers work through the
141    // Python wrapper
142    
143     \version 1.0.0  // The double for n? is just to keep python happy when people need to deal with
144    // truediv
145    escript::Domain_ptr _brick(double _n0, double _n1, double _n2, const object& l0,
146                     const object& l1, const object& l2, int d0, int d1, int d2)
147    {
148        int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1), n2=static_cast<int>(_n2);
149        double x0=0., x1=1., y0=0., y1=1., z0=0., z1=1.;
150        if (extract<tuple>(l0).check()) {
151            tuple x=extract<tuple>(l0);
152            if (len(x)==2) {
153                x0=extract<double>(x[0]);
154                x1=extract<double>(x[1]);
155            } else
156                throw RipleyException("Argument l0 must be a float or 2-tuple");
157        } else if (extract<double>(l0).check()) {
158            x1=extract<double>(l0);
159        } else
160            throw RipleyException("Argument l0 must be a float or 2-tuple");
161    
162        if (extract<tuple>(l1).check()) {
163            tuple y=extract<tuple>(l1);
164            if (len(y)==2) {
165                y0=extract<double>(y[0]);
166                y1=extract<double>(y[1]);
167            } else
168                throw RipleyException("Argument l1 must be a float or 2-tuple");
169        } else if (extract<double>(l1).check()) {
170            y1=extract<double>(l1);
171        } else
172            throw RipleyException("Argument l1 must be a float or 2-tuple");
173    
174        if (extract<tuple>(l2).check()) {
175            tuple z=extract<tuple>(l2);
176            if (len(z)==2) {
177                z0=extract<double>(z[0]);
178                z1=extract<double>(z[1]);
179            } else
180                throw RipleyException("Argument l2 must be a float or 2-tuple");
181        } else if (extract<double>(l2).check()) {
182            z1=extract<double>(l2);
183        } else
184            throw RipleyException("Argument l2 must be a float or 2-tuple");
185    
186     \section class_desc Class Description:      return escript::Domain_ptr(new Brick(n0,n1,n2, x0,y0,z0, x1,y1,z1, d0,d1,d2));
187     None  }
188    
189     \section class_limits Class Limitations:  const int _q[]={0x61686969,0x746c4144,0x79616e43};
190     None  escript::Domain_ptr _rectangle(double _n0, double _n1, const object& l0,
191                                   const object& l1, int d0, int d1)
192    {
193        int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1);
194        double x0=0., x1=1., y0=0., y1=1.;
195        if (extract<tuple>(l0).check()) {
196            tuple x=extract<tuple>(l0);
197            if (len(x)==2) {
198                x0=extract<double>(x[0]);
199                x1=extract<double>(x[1]);
200            } else
201                throw RipleyException("Argument l0 must be a float or 2-tuple");
202        } else if (extract<double>(l0).check()) {
203            x1=extract<double>(l0);
204        } else
205            throw RipleyException("Argument l0 must be a float or 2-tuple");
206    
207        if (extract<tuple>(l1).check()) {
208            tuple y=extract<tuple>(l1);
209            if (len(y)==2) {
210                y0=extract<double>(y[0]);
211                y1=extract<double>(y[1]);
212            } else
213                throw RipleyException("Argument l1 must be a float or 2-tuple");
214        } else if (extract<double>(l1).check()) {
215            y1=extract<double>(l1);
216        } else
217            throw RipleyException("Argument l1 must be a float or 2-tuple");
218    
219        return escript::Domain_ptr(new Rectangle(n0,n1, x0,y0, x1,y1, d0,d1));
220    }
221    std::string _who(){int a[]={_q[0]^42,_q[1]^42,_q[2]^42,0};return (char*)&a[0];}
222    
223     \section class_conds Class Conditions of Use:  } // end of namespace ripley
    None  
224    
    \section throws Throws:  
    None  
 */  
225    
226  BOOST_PYTHON_MODULE(ripleycpp)  BOOST_PYTHON_MODULE(ripleycpp)
227  {  {
228  // This feature was added in boost v1.34  // This feature was added in boost v1.34
229  #if ((BOOST_VERSION/100)%1000 > 34) || (BOOST_VERSION/100000 >1)  #if ((BOOST_VERSION/100)%1000 > 34) || (BOOST_VERSION/100000 >1)
230    // params are: bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures      // params are: bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures
231    docstring_options docopt(true, true, false);      docstring_options docopt(true, true, false);
232  #endif  #endif
233    
234    register_exception_translator<ripley::RipleyException>(&(esysUtils::esysExceptionTranslator));      register_exception_translator<ripley::RipleyException>(&(esysUtils::esysExceptionTranslator));
235    
236    def("LoadMesh",ripley::loadMesh, (arg("fileName")), ":rtype: `Domain`");      scope().attr("__doc__") = "To use this module, please import esys.ripley";
237        scope().attr("BYTEORDER_NATIVE") = (int)ripley::BYTEORDER_NATIVE;
238    def("ReadMesh",ripley::readMesh, (arg("fileName"), arg("optimize")=true)      scope().attr("BYTEORDER_LITTLE_ENDIAN") = (int)ripley::BYTEORDER_LITTLE_ENDIAN;
239          ,"Reads a mesh from a file. For MPI parallel runs the mesh is fanned out to multiple processes.\n\n"      scope().attr("BYTEORDER_BIG_ENDIAN") = (int)ripley::BYTEORDER_BIG_ENDIAN;
240          ":rtype: `Domain`\n:param fileName:\n:type fileName: ``string``\n"      scope().attr("DATATYPE_INT32") = (int)ripley::DATATYPE_INT32;
241          ":param optimize: Whether to optimize node labels\n:type optimize: ``bool``");      scope().attr("DATATYPE_FLOAT32") = (int)ripley::DATATYPE_FLOAT32;
242        scope().attr("DATATYPE_FLOAT64") = (int)ripley::DATATYPE_FLOAT64;
243    def("ReadGmsh",ripley::readGmsh,  
244        (arg("fileName"), arg("numDim"), arg("optimize")=true)      def("Brick", ripley::_brick, (arg("n0"),arg("n1"),arg("n2"),arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,arg("d0")=-1,arg("d1")=-1,arg("d2")=-1),
245          ,"Reads a gmsh mesh file\n\n"  "Creates a hexagonal mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2].\n\n"
246          ":rtype: `Domain`\n:param fileName:\n:type fileName: ``string``\n"  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
247          ":param optimize: Whether to optimize node labels\n:type optimize: ``bool``\n");  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
248    ":param n2: number of elements in direction 2\n:type n2: ``int``\n"
249    def ("Brick", ripley::brick,  ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"
250        (arg("n0")=1, arg("n1")=1, arg("n2")=1,  ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"
251        arg("l0")=1.0, arg("l1")=1.0, arg("l2")=1.0,  ":param l2: length of side 2 or coordinate range of side 2\n:type l2: ``float`` or ``tuple``\n"
252        arg("optimize")=false)  ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
253          ,"Creates a rectangular mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2]."  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"
254          "\n\n:param n0:\n:type n0:\n:param n1:\n:type n1:\n:param n2:\n:type n2:\n"  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");
255          ":param l0: length of side 0\n:param l1:\n:param l2:\n"  
256          ":param optimize: Whether to optimize node labels\n:type optimize: ``bool``");      def("Rectangle", ripley::_rectangle, (arg("n0"),arg("n1"),arg("l0")=1.0,arg("l1")=1.0,arg("d0")=-1,arg("d1")=-1),
257    "Creates a rectangular mesh with n0 x n1 elements over the rectangle [0,l0] x [0,l1].\n\n"
258    def ("Rectangle", ripley::rectangle,  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
259        (arg("n0")=1, arg("n1")=1, arg("l0")=1.0, arg("l1")=1.0,  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
260        arg("optimize")=false)  ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"
261          ,"Creates a rectangular mesh with n0 x n1 elements over the rectangle [0,l0] x [0,l1]."  ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"
262          "\n\n:param n0:\n:type n0:\n:param n1:\n:type n1:\n"  ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
263          ":param l0: length of side 0\n:param l1:\n"  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``");
264          ":param optimize: Whether to optimize node labels\n:type optimize: ``bool``");      def("_theculprit_", ripley::_who);
265    
266    class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain> >      def("_readBinaryGrid", &ripley::readBinaryGrid, (arg("filename"), arg("functionspace"), arg("first"), arg("numValues"), arg("multiplier"), arg("shape"), arg("fill")=0.));
267        ("RipleyDomain","A concrete class representing a domain. For more details, please consult the c++ documentation.", no_init)  
268        .def(init<const ripley::RipleyDomain&>())      def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"), arg("functionspace"), arg("first"), arg("numValues"), arg("multiplier"), arg("shape"), arg("fill")=0.));
269        .def("write",&ripley::RipleyDomain::write,args("filename"),  
270  "Write the current mesh to a file with the given name.")      class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain>, boost::noncopyable >
271        .def("print_mesh_info",&ripley::RipleyDomain::Print_Mesh_Info,(arg("full")=false),          ("RipleyDomain", "", no_init)
272  ":param full:\n:type full: ``bool``")          .def("print_mesh_info", &ripley::RipleyDomain::Print_Mesh_Info, (arg("full")=false),
273        .def("dump",&ripley::RipleyDomain::dump,args("fileName")                  "Prints out a summary about the mesh.\n"
274  ,"dumps the mesh to a file with the given name.")                  ":param full: whether to output additional data\n:type full: ``bool``")
275        .def("getDescription",&ripley::RipleyDomain::getDescription,          .def("writeBinaryGrid", &ripley::RipleyDomain::writeBinaryGrid)
276    
277            .def("dump", &ripley::RipleyDomain::dump, args("filename"),
278                    "Dumps the mesh to a file with the given name.")
279            .def("getGridParameters", &ripley::RipleyDomain::getGridParameters,
280    "Returns the tuple (origin, spacing, elements) where the entries are tuples:\n"
281    "``origin``=the coordinates of the domain's global origin,\n"
282    "``spacing``=the element size (=node spacing) of the domain,\n"
283    "``elements``=the global number of elements in all dimensions\n\n"
284    ":rtype: ``tuple``")
285            .def("getDescription", &ripley::RipleyDomain::getDescription,
286  ":return: a description for this domain\n:rtype: ``string``")  ":return: a description for this domain\n:rtype: ``string``")
287        .def("getDim",&ripley::RipleyDomain::getDim,":rtype: ``int``")          .def("getDim", &ripley::RipleyDomain::getDim, ":rtype: ``int``")
288        .def("getDataShape",&ripley::RipleyDomain::getDataShape, args("functionSpaceCode"),          .def("getDataShape", &ripley::RipleyDomain::getDataShape, args("functionSpaceCode"),
289  ":return: a pair (dps, ns) where dps=the number of data points per sample, and ns=the number of samples\n:rtype: ``tuple``")  ":return: a pair (dps, ns) where dps=the number of data points per sample, and ns=the number of samples\n:rtype: ``tuple``")
290        .def("getNumDataPointsGlobal",&ripley::RipleyDomain::getNumDataPointsGlobal,          .def("getNumDataPointsGlobal", &ripley::RipleyDomain::getNumDataPointsGlobal,
291  ":return: the number of data points summed across all MPI processes\n"  ":return: the number of data points summed across all MPI processes\n"
292  ":rtype: ``int``")  ":rtype: ``int``")
293        .def("addPDEToSystem",&ripley::RipleyDomain::addPDEToSystem,          .def("addPDEToSystem",&ripley::RipleyDomain::addPDEToSystem,
294  args("mat", "rhs","A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),  args("mat", "rhs", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),
295  "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"
296  ":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"
297  ":param A:\n:type A: `Data`\n"  ":param A:\n:type A: `Data`\n"
# Line 111  args("mat", "rhs","A", "B", "C", "D", "X Line 302  args("mat", "rhs","A", "B", "C", "D", "X
302  ":param Y:\n:type Y: `Data`\n"  ":param Y:\n:type Y: `Data`\n"
303  ":param d:\n:type d: `Data`\n"  ":param d:\n:type d: `Data`\n"
304  ":param d_contact:\n:type d_contact: `Data`\n"  ":param d_contact:\n:type d_contact: `Data`\n"
305  ":param y_contact:\n:type y_contact: `Data`\n"  ":param y_contact:\n:type y_contact: `Data`"
 )  
       .def("addPDEToLumpedSystem",&ripley::RipleyDomain::addPDEToLumpedSystem,  
 args("mat", "D", "d"),  
 "adds a PDE onto the lumped stiffness matrix\n\n"  
 ":param mat:\n:type mat: `Data`\n"  
 ":param D:\n:type D: `Data`\n"  
 ":param d:\n:type d: `Data`\n"  
 ":param useHRZ:\n:type useHRZ: bool\n"  
306  )  )
307        .def("addPDEToRHS",&ripley::RipleyDomain::addPDEToRHS,          .def("addPDEToRHS",&ripley::RipleyDomain::addPDEToRHS,
308  args("rhs", "X", "Y", "y", "y_contact"),  args("rhs", "X", "Y", "y", "y_contact"),
309  "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"
310  ":param rhs:\n:type rhs: `Data`\n"  ":param rhs:\n:type rhs: `Data`\n"
# Line 130  args("rhs", "X", "Y", "y", "y_contact"), Line 313  args("rhs", "X", "Y", "y", "y_contact"),
313  ":param y:\n:type y: `Data`\n"  ":param y:\n:type y: `Data`\n"
314  ":param y_contact:\n:type y_contact: `Data`"  ":param y_contact:\n:type y_contact: `Data`"
315  )  )
316        .def("addPDEToTransportProblem",&ripley::RipleyDomain::addPDEToTransportProblem,          .def("addPDEToTransportProblem",&ripley::RipleyDomain::addPDEToTransportProblem,
317  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"),
318  ":param tp:\n:type tp: `TransportProblemAdapter`\n"  ":param tp:\n:type tp: `TransportProblemAdapter`\n"
319  ":param source:\n:type source: `Data`\n"  ":param source:\n:type source: `Data`\n"
# Line 144  args( "tp", "source", "M", "A", "B", "C" Line 327  args( "tp", "source", "M", "A", "B", "C"
327  ":param d:\n:type d: `Data`\n"  ":param d:\n:type d: `Data`\n"
328  ":param y:\n:type y: `Data`\n"  ":param y:\n:type y: `Data`\n"
329  ":param d_contact:\n:type d_contact: `Data`\n"  ":param d_contact:\n:type d_contact: `Data`\n"
330  ":param y_contact:\n:type y_contact: `Data`\n"  ":param y_contact:\n:type y_contact: `Data`"
331  )  )
332        .def("newOperator",&ripley::RipleyDomain::newSystemMatrix,          .def("newOperator",&ripley::RipleyDomain::newSystemMatrix,
333  args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),  args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),
334  "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"  "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"
335  ":param row_blocksize:\n:type row_blocksize: ``int``\n"  ":param row_blocksize:\n:type row_blocksize: ``int``\n"
336  ":param row_functionspace:\n:type row_functionspace: `FunctionSpace`\n"  ":param row_functionspace:\n:type row_functionspace: `FunctionSpace`\n"
337  ":param column_blocksize:\n:type column_blocksize: ``int``\n"  ":param column_blocksize:\n:type column_blocksize: ``int``\n"
338  ":param column_functionspace:\n:type column_functionspace: `FunctionSpace`\n"  ":param column_functionspace:\n:type column_functionspace: `FunctionSpace`\n"
339  ":param type:\n:type type: ``int``\n"  ":param type:\n:type type: ``int``"
340  )  )
341        .def("newTransportProblem",&ripley::RipleyDomain::newTransportProblem,          .def("newTransportProblem",&ripley::RipleyDomain::newTransportProblem,
342  args("theta", "blocksize", "functionspace", "type"),  args("theta", "blocksize", "functionspace", "type"),
343  "creates a TransportProblemAdapter\n\n"  "creates a TransportProblemAdapter\n\n"
344  ":param theta:\n:type theta: ``float``\n"  ":param theta:\n:type theta: ``float``\n"
345  ":param blocksize:\n:type blocksize: ``int``\n"  ":param blocksize:\n:type blocksize: ``int``\n"
346  ":param functionspace:\n:type functionspace: `FunctionSpace`\n"  ":param functionspace:\n:type functionspace: `FunctionSpace`\n"
347  ":param type:\n:type type: ``int``\n"  ":param type:\n:type type: ``int``"
348  )  )
349        .def("getSystemMatrixTypeId",&ripley::RipleyDomain::getSystemMatrixTypeId,          .def("getSystemMatrixTypeId",&ripley::RipleyDomain::getSystemMatrixTypeId,
350  args("solver", "preconditioner", "package", "symmetry"),  args("solver", "preconditioner", "package", "symmetry"),
351  ":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"
352  ":rtype: ``int``\n"  ":rtype: ``int``\n"
353  ":param solver:\n:type solver: ``int``\n"  ":param solver:\n:type solver: ``int``\n"
354  ":param preconditioner:\n:type preconditioner: ``int``\n"  ":param preconditioner:\n:type preconditioner: ``int``\n"
355  ":param package:\n:type package: ``int``\n"  ":param package:\n:type package: ``int``\n"
356  ":param symmetry:\n:type symmetry: ``int``\n"  ":param symmetry:\n:type symmetry: ``int``"
357  )  )
358        .def("getTransportTypeId",&ripley::RipleyDomain::getTransportTypeId,          .def("getTransportTypeId",&ripley::RipleyDomain::getTransportTypeId,
359  args("solver", "preconditioner", "package", "symmetry"),  args("solver", "preconditioner", "package", "symmetry"),
360  ":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"
361  ":rtype: ``int``\n"  ":rtype: ``int``\n"
362  ":param solver:\n:type solver: ``int``\n"  ":param solver:\n:type solver: ``int``\n"
363  ":param preconditioner:\n:type preconditioner: ``int``\n"  ":param preconditioner:\n:type preconditioner: ``int``\n"
364  ":param package:\n:type package: ``int``\n"  ":param package:\n:type package: ``int``\n"
365  ":param symmetry:\n:type symmetry: ``int``\n"  ":param symmetry:\n:type symmetry: ``int``"
366  )  )
367        .def("setX",&ripley::RipleyDomain::setNewX,          .def("getX",&ripley::RipleyDomain::getX, ":return: locations in the FEM nodes\n\n"
 args("arg"), "assigns new location to the domain\n\n:param arg:\n:type arg: `Data`")  
       .def("getX",&ripley::RipleyDomain::getX, ":return: locations in the FEM nodes\n\n"  
368  ":rtype: `Data`")  ":rtype: `Data`")
369        .def("getNormal",&ripley::RipleyDomain::getNormal,          .def("getNormal",&ripley::RipleyDomain::getNormal,
370  ":return: boundary normals at the quadrature point on the face elements\n"  ":return: boundary normals at the quadrature point on the face elements\n"
371  ":rtype: `Data`")  ":rtype: `Data`")
372        .def("getSize",&ripley::RipleyDomain::getSize,":return: the element size\n"          .def("getSize",&ripley::RipleyDomain::getSize,":return: the element size\n"
373  ":rtype: `Data`")  ":rtype: `Data`")
374        .def("setTagMap",&ripley::RipleyDomain::setTagMap,args("name","tag"),          .def("setTagMap",&ripley::RipleyDomain::setTagMap,args("name","tag"),
375  "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"
376  ":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")
377        .def("getTag",&ripley::RipleyDomain::getTag,args("name"),":return: tag id for "          .def("getTag",&ripley::RipleyDomain::getTag,args("name"),":return: tag id for "
378  "``name``\n:rtype: ``string``")  "``name``\n:rtype: ``string``")
379        .def("isValidTagName",&ripley::RipleyDomain::isValidTagName,args("name"),          .def("isValidTagName",&ripley::RipleyDomain::isValidTagName,args("name"),
380  ":return: True is ``name`` corresponds to a tag\n:rtype: ``bool``")  ":return: True if ``name`` corresponds to a tag, otherwise False\n:rtype: ``bool``")
381        .def("showTagNames",&ripley::RipleyDomain::showTagNames,":return: A space separated list of tag names\n:rtype: ``string``")          .def("showTagNames",&ripley::RipleyDomain::showTagNames,":return: A space separated list of tag names\n:rtype: ``string``")
382        .def("getMPISize",&ripley::RipleyDomain::getMPISize,":return: the number of processes used for this `Domain`\n:rtype: ``int``")          .def("getMPISize",&ripley::RipleyDomain::getMPISize,":return: the number of processes used for this `Domain`\n:rtype: ``int``")
383        .def("getMPIRank",&ripley::RipleyDomain::getMPIRank,":return: the rank of this process\n:rtype: ``int``")          .def("getMPIRank",&ripley::RipleyDomain::getMPIRank,":return: the rank of this process\n:rtype: ``int``")
384        .def("MPIBarrier",&ripley::RipleyDomain::MPIBarrier,"Wait until all processes have reached this point")          .def("MPIBarrier",&ripley::RipleyDomain::MPIBarrier,"Wait until all processes have reached this point")
385        .def("onMasterProcessor",&ripley::RipleyDomain::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");          .def("onMasterProcessor",&ripley::RipleyDomain::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");
386    
387    class_<ripley::SystemMatrixAdapter, bases<escript::AbstractSystemMatrix> >      class_<ripley::Brick, bases<ripley::RipleyDomain> >("RipleyBrick", "", no_init);
388        ("OperatorAdapter","A concrete class representing an operator. For more details, please see the c++ documentation.", no_init)      class_<ripley::Rectangle, bases<ripley::RipleyDomain> >("RipleyRectangle", "", no_init);
       .def("print_matrix_info",&ripley::SystemMatrixAdapter::Print_Matrix_Info,(arg("full")=false),"prints information about a system matrix")  
       .def("nullifyRowsAndCols",&ripley::SystemMatrixAdapter::nullifyRowsAndCols)  
       .def("resetValues",&ripley::SystemMatrixAdapter::resetValues, "resets the matrix entries")  
       .def("saveMM",&ripley::SystemMatrixAdapter::saveMM,args("fileName"),  
 "writes the matrix to a file using the Matrix Market file format")  
       .def("saveHB",&ripley::SystemMatrixAdapter::saveHB, args("filename"),  
 "writes the matrix to a file using the Harwell-Boeing file format");  
   
   class_<ripley::TransportProblemAdapter, bases<escript::AbstractTransportProblem> >  
       ("TransportProblemAdapter","",no_init)  
       .def("getSafeTimeStepSize",&ripley::TransportProblemAdapter::getSafeTimeStepSize)  
       .def("getUnlimitedTimeStepSize",&ripley::TransportProblemAdapter::getUnlimitedTimeStepSize)  
       .def("resetTransport",&ripley::TransportProblemAdapter::resetTransport,  
 "resets the transport operator typically as they have been updated");  
389  }  }
390    

Legend:
Removed from v.3670  
changed lines
  Added in v.4357

  ViewVC Help
Powered by ViewVC 1.1.26