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

revision 3991 by caltinay, Tue Sep 25 23:52:22 2012 UTC revision 5148 by caltinay, Mon Sep 15 01:25:23 2014 UTC
# Line 1  Line 1 
1    
2  /*****************************************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2012 by University of Queensland  * Copyright (c) 2003-2014 by University of Queensland
5  * http://www.uq.edu.au  * http://www.uq.edu.au
6  *  *
7  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
# Line 9  Line 9 
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)  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12  * Development since 2012 by School of Earth Sciences  * Development 2012-2013 by School of Earth Sciences
13    * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
17    #include <ripley/AbstractAssembler.h>
18  #include <ripley/Brick.h>  #include <ripley/Brick.h>
19  #include <ripley/Rectangle.h>  #include <ripley/Rectangle.h>
20  #include <esysUtils/esysExceptionTranslator.h>  #include <esysUtils/esysExceptionTranslator.h>
21    
22  #include <boost/python.hpp>  #include <boost/python.hpp>
23  #include <boost/python/module.hpp>  #include <boost/python/module.hpp>
24  #include <boost/python/def.hpp>  #include <boost/python/def.hpp>
25  #include <boost/python/detail/defaults_gen.hpp>  #include <boost/python/detail/defaults_gen.hpp>
26  #include <boost/version.hpp>  #include <boost/version.hpp>
27    
28    #include "escript/SubWorld.h"
29    
30  using namespace boost::python;  using namespace boost::python;
31    
32  namespace ripley {  namespace ripley {
33    
34    template<typename T>
35    std::vector<T> extractPyArray(const object& obj, const std::string& name,
36                                  int expectedLength=0)
37    {
38        std::vector<T> result;
39        if (extract<tuple>(obj).check() || extract<list>(obj).check()) {
40            if (expectedLength==0 || len(obj)==expectedLength) {
41                for (int i=0; i<len(obj); i++) {
42                    result.push_back(extract<T>(obj[i]));
43                }
44            } else {
45                std::stringstream ssError;
46                ssError << "argument '" << name << "' has wrong length";
47                std::string error(ssError.str());
48                throw RipleyException(error.c_str());
49            }
50        } else {
51            std::stringstream ssError;
52            ssError << "argument '" << name << "' must be a tuple or list";
53            std::string error(ssError.str());
54            throw RipleyException(error.c_str());
55        }
56    
57        return result;
58    }
59    
60  escript::Data readBinaryGrid(std::string filename, escript::FunctionSpace fs,  escript::Data readBinaryGrid(std::string filename, escript::FunctionSpace fs,
61          const object& pyFirst, const object& pyNum, const object& pyShape,          const object& pyShape, double fill, int byteOrder, int dataType,
62          double fill=0.)          const object& pyFirst, const object& pyNum, const object& pyMultiplier,
63            const object& pyReverse)
64  {  {
65      int dim=fs.getDim();      int dim=fs.getDim();
66      std::vector<int> first(dim), numValues(dim), shape;      ReaderParameters params;
67    
68      if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {      params.first = extractPyArray<int>(pyFirst, "first", dim);
69          if (len(pyFirst)==dim) {      params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
70              for (int i=0; i<dim; i++) {      params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
71                  first[i]=extract<int>(pyFirst[i]);      params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
72              }      params.byteOrder = byteOrder;
73          } else      params.dataType = dataType;
74              throw RipleyException("Argument 'first' has wrong length");      std::vector<int> shape(extractPyArray<int>(pyShape, "shape"));
     } else  
         throw RipleyException("Argument 'first' must be a tuple or list");  
75    
76      if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {      const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
77          if (len(pyNum)==dim) {      if (!dom)
78              for (int i=0; i<dim; i++) {          throw RipleyException("Function space must be on a ripley domain");
                 numValues[i]=extract<int>(pyNum[i]);  
             }  
         } else  
             throw RipleyException("Argument 'numValues' has wrong length");  
     } else  
         throw RipleyException("Argument 'numValues' must be a tuple or list");  
79    
80      if (extract<tuple>(pyShape).check() || extract<list>(pyShape).check()) {      escript::Data res(fill, shape, fs, true);
81          for (int i=0; i<len(pyShape); i++) {      dom->readBinaryGrid(res, filename, params);
82              shape.push_back(extract<int>(pyShape[i]));      return res;
83          }  }
84      } else  
85          throw RipleyException("Argument 'shape' must be a tuple or list");  #ifdef USE_BOOSTIO
86    escript::Data readBinaryGridFromZipped(std::string filename, escript::FunctionSpace fs,
87            const object& pyShape, double fill, int byteOrder, int dataType,
88            const object& pyFirst, const object& pyNum, const object& pyMultiplier,
89            const object& pyReverse)
90    {
91        int dim=fs.getDim();
92        ReaderParameters params;
93    
94        params.first = extractPyArray<int>(pyFirst, "first", dim);
95        params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
96        params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
97        params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
98        params.byteOrder = byteOrder;
99        params.dataType = dataType;
100        std::vector<int> shape(extractPyArray<int>(pyShape, "shape"));
101    
102      const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());      const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
103      if (!dom)      if (!dom)
104          throw RipleyException("Function space must be on a ripley domain");          throw RipleyException("Function space must be on a ripley domain");
105    
   
106      escript::Data res(fill, shape, fs, true);      escript::Data res(fill, shape, fs, true);
107        dom->readBinaryGridFromZipped(res, filename, params);
108        return res;
109    }
110    #endif
111    
112      dom->readBinaryGrid(res, filename, first, numValues);  escript::Data readNcGrid(std::string filename, std::string varname,
113            escript::FunctionSpace fs, const object& pyShape, double fill,
114            const object& pyFirst, const object& pyNum, const object& pyMultiplier,
115            const object& pyReverse)
116    {
117        int dim=fs.getDim();
118        ReaderParameters params;
119    
120        params.first = extractPyArray<int>(pyFirst, "first", dim);
121        params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
122        params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
123        params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
124        std::vector<int> shape(extractPyArray<int>(pyShape, "shape"));
125    
126        const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
127        if (!dom)
128            throw RipleyException("Function space must be on a ripley domain");
129    
130        escript::Data res(fill, shape, fs, true);
131        dom->readNcGrid(res, filename, varname, params);
132      return res;      return res;
133  }  }
134    
# Line 78  escript::Data readBinaryGrid(std::string Line 138  escript::Data readBinaryGrid(std::string
138  // The double for n? is just to keep python happy when people need to deal with  // The double for n? is just to keep python happy when people need to deal with
139  // truediv  // truediv
140  escript::Domain_ptr _brick(double _n0, double _n1, double _n2, const object& l0,  escript::Domain_ptr _brick(double _n0, double _n1, double _n2, const object& l0,
141                   const object& l1, const object& l2, int d0, int d1, int d2)                   const object& l1, const object& l2, int d0, int d1, int d2,
142                     const object& objpoints, const object& objtags, escript::SubWorld_ptr world)
143  {  {
144      int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1), n2=static_cast<int>(_n2);      int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1), n2=static_cast<int>(_n2);
145      double x0=0., x1=1., y0=0., y1=1., z0=0., z1=1.;      double x0=0., x1=1., y0=0., y1=1., z0=0., z1=1.;
# Line 117  escript::Domain_ptr _brick(double _n0, d Line 178  escript::Domain_ptr _brick(double _n0, d
178          z1=extract<double>(l2);          z1=extract<double>(l2);
179      } else      } else
180          throw RipleyException("Argument l2 must be a float or 2-tuple");          throw RipleyException("Argument l2 must be a float or 2-tuple");
181        boost::python::list pypoints=extract<boost::python::list>(objpoints);
182      return escript::Domain_ptr(new Brick(n0,n1,n2, x0,y0,z0, x1,y1,z1, d0,d1,d2));      boost::python::list pytags=extract<boost::python::list>(objtags);
183        int numpts=extract<int>(pypoints.attr("__len__")());
184        int numtags=extract<int>(pytags.attr("__len__")());
185        std::vector<double> points;
186        std::vector<int> tags;
187        tags.resize(numtags, -1);
188        for (int i=0;i<numpts;++i) {
189            tuple temp = extract<tuple>(pypoints[i]);
190            int l=extract<int>(temp.attr("__len__")());
191            if (l != 3)
192                throw RipleyException("Number of coordinates for each dirac point must match dimensions.");
193            for (int k=0;k<l;++k) {
194                points.push_back(extract<double>(temp[k]));
195            }
196        }
197        std::map<std::string, int> tagstonames;
198        int curmax=40;
199        // but which order to assign tags to names?????
200        for (int i=0;i<numtags;++i) {
201            extract<int> ex_int(pytags[i]);
202            extract<std::string> ex_str(pytags[i]);
203            if (ex_int.check()) {
204                tags[i]=ex_int();
205                if (tags[i]>= curmax) {
206                    curmax=tags[i]+1;
207                }
208            } else if (ex_str.check()) {
209                std::string s=ex_str();
210                std::map<std::string, int>::iterator it=tagstonames.find(s);
211                if (it!=tagstonames.end()) {
212                    // we have the tag already so look it up
213                    tags[i]=it->second;
214                } else {
215                    tagstonames[s]=curmax;
216                    tags[i]=curmax;
217                    curmax++;
218                }
219            } else {
220                throw RipleyException("Error - Unable to extract tag value.");
221            }
222        }
223        if (numtags != numpts)
224            throw RipleyException("Number of tags does not match number of points.");
225        return escript::Domain_ptr(new Brick(n0,n1,n2, x0,y0,z0, x1,y1,z1, d0,d1,d2,
226                                                points, tags, tagstonames, world));
227  }  }
228    
229  const int _q[]={0x61686969,0x746c4144,0x79616e43};  //const int _q[]={0x61686969,0x746c4144,0x79616e43};
230    const int _q[]={0x62207363, 0x6574735F, 0x2020214e};
231  escript::Domain_ptr _rectangle(double _n0, double _n1, const object& l0,  escript::Domain_ptr _rectangle(double _n0, double _n1, const object& l0,
232                                 const object& l1, int d0, int d1)                                 const object& l1, int d0, int d1,
233                                   const object& objpoints, const object& objtags,
234                      escript::SubWorld_ptr world
235                      )
236  {  {
237      int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1);      int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1);
238      double x0=0., x1=1., y0=0., y1=1.;      double x0=0., x1=1., y0=0., y1=1.;
# Line 150  escript::Domain_ptr _rectangle(double _n Line 259  escript::Domain_ptr _rectangle(double _n
259          y1=extract<double>(l1);          y1=extract<double>(l1);
260      } else      } else
261          throw RipleyException("Argument l1 must be a float or 2-tuple");          throw RipleyException("Argument l1 must be a float or 2-tuple");
262        boost::python::list pypoints=extract<boost::python::list>(objpoints);
263      return escript::Domain_ptr(new Rectangle(n0,n1, x0,y0, x1,y1, d0,d1));      boost::python::list pytags=extract<boost::python::list>(objtags);
264        int numpts=extract<int>(pypoints.attr("__len__")());
265        int numtags=extract<int>(pytags.attr("__len__")());
266        std::vector<double> points;
267        std::vector<int> tags;
268        tags.resize(numtags, -1);
269        for (int i=0;i<numpts;++i) {
270            tuple temp = extract<tuple>(pypoints[i]);
271            int l=extract<int>(temp.attr("__len__")());
272            if (l != 2)
273                throw RipleyException("Number of coordinates for each dirac point must match dimensions.");
274            for (int k=0;k<l;++k) {
275                points.push_back(extract<double>(temp[k]));
276            }
277        }
278        std::map<std::string, int> tagstonames;
279        int curmax=40;
280        // but which order to assign tags to names?????
281        for (int i=0;i<numtags;++i) {
282            extract<int> ex_int(pytags[i]);
283            extract<std::string> ex_str(pytags[i]);
284            if (ex_int.check()) {
285                tags[i]=ex_int();
286                if (tags[i]>= curmax) {
287                    curmax=tags[i]+1;
288                }
289            } else if (ex_str.check()) {
290                std::string s=ex_str();
291                std::map<std::string, int>::iterator it=tagstonames.find(s);
292                if (it!=tagstonames.end()) {
293                    // we have the tag already so look it up
294                    tags[i]=it->second;
295                } else {
296                    tagstonames[s]=curmax;
297                    tags[i]=curmax;
298                    curmax++;
299                }
300            } else {
301                throw RipleyException("Error - Unable to extract tag value.");
302            }
303        }
304        if (numtags != numpts)
305            throw RipleyException("Number of tags does not match number of points.");
306        return escript::Domain_ptr(new Rectangle(n0,n1, x0,y0, x1,y1, d0,d1,
307                                                 points, tags, tagstonames, world));
308  }  }
309  std::string _who(){int a[]={_q[0]^42,_q[1]^42,_q[2]^42,0};return (char*)&a[0];}  std::string _who(){int a[]={_q[0]^42,_q[1]^42,_q[2]^42,0};return (char*)&a[0];}
310    
311  } // end of namespace  } // end of namespace ripley
312    
313    
314  BOOST_PYTHON_MODULE(ripleycpp)  BOOST_PYTHON_MODULE(ripleycpp)
# Line 166  BOOST_PYTHON_MODULE(ripleycpp) Line 319  BOOST_PYTHON_MODULE(ripleycpp)
319      docstring_options docopt(true, true, false);      docstring_options docopt(true, true, false);
320  #endif  #endif
321    
322      register_exception_translator<ripley::RipleyException>(&(esysUtils::esysExceptionTranslator));      register_exception_translator<ripley::RipleyException>(&(esysUtils::RuntimeErrorTranslator));
323    
324      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),      scope().attr("__doc__") = "To use this module, please import esys.ripley";
325        scope().attr("BYTEORDER_NATIVE") = (int)ripley::BYTEORDER_NATIVE;
326        scope().attr("BYTEORDER_LITTLE_ENDIAN") = (int)ripley::BYTEORDER_LITTLE_ENDIAN;
327        scope().attr("BYTEORDER_BIG_ENDIAN") = (int)ripley::BYTEORDER_BIG_ENDIAN;
328        scope().attr("DATATYPE_INT32") = (int)ripley::DATATYPE_INT32;
329        scope().attr("DATATYPE_FLOAT32") = (int)ripley::DATATYPE_FLOAT32;
330        scope().attr("DATATYPE_FLOAT64") = (int)ripley::DATATYPE_FLOAT64;
331    
332        def("Brick", ripley::_brick, (arg("n0"),arg("n1"),arg("n2"),arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,
333            arg("d0")=-1,arg("d1")=-1,arg("d2")=-1,arg("diracPoints")=list(),arg("diracTags")=list(), arg("escriptworld")=escript::SubWorld_ptr()),
334  "Creates a hexagonal mesh with n0 x n1 x n2 elements over the brick [0,l0] x [0,l1] x [0,l2].\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"
335  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"  ":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"  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
# Line 180  BOOST_PYTHON_MODULE(ripleycpp) Line 342  BOOST_PYTHON_MODULE(ripleycpp)
342  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``\n"
343  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");
344    
345      def("Rectangle", ripley::_rectangle, (arg("n0"),arg("n1"),arg("l0")=1.0,arg("l1")=1.0,arg("d0")=-1,arg("d1")=-1),      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(), arg("escriptworld")=escript::SubWorld_ptr()),
346  "Creates a rectangular mesh with n0 x n1 elements over the rectangle [0,l0] x [0,l1].\n\n"  "Creates a rectangular mesh with n0 x n1 elements over the rectangle [0,l0] x [0,l1].\n\n"
347  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"  ":param n0: number of elements in direction 0\n:type n0: ``int``\n"
348  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"  ":param n1: number of elements in direction 1\n:type n1: ``int``\n"
# Line 189  BOOST_PYTHON_MODULE(ripleycpp) Line 351  BOOST_PYTHON_MODULE(ripleycpp)
351  ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"  ":param d0: number of subdivisions in direction 0\n:type d0: ``int``\n"
352  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``");  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``");
353      def("_theculprit_", ripley::_who);      def("_theculprit_", ripley::_who);
     def("LoadMesh", ripley::RipleyDomain::loadMesh, (arg("filename")),  
            "Loads a ripley domain from a dump file" ":rtype: `Domain`");  
   
     def("ReadMesh", ripley::RipleyDomain::readMesh, (arg("filename")),  
             "Reads a ripley domain from a file created by write().\n\n"  
             ":rtype: `RipleyDomain`\n:param filename:\n:type filename: ``string``\n");  
354    
355      def("_readBinaryGrid", &ripley::readBinaryGrid, (arg("filename"), arg("functionspace"), arg("first"), arg("numValues"), arg("shape"), arg("fill")=0.));      def("readBinaryGrid", &ripley::readBinaryGrid, (arg("filename"),
356                    arg("functionspace"), arg("shape"), arg("fill")=0.,
357                    arg("byteOrder"), arg("dataType"), arg("first"),
358                    arg("numValues"), arg("multiplier"), arg("reverse")),
359    "Reads a binary Grid");
360    #ifdef USE_BOOSTIO
361        def("_readBinaryGridFromZipped", &ripley::readBinaryGridFromZipped, (arg("filename"),
362                    arg("functionspace"), arg("shape"), arg("fill")=0.,
363                    arg("byteOrder"), arg("dataType"), arg("first"),
364                    arg("numValues"), arg("multiplier"), arg("reverse")),
365    "Reads a binary Grid");
366    #endif
367        def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"),
368                    arg("functionspace"), arg("shape"), arg("fill"), arg("first"),
369                    arg("numValues"), arg("multiplier"), arg("reverse")),
370    "Reads a grid from a netCDF file");
371    
372      class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain> >      class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain>, boost::noncopyable >
373          ("RipleyDomain", "", no_init)          ("RipleyDomain", "", no_init)
         .def("write", &ripley::RipleyDomain::write, args("filename"),  
                 "Writes the current mesh to a file with the given name. It can subsequently be recovered using ReadMesh().")  
374          .def("print_mesh_info", &ripley::RipleyDomain::Print_Mesh_Info, (arg("full")=false),          .def("print_mesh_info", &ripley::RipleyDomain::Print_Mesh_Info, (arg("full")=false),
375                  "Prints out a summary about the mesh.\n"                  "Prints out a summary about the mesh.\n"
376                  ":param full: whether to output additional data\n:type full: ``bool``")                  ":param full: whether to output additional data\n:type full: ``bool``")
377            .def("writeBinaryGrid", &ripley::RipleyDomain::writeBinaryGrid)
378    
379          .def("dump", &ripley::RipleyDomain::dump, args("filename"),          .def("dump", &ripley::RipleyDomain::dump, args("filename"),
380                  "Dumps the mesh to a file with the given name.")                  "Dumps the mesh to a file with the given name.")
381            .def("getGridParameters", &ripley::RipleyDomain::getGridParameters,
382    "Returns the tuple (origin, spacing, elements) where the entries are tuples:\n"
383    "``origin``=the coordinates of the domain's global origin,\n"
384    "``spacing``=the element size (=node spacing) of the domain,\n"
385    "``elements``=the global number of elements in all dimensions\n\n"
386    ":rtype: ``tuple``")
387          .def("getDescription", &ripley::RipleyDomain::getDescription,          .def("getDescription", &ripley::RipleyDomain::getDescription,
388  ":return: a description for this domain\n:rtype: ``string``")  ":return: a description for this domain\n:rtype: ``string``")
389          .def("getDim", &ripley::RipleyDomain::getDim, ":rtype: ``int``")          .def("getDim", &ripley::RipleyDomain::getDim, ":rtype: ``int``")
# Line 215  BOOST_PYTHON_MODULE(ripleycpp) Line 392  BOOST_PYTHON_MODULE(ripleycpp)
392          .def("getNumDataPointsGlobal", &ripley::RipleyDomain::getNumDataPointsGlobal,          .def("getNumDataPointsGlobal", &ripley::RipleyDomain::getNumDataPointsGlobal,
393  ":return: the number of data points summed across all MPI processes\n"  ":return: the number of data points summed across all MPI processes\n"
394  ":rtype: ``int``")  ":rtype: ``int``")
395          .def("addPDEToSystem",&ripley::RipleyDomain::addPDEToSystem,          .def("addToSystem",&ripley::RipleyDomain::addToSystemFromPython,
396  args("mat", "rhs", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),              args("mat", "rhs", "data"),
397  "adds a PDE onto the stiffness matrix mat and a rhs\n\n"              "adds a PDE to the system, results depend on domain\n\n"
398  ":param mat:\n:type mat: `OperatorAdapter`\n:param rhs:\n:type rhs: `Data`\n"              ":param mat:\n:type mat: `OperatorAdapter`\n"
399  ":param A:\n:type A: `Data`\n"              ":param rhs:\n:type rhs: `Data`\n"
400  ":param B:\n:type B: `Data`\n"              ":param data:\ntype data: `list`")
401  ":param C:\n:type C: `Data`\n"          .def("addToRHS",&ripley::RipleyDomain::addToRHSFromPython,
402  ":param D:\n:type D: `Data`\n"              args("rhs", "data"),
403  ":param X:\n:type X: `Data`\n"              "adds a PDE onto the stiffness matrix mat and a rhs, "
404  ":param Y:\n:type Y: `Data`\n"              "results depends on domain\n\n"
405  ":param d:\n:type d: `Data`\n"              ":param rhs:\n:type rhs: `Data`\n"
406  ":param d_contact:\n:type d_contact: `Data`\n"              ":param data:\ntype data: `list`")
407  ":param y_contact:\n:type y_contact: `Data`"          .def("createAssembler", &ripley::RipleyDomain::createAssemblerFromPython,
408  )              args("typename", "options"),
409          .def("addPDEToRHS",&ripley::RipleyDomain::addPDEToRHS,              "request from the domain an assembler of the specified type, if "
410  args("rhs", "X", "Y", "y", "y_contact"),              "supported, using the supplied options (if provided)"
411  "adds a PDE onto the stiffness matrix mat and a rhs\n\n"              ":param typename:\n:type typename: `string`\n"
412  ":param rhs:\n:type rhs: `Data`\n"              ":param options:\n:type options: `list`\n")
413  ":param X:\n:type X: `Data`\n"          .def("addPDEToTransportProblem",&ripley::RipleyDomain::addPDEToTransportProblemFromPython,
414  ":param Y:\n:type Y: `Data`\n"              args("tp", "source", "data"),
415  ":param y:\n:type y: `Data`\n"              ":param tp:\n:type tp: `TransportProblemAdapter`\n"
416  ":param y_contact:\n:type y_contact: `Data`"              ":param source:\n:type source: `Data`\n"
417  )              ":param data:\ntype data: `list`")
         .def("addPDEToTransportProblem",&ripley::RipleyDomain::addPDEToTransportProblem,  
 args( "tp", "source", "M", "A", "B", "C", "D", "X", "Y", "d", "y", "d_contact", "y_contact"),  
 ":param tp:\n:type tp: `TransportProblemAdapter`\n"  
 ":param source:\n:type source: `Data`\n"  
 ":param M:\n:type M: `Data`\n"  
 ":param A:\n:type A: `Data`\n"  
 ":param B:\n:type B: `Data`\n"  
 ":param C:\n:type C: `Data`\n"  
 ":param D:\n:type D: `Data`\n"  
 ":param X:\n:type X: `Data`\n"  
 ":param Y:\n:type Y: `Data`\n"  
 ":param d:\n:type d: `Data`\n"  
 ":param y:\n:type y: `Data`\n"  
 ":param d_contact:\n:type d_contact: `Data`\n"  
 ":param y_contact:\n:type y_contact: `Data`"  
 )  
418          .def("newOperator",&ripley::RipleyDomain::newSystemMatrix,          .def("newOperator",&ripley::RipleyDomain::newSystemMatrix,
419  args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),  args("row_blocksize", "row_functionspace", "column_blocksize", "column_functionspace", "type"),
420  "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"  "creates a SystemMatrixAdapter stiffness matrix and initializes it with zeros\n\n"
# Line 272  args("theta", "blocksize", "functionspac Line 433  args("theta", "blocksize", "functionspac
433  ":param type:\n:type type: ``int``"  ":param type:\n:type type: ``int``"
434  )  )
435          .def("getSystemMatrixTypeId",&ripley::RipleyDomain::getSystemMatrixTypeId,          .def("getSystemMatrixTypeId",&ripley::RipleyDomain::getSystemMatrixTypeId,
436  args("solver", "preconditioner", "package", "symmetry"),  args("options"),
437  ":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"  ":return: the identifier of the matrix type to be used for the global stiffness matrix when particular solver options are used.\n"
438  ":rtype: ``int``\n"  ":rtype: ``int``\n"
439  ":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``"  
440  )  )
441          .def("getTransportTypeId",&ripley::RipleyDomain::getTransportTypeId,          .def("getTransportTypeId",&ripley::RipleyDomain::getTransportTypeId,
442  args("solver", "preconditioner", "package", "symmetry"),  args("solver", "preconditioner", "package", "symmetry"),
# Line 308  args("solver", "preconditioner", "packag Line 466  args("solver", "preconditioner", "packag
466          .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``")
467          .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")
468          .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`");
469        /* These two class exports are necessary to ensure that the extra methods added by ripley make it to python.
470         * This change became necessary when the Brick and Rectangle constructors turned into factories instead of classes */
471      class_<ripley::Brick, bases<ripley::RipleyDomain> >("RipleyBrick", "", no_init);      class_<ripley::Brick, bases<ripley::RipleyDomain> >("RipleyBrick", "", no_init);
472      class_<ripley::Rectangle, bases<ripley::RipleyDomain> >("RipleyRectangle", "", no_init);      class_<ripley::Rectangle, bases<ripley::RipleyDomain> >("RipleyRectangle", "", no_init);
473        class_<ripley::AbstractAssembler, ripley::Assembler_ptr, boost::noncopyable >
474            ("AbstractAssembler", "", no_init);
475  }  }
476    

Legend:
Removed from v.3991  
changed lines
  Added in v.5148

  ViewVC Help
Powered by ViewVC 1.1.26