Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
iorheo.cc
Go to the documentation of this file.
1
21//
22// Input/Output option management
23//
24// author: Pierre.Saramito@imag.fr
25//
26// date: 4 february 1997
27//
28// HOW TO ADD NEW OPTION ?
29//
30// 1st case: it's only a boolean flag, e.g.
31// cout << color
32// => add it
33// a) as an enumerate flag in `enum fmt_mode'
34// b) and in the `boolean' iorheo.h declaration
35// Jocelyn: also add it below in "force intialization" !!!
36//
37// 2nd case: you want to store e.g. a string or an int. e.g.
38// cout << ncolor(10)
39// => add it
40// a) in iorheo.h in `scalar' declaration
41// b) in iorheo.c in `RHEO_SCALAR'
42// c) in iorheo constructor initializer
43//
44# include "rheolef/iorheo.h"
45namespace rheolef {
46using namespace std;
47
48//
49// RHEO_SCALAR's
50//
51# define boolean(stream,name)
52# define member(stream,name,groupe)
53# define i_scalar(t,a) iorheobase_io_scalar_body_macro(iorheo,t,a)
54# define o_scalar(t,a) iorheobase_io_scalar_body_macro(iorheo,t,a)
55# define io_scalar(t,a) iorheobase_io_scalar_body_macro(iorheo,t,a)
56# include "rheolef/iorheo-members.h"
57# undef boolean
58# undef member
59# undef i_scalar
60# undef o_scalar
61# undef io_scalar
62
63//
64// static member declaration:
65//
70
71iorheo::flag_type iorheo::default_f;
72iorheo::flag_type iorheo::globals_;
73//
74// initialization of static data member
75//
76#define IORHEO_PREFIX
78
79 IORHEO_PREFIX default_f [verbose] = true;
80 IORHEO_PREFIX default_f [execute] = true;
81 IORHEO_PREFIX default_f [clean] = true;
82 IORHEO_PREFIX default_f [rheo] = true;
83 IORHEO_PREFIX default_f [color] = true;
84 IORHEO_PREFIX default_f [fill] = true;
85 IORHEO_PREFIX default_f [fastfieldload] = true;
86 IORHEO_PREFIX default_f [bezieradapt] = true;
87
91
95
97
104
115
124
144
145 IORHEO_PREFIX globals_ = default_f & static_field;
146}
147static iorheo::force_initialization dummy;
148//
149// constructor and destructor, copy and assignement
150//
152 :
153 rhstype_(string("")),
154 rhsfmt_(string("")),
155 nrhs_(0),
156 ivec_(0),
157 nptr_(0),
158 nidx_(0),
159 line_no_(0),
160 subdivide_(0),
161 ncolor_(0),
162 basename_(string("")),
163 image_format_(string("")),
164 mark_(string("")),
165 label_(string("")),
166 isovalue_(std::numeric_limits<Float>::max()),
167 n_isovalue_(15),
168 n_isovalue_negative_(0),
169 vectorscale_(1),
170 anglecorner_(0),
171 rounding_precision_(0),
172 branch_counter_(0),
173 flags_()
174{
175 // initialized may be called before main() starts
176 // constructor of global variable "dummy" is used for that
177 // but some compiler/linker do not call constructor of global vars
178 check_macro (default_f != flag_type(), "static data member not initialized");
179
180 flags_ = default_f;
181}
183{
184 // trace_macro ("iorheo::dstor");
185}
186// ---------------------------------------------------------------------
187// trivial memory handler instanciation
188// ---------------------------------------------------------------------
189
190// static variable initialization in template class:
191template <>
193
194// class instanciation:
196
197iorheo*
202// ---------------------------------------------------------------------
203// flags
204// ---------------------------------------------------------------------
206iorheo::flags () const
207{
208 flag_type ret_f = (globals_ & static_field) | (flags_ & (~static_field));
209 return ret_f;
210}
212iorheo::flags (flag_type f1)
213{
214 flag_type old_f = flags();
215 globals_ = f1 & static_field;
216 flags_ = f1 & (~static_field);
217 return old_f;
218}
220iorheo::setf (size_type i_add)
221{
222 flag_type new_f = flags();
223 new_f [i_add] = true;
224 return flags(new_f);
225}
227iorheo::setf (size_type i_add, flag_type field)
228{
229 flag_type new_f = flags() & (~field);
230 new_f [i_add] = field [i_add];
231 return flags(new_f);
232}
235{
236 flag_type new_f = flags();
237 new_f [i_del] = false;
238 return flags(new_f);
239}
240//
241// for extern usage at application level
242//
244iorheo::flags (ios& s)
245{
246 return iorheo::get_pointer(s) -> flags();
247}
249iorheo::flags (ios& s, flag_type f)
250{
251 return iorheo::get_pointer(s) -> flags(f);
252}
254iorheo::setf (ios& s, size_type i_add)
255{
256 return iorheo::get_pointer(s) -> setf (i_add);
257}
260{
261 return iorheo::get_pointer(s) -> setf (i_add, field);
262}
264iorheo::unsetf (ios& s, size_type i_del)
265{
266 return iorheo::get_pointer(s) -> unsetf (i_del);
267}
268
269} // namespace rheolef
field::size_type size_type
Definition branch.cc:430
see the Float page for the full documentation
see the field page for the full documentation
static flag_type color_field
Definition iorheo.h:444
size_t size_type
Definition iorheo.h:441
static iorheo * get_pointer(std::ios &s)
Definition iorheo.cc:198
static flag_type render_field
Definition iorheo.h:446
std::bitset< last > flag_type
Definition iorheo.h:440
static flag_type flags(std::ios &s)
Definition iorheo.cc:244
static flag_type format_field
Definition iorheo.h:445
static flag_type unsetf(std::ios &s, size_type i_del)
Definition iorheo.cc:264
static flag_type static_field
Definition iorheo.h:443
static flag_type setf(std::ios &s, size_type i_add)
Definition iorheo.cc:254
static T * get_pointer(std::ios &io)
Definition iorheobase.h:181
static iorheo::force_initialization dummy
Definition iorheo.cc:147
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
#define IORHEO_PREFIX
Definition iorheo.cc:76
This file is part of Rheolef.
STL namespace.
Definition cavity_dg.h:29