dolfin/io

Documentation for C++ code found in dolfin/io/*.h

Classes

File

C++ documentation for File from dolfin/io/File.h:

class dolfin::File

A File represents a data file for reading and writing objects. Unless specified explicitly, the format is determined by the file name suffix. A list of objects that can be read/written to file can be found in GenericFile.h. Compatible file formats include:

  • Binary (.bin)
  • RAW (.raw)
  • SVG (.svg)
  • XD3 (.xd3)
  • XML (.xml)
  • XYZ (.xyz)
  • VTK (.pvd)
dolfin::File::File(MPI_Comm comm, const std::string filename, Type type, std::string encoding = "ascii")

Create a file with given name and type (format) with MPI communicator Arguments communicator (MPI_Comm) The MPI communicator. filename (std::string) Name of file. type (Type) File() format. encoding (std::string) Optional argument specifying encoding, ascii is default. Example .. code-block:: c++

File file(MPI_COMM_WORLD, "solution", vtk);
Parameters:
  • comm
  • filename
  • type
  • encoding
dolfin::File::File(MPI_Comm comm, const std::string filename, std::string encoding = "ascii")

Create a file with given name with MPI communicator Arguments communicator (MPI_Comm) The MPI communicator. filename (std::string) Name of file. encoding (std::string) Optional argument specifying encoding, ascii is default. Example .. code-block:: c++

// Save solution to file
File file(u.mesh()->mpi_comm(), "solution.pvd");
file << u;

// Read mesh data from file
File mesh_file(MPI_COMM_WORLD, "mesh.xml");
mesh_file >> mesh;

// Using compressed binary format
File comp_file(u.mesh()->mpi_comm(), "solution.pvd",
               "compressed");
Parameters:
  • comm
  • filename
  • encoding
dolfin::File::File(const std::string filename, Type type, std::string encoding = "ascii")

Create a file with given name and type (format) Arguments filename (std::string) Name of file. type (Type) File() format. encoding (std::string) Optional argument specifying encoding, ascii is default. Example .. code-block:: c++

File file("solution", vtk);
Parameters:
  • filename
  • type
  • encoding
dolfin::File::File(const std::string filename, std::string encoding = "ascii")

Create a file with given name Arguments filename (std::string) Name of file. encoding (std::string) Optional argument specifying encoding, ASCII is default. Example .. code-block:: c++

// Save solution to file
File file("solution.pvd");
file << u;

// Read mesh data from file
File mesh_file("mesh.xml");
mesh_file >> mesh;

// Using compressed binary format
File comp_file("solution.pvd", "compressed");
Parameters:
  • filename
  • encoding
dolfin::File::File(std::ostream &outstream)

Create an outfile object writing to stream Arguments outstream (std::ostream) The stream.

Parameters:outstream
enum dolfin::File::Type

File formats.

enumerator dolfin::File::Type::x3d
enumerator dolfin::File::Type::xml
enumerator dolfin::File::Type::vtk
enumerator dolfin::File::Type::raw
enumerator dolfin::File::Type::xyz
enumerator dolfin::File::Type::binary
enumerator dolfin::File::Type::svg
void dolfin::File::create_parent_path(std::string filename)

Arguments filename (std::string) Name of file / path.

Parameters:filename
bool dolfin::File::exists(std::string filename)

Check if file exists Arguments filename (std::string) Name of file. Returns bool True if the file exists.

Parameters:filename
void dolfin::File::init(MPI_Comm comm, const std::string filename, Type type, std::string encoding)
Parameters:
  • comm
  • filename
  • type
  • encoding
void dolfin::File::init(MPI_Comm comm, const std::string filename, std::string encoding)
Parameters:
  • comm
  • filename
  • encoding
void dolfin::File::operator<<(const X &x)

Write object to file.

Parameters:x
void dolfin::File::operator<<(const std::pair<const Function *, double> u)

Write Function to file with time Example .. code-block:: c++

File file("solution.pvd", "compressed");
file << std::make_pair<const Function*, double>(&u, t);
Parameters:u
void dolfin::File::operator<<(const std::pair<const Mesh *, double> mesh)

Write Mesh to file with time Example .. code-block:: c++

File file("mesh.pvd", "compressed");
file << std::make_pair<const Mesh*, double>(&mesh, t);
Parameters:mesh
void dolfin::File::operator<<(const std::pair<const MeshFunction<bool> *, double> f)

Write MeshFunction to file with time Example .. code-block:: c++

File file("markers.pvd", "compressed");
file << std::make_pair<const MeshFunction<bool>*, double>(&f, t);
Parameters:f
void dolfin::File::operator<<(const std::pair<const MeshFunction<double> *, double> f)

Write MeshFunction to file with time Example .. code-block:: c++

File file("markers.pvd", "compressed");
file << std::make_pair<const MeshFunction<double>*, double>(&f, t);
Parameters:f
void dolfin::File::operator<<(const std::pair<const MeshFunction<int> *, double> f)

Write MeshFunction to file with time Example .. code-block:: c++

File file("markers.pvd", "compressed");
file << std::make_pair<const MeshFunction<int>*, double>(&f, t);
Parameters:f
void dolfin::File::operator<<(const std::pair<const MeshFunction<std::size_t> *, double> f)

Write MeshFunction to file with time Example .. code-block:: c++

File file("markers.pvd", "compressed");
file << std::make_pair<const MeshFunction<std::size_t>*, double>(&f, t);
Parameters:f
void dolfin::File::operator>>(T &t)

Read from file.

Parameters:t
void dolfin::File::read(T &t)

Read from file.

Parameters:t
void dolfin::File::write(const X &x)

Write object to file.

Parameters:x
void dolfin::File::write(const X &x, double time)

Write object to file with time.

Parameters:
  • x
  • time
dolfin::File::~File()

Destructor.

HDF5Utility

C++ documentation for HDF5Utility from dolfin/io/HDF5Utility.h:

class dolfin::HDF5Utility

This class contains some algorithms which do not explicitly depend on the HDF5 file format, mostly to do with reorganising Mesh entities with MPI

void dolfin::HDF5Utility::build_local_mesh(Mesh &mesh, const LocalMeshData &mesh_data)

Convert LocalMeshData structure to a Mesh , used when running in serial

Parameters:
  • mesh
  • mesh_data
std::vector<std::pair<std::size_t, std::size_t>> dolfin::HDF5Utility::cell_owners(const Mesh &mesh, const std::vector<std::size_t> &cells)

Get cell owners for an arbitrary set of cells. Returns (process, local index) pairs

Parameters:
  • mesh
  • cells
void dolfin::HDF5Utility::cell_owners_in_range(std::vector<std::pair<std::size_t, std::size_t>> &global_owner, const Mesh &mesh)

Get mapping of cells in the assigned global range of the current process to remote process and remote local index.

Parameters:
  • global_owner
  • mesh
void dolfin::HDF5Utility::get_global_dof(MPI_Comm mpi_comm, const std::vector<std::pair<std::size_t, std::size_t>> &cell_ownership, const std::vector<std::size_t> &remote_local_dofi, std::pair<std::size_t, std::size_t> vector_range, const GenericDofMap &dofmap, std::vector<dolfin::la_index> &global_dof)

Given the cell dof index specified as (process, local_cell_index, local_cell_dof_index) get the global_dof index from that location, and return it for all DOFs in the range of “vector_range”

Parameters:
  • mpi_comm
  • cell_ownership
  • remote_local_dofi
  • vector_range
  • dofmap
  • global_dof
void dolfin::HDF5Utility::map_gdof_to_cell(const MPI_Comm mpi_comm, const std::vector<std::size_t> &input_cells, const std::vector<dolfin::la_index> &input_cell_dofs, const std::vector<std::size_t> &x_cell_dofs, const std::pair<dolfin::la_index, dolfin::la_index> vector_range, std::vector<std::size_t> &global_cells, std::vector<std::size_t> &remote_local_dofi)

Generate two vectors, in the range of “vector_range” of the global DOFs. global_cells is a list of cells which point to the DOF (non-unique) and remote_local_dofi is the pertinent local_dof of the cell. input_cells is a list of cells held on this process, and input_cell_dofs/x_cell_dofs list their local_dofs.

Parameters:
  • mpi_comm
  • input_cells
  • input_cell_dofs
  • x_cell_dofs
  • vector_range
  • global_cells
  • remote_local_dofi
void dolfin::HDF5Utility::set_local_vector_values(MPI_Comm mpi_comm, GenericVector &x, const Mesh &mesh, const std::vector<size_t> &cells, const std::vector<dolfin::la_index> &cell_dofs, const std::vector<std::size_t> &x_cell_dofs, const std::vector<double> &vector, std::pair<dolfin::la_index, dolfin::la_index> input_vector_range, const GenericDofMap &dofmap)

Missing docstring.

Parameters:
  • mpi_comm
  • x
  • mesh
  • cells
  • cell_dofs
  • x_cell_dofs
  • vector
  • input_vector_range
  • dofmap

MeshValueCollection

C++ documentation for MeshValueCollection from dolfin/io/XDMFFile.h:

class dolfin::MeshValueCollection : public dolfin::MeshValueCollection<T>

The MeshValueCollection class can be used to store data associated with a subset of the entities of a mesh of a given topological dimension. It differs from the MeshFunction class in two ways. First, data does not need to be associated with all entities (only a subset). Second, data is associated with entities through the corresponding cell index and local entity number (relative to the cell), not by global entity index, which means that data may be stored robustly to file.

dolfin::MeshValueCollection::MeshValueCollection()

Create empty mesh value collection

dolfin::MeshValueCollection::MeshValueCollection(const MeshFunction<T> &mesh_function)

Create a mesh value collection from a MeshFunction

Parameters:mesh_function – (MeshFunction<T>) The mesh function for creating a MeshValueCollection() .
dolfin::MeshValueCollection::MeshValueCollection(std::shared_ptr<const Mesh> mesh)

Create an empty mesh value collection on a given mesh

Parameters:mesh – (Mesh ) The mesh.
dolfin::MeshValueCollection::MeshValueCollection(std::shared_ptr<const Mesh> mesh, const std::string filename)

Create a mesh value collection from a file.

Parameters:
  • mesh – (Mesh ) A mesh associated with the collection. The mesh is used to map collection values to the appropriate process.
  • filename – (std::string) The XML file name.
dolfin::MeshValueCollection::MeshValueCollection(std::shared_ptr<const Mesh> mesh, std::size_t dim)

Create a mesh value collection of entities of given dimension on a given mesh

Parameters:
  • mesh – (Mesh ) The mesh associated with the collection.
  • dim – (std::size_t) The mesh entity dimension for the mesh value collection.
void dolfin::MeshValueCollection::clear()

Clear all values.

std::size_t dolfin::MeshValueCollection::dim() const

Return topological dimension

Returns:std::size_t The dimension.
bool dolfin::MeshValueCollection::empty() const

Return true if the subset is empty

Returns:bool True if the subset is empty.
T dolfin::MeshValueCollection::get_value(std::size_t cell_index, std::size_t local_entity)

Get marker value for given entity defined by a cell index and a local entity index

Parameters:
  • cell_index – (std::size_t) The index of the cell.
  • local_entity – (std::size_t) The local index of the entity relative to the cell.
Returns:

marker_value (T) The value of the marker.

void dolfin::MeshValueCollection::init(std::shared_ptr<const Mesh> mesh, std::size_t dim)

Initialise MeshValueCollection with mesh and dimension

Parameters:
  • mesh – (_mesh)) The mesh on which the value collection is defined
  • dim – (std::size_t) The mesh entity dimension for the mesh value collection.
void dolfin::MeshValueCollection::init(std::size_t dim)

Set dimension. This function should not generally be used. It is for reading MeshValueCollections as the dimension is not generally known at construction.

Parameters:dim – (std::size_t) The mesh entity dimension for the mesh value collection.
std::shared_ptr<const Mesh> dolfin::MeshValueCollection::mesh() const

Return associated mesh

Returns:Mesh The mesh.
MeshValueCollection<T> &dolfin::MeshValueCollection::operator=(const MeshFunction<T> &mesh_function)

Assignment operator

Parameters:mesh_function – (MeshFunction ) A MeshFunction object used to construct a MeshValueCollection .
MeshValueCollection<T> &dolfin::MeshValueCollection::operator=(const MeshValueCollection<T> &mesh_value_collection)

Assignment operator

Parameters:mesh_value_collection – (MeshValueCollection ) A MeshValueCollection object used to construct a MeshValueCollection .
bool dolfin::MeshValueCollection::set_value(std::size_t cell_index, std::size_t local_entity, const T &value)

Set marker value for given entity defined by a cell index and a local entity index

Parameters:
  • cell_index – (std::size_t) The index of the cell.
  • local_entity – (std::size_t) The local index of the entity relative to the cell.
  • value
    1. The value of the marker.
Returns:

bool True is a new value is inserted, false if overwriting an existing value.

bool dolfin::MeshValueCollection::set_value(std::size_t entity_index, const T &value)

Set value for given entity index

Parameters:
  • entity_index – (std::size_t) Index of the entity.
  • value – (T). The value of the marker.
Returns:

bool True is a new value is inserted, false if overwriting an existing value.

std::size_t dolfin::MeshValueCollection::size() const

Return size (number of entities in subset)

Returns:std::size_t The size.
std::string dolfin::MeshValueCollection::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose – (bool) Flag to turn on additional output.
Returns:std::string An informal representation.
std::map<std::pair<std::size_t, std::size_t>, T> &dolfin::MeshValueCollection::values()

Get all values

Returns:std::map<std::pair<std::size_t, std::size_t>, T> A map from positions to values.
const std::map<std::pair<std::size_t, std::size_t>, T> &dolfin::MeshValueCollection::values() const

Get all values (const version)

Returns:std::map<std::pair<std::size_t, std::size_t>, T> A map from positions to values.
dolfin::MeshValueCollection::~MeshValueCollection()

Destructor.

RAWFile

C++ documentation for RAWFile from dolfin/io/RAWFile.h:

class dolfin::RAWFile

Output of data in raw binary format.

void dolfin::RAWFile::MeshFunctionWrite(T &meshfunction)
Parameters:meshfunction
dolfin::RAWFile::RAWFile(const std::string filename)

Constructor.

Parameters:filename
void dolfin::RAWFile::ResultsWrite(const Function &u) const
Parameters:u
void dolfin::RAWFile::rawNameUpdate(const int counter)
Parameters:counter
std::string dolfin::RAWFile::raw_filename
void dolfin::RAWFile::write(const Function &u)

Output Function

Parameters:uFunction
void dolfin::RAWFile::write(const MeshFunction<double> &meshfunction)

Output MeshFunction (double)

Parameters:meshfunctionMeshFunction
void dolfin::RAWFile::write(const MeshFunction<int> &meshfunction)

Output MeshFunction (int)

Parameters:meshfunctionMeshFunction
dolfin::RAWFile::~RAWFile()

Destructor.

SVGFile

C++ documentation for SVGFile from dolfin/io/SVGFile.h:

class dolfin::SVGFile

This class implements output of meshes to scalable vector graphics format (SVG).

dolfin::SVGFile::SVGFile(const std::string filename)

Constructor.

Parameters:filename
void dolfin::SVGFile::write(const Mesh &mesh)

Write mesh to file.

Parameters:mesh
dolfin::SVGFile::~SVGFile()

Destructor.

VTKFile

C++ documentation for VTKFile from dolfin/io/VTKFile.h:

class dolfin::VTKFile

Output of meshes and functions in VTK format. XML format for visualisation purposes. It is not suitable to checkpointing as it may decimate some data.

dolfin::VTKFile::VTKFile(const std::string filename, std::string encoding)

Create VTK file.

Parameters:
  • filename
  • encoding
bool dolfin::VTKFile::binary
void dolfin::VTKFile::clear_file(std::string file) const
Parameters:file
bool dolfin::VTKFile::compress
std::string dolfin::VTKFile::encode_string
void dolfin::VTKFile::finalize(std::string vtu_filename, double time)
Parameters:
  • vtu_filename
  • time
std::string dolfin::VTKFile::init(const Mesh &mesh, std::size_t dim) const
Parameters:
  • mesh
  • dim
void dolfin::VTKFile::mesh_function_write(T &meshfunction, double time)
Parameters:
  • meshfunction
  • time
void dolfin::VTKFile::pvd_file_write(std::size_t step, double time, std::string file)
Parameters:
  • step
  • time
  • file
void dolfin::VTKFile::pvtu_write(const Function &u, const std::string pvtu_filename) const
Parameters:
  • u
  • pvtu_filename
void dolfin::VTKFile::pvtu_write_function(std::size_t dim, std::size_t rank, const std::string data_location, const std::string name, const std::string filename, std::size_t num_processes) const
Parameters:
  • dim
  • rank
  • data_location
  • name
  • filename
  • num_processes
void dolfin::VTKFile::pvtu_write_mesh(const std::string pvtu_filename, const std::size_t num_processes) const
Parameters:
  • pvtu_filename
  • num_processes
void dolfin::VTKFile::pvtu_write_mesh(pugi::xml_node xml_node) const
Parameters:xml_node
void dolfin::VTKFile::results_write(const Function &u, std::string file) const
Parameters:
  • u
  • file
std::string dolfin::VTKFile::strip_path(std::string file) const
Parameters:file
void dolfin::VTKFile::vtk_header_close(std::string file) const
Parameters:file
void dolfin::VTKFile::vtk_header_open(std::size_t num_vertices, std::size_t num_cells, std::string file) const
Parameters:
  • num_vertices
  • num_cells
  • file
std::string dolfin::VTKFile::vtu_name(const int process, const int num_processes, const int counter, std::string ext) const
Parameters:
  • process
  • num_processes
  • counter
  • ext
void dolfin::VTKFile::write(const Function &u)

Output Function .

Parameters:u
void dolfin::VTKFile::write(const Function &u, double t)

Output Function and timestep.

Parameters:
  • u
  • t
void dolfin::VTKFile::write(const Mesh &mesh)

Output mesh.

Parameters:mesh
void dolfin::VTKFile::write(const Mesh &mesh, double t)

Output Mesh and timestep.

Parameters:
  • mesh
  • t
void dolfin::VTKFile::write(const MeshFunction<bool> &meshfunction)

Output MeshFunction<bool>

Parameters:meshfunction
void dolfin::VTKFile::write(const MeshFunction<bool> &mf, double t)

Output MeshFunction and timestep.

Parameters:
  • mf
  • t
void dolfin::VTKFile::write(const MeshFunction<double> &meshfunction)

Output MeshFunction<double>

Parameters:meshfunction
void dolfin::VTKFile::write(const MeshFunction<double> &mf, double t)

Output MeshFunction and timestep.

Parameters:
  • mf
  • t
void dolfin::VTKFile::write(const MeshFunction<int> &mesh, double t)

Output MeshFunction and timestep.

Parameters:
  • mesh
  • t
void dolfin::VTKFile::write(const MeshFunction<int> &meshfunction)

Output MeshFunction<int>

Parameters:meshfunction
void dolfin::VTKFile::write(const MeshFunction<std::size_t> &meshfunction)

Output MeshFunction<std::size_t>

Parameters:meshfunction
void dolfin::VTKFile::write(const MeshFunction<std::size_t> &mf, double t)

Output MeshFunction and timestep.

Parameters:
  • mf
  • t
void dolfin::VTKFile::write_function(const Function &u, double time)
Parameters:
  • u
  • time
void dolfin::VTKFile::write_mesh(const Mesh &mesh, double time)
Parameters:
  • mesh
  • time
void dolfin::VTKFile::write_point_data(const GenericFunction &u, const Mesh &mesh, std::string file) const
Parameters:
  • u
  • mesh
  • file
dolfin::VTKFile::~VTKFile()

VTKWriter

C++ documentation for VTKWriter from dolfin/io/VTKWriter.h:

class dolfin::VTKWriter

Write VTK Mesh representation.

std::string dolfin::VTKWriter::ascii_cell_data(const Mesh &mesh, const std::vector<std::size_t> &offset, const std::vector<double> &values, std::size_t dim, std::size_t rank)
Parameters:
  • mesh
  • offset
  • values
  • dim
  • rank
std::string dolfin::VTKWriter::base64_cell_data(const Mesh &mesh, const std::vector<std::size_t> &offset, const std::vector<double> &values, std::size_t dim, std::size_t rank, bool compress)
Parameters:
  • mesh
  • offset
  • values
  • dim
  • rank
  • compress
std::string dolfin::VTKWriter::encode_inline_base64(const std::vector<T> &data)
Parameters:data
std::string dolfin::VTKWriter::encode_inline_compressed_base64(const std::vector<T> &data)
Parameters:data
std::string dolfin::VTKWriter::encode_stream(const std::vector<T> &data, bool compress)

Form (compressed) base64 encoded string for VTK.

Parameters:
  • data
  • compress
std::uint8_t dolfin::VTKWriter::vtk_cell_type(const Mesh &mesh, std::size_t cell_dim)
Parameters:
  • mesh
  • cell_dim
void dolfin::VTKWriter::write_ascii_mesh(const Mesh &mesh, std::size_t cell_dim, std::string file)
Parameters:
  • mesh
  • cell_dim
  • file
void dolfin::VTKWriter::write_base64_mesh(const Mesh &mesh, std::size_t cell_dim, std::string file, bool compress)
Parameters:
  • mesh
  • cell_dim
  • file
  • compress
void dolfin::VTKWriter::write_cell_data(const Function &u, std::string file, bool binary, bool compress)

Cell data writer.

Parameters:
  • u
  • file
  • binary
  • compress
void dolfin::VTKWriter::write_mesh(const Mesh &mesh, std::size_t cell_dim, std::string file, bool binary, bool compress)

Mesh writer.

Parameters:
  • mesh
  • cell_dim
  • file
  • binary
  • compress

X3DFile

C++ documentation for X3DFile from dolfin/io/X3DFile.h:

class dolfin::X3DFile

This class implements output of meshes to X3D (successor to VRML) graphics format (http://www.web3d.org/x3d/ ). It is suitable for output of small to medium size meshes for 3D visualisation via browsers, and can also do basic Function and MeshFunction output (on the surface) X3D files can be included on web pages with WebGL functionality (see www.x3dom.org).

dolfin::X3DFile::X3DFile(const std::string filename)

Constructor.

Parameters:filename
std::string dolfin::X3DFile::color_palette(const int pal) const
Parameters:pal
const std::string dolfin::X3DFile::facet_type
std::vector<double> dolfin::X3DFile::mesh_min_max(const Mesh &mesh) const
Parameters:mesh
void dolfin::X3DFile::output_xml_header(pugi::xml_document &xml_doc, const std::vector<double> &xpos)
Parameters:
  • xml_doc
  • xpos
std::vector<std::size_t> dolfin::X3DFile::vertex_index(const Mesh &mesh) const
Parameters:mesh
void dolfin::X3DFile::write(const Function &function)

Output Function to X3D format - for a 3D mesh, only producing surface facets

Parameters:function
void dolfin::X3DFile::write(const Mesh &mesh)

Output Mesh to X3D format - for a 3D mesh, only producing surface facets

Parameters:mesh
void dolfin::X3DFile::write(const MeshFunction<std::size_t> &meshfunction)

Output MeshFunction to X3D format - for a 3D mesh, only producing surface facets

Parameters:meshfunction
void dolfin::X3DFile::write_meshfunction(const MeshFunction<std::size_t> &meshfunction)
Parameters:meshfunction
void dolfin::X3DFile::write_vertices(pugi::xml_document &xml_doc, const Mesh &mesh, const std::vector<std::size_t> vecindex)
Parameters:
  • xml_doc
  • mesh
  • vecindex
dolfin::X3DFile::~X3DFile()

Destructor.

X3DOM

C++ documentation for X3DOM from dolfin/io/X3DOM.h:

class dolfin::X3DOM

This class implements output of meshes to X3DOM XML or HTML5 with X3DOM strings. The latter can be used for interactive visualisation

enum dolfin::X3DOM::Viewpoint
enumerator dolfin::X3DOM::Viewpoint::top
enumerator dolfin::X3DOM::Viewpoint::bottom
enumerator dolfin::X3DOM::Viewpoint::left
enumerator dolfin::X3DOM::Viewpoint::right
enumerator dolfin::X3DOM::Viewpoint::back
enumerator dolfin::X3DOM::Viewpoint::front
enumerator dolfin::X3DOM::Viewpoint::default_view
void dolfin::X3DOM::add_html_doctype(pugi::xml_node &xml_node)
Parameters:xml_node
pugi::xml_node dolfin::X3DOM::add_html_preamble(pugi::xml_node &xml_node)
Parameters:xml_node
void dolfin::X3DOM::add_menu_color_tab(pugi::xml_node &xml_node)
Parameters:xml_node
void dolfin::X3DOM::add_menu_display(pugi::xml_node &xml_node, const Mesh &mesh, const X3DOMParameters &parameters)
Parameters:
  • xml_node
  • mesh
  • parameters
void dolfin::X3DOM::add_menu_options_option(pugi::xml_node &xml_node, std::string name)
Parameters:
  • xml_node
  • name
void dolfin::X3DOM::add_menu_options_tab(pugi::xml_node &xml_node)
Parameters:xml_node
void dolfin::X3DOM::add_menu_summary_tab(pugi::xml_node &xml_node, const Mesh &mesh)
Parameters:
  • xml_node
  • mesh
void dolfin::X3DOM::add_menu_tab_button(pugi::xml_node &xml_node, std::string name, bool checked)
Parameters:
  • xml_node
  • name
  • checked
void dolfin::X3DOM::add_menu_viewpoint_button(pugi::xml_node &xml_node, std::string name)
Parameters:
  • xml_node
  • name
void dolfin::X3DOM::add_menu_viewpoint_tab(pugi::xml_node &xml_node)
Parameters:xml_node
void dolfin::X3DOM::add_menu_warp_tab(pugi::xml_node &xml_node)
Parameters:xml_node
void dolfin::X3DOM::add_mesh_data(pugi::xml_node &xml_node, const Mesh &mesh, const std::vector<double> &vertex_values, const std::vector<double> &facet_values, const X3DOMParameters &parameters, bool surface)
Parameters:
  • xml_node
  • mesh
  • vertex_values
  • facet_values
  • parameters
  • surface
void dolfin::X3DOM::add_viewpoint_node(pugi::xml_node &xml_scene, Viewpoint viewpoint, const Point p, const double s)
Parameters:
  • xml_scene
  • viewpoint
  • p
  • s
void dolfin::X3DOM::add_viewpoint_nodes(pugi::xml_node &xml_scene, const Point p, double d, bool show_viewpoint_buttons)
Parameters:
  • xml_scene
  • p
  • d
  • show_viewpoint_buttons
pugi::xml_node dolfin::X3DOM::add_x3d_node(pugi::xml_node &xml_node, std::array<double, 2> size, bool show_stats)
Parameters:
  • xml_node
  • size
  • show_stats
void dolfin::X3DOM::add_x3dom_data(pugi::xml_node &xml_node, const Mesh &mesh, const std::vector<double> &vertex_values, const std::vector<double> &facet_values, const X3DOMParameters &parameters)
Parameters:
  • xml_node
  • mesh
  • vertex_values
  • facet_values
  • parameters
void dolfin::X3DOM::add_x3dom_doctype(pugi::xml_node &xml_node)
Parameters:xml_node
std::string dolfin::X3DOM::array_to_string3(std::array<double, 3> x)
Parameters:x
void dolfin::X3DOM::build_mesh_data(std::vector<int> &topology, std::vector<double> &geometry, std::vector<double> &value_data, const Mesh &mesh, const std::vector<double> &vertex_values, const std::vector<double> &facet_values, bool surface)
Parameters:
  • topology
  • geometry
  • value_data
  • mesh
  • vertex_values
  • facet_values
  • surface
void dolfin::X3DOM::build_x3dom_tree(pugi::xml_document &xml_doc, const Function &u, const X3DOMParameters &parameters = X3DOMParameters())

Build X3DOM pugixml tree for a Function .

Parameters:
  • xml_doc
  • u
  • parameters
void dolfin::X3DOM::build_x3dom_tree(pugi::xml_document &xml_doc, const Mesh &mesh, const X3DOMParameters &parameters = X3DOMParameters())

Build X3DOM pugixml tree for a Mesh .

Parameters:
  • xml_doc
  • mesh
  • parameters
pugi::xml_node dolfin::X3DOM::create_menu_content_node(pugi::xml_node &xml_node, std::string name, bool show)
Parameters:
  • xml_node
  • name
  • show
void dolfin::X3DOM::get_function_values(const Function &u, std::vector<double> &vertex_values, std::vector<double> &facet_values)
Parameters:
  • u
  • vertex_values
  • facet_values
std::string dolfin::X3DOM::html(const Function &u, X3DOMParameters parameters = X3DOMParameters())

Return HTML5 string with embedded X3D for a Function .

Parameters:
  • u
  • parameters
std::string dolfin::X3DOM::html(const Mesh &mesh, X3DOMParameters parameters = X3DOMParameters())

Return HTML5 string with embedded X3D for a Mesh .

Parameters:
  • mesh
  • parameters
void dolfin::X3DOM::html(pugi::xml_document &xml_doc, const Mesh &mesh, const std::vector<double> &vertex_values, const std::vector<double> &facet_values, const X3DOMParameters &parameters)
Parameters:
  • xml_doc
  • mesh
  • vertex_values
  • facet_values
  • parameters
std::pair<Point, double> dolfin::X3DOM::mesh_centre_and_distance(const Mesh &mesh)
Parameters:mesh
std::string dolfin::X3DOM::str(const Function &u, X3DOMParameters parameters = X3DOMParameters())

Return X3D string for a Function .

Parameters:
  • u
  • parameters
std::string dolfin::X3DOM::str(const Mesh &mesh, X3DOMParameters parameters = X3DOMParameters())

Return X3D string for a Mesh .

Parameters:
  • mesh
  • parameters
std::set<int> dolfin::X3DOM::surface_vertex_indices(const Mesh &mesh)
Parameters:mesh
std::string dolfin::X3DOM::to_string(pugi::xml_document &xml_doc, unsigned int flags)
Parameters:
  • xml_doc
  • flags
void dolfin::X3DOM::x3dom(pugi::xml_document &xml_doc, const Mesh &mesh, const std::vector<double> &vertex_values, const std::vector<double> &facet_values, const X3DOMParameters &parameters)
Parameters:
  • xml_doc
  • mesh
  • vertex_values
  • facet_values
  • parameters

X3DOMParameters

C++ documentation for X3DOMParameters from dolfin/io/X3DOM.h:

class dolfin::X3DOMParameters

Class data to store X3DOM view parameters.

enum dolfin::X3DOMParameters::Representation

X3DOM representation type.

enumerator dolfin::X3DOMParameters::Representation::surface
enumerator dolfin::X3DOMParameters::Representation::surface_with_edges
enumerator dolfin::X3DOMParameters::Representation::wireframe
dolfin::X3DOMParameters::X3DOMParameters()

Constructor (with default parameter settings)

void dolfin::X3DOMParameters::check_rgb(std::array<double, 3> &rgb)
Parameters:rgb
void dolfin::X3DOMParameters::check_value_range(double value, double lower, double upper)
Parameters:
  • value
  • lower
  • upper
double dolfin::X3DOMParameters::get_ambient_intensity() const

Get the ambient lighting intensity.

std::array<double, 3> dolfin::X3DOMParameters::get_background_color() const

Get background RGB color.

std::vector<double> dolfin::X3DOMParameters::get_color_map() const

Get the color map as a vector of 768 values (256*RGB) (using std::vector for Python compatibility via SWIG)

boost::multi_array<float, 2> dolfin::X3DOMParameters::get_color_map_array() const

Get the color map as a boost::multi_array (256x3)

std::array<double, 3> dolfin::X3DOMParameters::get_diffuse_color() const

Get the RGB diffuse color of the object.

std::array<double, 3> dolfin::X3DOMParameters::get_emissive_color() const

Get the RGB emissive color.

bool dolfin::X3DOMParameters::get_menu_display() const

Get the menu display state.

Representation dolfin::X3DOMParameters::get_representation() const

Get the current representation of the object (wireframe, surface or surface_with_edges)

double dolfin::X3DOMParameters::get_shininess() const

Set the surface shininess of the object.

std::array<double, 3> dolfin::X3DOMParameters::get_specular_color() const

Get the RGB specular color.

double dolfin::X3DOMParameters::get_transparency() const

Get the transparency (0-1)

std::array<double, 2> dolfin::X3DOMParameters::get_viewport_size() const

Get the size of the viewport.

bool dolfin::X3DOMParameters::get_x3d_stats() const

Get the state of the ‘statistics’ window.

void dolfin::X3DOMParameters::set_ambient_intensity(double intensity)

Set the ambient lighting intensity.

Parameters:intensity
void dolfin::X3DOMParameters::set_background_color(std::array<double, 3> rgb)

Set background RGB color.

Parameters:rgb
void dolfin::X3DOMParameters::set_color_map(const std::vector<double> &color_data)

Set the color map by supplying a vector of 768 values (256*RGB) (using std::vector for Python compatibility via SWIG)

Parameters:color_data
void dolfin::X3DOMParameters::set_diffuse_color(std::array<double, 3> rgb)

Set the RGB color of the object.

Parameters:rgb
void dolfin::X3DOMParameters::set_emissive_color(std::array<double, 3> rgb)

Set the RGB emissive color.

Parameters:rgb
void dolfin::X3DOMParameters::set_menu_display(bool show)

Toggle menu option.

Parameters:show
void dolfin::X3DOMParameters::set_representation(Representation representation)

Set representation of object (wireframe, surface or surface_with_edges)

Parameters:representation
void dolfin::X3DOMParameters::set_shininess(double shininess)

Set the surface shininess of the object.

Parameters:shininess
void dolfin::X3DOMParameters::set_specular_color(std::array<double, 3> rgb)

Set the RGB specular color.

Parameters:rgb
void dolfin::X3DOMParameters::set_transparency(double transparency)

Set the transparency (0-1)

Parameters:transparency
void dolfin::X3DOMParameters::set_x3d_stats(bool show)

Turn X3D ‘statistics’ window on/off.

Parameters:show

XDMFFile

C++ documentation for XDMFFile from dolfin/io/XDMFFile.h:

class dolfin::XDMFFile

Read and write Mesh , Function , MeshFunction and other objects in XDMF. This class supports the output of meshes and functions in XDMF (http://www.xdmf.org ) format. It creates an XML file that describes the data and points to a HDF5 file that stores the actual problem data. Output of data in parallel is supported. XDMF is not suitable for checkpointing as it may decimate some data.

enum dolfin::XDMFFile::Encoding

File encoding type.

enumerator dolfin::XDMFFile::Encoding::HDF5
enumerator dolfin::XDMFFile::Encoding::ASCII
dolfin::XDMFFile::XDMFFile(MPI_Comm comm, const std::string filename)

Constructor.

Parameters:
  • comm
  • filename
dolfin::XDMFFile::XDMFFile(const std::string filename)

Constructor.

Parameters:filename
void dolfin::XDMFFile::add_data_item(MPI_Comm comm, pugi::xml_node &xml_node, hid_t h5_id, const std::string h5_path, const T &x, const std::vector<std::int64_t> dimensions, const std::string number_type = "")
Parameters:
  • comm
  • xml_node
  • h5_id
  • h5_path
  • x
  • dimensions
  • number_type
void dolfin::XDMFFile::add_function(MPI_Comm comm, pugi::xml_node &xml_node, hid_t h5_id, std::string h5_path, const Function &u, std::string function_name, const Mesh &mesh)
Parameters:
  • comm
  • xml_node
  • h5_id
  • h5_path
  • u
  • function_name
  • mesh
void dolfin::XDMFFile::add_geometry_data(MPI_Comm comm, pugi::xml_node &xml_node, hid_t h5_id, const std::string path_prefix, const Mesh &mesh)
Parameters:
  • comm
  • xml_node
  • h5_id
  • path_prefix
  • mesh
void dolfin::XDMFFile::add_mesh(MPI_Comm comm, pugi::xml_node &xml_node, hid_t h5_id, const Mesh &mesh, const std::string path_prefix)
Parameters:
  • comm
  • xml_node
  • h5_id
  • mesh
  • path_prefix
void dolfin::XDMFFile::add_points(MPI_Comm comm, pugi::xml_node &xml_node, hid_t h5_id, const std::vector<Point> &points)
Parameters:
  • comm
  • xml_node
  • h5_id
  • points
void dolfin::XDMFFile::add_topology_data(MPI_Comm comm, pugi::xml_node &xml_node, hid_t h5_id, const std::string path_prefix, const Mesh &mesh, int tdim)
Parameters:
  • comm
  • xml_node
  • h5_id
  • path_prefix
  • mesh
  • tdim
void dolfin::XDMFFile::build_local_mesh_data(LocalMeshData &local_mesh_data, const CellType &cell_type, std::int64_t num_points, std::int64_t num_cells, int tdim, int gdim, const pugi::xml_node &topology_dataset_node, const pugi::xml_node &geometry_dataset_node, const boost::filesystem::path &parent_path)
Parameters:
  • local_mesh_data
  • cell_type
  • num_points
  • num_cells
  • tdim
  • gdim
  • topology_dataset_node
  • geometry_dataset_node
  • parent_path
void dolfin::XDMFFile::build_mesh(Mesh &mesh, const CellType &cell_type, std::int64_t num_points, std::int64_t num_cells, int tdim, int gdim, const pugi::xml_node &topology_dataset_node, const pugi::xml_node &geometry_dataset_node, const boost::filesystem::path &parent_path)
Parameters:
  • mesh
  • cell_type
  • num_points
  • num_cells
  • tdim
  • gdim
  • topology_dataset_node
  • geometry_dataset_node
  • parent_path
void dolfin::XDMFFile::build_mesh_quadratic(Mesh &mesh, const CellType &cell_type, std::int64_t num_points, std::int64_t num_cells, int tdim, int gdim, const pugi::xml_node &topology_dataset_node, const pugi::xml_node &geometry_dataset_node, const boost::filesystem::path &relative_path)
Parameters:
  • mesh
  • cell_type
  • num_points
  • num_cells
  • tdim
  • gdim
  • topology_dataset_node
  • geometry_dataset_node
  • relative_path
void dolfin::XDMFFile::check_encoding(Encoding encoding) const
Parameters:encoding
void dolfin::XDMFFile::check_function_name(std::string function_name)
Parameters:function_name
void dolfin::XDMFFile::close()

Close the file This closes any open HDF5 files. In ASCII mode the XML file is closed each time it is written to or read from, so close() has no effect. From Python you can also use XDMFFile as a context manager:

with XDMFFile(mpi_comm_world(), 'name.xdmf') as xdmf:
    xdmf.write(mesh)

The file is automatically closed at the end of the with block

std::set<unsigned int> dolfin::XDMFFile::compute_nonlocal_entities(const Mesh &mesh, int cell_dim)
Parameters:
  • mesh
  • cell_dim
std::vector<T> dolfin::XDMFFile::compute_quadratic_topology(const Mesh &mesh)
Parameters:mesh
std::vector<T> dolfin::XDMFFile::compute_topology_data(const Mesh &mesh, int cell_dim)
Parameters:
  • mesh
  • cell_dim
std::vector<T> dolfin::XDMFFile::compute_value_data(const MeshFunction<T> &meshfunction)
Parameters:meshfunction
std::vector<double> dolfin::XDMFFile::get_cell_data_values(const Function &u)
Parameters:u
std::pair<std::string, int> dolfin::XDMFFile::get_cell_type(const pugi::xml_node &topology_node)
Parameters:topology_node
std::vector< T > dolfin::XDMFFile::get_dataset(MPI_Comm comm, const pugi::xml_node &dataset_node, const boost::filesystem::path &parent_path, std::pair< std::int64_t, std::int64_t > range={0, 0})
Parameters:
  • comm
  • dataset_node
  • parent_path
  • range
std::vector<std::int64_t> dolfin::XDMFFile::get_dataset_shape(const pugi::xml_node &dataset_node)
Parameters:dataset_node
std::string dolfin::XDMFFile::get_hdf5_filename(std::string xdmf_filename)
Parameters:xdmf_filename
std::array<std::string, 2> dolfin::XDMFFile::get_hdf5_paths(const pugi::xml_node &dataitem_node)
Parameters:dataitem_node
std::int64_t dolfin::XDMFFile::get_num_cells(const pugi::xml_node &topology_node)
Parameters:topology_node
std::vector<double> dolfin::XDMFFile::get_p2_data_values(const Function &u)
Parameters:u
std::int64_t dolfin::XDMFFile::get_padded_width(const Function &u)
Parameters:u
std::vector<double> dolfin::XDMFFile::get_point_data_values(const Function &u)
Parameters:u
bool dolfin::XDMFFile::has_cell_centred_data(const Function &u)
Parameters:u
std::string dolfin::XDMFFile::rank_to_string(std::size_t value_rank)
Parameters:value_rank
void dolfin::XDMFFile::read(Mesh &mesh) const

Read in the first Mesh in XDMF file

Parameters:mesh – (Mesh ) Mesh to fill from XDMF file
void dolfin::XDMFFile::read(MeshFunction<bool> &meshfunction, std::string name = "")

Read first MeshFunction from file

Parameters:
  • meshfunction – (MeshFunction<bool>) MeshFunction to restore
  • name – (std::string) Name of data attribute in XDMF file
void dolfin::XDMFFile::read(MeshFunction<double> &meshfunction, std::string name = "")

Read MeshFunction from file, optionally specifying dataset name

Parameters:
  • meshfunction – (MeshFunction<double>) MeshFunction to restore
  • name – (std::string) Name of data attribute in XDMF file
void dolfin::XDMFFile::read(MeshFunction<int> &meshfunction, std::string name = "")

Read first MeshFunction from file

Parameters:
  • meshfunction – (MeshFunction<int>) MeshFunction to restore
  • name – (std::string) Name of data attribute in XDMF file
void dolfin::XDMFFile::read(MeshFunction<std::size_t> &meshfunction, std::string name = "")

Read MeshFunction from file, optionally specifying dataset name

Parameters:
  • meshfunction – (MeshFunction<std::size_t>) MeshFunction to restore
  • name – (std::string) Name of data attribute in XDMF file
void dolfin::XDMFFile::read(MeshValueCollection<bool> &mvc, std::string name = "")

Read MeshValueCollection from file, optionally specifying dataset name

Parameters:
  • mvc – (MeshValueCollection<bool>) MeshValueCollection to restore
  • name – (std::string) Name of data attribute in XDMF file
void dolfin::XDMFFile::read(MeshValueCollection<double> &mvc, std::string name = "")

Read MeshValueCollection from file, optionally specifying dataset name

Parameters:
  • mvc – (MeshValueCollection<double>) MeshValueCollection to restore
  • name – (std::string) Name of data attribute in XDMF file
void dolfin::XDMFFile::read(MeshValueCollection<int> &mvc, std::string name = "")

Read MeshValueCollection from file, optionally specifying dataset name

Parameters:
  • mvc – (MeshValueCollection<int>) MeshValueCollection to restore
  • name – (std::string) Name of data attribute in XDMF file
void dolfin::XDMFFile::read(MeshValueCollection<std::size_t> &mvc, std::string name = "")

Read MeshValueCollection from file, optionally specifying dataset name

Parameters:
  • mvc – (MeshValueCollection<std::size_t>) MeshValueCollection to restore
  • name – (std::string) Name of data attribute in XDMF file
void dolfin::XDMFFile::read_checkpoint(Function &u, std::string func_name, std::int64_t counter = -1)

Read a function from the XDMF file. Supplied function must come with already initialized and compatible function space. Functions saved as time-series must be addressed through (integer) internal counter and function name. Function name is a name of function that was saved. Counter stands for the number of function from time-series, e.g. counter=0 refers to first saved function regardless of its time-step value.

Parameters:
  • u – (Function ) A function to read.
  • func_name – (string) A name of a function to read. Must be the same on all processes in parallel.
  • counter – (int64_t) Internal integer counter - used in time-series. Default value is -1 which points to last saved function. Counter works same as python array position key, i.e. counter = -2 points to the function before the last one.
void dolfin::XDMFFile::read_mesh_function(MeshFunction<T> &meshfunction, std::string name = "")
Parameters:
  • meshfunction
  • name
void dolfin::XDMFFile::read_mesh_value_collection(MeshValueCollection<T> &mvc, std::string name)
Parameters:
  • mvc
  • name
void dolfin::XDMFFile::remap_meshfunction_data(MeshFunction<T> &meshfunction, const std::vector<std::int64_t> &topology_data, const std::vector<T> &value_data)
Parameters:
  • meshfunction
  • topology_data
  • value_data
std::vector<T> dolfin::XDMFFile::string_to_vector(const std::vector<std::string> &x_str)
Parameters:x_str
std::string dolfin::XDMFFile::to_string(X x, Y y)
Parameters:
  • x
  • y
std::string dolfin::XDMFFile::vtk_cell_type_str(CellType::Type cell_type, int order)
Parameters:
  • cell_type
  • order
void dolfin::XDMFFile::write(const Function &u, Encoding encoding = default_encoding)

Save a Function to XDMF file for visualisation, using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • u – (Function ) A function to save.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const Function &u, double t, Encoding encoding = default_encoding)

Save a Function with timestamp to XDMF file for visualisation, using an associated HDF5 file, or storing the data inline as XML. You can control the output with the following boolean parameters on the XDMFFile class:

  • rewrite_function_mesh (default true): Controls whether the mesh will be rewritten every timestep. If the mesh does not change this can be turned off to create smaller files.
  • functions_share_mesh (default false): Controls whether all functions on a single time step share the same mesh. If true the files created will be smaller and also behave better in Paraview, at least in version 5.3.0
Parameters:
  • u – (Function ) A function to save.
  • t – (double) Timestep
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const Mesh &mesh, Encoding encoding = default_encoding)

Save a mesh to XDMF format, either using an associated HDF5 file, or storing the data inline as XML Create function on given function space

Parameters:
  • mesh – (Mesh ) A mesh to save.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const MeshFunction<bool> &meshfunction, Encoding encoding = default_encoding)

Save MeshFunction to file using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • meshfunction – (MeshFunction ) A meshfunction to save.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const MeshFunction<double> &meshfunction, Encoding encoding = default_encoding)

Save MeshFunction to file using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • meshfunction – (MeshFunction ) A meshfunction to save.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const MeshFunction<int> &meshfunction, Encoding encoding = default_encoding)

Save MeshFunction to file using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • meshfunction – (MeshFunction ) A meshfunction to save.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const MeshFunction<std::size_t> &meshfunction, Encoding encoding = default_encoding)

Save MeshFunction to file using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • meshfunction – (MeshFunction ) A meshfunction to save.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const MeshValueCollection<bool> &mvc, Encoding encoding = default_encoding)

Write out mesh value collection (subset) using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • mvc – (MeshValueCollection<bool>) MeshValueCollection to save
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const MeshValueCollection<double> &mvc, Encoding encoding = default_encoding)

Write out mesh value collection (subset) using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • mvc – (MeshValueCollection<double>) MeshValueCollection to save
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const MeshValueCollection<int> &mvc, Encoding encoding = default_encoding)

Write out mesh value collection (subset) using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • mvc – (MeshValueCollection<int>) MeshValueCollection to save
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const MeshValueCollection<std::size_t> &mvc, Encoding encoding = default_encoding)

Write out mesh value collection (subset) using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • mvc – (MeshValueCollection<int>) MeshValueCollection to save
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const std::vector<Point> &points, Encoding encoding = default_encoding)

Save a cloud of points to file using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • points – (std::vector<Point>) A list of points to save.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write(const std::vector<Point> &points, const std::vector<double> &values, Encoding encoding = default_encoding)

Save a cloud of points, with scalar values using an associated HDF5 file, or storing the data inline as XML.

Parameters:
  • points – (std::vector<Point>) A list of points to save.
  • values – (std::vector<double>) A list of values at each point.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write_checkpoint(const Function &u, std::string function_name, double time_step = 0.0, Encoding encoding = default_encoding)

Save a Function to XDMF file for checkpointing, using an associated HDF5 file, or storing the data inline as XML. If the file where we would like to write exists, then the function is appended to the file.

Parameters:
  • u – (Function ) A function to save.
  • function_name – (string) Name of the function used in XDMF XML and HDF file (if encoding = HDF). The string is used to fill value for XML attribute Name of Grid node. It is also used in HDF file in path to datasets. Must be the same on all processes in parallel.
  • time_step – (double) Time step. It is saved only in XDMF file. The function could be saved with the same time step several times. There is an internal “counter” value stored in XDMF which differentiates the same time steps.
  • encoding – (Encoding) Encoding to use: HDF5 or ASCII
void dolfin::XDMFFile::write_mesh_function(const MeshFunction<T> &meshfunction, Encoding encoding)
Parameters:
  • meshfunction
  • encoding
void dolfin::XDMFFile::write_mesh_value_collection(const MeshValueCollection<T> &mvc, Encoding encoding)
Parameters:
  • mvc
  • encoding
std::string dolfin::XDMFFile::xdmf_format_str(Encoding encoding)
Parameters:encoding
dolfin::XDMFFile::~XDMFFile()

Destructor.

XMLArray

C++ documentation for XMLArray from dolfin/io/XMLArray.h:

class dolfin::XMLArray

I/O of array data in XML format.

void dolfin::XMLArray::read(std::vector<T> &x, const pugi::xml_node xml_dolfin)

Read XML vector. Vector must have correct size.

Parameters:
  • x
  • xml_dolfin
void dolfin::XMLArray::write(const std::vector<T> &x, const std::string type, pugi::xml_node xml_node)

Write the XML file.

Parameters:
  • x
  • type
  • xml_node

XMLFile

C++ documentation for XMLFile from dolfin/io/XMLFile.h:

class dolfin::XMLFile

I/O of DOLFIN objects in XML format.

dolfin::XMLFile::XMLFile(MPI_Comm mpi_comm, const std::string filename)

Constructor.

Parameters:
  • mpi_comm
  • filename
dolfin::XMLFile::XMLFile(std::ostream &s)

Constructor from a stream.

Parameters:s
const pugi::xml_node dolfin::XMLFile::get_dolfin_xml_node(pugi::xml_document &xml_doc) const
Parameters:xml_doc
void dolfin::XMLFile::load_xml_doc(pugi::xml_document &xml_doc) const
Parameters:xml_doc
std::shared_ptr<std::ostream> dolfin::XMLFile::outstream
void dolfin::XMLFile::read(Function &input)

Function data input.

Parameters:input
void dolfin::XMLFile::read(GenericVector &input)

Vector input.

Parameters:input
void dolfin::XMLFile::read(Mesh &input)

Mesh input.

Parameters:input
void dolfin::XMLFile::read(MeshFunction<bool> &input)

MeshFunction (bool) input.

Parameters:input
void dolfin::XMLFile::read(MeshFunction<double> &input)

MeshFunction (double) input.

Parameters:input
void dolfin::XMLFile::read(MeshFunction<int> &input)

MeshFunction (int) input.

Parameters:input
void dolfin::XMLFile::read(MeshFunction<std::size_t> &input)

MeshFunction (uint) input.

Parameters:input
void dolfin::XMLFile::read(MeshValueCollection<bool> &input)

MeshValueCollection (bool) input.

Parameters:input
void dolfin::XMLFile::read(MeshValueCollection<double> &input)

MeshValueCollection (double) input.

Parameters:input
void dolfin::XMLFile::read(MeshValueCollection<int> &input)

MeshValueCollection (int) input.

Parameters:input
void dolfin::XMLFile::read(MeshValueCollection<std::size_t> &input)

MeshValueCollection (std::size_t) input.

Parameters:input
void dolfin::XMLFile::read(Parameters &input)

Parameters input.

Parameters:input
void dolfin::XMLFile::read(Table &input)

Table input.

Parameters:input
void dolfin::XMLFile::read_mesh_function(MeshFunction<T> &t, const std::string type) const
Parameters:
  • t
  • type
void dolfin::XMLFile::read_mesh_value_collection(MeshValueCollection<T> &t, const std::string type) const
Parameters:
  • t
  • type
void dolfin::XMLFile::read_vector(std::vector<double> &input, std::vector<dolfin::la_index> &indices)

Vector input.

Parameters:
  • input
  • indices
void dolfin::XMLFile::save_xml_doc(const pugi::xml_document &xml_doc) const
Parameters:xml_doc
void dolfin::XMLFile::write(const Function &output)

Function data output.

Parameters:output
void dolfin::XMLFile::write(const GenericVector &output)

Vector output.

Parameters:output
void dolfin::XMLFile::write(const Mesh &output)

Mesh output.

Parameters:output
void dolfin::XMLFile::write(const MeshFunction<bool> &input)

MeshFunction (bool) output.

Parameters:input
void dolfin::XMLFile::write(const MeshFunction<double> &output)

MeshFunction (double) output.

Parameters:output
void dolfin::XMLFile::write(const MeshFunction<int> &output)

MeshFunction (int) output.

Parameters:output
void dolfin::XMLFile::write(const MeshFunction<std::size_t> &output)

MeshFunction (uint) output.

Parameters:output
void dolfin::XMLFile::write(const MeshValueCollection<bool> &input)

MeshValueCollection (bool) output.

Parameters:input
void dolfin::XMLFile::write(const MeshValueCollection<double> &output)

MeshValueCollection (double) output.

Parameters:output
void dolfin::XMLFile::write(const MeshValueCollection<int> &output)

MeshValueCollection (int) output.

Parameters:output
void dolfin::XMLFile::write(const MeshValueCollection<std::size_t> &output)

MeshValueCollection (std::size_t) output.

Parameters:output
void dolfin::XMLFile::write(const Parameters &output)

Parameters output.

Parameters:output
void dolfin::XMLFile::write(const Table &output)

Table output.

Parameters:output
pugi::xml_node dolfin::XMLFile::write_dolfin(pugi::xml_document &doc)
Parameters:doc
void dolfin::XMLFile::write_mesh_function(const MeshFunction<T> &t, const std::string type)
Parameters:
  • t
  • type
void dolfin::XMLFile::write_mesh_value_collection(const MeshValueCollection<T> &t, const std::string type)
Parameters:
  • t
  • type
dolfin::XMLFile::~XMLFile()

XMLFunctionData

C++ documentation for XMLFunctionData from dolfin/io/XMLFunctionData.h:

class dolfin::XMLFunctionData

I/O for XML representation of Function .

void dolfin::XMLFunctionData::build_dof_map(std::vector<std::vector<dolfin::la_index>> &global_dof_to_cell_dof, const FunctionSpace &V)
Parameters:
  • global_dof_to_cell_dof
  • V
void dolfin::XMLFunctionData::build_global_to_cell_dof(std::vector<std::vector<std::pair<dolfin::la_index, dolfin::la_index>>> &global_dof_to_cell_dof, const FunctionSpace &V)
Parameters:
  • global_dof_to_cell_dof
  • V
void dolfin::XMLFunctionData::read(Function &u, pugi::xml_node xml_node)

Read the XML file with function data.

Parameters:
  • u
  • xml_node
void dolfin::XMLFunctionData::write(const Function &u, pugi::xml_node xml_node)

Write the XML file with function data.

Parameters:
  • u
  • xml_node

XMLMesh

C++ documentation for XMLMesh from dolfin/io/XMLMesh.h:

class dolfin::XMLMesh

I/O of XML representation of a Mesh .

void dolfin::XMLMesh::read(Mesh &mesh, const pugi::xml_node mesh_node)

Read mesh from XML.

Parameters:
  • mesh
  • mesh_node
void dolfin::XMLMesh::read_array_uint(std::vector<std::size_t> &array, const pugi::xml_node xml_array)
Parameters:
  • array
  • xml_array
void dolfin::XMLMesh::read_data(MeshData &data, const Mesh &mesh, const pugi::xml_node mesh_node)
Parameters:
  • data
  • mesh
  • mesh_node
void dolfin::XMLMesh::read_domain_data(LocalMeshData &mesh_data, const pugi::xml_node mesh_node)

Read domain data in LocalMeshData .

Parameters:
  • mesh_data
  • mesh_node
void dolfin::XMLMesh::read_domains(MeshDomains &domains, const Mesh &mesh, const pugi::xml_node mesh_node)
Parameters:
  • domains
  • mesh
  • mesh_node
void dolfin::XMLMesh::read_mesh(Mesh &mesh, const pugi::xml_node mesh_node)
Parameters:
  • mesh
  • mesh_node
void dolfin::XMLMesh::write(const Mesh &mesh, pugi::xml_node mesh_node)

Write mesh to XML.

Parameters:
  • mesh
  • mesh_node
void dolfin::XMLMesh::write_data(const Mesh &mesh, const MeshData &data, pugi::xml_node mesh_node)
Parameters:
  • mesh
  • data
  • mesh_node
void dolfin::XMLMesh::write_domains(const Mesh &mesh, const MeshDomains &domains, pugi::xml_node mesh_node)
Parameters:
  • mesh
  • domains
  • mesh_node
void dolfin::XMLMesh::write_mesh(const Mesh &mesh, pugi::xml_node mesh_node)
Parameters:
  • mesh
  • mesh_node

XMLMeshFunction

C++ documentation for XMLMeshFunction from dolfin/io/XMLMeshFunction.h:

class dolfin::XMLMeshFunction

I/O of XML representation of MeshFunction .

void dolfin::XMLMeshFunction::read(MeshFunction<T> &mesh_function, const std::string type, const pugi::xml_node xml_mesh)

Read XML MeshFunction .

Parameters:
  • mesh_function
  • type
  • xml_mesh
void dolfin::XMLMeshFunction::read(MeshValueCollection<T> &mesh_value_collection, const std::string type, const pugi::xml_node xml_mesh)

Read XML MeshFunction as a MeshValueCollection .

Parameters:
  • mesh_value_collection
  • type
  • xml_mesh
void dolfin::XMLMeshFunction::write(const MeshFunction<T> &mesh_function, const std::string type, pugi::xml_node xml_node, bool write_mesh = true)

Write the XML file.

Parameters:
  • mesh_function
  • type
  • xml_node
  • write_mesh

XMLMeshValueCollection

C++ documentation for XMLMeshValueCollection from dolfin/io/XMLMeshValueCollection.h:

class dolfin::XMLMeshValueCollection

I/O of XML representation of a MeshValueCollection .

void dolfin::XMLMeshValueCollection::read(MeshValueCollection<T> &mesh_value_collection, const std::string type, const pugi::xml_node xml_node)

Read mesh value collection from XML file.

Parameters:
  • mesh_value_collection
  • type
  • xml_node
void dolfin::XMLMeshValueCollection::write(const MeshValueCollection<T> &mesh_value_collection, const std::string type, pugi::xml_node xml_node)

Write mesh value collection to XML file.

Parameters:
  • mesh_value_collection
  • type
  • xml_node

XMLParameters

C++ documentation for XMLParameters from dolfin/io/XMLParameters.h:

class dolfin::XMLParameters

I/O of Parameters in XML format.

void dolfin::XMLParameters::add_parameter(Parameters &p, const std::string &key, T value)
Parameters:
  • p
  • key
  • value
void dolfin::XMLParameters::read(Parameters &parameters, const pugi::xml_node xml_dolfin)

Read parameters from XML file.

Parameters:
  • parameters
  • xml_dolfin
void dolfin::XMLParameters::read_parameter_nest(Parameters &p, const pugi::xml_node xml_node)
Parameters:
  • p
  • xml_node
void dolfin::XMLParameters::write(const Parameters &parameters, pugi::xml_node xml_node)

Write the XML file.

Parameters:
  • parameters
  • xml_node

XMLTable

C++ documentation for XMLTable from dolfin/io/XMLTable.h:

class dolfin::XMLTable

Output of XML representation of DOLFIN Table .

void dolfin::XMLTable::read(Table &table, pugi::xml_node xml_node)

Read the XML file.

Parameters:
  • table
  • xml_node
void dolfin::XMLTable::write(const Table &table, pugi::xml_node xml_node)

Write the XML file.

Parameters:
  • table
  • xml_node

XMLVector

C++ documentation for XMLVector from dolfin/io/XMLVector.h:

class dolfin::XMLVector

I/O of XML representation of GenericVector .

void dolfin::XMLVector::read(GenericVector &x, const pugi::xml_node xml_dolfin)

Read XML vector. Vector must have correct size.

Parameters:
  • x
  • xml_dolfin
void dolfin::XMLVector::read(std::vector<double> &x, std::vector<dolfin::la_index> &indices, const pugi::xml_node xml_dolfin)

Read XML vector in Array .

Parameters:
  • x
  • indices
  • xml_dolfin
std::size_t dolfin::XMLVector::read_size(const pugi::xml_node xml_dolfin)

Read XML vector size.

Parameters:xml_dolfin
void dolfin::XMLVector::write(const GenericVector &vector, pugi::xml_node xml_node, bool write_to_stream)

Write the XML file.

Parameters:
  • vector
  • xml_node
  • write_to_stream

XYZFile

C++ documentation for XYZFile from dolfin/io/XYZFile.h:

class dolfin::XYZFile

Simple and light file format for use with Xd3d.

dolfin::XYZFile::XYZFile(const std::string filename)

Simple and light file format for use with Xd3d. Supports scalar solution on 2D convex domains. The files only have a list of xyz coordinates ‘x y u(x,y)=z’

Parameters:filename
void dolfin::XYZFile::mesh_function_write(T &meshfunction)
Parameters:meshfunction
void dolfin::XYZFile::results_write(const Function &u) const
Parameters:u
void dolfin::XYZFile::write(const Function &u)

Output Function

Parameters:uFunction
std::string dolfin::XYZFile::xyz_filename
void dolfin::XYZFile::xyz_name_update()
dolfin::XYZFile::~XYZFile()