/[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 4906 by sshaw, Tue Apr 29 05:27:34 2014 UTC revision 4934 by jfenwick, Tue May 13 00:28:11 2014 UTC
# Line 24  Line 24 
24  #include <boost/python/detail/defaults_gen.hpp>  #include <boost/python/detail/defaults_gen.hpp>
25  #include <boost/version.hpp>  #include <boost/version.hpp>
26    
27    #include "escript/SubWorld.h"
28    
29  using namespace boost::python;  using namespace boost::python;
30    
31  namespace ripley {  namespace ripley {
# Line 136  escript::Data readNcGrid(std::string fil Line 138  escript::Data readNcGrid(std::string fil
138  // truediv  // truediv
139  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,
140                   const object& l1, const object& l2, int d0, int d1, int d2,                   const object& l1, const object& l2, int d0, int d1, int d2,
141                   const object& objpoints, const object& objtags)                   const object& objpoints, const object& objtags, escript::SubWorld_ptr world)
142  {  {
143      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);
144      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 220  escript::Domain_ptr _brick(double _n0, d Line 222  escript::Domain_ptr _brick(double _n0, d
222      if (numtags != numpts)      if (numtags != numpts)
223          throw RipleyException("Number of tags does not match number of points.");          throw RipleyException("Number of tags does not match number of points.");
224      return escript::Domain_ptr(new Brick(n0,n1,n2, x0,y0,z0, x1,y1,z1, d0,d1,d2,      return escript::Domain_ptr(new Brick(n0,n1,n2, x0,y0,z0, x1,y1,z1, d0,d1,d2,
225                                              points, tags, tagstonames));                                              points, tags, tagstonames, world));
226  }  }
227    
228  //const int _q[]={0x61686969,0x746c4144,0x79616e43};  //const int _q[]={0x61686969,0x746c4144,0x79616e43};
229  const int _q[]={0x62207363, 0x6574735F, 0x2020214e};  const int _q[]={0x62207363, 0x6574735F, 0x2020214e};
230  escript::Domain_ptr _rectangle(double _n0, double _n1, const object& l0,  escript::Domain_ptr _rectangle(double _n0, double _n1, const object& l0,
231                                 const object& l1, int d0, int d1,                                 const object& l1, int d0, int d1,
232                                 const object& objpoints, const object& objtags)                                 const object& objpoints, const object& objtags,
233                      escript::SubWorld_ptr world
234                      )
235  {  {
236      int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1);      int n0=static_cast<int>(_n0), n1=static_cast<int>(_n1);
237      double x0=0., x1=1., y0=0., y1=1.;      double x0=0., x1=1., y0=0., y1=1.;
# Line 299  escript::Domain_ptr _rectangle(double _n Line 303  escript::Domain_ptr _rectangle(double _n
303      if (numtags != numpts)      if (numtags != numpts)
304          throw RipleyException("Number of tags does not match number of points.");          throw RipleyException("Number of tags does not match number of points.");
305      return escript::Domain_ptr(new Rectangle(n0,n1, x0,y0, x1,y1, d0,d1,      return escript::Domain_ptr(new Rectangle(n0,n1, x0,y0, x1,y1, d0,d1,
306                                               points, tags, tagstonames));                                               points, tags, tagstonames, world));
307  }  }
308  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];}
309    
# Line 324  BOOST_PYTHON_MODULE(ripleycpp) Line 328  BOOST_PYTHON_MODULE(ripleycpp)
328      scope().attr("DATATYPE_FLOAT32") = (int)ripley::DATATYPE_FLOAT32;      scope().attr("DATATYPE_FLOAT32") = (int)ripley::DATATYPE_FLOAT32;
329      scope().attr("DATATYPE_FLOAT64") = (int)ripley::DATATYPE_FLOAT64;      scope().attr("DATATYPE_FLOAT64") = (int)ripley::DATATYPE_FLOAT64;
330    
331      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()),      def("Brick", ripley::_brick, (arg("n0"),arg("n1"),arg("n2"),arg("l0")=1.0,arg("l1")=1.0,arg("l2")=1.0,
332            arg("d0")=-1,arg("d1")=-1,arg("d2")=-1,arg("diracPoints")=list(),arg("diracTags")=list(), arg("escriptworld")=escript::SubWorld_ptr()),
333  "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"
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 336  BOOST_PYTHON_MODULE(ripleycpp) Line 341  BOOST_PYTHON_MODULE(ripleycpp)
341  ":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"
342  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");  ":param d2: number of subdivisions in direction 2\n:type d2: ``int``");
343    
344      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()),      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()),
345  "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"
346  ":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"
347  ":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"

Legend:
Removed from v.4906  
changed lines
  Added in v.4934

  ViewVC Help
Powered by ViewVC 1.1.26