Scalar field class. More...
#include <meshscalarfield.hpp>

Public Member Functions | |
MeshScalarField () | |
Default constructor. More... | |
MeshScalarField (const Mesh &m) | |
Constructor for scalarfield from mesh. More... | |
MeshScalarField (geom_mode_e geom_mode, Int3D size, Vec3D origo, double h) | |
Constructor for set geometry. More... | |
MeshScalarField (std::istream &s) | |
Constructor for loading scalar field from a file. More... | |
MeshScalarField (const MeshScalarField &f) | |
Copy constructor. More... | |
virtual | ~MeshScalarField () |
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... | |
MeshScalarField & | operator= (const MeshScalarField &f) |
Copy operator. More... | |
MeshScalarField & | operator+= (const MeshScalarField &f) |
Accumulation operator. More... | |
MeshScalarField & | operator-= (const MeshScalarField &f) |
Inverse accumulation operator. More... | |
MeshScalarField & | operator*= (double x) |
Scaling operator. More... | |
MeshScalarField & | operator/= (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... | |
virtual double | operator() (const Vec3D &x) const |
Operator for getting linearly interpolated field values. More... | |
void | save (const std::string &filename) const |
Saves scalar field data to file filename. More... | |
void | save (std::ostream &os) const |
Saves scalar field data to stream os. More... | |
void | debug_print (std::ostream &os) const |
Print debugging information to os. More... | |
![]() | |
virtual | ~ScalarField () |
Virtual destructor. More... | |
![]() | |
virtual | ~Field () |
Virtual destructor. More... | |
![]() | |
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... | |
uint32_t | dim (void) const |
Returns number of dimensions in geometry. More... | |
Int3D | size (void) const |
Returns size array of geometry. More... | |
uint32_t | size (int i) const |
Returns size of solid mesh in direction i. More... | |
uint32_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... | |
Int3D | closest_node (Vec3D x) const |
Returns node closest to location x. More... | |
Int3D | mesh_number (Vec3D x) const |
Returns node, which contains x. More... | |
Vec3D | coord_of_node (Int3D n) const |
Returns coordinates of node i. 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... | |
Protected Attributes | |
double * | _F |
Scalar field data. More... | |
![]() | |
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
◆ MeshScalarField() [1/5]
MeshScalarField::MeshScalarField | ( | ) |
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.
◆ MeshScalarField() [2/5]
MeshScalarField::MeshScalarField | ( | 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.
◆ MeshScalarField() [3/5]
MeshScalarField::MeshScalarField | ( | 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.
◆ MeshScalarField() [4/5]
MeshScalarField::MeshScalarField | ( | std::istream & | s | ) |
Constructor for loading scalar field from a file.
◆ MeshScalarField() [5/5]
MeshScalarField::MeshScalarField | ( | const MeshScalarField & | f | ) |
Copy constructor.
◆ ~MeshScalarField()
|
virtual |
Destructor.
Member Function Documentation
◆ clear()
void MeshScalarField::clear | ( | void | ) |
Clears the field.
◆ debug_print()
void MeshScalarField::debug_print | ( | std::ostream & | os | ) | const |
Print debugging information to os.
◆ get_minmax()
void MeshScalarField::get_minmax | ( | double & | min, |
double & | max | ||
) | const |
Search minimum and maximum values of scalar field.
◆ operator()() [1/7]
|
virtual |
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.
Implements ScalarField.
Reimplemented in EpotField.
◆ operator()() [2/7]
|
inline |
Operator for pointing to elements of the field mesh.
◆ operator()() [3/7]
|
inline |
Operator for pointing to elements of the field mesh.
◆ operator()() [4/7]
|
inline |
Operator for pointing to elements of the field mesh.
◆ operator()() [5/7]
|
inline |
Operator for pointing to elements of the field mesh.
◆ operator()() [6/7]
|
inline |
Operator for pointing to elements of the field mesh.
◆ operator()() [7/7]
|
inline |
Operator for pointing to elements of the field mesh.
◆ operator*=()
MeshScalarField & MeshScalarField::operator*= | ( | double | x | ) |
Scaling operator.
◆ operator+=()
MeshScalarField & MeshScalarField::operator+= | ( | const MeshScalarField & | f | ) |
Accumulation operator.
◆ operator-=()
MeshScalarField & MeshScalarField::operator-= | ( | const MeshScalarField & | f | ) |
Inverse accumulation operator.
◆ operator/=()
MeshScalarField & MeshScalarField::operator/= | ( | double | x | ) |
Inverse scaling operator.
◆ operator=()
MeshScalarField & MeshScalarField::operator= | ( | const MeshScalarField & | f | ) |
Copy operator.
◆ reset()
void MeshScalarField::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.
◆ save() [1/2]
void MeshScalarField::save | ( | const std::string & | filename | ) | const |
Saves scalar field data to file filename.
◆ save() [2/2]
void MeshScalarField::save | ( | std::ostream & | os | ) | const |
Saves scalar field data to stream os.
Member Data Documentation
◆ _F
|
protected |
Scalar field data.
The documentation for this class was generated from the following files: