In [28]:
from dolfin import *
import numpy
nn = 2
mesh = UnitCubeMesh(int(nn),int(nn),int(nn))
order = 1
parameters['reorder_dofs_serial'] = False
Magnetic = FunctionSpace(mesh, "N1curl", order)
Lagrange = FunctionSpace(mesh, "CG", order)
print Magnetic.dim()

def boundary(x, on_boundary):
        return on_boundary
W = Magnetic*Lagrange
# bcW = DirichletBC(W.sub(0),Expression(("1.0","1.0","1.0")), boundary)
# bcuW = DirichletBC(W.sub(1), Expression(("1.0")), boundary)


DEBUG:UFL:No integrals left after transformation, returning empty form.
DEBUG:FFC:Reusing form from cache.
DEBUG:UFL:No integrals left after transformation, returning empty form.
DEBUG:FFC:Reusing form from cache.
DEBUG:UFL:No integrals left after transformation, returning empty form.
DEBUG:FFC:Reusing form from cache.
16

In [52]:
a = mesh.bounding_box_tree()
B = BoundaryMesh(Magnetic.mesh(),"exterior",False)
B = numpy.sort(B.entity_map(0).array().astype("float_","C"))

In [40]:
v = Vertex(mesh, 3)

In [61]:
data = mesh.data()

In [63]:
data.array("facet_orientation",0)


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-63-05ed6cbbe53d> in <module>()
----> 1 data.array("facet_orientation",0)

RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics@fenicsproject.org
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to access mesh data.
*** Reason:  Mesh data array named "facet_orientation" does not exist.
*** Where:   This error was encountered inside MeshData.cpp.
*** Process: unknown
*** 
*** DOLFIN version: 1.4.0
*** Git changeset:  
*** -------------------------------------------------------------------------

In [53]:
j = 0
for vert in vertices(mesh):
        if vert.index() == B[j]:
            print "boundary"
            j = j+1
        else:
            print "\nvert", vert.index()
            print vert.entities(1)
            for edge in edges(vert):
                j = j+1
                print j
                print "   edge", edge.index()
Ve


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-53-0dcb13513cef> in <module>()
      1 j = 0
      2 for vert in vertices(mesh):
----> 3         if vert.index() == B[j]:
      4             print "boundary"
      5             j = j+1

IndexError: index out of bounds
boundary
boundary
boundary
boundary

vert 4
[]
5
   edge 0
6
   edge 1
7
   edge 3
8
   edge 8
9
   edge 9
10
   edge 14

In [36]:



---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-36-525d187a2b0a> in <module>()
----> 1 dof_to_vertex_map(Magnetic)

/home/mwathen/WorkFuckingWork/FEniCS/lib/python2.7/site-packages/dolfin/cpp/fem.pyc in dof_to_vertex_map(*args)
    687 
    688     """
--> 689   return _fem.dof_to_vertex_map(*args)
    690 
    691 def vertex_to_dof_map(*args):

RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics@fenicsproject.org
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to tabulate dof to vertex map.
*** Reason:  Can only tabulate dofs on vertices.
*** Where:   This error was encountered inside DofMap.cpp.
*** Process: unknown
*** 
*** DOLFIN version: 1.4.0
*** Git changeset:  
*** -------------------------------------------------------------------------

In [54]:
boundary_parts = MeshFunction("uint", mesh, mesh.topology().dim()-1)

In [57]:
boundary_parts.


Out[57]:
120

In [59]:
SystemAssembler?

In [24]:
bcW = DirichletBC(Magnetic,Expression(("1.0","1.0","1.0")), boundary)
bcW.get_boundary_values()
bcW.markers()


Out[24]:
array([  3,   6,   9,  12,  15,  17,  18,  21,  22,  24,  27,  30,  37,
        42,  44,  47,  48,  49,  50,  53,  54,  58,  60,  63,  69,  70,
        72,  75,  77,  79,  80,  83,  85,  86,  88,  91,  99, 101, 103,
       105, 106, 107, 108, 111, 113, 115, 117, 119], dtype=uint64)

In [16]:
B.keys()
intlist = [str(x) for x in B.keys()]

In [21]:
import numpy
x= numpy.array(intlist)
y = x.astype("float_","C")

In [22]:
y


Out[22]:
array([  2.,   4.,   5.,   7.,   8.,  10.,  11.,  13.,  14.,  16.,  17.,
        18.,  19.,  20.,  21.,  23.,  24.,  25.,  26.,  27.,  29.,  31.,
        33.,  35.,  37.,  40.,  41.,  42.,  43.,  44.,  45.,  46.,  47.,
        48.,  49.,  51.,  52.,  54.,  55.,  56.,  60.,  61.,  62.,  63.,
        64.,  65.,  67.,  68.,  69.,  70.,  71.,  72.,  74.,  75.,  76.,
        77.,  78.,  80.,  81.,  84.,  85.,  86.,  87.,  88.,  89.,  90.,
        91.,  92.,  94.,  95.,  96.,  97.])