Loading...
Searching...
No Matches
ITHACAstream.H File Reference

Header file of the ITHACAstream class, it contains the implementation of several methods for input output operations. More...

#include "fvCFD.H"
#include "IOmanip.H"
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <algorithm>
#include <fstream>
#include <string>
#include <stdexcept>
#include <sstream>
#include <vector>
#include <cstdio>
#include <typeinfo>
#include <iostream>
#include <cassert>
#include <zlib.h>
#include <map>
#include "ITHACAassert.H"
#include "ITHACAparameters.H"
#include "ITHACAutilities.H"
#include <Eigen/Eigen>
#include "EigenFunctions.H"
#include <unsupported/Eigen/CXX11/Tensor>
#include "cnpy.H"

Go to the source code of this file.

Namespaces

namespace  ITHACAstream
 Namespace for input-output manipulation.
 
namespace  Foam
 

Macros

#define MAXBUFSIZE   (static_cast<int> (1e6))
 
#define PBSTR   "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
 
#define PBWIDTH   60
 

Functions

template<typename Type >
void ITHACAstream::exportFvMatrix (fvMatrix< Type > &Matrix, word folder, word MatrixName)
 Export an Fv Matrix to folder together with its source term.
 
template<typename T , int dim>
void ITHACAstream::exportMatrix (Eigen::Matrix< T, -1, dim > &matrix, word Name, word type="python", word folder="./Matrices")
 Export the reduced matrices in numpy (type=python), matlab (type=matlab) and txt (type=eigen) format The function is implemented for a second order matrix.
 
void ITHACAstream::exportMatrix (List< Eigen::MatrixXd > &matrix, word Name, word type="python", word folder="./Matrices")
 Export the reduced matrices in numpy (type=python), matlab (type=matlab) and txt (type=eigen) format The function is implemented for a third order matrix The eigen matrix is stored as a set of two dimensional matrices where each matrix is in a different file.
 
template<typename T >
void ITHACAstream::exportTensor (Eigen::Tensor< T, 3 > tensor, word Name, word type="python", word folder="./Matrices")
 Export the reduced tensor in numpy (tipo=python), matlab (tipo=matlab) and txt (tipo=eigen) format.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::read_fields (PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, word Name, fileName casename, int first_snap=0, int n_snap=0)
 Function to read a list of fields from the name of the field and casename.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::read_fields (PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, GeometricField< Type, PatchField, GeoMesh > &field, fileName casename, int first_snap=0, int n_snap=0)
 Function to read a list of fields from the name of the field if it is already existing.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::readMiddleFields (PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, GeometricField< Type, PatchField, GeoMesh > &field, fileName casename)
 Funtion to read a list of volVectorField from name of the field including all the intermediate snapshots.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::readConvergedFields (PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, GeometricField< Type, PatchField, GeoMesh > &field, fileName casename)
 Function to read a list of volVectorField from name of the field including only converged snapshots.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::read_last_fields (PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, const GeometricField< Type, PatchField, GeoMesh > &field, const fileName casename)
 Function to read a list of fields from the name of the field including only the last snapshot.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::readLastFields (PtrList< GeometricField< Type, PatchField, GeoMesh > > &Lfield, const GeometricField< Type, PatchField, GeoMesh > &field, const fileName casename)
 Funtion to read a list of volVectorField from name of the field including only the last snapshots.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::exportFields (PtrList< GeometricField< Type, PatchField, GeoMesh > > &field, word folder, word fieldname)
 Function to export a scalar of vector field.
 
Eigen::MatrixXd ITHACAstream::readMatrix (word filename)
 Read a two dimensional matrix from a txt file in Eigen format.
 
List< Eigen::MatrixXd > ITHACAstream::readMatrix (word folder, word mat_name)
 Read a three dimensional matrix from a txt file in Eigen format.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::exportSolution (GeometricField< Type, PatchField, GeoMesh > &s, fileName subfolder, fileName folder, word fieldName)
 Export a field to file in a certain folder and subfolder.
 
template<class Type , template< class > class PatchField, class GeoMesh >
void ITHACAstream::exportSolution (GeometricField< Type, PatchField, GeoMesh > &s, fileName subfolder, fileName folder)
 Export a field to file in a certain folder and subfolder.
 
