Skip to content

Commit 358b8b3

Browse files
authored
Merge pull request #6745 from bangerth/manager-serialize
Push down the functionality to serialize plugins to the ManagerBase level.
2 parents 3862285 + 1658537 commit 358b8b3

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

include/aspect/plugins.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,24 @@ namespace aspect
272272
const std::vector<std::string> &
273273
get_active_plugin_names () const;
274274

275+
/**
276+
* Write the data of this object to a stream for the purpose of
277+
* serialization.
278+
*/
279+
template <class Archive>
280+
void save (Archive &ar,
281+
const unsigned int version) const;
282+
283+
/**
284+
* Read the data of this object from a stream for the purpose of
285+
* serialization.
286+
*/
287+
template <class Archive>
288+
void load (Archive &ar,
289+
const unsigned int version);
290+
291+
BOOST_SERIALIZATION_SPLIT_MEMBER()
292+
275293
protected:
276294
/**
277295
* A list of plugin objects that have been requested in the
@@ -361,6 +379,40 @@ namespace aspect
361379
}
362380

363381

382+
383+
template <typename InterfaceType>
384+
template <class Archive>
385+
void ManagerBase<InterfaceType>::save (Archive &ar,
386+
const unsigned int) const
387+
{
388+
// let all the postprocessors save their data in a map and then
389+
// serialize that
390+
std::map<std::string,std::string> saved_text;
391+
for (const auto &p : plugin_objects)
392+
p->save (saved_text);
393+
394+
ar &saved_text;
395+
}
396+
397+
398+
template <typename InterfaceType>
399+
template <class Archive>
400+
void ManagerBase<InterfaceType>::load (Archive &ar,
401+
const unsigned int)
402+
{
403+
// get the map back out of the stream; then let the postprocessors
404+
// that we currently have get their data from there. note that this
405+
// may not be the same set of postprocessors we had when we saved
406+
// their data
407+
std::map<std::string,std::string> saved_text;
408+
ar &saved_text;
409+
410+
for (auto &p : plugin_objects)
411+
p->load (saved_text);
412+
}
413+
414+
415+
364416
template <typename InterfaceType>
365417
template <typename PluginType, typename>
366418
inline

include/aspect/postprocess/interface.h

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -242,25 +242,6 @@ namespace aspect
242242
void
243243
parse_parameters (ParameterHandler &prm) override;
244244

245-
/**
246-
* Write the data of this object to a stream for the purpose of
247-
* serialization.
248-
*/
249-
template <class Archive>
250-
void save (Archive &ar,
251-
const unsigned int version) const;
252-
253-
/**
254-
* Read the data of this object from a stream for the purpose of
255-
* serialization.
256-
*/
257-
template <class Archive>
258-
void load (Archive &ar,
259-
const unsigned int version);
260-
261-
BOOST_SERIALIZATION_SPLIT_MEMBER()
262-
263-
264245
/**
265246
* A function that is used to register postprocessor objects in such a
266247
* way that the Manager can deal with all of them without having to
@@ -311,39 +292,6 @@ namespace aspect
311292

312293
/* -------------------------- inline and template functions ---------------------- */
313294

314-
template <int dim>
315-
template <class Archive>
316-
void Manager<dim>::save (Archive &ar,
317-
const unsigned int) const
318-
{
319-
// let all the postprocessors save their data in a map and then
320-
// serialize that
321-
std::map<std::string,std::string> saved_text;
322-
for (const auto &p : this->plugin_objects)
323-
p->save (saved_text);
324-
325-
ar &saved_text;
326-
}
327-
328-
329-
template <int dim>
330-
template <class Archive>
331-
void Manager<dim>::load (Archive &ar,
332-
const unsigned int)
333-
{
334-
// get the map back out of the stream; then let the postprocessors
335-
// that we currently have get their data from there. note that this
336-
// may not be the same set of postprocessors we had when we saved
337-
// their data
338-
std::map<std::string,std::string> saved_text;
339-
ar &saved_text;
340-
341-
for (auto &p : this->plugin_objects)
342-
p->load (saved_text);
343-
}
344-
345-
346-
347295
template <int dim>
348296
template <typename PostprocessorType, typename>
349297
inline

0 commit comments

Comments
 (0)