How to get the Function space from the Data object

Asked by hhh_Chen

Hi everyone,

Can I get the Function space from the Data object representing the same region in one geometry. For example, I get the Data object region y>2. from

x=Function(mydomain).getX()
region=wherePositive(x[1]-2.)

How can I get the Function space of y>2. from region?

Question information

Language:
English Edit question
Status:
Solved
For:
esys-escript Edit question
Assignee:
No assignee Edit question
Solved by:
Lutz Gross
Solved:
Last query:
Last reply:
Revision history for this message
Lutz Gross (l-gross) said :
#1

I am not sure I understand your question correctly but you can get the associated function space by

    region.getFunctionSpace()

As function space is passed through expression on you should have

    assert region.getFunctionSpace() == Function(mydomain)

Revision history for this message
hhh_Chen (chenlifan) said :
#2
Revision history for this message
hhh_Chen (chenlifan) said :
#3

Thanks, Lutz Gross.

I have tried the expression before

region.getFunctionSpace().getX().toListOfTuples()

but it returns the whole function space of mydomain instead of the one y>2. Is it possible to get the function space of y>2. by an expression with region?

Revision history for this message
Best Lutz Gross (l-gross) said :
#4

In first instance the term 'function space' refers to a way values are stored not to a certain spatial region. I need to admit that the name is a bit misleading. Hence region.getFunctionSpace() return the same function space as x.getFunctionSpace().
The best way to deal with this subregion depends on what you want to do. If you solve a PDE you can just black the y>=2. region using q.

Revision history for this message
hhh_Chen (chenlifan) said :
#5

Thanks Lutz Gross, that solved my question.