Loading...
Searching...
No Matches
VTKFile.h
// Copyright (C) 2020 Garth N. Wells
//
// This file is part of DOLFINx (https://www.fenicsproject.org)
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#pragma once
#include <concepts>
#include <dolfinx/common/MPI.h>
#include <dolfinx/common/types.h>
#include <filesystem>
#include <functional>
#include <memory>
#include <string>
namespace pugi
{
class xml_document;
}
namespace dolfinx::fem
{
template <dolfinx::scalar T, std::floating_point U>
class Function;
}
namespace dolfinx::mesh
{
template <std::floating_point T>
class Mesh;
}
namespace dolfinx::io
{
class VTKFile
{
public:
VTKFile(MPI_Comm comm, const std::filesystem::path& filename,
const std::string& file_mode);
~VTKFile();
void close();
void flush();
template <std::floating_point U>
void write(const mesh::Mesh<U>& mesh, double time = 0.0);
template <dolfinx::scalar T, std::floating_point U = scalar_value_t<T>>
void
write(const std::vector<std::reference_wrapper<const fem::Function<T, U>>>& u,
double t);
private:
std::unique_ptr<pugi::xml_document> _pvd_xml;
std::filesystem::path _filename;
// MPI communicator
dolfinx::MPI::Comm _comm;
};
} // namespace dolfinx::io
dolfinx::MPI::Comm
A duplicate MPI communicator and manage lifetime of the communicator.
Definition MPI.h:42
dolfinx::fem::Function
Definition Function.h:47
dolfinx::io::VTKFile::write
void write(const mesh::Mesh< U > &mesh, double time=0.0)
Write a mesh to file. Supports arbitrary order Lagrange isoparametric cells.
Definition VTKFile.cpp:763
dolfinx::io::VTKFile::close
void close()
Close file.
Definition VTKFile.cpp:731
dolfinx::io::VTKFile::VTKFile
VTKFile(MPI_Comm comm, const std::filesystem::path &filename, const std::string &file_mode)
Create VTK file.
Definition VTKFile.cpp:709
dolfinx::io::VTKFile::~VTKFile
~VTKFile()
Destructor.
Definition VTKFile.cpp:721
dolfinx::io::VTKFile::flush
void flush()
Flushes XML files to disk.
Definition VTKFile.cpp:748
dolfinx::mesh::Mesh
A Mesh consists of a set of connected and numbered mesh topological entities, and geometry data.
Definition Mesh.h:23
dolfinx::fem
Finite element method functionality.
Definition assemble_expression_impl.h:23
dolfinx::io
Support for file IO.
Definition cells.h:119
dolfinx::mesh
Mesh data structures and algorithms on meshes.
Definition DofMap.h:32