Scalar field class. More...
#include <scalarfield.hpp>
Public Member Functions | |
ScalarField () | |
Default constructor. | |
ScalarField (const Geometry &g) | |
Constructor for geometry from g. | |
ScalarField (geom_mode_e geom_mode, Int3D size, Vec3D origo, double h) | |
Constructor for set geometry. | |
ScalarField (std::istream &s) | |
Constructor for loading scalar field from a file. | |
ScalarField (const ScalarField &f) | |
Copy constructor. | |
~ScalarField () | |
Destructor. | |
geom_mode_e | geom_mode (void) const |
Returns geometry mode. | |
Int3D | size (void) const |
Returns size array of geometry. | |
int32_t | size (int i) const |
Returns size of solid mesh in direction i. | |
int32_t | nodecount (void) const |
Returns number of nodes in the mesh. | |
Vec3D | origo (void) const |
Returns origo vector of geometry. | |
double | origo (int i) const |
Returns i-th component of vector origo. | |
Vec3D | max (void) const |
Returns vector pointing to the last mesh point opposite of origo. | |
double | max (int i) const |
Returns i-th component of vector pointing to the last mesh point opposite of origo. | |
double | h (void) const |
Returns mesh cell size. | |
double | div_h (void) const |
Returns inverse mesh cell size. | |
void | clear () |
Clears the field. | |
void | reset (geom_mode_e geom_mode, Int3D size, Vec3D origo, double h) |
Resets the field geometry. | |
void | get_minmax (double &min, double &max) const |
Search minimum and maximum values of scalar field. | |
void | epot_get_minmax (const Geometry &g, double &min, double &max) const |
Search minimum and maximum electric potential values of electric potential field. | |
ScalarField & | operator= (const ScalarField &f) |
Copy operator. | |
ScalarField & | operator+= (const ScalarField &f) |
Accumulation operator. | |
ScalarField & | operator*= (double x) |
Scaling operator. | |
ScalarField & | operator/= (double x) |
Inverse scaling operator. | |
double & | operator() (int32_t i) |
Operator for pointing to elements of the field mesh. | |
double & | operator() (int32_t i, int32_t j) |
Operator for pointing to elements of the field mesh. | |
double & | operator() (int32_t i, int32_t j, int32_t k) |
Operator for pointing to elements of the field mesh. | |
const double & | operator() (int32_t i) const |
Operator for pointing to elements of the field mesh. | |
const double & | operator() (int32_t i, int32_t j) const |
Operator for pointing to elements of the field mesh. | |
const double & | operator() (int32_t i, int32_t j, int32_t k) const |
Operator for pointing to elements of the field mesh. | |
double | operator() (Vec3D x) const |
Operator for getting linearly interpolated field values. | |
void | save (std::ostream &s) const |
Saves scalar field data to stream. | |
void | debug_print (void) const |
Prints internal data to std::cout. |
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.
ScalarField::ScalarField | ( | ) | [inline] |
Default constructor.
ScalarField::ScalarField | ( | const Geometry & | g | ) |
Constructor for geometry from g.
Returns a new scalar field with geometry parameters (including mesh size) set from g. 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 file.
ScalarField::ScalarField | ( | const ScalarField & | f | ) |
Copy constructor.
ScalarField::~ScalarField | ( | ) |
Destructor.
void ScalarField::clear | ( | ) |
Clears the field.
void ScalarField::debug_print | ( | void | ) | const |
Prints internal data to std::cout.
double ScalarField::div_h | ( | void | ) | const [inline] |
Returns inverse mesh cell size.
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.
geom_mode_e ScalarField::geom_mode | ( | void | ) | const [inline] |
Returns geometry mode.
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::h | ( | void | ) | const [inline] |
Returns mesh cell size.
double ScalarField::max | ( | int | i | ) | const [inline] |
Returns i-th component of vector pointing to the last mesh point opposite of origo.
Vec3D ScalarField::max | ( | void | ) | const [inline] |
Returns vector pointing to the last mesh point opposite of origo.
int32_t ScalarField::nodecount | ( | void | ) | const [inline] |
Returns number of nodes in the 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.
const double& ScalarField::operator() | ( | int32_t | i, | |
int32_t | j, | |||
int32_t | k | |||
) | 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 | ) | const [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.
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 | ) | [inline] |
Operator for pointing to elements of the field mesh.
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.
double ScalarField::origo | ( | int | i | ) | const [inline] |
Returns i-th component of vector origo.
Vec3D ScalarField::origo | ( | void | ) | const [inline] |
Returns origo vector of geometry.
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 | ( | std::ostream & | s | ) | const |
Saves scalar field data to stream.
int32_t ScalarField::size | ( | int | i | ) | const [inline] |
Returns size of solid mesh in direction i.
Int3D ScalarField::size | ( | void | ) | const [inline] |
Returns size array of geometry.