44 #ifndef KOKKOS_STATICCRSGRAPH_HPP 45 #define KOKKOS_STATICCRSGRAPH_HPP 50 #include <Kokkos_Core.hpp> 84 template<
class DataType,
86 class Arg2Type = void,
87 typename SizeType =
typename ViewTraits<DataType*, Arg1Type, Arg2Type, void >::size_type>
93 typedef DataType data_type;
94 typedef typename traits::array_layout array_layout;
95 typedef typename traits::execution_space execution_space;
97 typedef SizeType size_type;
104 entries_type entries;
105 row_map_type row_map;
114 template<
class EntriesType,
class RowMapType>
115 StaticCrsGraph (
const EntriesType& entries_,
const RowMapType& row_map_) : entries (entries_), row_map (row_map_)
123 entries = rhs.entries;
124 row_map = rhs.row_map;
133 KOKKOS_INLINE_FUNCTION
134 size_type numRows()
const {
135 return (row_map.dimension_0 () != 0) ?
136 row_map.dimension_0 () -
static_cast<size_type
> (1) :
137 static_cast<size_type> (0);
143 template<
class StaticCrsGraphType ,
class InputSizeType >
144 typename StaticCrsGraphType::staticcrsgraph_type
145 create_staticcrsgraph(
const std::string & label ,
146 const std::vector< InputSizeType > & input );
148 template<
class StaticCrsGraphType ,
class InputSizeType >
149 typename StaticCrsGraphType::staticcrsgraph_type
150 create_staticcrsgraph(
const std::string & label ,
151 const std::vector< std::vector< InputSizeType > > & input );
155 template<
class DataType ,
162 template<
class DataType ,
174 #include <impl/Kokkos_StaticCrsGraph_factory.hpp> 182 template<
class GraphType >
183 struct StaticCrsGraphMaximumEntry {
185 typedef typename GraphType::execution_space execution_space ;
186 typedef typename GraphType::data_type value_type ;
188 const typename GraphType::entries_type entries ;
190 StaticCrsGraphMaximumEntry(
const GraphType & graph ) : entries( graph.entries ) {}
192 KOKKOS_INLINE_FUNCTION
193 void operator()(
const unsigned i , value_type & update )
const 194 {
if ( update < entries(i) ) update = entries(i); }
196 KOKKOS_INLINE_FUNCTION
197 void init( value_type & update )
const 200 KOKKOS_INLINE_FUNCTION
201 void join(
volatile value_type & update ,
202 volatile const value_type & input )
const 203 {
if ( update < input ) update = input ; }
208 template<
class DataType,
class Arg1Type,
class Arg2Type,
typename SizeType >
212 typedef Impl::StaticCrsGraphMaximumEntry< GraphType > FunctorType ;
214 DataType result = 0 ;
216 FunctorType(graph), result );
~StaticCrsGraph()
Destroy this view of the array. If the last view then allocated memory is deallocated.
void parallel_reduce(const ExecPolicy &policy, const FunctorType &functor, const std::string &str="", typename Impl::enable_if< !Impl::is_integral< ExecPolicy >::value >::type *=0)
Parallel reduction.
StaticCrsGraph(const StaticCrsGraph &rhs)
Copy constructor (shallow copy).
Memory space for main process and CPU execution spaces.
Traits class for accessing attributes of a View.
StaticCrsGraph & operator=(const StaticCrsGraph &rhs)
Assign to a view of the rhs array. If the old view is the last view then allocated memory is dealloca...
Compressed row storage array.
StaticCrsGraph()
Construct an empty view.