Implementing a SubDomain function that returns the domain id instead of bool

Registered by Martin Sandve Aln├Žs

Garth says:
"I would like to change SubDomain::inside to return an integer which
would make it possible to create multiple subdomains with just one
loop over the mesh."

If it returns an int, "inside" is not a good name, and lots of existing code will break, so maybe it's better to introduce a new function?

Pseudocode of the different aspects here:

class SubDomain
{
public:
  virtual bool inside(x, ...) { throw notimplemented(); }
  virtual bool domain_id(x, ...); { throw notimplemented(); }
};

class MyDomain1(SubDomain):
    def inside(self, x, ...):
        return True

class MyDomain2(SubDomain):
    def domain_id(self, x, ...):
        return 3

Then old code keeps working and new code can just implement the other function.

And by overloading mark() signatures we can simply do:

MyDomain1().mark(meshfunction, 3) # Id given, using inside()
MyDomain2().mark(meshfunction) # No id given, using domain_id()

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.