C++ std::fstream state flags cheat sheet

Out stream - no file is open: is_open()=0 good()=1 eof()=0 fail()=0 bad()=0 Out stream - file open but not read/written: is_open()=1 good()=1 eof()=0 fail()=0 bad()=0 Out stream - file opened and then closed: is_open()=0 good()=1 eof()=0 fail()=0 bad()=0 Out stream - invalid filename: is_open()=0 good()=0 eof()=0 fail()=1 bad()=0 In/Out stream - file open but not read/written: is_open()=1 good()=1 eof()=0 fail()=0 bad()=0 In/Out stream - trying to read a char (eof): [Read More]
C++ 

Best C++ GUI libraries for Windows

Disclaimer: the list contains the library that I use (FLTK) and the libraries that I have evaluated/ am evaluating for future use (i.e. I have at least compiled the demo version). It is by far not a complete list of all the libraries. But if you have suggestion, please write them in the comment or email me, as I will constantly be updating this page. FLTK FLTK (Fast Light Toolkit, pronounced “fulltick”) is the library I currently use in one of my projects. [Read More]
C++ 

IBSimu internal structure

I will update this post with what I understand of the IBSimu library structure. Here is the class diagram so far [PDF][[TEX]]: IBSimu Partial Class Diagram (as of 13/08/2020) The EpotField class inherits from the following classes: Mesh: has no Geometry geom_mode_e _geom_mode (2D, 3D, Cyl) Int3D _size Vec3D _origo Vec3D _max double _h – length of mesh step double _div_h (reciprocal of _h) default implicit copy constructor save( std::ostream &os) ScalarField: public Field, almost empty Geometry: public Mesh MeshScalarField : public ScalarField, public Mesh double *_F (field data) MeshScalarField(const Mesh &m) -> Mesh(m) and allocate memory for _F DOES NOT store a pointer to Geometry EpotField: public MeshScalarField Geometry *_geom overload operator() for returning linear interpolation DOES store a pointer to Geometry does nothing more EpotEfield is given by: [Read More]
C++ 

How to install two copies of a C++ library on Linux for development purposes

Often, library development goes hand by hand with the development of your own project: you need a feature, and you realize that the feature would fit better in the original library rather than in your own code. I am working on a Client for the Ion Beam Simulator IBSimu library for plasma simulation, and I started to modify the original IBSimu library when I noticed that the partial saving of particle trajectories was not yet implemented. [Read More]
C++ 

Installing C++17 and C++20 on Ubuntu and Amazon Linux

The standard installation of gcc and g++ does not come with the latest versions of the libraries, so if you want to take advantage of the features offered by the new C++ standards (C++17 and C++20 as the time of writing) you have to manually switch libraries. Specifically, you have to make sure that the libraries gcc and libstdc++ are upgraded to their latest versions. As the time of writing, those are the followings: [Read More]
C++ 

Best plot and charting C++ packages for data visualization

While in Python Matplotlib seems the de facto standard for plotting and charting, no real incumbent is established when it comes to data visualization in C++. I had to review several packages for data visualization in C++, and here are my (partial and incomplete) evaluations: gnuplot with the necessary wrapper gnuplot-iostream . Gnuplot is a old (1986, 30-some years ago, but still updated) standalone software with a vibrant community actively developing it. [Read More]
C++