Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/df/d34/ADIOS2Writers_8h_source.html
DOLFINx 0.6.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
ADIOS2Writers.h
1// Copyright (C) 2021 Jørgen S. Dokken and Garth N. Wells
2//
3// This file is part of DOLFINX (https://www.fenicsproject.org)
4//
5// SPDX-License-Identifier: LGPL-3.0-or-later
6
7#pragma once
8
9#ifdef HAS_ADIOS2
10
11#include <cassert>
12#include <complex>
13#include <filesystem>
14#include <memory>
15#include <mpi.h>
16#include <string>
17#include <variant>
18#include <vector>
19
20namespace adios2
21{
22class ADIOS;
23class IO;
24class Engine;
25} // namespace adios2
26
27namespace dolfinx::fem
28{
29template <typename T>
30class Function;
31}
32
33namespace dolfinx::mesh
34{
35class Mesh;
36}
37
38namespace dolfinx::io
39{
40
43{
44public:
50 using U = std::vector<
51 std::variant<std::shared_ptr<const Fd32>, std::shared_ptr<const Fd64>,
52 std::shared_ptr<const Fc64>, std::shared_ptr<const Fc128>>>;
53
54private:
61 ADIOS2Writer(MPI_Comm comm, const std::filesystem::path& filename,
62 std::string tag, std::shared_ptr<const mesh::Mesh> mesh,
63 const U& u);
64
65protected:
71 ADIOS2Writer(MPI_Comm comm, const std::filesystem::path& filename,
72 std::string tag, std::shared_ptr<const mesh::Mesh> mesh);
73
79 ADIOS2Writer(MPI_Comm comm, const std::filesystem::path& filename,
80 std::string tag, const U& u);
81
83 ADIOS2Writer(ADIOS2Writer&& writer) = default;
84
86 ADIOS2Writer(const ADIOS2Writer&) = delete;
87
90
92 ADIOS2Writer& operator=(ADIOS2Writer&& writer) = default;
93
94 // Copy assignment
95 ADIOS2Writer& operator=(const ADIOS2Writer&) = delete;
96
97public:
99 void close();
100
101protected:
102 std::unique_ptr<adios2::ADIOS> _adios;
103 std::unique_ptr<adios2::IO> _io;
104 std::unique_ptr<adios2::Engine> _engine;
105 std::shared_ptr<const mesh::Mesh> _mesh;
106 U _u;
107};
108
113{
114public:
116 enum class MeshPolicy
117 {
118 update,
119 reuse
121 };
122
129 FidesWriter(MPI_Comm comm, const std::filesystem::path& filename,
130 std::shared_ptr<const mesh::Mesh> mesh);
131
141 FidesWriter(MPI_Comm comm, const std::filesystem::path& filename,
142 const ADIOS2Writer::U& u,
143 const MeshPolicy mesh_policy = MeshPolicy::update);
144
145 // Copy constructor
146 FidesWriter(const FidesWriter&) = delete;
147
149 FidesWriter(FidesWriter&& file) = default;
150
152 ~FidesWriter() = default;
153
156
157 // Copy assignment
158 FidesWriter& operator=(const FidesWriter&) = delete;
159
162 void write(double t);
163
164private:
165 // Control whether the mesh is written to file once or at every time step
166 MeshPolicy _mesh_reuse_policy;
167};
168
175{
176public:
187 VTXWriter(MPI_Comm comm, const std::filesystem::path& filename,
188 std::shared_ptr<const mesh::Mesh> mesh);
189
197 VTXWriter(MPI_Comm comm, const std::filesystem::path& filename, const U& u);
198
199 // Copy constructor
200 VTXWriter(const VTXWriter&) = delete;
201
203 VTXWriter(VTXWriter&& file) = default;
204
206 ~VTXWriter() = default;
207
210
211 // Copy assignment
212 VTXWriter& operator=(const VTXWriter&) = delete;
213
216 void write(double t);
217};
218
219} // namespace dolfinx::io
220
221#endif
This class represents a function in a finite element function space , given by.
Definition: Function.h:43
Base class for ADIOS2-based writers.
Definition: ADIOS2Writers.h:43
ADIOS2Writer & operator=(ADIOS2Writer &&writer)=default
Move assignment.
void close()
Close the file.
Definition: ADIOS2Writers.cpp:708
ADIOS2Writer(const ADIOS2Writer &)=delete
Copy constructor.
ADIOS2Writer(ADIOS2Writer &&writer)=default
Move constructor.
~ADIOS2Writer()
Destructor.
Definition: ADIOS2Writers.cpp:706
Output of meshes and functions compatible with the Fides Paraview reader, see https://fides....
Definition: ADIOS2Writers.h:113
MeshPolicy
Mesh reuse policy.
Definition: ADIOS2Writers.h:117
@ update
Re-write the mesh to file upon every write of a fem::Function.
@ reuse
Write the mesh to file only the first time a fem::Function is written to file.
void write(double t)
Write data with a given time.
Definition: ADIOS2Writers.cpp:796
FidesWriter(FidesWriter &&file)=default
Move constructor.
~FidesWriter()=default
Destructor.
FidesWriter & operator=(FidesWriter &&)=default
Move assignment.
Writer for meshes and functions using the ADIOS2 VTX format, see https://adios2.readthedocs....
Definition: ADIOS2Writers.h:175
VTXWriter & operator=(VTXWriter &&)=default
Move assignment.
~VTXWriter()=default
Destructor.
void write(double t)
Write data with a given time.
Definition: ADIOS2Writers.cpp:883
VTXWriter(VTXWriter &&file)=default
Move constructor.
Finite element method functionality.
Definition: assemble_matrix_impl.h:25
Support for file IO.
Definition: ADIOS2Writers.h:39
Mesh data structures and algorithms on meshes.
Definition: DofMap.h:31