python Code translation to C++

Asked by Olivier Balima

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

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Johannes Ring (johannr) said :
#1

FEniCS no longer uses Launchpad for Questions & Answers. Please consult the documentation on the FEniCS web page for where and how to (re)post your question: http://fenicsproject.org/support/

Can you help with this problem?

Provide an answer of your own, or ask Olivier Balima for more information if necessary.

To post a message you must log in.