36 #ifndef CELLVECDATA_HPP_
37 #define CELLVECDATA_HPP_
39 #include <boost/shared_ptr.hpp>
46 #include "AbstractCellProperty.hpp"
48 #include <boost/serialization/base_object.hpp>
49 #include <boost/serialization/map.hpp>
50 #include <boost/serialization/array.hpp>
52 #include "ArchiveLocationInfo.hpp"
84 template<
class Archive>
85 void serialize(Archive & archive,
const unsigned int version)
87 archive & boost::serialization::base_object<AbstractCellProperty>(*this);
107 CellVecData(
const std::map<std::string, Vec>& rCellVecDataMap);
121 void SetItem(
const std::string& rVariableName,
Vec data);
130 Vec GetItem(
const std::string& rVariableName)
const;
142 std::vector<std::string>
GetKeys()
const;
152 namespace serialization
154 template<
class Archive>
155 inline void save_construct_data(
156 Archive & ar,
const CellVecData * t,
const unsigned int file_version)
161 std::vector<std::string> keys = t->
GetKeys();
163 for (std::vector<std::string>::iterator iter = keys.begin(); iter != keys.end(); ++iter)
165 std::string key = *iter;
171 VecGetArray(vec_data, &p_vec_data);
173 VecGetSize(vec_data, &size);
174 VecGetLocalSize(vec_data, &local_size);
176 assert( local_size == size);
178 ar << make_array(p_vec_data, size);
179 VecRestoreArray(vec_data, &p_vec_data);
187 template<
class Archive>
188 inline void load_construct_data(
189 Archive & ar,
CellVecData * t,
const unsigned int file_version)
194 std::map<std::string, Vec> archived_cell_vec_data;
195 for (
unsigned map_entry = 0; map_entry < map_size; ++map_entry)
204 double *p_archived_vec;
205 VecGetArray(archived_vec, &p_archived_vec);
206 ar >> make_array<double>(p_archived_vec, size);
207 VecRestoreArray(archived_vec, &p_archived_vec);
212 archived_cell_vec_data[key] = archived_vec;
std::map< std::string, Vec > mCellVecData
Vec GetItem(const std::string &rVariableName) const
void serialize(Archive &archive, const unsigned int version)
friend class boost::serialization::access
void SetItem(const std::string &rVariableName, Vec data)
std::vector< std::string > GetKeys() const
#define CHASTE_CLASS_EXPORT(T)
unsigned GetNumItems() const