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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4821 - (hide annotations)
Tue Apr 1 04:58:33 2014 UTC (5 years, 5 months ago) by sshaw
File size: 23534 byte(s)
moved SolverOptions to c++, split into SolverOptions for the options and SolverBuddy as the state as a precursor to per-pde solving... does break some use cases (e.g. pde.getSolverOptions().DIRECT will now fail, new value access is with SolverOptions.DIRECT), examples and documentation updated to match
1 caltinay 3670
2 jfenwick 3981 /*****************************************************************************
3 caltinay 3670 *
4 jfenwick 4657 * Copyright (c) 2003-2014 by University of Queensland
5 jfenwick 3981 * http://www.uq.edu.au
6 caltinay 3670 *
7     * Primary Business: Queensland, Australia
8     * Licensed under the Open Software License version 3.0
9     * http://www.opensource.org/licenses/osl-3.0.php
10     *
11 jfenwick 3981 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 jfenwick 4657 * Development 2012-2013 by School of Earth Sciences
13     * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 jfenwick 3981 *
15     *****************************************************************************/
16 caltinay 3670
17 caltinay 3691 #include <ripley/Brick.h>
18     #include <ripley/Rectangle.h>
19 caltinay 3670 #include <esysUtils/esysExceptionTranslator.h>
20    
21     #include <boost/python.hpp>
22     #include <boost/python/module.hpp>
23     #include <boost/python/def.hpp>
24     #include <boost/python/detail/defaults_gen.hpp>
25     #include <boost/version.hpp>
26    
27     using namespace boost::python;
28    
29 caltinay 3691 namespace ripley {
30 caltinay 3670
31 caltinay 4616 template<typename T>
32     std::vector<T> extractPyArray(const object& obj, const std::string& name,
33     int expectedLength=0)
34     {
35     std::vector<T> result;
36     if (extract<tuple>(obj).check() || extract<list>(obj).check()) {
37     if (expectedLength==0 || len(obj)==expectedLength) {
38     for (int i=0; i<len(obj); i++) {
39     result.push_back(extract<T>(obj[i]));
40     }
41     } else {
42     std::stringstream ssError;
43     ssError << "argument '" << name << "' has wrong length";
44     std::string error(ssError.str());
45     throw RipleyException(error.c_str());
46     }
47     } else {
48     std::stringstream ssError;
49     ssError << "argument '" << name << "' must be a tuple or list";
50     std::string error(ssError.str());
51     throw RipleyException(error.c_str());
52     }
53    
54     return result;
55     }
56    
57 caltinay 3971 escript::Data readBinaryGrid(std::string filename, escript::FunctionSpace fs,
58 caltinay 4616 const object& pyShape, double fill, int byteOrder, int dataType,
59 caltinay 4277 const object& pyFirst, const object& pyNum, const object& pyMultiplier,
60 caltinay 4616 const object& pyReverse)
61 caltinay 3971 {
62     int dim=fs.getDim();
63 caltinay 4618 ReaderParameters params;
64 caltinay 3971
65 caltinay 4616 params.first = extractPyArray<int>(pyFirst, "first", dim);
66     params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
67     params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
68     params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
69     params.byteOrder = byteOrder;
70     params.dataType = dataType;
71     std::vector<int> shape(extractPyArray<int>(pyShape, "shape"));
72 caltinay 3971
73     const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
74     if (!dom)
75     throw RipleyException("Function space must be on a ripley domain");
76    
77     escript::Data res(fill, shape, fs, true);
78 caltinay 4615 dom->readBinaryGrid(res, filename, params);
79 caltinay 3971 return res;
80     }
81    
82 sshaw 4738 #ifdef USE_BOOSTIO
83     escript::Data readBinaryGridFromZipped(std::string filename, escript::FunctionSpace fs,
84     const object& pyShape, double fill, int byteOrder, int dataType,
85     const object& pyFirst, const object& pyNum, const object& pyMultiplier,
86     const object& pyReverse)
87     {
88     int dim=fs.getDim();
89     ReaderParameters params;
90    
91     params.first = extractPyArray<int>(pyFirst, "first", dim);
92     params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
93     params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
94     params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
95     params.byteOrder = byteOrder;
96     params.dataType = dataType;
97     std::vector<int> shape(extractPyArray<int>(pyShape, "shape"));
98    
99     const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
100     if (!dom)
101     throw RipleyException("Function space must be on a ripley domain");
102    
103     escript::Data res(fill, shape, fs, true);
104     dom->readBinaryGridFromZipped(res, filename, params);
105     return res;
106     }
107     #endif
108    
109 caltinay 4013 escript::Data readNcGrid(std::string filename, std::string varname,
110 caltinay 4616 escript::FunctionSpace fs, const object& pyShape, double fill,
111     const object& pyFirst, const object& pyNum, const object& pyMultiplier,
112     const object& pyReverse)
113 caltinay 4013 {
114     int dim=fs.getDim();
115 caltinay 4618 ReaderParameters params;
116 caltinay 4013
117 caltinay 4616 params.first = extractPyArray<int>(pyFirst, "first", dim);
118     params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
119     params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
120     params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
121     std::vector<int> shape(extractPyArray<int>(pyShape, "shape"));
122 caltinay 4013
123     const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
124     if (!dom)
125     throw RipleyException("Function space must be on a ripley domain");
126    
127     escript::Data res(fill, shape, fs, true);
128 caltinay 4615 dom->readNcGrid(res, filename, varname, params);
129 caltinay 4013 return res;
130     }
131    
132 caltinay 3691 // These wrappers are required to make the shared pointers work through the
133     // Python wrapper
134 caltinay 3670
135 jfenwick 3892 // The double for n? is just to keep python happy when people need to deal with
136 caltinay 3971 // truediv
137 jfenwick 3892 escript::Domain_ptr _brick(double _n0, double _n1, double _n2, const object& l0,
138 sshaw 4622 const object& l1, const object& l2, int d0, int d1, int d2,
139     const object& objpoints, const object& objtags)
140 caltinay 3691 {
141 jfenwick 3892 int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1), n2=static_cast<int>(_n2);
142 caltinay 3781 double x0=0., x1=1., y0=0., y1=1., z0=0., z1=1.;
143     if (extract<tuple>(l0).check()) {
144     tuple x=extract<tuple>(l0);
145     if (len(x)==2) {
146     x0=extract<double>(x[0]);
147     x1=extract<double>(x[1]);
148     } else
149     throw RipleyException("Argument l0 must be a float or 2-tuple");
150     } else if (extract<double>(l0).check()) {
151     x1=extract<double>(l0);
152     } else
153     throw RipleyException("Argument l0 must be a float or 2-tuple");
154    
155     if (extract<tuple>(l1).check()) {
156     tuple y=extract<tuple>(l1);
157     if (len(y)==2) {
158     y0=extract<double>(y[0]);
159     y1=extract<double>(y[1]);
160     } else
161     throw RipleyException("Argument l1 must be a float or 2-tuple");
162     } else if (extract<double>(l1).check()) {
163     y1=extract<double>(l1);
164     } else
165     throw RipleyException("Argument l1 must be a float or 2-tuple");
166    
167     if (extract<tuple>(l2).check()) {
168     tuple z=extract<tuple>(l2);
169     if (len(z)==2) {
170     z0=extract<double>(z[0]);
171     z1=extract<double>(z[1]);
172     } else
173     throw RipleyException("Argument l2 must be a float or 2-tuple");
174     } else if (extract<double>(l2).check()) {
175     z1=extract<double>(l2);
176     } else
177     throw RipleyException("Argument l2 must be a float or 2-tuple");
178    
179 sshaw 4622 boost::python::list pypoints=extract<boost::python::list>(objpoints);
180     boost::python::list pytags=extract<boost::python::list>(objtags);
181     int numpts=extract<int>(pypoints.attr("__len__")());
182     int numtags=extract<int>(pytags.attr("__len__")());
183     std::vector<double> points;
184     std::vector<int> tags;
185     tags.resize(numtags, -1);
186     for (int i=0;i<numpts;++i) {
187     boost::python::object temp=pypoints[i];
188     int l=extract<int>(temp.attr("__len__")());
189     for (int k=0;k<l;++k) {
190     points.push_back(extract<double>(temp[k]));
191     }
192     }
193     std::map<std::string, int> tagstonames;
194     int curmax=40;
195     // but which order to assign tags to names?????
196     for (int i=0;i<numtags;++i) {
197     extract<int> ex_int(pytags[i]);
198     extract<std::string> ex_str(pytags[i]);
199     if (ex_int.check()) {
200     tags[i]=ex_int();
201     if (tags[i]>= curmax) {
202     curmax=tags[i]+1;
203     }
204     } else if (ex_str.check()) {
205     std::string s=ex_str();
206     std::map<std::string, int>::iterator it=tagstonames.find(s);
207     if (it!=tagstonames.end()) {
208     // we have the tag already so look it up
209     tags[i]=it->second;
210     } else {
211     tagstonames[s]=curmax;
212     tags[i]=curmax;
213     curmax++;
214     }
215     } else {
216     throw RipleyException("Error - Unable to extract tag value.");
217     }
218     }
219     return escript::Domain_ptr(new Brick(n0,n1,n2, x0,y0,z0, x1,y1,z1, d0,d1,d2,
220     points, tags, tagstonames));
221 caltinay 3691 }
222 caltinay 3670
223 jfenwick 4779 //const int _q[]={0x61686969,0x746c4144,0x79616e43};
224     const int _q[]={0x62207363, 0x6574735F, 0x2020214e};
225 jfenwick 3892 escript::Domain_ptr _rectangle(double _n0, double _n1, const object& l0,
226 sshaw 4622 const object& l1, int d0, int d1,
227     const object& objpoints, const object& objtags)
228 caltinay 3691 {
229 jfenwick 3892 int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1);
230 caltinay 3781 double x0=0., x1=1., y0=0., y1=1.;
231     if (extract<tuple>(l0).check()) {
232     tuple x=extract<tuple>(l0);
233     if (len(x)==2) {
234     x0=extract<double>(x[0]);
235     x1=extract<double>(x[1]);
236     } else
237     throw RipleyException("Argument l0 must be a float or 2-tuple");
238     } else if (extract<double>(l0).check()) {
239     x1=extract<double>(l0);
240     } else
241     throw RipleyException("Argument l0 must be a float or 2-tuple");
242    
243     if (extract<tuple>(l1).check()) {
244     tuple y=extract<tuple>(l1);
245     if (len(y)==2) {
246     y0=extract<double>(y[0]);
247     y1=extract<double>(y[1]);
248     } else
249     throw RipleyException("Argument l1 must be a float or 2-tuple");
250     } else if (extract<double>(l1).check()) {
251     y1=extract<double>(l1);
252     } else
253     throw RipleyException("Argument l1 must be a float or 2-tuple");
254 sshaw 4622
255     boost::python::list pypoints=extract<boost::python::list>(objpoints);
256     boost::python::list pytags=extract<boost::python::list>(objtags);
257     int numpts=extract<int>(pypoints.attr("__len__")());
258     int numtags=extract<int>(pytags.attr("__len__")());
259     std::vector<double> points;
260     std::vector<int> tags;
261     tags.resize(numtags, -1);
262     for (int i=0;i<numpts;++i) {
263     boost::python::object temp=pypoints[i];
264     int l=extract<int>(temp.attr("__len__")());
265     for (int k=0;k<l;++k) {
266     points.push_back(extract<double>(temp[k]));
267     }
268     }
269     std::map<std::string, int> tagstonames;
270     int curmax=40;
271     // but which order to assign tags to names?????
272     for (int i=0;i<numtags;++i) {
273     extract<int> ex_int(pytags[i]);
274     extract<std::string> ex_str(pytags[i]);
275     if (ex_int.check()) {
276     tags[i]=ex_int();
277     if (tags[i]>= curmax) {
278     curmax=tags[i]+1;
279     }
280     } else if (ex_str.check()) {
281     std::string s=ex_str();
282     std::map<std::string, int>::iterator it=tagstonames.find(s);
283     if (it!=tagstonames.end()) {
284     // we have the tag already so look it up
285     tags[i]=it->second;
286     } else {
287     tagstonames[s]=curmax;
288     tags[i]=curmax;
289     curmax++;
290     }
291     } else {
292     throw RipleyException("Error - Unable to extract tag value.");
293     }
294     }
295     return escript::Domain_ptr(new Rectangle(n0,n1, x0,y0, x1,y1, d0,d1,
296     points, tags, tagstonames));
297 caltinay 3691 }
298 caltinay 3791 std::string _who(){int a[]={_q[0]^42,_q[1]^42,_q[2]^42,0};return (char*)&a[0];}
299 caltinay 3670
300 caltinay 4357 } // end of namespace ripley
301 caltinay 3670
302    
303     BOOST_PYTHON_MODULE(ripleycpp)
304     {
305     // This feature was added in boost v1.34
306     #if ((BOOST_VERSION/100)%1000 > 34) || (BOOST_VERSION/100000 >1)
307 caltinay 3691 // params are: bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures
308     docstring_options docopt(true, true, false);
309 caltinay 3670 #endif
310    
311 sshaw 4821 register_exception_translator<ripley::RipleyException>(&(esysUtils::RuntimeErrorTranslator));
312 caltinay 3670
313 caltinay 4174 scope().attr("__doc__") = "To use this module, please import esys.ripley";
314 caltinay 4357 scope().attr("BYTEORDER_NATIVE") = (int)ripley::BYTEORDER_NATIVE;
315     scope().attr("BYTEORDER_LITTLE_ENDIAN") = (int)ripley::BYTEORDER_LITTLE_ENDIAN;
316     scope().attr("BYTEORDER_BIG_ENDIAN") = (int)ripley::BYTEORDER_BIG_ENDIAN;
317     scope().attr("DATATYPE_INT32") = (int)ripley::DATATYPE_INT32;
318     scope().attr("DATATYPE_FLOAT32") = (int)ripley::DATATYPE_FLOAT32;
319     scope().attr("DATATYPE_FLOAT64") = (int)ripley::DATATYPE_FLOAT64;
320 caltinay 4174
321 sshaw 4622 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,arg("diracPoints")=list(),arg("diracTags")=list()),
322 caltinay 3691 "Creates a hexagonal mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2].\n\n"
323     ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
324     ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
325     ":param n2: number of elements in direction 2\n:type n2: ``int``\n"
326 caltinay 3781 ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"
327     ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"
328     ":param l2: length of side 2 or coordinate range of side 2\n:type l2: ``float`` or ``tuple``\n"
329 caltinay 3691 ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
330     ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"
331     ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");
332 caltinay 3670
333 sshaw 4622 def("Rectangle", ripley::_rectangle, (arg("n0"),arg("n1"),arg("l0")=1.0,arg("l1")=1.0,arg("d0")=-1,arg("d1")=-1,arg("diracPoints")=list(),arg("diracTags")=list()),
334 caltinay 3691 "Creates a rectangular mesh with n0 x n1 elements over the rectangle [0,l0] x [0,l1].\n\n"
335     ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
336     ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
337 caltinay 3781 ":param l0: length of side 0 or coordinate range of side 0\n:type l0: ``float`` or ``tuple``\n"
338     ":param l1: length of side 1 or coordinate range of side 1\n:type l1: ``float`` or ``tuple``\n"
339 caltinay 3691 ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
340     ":param d1: number of subdivisions in direction 1\n:type d1: ``int``");
341 caltinay 3971 def("_theculprit_", ripley::_who);
342 caltinay 3670
343 caltinay 4616 def("_readBinaryGrid", &ripley::readBinaryGrid, (arg("filename"),
344     arg("functionspace"), arg("shape"), arg("fill")=0.,
345     arg("byteOrder"), arg("dataType"), arg("first"),
346     arg("numValues"), arg("multiplier"), arg("reverse")),
347     "Reads a binary Grid");
348 sshaw 4738 #ifdef USE_BOOSTIO
349     def("_readBinaryGridFromZipped", &ripley::readBinaryGridFromZipped, (arg("filename"),
350     arg("functionspace"), arg("shape"), arg("fill")=0.,
351     arg("byteOrder"), arg("dataType"), arg("first"),
352     arg("numValues"), arg("multiplier"), arg("reverse")),
353     "Reads a binary Grid");
354     #endif
355 caltinay 4616 def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"),
356     arg("functionspace"), arg("shape"), arg("fill"), arg("first"),
357     arg("numValues"), arg("multiplier"), arg("reverse")),
358     "Reads a grid from a netCDF file");
359 caltinay 4013
360 jfenwick 4242 class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain>, boost::noncopyable >
361 caltinay 3691 ("RipleyDomain", "", no_init)
362     .def("print_mesh_info", &ripley::RipleyDomain::Print_Mesh_Info, (arg("full")=false),
363     "Prints out a summary about the mesh.\n"
364     ":param full: whether to output additional data\n:type full: ``bool``")
365 caltinay 4357 .def("writeBinaryGrid", &ripley::RipleyDomain::writeBinaryGrid)
366    
367 caltinay 3691 .def("dump", &ripley::RipleyDomain::dump, args("filename"),
368     "Dumps the mesh to a file with the given name.")
369 caltinay 4340 .def("getGridParameters", &ripley::RipleyDomain::getGridParameters,
370     "Returns the tuple (origin, spacing, elements) where the entries are tuples:\n"
371     "``origin``=the coordinates of the domain's global origin,\n"
372     "``spacing``=the element size (=node spacing) of the domain,\n"
373     "``elements``=the global number of elements in all dimensions\n\n"
374     ":rtype: ``tuple``")
375 caltinay 3691 .def("getDescription", &ripley::RipleyDomain::getDescription,
376 caltinay 3670 ":return: a description for this domain\n:rtype: ``string``")
377 caltinay 3691 .def("getDim", &ripley::RipleyDomain::getDim, ":rtype: ``int``")
378     .def("getDataShape", &ripley::RipleyDomain::getDataShape, args("functionSpaceCode"),
379 caltinay 3670 ":return: a pair (dps, ns) where dps=the number of data points per sample, and ns=the number of samples\n:rtype: ``tuple``")
380 caltinay 3691 .def("getNumDataPointsGlobal", &ripley::RipleyDomain::getNumDataPointsGlobal,
381 caltinay 3670 ":return: the number of data points summed across all MPI processes\n"
382     ":rtype: ``int``")
383 sshaw 4622 .def("addToSystem",&ripley::RipleyDomain::addToSystemFromPython,
384     args("mat", "rhs", "data"),
385     "adds a PDE to the system, results depend on domain\n\n"
386     ":param mat:\n:type mat: `OperatorAdapter`\n"
387     ":param rhs:\n:type rhs: `Data`\n"
388     ":param data:\ntype data: `list`")
389 caltinay 3691 .def("addPDEToSystem",&ripley::RipleyDomain::addPDEToSystem,
390     args("mat", "rhs", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),
391 caltinay 3670 "adds a PDE onto the stiffness matrix mat and a rhs\n\n"
392     ":param mat:\n:type mat: `OperatorAdapter`\n:param rhs:\n:type rhs: `Data`\n"
393     ":param A:\n:type A: `Data`\n"
394     ":param B:\n:type B: `Data`\n"
395     ":param C:\n:type C: `Data`\n"
396     ":param D:\n:type D: `Data`\n"
397     ":param X:\n:type X: `Data`\n"
398     ":param Y:\n:type Y: `Data`\n"
399     ":param d:\n:type d: `Data`\n"
400     ":param d_contact:\n:type d_contact: `Data`\n"
401 caltinay 3791 ":param y_contact:\n:type y_contact: `Data`"
402 caltinay 3670 )
403 sshaw 4622
404 caltinay 3691 .def("addPDEToRHS",&ripley::RipleyDomain::addPDEToRHS,
405 caltinay 3670 args("rhs", "X", "Y", "y", "y_contact"),
406     "adds a PDE onto the stiffness matrix mat and a rhs\n\n"
407     ":param rhs:\n:type rhs: `Data`\n"
408     ":param X:\n:type X: `Data`\n"
409     ":param Y:\n:type Y: `Data`\n"
410     ":param y:\n:type y: `Data`\n"
411     ":param y_contact:\n:type y_contact: `Data`"
412     )
413 sshaw 4622 .def("addToRHS",&ripley::RipleyDomain::addToRHSFromPython,
414     args("rhs", "data"),
415     "adds a PDE onto the stiffness matrix mat and a rhs, "
416     "results depends on domain\n\n"
417     ":param rhs:\n:type rhs: `Data`\n"
418     ":param data:\ntype data: `list`")
419     .def("setAssembler", &ripley::RipleyDomain::setAssemblerFromPython,
420     args("typename", "options"),
421     "sets the domain to use the named assembler, if supported, using"
422     "the options if provided"
423     ":param typename:\n:type typename: `string`\n"
424     ":param options:\n:type options: `list`\n")
425 caltinay 3691 .def("addPDEToTransportProblem",&ripley::RipleyDomain::addPDEToTransportProblem,
426 caltinay 3670 args( "tp", "source", "M", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),
427     ":param tp:\n:type tp: `TransportProblemAdapter`\n"
428     ":param source:\n:type source: `Data`\n"
429     ":param M:\n:type M: `Data`\n"
430     ":param A:\n:type A: `Data`\n"
431     ":param B:\n:type B: `Data`\n"
432     ":param C:\n:type C: `Data`\n"
433     ":param D:\n:type D: `Data`\n"
434     ":param X:\n:type X: `Data`\n"
435     ":param Y:\n:type Y: `Data`\n"
436     ":param d:\n:type d: `Data`\n"
437     ":param y:\n:type y: `Data`\n"
438     ":param d_contact:\n:type d_contact: `Data`\n"
439 caltinay 3791 ":param y_contact:\n:type y_contact: `Data`"
440 caltinay 3670 )
441 caltinay 3691 .def("newOperator",&ripley::RipleyDomain::newSystemMatrix,
442 caltinay 3670 args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),
443     "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"
444     ":param row_blocksize:\n:type row_blocksize: ``int``\n"
445     ":param row_functionspace:\n:type row_functionspace: `FunctionSpace`\n"
446     ":param column_blocksize:\n:type column_blocksize: ``int``\n"
447     ":param column_functionspace:\n:type column_functionspace: `FunctionSpace`\n"
448 caltinay 3791 ":param type:\n:type type: ``int``"
449 caltinay 3670 )
450 caltinay 3691 .def("newTransportProblem",&ripley::RipleyDomain::newTransportProblem,
451 caltinay 3670 args("theta", "blocksize", "functionspace", "type"),
452     "creates a TransportProblemAdapter\n\n"
453     ":param theta:\n:type theta: ``float``\n"
454     ":param blocksize:\n:type blocksize: ``int``\n"
455     ":param functionspace:\n:type functionspace: `FunctionSpace`\n"
456 caltinay 3791 ":param type:\n:type type: ``int``"
457 caltinay 3670 )
458 caltinay 3691 .def("getSystemMatrixTypeId",&ripley::RipleyDomain::getSystemMatrixTypeId,
459 caltinay 3670 args("solver", "preconditioner", "package", "symmetry"),
460 caltinay 3697 ":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"
461 caltinay 3670 ":rtype: ``int``\n"
462     ":param solver:\n:type solver: ``int``\n"
463     ":param preconditioner:\n:type preconditioner: ``int``\n"
464     ":param package:\n:type package: ``int``\n"
465 caltinay 3791 ":param symmetry:\n:type symmetry: ``int``"
466 caltinay 3670 )
467 caltinay 3691 .def("getTransportTypeId",&ripley::RipleyDomain::getTransportTypeId,
468 caltinay 3670 args("solver", "preconditioner", "package", "symmetry"),
469 caltinay 3697 ":return: the identifier of the transport problem type to be used when a particular solver, preconditioner, package and symmetric matrix is used.\n"
470 caltinay 3670 ":rtype: ``int``\n"
471     ":param solver:\n:type solver: ``int``\n"
472     ":param preconditioner:\n:type preconditioner: ``int``\n"
473     ":param package:\n:type package: ``int``\n"
474 caltinay 3791 ":param symmetry:\n:type symmetry: ``int``"
475 caltinay 3670 )
476 caltinay 3691 .def("getX",&ripley::RipleyDomain::getX, ":return: locations in the FEM nodes\n\n"
477 caltinay 3670 ":rtype: `Data`")
478 caltinay 3691 .def("getNormal",&ripley::RipleyDomain::getNormal,
479 caltinay 3670 ":return: boundary normals at the quadrature point on the face elements\n"
480     ":rtype: `Data`")
481 caltinay 3691 .def("getSize",&ripley::RipleyDomain::getSize,":return: the element size\n"
482 caltinay 3670 ":rtype: `Data`")
483 caltinay 3691 .def("setTagMap",&ripley::RipleyDomain::setTagMap,args("name","tag"),
484 caltinay 3670 "Give a tag number a name.\n\n:param name: Name for the tag\n:type name: ``string``\n"
485     ":param tag: numeric id\n:type tag: ``int``\n:note: Tag names must be unique within a domain")
486 caltinay 3691 .def("getTag",&ripley::RipleyDomain::getTag,args("name"),":return: tag id for "
487 caltinay 3670 "``name``\n:rtype: ``string``")
488 caltinay 3691 .def("isValidTagName",&ripley::RipleyDomain::isValidTagName,args("name"),
489     ":return: True if ``name`` corresponds to a tag, otherwise False\n:rtype: ``bool``")
490     .def("showTagNames",&ripley::RipleyDomain::showTagNames,":return: A space separated list of tag names\n:rtype: ``string``")
491     .def("getMPISize",&ripley::RipleyDomain::getMPISize,":return: the number of processes used for this `Domain`\n:rtype: ``int``")
492     .def("getMPIRank",&ripley::RipleyDomain::getMPIRank,":return: the rank of this process\n:rtype: ``int``")
493     .def("MPIBarrier",&ripley::RipleyDomain::MPIBarrier,"Wait until all processes have reached this point")
494     .def("onMasterProcessor",&ripley::RipleyDomain::onMasterProcessor,":return: True if this code is executing on the master process\n:rtype: `bool`");
495 caltinay 3670
496 jfenwick 4687 class_<ripley::Brick, bases<ripley::RipleyDomain> >("RipleyBrick", "", no_init);
497     /*
498 jfenwick 4650 .def("randomFill", &ripley::Brick::randomFill,":return: random data\n:rtype: `Data`\n:param seed: pass zero to use system generated seed\n:type seed: `int`\n"
499     ":param details: more info about the type of randomness\nCurrently, the only acceptable value for this tuple is ('gaussian', r, s) where r is the radius of the"
500     "guassian blur and s is the sigma parameter."
501     );
502 jfenwick 4687 */
503     class_<ripley::Rectangle, bases<ripley::RipleyDomain> >("RipleyRectangle", "", no_init);
504     /*
505 jfenwick 4586 .def("randomFill", &ripley::Rectangle::randomFill,":return: random data\n:rtype: `Data`\n:param seed: pass zero to use system generated seed\n:type seed: `int`\n"
506     ":param details: more info about the type of randomness\nCurrently, the only acceptable value for this tuple is ('gaussian', r, s) where r is the radius of the"
507     "guassian blur and s is the sigma parameter."
508     );
509 jfenwick 4687 */
510 caltinay 3670 }
511    

  ViewVC Help
Powered by ViewVC 1.1.26