/[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 4174 by caltinay, Wed Jan 30 03:21:27 2013 UTC revision 4738 by sshaw, Wed Mar 12 01:32:36 2014 UTC
# Line 1  Line 1 
1    
2  /*****************************************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2013 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    
# Line 27  using namespace boost::python; Line 28  using namespace boost::python;
28    
29  namespace ripley {  namespace ripley {
30    
31    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  escript::Data readBinaryGrid(std::string filename, escript::FunctionSpace fs,  escript::Data readBinaryGrid(std::string filename, escript::FunctionSpace fs,
58          const object& pyFirst, const object& pyNum, const object& pyShape,          const object& pyShape, double fill, int byteOrder, int dataType,
59          double fill=0.)          const object& pyFirst, const object& pyNum, const object& pyMultiplier,
60            const object& pyReverse)
61  {  {
62      int dim=fs.getDim();      int dim=fs.getDim();
63      std::vector<int> first(dim), numValues(dim), shape;      ReaderParameters params;
64    
65      if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {      params.first = extractPyArray<int>(pyFirst, "first", dim);
66          if (len(pyFirst)==dim) {      params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
67              for (int i=0; i<dim; i++) {      params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
68                  first[i]=extract<int>(pyFirst[i]);      params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
69              }      params.byteOrder = byteOrder;
70          } else      params.dataType = dataType;
71              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");  
72    
73      if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {      const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
74          if (len(pyNum)==dim) {      if (!dom)
75              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");  
76    
77      if (extract<tuple>(pyShape).check() || extract<list>(pyShape).check()) {      escript::Data res(fill, shape, fs, true);
78          for (int i=0; i<len(pyShape); i++) {      dom->readBinaryGrid(res, filename, params);
79              shape.push_back(extract<int>(pyShape[i]));      return res;
80          }  }
81      } else  
82          throw RipleyException("Argument 'shape' must be a tuple or list");  #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());      const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
100      if (!dom)      if (!dom)
101          throw RipleyException("Function space must be on a ripley domain");          throw RipleyException("Function space must be on a ripley domain");
102    
   
103      escript::Data res(fill, shape, fs, true);      escript::Data res(fill, shape, fs, true);
104        dom->readBinaryGridFromZipped(res, filename, params);
     dom->readBinaryGrid(res, filename, first, numValues);  
105      return res;      return res;
106  }  }
107    #endif
108    
109  escript::Data readNcGrid(std::string filename, std::string varname,  escript::Data readNcGrid(std::string filename, std::string varname,
110          escript::FunctionSpace fs, const object& pyFirst, const object& pyNum,          escript::FunctionSpace fs, const object& pyShape, double fill,
111          const object& pyShape, double fill=0.)          const object& pyFirst, const object& pyNum, const object& pyMultiplier,
112            const object& pyReverse)
113  {  {
114      int dim=fs.getDim();      int dim=fs.getDim();
115      std::vector<int> first(dim), numValues(dim), shape;      ReaderParameters params;
116    
117      if (extract<tuple>(pyFirst).check() || extract<list>(pyFirst).check()) {      params.first = extractPyArray<int>(pyFirst, "first", dim);
118          if (len(pyFirst)==dim) {      params.numValues = extractPyArray<int>(pyNum, "numValues", dim);
119              for (int i=0; i<dim; i++) {      params.multiplier = extractPyArray<int>(pyMultiplier, "multiplier", dim);
120                  first[i]=extract<int>(pyFirst[i]);      params.reverse = extractPyArray<int>(pyReverse, "reverse", dim);
121              }      std::vector<int> shape(extractPyArray<int>(pyShape, "shape"));
         } else  
             throw RipleyException("Argument 'first' has wrong length");  
     } else  
         throw RipleyException("Argument 'first' must be a tuple or list");  
   
     if (extract<tuple>(pyNum).check() || extract<list>(pyNum).check()) {  
         if (len(pyNum)==dim) {  
             for (int i=0; i<dim; i++) {  
                 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");  
   
     if (extract<tuple>(pyShape).check() || extract<list>(pyShape).check()) {  
         for (int i=0; i<len(pyShape); i++) {  
             shape.push_back(extract<int>(pyShape[i]));  
         }  
     } else  
         throw RipleyException("Argument 'shape' must be a tuple or list");  
122    
123      const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());      const RipleyDomain* dom=dynamic_cast<const RipleyDomain*>(fs.getDomain().get());
124      if (!dom)      if (!dom)
125          throw RipleyException("Function space must be on a ripley domain");          throw RipleyException("Function space must be on a ripley domain");
126    
   
127      escript::Data res(fill, shape, fs, true);      escript::Data res(fill, shape, fs, true);
128        dom->readNcGrid(res, filename, varname, params);
     dom->readNcGrid(res, filename, varname, first, numValues);  
129      return res;      return res;
130  }  }
131    
# Line 123  escript::Data readNcGrid(std::string fil Line 135  escript::Data readNcGrid(std::string fil
135  // 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
136  // truediv  // truediv
137  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,
138                   const object& l1, const object& l2, int d0, int d1, int d2)                   const object& l1, const object& l2, int d0, int d1, int d2,
139                     const object& objpoints, const object& objtags)
140  {  {
141      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);
142      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 163  escript::Domain_ptr _brick(double _n0, d Line 176  escript::Domain_ptr _brick(double _n0, d
176      } else      } else
177          throw RipleyException("Argument l2 must be a float or 2-tuple");          throw RipleyException("Argument l2 must be a float or 2-tuple");
178    
179      return escript::Domain_ptr(new Brick(n0,n1,n2, x0,y0,z0, x1,y1,z1, d0,d1,d2));      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  }  }
222    
223  const int _q[]={0x61686969,0x746c4144,0x79616e43};  const int _q[]={0x61686969,0x746c4144,0x79616e43};
224  escript::Domain_ptr _rectangle(double _n0, double _n1, const object& l0,  escript::Domain_ptr _rectangle(double _n0, double _n1, const object& l0,
225                                 const object& l1, int d0, int d1)                                 const object& l1, int d0, int d1,
226                                   const object& objpoints, const object& objtags)
227  {  {
228      int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1);      int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1);
229      double x0=0., x1=1., y0=0., y1=1.;      double x0=0., x1=1., y0=0., y1=1.;
# Line 195  escript::Domain_ptr _rectangle(double _n Line 250  escript::Domain_ptr _rectangle(double _n
250          y1=extract<double>(l1);          y1=extract<double>(l1);
251      } else      } else
252          throw RipleyException("Argument l1 must be a float or 2-tuple");          throw RipleyException("Argument l1 must be a float or 2-tuple");
253            
254      return escript::Domain_ptr(new Rectangle(n0,n1, x0,y0, x1,y1, d0,d1));      boost::python::list pypoints=extract<boost::python::list>(objpoints);
255        boost::python::list pytags=extract<boost::python::list>(objtags);
256        int numpts=extract<int>(pypoints.attr("__len__")());
257        int numtags=extract<int>(pytags.attr("__len__")());
258        std::vector<double> points;
259        std::vector<int> tags;
260        tags.resize(numtags, -1);
261        for (int i=0;i<numpts;++i) {
262            boost::python::object temp=pypoints[i];
263            int l=extract<int>(temp.attr("__len__")());
264            for (int k=0;k<l;++k) {
265                points.push_back(extract<double>(temp[k]));
266            }
267        }
268        std::map<std::string, int> tagstonames;
269        int curmax=40;
270        // but which order to assign tags to names?????
271        for (int i=0;i<numtags;++i) {
272            extract<int> ex_int(pytags[i]);
273            extract<std::string> ex_str(pytags[i]);
274            if (ex_int.check()) {
275                tags[i]=ex_int();
276                if (tags[i]>= curmax) {
277                    curmax=tags[i]+1;
278                }
279            } else if (ex_str.check()) {
280                std::string s=ex_str();
281                std::map<std::string, int>::iterator it=tagstonames.find(s);
282                if (it!=tagstonames.end()) {
283                    // we have the tag already so look it up
284                    tags[i]=it->second;
285                } else {
286                    tagstonames[s]=curmax;
287                    tags[i]=curmax;
288                    curmax++;
289                }
290            } else {
291                throw RipleyException("Error - Unable to extract tag value.");
292            }
293        }
294        return escript::Domain_ptr(new Rectangle(n0,n1, x0,y0, x1,y1, d0,d1,
295                                                 points, tags, tagstonames));
296  }  }
297  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];}
298    
299  } // end of namespace  } // end of namespace ripley
300    
301    
302  BOOST_PYTHON_MODULE(ripleycpp)  BOOST_PYTHON_MODULE(ripleycpp)
# Line 214  BOOST_PYTHON_MODULE(ripleycpp) Line 310  BOOST_PYTHON_MODULE(ripleycpp)
310      register_exception_translator<ripley::RipleyException>(&(esysUtils::esysExceptionTranslator));      register_exception_translator<ripley::RipleyException>(&(esysUtils::esysExceptionTranslator));
311    
312      scope().attr("__doc__") = "To use this module, please import esys.ripley";      scope().attr("__doc__") = "To use this module, please import esys.ripley";
313        scope().attr("BYTEORDER_NATIVE") = (int)ripley::BYTEORDER_NATIVE;
314        scope().attr("BYTEORDER_LITTLE_ENDIAN") = (int)ripley::BYTEORDER_LITTLE_ENDIAN;
315        scope().attr("BYTEORDER_BIG_ENDIAN") = (int)ripley::BYTEORDER_BIG_ENDIAN;
316        scope().attr("DATATYPE_INT32") = (int)ripley::DATATYPE_INT32;
317        scope().attr("DATATYPE_FLOAT32") = (int)ripley::DATATYPE_FLOAT32;
318        scope().attr("DATATYPE_FLOAT64") = (int)ripley::DATATYPE_FLOAT64;
319    
320      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),      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()),
321  "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"
322  ":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"
323  ":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 227  BOOST_PYTHON_MODULE(ripleycpp) Line 329  BOOST_PYTHON_MODULE(ripleycpp)
329  ":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"
330  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");
331    
332      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()),
333  "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"
334  ":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"
335  ":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 236  BOOST_PYTHON_MODULE(ripleycpp) Line 338  BOOST_PYTHON_MODULE(ripleycpp)
338  ":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"
339  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``");  ":param d1: number of subdivisions in direction 1\n:type d1: ``int``");
340      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");  
   
     def("_readBinaryGrid", &ripley::readBinaryGrid, (arg("filename"), arg("functionspace"), arg("first"), arg("numValues"), arg("shape"), arg("fill")=0.));  
341    
342      def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"), arg("functionspace"), arg("first"), arg("numValues"), arg("shape"), arg("fill")=0.));      def("_readBinaryGrid", &ripley::readBinaryGrid, (arg("filename"),
343                    arg("functionspace"), arg("shape"), arg("fill")=0.,
344                    arg("byteOrder"), arg("dataType"), arg("first"),
345                    arg("numValues"), arg("multiplier"), arg("reverse")),
346    "Reads a binary Grid");
347    #ifdef USE_BOOSTIO
348        def("_readBinaryGridFromZipped", &ripley::readBinaryGridFromZipped, (arg("filename"),
349                    arg("functionspace"), arg("shape"), arg("fill")=0.,
350                    arg("byteOrder"), arg("dataType"), arg("first"),
351                    arg("numValues"), arg("multiplier"), arg("reverse")),
352    "Reads a binary Grid");
353    #endif
354        def("_readNcGrid", &ripley::readNcGrid, (arg("filename"), arg("varname"),
355                    arg("functionspace"), arg("shape"), arg("fill"), arg("first"),
356                    arg("numValues"), arg("multiplier"), arg("reverse")),
357    "Reads a grid from a netCDF file");
358    
359      class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain> >      class_<ripley::RipleyDomain, bases<escript::AbstractContinuousDomain>, boost::noncopyable >
360          ("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().")  
361          .def("print_mesh_info", &ripley::RipleyDomain::Print_Mesh_Info, (arg("full")=false),          .def("print_mesh_info", &ripley::RipleyDomain::Print_Mesh_Info, (arg("full")=false),
362                  "Prints out a summary about the mesh.\n"                  "Prints out a summary about the mesh.\n"
363                  ":param full: whether to output additional data\n:type full: ``bool``")                  ":param full: whether to output additional data\n:type full: ``bool``")
364            .def("writeBinaryGrid", &ripley::RipleyDomain::writeBinaryGrid)
365    
366          .def("dump", &ripley::RipleyDomain::dump, args("filename"),          .def("dump", &ripley::RipleyDomain::dump, args("filename"),
367                  "Dumps the mesh to a file with the given name.")                  "Dumps the mesh to a file with the given name.")
368            .def("getGridParameters", &ripley::RipleyDomain::getGridParameters,
369    "Returns the tuple (origin, spacing, elements) where the entries are tuples:\n"
370    "``origin``=the coordinates of the domain's global origin,\n"
371    "``spacing``=the element size (=node spacing) of the domain,\n"
372    "``elements``=the global number of elements in all dimensions\n\n"
373    ":rtype: ``tuple``")
374          .def("getDescription", &ripley::RipleyDomain::getDescription,          .def("getDescription", &ripley::RipleyDomain::getDescription,
375  ":return: a description for this domain\n:rtype: ``string``")  ":return: a description for this domain\n:rtype: ``string``")
376          .def("getDim", &ripley::RipleyDomain::getDim, ":rtype: ``int``")          .def("getDim", &ripley::RipleyDomain::getDim, ":rtype: ``int``")
# Line 264  BOOST_PYTHON_MODULE(ripleycpp) Line 379  BOOST_PYTHON_MODULE(ripleycpp)
379          .def("getNumDataPointsGlobal", &ripley::RipleyDomain::getNumDataPointsGlobal,          .def("getNumDataPointsGlobal", &ripley::RipleyDomain::getNumDataPointsGlobal,
380  ":return: the number of data points summed across all MPI processes\n"  ":return: the number of data points summed across all MPI processes\n"
381  ":rtype: ``int``")  ":rtype: ``int``")
382            .def("addToSystem",&ripley::RipleyDomain::addToSystemFromPython,
383                args("mat", "rhs", "data"),
384                "adds a PDE to the system, results depend on domain\n\n"
385                ":param mat:\n:type mat: `OperatorAdapter`\n"
386                ":param rhs:\n:type rhs: `Data`\n"
387                ":param data:\ntype data: `list`")
388          .def("addPDEToSystem",&ripley::RipleyDomain::addPDEToSystem,          .def("addPDEToSystem",&ripley::RipleyDomain::addPDEToSystem,
389  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"),
390  "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 278  args("mat", "rhs", "A", "B", "C", "D", " Line 399  args("mat", "rhs", "A", "B", "C", "D", "
399  ":param d_contact:\n:type d_contact: `Data`\n"  ":param d_contact:\n:type d_contact: `Data`\n"
400  ":param y_contact:\n:type y_contact: `Data`"  ":param y_contact:\n:type y_contact: `Data`"
401  )  )
402    
403          .def("addPDEToRHS",&ripley::RipleyDomain::addPDEToRHS,          .def("addPDEToRHS",&ripley::RipleyDomain::addPDEToRHS,
404  args("rhs", "X", "Y", "y", "y_contact"),  args("rhs", "X", "Y", "y", "y_contact"),
405  "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 287  args("rhs", "X", "Y", "y", "y_contact"), Line 409  args("rhs", "X", "Y", "y", "y_contact"),
409  ":param y:\n:type y: `Data`\n"  ":param y:\n:type y: `Data`\n"
410  ":param y_contact:\n:type y_contact: `Data`"  ":param y_contact:\n:type y_contact: `Data`"
411  )  )
412            .def("addToRHS",&ripley::RipleyDomain::addToRHSFromPython,
413                args("rhs", "data"),
414                "adds a PDE onto the stiffness matrix mat and a rhs, "
415                "results depends on domain\n\n"
416                ":param rhs:\n:type rhs: `Data`\n"
417                ":param data:\ntype data: `list`")
418            .def("setAssembler", &ripley::RipleyDomain::setAssemblerFromPython,
419                args("typename", "options"),
420                "sets the domain to use the named assembler, if supported, using"
421                "the options if provided"
422                ":param typename:\n:type typename: `string`\n"
423                ":param options:\n:type options: `list`\n")
424          .def("addPDEToTransportProblem",&ripley::RipleyDomain::addPDEToTransportProblem,          .def("addPDEToTransportProblem",&ripley::RipleyDomain::addPDEToTransportProblem,
425  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"),
426  ":param tp:\n:type tp: `TransportProblemAdapter`\n"  ":param tp:\n:type tp: `TransportProblemAdapter`\n"
# Line 359  args("solver", "preconditioner", "packag Line 493  args("solver", "preconditioner", "packag
493          .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`");
494    
495      class_<ripley::Brick, bases<ripley::RipleyDomain> >("RipleyBrick", "", no_init);      class_<ripley::Brick, bases<ripley::RipleyDomain> >("RipleyBrick", "", no_init);
496    /*    
497        .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"
498    ":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"
499    "guassian blur and s is the sigma parameter."
500        );
501    */    
502      class_<ripley::Rectangle, bases<ripley::RipleyDomain> >("RipleyRectangle", "", no_init);      class_<ripley::Rectangle, bases<ripley::RipleyDomain> >("RipleyRectangle", "", no_init);
503    /*    
504        .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"
505    ":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"
506    "guassian blur and s is the sigma parameter."
507        );
508    */    
509  }  }
510    

Legend:
Removed from v.4174  
changed lines
  Added in v.4738

  ViewVC Help
Powered by ViewVC 1.1.26