most generic field object More...
#include <mdp_field.h>
Public Member Functions | |
| mdp_field () | |
| declare empty field (zero size) | |
| mdp_field (mdp_lattice &a, int n=1) | |
| declares a field on lattice a and allocates a vector of n T at each site | |
| mdp_field (const mdp_field &field) | |
| bool | allocated () |
| checks if a field is allocated of has zero-size | |
| void | allocate_field (mdp_lattice &a, int n=0) |
| Allows dynamical allocation of a field that is not allocated. | |
| void | fill_header () |
| void | deallocate_memory () |
| void | reset_field () |
| do not use, may cause memory leaks | |
| void | deallocate_field () |
| dynamically deallocate field | |
| virtual | ~mdp_field () |
| T & | operator() (mdp_site x, int i=0) |
| returns component i of the vector of objects T stored at site x | |
| T & | operator() (int idx, int i=0) |
| T * | operator[] (mdp_site x) |
| retruns the address of the vector of objects T stored at site x | |
| T & | operator[] (mdp_int i) |
| T * | address (mdp_site x, int i=0) const |
| void | shift (int i, int mu) |
| void | operator= (const mdp_field &a) |
| void | operator= (const T a) |
| void | operator+= (const mdp_field &a) |
| void | operator-= (const mdp_field &a) |
| template<class T2 > | |
| void | operator*= (const T2 a) |
| template<class T2 > | |
| void | operator/= (const T2 a) |
| mdp_lattice & | lattice () const |
| returns by reference the lattice this field is defined on | |
| mdp_int | field_size () |
| returns the total memory in bytes occupied by the field | |
| mdp_int | file_size () |
| returns the total space in bytes required to store the field | |
| int | where_global (mdp_int i) |
| only used by mdp_field::load() and mdp_field::save() | |
| void | switch_endianess_4bytes () |
| void | switch_endianess_8bytes () |
| mdp_int | global_size () |
| lattice size in units of sizeof(T) | |
| mdp_int | physical_size () |
| mdp_int | size_per_site () |
| mdp_int | physical_local_start (int i=2) |
| mdp_int | physical_local_stop (int i=2) |
| T * | physical_address (mdp_int i=0) |
| void | update (int np=2, int d=-1, int size=1) |
| bool | load (string filename, int processIO=0, mdp_int max_buffer_size=1024, bool load_header=true, mdp_int skip_bytes=0, bool(*user_read)(FILE *, void *, mdp_int, mdp_int, mdp_int, const mdp_lattice &)=0, bool try_switch_endianess=true) |
| Best way to load a field. | |
| bool | save (string filename, int processIO=0, mdp_int max_buffer_size=1024, bool load_header=true, mdp_int skip_bytes=0, bool(*user_write)(FILE *, void *, mdp_int, mdp_int, mdp_int, const mdp_lattice &)=0) |
| Best way to save a field. | |
| bool | save_vtk (string filename, int t=-1, int component=-1, int processIO=0, bool ASCII=false) |
| Best way to save a field. | |
Public Attributes | |
| mdp_field_file_header | header |
| the field file header, contains data only if field was read from file | |
Protected Attributes | |
| mdp_lattice * | ptr |
| T * | m |
| mdp_int | Tsize |
| mdp_int | size |
| int | field_components |
most generic field object
Example:
/// int box[]={10,10,10};
/// mdp_lattice lattice(3,box);
/// mdp_field<float> psi(lattice,10);
/// mdp_site x(lattice);
/// forallsites(x)
/// for(int i=0; i<10; i++)
/// psi(x,i)=0.0;
/// psi.update(); // synchronization
/// psi.save("myfield");
/// psi.load("myfield");
/// | mdp_field< T >::mdp_field | ( | mdp_lattice & | a, | |
| int | n = 1 | |||
| ) | [inline] |
declares a field on lattice a and allocates a vector of n T at each site
| void mdp_field< T >::allocate_field | ( | mdp_lattice & | a, | |
| int | n = 0 | |||
| ) | [inline] |
Allows dynamical allocation of a field that is not allocated.
| bool mdp_field< T >::allocated | ( | ) | [inline] |
checks if a field is allocated of has zero-size
| void mdp_field< T >::deallocate_field | ( | ) | [inline] |
dynamically deallocate field
| void mdp_field< T >::deallocate_memory | ( | ) | [inline] |
returns the total memory in bytes occupied by the field
returns the total space in bytes required to store the field
| void mdp_field< T >::fill_header | ( | ) | [inline] |
lattice size in units of sizeof(T)
| mdp_lattice& mdp_field< T >::lattice | ( | ) | const [inline] |
returns by reference the lattice this field is defined on
| bool mdp_field< T >::load | ( | string | filename, | |
| int | processIO = 0, |
|||
| mdp_int | max_buffer_size = 1024, |
|||
| bool | load_header = true, |
|||
| mdp_int | skip_bytes = 0, |
|||
| bool(*)(FILE *, void *, mdp_int, mdp_int, mdp_int, const mdp_lattice &) | user_read = 0, |
|||
| bool | try_switch_endianess = true | |||
| ) | [inline] |
Best way to load a field.
| T& mdp_field< T >::operator() | ( | int | idx, | |
| int | i = 0 | |||
| ) | [inline] |
returns component i of the vector of objects T stored at site x
Reimplemented in mdp_nmatrix_field, mdp_nvector_field, and mdp_vector_field.
| void mdp_field< T >::operator= | ( | const T | a | ) | [inline] |
Reimplemented in dwfermi_field, fermi_field, sdwf_field, and staggered_field.
retruns the address of the vector of objects T stored at site x
| void mdp_field< T >::reset_field | ( | ) | [inline] |
do not use, may cause memory leaks
| bool mdp_field< T >::save | ( | string | filename, | |
| int | processIO = 0, |
|||
| mdp_int | max_buffer_size = 1024, |
|||
| bool | load_header = true, |
|||
| mdp_int | skip_bytes = 0, |
|||
| bool(*)(FILE *, void *, mdp_int, mdp_int, mdp_int, const mdp_lattice &) | user_write = 0 | |||
| ) | [inline] |
Best way to save a field.
| bool mdp_field< T >::save_vtk | ( | string | filename, | |
| int | t = -1, |
|||
| int | component = -1, |
|||
| int | processIO = 0, |
|||
| bool | ASCII = false | |||
| ) | [inline] |
Best way to save a field.
| void mdp_field< T >::shift | ( | int | i, | |
| int | mu | |||
| ) | [inline] |
shifts the entire fields in direction mu of i steps (i can be positive or negative) note that if i=1, field(x-mu) is assigned to field(x) function requires communication
| void mdp_field< T >::switch_endianess_4bytes | ( | ) | [inline] |
| void mdp_field< T >::switch_endianess_8bytes | ( | ) | [inline] |
| void mdp_field< T >::update | ( | int | np = 2, |
|
| int | d = -1, |
|||
| int | ncomp = 1 | |||
| ) | [inline] |
the most important communication function in MDP. it must be called after each field variables are modified. it restores the syncronization between parallel processes.
The only communication function for a field object To be invoked every time field variables are assigned and Need to be sinchronized between the parallel processes
only used by mdp_field::load() and mdp_field::save()
int mdp_field< T >::field_components [protected] |
| mdp_field_file_header mdp_field< T >::header |
the field file header, contains data only if field was read from file
mdp_lattice* mdp_field< T >::ptr [protected] |
1.6.1