Skip to content

Commit

Permalink
Merge branch 'master' into bug/config
Browse files Browse the repository at this point in the history
  • Loading branch information
anseramosfe authored Dec 13, 2023
2 parents d8f4e34 + 790a062 commit 0f85574
Show file tree
Hide file tree
Showing 43 changed files with 666 additions and 198 deletions.
46 changes: 39 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}

pick_server_suffix:
runs-on: ubuntu-latest
outputs:
suffix: ${{ steps.step1.outputs.suffix }}
steps:
- id: step1
name: Define server branch suffix to use
run: |
if ${{ github.event_name == 'push' }}; then
echo "suffix=" >> "$GITHUB_OUTPUT"
elif ${{ github.event_name == 'workflow_dispatch' }}; then
echo "suffix=${{ github.event.inputs.standalone_branch_suffix }}" >> "$GITHUB_OUTPUT"
elif ${{ github.event_name == 'pull_request' }}; then
# If the PR is server-sync then extract suffix from branch name
sub='maint/update_code_for_'
if [[ "${{ github.head_ref }}" == *"$sub"* ]]; then
ref_name=${{ github.head_ref }}
base_ref=${{ github.base_ref }}
suffix=${ref_name/$sub[0-9][0-9][0-9]/''}
suffix=${suffix/_on_$base_ref/''}
fi
echo "suffix=$suffix" >> "$GITHUB_OUTPUT"
fi
echo "branch suffix is: >$suffix<"
style:
name: "Style Check"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -80,48 +105,53 @@ jobs:

tests:
uses: ./.github/workflows/tests.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
python_versions: '["3.9"]'
wheel: true
wheelhouse: false
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

tests_any:
uses: ./.github/workflows/tests.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
python_versions: '["3.9"]'
wheel: true
wheelhouse: false
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
test_any: true
secrets: inherit

docker_tests:
name: "Build and Test on Docker"
uses: ./.github/workflows/test_docker.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

docker_examples:
name: "Run examples on Docker"
uses: ./.github/workflows/examples_docker.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
python_versions: '["3.9"]'
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

docs:
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/docs.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
event_name: ${{ github.event_name }}
secrets: inherit

Expand Down Expand Up @@ -156,10 +186,11 @@ jobs:
examples:
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/examples.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
python_versions: '["3.9"]'
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

retro_241:
Expand Down Expand Up @@ -208,9 +239,10 @@ jobs:
name: "PyDPF-Post"
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/pydpf-post.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
post_branch: "master"
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
test_docstrings: "true"
secrets: inherit
11 changes: 6 additions & 5 deletions docs/source/_static/dpf_operators.html

Large diffs are not rendered by default.

45 changes: 42 additions & 3 deletions src/ansys/dpf/core/operators/mapping/solid_to_skin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ class solid_to_skin(Operator):
field : Field or FieldsContainer
Field or fields container with only one field
is expected
mesh : MeshedRegion, optional
mesh : MeshedRegion
Skin mesh region expected
solid_mesh : MeshedRegion, optional
Solid mesh support (optional).
Examples
Expand All @@ -35,25 +37,32 @@ class solid_to_skin(Operator):
>>> op.inputs.field.connect(my_field)
>>> my_mesh = dpf.MeshedRegion()
>>> op.inputs.mesh.connect(my_mesh)
>>> my_solid_mesh = dpf.MeshedRegion()
>>> op.inputs.solid_mesh.connect(my_solid_mesh)
>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.mapping.solid_to_skin(
... field=my_field,
... mesh=my_mesh,
... solid_mesh=my_solid_mesh,
... )
>>> # Get output data
>>> result_field = op.outputs.field()
"""

def __init__(self, field=None, mesh=None, config=None, server=None):
def __init__(
self, field=None, mesh=None, solid_mesh=None, config=None, server=None
):
super().__init__(name="solid_to_skin", config=config, server=server)
self._inputs = InputsSolidToSkin(self)
self._outputs = OutputsSolidToSkin(self)
if field is not None:
self.inputs.field.connect(field)
if mesh is not None:
self.inputs.mesh.connect(mesh)
if solid_mesh is not None:
self.inputs.solid_mesh.connect(solid_mesh)

@staticmethod
def _spec():
Expand All @@ -72,9 +81,15 @@ def _spec():
1: PinSpecification(
name="mesh",
type_names=["abstract_meshed_region"],
optional=True,
optional=False,
document="""Skin mesh region expected""",
),
2: PinSpecification(
name="solid_mesh",
type_names=["abstract_meshed_region"],
optional=True,
document="""Solid mesh support (optional).""",
),
},
map_output_pin_spec={
0: PinSpecification(
Expand Down Expand Up @@ -136,6 +151,8 @@ class InputsSolidToSkin(_Inputs):
>>> op.inputs.field.connect(my_field)
>>> my_mesh = dpf.MeshedRegion()
>>> op.inputs.mesh.connect(my_mesh)
>>> my_solid_mesh = dpf.MeshedRegion()
>>> op.inputs.solid_mesh.connect(my_solid_mesh)
"""

def __init__(self, op: Operator):
Expand All @@ -144,6 +161,8 @@ def __init__(self, op: Operator):
self._inputs.append(self._field)
self._mesh = Input(solid_to_skin._spec().input_pin(1), 1, op, -1)
self._inputs.append(self._mesh)
self._solid_mesh = Input(solid_to_skin._spec().input_pin(2), 2, op, -1)
self._inputs.append(self._solid_mesh)