template<typename T >
void ITHACAstream::exportList (T &list, word folder, word filename)
 Export a list to file.
 
template<typename T , int Nrows, typename IND >
void ITHACAstream::SaveSparseMatrix (Eigen::SparseMatrix< T, Nrows, IND > &m, word folder, word MatrixName)
 Export an Eigen sparse matrix into bynary format file.
 
template<typename T , int Nrows, typename IND >
void ITHACAstream::ReadSparseMatrix (Eigen::SparseMatrix< T, Nrows, IND > &m, word folder, word MatrixName)
 Read an Eigen sparse matrix from a bynary format file.
 
template<typename MatrixType >
void ITHACAstream::SaveDenseMatrix (MatrixType &Matrix, word folder, word MatrixName)
 Save a dense matrix to a binary format file.
 
template<typename MatrixType >
void ITHACAstream::ReadDenseMatrix (MatrixType &Matrix, word folder, word MatrixName)
 Read a dense matrix from a binary format file.
 
template<typename TensorType >
void ITHACAstream::SaveDenseTensor (TensorType &Tensor, word folder, word MatrixName)
 Save a dense tensor to file.
 
template<typename TensorType >
void ITHACAstream::ReadDenseTensor (TensorType &Tensor, word folder, word MatrixName)
 Read a dense tensor from file.
 
template<typename MatrixType >
void ITHACAstream::SaveSparseMatrixList (List< MatrixType > &MatrixList, word folder, word MatrixName)
 Save a sparse matrix list to bynary files.
 
template<typename T , int Nrows, typename IND >
void ITHACAstream::ReadSparseMatrixList (List< Eigen::SparseMatrix< T, Nrows, IND > > &m, word folder, word MatrixName)
 Read a sparse matrix list to bynary files.
 
template<typename MatrixType >
void ITHACAstream::SaveDenseMatrixList (List< MatrixType > &MatrixList, word folder, word MatrixName)
 Save a dense matrix list to bynary files.
 
template<typename MatrixType >
void ITHACAstream::ReadDenseMatrixList (List< MatrixType > &m, word folder, word MatrixName)
 Read a sparse matrix list to bynary files.
 
int ITHACAstream::numberOfFiles (word folder, word MatrixName, word ext="")
 Count the number of files with a certain name prefix, used by reading functions of list of matrices.
 
void ITHACAstream::writePoints (pointField points, fileName folder, fileName subfolder)
 Write points of a mesh to a file.
 
void ITHACAstream::printProgress (double percentage)
 Print progress bar given the percentage.
 
template<typename T >
void ITHACAstream::save (const List< Eigen::SparseMatrix< T > > &MatrixList, word folder, word MatrixName)
 
template<typename T >
void ITHACAstream::load (List< Eigen::SparseMatrix< T > > &MatrixList, word folder, word MatrixName)
 
template<typename T >
Ostream & Foam::operator<< (Ostream &os, const Eigen::Matrix< T, -1, -1 > &mat)
 
template<typename T >
Istream & Foam::operator>> (Istream &is, Eigen::Matrix< T, -1, -1 > &mat)
 
template<typename T >
Ostream & Foam::operator<< (Ostream &os, const Eigen::Matrix< T, -1, 1 > &mat)
 
template<typename T >
Istream & Foam::operator>> (Istream &is, Eigen::Matrix< T, -1, 1 > &mat)
 
template<typename T >
Ostream & Foam::operator<< (Ostream &os, const Eigen::Tensor< T, 3 > &tens)
 
template<typename T >
Istream & Foam::operator>> (Istream &is, Eigen::Tensor< T, 3 > &tens)
 

Detailed Description

Header file of the ITHACAstream class, it contains the implementation of several methods for input output operations.

Definition in file ITHACAstream.H.

Macro Definition Documentation

◆ MAXBUFSIZE

#define MAXBUFSIZE   (static_cast<int> (1e6))

Definition at line 71 of file ITHACAstream.H.

◆ PBSTR

#define PBSTR   "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"

Definition at line 72 of file ITHACAstream.H.

◆ PBWIDTH

#define PBWIDTH   60

Definition at line 73 of file ITHACAstream.H.