Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads

Post-processor

It is possible to make a post-processor for a simulation. For that capability you need to save the necessary simulation data at the end (or during the simulation iteration) of your simulation. For example:

geom.save( "geom.dat" );
epot.save( "epot.dat" );
pdb.save( "pdb.dat" );

Currently it is possible to save and load the following types: Geometry, ScalarField, MeshVectorField, MultiMeshVectorField, ParticleDataBaseXX, Mesh, ParticlePXX and ParticleXX (Here XX is the coordinate type).

For the post-processor, make another source code file. For example postp.cpp, which is like a regular simulation driving cpp-file, but instead of redefining the data objects they should be loaded from the data files:

std::ifstream is_geom( "geom.dat" );
if( !is_geom.good() )
    throw( Error( ERROR_LOCATION, "couldn\'t open file \'geom.dat\'" ) );
Geometry geom( is_geom );
is_geom.close();

std::ifstream is_epot( "epot.dat" );
if( !is_epot.good() )
    throw( Error( ERROR_LOCATION, "couldn\'t open file \'epot.dat\'" ) );
ScalarField epot( is_epot );
is_epot.close();

std::ifstream is_pdb( "pdb.dat" );
if( !is_pdb.good() )
    throw( Error( ERROR_LOCATION, "couldn\'t open file \'pdb.dat\'" ) );
ParticleDataBase3D pdb( is_pdb );
is_pdb.close();

The geometry object can't save the solid definitions in the file. It can only save the mesh. Therefore you will need to redefine the solids into the loaded geometry object exactly like in the simulation. One way to guarantee that the geometry definitions are the same is doing the geometry definition in a separate cpp-file.

MyDXFFile *dxffile = new MyDXFFile( "geometry.dxf" );
dxffile->set_warning_level( 2 );
MyDXFEntities *e = dxffile->get_entities();
MyDXFEntitySelection *sel = e->selection_all();
e->scale( sel, dxffile, 1.0e-3 );

DXFSolid *s1 = new DXFSolid( dxffile, "electrode 1" );
s1->define_2x3_mapping( DXFSolid::rotz );
g.set_solid( 7, s1 );
DXFSolid *s2 = new DXFSolid( dxffile, "electrode 2" );
s2->define_2x3_mapping( DXFSolid::rotz );
g.set_solid( 8, s2 );

After this you can continue the simulation by defining derived objects like EpotEfield or doing post-processing, analysis, etc.


Copyright © 2010-2011 Taneli Kalvas
Last modified: Mon Jun 23 15:31:24 EEST 2014