This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

translating a portion of python fenics code in c++

–8 votes

Dear all users

I wonder if you can help me in translating this portin of python code in dolfin to C++ version.

// Python code with fenics
...
mesh = UnitSquareMesh(20,20,"crossed")

Omega = Vector (2)
for i in range(0,2):
Omega[i] += 1.0*i+1.0

boundary_markers = FacetFunction("uint", mesh)
boundary_markers.set_all(0)
for facet in facets(mesh):
p = facet.normal()
value = (Omega[0]p[0]+Omega[1]p[1])
if (value < 0):
#print ' Inflow ', value
boundary_markers[facet] = 1

// C++ code ? The porblem ins in the for loops on fecets(mesh) and how to get p = facet.normal() in c++

Thanks for your help

closed with the note: Questions should be specific and demonstrate a degree of investigation by the asker. Asking others to write your code is not an appropriate question.
asked Aug 21, 2013 by ofbalima (90 points)
closed Aug 21, 2013 by Garth N. Wells
...