@@ -16,8 +16,7 @@ specfem::assembly::element_types<specfem::dimension::type::dim3>::element_types(
1616 }
1717
1818 FOR_EACH_IN_PRODUCT (
19- (DIMENSION_TAG (DIM3), MEDIUM_TAG (ELASTIC), PROPERTY_TAG (ISOTROPIC),
20- BOUNDARY_TAG (NONE)),
19+ (DIMENSION_TAG (DIM3), MEDIUM_TAG (ELASTIC)),
2120 CAPTURE (elements, h_elements) {
2221 int count = 0 ;
2322 int index = 0 ;
@@ -38,13 +37,109 @@ specfem::assembly::element_types<specfem::dimension::type::dim3>::element_types(
3837 Kokkos::deep_copy (_elements_, _h_elements_);
3938 })
4039
40+ FOR_EACH_IN_PRODUCT (
41+ (DIMENSION_TAG (DIM3), MEDIUM_TAG (ELASTIC), PROPERTY_TAG (ISOTROPIC)),
42+ CAPTURE (elements, h_elements) {
43+ int count = 0 ;
44+ int index = 0 ;
45+
46+ for (int ispec = 0 ; ispec < nspec; ispec++) {
47+ if (medium_tags (ispec) == _medium_tag_ &&
48+ property_tags (ispec) == _property_tag_) {
49+ count++;
50+ }
51+ }
52+
53+ _elements_ =
54+ IndexViewType (" specfem::assembly::element_types::elements" , count);
55+ _h_elements_ = Kokkos::create_mirror_view (_elements_);
56+
57+ for (int ispec = 0 ; ispec < nspec; ispec++) {
58+ if (medium_tags (ispec) == _medium_tag_ &&
59+ property_tags (ispec) == _property_tag_) {
60+ _h_elements_ (index) = ispec;
61+ index++;
62+ }
63+ }
64+
65+ Kokkos::deep_copy (_elements_, _h_elements_);
66+ })
67+
4168 FOR_EACH_IN_PRODUCT (
4269 (DIMENSION_TAG (DIM3), MEDIUM_TAG (ELASTIC), PROPERTY_TAG (ISOTROPIC),
4370 BOUNDARY_TAG (NONE)),
4471 CAPTURE (elements, h_elements) {
4572 int count = 0 ;
4673 int index = 0 ;
4774
75+ for (int ispec = 0 ; ispec < nspec; ispec++) {
76+ if (medium_tags (ispec) == _medium_tag_ &&
77+ property_tags (ispec) == _property_tag_ &&
78+ boundary_tags (ispec) == _boundary_tag_) {
79+ count++;
80+ }
81+ }
82+
83+ _elements_ =
84+ IndexViewType (" specfem::assembly::element_types::elements" , count);
85+ _h_elements_ = Kokkos::create_mirror_view (_elements_);
86+
87+ for (int ispec = 0 ; ispec < nspec; ispec++) {
88+ if (medium_tags (ispec) == _medium_tag_ &&
89+ property_tags (ispec) == _property_tag_ &&
90+ boundary_tags (ispec) == _boundary_tag_) {
91+ _h_elements_ (index) = ispec;
92+ index++;
93+ }
94+ }
95+
96+ Kokkos::deep_copy (_elements_, _h_elements_);
97+ })
98+ }
99+
100+ specfem::assembly::element_types<specfem::dimension::type::dim3>::element_types(
101+ const int nspec, const int ngllz, const int nglly, const int ngllx,
102+ const specfem::assembly::mesh<specfem::dimension::type::dim3> &mesh,
103+ const specfem::mesh::meshfem3d::tags<specfem::dimension::type::dim3> &tags)
104+ : nspec(nspec),
105+ medium_tags (" specfem::assembly::element_types::medium_tags" , nspec),
106+ property_tags(" specfem::assembly::element_types::property_tags" , nspec),
107+ boundary_tags(" specfem::assembly::element_types::boundary_tags" , nspec) {
108+
109+ for (int ispec = 0 ; ispec < nspec; ispec++) {
110+ medium_tags (ispec) = tags.tags_container (ispec).medium_tag ;
111+ property_tags (ispec) = tags.tags_container (ispec).property_tag ;
112+ boundary_tags (ispec) = tags.tags_container (ispec).boundary_tag ;
113+ }
114+
115+ FOR_EACH_IN_PRODUCT (
116+ (DIMENSION_TAG (DIM3), MEDIUM_TAG (ELASTIC)),
117+ CAPTURE (elements, h_elements) {
118+ int count = 0 ;
119+ int index = 0 ;
120+ for (int ispec = 0 ; ispec < nspec; ispec++) {
121+ if (medium_tags (ispec) == _medium_tag_) {
122+ count++;
123+ }
124+ }
125+ _elements_ =
126+ IndexViewType (" specfem::assembly::element_types::elements" , count);
127+ _h_elements_ = Kokkos::create_mirror_view (_elements_);
128+ for (int ispec = 0 ; ispec < nspec; ispec++) {
129+ if (medium_tags (ispec) == _medium_tag_) {
130+ _h_elements_ (index) = ispec;
131+ index++;
132+ }
133+ }
134+ Kokkos::deep_copy (_elements_, _h_elements_);
135+ })
136+
137+ FOR_EACH_IN_PRODUCT (
138+ (DIMENSION_TAG (DIM3), MEDIUM_TAG (ELASTIC), PROPERTY_TAG (ISOTROPIC)),
139+ CAPTURE (elements, h_elements) {
140+ int count = 0 ;
141+ int index = 0 ;
142+
48143 for (int ispec = 0 ; ispec < nspec; ispec++) {
49144 if (medium_tags (ispec) == _medium_tag_ &&
50145 property_tags (ispec) == _property_tag_) {
0 commit comments