[cig-commits] r13168 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Wed Oct 29 15:11:35 PDT 2008
Author: luis
Date: 2008-10-29 15:11:35 -0700 (Wed, 29 Oct 2008)
New Revision: 13168
Added:
cs/cigma/trunk/src/py_Cell.h
Modified:
cs/cigma/trunk/src/py_Cell.cpp
Log:
Updated python bindings to the cigma::Cell subclasses.
Modified: cs/cigma/trunk/src/py_Cell.cpp
===================================================================
--- cs/cigma/trunk/src/py_Cell.cpp 2008-10-29 22:11:33 UTC (rev 13167)
+++ cs/cigma/trunk/src/py_Cell.cpp 2008-10-29 22:11:35 UTC (rev 13168)
@@ -1,26 +1,130 @@
-#include "Cell.h"
-#include "fe_tet4.h"
-#include "numpy_util.h"
+#include "py_Cell.h"
+#include "py_Quadrature.h"
#include <iostream>
-
using namespace cigma;
using namespace boost::python;
+using boost::shared_ptr;
-class pyQuadrature;
+// ----------------------------------------------------------------------------
-struct py_tet4 : tet4
+py_hex8::py_hex8() : gv(0)
{
- py_tet4() {}
- ~py_tet4() {}
-};
+}
+py_hex8::~py_hex8()
+{
+}
+
+shared_ptr<pyQuadrature> py_hex8::default_rule()
+{
+ shared_ptr<Quadrature> Q;
+ Q = hex8::default_quadrature();
+
+ shared_ptr<pyQuadrature> pyQ(new pyQuadrature(*Q));
+ Q.reset();
+
+ return pyQ;
+}
+
+// ----------------------------------------------------------------------------
+
+py_tet4::py_tet4()
+{
+}
+
+py_tet4::~py_tet4()
+{
+}
+
+shared_ptr<pyQuadrature> py_tet4::default_rule()
+{
+ shared_ptr<Quadrature> Q;
+ Q = tet4::default_quadrature();
+
+ shared_ptr<pyQuadrature> pyQ(new pyQuadrature(*Q));
+ Q.reset();
+
+ return pyQ;
+}
+
+// ----------------------------------------------------------------------------
+
+py_quad4::py_quad4()
+{
+}
+
+py_quad4::~py_quad4()
+{
+}
+
+shared_ptr<pyQuadrature> py_quad4::default_rule()
+{
+ shared_ptr<Quadrature> Q;
+ Q = quad4::default_quadrature();
+
+ shared_ptr<pyQuadrature> pyQ(new pyQuadrature(*Q));
+ Q.reset();
+
+ return pyQ;
+}
+
+// ----------------------------------------------------------------------------
+
+py_tri3::py_tri3()
+{
+}
+
+py_tri3::~py_tri3()
+{
+}
+
+shared_ptr<pyQuadrature> py_tri3::default_rule()
+{
+ shared_ptr<Quadrature> Q;
+ Q = tri3::default_quadrature();
+
+ shared_ptr<pyQuadrature> pyQ(new pyQuadrature(*Q));
+ Q.reset();
+
+ return pyQ;
+}
+
+// ----------------------------------------------------------------------------
+
void export_Cell()
{
using namespace boost::python;
+
+ class_<py_hex8, boost::noncopyable>("hex8")
+ .def("n_nodes", &py_hex8::n_nodes)
+ .def("n_celldim", &py_hex8::n_celldim)
+ .def("n_dim", &py_hex8::n_dim)
+ .def("default_rule", &py_hex8::default_rule)
+ ;
+
class_<py_tet4, boost::noncopyable>("tet4")
.def("n_nodes", &py_tet4::n_nodes)
.def("n_celldim", &py_tet4::n_celldim)
.def("n_dim", &py_tet4::n_dim)
- .def("default_quadrature", &py_tet4::default_quadrature)
+ .def("default_rule", &py_tet4::default_rule)
;
+
+ class_<py_quad4, boost::noncopyable>("quad4")
+ .def("n_nodes", &py_quad4::n_nodes)
+ .def("n_celldim", &py_quad4::n_celldim)
+ .def("n_dim", &py_quad4::n_dim)
+ .def("default_rule", &py_quad4::default_rule)
+ ;
+
+ class_<py_tri3, boost::noncopyable>("tri3")
+ .def("n_nodes", &py_tri3::n_nodes)
+ .def("n_celldim", &py_tri3::n_celldim)
+ .def("n_dim", &py_tri3::n_dim)
+ .def("default_rule", &py_tri3::default_rule)
+ ;
+
+ //register_ptr_to_python< shared_ptr<py_hex8> >();
+ //register_ptr_to_python< shared_ptr<py_tet4> >();
+ //register_ptr_to_python< shared_ptr<py_quad4> >();
+ //register_ptr_to_python< shared_ptr<py_tri3> >();
}
Added: cs/cigma/trunk/src/py_Cell.h
===================================================================
--- cs/cigma/trunk/src/py_Cell.h (rev 0)
+++ cs/cigma/trunk/src/py_Cell.h 2008-10-29 22:11:35 UTC (rev 13168)
@@ -0,0 +1,46 @@
+#ifndef __PY_CELL_H__
+#define __PY_CELL_H__
+
+#include "Cell.h"
+#include "fe_hex8.h"
+#include "fe_tet4.h"
+#include "fe_quad4.h"
+#include "fe_tri3.h"
+
+#include "numpy_util.h"
+#include "py_Quadrature.h"
+
+
+struct py_hex8 : cigma::hex8
+{
+ py_hex8();
+ ~py_hex8();
+ boost::shared_ptr<pyQuadrature> default_rule();
+
+public:
+ boost::python::numeric::array gv;
+};
+
+struct py_tet4 : cigma::tet4
+{
+ py_tet4();
+ ~py_tet4();
+ boost::shared_ptr<pyQuadrature> default_rule();
+};
+
+struct py_quad4 : cigma::quad4
+{
+ py_quad4();
+ ~py_quad4();
+ boost::shared_ptr<pyQuadrature> default_rule();
+};
+
+struct py_tri3 : cigma::tri3
+{
+ py_tri3();
+ ~py_tri3();
+ boost::shared_ptr<pyQuadrature> default_rule();
+};
+
+
+#endif
More information about the CIG-COMMITS
mailing list