Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-testing-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
# Run tests
- name: Run tests
# For example, using `pytest`
run: uv run pytest bsplines2d/tests
run: uv run pytest bsplines2d/tests -v -x
48 changes: 48 additions & 0 deletions bsplines2d/_class01_Mesh2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from . import _class01_select as _select
from . import _class01_sample as _sample
from . import _class01_sample3d as _sample3d
from . import _class01_slice3d as _slice3d
from . import _class01_outline as _outline
from . import _class01_plot as _plot

Expand Down Expand Up @@ -544,6 +545,53 @@ def get_sample_mesh_3d_func(
res_phi=res_phi,
)

def get_sample_mesh_3d_slice(
self,
key=None,
res=None,
# slice
phi=None,
Z=None,
# domain
DR=None,
DZ=None,
Dphi=None,
# option
reshape_2d=None,
# plot
plot=None,
dax=None,
color=None,
):
""" Return a dict continaing pts coordinates on a plane (slice)

Slice can be either horizontal (Z) or poloidal (phi)

A subset of the mesh can be defined using:
- horizontal: DR and Dphi
- poloidal: DR and DZ

"""

return _slice3d.main(
coll=self,
key=key,
res=res,
# slice
phi=phi,
Z=Z,
# domain
DR=DR,
DZ=DZ,
Dphi=Dphi,
# option
reshape_2d=reshape_2d,
# plot
plot=plot,
dax=dax,
color=color,
)

# -----------------
# outline
# ------------------
Expand Down
7 changes: 5 additions & 2 deletions bsplines2d/_class01_sample3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,8 @@ def func(
)[0]
else:
iphi = np.nonzero(
(phii >= Dphi[1]) | (phii <= Dphi[0])
(phii >= Dphi[0]) | (phii <= Dphi[1])
)[0]

elif phor0 is not None:
phii = np.pi*np.linspace(-1, 1, nphi[iri])
pts = np.array([
Expand Down Expand Up @@ -490,5 +489,9 @@ def _check_domain(
size=2,
dtype=float,
)
Dphi = [
np.arctan2(np.sin(Dphi[0]), np.cos(Dphi[0])),
np.arctan2(np.sin(Dphi[1]), np.cos(Dphi[1])),
]

return DR, DZ, Dphi
Loading
Loading