#include <fstream>
#include <boost/filesystem.hpp>
#include <boost/version.hpp>
#include <boost/regex.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <iterator>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <iomanip>
#include <bitset>
#include "uth_intf.h"
#include "uth_log.h"
#include "uth_system.h"
#include "uth_io_results.h"
#include "uth_io_compression.h"
#include "uth_io_files.h"
#include "mmh_intf.h"
#include "pch_intf.h"
#include "svnversion.h"
#include "mf_version.h"
#include "aph_intf.h"
#include "uth_bc.h"
Classes | |
struct | NAS |
Typedefs | |
typedef int(* | mmpt_io_fptr )(const int Mesh_field_id, const char *Filename) |
Functions | |
int | utr_io_initialize_mesh (FILE *Interactive_output, const char *Work_dir, char Mesh_type, const char *Mesh_file) |
For file io. | |
void | utr_io_gather_filenames_from_dir (const char *Dir, std::vector< string > &Filenames) |
! extern "C" | |
void | utr_io_filter_filenames (std::vector< string > &Filenames, const char *Regex) |
mmpt_io_fptr | utr_io_get_reading_function (const char Mesh_type) |
int | utr_io_read_mesh (const int Mesh_id, const char *Working_dir, const char *Mesh_files_regex, const char Mesh_type) |
Definitions:. | |
mmpt_io_fptr | utr_io_get_writing_function (const char Mesh_type) |
int | utr_io_export_mesh (FILE *Interactive_output, const int Mesh_id, char Mesh_type, char *Mesh_file) |
int | utr_menu_export_mesh (FILE *Interactive_output, FILE *Interactive_input, const int Mesh_id, const char *Work_dir, char *Mesh_file) |
int | utr_io_write_img_to_pam (const char *Work_dir, const char *Filename, const int Width, const int Height, const int Depth, const int Maxval, const char *TUPLTYPE, const char *Img_data, FILE *Interactive_output) |
int | utr_io_write_img_to_pnm (const char *Work_dir, const char *Filename, const char *Comment, const int Width, const int Height, const int Max_color_component_value, const int Magic_number, const char *Img_data, FILE *Interactive_output) |
int | utr_io_write_img_to_pbm (const char *Work_dir, const char *Filename, const char *Comment, const int Width, const int Height, const int Max_color_component_value, const int Magic_number, const unsigned char *Img_data, FILE *Interactive_output) |
int | utr_io_count_string_in_file (std::ifstream &File, const string &To_find) |
NAS | utr_io_nastran_discover_type (std::ifstream &File, int Line_count) |
int | utr_io_read_nas (const int Mesh_id, const char *filename) |
int | utr_io_read_in (const int Mesh_id, const char *filename) |
int | utr_io_read_binary (const int Mesh_id, const char *filename) |
int | utr_io_read_hybrid (const int Mesh_id, const char *filename) |
int | utr_io_read_am (const int Mesh_id, const char *filename) |
int | utr_io_read_dat (const int Mesh_id, const char *filename) |
int | utr_io_read_vtk (const int Mesh_id, const char *filename) |
int | utr_io_read_jk (const int Mesh_id, const char *filename) |
int | utr_io_read_msh (const int Mesh_id, const char *filename) |
int | utr_io_write_vtk (const int Mesh_id, const char *filename) |
int | utr_io_write_msh (const int Mesh_id, const char *filename) |
int | utr_io_write_nas (const int Mesh_id, const char *Filename) |
int | utr_io_write_nas_short (const int Mesh_id, const char *Filename) |
int | utr_io_write_nas_long (const int Mesh_id, const char *Filename) |
Variables | |
const int | Nastran_max_line_length = 128 |
typedef int(* mmpt_io_fptr)(const int Mesh_field_id,const char *Filename) |
Internal types pointer to a function to read/write specyfic file type.
int utr_io_count_string_in_file | ( | std::ifstream & | File, | |
const string & | To_find | |||
) |
--------------------------------------------------------- utr_io_count_string_in_file - to count string occurences in the file ---------------------------------------------------------
void utr_io_filter_filenames | ( | std::vector< string > & | Filenames, | |
const char * | Regex | |||
) |
--------------------------------------------------------- utr_io_filter_filename - to filter filenames with given regular expression ---------------------------------------------------------
Find entries that DON'T MATCH and remove them.
!for
Regex | IN: list of filenames to filter OUT: filtered filenames IN: regular expression pattern to filter with |
void utr_io_gather_filenames_from_dir | ( | const char * | Dir, | |
std::vector< string > & | Filenames | |||
) |
! extern "C"
Forward declarations of internal routines: --------------------------------------------------------- utr_io_gather_filenames_from_dir - to write all filenames into given vector ---------------------------------------------------------
Internal routines (not extern "C") --------------------------------------------------------- utr_io_gather_filenames_from_dir - to write all filenames into given vector ---------------------------------------------------------
this should be working directory...
!for
!if
!if
!try
Filenames | IN: path of directory OUT: vector of filenames in Dir |
mmpt_io_fptr utr_io_get_reading_function | ( | const char | Mesh_type | ) |
--------------------------------------------------------- utr_io_get_reading_function - to return pointer to appropriate reading function for given mesh type ---------------------------------------------------------
IMPORTANT! Registering reading functions.
notify that initialization is done
Mesh_type | returns: pointer to read function for Mesh_type IN: type of mesh filename |
mmpt_io_fptr utr_io_get_writing_function | ( | const char | Mesh_type | ) |
--------------------------------------------------------- utr_io_get_writing_function - to return pointer to appropriate reading function for given mesh type ---------------------------------------------------------
IMPORTANT! Registering reading functions.
writing_functions[ MMC_MOD_FEM_HYBRID_DATA ]=utr_io_write_hybrid; writing_functions[ MMC_MOD_FEM_TETRA_DATA ]=utr_io_write_hybrid; writing_functions[ MMC_MOD_FEM_MESH_DATA ]=utr_io_write_dat; writing_functions[ MMC_MOD_FEM_PRISM_DATA ]=utr_io_write_dat;
writing_functions[ MMC_GRADMESH_DATA ]=utr_io_write_jk; writing_functions[ MMC_BINARY_DATA ]=utr_io_write_binary; writing_functions[ MMC_IN_ANSYS_DATA ]=utr_io_write_in; writing_functions[ MMC_PARAVIEW_VTK_DATA ]=utr_io_write_vtk;
notify that initialization is done
NAS utr_io_nastran_discover_type | ( | std::ifstream & | File, | |
int | Line_count | |||
) |
int utr_io_read_am | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_am - to read single .am file --------------------------------------------
int utr_io_read_binary | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_binary - to read single binary dump file --------------------------------------------
int utr_io_read_dat | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_dat - to read single .dat file --------------------------------------------
Vertices
Edges
if(vertices[0] > vertices[1]) { std::swap(vertices[0],vertices[1]); }
Faces
check negative values
for(register int i(0); i < face_type; ++i) { edgePtrs[i]=&m.edges_[edges[i]]; assert(edgePtrs[i] != NULL); }
std::sort(edgePtrs,edgePtrs+face_type, & Edge::comparePtrs );
for(register int i(0); i < face_type; ++i) { edges[i]=edgePtrs[i]->pos_; }
MMC_TRIA:
MMC_QUAD:
MMC_TETRA:
MMC_PRISM:
HACK below: to conform KB ordering of nodes faceFlip is... flipped ;) see PHP_FEM.pdf and hHybridMesh.pdf for details
!switch(element_type)
int utr_io_read_hybrid | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_hybrid - to read single .kaz file --------------------------------------------
int utr_io_read_in | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_in - to read single .in file --------------------------------------------
int utr_io_read_jk | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_jk - to read single .jk file --------------------------------------------
Reading initial data.
Reserving space for all kind of nodes.
Reading vertices.
Read plain x y coords.
read the number of stored element structures
int utr_io_read_msh | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_msh - to read single .msh (ansys) file --------------------------------------------
mapping from MSH cell/element/face types to MMC_constans
mixed
triangular
tetrahedral
quadrilateral
hexahedral
pyramid
wedge
mixed
linear
triangular
quadrilateral
int utr_io_read_nas | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_nas - to read single .nas file --------------------------------------------
below: tetrahedron have 6 edges prismatic element have 9 edges in case of expanding mesh we reserve also for already exisintg entities
1. Reading Nodes. /////////////////////////////////////////////////////////// Find first node
Move back before 'node_str'
2. Reading edges - omitted. /////////////////////////////////////////////////////////// In .nas file there are no edges
number - ignore it
element group no. = bc no.
fPtr->verts(0) = tmp2; /// vertices no. !!! (not edges)
fPtr->verts(1) = tmp2;
fPtr->verts(2) = tmp2;
number - ignore it
element group no. = bc no.
fPtr->verts(0) = tmp2; /// vertices no. !!! (not edges)
fPtr->verts(1) = tmp2;
fPtr->verts(2) = tmp2;
! while - faces
number - ignore it
element group no. = material
vertices no. !!! (not edges)
number - ignore it
element group material
vertices no. !!! (not edges)
number - ignore it
element group material
vertices no. !!! (not edges)
! while - elements
int utr_io_read_vtk | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_read_vtk - to read single .vtk file --------------------------------------------
int utr_io_write_msh | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_write_msh - to write single .msh file --------------------------------------------
int utr_io_write_nas | ( | const int | Mesh_id, | |
const char * | Filename | |||
) |
-------------------------------------------- utr_io_write_nas - to read single .nas file --------------------------------------------
while
int utr_io_write_nas_long | ( | const int | Mesh_id, | |
const char * | Filename | |||
) |
-------------------------------------------- utr_io_write_nas_long - to read single .nas file (long format) --------------------------------------------
while
int utr_io_write_nas_short | ( | const int | Mesh_id, | |
const char * | Filename | |||
) |
-------------------------------------------- utr_io_write_nas_short - to read single .nas file (short format) --------------------------------------------
int utr_io_write_vtk | ( | const int | Mesh_id, | |
const char * | filename | |||
) |
-------------------------------------------- utr_io_write_vtk - to write single .vtk file --------------------------------------------
const int Nastran_max_line_length = 128 |
--------------------------------------------------------- utr_io_nastran_discover_type - to parse Nastran file to discover it's type ---------------------------------------------------------