Loading...
Searching...
No Matches
iorheo.cc
Go to the documentation of this file.
//
// Input/Output option management
//
// author: Pierre.Saramito@imag.fr
//
// date: 4 february 1997
//
// HOW TO ADD NEW OPTION ?
//
// 1st case: it's only a boolean flag, e.g.
// cout << color
// => add it
// a) as an enumerate flag in `enum fmt_mode'
// b) and in the `boolean' iorheo.h declaration
// Jocelyn: also add it below in "force intialization" !!!
//
// 2nd case: you want to store e.g. a string or an int. e.g.
// cout << ncolor(10)
// => add it
// a) in iorheo.h in `scalar' declaration
// b) in iorheo.c in `RHEO_SCALAR'
// c) in iorheo constructor initializer
//
# include "rheolef/iorheo.h"
namespace rheolef {
using namespace std;
//
// RHEO_SCALAR's
//
# define boolean(stream,name)
# define member(stream,name,groupe)
# define i_scalar(t,a) iorheobase_io_scalar_body_macro(iorheo,t,a)
# define o_scalar(t,a) iorheobase_io_scalar_body_macro(iorheo,t,a)
# define io_scalar(t,a) iorheobase_io_scalar_body_macro(iorheo,t,a)
# include "rheolef/iorheo-members.h"
# undef boolean
# undef member
# undef i_scalar
# undef o_scalar
# undef io_scalar
//
// static member declaration:
//
iorheo::flag_type iorheo::static_field;
iorheo::flag_type iorheo::color_field;
iorheo::flag_type iorheo::format_field;
iorheo::flag_type iorheo::render_field;
iorheo::flag_type iorheo::default_f;
iorheo::flag_type iorheo::globals_;
//
// initialization of static data member
//
#define IORHEO_PREFIX
iorheo::force_initialization::force_initialization() {
IORHEO_PREFIX default_f [verbose] = true;
IORHEO_PREFIX default_f [execute] = true;
IORHEO_PREFIX default_f [clean] = true;
IORHEO_PREFIX default_f [rheo] = true;
IORHEO_PREFIX default_f [color] = true;
IORHEO_PREFIX default_f [fill] = true;
IORHEO_PREFIX default_f [fastfieldload] = true;
IORHEO_PREFIX default_f [bezieradapt] = true;
IORHEO_PREFIX static_field [verbose] = true;
IORHEO_PREFIX static_field [execute] = true;
IORHEO_PREFIX static_field [clean] = true;
IORHEO_PREFIX color_field [black_and_white] = true;
IORHEO_PREFIX color_field [gray] = true;
IORHEO_PREFIX color_field [color] = true;
IORHEO_PREFIX format_field [rheo] = true;
IORHEO_PREFIX format_field [hb] = true;
IORHEO_PREFIX format_field [matrix_market] = true;
IORHEO_PREFIX format_field [ml] = true;
IORHEO_PREFIX format_field [matlab] = true;
IORHEO_PREFIX format_field [sparse_matlab] = true;
IORHEO_PREFIX format_field [dump] = true;
IORHEO_PREFIX format_field [bamg] = true;
IORHEO_PREFIX format_field [peschetola] = true;
IORHEO_PREFIX format_field [grummp] = true;
IORHEO_PREFIX format_field [gmsh] = true;
IORHEO_PREFIX format_field [gmsh_pos] = true;
IORHEO_PREFIX format_field [mmg3d] = true;
IORHEO_PREFIX format_field [tetgen] = true;
IORHEO_PREFIX format_field [qmg] = true;
IORHEO_PREFIX format_field [vtkdata] = true;
IORHEO_PREFIX format_field [vtkpolydata] = true;
IORHEO_PREFIX format_field [ps] = true;
IORHEO_PREFIX format_field [gnuplot] = true;
IORHEO_PREFIX format_field [plotmtv] = true;
IORHEO_PREFIX format_field [vtk] = true;
IORHEO_PREFIX format_field [paraview] = true;
IORHEO_PREFIX format_field [geomview] = true;
IORHEO_PREFIX format_field [x3d] = true;
IORHEO_PREFIX format_field [atom] = true;
IORHEO_PREFIX render_field [logscale] = true;
IORHEO_PREFIX render_field [grid] = true;
IORHEO_PREFIX render_field [domains] = true;
IORHEO_PREFIX render_field [fill] = true;
IORHEO_PREFIX render_field [tube] = true;
IORHEO_PREFIX render_field [ball] = true;
IORHEO_PREFIX render_field [shrink] = true;
IORHEO_PREFIX render_field [full] = true;
IORHEO_PREFIX render_field [stereo] = true;
IORHEO_PREFIX render_field [cut] = true;
IORHEO_PREFIX render_field [iso] = true;
IORHEO_PREFIX render_field [split] = true;
IORHEO_PREFIX render_field [volume] = true;
IORHEO_PREFIX render_field [velocity] = true;
IORHEO_PREFIX render_field [deformation] = true;
IORHEO_PREFIX render_field [lattice] = true;
IORHEO_PREFIX render_field [showlabel] = true;
IORHEO_PREFIX render_field [skipvtk] = false;
IORHEO_PREFIX render_field [reader_on_stdin] = true;
IORHEO_PREFIX globals_ = default_f & static_field;
}
static iorheo::force_initialization dummy;
//
// constructor and destructor, copy and assignement
//
iorheo::iorheo()
:
rhstype_(string("")),
rhsfmt_(string("")),
nrhs_(0),
ivec_(0),
nptr_(0),
nidx_(0),
line_no_(0),
subdivide_(0),
ncolor_(0),
basename_(string("")),
image_format_(string("")),
mark_(string("")),
label_(string("")),
isovalue_(std::numeric_limits<Float>::max()),
n_isovalue_(15),
n_isovalue_negative_(0),
vectorscale_(1),
anglecorner_(0),
rounding_precision_(0),
branch_counter_(0),
flags_()
{
// initialized may be called before main() starts
// constructor of global variable "dummy" is used for that
// but some compiler/linker do not call constructor of global vars
check_macro (default_f != flag_type(), "static data member not initialized");
flags_ = default_f;
}
iorheo::~iorheo()
{
// trace_macro ("iorheo::dstor");
}
// ---------------------------------------------------------------------
// trivial memory handler instanciation
// ---------------------------------------------------------------------
// static variable initialization in template class:
template <>
list<iorheo*> *iorheobase_memory_handler<iorheo>::pointer_list = 0;
// class instanciation:
template class iorheobase_memory_handler<iorheo>;
iorheo*
iorheo::get_pointer (ios& s)
{
return iorheobase_memory_handler<iorheo>::get_pointer(s);
}
// ---------------------------------------------------------------------
// flags
// ---------------------------------------------------------------------
iorheo::flag_type
iorheo::flags () const
{
flag_type ret_f = (globals_ & static_field) | (flags_ & (~static_field));
return ret_f;
}
iorheo::flag_type
iorheo::flags (flag_type f1)
{
flag_type old_f = flags();
globals_ = f1 & static_field;
flags_ = f1 & (~static_field);
return old_f;
}
iorheo::flag_type
iorheo::setf (size_type i_add)
{
flag_type new_f = flags();
new_f [i_add] = true;
return flags(new_f);
}
iorheo::flag_type
iorheo::setf (size_type i_add, flag_type field)
{
flag_type new_f = flags() & (~field);
new_f [i_add] = field [i_add];
return flags(new_f);
}
iorheo::flag_type
iorheo::unsetf (size_type i_del)
{
flag_type new_f = flags();
new_f [i_del] = false;
return flags(new_f);
}
//
// for extern usage at application level
//
iorheo::flag_type
iorheo::flags (ios& s)
{
return iorheo::get_pointer(s) -> flags();
}
iorheo::flag_type
iorheo::flags (ios& s, flag_type f)
{
return iorheo::get_pointer(s) -> flags(f);
}
iorheo::flag_type
iorheo::setf (ios& s, size_type i_add)
{
return iorheo::get_pointer(s) -> setf (i_add);
}
iorheo::flag_type
iorheo::setf (ios& s, size_type i_add, flag_type field)
{
return iorheo::get_pointer(s) -> setf (i_add, field);
}
iorheo::flag_type
iorheo::unsetf (ios& s, size_type i_del)
{
return iorheo::get_pointer(s) -> unsetf (i_del);
}
} // namespace rheolef
size_type
field::size_type size_type
Definition branch.cc:430
Float
see the Float page for the full documentation
field
see the field page for the full documentation
rheolef::iorheo
Definition iorheo.h:354
rheolef::iorheo::color_field
static flag_type color_field
Definition iorheo.h:444
rheolef::iorheo::~iorheo
~iorheo()
Definition iorheo.cc:182
rheolef::iorheo::iorheo
iorheo()
Definition iorheo.cc:151
rheolef::iorheo::size_type
size_t size_type
Definition iorheo.h:441
rheolef::iorheo::get_pointer
static iorheo * get_pointer(std::ios &s)
Definition iorheo.cc:198
rheolef::iorheo::render_field
static flag_type render_field
Definition iorheo.h:446
rheolef::iorheo::flag_type
std::bitset< last > flag_type
Definition iorheo.h:440
rheolef::iorheo::flags
static flag_type flags(std::ios &s)
Definition iorheo.cc:244
rheolef::iorheo::format_field
static flag_type format_field
Definition iorheo.h:445
rheolef::iorheo::unsetf
static flag_type unsetf(std::ios &s, size_type i_del)
Definition iorheo.cc:264
rheolef::iorheo::ball
@ ball
Definition iorheo.h:419
rheolef::iorheo::fastfieldload
@ fastfieldload
Definition iorheo.h:430
rheolef::iorheo::logscale
@ logscale
Definition iorheo.h:414
rheolef::iorheo::vtk
@ vtk
Definition iorheo.h:408
rheolef::iorheo::full
@ full
Definition iorheo.h:421
rheolef::iorheo::lattice
@ lattice
Definition iorheo.h:432
rheolef::iorheo::dump
@ dump
Definition iorheo.h:388
rheolef::iorheo::x3d
@ x3d
Definition iorheo.h:407
rheolef::iorheo::clean
@ clean
Definition iorheo.h:366
rheolef::iorheo::peschetola
@ peschetola
Definition iorheo.h:391
rheolef::iorheo::showlabel
@ showlabel
Definition iorheo.h:433
rheolef::iorheo::bezieradapt
@ bezieradapt
Definition iorheo.h:431
rheolef::iorheo::matlab
@ matlab
Definition iorheo.h:386
rheolef::iorheo::reader_on_stdin
@ reader_on_stdin
Definition iorheo.h:436
rheolef::iorheo::velocity
@ velocity
Definition iorheo.h:426
rheolef::iorheo::stereo
@ stereo
Definition iorheo.h:422
rheolef::iorheo::gnuplot
@ gnuplot
Definition iorheo.h:405
rheolef::iorheo::deformation
@ deformation
Definition iorheo.h:427
rheolef::iorheo::color
@ color
Definition iorheo.h:378
rheolef::iorheo::paraview
@ paraview
Definition iorheo.h:409
rheolef::iorheo::plotmtv
@ plotmtv
Definition iorheo.h:406
rheolef::iorheo::skipvtk
@ skipvtk
Definition iorheo.h:435
rheolef::iorheo::qmg
@ qmg
Definition iorheo.h:397
rheolef::iorheo::volume
@ volume
Definition iorheo.h:429
rheolef::iorheo::black_and_white
@ black_and_white
Definition iorheo.h:376
rheolef::iorheo::tube
@ tube
Definition iorheo.h:418
rheolef::iorheo::ps
@ ps
Definition iorheo.h:404
rheolef::iorheo::bamg
@ bamg
Definition iorheo.h:390
rheolef::iorheo::sparse_matlab
@ sparse_matlab
Definition iorheo.h:387
rheolef::iorheo::geomview
@ geomview
Definition iorheo.h:410
rheolef::iorheo::vtkdata
@ vtkdata
Definition iorheo.h:399
rheolef::iorheo::execute
@ execute
Definition iorheo.h:365
rheolef::iorheo::ml
@ ml
Definition iorheo.h:385
rheolef::iorheo::gray
@ gray
Definition iorheo.h:377
rheolef::iorheo::domains
@ domains
Definition iorheo.h:416
rheolef::iorheo::grummp
@ grummp
Definition iorheo.h:392
rheolef::iorheo::vtkpolydata
@ vtkpolydata
Definition iorheo.h:400
rheolef::iorheo::atom
@ atom
Definition iorheo.h:411
rheolef::iorheo::grid
@ grid
Definition iorheo.h:415
rheolef::iorheo::iso
@ iso
Definition iorheo.h:424
rheolef::iorheo::fill
@ fill
Definition iorheo.h:417
rheolef::iorheo::hb
@ hb
Definition iorheo.h:383
rheolef::iorheo::split
@ split
Definition iorheo.h:425
rheolef::iorheo::rheo
@ rheo
Definition iorheo.h:382
rheolef::iorheo::tetgen
@ tetgen
Definition iorheo.h:396
rheolef::iorheo::gmsh
@ gmsh
Definition iorheo.h:393
rheolef::iorheo::shrink
@ shrink
Definition iorheo.h:420
rheolef::iorheo::mmg3d
@ mmg3d
Definition iorheo.h:395
rheolef::iorheo::gmsh_pos
@ gmsh_pos
Definition iorheo.h:394
rheolef::iorheo::matrix_market
@ matrix_market
Definition iorheo.h:384
rheolef::iorheo::verbose
@ verbose
Definition iorheo.h:364
rheolef::iorheo::cut
@ cut
Definition iorheo.h:423
rheolef::iorheo::static_field
static flag_type static_field
Definition iorheo.h:443
rheolef::iorheo::setf
static flag_type setf(std::ios &s, size_type i_add)
Definition iorheo.cc:254
rheolef::iorheobase_memory_handler
Definition iorheobase.h:165
rheolef::iorheobase_memory_handler::get_pointer
static T * get_pointer(std::ios &io)
Definition iorheobase.h:181
rheolef::dummy
static iorheo::force_initialization dummy
Definition iorheo.cc:147
check_macro
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
IORHEO_PREFIX
#define IORHEO_PREFIX
Definition iorheo.cc:76
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
std
STL namespace.
f
Definition cavity_dg.h:29
rheolef::iorheo::force_initialization::force_initialization
force_initialization()
Definition iorheo.cc:77