On Wed, 28 Jun 2017, John Peterson wrote:

On Wed, Jun 28, 2017 at 9:36 AM, Harshad Sahasrabudhe <hsaha...@purdue.edu>
wrote:

I would like to create a submesh of my mesh inside a particular region.
Since the UnstructuredMesh::create_submesh method uses a
const_element_iterator on the old mesh to create a new mesh, I would like
to create a new single_predicate which identifies elements that lie inside
the region of interest. What is the process by which I can create a new
predicate and a new element iterator? Will this method work for
create_submesh function?

You might not need to define a new type of iterator at all. For example, if
you could first mark the elements in your region of interest with a
specific subdomain id, then you could just use the
existing active_subdomain_elements_begin/end iterators in the call to
create_submesh().

The most recent mesh iterator was in added in d7a08b2f, so you should be
able to use that commit for inspiration... but I would say that it's not
super straightforward to do.

It's also really only appropriate for iterator predicates which would
be of wide general use.

It would be quite useful to be able to instead create a range of
iterators with any arbitrary one-off user-supplied predicate the user
wants.  Super-useful if the user could assign a lambda function for
their predicate.  We can't do that at the moment (except for an ugly
trick for a special case; see "fake_elem_it" in sparsity_pattern.C)
but it might not be too hard to add.
---
Roy

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to