5 extern "C" int printf(const char *, ...);
11 Subscriptor() : counter(1) {}
13 virtual ~Subscriptor()
23 template <int dim
> struct Function
25 Function(int i
): value(dim
+ i
) {}
29 template <int dim
> struct Triangulation
34 template <int dim
> struct Exercise_2_3
40 struct SetUpBase
: public Subscriptor
43 const Function
<dim
> get_boundary_values () const = 0;
46 const Function
<dim
> get_right_hand_side () const = 0;
49 // void create_coarse_grid (Triangulation<dim> &coarse_grid) const = 0;
52 template <class Traits
, int dim
>
53 struct SetUp
: public SetUpBase
<dim
>
58 const Function
<dim
> get_boundary_values () const
59 { return Function
<dim
>(Traits::DIM
); }
62 const Function
<dim
> get_right_hand_side () const
63 { return Function
<dim
>(Traits::DIM
); }
66 // void create_coarse_grid (Triangulation<dim> &coarse_grid) const;
68 // static const typename Traits::BoundaryValues boundary_values;
69 // static const typename Traits::RightHandSide right_hand_side;
77 SetUp<Exercise_2_3<1000>, 2> s1a;
78 SetUp<Exercise_2_3<2000>, 1> s2;
79 SetUp<Exercise_2_3<2000>, 2> s2a;
80 return s1->get_boundary_values().value + s1a.get_boundary_values().value +
81 s2.get_boundary_values().value + s2a.get_boundary_values().value +
82 s1->get_right_hand_side().value + s1a.get_right_hand_side().value +
83 s2.get_right_hand_side().value + s2a.get_right_hand_side().value;
86 SetUp
<Exercise_2_3
<1000>, 1> * s1
= new SetUp
<Exercise_2_3
<1000>, 1>();
87 printf("%d\n", s1
->get_boundary_values().value
);
90 SetUp
<Exercise_2_3
<1000>, 1> s1
;
91 printf("%d\n", s1
.get_boundary_values().value
);