Program Listing for File vtk_utils.h

Return to documentation for file (include/immersx/io/vtk_utils.h)

// ---------------------------------------------------------------------
//
// Copyright (C) 2024 by Luca Heltai
//
// This file is part of the ImmersX application, based on
// the deal.II library.
//
// The ImmersX application is free software; you can use
// it, redistribute it, and/or modify it under the terms of the Apache-2.0
// License WITH LLVM-exception as published by the Free Software Foundation;
// either version 3.0 of the License, or (at your option) any later version. The
// full text of the license can be found in the file LICENSE.md at the top level
// of the ImmersX distribution.
//
// ---------------------------------------------------------------------

#ifndef rdl_vtk_utils_h
#define rdl_vtk_utils_h

#include <deal.II/base/config.h>

#include <deal.II/base/mpi.h>
#include <deal.II/base/point.h>

#include <deal.II/distributed/tria.h>

#include <deal.II/dofs/dof_handler.h>

#include <deal.II/fe/fe.h>

#include <deal.II/grid/tria.h>

#include <deal.II/lac/vector.h>

#include <immersx/core/reduced_field_catalog.h>
#include <immersx/coupling/point_cloud.h>

#include <limits>
#include <string>
#include <vector>

namespace ImmersX
{
#ifdef DEAL_II_WITH_VTK

  using namespace dealii;

  namespace VTKUtils
  {
    template <int spacedim>
    void
    read_vtk_point_cloud(const std::string    &vtk_filename,
                         PointCloud<spacedim> &point_cloud,
                         const unsigned int    requested_piece =
                           std::numeric_limits<unsigned int>::max(),
                         const unsigned int n_requested_pieces = 1);

    template <int spacedim>
    void
    read_vtk_point_cloud(const std::string                &vtk_filename,
                         std::vector<Point<spacedim>>     &points,
                         std::vector<std::vector<double>> &properties,
                         FieldCatalog                     &catalog,
                         std::vector<std::string>         &property_names);

    template <int spacedim>
    void
    read_vtk_point_cloud(const std::string            &vtk_filename,
                         std::vector<Point<spacedim>> &points,
                         Vector<double>               &properties,
                         FieldCatalog                 &catalog,
                         std::vector<std::string>     &property_names);

    template <int dim, int spacedim>
    void
    read_vtk(const std::string            &vtk_filename,
             Triangulation<dim, spacedim> &tria,
             const bool                    cleanup = true);

    void
    read_cell_data(const std::string &vtk_filename,
                   const std::string &cell_data_name,
                   Vector<double>    &output_vector);

    void
    read_vertex_data(const std::string &vtk_filename,
                     const std::string &vertex_data_name,
                     Vector<double>    &output_vector);


    void
    read_data(const std::string &vtk_filename, Vector<double> &output_vector);

    template <int dim, int spacedim>
    std::unique_ptr<FiniteElement<dim, spacedim>>
    vtk_to_finite_element(const std::string &vtk_filename,
                          FieldCatalog      &catalog);

    template <int dim, int spacedim>
    void
    read_vtk(const std::string         &vtk_filename,
             DoFHandler<dim, spacedim> &dof_handler,
             Vector<double>            &output_vector,
             std::vector<std::string>  &data_names);

    template <int dim, int spacedim>
    void
    read_vtk(const std::string         &vtk_filename,
             DoFHandler<dim, spacedim> &dof_handler,
             Vector<double>            &output_vector,
             FieldCatalog              &catalog);
  }    // namespace VTKUtils
#endif // DEAL_II_WITH_VTK


} // namespace ImmersX

#endif