Hi Corbin,

To add to Daniel's suggestion, you could also associated some generic data structures to your cell that you could store the multi-material id data in, and query it as you like. I can think of three different ways to do this:

1. Directly attach your data structure to each cell's user pointer. See the TriaAccessor::set_user_pointer() <https://dealii.org/current/doxygen/deal.II/classTriaAccessor.html#aceaaa0940be75dd7436769b55538aaac> function and the other functions related to the user_pointer. Step-18 <https://dealii.org/developer/doxygen/deal.II/step_18.html#TopLevelsetup_quadrature_point_history> uses the cell user pointer to store quadrature point data. 2. Create a map between the CellID <https://dealii.org/current/doxygen/deal.II/classCellId.html> and your data structure, e.g. std::map<CellID, std::vector<types::material_id>> 3. In the same spirit as suggestion (2), you can use the CellDataStorage <https://www.dealii.org/current/doxygen/deal.II/classCellDataStorage.html> class to associate cell iterators with some generic data. Step-44 <https://dealii.org/developer/doxygen/deal.II/step_44.html#Solidsetup_qph> leverages this class to store quadrature point data.

I hope that this help you achieve what you're trying to do.

Best,
Jean-Paul

On 08.02.21 02:06, Daniel Arndt wrote:
Corbin,

if you have a maximal range for either of the two material ranges you could just compute a single material ID by
material_id   = material_id1 * max_material_id2 + material_id2
material_id2 = material_id % max_material_id2
material_id1 = material_id / max_material_id2

Best,
Daniel

Am So., 7. Feb. 2021 um 17:23 Uhr schrieb Corbin Foucart <corbin.fouc...@gmail.com <mailto:corbin.fouc...@gmail.com>>:

    Hello all,

    I've read the documentation on material ID and it's not clear to
    me if there's a way to define more than one material ID. This
    could be helpful when wanting to isolate elements that correspond
    to the same material, but also when looking to isolate elements of
    different materials that might exist in a particular "layer" of
    the domain.

    I can see three ways to define multiple IDs per each element:

     1. Define two identical meshes and set the material IDs
        differently on each. This seems suboptimal because I don't
        really want to use up the extra memory
     2. Define functions that re-label the material IDs based on the
        current task at hand, at the expense of extra computation and
        logic
     3. Define an external vector of structs that contain the
        different element IDs by cell, but then it's unclear how to
        filter elements by MaterialIDEqualTo() without first
        relabeling as in (2)

    Is there a standard way to do this that I'm missing? Any advice is
    much appreciated!

    Best,
    Corbin

-- The deal.II project is located at http://www.dealii.org/
    <http://www.dealii.org/>
    For mailing list/forum options, see
    https://groups.google.com/d/forum/dealii?hl=en
    <https://groups.google.com/d/forum/dealii?hl=en>
    ---
    You received this message because you are subscribed to the Google
    Groups "deal.II User Group" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to dealii+unsubscr...@googlegroups.com
    <mailto:dealii+unsubscr...@googlegroups.com>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/dealii/a66dcb53-8a6b-46ce-8c29-90067829a0a3n%40googlegroups.com
    
<https://groups.google.com/d/msgid/dealii/a66dcb53-8a6b-46ce-8c29-90067829a0a3n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
The deal.II project is located at http://www.dealii.org/ <http://www.dealii.org/> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en <https://groups.google.com/d/forum/dealii?hl=en>
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com <mailto:dealii+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAOYDWb%2B_k%3DyZ%2BOuEp55VxxzjFRscq1U3QUC5qKSn2RRkd6oATQ%40mail.gmail.com <https://groups.google.com/d/msgid/dealii/CAOYDWb%2B_k%3DyZ%2BOuEp55VxxzjFRscq1U3QUC5qKSn2RRkd6oATQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/7bf57952-fb0c-7759-11a8-be90215fd7f8%40gmail.com.

Reply via email to