@property
def field(self):
Expand Down Expand Up @@ -186,6 +205,26 @@ def mesh(self):
"""
return self._mesh

@property
def solid_mesh(self):
"""Allows to connect solid_mesh input to the operator.
Solid mesh support (optional).
Parameters
----------
my_solid_mesh : MeshedRegion
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.mapping.solid_to_skin()
>>> op.inputs.solid_mesh.connect(my_solid_mesh)
>>> # or
>>> op.inputs.solid_mesh(my_solid_mesh)
"""
return self._solid_mesh


class OutputsSolidToSkin(_Outputs):
"""Intermediate class used to get outputs from
Expand Down
50 changes: 47 additions & 3 deletions src/ansys/dpf/core/operators/mapping/solid_to_skin_fc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ class solid_to_skin_fc(Operator):
fields_container : FieldsContainer
Field or fields container with only one field
is expected
mesh : MeshedRegion, optional
mesh : MeshedRegion
Skin mesh region expected
solid_mesh : MeshedRegion, optional
Solid mesh support (optional).
Examples
Expand All @@ -35,25 +37,37 @@ class solid_to_skin_fc(Operator):
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_mesh = dpf.MeshedRegion()
>>> op.inputs.mesh.connect(my_mesh)
>>> my_solid_mesh = dpf.MeshedRegion()
>>> op.inputs.solid_mesh.connect(my_solid_mesh)
>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.mapping.solid_to_skin_fc(
... fields_container=my_fields_container,
... mesh=my_mesh,
... solid_mesh=my_solid_mesh,
... )
>>> # Get output data
>>> result_fields_container = op.outputs.fields_container()
"""

def __init__(self, fields_container=None, mesh=None, config=None, server=None):
def __init__(
self,
fields_container=None,
mesh=None,
solid_mesh=None,
config=None,
server=None,
):
super().__init__(name="solid_to_skin_fc", config=config, server=server)
self._inputs = InputsSolidToSkinFc(self)
self._outputs = OutputsSolidToSkinFc(self)
if fields_container is not None:
self.inputs.fields_container.connect(fields_container)
if mesh is not None:
self.inputs.mesh.connect(mesh)
if solid_mesh is not None:
self.inputs.solid_mesh.connect(solid_mesh)

@staticmethod
def _spec():
Expand All @@ -72,9 +86,15 @@ def _spec():
1: PinSpecification(
name="mesh",
type_names=["abstract_meshed_region"],
optional=True,
optional=False,
document="""Skin mesh region expected""",
),
2: PinSpecification(
name="solid_mesh",
type_names=["abstract_meshed_region"],
optional=True,
document="""Solid mesh support (optional).""",
),
},
map_output_pin_spec={
0: PinSpecification(
Expand Down Expand Up @@ -136,6 +156,8 @@ class InputsSolidToSkinFc(_Inputs):
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_mesh = dpf.MeshedRegion()
>>> op.inputs.mesh.connect(my_mesh)
>>> my_solid_mesh = dpf.MeshedRegion()
>>> op.inputs.solid_mesh.connect(my_solid_mesh)
"""

def __init__(self, op: Operator):
Expand All @@ -144,6 +166,8 @@ def __init__(self, op: Operator):
self._inputs.append(self._fields_container)
self._mesh = Input(solid_to_skin_fc._spec().input_pin(1), 1, op, -1)
self._inputs.append(self._mesh)
self._solid_mesh = Input(solid_to_skin_fc._spec().input_pin(2), 2, op, -1)
self._inputs.append(self._solid_mesh)

@property
def fields_container(self):
Expand Down Expand Up @@ -186,6 +210,26 @@ def mesh(self):
"""
return self._mesh

@property
def solid_mesh(self):
"""Allows to connect solid_mesh input to the operator.
Solid mesh support (optional).
Parameters
----------
my_solid_mesh : MeshedRegion
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.mapping.solid_to_skin_fc()
>>> op.inputs.solid_mesh.connect(my_solid_mesh)
>>> # or
>>> op.inputs.solid_mesh(my_solid_mesh)
"""
return self._solid_mesh


class OutputsSolidToSkinFc(_Outputs):
"""Intermediate class used to get outputs from
Expand Down
12 changes: 9 additions & 3 deletions src/ansys/dpf/core/operators/mesh/mesh_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class mesh_provider(Operator):
read and a workflow will be bounded
to the properties to be evaluated on
demand, with 0 they are read (default
is 0).
is 0). - "all_available_properties"
option set to 0 will return all
possible properties
Examples
Expand Down Expand Up @@ -181,7 +183,9 @@ def _spec():
read and a workflow will be bounded
to the properties to be evaluated on
demand, with 0 they are read (default
is 0).""",
is 0). - "all_available_properties"
option set to 0 will return all
possible properties""",
),
},
map_output_pin_spec={
Expand Down Expand Up @@ -398,7 +402,9 @@ def laziness(self):
read and a workflow will be bounded
to the properties to be evaluated on
demand, with 0 they are read (default
is 0).
is 0). - "all_available_properties"
option set to 0 will return all
possible properties
Parameters
----------
Expand Down
Loading

0 comments on commit 0f85574

Please sign in to comment.