QMCPACK
ParticleAttrib< T, Alloc > Class Template Reference

Attaches a unit to a Vector for IO. More...

+ Inheritance diagram for ParticleAttrib< T, Alloc >:
+ Collaboration diagram for ParticleAttrib< T, Alloc >:

Public Member Functions

 ParticleAttrib (size_t n=0)
 constructor with size n More...
 
 ParticleAttrib (T *ref, size_t n)
 constructor with an initialized ref More...
 
 ParticleAttrib (const ParticleAttrib &rhs)=default
 
 ParticleAttrib (std::initializer_list< T > ts)
 
ParticleAttriboperator= (const ParticleAttrib &rhs)=default
 
template<class RHS >
ParticleAttriboperator= (const RHS &rhs)
 assignment operator to enable PETE More...
 
OhmmsObjectmakeClone () const override
 
bool get (std::ostream &os) const override
 Specialized to write the unit. More...
 
bool put (std::istream &is) override
 Specialized to read the unit. More...
 
bool put (xmlNodePtr cur) override
 read from an xmlNode More...
 
void reset () override
 reset member data More...
 
void setUnit (PosUnit i)
 
PosUnit getUnit () const
 
- Public Member Functions inherited from Vector< T, Alloc >
 Vector (size_type n=0, Type_t val=Type_t())
 constructor with size n More...
 
 Vector (T *ref, size_type n)
 constructor with an initialized ref More...
 
 Vector (const Vector &rhs)
 copy constructor More...
 
template<typename CONTAINER >
 Vector (const CONTAINER &from, T *ref, size_type n)
 This allows construction of a Vector on another containers owned memory that is using a dualspace allocator. More...
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
 Vector (std::initializer_list< T > ts)
 Initializer list constructor that can deal with both POD and nontrivial nested elements with move assignment operators. More...
 
Vectoroperator= (const Vector &rhs)
 
template<typename T1 , typename C1 , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
Vectoroperator= (const Vector< T1, C1 > &rhs)
 
template<class RHS , typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
Vectoroperator= (const RHS &rhs)
 
virtual ~Vector ()
 Destructor. More...
 
void attachReference (T *ref, size_type n)
 
template<typename CONTAINER >
void attachReference (const CONTAINER &other, T *ref, size_type n)
 Attach to pre-allocated memory and propagate the allocator of the owning container. More...
 
size_type size () const
 return the current size More...
 
void resize (size_type n, Type_t val=Type_t())
 Resize the container. More...
 
void clear ()
 clear More...
 
void zero ()
 
void free ()
 free More...
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
Type_toperator[] (size_type i)
 
template<typename Allocator = Alloc, typename = IsHostSafe<Allocator>>
const Type_toperator[] (size_type i) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
pointer data ()
 
const_pointer data () const
 
template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
pointer device_data ()
 Return the device_ptr matching X if this is a vector attached or owning dual space memory. More...
 
template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
const_pointer device_data () const
 
pointer first_address ()
 
const_pointer first_address () const
 
pointer last_address ()
 
const_pointer last_address () const
 
template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
void updateTo (size_type size=0, std::ptrdiff_t offset=0)
 
template<typename Allocator = Alloc, typename = IsDualSpace<Allocator>>
void updateFrom (size_type size=0, std::ptrdiff_t offset=0)
 
- Public Member Functions inherited from OhmmsObject
 OhmmsObject ()
 default constructor More...
 
 OhmmsObject (const std::string &tname, const std::string &oname)
 contructor More...
 
 ~OhmmsObject () override
 
int id () const
 return the ObjectID which is unique to each object More...
 
void setID (int i)
 overwrite ObjectID More...
 
int elementByteSize () const
 returns the byte size of the object More...
 
void setTypeName (const std::string &tname)
 set the type name More...
 
void setObjName (const std::string &oname)
 set the object name More...
 
const std::string & typeName () const
 return the type name More...
 
const std::string & objName () const
 return the object name More...
 
- Public Member Functions inherited from OhmmsElementBase
 OhmmsElementBase (const char *aname="none")
 constructor with a name More...
 
virtual ~OhmmsElementBase ()
 destructor More...
 
const std::string & getName () const
 return the name More...
 
void setName (const std::string &aname)
 set name More...
 
void setIOMode (int imode)
 set iomode More...
 
virtual bool add (xmlNodePtr parent)
 add a xmlNode to the children list of parent More...
 
void put (const std::string &s)
 read from string More...
 
virtual void begin_node (std::ostream &os) const
 write the start of a node More...
 
virtual void end_node (std::ostream &os) const
 write the end of a node More...
 

Public Attributes

PosUnit InUnit
 The unit type. More...
 

