QMCPACK
LibxmlNumericIO.h File Reference
+ Include dependency graph for LibxmlNumericIO.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class T >
bool putContent (qmcplusplus::Vector< T > &a, xmlNodePtr cur)
 assign std::vector<T> from a node. More...
 
template<typename T >
bool putContent (qmcplusplus::Matrix< T > &a, xmlNodePtr cur)
 

Function Documentation

◆ putContent() [1/2]

bool putContent ( qmcplusplus::Vector< T > &  a,
xmlNodePtr  cur 
)
inline

assign std::vector<T> from a node.

Create a temporary vector and make assignment.

Parameters
areference std::vector<T>
curcurrent node to which a content is copied
Returns
true if successful

Definition at line 27 of file LibxmlNumericIO.h.

References qmcplusplus::n, and Vector< T, Alloc >::size().

28 {
29  std::istringstream stream(XMLNodeString{cur});
30  int i = 0;
31  int n(a.size());
32  while (!stream.eof() && i < n)
33  {
34  stream >> a[i++];
35  }
36  return true;
37 }
size_type size() const
return the current size
Definition: OhmmsVector.h:162
convert xmlNode contents into a std::string

◆ putContent() [2/2]

bool putContent ( qmcplusplus::Matrix< T > &  a,
xmlNodePtr  cur 
)
inline

Definition at line 40 of file LibxmlNumericIO.h.

References Matrix< T, Alloc >::size().

41 {
42  std::istringstream stream(XMLNodeString{cur});
43  int i = 0, ntot = a.size();
44  while (!stream.eof() && i < ntot)
45  {
46  stream >> a(i++);
47  }
48  return true;
49 }
size_type size() const
Definition: OhmmsMatrix.h:76
convert xmlNode contents into a std::string