← Back to team overview

dolfin team mailing list archive

[noreply@xxxxxxxxxxxxx: [Branch ~dolfin-core/dolfin/main] Rev 4561: Fix wrapping of super_space() to Python.]

 

One can now do

  V.sub(i).super_space()

and get back V.

Perhaps sub should be renamed to sub_space?

And while we're on the subject, why is it called sub and not __getitem__?

--
Anders
--- Begin Message ---
------------------------------------------------------------
revno: 4561
committer: Anders Logg <logg@xxxxxxxxx>
branch nick: dolfin-dev
timestamp: Tue 2010-02-23 21:33:27 +0100
message:
  Fix wrapping of super_space() to Python.
modified:
  dolfin/swig/docstrings.i
  dolfin/swig/function_pre.i
  site-packages/dolfin/function/functionspace.py


--
lp:dolfin
https://code.launchpad.net/~dolfin-core/dolfin/main

Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription.
=== modified file 'dolfin/swig/docstrings.i'
--- dolfin/swig/docstrings.i	2010-02-23 11:12:13 +0000
+++ dolfin/swig/docstrings.i	2010-02-23 20:33:27 +0000
@@ -34,6 +34,8 @@
 
 C++ includes: Array.h ";
 
+%feature("docstring")  dolfin::Array::Array "";
+
 %feature("docstring")  dolfin::Array::Array "
 
 Create array of size N. ";
@@ -1878,15 +1880,13 @@
 
 Check if function space has given element. ";
 
-%feature("docstring")  dolfin::FunctionSpace::attach "
-
-Attach restriction meshfunction. ";
-
-%feature("docstring")  dolfin::FunctionSpace::restriction "
-
-Create function space based on the restriction. ";
-
-%feature("docstring")  dolfin::FunctionSpace::is_inside_restriction "";
+%feature("docstring")  dolfin::FunctionSpace::super_space "
+
+Return super space (for sub spaces). ";
+
+%feature("docstring")  dolfin::FunctionSpace::component "
+
+Return component (relative to super space). ";
 
 %feature("docstring")  dolfin::FunctionSpace::str "
 
@@ -2125,6 +2125,10 @@
 
 Set given entry to value. ";
 
+%feature("docstring")  dolfin::GenericMatrix::ident_zeros "
+
+Insert one on the diagonal for all zero rows. ";
+
 
 // File: classdolfin_1_1GenericSparsityPattern.xml
 %feature("docstring") dolfin::GenericSparsityPattern "
@@ -7407,50 +7411,50 @@
 // File: RadauQuadrature_8h.xml
 
 
-// File: dir_68f858635a27044942e1456f397a257e.xml
-
-
-// File: dir_be4abbe9be371fb90858f9b708d1b3fd.xml
-
-
-// File: dir_c9896c264abe1f5ce0b23b00c130609f.xml
-
-
-// File: dir_96b86ef69f481d1d80becb314010dfa2.xml
-
-
-// File: dir_13fd81ecff987b0a93366aa1e9319de6.xml
-
-
-// File: dir_12eaeb6393c8340c3fcc7bb4666dbe6a.xml
-
-
-// File: dir_5bab3dfda35b11ed9e9fc557c91c04ca.xml
-
-
-// File: dir_29c16e73653a7fc876ded90673bae460.xml
-
-
-// File: dir_a36793e7aa99483120927e3d6713b3d9.xml
-
-
-// File: dir_3f6ea3b079d98368ba4d0298b8edf7e0.xml
-
-
-// File: dir_e9dae39b13f1287e8917eaa1de874624.xml
-
-
-// File: dir_8ab656e4681daa02e4b96ad13fdc62c8.xml
-
-
-// File: dir_bfb3cabb742a51f1c9dcbb782a9883c3.xml
-
-
-// File: dir_a1ad675c37ae45d8c452a0ce15eff5f1.xml
-
-
-// File: dir_b6d81790256b0d7b70fdbdc2046bfa2d.xml
-
-
-// File: dir_dbf2ee81eba2eb363262fc2ffa131006.xml
+// File: dir_92d4af779eea750d7e464f1256129e5e.xml
+
+
+// File: dir_0e5e0b86b41d9000573aadd072faa0dc.xml
+
+
+// File: dir_61626f8f8c8774eaa462b97af4c0a252.xml
+
+
+// File: dir_2cb12ea2104a8aec4b8dae08301d3209.xml
+
+
+// File: dir_d0df2a1ab10bb9fcd71ace3b2981978c.xml
+
+
+// File: dir_f7aa9f93aae02aa89e597f6f65a28147.xml
+
+
+// File: dir_2a2507e206f95ba5c74f6a3fc297b422.xml
+
+
+// File: dir_449565eb50e230200f96f6a0b17b6e07.xml
+
+
+// File: dir_0e7ac0b790142585bc3f28b27e1d693c.xml
+
+
+// File: dir_e5a30508e9aae611f47294df14ae6493.xml
+
+
+// File: dir_680935dbf4f91b75291f72a5f78bda78.xml
+
+
+// File: dir_226c3f7db0502d394c9c3450f0eef019.xml
+
+
+// File: dir_9e225bd197a6b3a6419f642327134d3a.xml
+
+
+// File: dir_6f9af259675e617b318bfa6ca6a38176.xml
+
+
+// File: dir_ff7823292883bd032ef3ce5f54c32d54.xml
+
+
+// File: dir_74e6714b2427c4debf2a5e534203887f.xml
 

