Public Member Functions | List of all members
ScalarField Class Reference

Scalar field class. More...

#include <scalarfield.hpp>

Inheritance diagram for ScalarField:
Mesh

Public Member Functions

 ScalarField ()
 Default constructor. More...
 
 ScalarField (const Mesh &m)
 Constructor for scalarfield from mesh. More...
 
 ScalarField (geom_mode_e geom_mode, Int3D size, Vec3D origo, double h)
 Constructor for set geometry. More...
 
 ScalarField (std::istream &s)
 Constructor for loading scalar field from a stream s. More...
 
 ScalarField (const ScalarField &f)
 Copy constructor. More...
 
 ~ScalarField ()
 Destructor. More...
 
void clear ()
 Clears the field. More...
 
void reset (geom_mode_e geom_mode, Int3D size, Vec3D origo, double h)
 Resets the field geometry. More...
 
void get_minmax (double &min, double &max) const
 Search minimum and maximum values of scalar field. More...
 
void epot_get_minmax (const Geometry &g, double &min, double &max) const
 Search minimum and maximum electric potential values of electric potential field. More...
 
ScalarFieldoperator= (const ScalarField &f)
 Copy operator. More...
 
ScalarFieldoperator+= (const ScalarField &f)
 Accumulation operator. More...
 
ScalarFieldoperator*= (double x)
 Scaling operator. More...
 
ScalarFieldoperator/= (double x)
 Inverse scaling operator. More...
 
double & operator() (int32_t i)
 Operator for pointing to elements of the field mesh. More...
 
double & operator() (int32_t i, int32_t j)
 Operator for pointing to elements of the field mesh. More...
 
double & operator() (int32_t i, int32_t j, int32_t k)
 Operator for pointing to elements of the field mesh. More...
 
const double & operator() (int32_t i) const
 Operator for pointing to elements of the field mesh. More...
 
const double & operator() (int32_t i, int32_t j) const
 Operator for pointing to elements of the field mesh. More...
 
const double & operator() (int32_t i, int32_t j, int32_t k) const
 Operator for pointing to elements of the field mesh. More...
 
double operator() (Vec3D x) const
 Operator for getting linearly interpolated field values. More...
 
void save (const std::string &filename) const
 Saves data to a new file filename. More...
 
void save (std::ostream &s) const
 Saves scalar field data to stream s. More...
 
void debug_print (std::ostream &os) const
 Print debugging information to os. More...
 
- Public Member Functions inherited from Mesh
 Mesh ()
 Default constructor for mesh definition. More...
 
 Mesh (geom_mode_e geom_mode, Int3D size, Vec3D origo, double h)
 Constructor for mesh definition. More...
 
 Mesh (std::istream &is)
 Constructoer for loading mesh from a stream is. More...
 
 ~Mesh ()
 Destructor. More...
 
void reset (geom_mode_e geom_mode, Int3D size, Vec3D origo, double h)
 Reset mesh definition. More...
 
geom_mode_e geom_mode (void) const
 Returns geometry mode. More...
 
int32_t dim (void) const
 Returns number of dimensions in geometry. More...
 
Int3D size (void) const
 Returns size array of geometry. More...
 
int32_t size (int i) const
 Returns size of solid mesh in direction i. More...
 
int32_t nodecount (void) const
 Returns number of nodes in the mesh. More...
 
Vec3D origo (void) const
 Returns origo vector of geometry. More...
 
double origo (int i) const
 Returns i-th component of vector origo. More...
 
Vec3D max (void) const
 Returns vector pointing to the last mesh point opposite of origo. More...
 
double max (int i) const
 Returns i-th component of vector pointing to the last mesh point opposite of origo. More...
 
double h (void) const
 Returns mesh cell size. More...
 
double div_h (void) const
 Returns reciprocal of mesh cell size (1/h). More...
 
void save (std::ostream &os) const
 Saves geometry data to stream os. More...
 
bool operator== (const Mesh &m) const
 Equality. More...
 
bool operator!= (const Mesh &m) const
 Non-equality. More...
 
void debug_print (std::ostream &os) const
 Print debugging information to stream os. More...
 

Additional Inherited Members

- Protected Attributes inherited from Mesh
geom_mode_e _geom_mode
 Geometry mode More...
 
Int3D _size
 Size of mesh. More...
 
Vec3D _origo
 Location of mesh point (0,0,0) [m]. More...
 
