Skip to content

Commit 0abf6e9

Browse files
authored
Merge pull request #935 from Geode-solutions/fix/span_constructor_of_attribute_linear_inteprolation
fix(AttributeLinearInterpolation): Changed constructor to take spans …
2 parents 94660fa + 27ebeb0 commit 0abf6e9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

include/geode/basic/attribute_utils.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,18 @@ namespace geode
9393

9494
struct AttributeLinearInterpolation
9595
{
96-
AttributeLinearInterpolation( absl::FixedArray< index_t > indices,
97-
absl::FixedArray< double > lambdas )
98-
: indices_{ std::move( indices ) }, lambdas_{ std::move( lambdas ) }
96+
AttributeLinearInterpolation( absl::Span< const index_t > indices,
97+
absl::Span< const double > lambdas )
98+
: indices_( indices.size() ), lambdas_( lambdas.size() )
9999
{
100100
OPENGEODE_EXCEPTION( indices_.size() == lambdas_.size(),
101101
"[AttributeLinearInterpolation] Both arrays should have the "
102102
"same size" );
103+
for( const auto index : Indices{ indices } )
104+
{
105+
indices_[index] = indices[index];
106+
lambdas_[index] = lambdas[index];
107+
}
103108
}
104109

105110
template < template < typename > class Attribute, typename T >
@@ -109,8 +114,8 @@ namespace geode
109114
*this, attribute );
110115
}
111116

112-
const absl::FixedArray< index_t > indices_;
113-
const absl::FixedArray< double > lambdas_;
117+
absl::FixedArray< index_t > indices_;
118+
absl::FixedArray< double > lambdas_;
114119
};
115120

116121
#define IMPLICIT_ATTRIBUTE_LINEAR_INTERPOLATION( Type ) \

0 commit comments

Comments
 (0)