32 #ifndef MADNESS_WORLD_VECTOR_ARCHIVE_H__INCLUDED
33 #define MADNESS_WORLD_VECTOR_ARCHIVE_H__INCLUDED
43 #include <type_traits>
57 mutable std::vector<unsigned char>*
v;
78 typename std::enable_if< madness::is_trivially_serializable<T>::value,
void >
::type
80 const unsigned char* ptr = (
unsigned char*) t;
81 v->insert(
v->end(),ptr,ptr+n*
sizeof(
T));
87 void open(std::size_t hint=262144) {
102 mutable std::vector<unsigned char>*
v;
103 mutable std::size_t
i;
120 typename std::enable_if< madness::is_trivially_serializable<T>::value,
void >
::type
122 std::size_t
m = n*
sizeof(
T);
124 memcpy((
unsigned char*) t, &((*
v)[
i]),
m);
Interface templates for the archives (serialization).
Base class for output archive classes.
Definition: archive.h:382
Wraps an archive around an STL vector for output.
Definition: vector_archive.h:55
void close()
Close the archive.
Definition: vector_archive.h:93
std::enable_if< madness::is_trivially_serializable< T >::value, void >::type store(const T *t, long n) const
Appends data to the end of the vector.
Definition: vector_archive.h:79
std::vector< unsigned char > * v
The STL vector being wrapped.
Definition: vector_archive.h:57
void flush()
Flush the archive.
Definition: vector_archive.h:96
VectorOutputArchive(std::vector< unsigned char > &v, std::size_t hint=262144)
Create a buffer to wrap the specified vector.
Definition: vector_archive.h:64
void open(std::size_t hint=262144)
Clear any data in the vector and ensure its capacity is at least hint.
Definition: vector_archive.h:87
const double m
Definition: gfit.cc:199
auto T(World &world, response_space &f) -> response_space
Definition: global_functions.cc:34
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition: madness_exception.h:119
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
std::string type(const PairType &n)
Definition: PNOParameters.h:18
static void preamble_load(const VectorInputArchive &ar)
Load the preamble.
Definition: vector_archive.h:173
static void postamble_load(const VectorInputArchive &ar)
Load the postamble.
Definition: vector_archive.h:178
static void postamble_store(const VectorOutputArchive &ar)
Store the postamble.
Definition: vector_archive.h:161
static void preamble_store(const VectorOutputArchive &ar)
Store the preamble.
Definition: vector_archive.h:156
Default implementation of the pre/postamble for type checking.
Definition: archive.h:509