OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
checksum_output_files.h
Go to the documentation of this file.
1//Copyright> OpenRadioss
2//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3//Copyright>
4//Copyright> This program is free software: you can redistribute it and/or modify
5//Copyright> it under the terms of the GNU Affero General Public License as published by
6//Copyright> the Free Software Foundation, either version 3 of the License, or
7//Copyright> (at your option) any later version.
8//Copyright>
9//Copyright> This program is distributed in the hope that it will be useful,
10//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//Copyright> GNU Affero General Public License for more details.
13//Copyright>
14//Copyright> You should have received a copy of the GNU Affero General Public License
15//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16//Copyright>
17//Copyright>
18//Copyright> Commercial Alternative: Altair Radioss Software
19//Copyright>
20//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21//Copyright> software under a commercial license. Contact Altair to discuss further if the
22//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23
24
25#include <iostream>
26#include <fstream>
27#include <list>
28#include <string>
29#include <tuple>
30#include <algorithm> // std::remove
31using std::cout;
32using std::endl;
33
34#include <stdlib.h>
35#include <stdio.h>
36#include <string.h>
37#include <math.h>
38#include <zlib.h>
39
40#ifdef _WIN64
41
42#include <winsock2.h>
43#define htobe64(x) htonll(x)
44
45#else
46
47#include <arpa/inet.h>
48
49#endif
50
51
52#define FASTMAGI10 0x542c // output format : only FASTMAGI10 exists
53#define SHORT2FLOAT 3000. // used to convert a uint16_t to a float
54
55
57private:
58 // Debug flag
59 // Set to 1 to enable debug mode, 0 to disable it
60#ifdef DEBUG
61 int debug=1;
62#else
63 int debug=0;
64#endif
65 FILE * fstream;
66 gzFile gzstream;
67 std::string file_mode;
68
69 void remove_cr(std::string &line);
70 void remove_trailing_blanks(std::string& str);
71 inline void SWAP_MANY2BYTES(uint16_t *intPtr, size_t number);
72 inline void SWAP_MANY4BYTES(int *intPtr, size_t number);
73 inline void SWAP_MANY8BYTES(double *intPtr, size_t number);
74 inline void SWAP_BYTESINDATA(void *itemList, size_t itemCount, size_t sizeOfItem);
75 int Ufread(void *pchar, size_t sizeOfItem,
76 size_t numItems,
77 bool text = false);
78
79public:
80 int open_binary_file(std::string filename);
81 void close_binary_file();
82 std::list<std::string> Animation();
83 std::list<std::string> Time_History();
84 std::list<std::string> Out_File(std::fstream *new_file);
85 std::list<std::tuple<std::string,std::string>> Checksum_File(std::fstream *new_file);
86};
87
void remove_trailing_blanks(std::string &str)
int open_binary_file(std::string filename)
void SWAP_MANY4BYTES(int *intPtr, size_t number)
void SWAP_MANY8BYTES(double *intPtr, size_t number)
int Ufread(void *pchar, size_t sizeOfItem, size_t numItems, bool text=false)
void SWAP_BYTESINDATA(void *itemList, size_t itemCount, size_t sizeOfItem)
void remove_cr(std::string &line)
std::list< std::string > Animation()
void SWAP_MANY2BYTES(uint16_t *intPtr, size_t number)
std::list< std::string > Out_File(std::fstream *new_file)
std::list< std::string > Time_History()
std::list< std::tuple< std::string, std::string > > Checksum_File(std::fstream *new_file)