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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .ci/code_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
for file_path in files:
if file_path.stem == "specification":
continue
if file_path.stem == "translator":
continue
if file_path.name == "build.py":
continue
if file_path.name == "operator.mustache":
Expand Down
4 changes: 2 additions & 2 deletions doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions examples/00-basic/10-math_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,27 +105,27 @@
# ~~~~~~~~~~
# First we define fields. By default, fields represent 3D vectors
# so one elementary data is a 3D vector.
# The optional ponderation field is a field which takes one value per entity,
# The optional weights field is a field which takes one value per entity,
# so we need to change its dimensionality (1D).
num_entities = 3
input_field = dpf.Field(nentities=num_entities)
ponderation_field = dpf.Field(num_entities)
ponderation_field.dimensionality = dpf.Dimensionality([1])
weights_field = dpf.Field(num_entities)
weights_field.dimensionality = dpf.Dimensionality([1])

input_field.scoping.ids = range(num_entities)
ponderation_field.scoping.ids = range(num_entities)
weights_field.scoping.ids = range(num_entities)

###############################################################################
# Fill fields with data.
# Add nine values because there are three entities.
input_field.data = [-2.0, 2.0, 4.0, -5.0, 0.5, 1.0, 7.0, 3.0, -3.0]
###############################################################################
# Three weights, one per entity.
ponderation_field.data = [0.5, 2.0, 0.5]
weights_field.data = [0.5, 2.0, 0.5]

###############################################################################
# Retrieve the result.
acc = dpf.operators.math.accumulate(fieldA=input_field, ponderation=ponderation_field)
acc = dpf.operators.math.accumulate(fieldA=input_field, weights=weights_field)
output_field = acc.outputs.field()

# (-2.0 * 0.5) + (-5.0 * 2.0) + (7.0 * 0.5) = -7.5
Expand Down
4 changes: 2 additions & 2 deletions examples/01-mathematical-operations/matrix-operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@

# Add a constant
# Add 2 to each value in the field
stress_2 = maths.add_constant_fc(fields_container=stress_2, ponderation=2.0).eval()
stress_2 = maths.add_constant_fc(fields_container=stress_2, weights=2.0).eval()

# Multiply by a constant
# Multiply each value in the field by 3
stress_3 = maths.scale_fc(fields_container=stress_3, ponderation=3.0).eval()
stress_3 = maths.scale_fc(fields_container=stress_3, weights=3.0).eval()

# Add fields containers
# Each value of each field is added by the correspondent component of the others fields
Expand Down
2 changes: 1 addition & 1 deletion examples/04-advanced/04-extrapolation_stress_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
divide.inputs.fieldB.connect(stress_ref_nodal_op)
rel_error = dpf.operators.math.scale()
rel_error.inputs.field.connect(divide)
rel_error.inputs.ponderation.connect(1.0)
rel_error.inputs.weights.connect(1.0)

###############################################################################
# Plot absolute and relative errors.
Expand Down
2 changes: 1 addition & 1 deletion examples/04-advanced/05-extrapolation_strain_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
divide.inputs.fieldB.connect(strain_ref_nodal_op)
rel_error = dpf.operators.math.scale()
rel_error.inputs.field.connect(divide)
rel_error.inputs.ponderation.connect(1.0)
rel_error.inputs.weights.connect(1.0)

###############################################################################
# Plot absolute and relative errors.
Expand Down
2 changes: 1 addition & 1 deletion examples/04-advanced/06-stress_gradient_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
# using :class:`scale <ansys.dpf.core.operators.math.scale.scale>` operator
# inwards in the geometry, to get the path direction.
#
normal_vec_in_field = ops.math.scale(field=normal_vec_out_field, ponderation=-1.0)
normal_vec_in_field = ops.math.scale(field=normal_vec_out_field, weights=-1.0)
normal_vec_in = normal_vec_in_field.outputs.field.get_data().data[0]
###############################################################################
# Get nodal coordinates, they serve as the first point on the line.
Expand Down
10 changes: 5 additions & 5 deletions examples/04-advanced/10-asme_secviii_divtwo.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

poisson_ratio_correction = 1.3 / 1.5
eppleqvmech_op = dpf.operators.math.scale_fc(
fields_container=eppleqv, ponderation=poisson_ratio_correction
fields_container=eppleqv, weights=poisson_ratio_correction
)
eppleqvmech = eppleqvmech_op.outputs.fields_container()

