To read project parameters from a file in IPF format. More...

#include <IPF.h>

Public Member Functions

 IPF ()
 Default constructor.
 
 IPF (const string &file)
 Constructor that gives the data file name.
 
 IPF (const string &prog, const string &file)
 Constructor that reads parameters in file file and prints header information for the calling program prog. It reads parameters in IPF Format from this file.
 
 ~IPF ()
 Destructor.
 
real_t getDisplay ()
 Display acquired parameters.
 
int getVerbose ()
 Return parameter read using keyword Verbose.
 
int getOutput () const
 Return parameter read using keyword Output.
 
int getSave () const
 Return parameter read using keyword Save.
 
int getPlot () const
 Return parameter read using keyword Plot.
 
int getBC () const
 Return parameter read using keyword BC.
 
int getBF () const
 Return parameter read using keyword BF.
 
int getSF () const
 Return parameter read using keyword SF.
 
int getInit () const
 Return parameter read using keyword Init.
 
int getData () const
 Return parameter read using keyword Data.
 
size_t getNbSteps () const
 Return parameter read using keyword NbSteps.
 
size_t getNbIter () const
 Return parameter read using keyword NbIter.
 
real_t getTimeStep () const
 Return parameter read using keyword TimeStep.
 
real_t getMaxTime () const
 Return parameter read using keyword MaxTime.
 
real_t getTolerance () const
 Return parameter read using keyword Tolerance.
 
int getIntPar (size_t n=1) const
 Return n-th parameter read using keyword IntPar
 
string getStringPar (size_t n=1) const
 Return n-th parameter read using keyword StringPar.
 
real_t getDoublePar (size_t n=1) const
 Return n-th parameter read using keyword DoublePar.
 
Point< real_t > getPointDoublePar (size_t n=1) const
 Return n-th parameter read using keyword PointDoublePar.
 
complex_t getComplexPar (size_t n=1) const
 Return n-th parameter read using keyword StringPar.
 
string getString (const string &label) const
 Return parameter corresponding to a given label, when its value is a string.
 
string getString (const string &label, string def) const
 Return parameter corresponding to a given label, when its value is a string.
 
int getInteger (const string &label) const
 Return parameter corresponding to a given label, when its value is an integer.
 
int getInteger (const string &label, int def) const
 Return parameter corresponding to a given label, when its value is an integer.
 
real_t getDouble (const string &label) const
 Return parameter corresponding to a given label, when its value is a real_t.
 
real_t getDouble (const string &label, real_t def) const
 Return parameter corresponding to a given label, when its value is a real_t.
 
complex_t getComplex (const string &label) const
 Return parameter corresponding to a given label, when its value is a complex number.
 
complex_t getComplex (const string &label, complex_t def) const
 Return parameter corresponding to a given label, when its value is a complex number.
 
int contains (const string &label) const
 check if the project file contains a given parameter
 
void get (const string &label, Vect< real_t > &a) const
 Read an array of real values, corresponding to a given label.
 
real_t getArraySize (const string &label, size_t j) const
 Return an array entry for a given label.
 
void get (const string &label, int &a) const
 Return integer parameter corresponding to a given label.
 
void get (const string &label, real_t &a) const
 Return real parameter corresponding to a given label.
 
void get (const string &label, complex_t &a) const
 Return complex parameter corresponding to a given label.
 
void get (const string &label, string &a) const
 Return string parameter corresponding to a given label.
 
string getProject () const
 Return parameter read using keyword Project.
 
string getDomainFile () const
 Return pameter using keyword Mesh.
 
string getMeshFile (size_t i=1) const
 Return i-th parameter read using keyword mesh_file.
 
string getInitFile () const
 Return parameter read using keyword InitFile.
 
string getRestartFile () const
 Return parameter read using keyword RestartFile.
 
string getBCFile () const
 Return parameter read using keyword BCFile.
 
string getBFFile () const
 Return parameter read using keyword BFFile.
 
string getSFFile () const
 Return parameter read using keyword SFFile.
 
string getSaveFile () const
 Return parameter read using keyword SaveFile.
 
string getPlotFile (int i=1) const
 Return i-th parameter read using keyword PlotFile.
 
string getPrescriptionFile (int i=1) const
 Return parameter read using keyword DataFile.
 
string getAuxFile (size_t i=1) const
 Return i-th parameter read using keyword Auxfile.
 
string getDensity () const
 Return expression (to be parsed, function of x, y, z, t) for density function.
 
string getElectricConductivity () const
 Return expression (to be parsed, function of x, y, z, t) for electric conductivity.
 
string getElectricPermittivity () const
 Return expression (to be parsed, function of x, y, z, t) for electric permittivity.
 
string getMagneticPermeability () const
 Return expression (to be parsed, function of x, y, z, t) for magnetic permeability.
 
string getPoissonRatio () const
 Return expression (to be parsed, function of x, y, z, t) for Poisson ratio.
 
