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
81 changes: 80 additions & 1 deletion bsplines2d/_class01_Mesh2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from . import _class01_cropping as _cropping
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 @@ -513,6 +515,83 @@ def get_sample_mesh(
kx1=kx1,
)

def get_sample_mesh_3d_func(
self,
key=None,
res_RZ=None,
mode=None,
res_phi=None,
):
""" Return 2 functions

Used for vos computation

func_RZphi_from_ind(ind)
where in = (3, npts) indices of a 3d sampled mesh
return R, Z, phi

func_ind_from_domain(DR, DZ, Dphi, pcross, phor)
where DR, DZ, Dphi define a rectangular domain (optional)
where (pcross0, pcross1) and (phor0, phor1) define ploygons
return ind (to be used by func_RZphi_from_ind)

"""

return _sample3d.main(
coll=self,
key=key,
res_RZ=res_RZ,
mode=mode,
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 Expand Up @@ -561,4 +640,4 @@ def plot_mesh(
fs=fs,
dleg=dleg,
connect=connect,
)
)
26 changes: 13 additions & 13 deletions bsplines2d/_class01_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
from . import _generic_mesh


# ##############################################################
# ##############################################################
# Main
# ##############################################################
# ######################################################
# ######################################################
# Main
# ######################################################


def sample_mesh(
Expand Down Expand Up @@ -151,10 +151,10 @@ def sample_mesh(
return ddata


# ##################################################################
# ##################################################################
# checks
# ##################################################################
# ##########################################################
# ##########################################################
# checks
# ##########################################################


def _check(
Expand Down Expand Up @@ -500,10 +500,10 @@ def _sample_1d(
return xx


# ##################################################################
# ##################################################################
# sample 2d
# ##################################################################
# #########################################################
# #########################################################
# sample 2d
# #########################################################


def _sample_2d(
Expand Down Expand Up @@ -767,4 +767,4 @@ def _store(coll=None, dref=None, ddata=None):

# ddata
for k0, v0 in ddata.items():
coll.add_data(**v0)
coll.add_data(**v0)
Loading
Loading