how to copy the layout of Sacado Fad View?
Created by: ibaned
I'm trying to create a really simple function for Albany to create an "uninit deep copy" of a view, that is a view with the same layout whose allocation is new and distinct from the input view, but not necessarily copying the contents. I tried to base it off of Kokkos's functions for creating mirrors:
template< class T , class ... P >
inline
typename Kokkos::DynRankView<T,P...>::non_const_type
create_copy( const std::string& name,
const Kokkos::DynRankView<T,P...> & src )
{
using dst_type = typename Kokkos::DynRankView<T,P...>::non_const_type;
auto layout = Kokkos::Experimental::Impl::reconstructLayout(src.layout(), src.rank());
return dst_type( name , layout );
}
This worked okay for native Kokkos Views, but it fails for the specialized Views of Sacado Fad types. The Sacado DynRankDimTraits
treat the Fad dimension in a way that reconstructLayout
doesn't expect. Also, If I print out the 8th dimension of the layout objects, they are all zero because the Sacado ViewMapping
hides the fad size in a separate variable.
My question is: how am I supposed to write this simple function such that it works with Sacado's View specializations ?
@trilinos/sacado (unsure how to mention Kokkos team from Trilinos repo, going with @hcedwar )