=== modified file 'dolfin/swig/function_pre.i'
--- dolfin/swig/function_pre.i	2010-02-14 08:25:44 +0000
+++ dolfin/swig/function_pre.i	2010-02-23 20:33:27 +0000
@@ -7,9 +7,9 @@
 // Modified by Johan Hake, 2008-2009
 // Modified by Garth Wells, 2008-2009
 // Modified by Kent-Andre Mardal, 2009
-// 
+//
 // First added:  2007-08-16
-// Last changed: 2010-02-14
+// Last changed: 2010-02-23
 
 // ===========================================================================
 // SWIG directives for the DOLFIN function kernel module (pre)
@@ -37,7 +37,7 @@
 // Modifying the interface of Function
 //-----------------------------------------------------------------------------
 %ignore dolfin::Function::function_space;
-%rename (_function_space) dolfin::Function::function_space_ptr;
+%rename(_function_space) dolfin::Function::function_space_ptr;
 %rename(_sub) dolfin::Function::operator[];
 %rename(assign) dolfin::Function::operator=;
 %rename(_in) dolfin::Function::in;
@@ -46,6 +46,7 @@
 // Modifying the interface of FunctionSpace
 //-----------------------------------------------------------------------------
 %rename(sub) dolfin::FunctionSpace::operator[];
+%rename(_super_space) dolfin::FunctionSpace::super_space;
 %rename(assign) dolfin::FunctionSpace::operator=;
 
 //-----------------------------------------------------------------------------
@@ -70,12 +71,12 @@
 //-----------------------------------------------------------------------------
 // Turn off value wrapper for std::vector<dolfin::uint>
 //-----------------------------------------------------------------------------
-%feature("novaluewrapper") std::vector<dolfin::uint>; 
+%feature("novaluewrapper") std::vector<dolfin::uint>;
 
 //-----------------------------------------------------------------------------
 // Instantiate a dummy std::vector<dolfin::uint> so value wrapper is not used
 //-----------------------------------------------------------------------------
-%template () std::vector<dolfin::uint>; 
+%template () std::vector<dolfin::uint>;
 
 //-----------------------------------------------------------------------------
 // Typemap for std::vector<dolfin::uint> value_shape
@@ -88,7 +89,7 @@
 %typemap (in) std::vector<dolfin::uint> value_shape
 {
   if (PyList_Check($input))
-  {  
+  {
     PyObject * py_item = 0;
     int size = PyList_Size($input);
     int item = 0;
@@ -113,12 +114,12 @@
 //-----------------------------------------------------------------------------
 // Turn off value wrapper for std::vector<double>
 //-----------------------------------------------------------------------------
-%feature("novaluewrapper") std::vector<double>; 
+%feature("novaluewrapper") std::vector<double>;
 
 //-----------------------------------------------------------------------------
 // Instantiate a dummy std::vector<double> so value wrapper is not used
 //-----------------------------------------------------------------------------
-%template () std::vector<double>; 
+%template () std::vector<double>;
 
 //-----------------------------------------------------------------------------
 // Typemap for std::vector<double> values
@@ -131,7 +132,7 @@
 %typemap (in) std::vector<double> values
 {
   if (PyList_Check($input))
-  {  
+  {
     PyObject * py_item = 0;
     int size = PyList_Size($input);
     double item = 0;

=== modified file 'site-packages/dolfin/function/functionspace.py'
--- site-packages/dolfin/function/functionspace.py	2010-02-23 19:46:13 +0000
+++ site-packages/dolfin/function/functionspace.py	2010-02-23 20:33:27 +0000
@@ -96,6 +96,10 @@
         element = self._ufl_element.sub_elements()[i]
         return FunctionSpaceFromCpp(cpp.SubSpace(self,i), element)
 
+    def super_space(self):
+        "Return super space of sub element."
+        return FunctionSpaceFromCpp(self._super_space())
+
 class FunctionSpaceFromCpp(FunctionSpaceBase):
     " FunctionSpace represents a finite element function space."
     def __init__(self, cppV, element=None):


--- End Message ---

Attachment: signature.asc
Description: Digital signature


Follow ups