MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
inout.cc File Reference

Functions for input and output operations. More...

#include "globals.hh"
#include <fstream>
#include <iostream>
#include <string.h>
#include "allocation.hh"
#include "geometry.hh"

Go to the source code of this file.

Functions

void readParameters (string filename, string &outputFilename, string &VTKInputFilename, string &GnuplotSkeletonFilename, string &GnuplotAltSkeletonFilename, string &descriptorsFilename, string &parametersFilename)
 
int *** allocateFromVTK (string filename, int ***amat, bool report)
 Allocates the matrix from dimensions read from VTK file. More...
 
void importFromVTK (string filename, int ***amat, bool report)
 Reads morphology from VTK file. Changes amat. More...
 
void saveToVTK (const char *filename, int ***amat, bool report)
 Saves morphology to VTK file. More...
 
void saveToDX (const char *filename, int ***amat, bool report)
 Saves morphology to DX file. More...
 
void saveToGnuplot (string filename, int sv, int incmax, double **vert, int **vinc, bool report)
 Saves tessellation diagram to gnuplot file. More...
 
void saveDescriptors (string filename, double por, double fs, bool report)
 Saves morphology descriptors (porosity and strut content) to a file. More...
 
void saveParameters (string filename, double dedge, bool report)
 Saves parameters (dedge) to a file. More...
 

Detailed Description

Functions for input and output operations.

Author
Pavel Ferkl

Definition in file inout.cc.

Function Documentation

◆ allocateFromVTK()

int*** allocateFromVTK ( string  filename,
int ***  amat,
bool  report 
)

Allocates the matrix from dimensions read from VTK file.

Parameters
[in]filenameName of input VTK file with morphology
[in,out]amatmatrix
[in]reportshow output

Definition at line 71 of file inout.cc.

References alloc_3Dmatrix(), globals::nx, globals::ny, and constants::nz.

Referenced by main().

◆ importFromVTK()

void importFromVTK ( string  filename,
int ***  amat,
bool  report 
)

Reads morphology from VTK file. Changes amat.

Parameters
[in]filenameName of input VTK file with morphology
[in,out]amatmatrix
[in]reportshow output

Definition at line 108 of file inout.cc.

Referenced by main().

◆ readParameters()

void readParameters ( string  filename,
string &  outputFilename,
string &  VTKInputFilename,
string &  GnuplotSkeletonFilename,
string &  GnuplotAltSkeletonFilename,
string &  descriptorsFilename,
string &  parametersFilename 
)

Reads file with options and parameters

Reads parameters from file and stores them to global variables. These parameters determine what will be done.

Parameters
[in]filenameName of input file with parameters that determine what will be done
[in,out]outputFilenameName of output file with morphology without extension
[in,out]VTKInputFilenameName of input VTK file with morphology
[in,out]GnuplotSkeletonFilenameName of input/output file with tessellation - gnuplot diagram
[in,out]GnuplotAltSkeletonFilenameName of output file with tessellation - alt. gnuplot diagram
[in,out]descriptorsFilenameName of output file with morphology descriptors
[in,out]parametersFilenameName of output file with parameters

Definition at line 18 of file inout.cc.

References globals::createEdges, globals::createNodes, globals::dedge, constants::dstrut, globals::grid, globals::import_vtk, globals::nx, globals::ny, constants::nz, globals::openCell, globals::progress_report, globals::RANDOM, globals::save_dat, globals::save_voro_diag1, globals::save_voro_diag2, globals::save_vtk, globals::strutPorosity, globals::sx, globals::sy, and globals::sz.

Referenced by main().

◆ saveDescriptors()

void saveDescriptors ( string  filename,
double  por,
double  fs,
bool  report 
)

Saves morphology descriptors (porosity and strut content) to a file.

Parameters
[in]filenameOutput file with morphology descriptors
[in]porporosity
[in]fsstrut content
[in]reportshow output

Definition at line 295 of file inout.cc.

Referenced by main().

◆ saveParameters()

void saveParameters ( string  filename,
double  dedge,
bool  report 
)

Saves parameters (dedge) to a file.

Parameters
[in]filenameName of output file with parameters
[in]dedgeedge strut size parameter
[in]reportshow output

Definition at line 315 of file inout.cc.

Referenced by main().

◆ saveToDX()

void saveToDX ( const char *  filename,
int ***  amat,
bool  report 
)

Saves morphology to DX file.

Parameters
[in]filenameName of output file with morphology
[in]amatmatrix
[in]reportshow output

Definition at line 220 of file inout.cc.

References globals::nx, globals::ny, and constants::nz.

Referenced by main().

◆ saveToGnuplot()

void saveToGnuplot ( string  filename,
int  sv,
int  incmax,
double **  vert,
int **  vinc,
bool  report 
)

Saves tessellation diagram to gnuplot file.

Parameters
[in]filenameName of output file with tessellation
[in]svnumber of vertices
[in]incmaxmaximum number of connections to one vertex
[in]vertvertex positions
[in]vincindexes of connected vertices
[in]reportshow output

Definition at line 256 of file inout.cc.

References in_domain().

Referenced by main().

◆ saveToVTK()

void saveToVTK ( const char *  filename,
int ***  amat,
bool  report 
)

Saves morphology to VTK file.

Parameters
[in]filenameName of output file with morphology
[in]amatmatrix
[in]reportshow output

Definition at line 178 of file inout.cc.

References globals::nx, globals::ny, and constants::nz.

Referenced by main().