1010#include <KokkosInterface.h>
1111#include "utils/CreateDeviceExpression.h"
1212
13- class Deviceable {
14- protected :
15- Deviceable * deviceCopy_ ;
16- public :
17- KOKKOS_FORCEINLINE_FUNCTION Deviceable () : deviceCopy_ (nullptr ) {}
18- virtual ~Deviceable () {
19- if (deviceCopy_ ) delete_device_copy ();
20- deviceCopy_ = nullptr ;
21- }
22- template < class T > void copy_to_device (const T & t ) {
23- deviceCopy_ = sierra ::nalu ::create_device_expression (t );
24- }
25- void delete_device_copy () {
26- sierra ::nalu ::kokkos_free_on_device (deviceCopy_ );
27- }
28- };
29-
30- class Shape : public Deviceable {
13+ class Shape
14+ {
3115public :
32- KOKKOS_FORCEINLINE_FUNCTION Shape () {}
33- virtual ~Shape () {}
16+ KOKKOS_FORCEINLINE_FUNCTION Shape () {}
17+ KOKKOS_DEFAULTED_FUNCTION virtual ~Shape () = default ;
3418 KOKKOS_FUNCTION
3519 virtual double area () const = 0 ;
3620};
3721
3822class Rectangle : public Shape {
3923 const double length_ ,width_ ;
4024public :
41- Rectangle (const double l ,const double w ):Shape (),length_ (l ),width_ (w ) {
42- copy_to_device ( * this );
43- }
44- KOKKOS_FORCEINLINE_FUNCTION Rectangle ( const Rectangle & r ): Shape (), length_ ( r . length_ ), width_ ( r . width_ ) {}
45- virtual ~Rectangle (){}
25+ Rectangle (const double l ,const double w ):Shape (),length_ (l ),width_ (w ) {}
26+ KOKKOS_FORCEINLINE_FUNCTION Rectangle ( const Rectangle & r )
27+ : Shape (), length_ ( r . length_ ), width_ ( r . width_ )
28+ {}
29+ KOKKOS_DEFAULTED_FUNCTION virtual ~Rectangle () = default ;
4630 KOKKOS_FUNCTION
4731 virtual double area () const final {
4832 return length_ * width_ ;
@@ -52,11 +36,11 @@ public :
5236class Circle : public Shape {
5337 const double radius_ ;
5438public :
55- Circle (const double radius ):Shape (),radius_ (radius ) {
56- copy_to_device ( * this );
57- }
58- KOKKOS_FORCEINLINE_FUNCTION Circle ( const Circle & c ): Shape (), radius_ ( c . radius_ ) {}
59- virtual ~Circle (){}
39+ Circle (const double radius ):Shape (),radius_ (radius ) {}
40+ KOKKOS_FORCEINLINE_FUNCTION Circle ( const Circle & c )
41+ : Shape (), radius_ ( c . radius_ )
42+ {}
43+ KOKKOS_DEFAULTED_FUNCTION virtual ~Circle () = default ;
6044 KOKKOS_FUNCTION
6145 virtual double area () const final {
6246 return 3.14159265 * radius_ * radius_ ;
0 commit comments