phiFEM 0.7.1.dev1__py3-none-any.whl → 0.7.2.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
phifem/mesh_scripts.py CHANGED
@@ -135,15 +135,14 @@ def _compute_detection_vector(
135
135
 
136
136
 
137
137
  def _compute_integration_entities(
138
- mesh: Mesh, integration_cells: list[int], integration_facets: list[int], ind: int
139
- ) -> ufl.Measure:
138
+ mesh: Mesh, integration_cells: list[int], integration_facets: list[int]
139
+ ) -> list[int]:
140
140
  """Compute the integration entities in order to build a one-sided integral over a set of given edges. This script is inspired from https://github.com/jorgensd/dolfinx-tutorial/issues/158.
141
141
 
142
142
  Args:
143
143
  mesh: the mesh on which we compute the measure.
144
144
  integration_cells: list of cells indices from which the integral is computed.
145
145
  integration_facets: list of facets indices on which the integral is computed.
146
- ind: index used in the measure.
147
146
  Returns: the integration entities.
148
147
  """
149
148
  cdim = mesh.topology.dim
@@ -189,7 +188,7 @@ def _compute_integration_entities(
189
188
  np.column_stack((right_side_cells_rep, local_indices))
190
189
  ).astype(np.int32)
191
190
 
192
- return [(ind, integration_entities)]
191
+ return integration_entities
193
192
 
194
193
 
195
194
  def _reshape_map(connect: AdjacencyList_int32) -> npt.NDArray[np.int32]:
@@ -610,7 +609,7 @@ def compute_tags_measures(
610
609
  cells_tags = _overwrite_tags(mesh, cells_tags, ow_cells_tags)
611
610
  if "facets" in overwrite_tags.keys():
612
611
  ow_facets_tags = overwrite_tags["facets"]
613
- if np.any(np.isin([1, 2, 3, 4, 5, 6, 100, 101], ow_facets_tags.values)):
612
+ if np.any(np.isin([1, 2, 3, 4, 5, 6], ow_facets_tags.values)):
614
613
  raise ValueError("Cannot overwrite facets tags with values 1, 2, 3, 4, 5, 6, 100 or 101.")
615
614
  facets_tags = _overwrite_tags(mesh, facets_tags, ow_facets_tags)
616
615
 
@@ -618,15 +617,35 @@ def compute_tags_measures(
618
617
  submesh = None
619
618
  integration_cells = np.union1d(cells_tags.find(2), cells_tags.find(1))
620
619
  integration_entities_outside = _compute_integration_entities(
621
- mesh, integration_cells, facets_tags.find(4), 100
622
- )
620
+ mesh, integration_cells, facets_tags.find(4))
621
+ integration_entities_outside = [(100, integration_entities_outside)]
623
622
  integration_cells = np.union1d(cells_tags.find(2), cells_tags.find(3))
624
623
  integration_entities_inside = _compute_integration_entities(
625
- mesh, integration_cells, facets_tags.find(3), 101
626
- )
627
- combined_integration_entities = (
628
- integration_entities_outside + integration_entities_inside
629
- )
624
+ mesh, integration_cells, facets_tags.find(3))
625
+ integration_entities_inside = [(101, integration_entities_inside)]
626
+ combined_integration_entities = integration_entities_outside + integration_entities_inside
627
+
628
+ non_phifem_mask = ~np.isin(facets_tags.values, [1, 2, 3, 4, 5, 6])
629
+ fdim = facets_tags.dim
630
+ boundary_facets = dfx.mesh.locate_entities_boundary(mesh, fdim, lambda x: np.ones_like(x[0]).astype(bool))
631
+ non_phifem_facets_bdy = np.isin(facets_tags.indices, boundary_facets)
632
+ non_phifem_mask *= non_phifem_facets_bdy
633
+ non_phifem_facets_ind = np.arange(len(facets_tags.indices))[non_phifem_mask]
634
+ non_phifem_facets = facets_tags.indices[non_phifem_facets_ind]
635
+ non_phifem_facets_tags = np.unique(facets_tags.values[non_phifem_facets_ind])
636
+
637
+ for tag in non_phifem_facets_tags:
638
+ cdim = mesh.topology.dim
639
+ fdim = cdim - 1
640
+ mesh.topology.create_connectivity(fdim, cdim)
641
+ f2c_connect = mesh.topology.connectivity(fdim, cdim)
642
+ f2c_map = _reshape_map(f2c_connect)[0]
643
+
644
+ non_phifem_facets_cells = f2c_map[non_phifem_facets]
645
+
646
+ assert len(non_phifem_facets_cells) == len(non_phifem_facets)
647
+
648
+ combined_integration_entities += [(tag, _compute_integration_entities(mesh, non_phifem_facets_cells, facets_tags.find(tag)))]
630
649
 
631
650
  boundaries_measure = ufl.Measure(
632
651
  "ds", domain=mesh, subdomain_data=combined_integration_entities
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: phiFEM
3
- Version: 0.7.1.dev1
3
+ Version: 0.7.2.dev1
4
4
  Summary: phiFEM: convenience tools to use the phiFEM immersed boundary finite element method with dolfinx.
5
5
  Project-URL: Homepage, https://github.com/PhiFEM/phiFEM
6
6
  Project-URL: Issues, https://github.com/PhiFEM/phiFEM/issues
@@ -0,0 +1,7 @@
1
+ phifem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ phifem/mesh_scripts.py,sha256=NSciUpSeABNaZAHdihEI4yUqYZGSFk-NvjuRkSUqrhk,26963
3
+ phifem-0.7.2.dev1.dist-info/METADATA,sha256=M_YPSSUAxI-OOC8n4YM2Ld7AnHfnkx3QtlK9qBJ-K4g,5603
4
+ phifem-0.7.2.dev1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
5
+ phifem-0.7.2.dev1.dist-info/licenses/COPYING,sha256=xTplwv1WHIfqq_EHLvXcq4ZTBCvBUwhGX1JBNYXrYnE,35146
6
+ phifem-0.7.2.dev1.dist-info/licenses/COPYING.lesser,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
7
+ phifem-0.7.2.dev1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.30.1
2
+ Generator: hatchling 1.32.4
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,7 +0,0 @@
1
- phifem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- phifem/mesh_scripts.py,sha256=mFbgpjs3tAmMOdMQYZCXICh91YIcwhKjE5lXmEUIcWw,25772
3
- phifem-0.7.1.dev1.dist-info/METADATA,sha256=9-pTFrhjCVyvyK25xFdzNOS8jeD1IgYGpf6N2OI9GqU,5603
4
- phifem-0.7.1.dev1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
5
- phifem-0.7.1.dev1.dist-info/licenses/COPYING,sha256=xTplwv1WHIfqq_EHLvXcq4ZTBCvBUwhGX1JBNYXrYnE,35146
6
- phifem-0.7.1.dev1.dist-info/licenses/COPYING.lesser,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
7
- phifem-0.7.1.dev1.dist-info/RECORD,,