1 #ifndef PICTURE_HPP_FILE 2 #define PICTURE_HPP_FILE 12 #include "rect_fwd.hpp" 13 #include "parallel.hpp" 14 #include "shared_ptr.hpp" 16 typedef std::list<std::string> t_filename_list;
17 typedef STD_TR1::shared_ptr<t_filename_list > t_filename_list_ref;
19 typedef std::complex<double> complex;
20 typedef std::vector<complex> Vector;
29 const std::string identifier()
const;
30 void set_identifier(
const std::string&);
32 Rectangle_const_ref geometry()
const;
34 const complex* raw_storage()
const;
35 complex* raw_storage();
39 double get_tag()
const;
40 void set_tag(
double t);
42 STD_TR1::shared_ptr<state_collection> get_state_collection(){
return sc;};
46 state(
size_t nr, STD_TR1::shared_ptr<state_collection> sc_):
50 void load(std::istream&);
55 STD_TR1::shared_ptr<state_collection> sc;
75 typedef STD_TR1::shared_ptr< state_collection> ref;
76 typedef STD_TR1::shared_ptr<const state_collection> const_ref;
79 ref create(MPI_Comm c);
82 ref create(MPI_Comm c, t_filename_list_ref files);
84 std::string filename(
size_t index)
const;
86 std::string minimal_identifier(
const std::string& ,
size_t,
size_t );
88 const std::string& state_identifier(
size_t index)
const;
89 Rectangle_const_ref state_geometry(
size_t index)
const;
90 size_t state_size(
size_t index)
const;
92 state push_pointer(complex*);
95 void add_empty_state(Rectangle_const_ref,
96 const std::string& identifier);
97 void add_states(
const t_filename_list_ref files);
98 void add_states(Rectangle_const_ref,
100 const std::string& identifier);
105 ref copy_if( Pr )
const;
109 state get_state(
size_t index);
110 const state get_state(
size_t index)
const;
113 void write(
size_t index)
const;
115 size_t N()
const {
return states.size();};
117 void set_write_out_immediately(
bool woi){ write_out_immediately = woi;};
119 void set_prefix(
const std::string& s){prefix = s;};
120 const std::string& get_prefix()
const {
return prefix;};
123 double state_norm(
int);
126 void state_dot(
int,
int,complex& result);
129 void state_scale(
int, complex alpha);
132 void state_axpy(
int i,
int j, complex alpha);
135 void state_copy(
int i,
int j);
151 void state_maxpby(
const complex* prefactors,
int& istart,
int& iend, complex& alpha,
int& j);
154 bool write_out_immediately;
161 std::string identifier;
165 Rectangle_const_ref geometry;
167 complex* raw_storage() {
return p;};
168 const complex* raw_storage()
const {
return p;};
171 void check(
size_t index)
const;
174 void write_state(std::ostream& os,
175 const state_info& st)
const;
177 void load_state(state_info& st,
186 std::vector<state_info> states;
188 std::list< STD_TR1::shared_ptr<Vector> > state_data;
190 STD_TR1::weak_ptr<state_collection> my_ptr;
194 STD_TR1::shared_ptr<state_collection>
195 state_collection::copy_if( Pr pred )
const {
197 auto clone = create(comm);
199 clone->write_out_immediately =
false;
200 clone->prefix = prefix;
202 std::copy(state_data.begin(), state_data.end(), std::back_inserter(clone->state_data));
204 auto ins(std::back_inserter(clone->states));
205 for (
size_t i = 0; i < states.size(); ++i)
206 if (pred(get_state(i))){