Dolfin Cell from ufc_cell

Asked by Jehanzeb

Hi,

In my python code, I need access to the cell size (say, circumradius, largest length or something similar). I am doing the following:

class my_func(Expression):
    def __init__(self,mesh):
        self.mesh = mesh

    def eval_cell(self, values, x, ufc_cell):
       dolfin_cell = Cell(self.mesh, ufc_cell.index)
        print dolfin_cell.diameter()
        values[0] = 0

Is this the right way to do it? I am concerned that the ufc_cell.index may not equate to the index of the dolfin cell in the mesh. Secondly, I am not sure what diameter() gives me. Is the diameter of the circumcircle?

Thanks,
-Jehanzeb

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Garth Wells
Solved:
Last query:
Last reply:
Revision history for this message
Best Garth Wells (garth-wells) said :
#1

On Fri, Dec 14, 2012 at 8:05 PM, Jehanzeb
<email address hidden> wrote:
> New question #216832 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/216832
>
> Hi,
>
> In my python code, I need access to the cell size (say, circumradius, largest length or something similar). I am doing the following:
>
> class my_func(Expression):
> def __init__(self,mesh):
> self.mesh = mesh
>
> def eval_cell(self, values, x, ufc_cell):
> dolfin_cell = Cell(self.mesh, ufc_cell.index)
> print dolfin_cell.diameter()
> values[0] = 0
>
>
> Is this the right way to do it?

Yes.

I am concerned that the ufc_cell.index may not equate to the index of
the dolfin cell in the mesh. Secondly, I am not sure what diameter()
gives me. Is the diameter of the circumcircle?
>

2*circumradius

Garth

> Thanks,
> -Jehanzeb
>
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.

Revision history for this message
Jehanzeb (jehanzebh) said :
#2

Thanks.

Revision history for this message
Jehanzeb (jehanzebh) said :
#3

Thanks Garth Wells, that solved my question.