Expand All @@ -134,23 +134,23 @@
s123 = s123_op.outputs.fields_container()
# SVM_scale=SVM*3
ratio = 3.0
seqvs_op = dpf.operators.math.scale_fc(fields_container=seqv, ponderation=ratio)
seqvs_op = dpf.operators.math.scale_fc(fields_container=seqv, weights=ratio)
seqvs = seqvs_op.outputs.fields_container()
# S123/SVM*3
sratio_op = dpf.operators.math.component_wise_divide(fieldA=s123, fieldB=seqvs)
sratio = sratio_op.outputs.field()
# S123/SVM*3-0.33
sterm_op = dpf.operators.math.add_constant(field=sratio, ponderation=-1 / 3)
sterm_op = dpf.operators.math.add_constant(field=sratio, weights=-1 / 3)
sterm = sterm_op.outputs.field()
# -alfasl/(1+m2)*stressterm
ratio2 = -alfasl / (1 + m2)
expt_op = dpf.operators.math.scale(field=sterm, ponderation=ratio2)
expt_op = dpf.operators.math.scale(field=sterm, weights=ratio2)
expt = expt_op.outputs.field()
# exp(-alfasl/(1+m2)*stressterm)
exp_op = dpf.operators.math.exponential(field=expt)
exp = exp_op.outputs.field()
# elu*exp(-alfasl/(1+m2)*stressterm)
strainlimit_op = dpf.operators.math.scale(field=exp, ponderation=m2)
strainlimit_op = dpf.operators.math.scale(field=exp, weights=m2)
strainlimit = strainlimit_op.outputs.field()

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/04-advanced/13-manage_licensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
print(field)

# Instantiate an Entry (not licensed) DPF operator
op_entry = dpf.operators.math.add_constant(field=field, ponderation=2.0, server=server)
op_entry = dpf.operators.math.add_constant(field=field, weights=2.0, server=server)

# Instantiate a Premium (licensed) DPF operator
op_premium = dpf.operators.filter.field_high_pass(field=field, threshold=0.0, server=server)
Expand Down
2 changes: 1 addition & 1 deletion examples/05-file-IO/04-basic-load-file.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
divide.inputs.fieldB.connect(fc_out)
scale = dpf.operators.math.scale()
scale.inputs.field.connect(divide)
scale.inputs.ponderation.connect(100.0)
scale.inputs.weights.connect(100.0)
rel_error = scale.eval()

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/06-plotting/02-solution_combination.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
field_lc2 = stress_tensor.outputs.fields_container()[1]

# Scale LC2 to -1.
stress_tensor_lc2_sc = dpf.operators.math.scale(field=field_lc2, ponderation=-1.0)
stress_tensor_lc2_sc = dpf.operators.math.scale(field=field_lc2, weights=-1.0)

###############################################################################
# Add load cases.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
###############################################################################
# Transform rotated nodal coordinates field along rotated position vector
# ``pos_vec_rot``:
pos_vec_rot_neg_f = dpf.operators.math.scale(field=pos_vec_rot, ponderation=-1.0)
pos_vec_rot_neg_f = dpf.operators.math.scale(field=pos_vec_rot, weights=-1.0)
pos_vec_rot_neg = pos_vec_rot_neg_f.outputs.field.get_data().data_as_list
ncoord_translate = dpf.operators.math.add_constant(field=ncoord_rot_f, ponderation=pos_vec_rot_neg)
ncoord_translate = dpf.operators.math.add_constant(field=ncoord_rot_f, weights=pos_vec_rot_neg)
###############################################################################
# Get the nodal coordinates field ``ncoord_lcs_f`` in LCS:
ncoord_lcs_f = ncoord_translate.outputs.field.get_data()
Expand Down
4 changes: 2 additions & 2 deletions examples/16-maths-ops/01-matrix-operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@

# Add a constant
# Add 2 to each value in the field
stress_2 = maths.add_constant_fc(fields_container=stress_2, ponderation=2.0).eval()
stress_2 = maths.add_constant_fc(fields_container=stress_2, weights=2.0).eval()

# Multiply by a constant
# Multiply each value in the field by 3
stress_3 = maths.scale_fc(fields_container=stress_3, ponderation=3.0).eval()
stress_3 = maths.scale_fc(fields_container=stress_3, weights=3.0).eval()

# Add fields containers
# Each value of each field is added by the correspondent component of the others fields
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/dpf/core/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@
scaling_op.inputs.field.connect(field_mode)
wf.add_operators([scaling_op])

wf.set_input_name("ponderation", scaling_op.inputs.ponderation)
wf.set_input_name("weights", scaling_op.inputs.weights)

Check warning on line 121 in src/ansys/dpf/core/animation.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/animation.py#L121

Added line #L121 was not covered by tests
wf.set_output_name("field", scaling_op.outputs.field)

anim = Animator(workflow=wf, **kwargs)

return anim.animate(
loop_over=loop_over,
input_name="ponderation",
input_name="weights",
output_name="field",
save_as=save_as,
mode_number=mode_number,
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/dpf/core/meshed_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def deform_by(self, deform_by, scale_factor=1.0):
deform_by = deform_by[0]
if deform_by.unit != self.unit:
unit_convert(deform_by, self.unit)
scale_op = scale(field=deform_by, ponderation=scale_factor)
scale_op = scale(field=deform_by, weights=scale_factor)
return add(fieldA=self.nodes.coordinates_field, fieldB=scale_op.outputs.field).eval()

def _as_vtk(self, coordinates=None, as_linear=True, include_ids=False):
Expand Down
Loading
Loading