Skip to content

Commit 414c42d

Browse files
authored
Merge pull request #122 from ToFuProject/devel
Prepare 0.0.26
2 parents 6a52ea8 + 6dfe14b commit 414c42d

File tree

10 files changed

+1256
-74
lines changed

10 files changed

+1256
-74
lines changed

.github/workflows/python-testing-matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
# Run tests
3939
- name: Run tests
4040
# For example, using `pytest`
41-
run: uv run pytest bsplines2d/tests
41+
run: uv run pytest bsplines2d/tests -v -x

bsplines2d/_class01_Mesh2D.py

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from . import _class01_cropping as _cropping
1717
from . import _class01_select as _select
1818
from . import _class01_sample as _sample
19+
from . import _class01_sample3d as _sample3d
20+
from . import _class01_slice3d as _slice3d
1921
from . import _class01_outline as _outline
2022
from . import _class01_plot as _plot
2123

@@ -513,6 +515,83 @@ def get_sample_mesh(
513515
kx1=kx1,
514516
)
515517

518+
def get_sample_mesh_3d_func(
519+
self,
520+
key=None,
521+
res_RZ=None,
522+
mode=None,
523+
res_phi=None,
524+
):
525+
""" Return 2 functions
526+
527+
Used for vos computation
528+
529+
func_RZphi_from_ind(ind)
530+
where in = (3, npts) indices of a 3d sampled mesh
531+
return R, Z, phi
532+
533+
func_ind_from_domain(DR, DZ, Dphi, pcross, phor)
534+
where DR, DZ, Dphi define a rectangular domain (optional)
535+
where (pcross0, pcross1) and (phor0, phor1) define ploygons
536+
return ind (to be used by func_RZphi_from_ind)
537+
538+
"""
539+
540+
return _sample3d.main(
541+
coll=self,
542+
key=key,
543+
res_RZ=res_RZ,
544+
mode=mode,
545+
res_phi=res_phi,
546+
)
547+
548+
def get_sample_mesh_3d_slice(
549+
self,
550+
key=None,
551+
res=None,
552+
# slice
553+
phi=None,
554+
Z=None,
555+
# domain
556+
DR=None,
557+
DZ=None,
558+
Dphi=None,
559+
# option
560+
reshape_2d=None,
561+
# plot
562+
plot=None,
563+
dax=None,
564+
color=None,
565+
):
566+
""" Return a dict continaing pts coordinates on a plane (slice)
567+
568+
Slice can be either horizontal (Z) or poloidal (phi)
569+
570+
A subset of the mesh can be defined using:
571+
- horizontal: DR and Dphi
572+
- poloidal: DR and DZ
573+
574+
"""
575+
576+
return _slice3d.main(
577+
coll=self,
578+
key=key,
579+
res=res,
580+
# slice
581+
phi=phi,
582+
Z=Z,
583+
# domain
584+
DR=DR,
585+
DZ=DZ,
586+
Dphi=Dphi,
587+
# option
588+
reshape_2d=reshape_2d,
589+
# plot
590+
plot=plot,
591+
dax=dax,
592+
color=color,
593+
)
594+
516595
# -----------------
517596
# outline
518597
# ------------------
@@ -561,4 +640,4 @@ def plot_mesh(
561640
fs=fs,
562641
dleg=dleg,
563642
connect=connect,
564-
)
643+
)

bsplines2d/_class01_sample.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
from . import _generic_mesh
1212

1313

14-
# ##############################################################
15-
# ##############################################################
16-
# Main
17-
# ##############################################################
14+
# ######################################################
15+
# ######################################################
16+
# Main
17+
# ######################################################
1818

1919

2020
def sample_mesh(
@@ -151,10 +151,10 @@ def sample_mesh(
151151
return ddata
152152

153153

154-
# ##################################################################
155-
# ##################################################################
156-
# checks
157-
# ##################################################################
154+
# ##########################################################
155+
# ##########################################################
156+
# checks
157+
# ##########################################################
158158

159159

160160
def _check(
@@ -500,10 +500,10 @@ def _sample_1d(
500500
return xx
501501

502502

503-
# ##################################################################
504-
# ##################################################################
505-
# sample 2d
506-
# ##################################################################
503+
# #########################################################
504+
# #########################################################
505+
# sample 2d
506+
# #########################################################
507507

508508

509509
def _sample_2d(
@@ -767,4 +767,4 @@ def _store(coll=None, dref=None, ddata=None):
767767

768768
# ddata
769769
for k0, v0 in ddata.items():
770-
coll.add_data(**v0)
770+
coll.add_data(**v0)

0 commit comments

Comments
 (0)