Skip to content

Commit

Permalink
bug fix in MultiFieldCreatorArray
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrdar committed Sep 17, 2024
1 parent 7f33861 commit 3153f92
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/atlas/field/MultiFieldCreatorArray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,18 @@ MultiFieldImpl* MultiFieldCreatorArray::create(const array::DataType datatype, c
array::ArrayShape multiarray_shape = shape;
multiarray_shape[varidx] = nvar;


MultiFieldImpl* multifield = new MultiFieldImpl{array::ArraySpec{datatype, multiarray_shape}};
auto& multiarray = multifield->array();

array::ArrayShape field_shape;
field_shape.resize(multiarray_shape.size() - 1);
field_shape.resize(dim - 1);
array::ArrayStrides field_strides;
field_strides.resize(multiarray_shape.size() - 1);
for (int ivar = 0, i = 0; ivar < nvar; ivar++) {
if (ivar != varidx) {
field_shape[i] = multiarray.shape()[ivar];
field_strides[i] = multiarray.strides()[ivar];
++i;
field_strides.resize(dim - 1);
for (int i = 0, j = 0; i < dim; i++) {
if (i != varidx) {
field_shape[j] = multiarray.shape()[i];
field_strides[j] = multiarray.strides()[i];
++j;
}
}
array::ArraySpec field_array_spec(field_shape, field_strides);
Expand Down

0 comments on commit 3153f92

Please sign in to comment.