string getThermalConductivity () const
 Return expression (to be parsed, function of x, y, z, t) for thermal conductivity.
 
string getRhoCp () const
 Return expression (to be parsed, function of x, y, z, t) for density * specific heat.
 
string getViscosity () const
 Return expression (to be parsed, function of x, y, z, t) for viscosity.
 
string getYoungModulus () const
 Return expression (to be parsed, function of x, y, z, t) for Young's modulus.
 

Detailed Description

To read project parameters from a file in IPF format.

This class can be used to acquire various parameters from a parameter file of IPF (Input Project File). The declaration of an instance of this class avoids reading data in your main program. The acquired parameters are retrieved through information members of the class. Note that all the parameters have default values

Author
Rachid Touzani

Constructor & Destructor Documentation

◆ IPF()

IPF ( const string &  file)

Constructor that gives the data file name.

It reads parameters in IPF Format from this file.

Member Function Documentation

◆ contains()

int contains ( const string &  label) const

check if the project file contains a given parameter

Parameters
[in]labelLabel that identifies the label to seek in file
Returns
0 if the parameter is not found, n if the parameter is found, where n is the parameter index in the parameter list

◆ get() [1/5]

void get ( const string &  label,
complex_t &  a 
) const

Return complex parameter corresponding to a given label.

Parameters
[in]labelLabel that identifies the complex number (read from input file).
[out]aReturned value. If this label is not found an error message is displayed and program stops.

◆ get() [2/5]

void get ( const string &  label,
int &  a 
) const

Return integer parameter corresponding to a given label.

Parameters
[in]labelLabel that identifies the integer number (read from input file).
[out]aReturned value. If this label is not found an error message is displayed and program stops. Note: This member function can be used instead of getInteger

◆ get() [3/5]

void get ( const string &  label,
real_t &  a 
) const

Return real parameter corresponding to a given label.

Parameters
[in]labelLabel that identifies the real (real_t) number (read from input file).
[out]aReturned value. If this label is not found an error message is displayed and program stops. Note: This member function can be used instead of getReal_T

◆ get() [4/5]

void get ( const string &  label,
string &  a 
) const

Return string parameter corresponding to a given label.

Parameters
[in]labelLabel that identifies the atring (read from input file).
[out]aReturned value. Note: This member function can be used instead of getString If this label is not found an error message is displayed and program stops. Note: This member function can be used instead of getString

◆ get() [5/5]

void get ( const string &  label,
Vect< real_t > &  a 
) const

Read an array of real values, corresponding to a given label.

Parameters
[in]labelLabel that identifies the array (read from input file).
[in]aVector that contain the array. The vector is properly resized before filling.
Remarks
If this label is not found an error message is displayed.

◆ getArraySize()

real_t getArraySize ( const string &  label,
size_t  j 
) const

Return an array entry for a given label.

Parameters
[in]labelLabel that identifies the array (read from input file).
[in]jIndex of entry in the array (Starting from 1)
Remarks
If this label is not found an error message is displayed and program stops.

◆ getAuxFile()

string getAuxFile ( size_t  i = 1) const

Return i-th parameter read using keyword Auxfile.

Here we have at most 10 integer extra parameters that can be used for any auxiliary file names. Default value for i is 1

◆ getBC()

int getBC ( ) const

Return parameter read using keyword BC.

This parameter can be used to set a boundary condition flag.

◆ getBCFile()

string getBCFile ( ) const

Return parameter read using keyword BCFile.

This parameter can be used to read a boundary condition file name.

◆ getBF()

int getBF ( ) const

Return parameter read using keyword BF.

This parameter can be used to set a body force flag.

◆ getBFFile()

string getBFFile ( ) const

Return parameter read using keyword BFFile.

This parameter can be used to read a body force file name.

◆ getComplex() [1/2]

complex_t getComplex ( const string &  label) const

Return parameter corresponding to a given label, when its value is a complex number.

Parameters
[in]labelLabel that identifies the complex number (read from input file) If this label is not found an error message is displayed and program stops

◆ getComplex() [2/2]

complex_t getComplex ( const string &  label,
complex_t  def 
) const

Return parameter corresponding to a given label, when its value is a complex number.

Case where a default value is provided

Parameters
[in]labelLabel that identifies the complex number (read from input file)
[in]defDefault value: Value to assign if the sought parameter is not found

◆ getComplexPar()

complex_t getComplexPar ( size_t  n = 1) const

Return n-th parameter read using keyword StringPar.

Here we have at most 20 integer extra parameters that can be used for any purpose. Default value for n is 1

◆ getData()

int getData ( ) const

Return parameter read using keyword Data.

This parameter can be used to set a various data flag.

◆ getDouble() [1/2]

real_t getDouble ( const string &  label) const

Return parameter corresponding to a given label, when its value is a real_t.

Parameters
[in]labelLabel that identifies the real number (read from input file). If this label is not found an error message is displayed and program stops.

◆ getDouble() [2/2]

