OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
show.hpp File Reference

Pretty-print 3D arrays to console. More...

#include "typename.hpp"
#include <array>
#include <complex>
#include <iomanip>
#include <iostream>
#include <vector>
Include dependency graph for show.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T >
void pfc::utils::show (const std::vector< T > &data, const std::array< int, 3 > &size, const std::array< int, 3 > &offsets)
 
template<typename T >
void pfc::utils::show (const std::vector< T > &data, const std::array< int, 2 > &size, const std::array< int, 2 > &offsets)
 

Detailed Description

Pretty-print 3D arrays to console.

This header provides the show() template function for pretty-printing 3D arrays stored in std::vector with size and offset information.

The function displays:

  • Array dimensions and type
  • Slice-by-slice output ([:, :, k] format)
  • Formatted values with fixed precision
  • Optional offset information for distributed arrays

This is particularly useful for debugging field data and visualization of small computational domains.

std::vector<double> data(4*4*4, 1.0);
pfc::utils::show(data, {4, 4, 4}, {0, 0, 0});
// Prints formatted 3D array slices
Pretty-print 3D arrays to console.
See also
utils/array_to_string.hpp for simple array formatting
utils/typename.hpp for type name display
Author
OpenPFC Development Team
Date
2025