JDFTx  1.7.0
ScalarFieldMultiplet< T, N > Struct Template Reference

Generic multiplet object with overloaded arithmetic. More...

#include <VectorField.h>

Public Member Functions

 ScalarFieldMultiplet (const Tptr *in=0)
 Construct multiplet from an array of data sets (or default: initialize to null) More...
 
 ScalarFieldMultiplet (const GridInfo &gInfo, bool onGpu=false)
 Construct a multiplet with allocated data. More...
 
Tptroperator[] (int i)
 Retrieve a reference to the i'th component (no bound checks)
 
const Tptroperator[] (int i) const
 Retrieve a const reference to the i'th component (no bound checks)
 
ScalarFieldMultiplet clone () const
 Clone data (note assignment will be reference for the actual data)
 
std::vector< typename T::DataType * > data ()
 Get the component data pointers in an std::vector.
 
std::vector< const typename T::DataType * > data () const
 Get the component data pointers in an std::vector (const version)
 
std::vector< const typename T::DataType * > const_data () const
 Get the component data pointers in an std::vector (const version)
 
std::vector< typename T::DataType * > dataGpu ()
 Get the component GPU data pointers in an std::vector.
 
std::vector< const typename T::DataType * > dataGpu () const
 Get the component GPU data pointers in an std::vector (const version)
 
std::vector< const typename T::DataType * > const_dataGpu () const
 Get the component GPU data pointers in an std::vector (const version)
 
std::vector< typename T::DataType * > dataPref ()
 
std::vector< const typename T::DataType * > dataPref () const
 
std::vector< const typename T::DataType * > const_dataPref () const
 
 operator bool () const
 Cast to bool: true if all components are non-null.
 
void loadFromFile (const char *fileName)
 Load all components from a single binary file.
 
void saveToFile (const char *fileName) const
 Save all components from a single binary file.
 

Public Attributes

std::vector< Tptrcomponent
 the array of components (also accessible via operator[])
 

Detailed Description

template<class T, int N>
struct ScalarFieldMultiplet< T, N >

Generic multiplet object with overloaded arithmetic.

Template Parameters
TScalarFieldData or ScalarFieldTildeData
NNumber of elements in multiplet

Constructor & Destructor Documentation

◆ ScalarFieldMultiplet() [1/2]

template<class T , int N>
ScalarFieldMultiplet< T, N >::ScalarFieldMultiplet ( const Tptr in = 0)
inline

Construct multiplet from an array of data sets (or default: initialize to null)

Parameters
inPointer to array, or null to initialize each component to null

◆ ScalarFieldMultiplet() [2/2]

template<class T , int N>
ScalarFieldMultiplet< T, N >::ScalarFieldMultiplet ( const GridInfo gInfo,
bool  onGpu = false 
)
inline

Construct a multiplet with allocated data.

Parameters
gInfoSimulation grid info / memory manager to use to allocate the data
onGpuBoolean flag to indicate whether memory is on GPU

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