Vec3D _max
 Location of mesh point (size[0]-1,size[1]-1,size[2]-1) [m]. More...
 
double _h
 Length of mesh step [m]. More...
 
double _div_h
 Reciprocal of length of mesh step [1/m]. More...
 

Detailed Description

Scalar field class.

ScalarField is intended to be used as a container for scalar field data. The IBSimu Package uses scalar fields for storing electric potential and space charge density fields. A separate Efield exists for electric fields. The scalar field class provides a subset of vector operations to copy, sum and scale scalar fields. The class also includes operators for indexed access to mesh elements and interpolation functions for linearly interpolated smooth field data. The interpolation function uses linear extrapolation of field outside the defined mesh. This way it can be ensured that ScalarField returns sensible values even close by to the edges of the geometry.

The scalar field mesh size has to be at least 2 nodes in active directions for the selected geometry mode. The mesh size has to be 1 in the other (inactive) directions.

Constructor & Destructor Documentation

ScalarField::ScalarField ( )

Default constructor.

The field made with the default constructor sets geometry mode to MODE3D, mesh cell size h to 1, mesh size size to (0,0,0) and origo origo to (0,0,0). The field evaluator returns always zero.

ScalarField::ScalarField ( const Mesh m)

Constructor for scalarfield from mesh.

Returns a new scalar field with geometry parameters (including mesh size) set from m. The field is set to zero in all locations.

ScalarField::ScalarField ( geom_mode_e  geom_mode,
Int3D  size,
Vec3D  origo,
double  h 
)

Constructor for set geometry.

Returns a new scalar field with geometry set according to parameters. The field is set to zero in all locations.

ScalarField::ScalarField ( std::istream &  s)

Constructor for loading scalar field from a stream s.

ScalarField::ScalarField ( const ScalarField f)

Copy constructor.

ScalarField::~ScalarField ( )

Destructor.

Member Function Documentation

void ScalarField::clear ( )

Clears the field.

void ScalarField::debug_print ( std::ostream &  os) const

Print debugging information to os.

void ScalarField::epot_get_minmax ( const Geometry g,
double &  min,
double &  max 
) const

Search minimum and maximum electric potential values of electric potential field.

Searches the minimum and maximum electric potential field values skipping the virtual potentials of electrode edges defined by the geometry and adding in the electrode potentials.

void ScalarField::get_minmax ( double &  min,
double &  max 
) const

Search minimum and maximum values of scalar field.

It should be noted that ScalarField object itself doesn't know about virtual potentials at electrode edges and therefore this function doesn't know how to separate these points from other points. For electric potential fields use epot_get_minmax() instead.

double& ScalarField::operator() ( int32_t  i)
inline

Operator for pointing to elements of the field mesh.

double& ScalarField::operator() ( int32_t  i,
int32_t  j 
)
inline

Operator for pointing to elements of the field mesh.

double& ScalarField::operator() ( int32_t  i,
int32_t  j,
int32_t  k 
)
inline

Operator for pointing to elements of the field mesh.

const double& ScalarField::operator() ( int32_t  i) const
inline

Operator for pointing to elements of the field mesh.

const double& ScalarField::operator() ( int32_t  i,
int32_t  j 
) const
inline

Operator for pointing to elements of the field mesh.

const double& ScalarField::operator() ( int32_t  i,
int32_t  j,
int32_t  k 
) const
inline

Operator for pointing to elements of the field mesh.

double ScalarField::operator() ( Vec3D  x) const

Operator for getting linearly interpolated field values.

The field is interpolated linearly to get the field value at x. If x is outside the mesh, the field is extrapolated linearly using the field points to x. This provides correct field values also close to the mesh boundaries.

ScalarField& ScalarField::operator*= ( double  x)

Scaling operator.

ScalarField& ScalarField::operator+= ( const ScalarField f)

Accumulation operator.

ScalarField& ScalarField::operator/= ( double  x)

Inverse scaling operator.

ScalarField& ScalarField::operator= ( const ScalarField f)

Copy operator.

void ScalarField::reset ( geom_mode_e  geom_mode,
Int3D  size,
Vec3D  origo,
double  h 
)

Resets the field geometry.

Sets the field geometry according to the parameters and clears the field to zero in all locations.

void ScalarField::save ( const std::string &  filename) const

Saves data to a new file filename.

void ScalarField::save ( std::ostream &  s) const

Saves scalar field data to stream s.


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