MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
fmsdatacollection.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_FMSDATACOLLECTION
13#define MFEM_FMSDATACOLLECTION
14
15#include "../config/config.hpp"
16
17#ifdef MFEM_USE_FMS
18
19#include "datacollection.hpp"
20#include <fms.h>
21
22namespace mfem
23{
24
25/** @brief Data collection that uses FMS. */
26/** FMSDataCollection lets MFEM read/write data using FMS.
27
28 For more information, see:
29 - FMS project, https://ceed.exascaleproject.org/fms/
30*/
31
32/// Data collection with FMS I/O routines
34{
35protected:
36 // file name helpers
37
38 /// Returns file name for the current cycle
39 std::string RootFileName();
40
41 // holds currently active i/o protocol
42 std::string fms_protocol;
43
44public:
45 /// Constructor. The collection name is used when saving the data.
46 /** If @a mesh is NULL, then the mesh can be set later by calling either
47 SetMesh() or Load(). The latter works only in serial. */
48 FMSDataCollection(const std::string& collection_name,
49 Mesh *mesh = NULL);
50#ifdef MFEM_USE_MPI
51 /// Construct a parallel FMSDataCollection.
52 FMSDataCollection(MPI_Comm comm, const std::string& collection_name,
53 Mesh *mesh = NULL);
54#endif
55
56 /// We will delete the mesh and fields if we own them
57 virtual ~FMSDataCollection();
58
59 /// Set the FMS relay i/o protocol to use
60 /** Supported options: ascii (default), json, yaml, hdf5 */
61 void SetProtocol(const std::string &protocol);
62
63 /// Save the collection and a FMS blueprint root file
64 virtual void Save();
65
66 /// Load the collection based blueprint data
67 virtual void Load(int cycle = 0);
68};
69
70} // namespace mfem
71
72#endif
73
74#endif
int cycle
Time cycle; for time-dependent simulations cycle >= 0, otherwise = -1.
Mesh * mesh
The (common) mesh for the collected fields.
Data collection that uses FMS.
virtual void Save()
Save the collection and a FMS blueprint root file.
std::string RootFileName()
Returns file name for the current cycle.
FMSDataCollection(const std::string &collection_name, Mesh *mesh=NULL)
Constructor. The collection name is used when saving the data.
virtual ~FMSDataCollection()
We will delete the mesh and fields if we own them.
virtual void Load(int cycle=0)
Load the collection based blueprint data.
void SetProtocol(const std::string &protocol)
Set the FMS relay i/o protocol to use.
Mesh data type.
Definition mesh.hpp:56