11 extern "C" int printf(const char *, ...);
17 Subscriptor() : counter(1) {}
19 virtual ~Subscriptor()
29 template <int dim
> struct Function
31 Function(int i
): value(dim
+ i
) {}
35 template <int dim
> struct Triangulation
40 template <int dim
> struct Exercise_2_3
46 struct SetUpBase
: public Subscriptor
49 const Function
<dim
> get_boundary_values () const = 0;
52 const Function
<dim
> get_right_hand_side () const = 0;
55 // void create_coarse_grid (Triangulation<dim> &coarse_grid) const = 0;
58 template <class Traits
, int dim
>
59 struct SetUp
: public SetUpBase
<dim
>
64 const Function
<dim
> get_boundary_values () const
65 { return Function
<dim
>(Traits::DIM
); }
68 const Function
<dim
> get_right_hand_side () const
69 { return Function
<dim
>(Traits::DIM
); }
72 // void create_coarse_grid (Triangulation<dim> &coarse_grid) const;
74 // static const typename Traits::BoundaryValues boundary_values;
75 // static const typename Traits::RightHandSide right_hand_side;
79 void myread(std::istream
* in
)
81 char input_str
[50] = "\0";
84 std::cout
<< input_str
<< std::endl
;
94 SetUp<Exercise_2_3<1000>, 2> s1a;
95 SetUp<Exercise_2_3<2000>, 1> s2;
96 SetUp<Exercise_2_3<2000>, 2> s2a;
97 return s1->get_boundary_values().value + s1a.get_boundary_values().value +
98 s2.get_boundary_values().value + s2a.get_boundary_values().value +
99 s1->get_right_hand_side().value + s1a.get_right_hand_side().value +
100 s2.get_right_hand_side().value + s2a.get_right_hand_side().value;
103 SetUp
<Exercise_2_3
<1000>, 1> * s1
= new SetUp
<Exercise_2_3
<1000>, 1>();
105 printf("%d\n", s1
->get_boundary_values().value
);
107 ifstream
* infile
= new ifstream("./template-list-iostream.cc");
111 ofstream
* outfile
= new ofstream("/tmp/xxx.txt");
114 (*outfile
) << "hello there" << std::endl
;
115 std::cerr
<< "Reached End" << std::endl
;