O P A R - Open Architecture Particle in Cell Simulation - Version 3.0
Plasma simulations with dust particles
 All Classes Files Functions Variables Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes
File Class Reference

Implements a DiagPort for writing data to a file. The Series parameter of the DiagPort has the following meaning: if set to true (1) then only one file is produced with all new data appended at the end. If set to false (0) the file name given by the file parameter is parsed, replacing the first occurence of "#t" with the current time step. Then for each diagnostic output a new file is created. If the file name doesn't contain "#t" then everytime an output is created the old data is overwritten. More...

#include <diagnostic.h>

Inheritance diagram for File:
DiagPort Task

List of all members.

Public Member Functions

 File ()
 Default constructor.
virtual ~File ()
 The destructor closes the file if it is still open.
virtual void Init ()
 Initialization. In addition to DiagPort::Init it opens the file if the Series flag is set.
virtual void BeginStep (const std::string &strType="", const std::string &strName="")
 If the file is not yet open, open it. Apply file name parsing in the case of Series=false.
virtual void EndStep ()
 If it is not a series output, close the file.
virtual void Out (double d)
 Use the << opertor of Velocity to write to file. In the case of a series output, start with the number of the cycle.
virtual void Out (const Position &pos)
virtual void Out (const DOUBLEVEC &vec)
 Write a vector of double seperated by tabs into one line. In the case of a series output, start with the number of the cycle.
virtual void Out (const Velocity &V, double dF=1.0)
 Use the << opertor of Velocity to write to file. In the case of a series output, start with the number of the cycle.
virtual void Out (const grid< double > &g, double dF=1.0)
 Iterate through the grid and write out each value together with the grid position.
virtual void Out (const grid< Position > &g, double dF=1.0)
 Iterate through the grid and write out each value together with the grid position.
virtual void Out (const grid< Velocity > &g, double dF=1.0)
 Iterate through the grid and write out each value together with the grid position.
- Public Member Functions inherited from DiagPort
 DiagPort ()
 Default constructur.
virtual ~DiagPort ()
 Destructor.
std::string GetClassName () const
 Returns the name of the class, here "DiagPort".
bool Execute ()
- Public Member Functions inherited from Task
 Task ()
 Default constructor sets the running number nNr of the Task.
virtual ~Task ()
 When destructing a Task is has to be detatched from the parents Task list.
int GetStep () const
 Return the interval between execution in timesteps.
int GetEnd () const
 Return the timestep when the Task ends execution.
bool DoNow ()
 Returns true if the Task is to be executed now.
std::string GetName () const
 Returns the name given to the Task object.
virtual bool IsInteractive () const
 If not specified otherwise, a Task is not interactive.
void AttachTask (Task *pTask)
 Insert Task into Task list and registers it with the Process.
void DetachTask (Task *pTask)
 DetachTask from Task list.
virtual std::string Rebuild (std::istream &in)
 Rebuilds the task from the setup. This normally does not need to be overwritten. Rebuild always returns the next token that does not belong to the object setup.
virtual void DumpTaskList (std::ostream &o, int nDepth=0)
 Recursively dumps the complete Task list into a stream.

Protected Member Functions

std::string ParseFileName (std::string strFile) const
 Parse the filename, replacing the first occurence of "#t" by the time step.
virtual PARAMETERMAP * MakeParamMap (PARAMETERMAP *pm=NULL)
 Register the parameters needed for the Task. A derived class should overwrite this whenever it needs additional parameters from the setup file. It should then ALWAYS call the MakeParamMap of its superclass.

Protected Attributes

std::string FileName
 Contains the file name.
std::ofstream outfile
 The file to which the data is written.
- Protected Attributes inherited from DiagPort
bool Series
 Every timestep produces a new output.
SimulationSim
 A pointer to the overall simulation object.
- Protected Attributes inherited from Task
int nNr
 The running number of this Task.
std::string strName
 The name of this Task.
TaskpParent
 The parent Task to which this Task belongs.
ProcesspProcess
 The Process to which this Task belongs.
std::string strNorm
 The name of the referenced Normalization object.
NormalizationNorm
 The pointer to the referenced Normalization object.
TASKLIST plTasks
 A list of sub-Tasks.
int nStart
int nEnd
int nStep

Detailed Description

Implements a DiagPort for writing data to a file. The Series parameter of the DiagPort has the following meaning: if set to true (1) then only one file is produced with all new data appended at the end. If set to false (0) the file name given by the file parameter is parsed, replacing the first occurence of "#t" with the current time step. Then for each diagnostic output a new file is created. If the file name doesn't contain "#t" then everytime an output is created the old data is overwritten.

Parameters:
fileThe file name to which the diagnostic output is directed.

Member Function Documentation

void File::Init ( )
virtual

Initialization. In addition to DiagPort::Init it opens the file if the Series flag is set.

Todo:
seperate the open-file into a different method since it is also used in BeginStep. Also do proper exception throwing.

Reimplemented from DiagPort.


The documentation for this class was generated from the following files: