HILA
Loading...
Searching...
No Matches
Lattice Class Reference

main interface class to lattices.
More...

#include <lattice.h>

Public Member Functions

bool can_block (const CoordinateVector &factor) const
 Test if lattice can be blocked by factor given in argument.
 
bool is_base () const
 lattice.is_base() is used to check if the current lattice is the original one, i.e. not a blocked one
 
const lattice_structoperator-> () const noexcept
 lattice-> defines an operator with which detailed lattice_struct fields can be accessed.
 
bool operator== (const Lattice &rhs)
 Equality operator == is true if the two Lattices are the same, i.e. point to the same lattice.
 
lattice_structptr () const
 get non-const pointer to lattice_struct (cf. operator ->)
 
const lattice_structref () const
 get const ref to lattice_struct, lattice.ref(). is equivalent to lattice->
 
void setup (const CoordinateVector &siz)
 lattice.setup(CoordinateVector size) - set up the base lattice. Called at the beginning of the program. Can be called only once during the program run
 
int size (Direction d) const
 lattice.size() -> CoordinateVector or lattice.size(d) -> int returns the dimensions of the lattice, in latter case to direction d Can be used inside onsites()-loops
 
Lattice switch_to (Lattice &lat)
 With a valid Lattice, switch this lattice to be active.
 
Lattice switch_to (lattice_struct *lat)
 With a valid lattice_struct pointer, switch this lattice to be active.
 
Lattice switch_to_base ()
 lattice.switch_to_base() switches the base lattice active (if not already)
 
Lattice unblock ()
 Unblock lattice, returning to parent. Current lattice must be a blocked lattice.
 
int64_t volume () const
 lattice.volume() returns lattice volume Can be used inside onsites()-loops
 

Detailed Description

main interface class to lattices.

Lightweight class, contains only pointer to lattice_struct so can be returned as such from functions.

Examples
/home/runner/work/HILA/HILA/libraries/plumbing/field.h.

Definition at line 396 of file lattice.h.

Member Function Documentation

◆ can_block()

bool Lattice::can_block ( const CoordinateVector factor) const
inline

Test if lattice can be blocked by factor given in argument.

lattice.size() must be element-by-element divisible by factor

Example: lattice.can_block({2,2,2}) returns true if (3-dim) lattice dimensions are even

Definition at line 531 of file lattice.h.

◆ is_base()

bool Lattice::is_base ( ) const
inline

lattice.is_base() is used to check if the current lattice is the original one, i.e. not a blocked one

Returns
true if current lattice is the base lattice, otherwise false

Definition at line 605 of file lattice.h.

◆ operator->()

const lattice_struct * Lattice::operator-> ( ) const
inlinenoexcept

lattice-> defines an operator with which detailed lattice_struct fields can be accessed.

For example: lattice->mynode.min: CoordinateVector of the min-corner managed by this MPI rank lattice->mynode.size: CV of the local node dimensions.

For further info, check the class lattice_struct. This cannot be used within onsites(), copy the relevant field to local variable first.

Definition at line 463 of file lattice.h.

◆ operator==()

bool Lattice::operator== ( const Lattice rhs)
inline

Equality operator == is true if the two Lattices are the same, i.e. point to the same lattice.

Parameters
rhs

Definition at line 492 of file lattice.h.

◆ ptr()

lattice_struct * Lattice::ptr ( ) const
inline

get non-const pointer to lattice_struct (cf. operator ->)

This can be used to access fields of lattice_struct, this time returning non-const. reference. NOTE! you should not

Examples
/home/runner/work/HILA/HILA/libraries/plumbing/field.h.

Definition at line 474 of file lattice.h.

◆ switch_to()

Lattice Lattice::switch_to ( Lattice lat)
inline

With a valid Lattice, switch this lattice to be active.

useful e.g. in switching to lattice where field a belongs to: lattice.switch_to(a.mylattice());

Definition at line 517 of file lattice.h.

◆ switch_to_base()

Lattice Lattice::switch_to_base ( )
inline

lattice.switch_to_base() switches the base lattice active (if not already)

Returns
The Lattice for the base lattice (i.e. the first lattice)
Examples
/home/runner/work/HILA/HILA/libraries/plumbing/field.h.

Definition at line 614 of file lattice.h.

◆ unblock()

Lattice Lattice::unblock ( )
inline

Unblock lattice, returning to parent. Current lattice must be a blocked lattice.

Returns
lattice_struct * to new lattice
Examples
lattice.block.

Definition at line 589 of file lattice.h.

◆ volume()

int64_t Lattice::volume ( ) const
inline

lattice.volume() returns lattice volume Can be used inside onsites()-loops

Returns
lattice volume

Definition at line 424 of file lattice.h.


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