|
105 | 105 | # ~~~~~~~~~~ |
106 | 106 | # First we define fields. By default, fields represent 3D vectors |
107 | 107 | # so one elementary data is a 3D vector. |
108 | | -# The optional ponderation field is a field which takes one value per entity, |
| 108 | +# The optional weights field is a field which takes one value per entity, |
109 | 109 | # so we need to change its dimensionality (1D). |
110 | 110 | num_entities = 3 |
111 | 111 | input_field = dpf.Field(nentities=num_entities) |
112 | | -ponderation_field = dpf.Field(num_entities) |
113 | | -ponderation_field.dimensionality = dpf.Dimensionality([1]) |
| 112 | +weights_field = dpf.Field(num_entities) |
| 113 | +weights_field.dimensionality = dpf.Dimensionality([1]) |
114 | 114 |
|
115 | 115 | input_field.scoping.ids = range(num_entities) |
116 | | -ponderation_field.scoping.ids = range(num_entities) |
| 116 | +weights_field.scoping.ids = range(num_entities) |
117 | 117 |
|
118 | 118 | ############################################################################### |
119 | 119 | # Fill fields with data. |
120 | 120 | # Add nine values because there are three entities. |
121 | 121 | input_field.data = [-2.0, 2.0, 4.0, -5.0, 0.5, 1.0, 7.0, 3.0, -3.0] |
122 | 122 | ############################################################################### |
123 | 123 | # Three weights, one per entity. |
124 | | -ponderation_field.data = [0.5, 2.0, 0.5] |
| 124 | +weights_field.data = [0.5, 2.0, 0.5] |
125 | 125 |
|
126 | 126 | ############################################################################### |
127 | 127 | # Retrieve the result. |
128 | | -acc = dpf.operators.math.accumulate(fieldA=input_field, ponderation=ponderation_field) |
| 128 | +acc = dpf.operators.math.accumulate(fieldA=input_field, weights=weights_field) |
129 | 129 | output_field = acc.outputs.field() |
130 | 130 |
|
131 | 131 | # (-2.0 * 0.5) + (-5.0 * 2.0) + (7.0 * 0.5) = -7.5 |
|
0 commit comments