Private Types

using __my_base = Vector< T, Alloc >
 

Additional Inherited Members

- Public Types inherited from Vector< T, Alloc >
using Type_t = T
 
using value_type = T
 
using iterator = T *
 
using const_iterator = const T *
 
using size_type = typename Alloc::size_type
 
using pointer = typename Alloc::pointer
 
using const_pointer = typename Alloc::const_pointer
 
using This_t = Vector< T, Alloc >
 
- Public Types inherited from OhmmsElementBase
enum  { useLIBXML = 0, useLIBXMLPP, usePLAIN }
 enumeration to choose the xml parser More...
 
- Protected Attributes inherited from OhmmsObject
std::string TypeName
 the type name of this object More...
 
int ObjectID
 the unique ID of this object More...
 
int ElementByteSize
 the byte size of this object More...
 
- Protected Attributes inherited from OhmmsElementBase
int myIOMode
 the type of IO mode: default is useLIBXML More...
 
std::string myName
 the name of the node, corresponds to the xml tag More...
 

Detailed Description

template<class T, typename Alloc = std::allocator<T>>
class qmcplusplus::ParticleAttrib< T, Alloc >

Attaches a unit to a Vector for IO.

Makes Vect

Definition at line 33 of file ParticleAttrib.h.

Member Typedef Documentation

◆ __my_base

using __my_base = Vector<T, Alloc>
private

Definition at line 35 of file ParticleAttrib.h.

Constructor & Destructor Documentation

◆ ParticleAttrib() [1/4]

ParticleAttrib ( size_t  n = 0)
inlineexplicit

constructor with size n

Definition at line 42 of file ParticleAttrib.h.

◆ ParticleAttrib() [2/4]

ParticleAttrib ( T *  ref,
size_t  n 
)
inlineexplicit

constructor with an initialized ref

Definition at line 45 of file ParticleAttrib.h.

◆ ParticleAttrib() [3/4]

ParticleAttrib ( const ParticleAttrib< T, Alloc > &  rhs)
default

◆ ParticleAttrib() [4/4]

ParticleAttrib ( std::initializer_list< T >  ts)
inline

Definition at line 49 of file ParticleAttrib.h.

Member Function Documentation

◆ get()

bool get ( std::ostream &  os) const
inlineoverridevirtual

Specialized to write the unit.

Returns
true, if the attribute is relative to a unit

Ad hoc get function to tell users if this attribute is absolute or relative value. E.g., is Cartesian unit vs Lattice unit.

Implements OhmmsElementBase.

Definition at line 74 of file ParticleAttrib.h.

75  {
76  os << InUnit;
77  return true;
78  }
PosUnit InUnit
The unit type.

◆ getUnit()

PosUnit getUnit ( ) const
inline

Definition at line 63 of file ParticleAttrib.h.

63 { return InUnit; }
PosUnit InUnit
The unit type.

◆ makeClone()

OhmmsObject* makeClone ( ) const
inlineoverridevirtual

Implements OhmmsObject.

Definition at line 66 of file ParticleAttrib.h.

66 { return new ParticleAttrib<T, Alloc>(*this); }

◆ operator=() [1/2]

ParticleAttrib& operator= ( const ParticleAttrib< T, Alloc > &  rhs)
inlinedefault

◆ operator=() [2/2]

ParticleAttrib& operator= ( const RHS &  rhs)
inline

assignment operator to enable PETE

Definition at line 55 of file ParticleAttrib.h.

56  {
57  assign(*this, rhs);
58  return *this;
59  }
Matrix< T1, C1 > & assign(Matrix< T1, C1 > &lhs, const RHS &rhs)

◆ put() [1/2]

bool put ( std::istream &  is)
inlineoverridevirtual

Specialized to read the unit.

Implements OhmmsElementBase.

Definition at line 82 of file ParticleAttrib.h.

83  {
84  is >> InUnit;
85  return true;
86  }
PosUnit InUnit
The unit type.

◆ put() [2/2]

bool put ( xmlNodePtr  cur)
inlineoverridevirtual

read from an xmlNode

Implements OhmmsElementBase.

Definition at line 89 of file ParticleAttrib.h.

89 { return true; }

◆ reset()

void reset ( )
inlineoverridevirtual

reset member data

Implements OhmmsElementBase.

Definition at line 92 of file ParticleAttrib.h.

92 {}

◆ setUnit()

void setUnit ( PosUnit  i)
inline

Definition at line 62 of file ParticleAttrib.h.

Referenced by InitMolecularSystem::initWithVolume(), and XMLParticleParser::readXML().

62 { InUnit = i; }
PosUnit InUnit
The unit type.

Member Data Documentation

◆ InUnit


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