real_t getDouble ( const string &  label,
real_t  def 
) const

Return parameter corresponding to a given label, when its value is a real_t.

Case where a default value is provided

Parameters
[in]labelLabel that identifies the real number (read from input file)
[in]defDefault value: Value to assign if the sought parameter is not found

◆ getDoublePar()

real_t getDoublePar ( size_t  n = 1) const

Return n-th parameter read using keyword DoublePar.

Here we have at most 20 integer extra parameters that can be used for any purpose. Default value for n is 1

◆ getInit()

int getInit ( ) const

Return parameter read using keyword Init.

This parameter can be used to set an initial data flag.

◆ getInitFile()

string getInitFile ( ) const

Return parameter read using keyword InitFile.

This parameter can be used to read an initial data file name.

◆ getInteger() [1/2]

int getInteger ( const string &  label) const

Return parameter corresponding to a given label, when its value is an integer.

Parameters
[in]labelLabel that identifies the integer number (read from input file) If this label is not found an error message is displayed and program stops

◆ getInteger() [2/2]

int getInteger ( const string &  label,
int  def 
) const

Return parameter corresponding to a given label, when its value is an integer.

Case where a default value is provided

Parameters
[in]labelLabel that identifies the integer number (read from input file).
[in]defDefault value: Value to assign if the sought parameter is not found

◆ getIntPar()

int getIntPar ( size_t  n = 1) const

Return n-th parameter read using keyword IntPar

Here we have at most 20 integer extra parameters that can be used for any purpose. Default value for n is 1

◆ getMaxTime()

real_t getMaxTime ( ) const

Return parameter read using keyword MaxTime.

This parameter can be used to read a maximum time value.

◆ getMeshFile()

string getMeshFile ( size_t  i = 1) const

Return i-th parameter read using keyword mesh_file.

Here we have at most 10 integer extra parameters that can be used for any purpose. Default value for i is 1

◆ getNbIter()

size_t getNbIter ( ) const

Return parameter read using keyword NbIter.

This parameter can be used to read a number of iterations.

◆ getNbSteps()

size_t getNbSteps ( ) const

Return parameter read using keyword NbSteps.

This parameter can be used to read a number of time steps.

◆ getOutput()

int getOutput ( ) const

Return parameter read using keyword Output.

This parameter can be used to control output behavior in a program.

◆ getPlot()

int getPlot ( ) const

Return parameter read using keyword Plot.

This parameter can be used to control result saving for plotting in a program.

◆ getPlotFile()

string getPlotFile ( int  i = 1) const

Return i-th parameter read using keyword PlotFile.

Here we have at most 10 integer extra parameters that can be used for plot file names. Default value for i is 1

◆ getPointDoublePar()

Point< real_t > getPointDoublePar ( size_t  n = 1) const

Return n-th parameter read using keyword PointDoublePar.

Here we have at most 20 integer extra parameters that can be used for any purpose. Default value for n is 1

◆ getPrescriptionFile()

string getPrescriptionFile ( int  i = 1) const

Return parameter read using keyword DataFile.

This parameter can be used to read a Prescription file.

◆ getProject()

string getProject ( ) const

Return parameter read using keyword Project.

This parameter can be used to read a project's name.

◆ getRestartFile()

string getRestartFile ( ) const

Return parameter read using keyword RestartFile.

This parameter can be used to read a restart file name.

◆ getSave()

int getSave ( ) const

Return parameter read using keyword Save.

This parameter can be used to control result saving in a program (e.g. for a restarting purpose).

◆ getSaveFile()

string getSaveFile ( ) const

Return parameter read using keyword SaveFile.

This parameter can be used to read a save file name.

◆ getSF()

int getSF ( ) const

Return parameter read using keyword SF.

This parameter can be used to set a surface force flag.

◆ getSFFile()

string getSFFile ( ) const

Return parameter read using keyword SFFile.

This parameter can be used to read a source force file name.

◆ getString() [1/2]

string getString ( const string &  label) const

Return parameter corresponding to a given label, when its value is a string.

Parameters
[in]labelLabel that identifies the string (read from input file) If this label is not found an error message is displayed and program stops

◆ getString() [2/2]

string getString ( const string &  label,
string  def 
) const

Return parameter corresponding to a given label, when its value is a string.

Case where a default value is provided

Parameters
[in]labelLabel that identifies the string (read from input file)
[in]defDefault value: Value to assign if the sought parameter is not found

◆ getStringPar()

string getStringPar ( size_t  n = 1) const

Return n-th parameter read using keyword StringPar.

Here we have at most 20 integer extra parameters that can be used for any purpose. Default value for n is 1

◆ getTimeStep()

real_t getTimeStep ( ) const

Return parameter read using keyword TimeStep.

This parameter can be used to read a time step value.

◆ getTolerance()

real_t getTolerance ( ) const

Return parameter read using keyword Tolerance.

This parameter can be used to read a tolerance value to control convergence.