Skip to content

Commit 71a0942

Browse files
MicK7pcarruscag
andauthored
Add HDF5 backend support for CGNS in SU2 (#1500)
* Add hdf5 subdirectory in CGNS - hdf5 1.12 source copied in cgns - add cgns files from 4.2 to support hdf5 backend - add parallel cgns build detection to meson - add LICENSE Co-authored-by: Pedro Gomes <pcarruscag@gmail.com>
1 parent 622587c commit 71a0942

531 files changed

Lines changed: 459295 additions & 1738 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.lgtm.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
extraction:
2+
cpp:
3+
prepare:
4+
packages:
5+
- libboost-all-dev
6+
configure:
7+
command:
8+
- ./meson.py build --optimization=1
9+
index:
10+
build_command:
11+
- ./ninja -C build
12+
113
path_classifiers:
214
test:
315
- TestCases/*

externals/cgns/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
**********************************************************************
22
https://github.com/CGNS/CGNS/releases,
3-
the source files for CGNS v3.3.0 are bundled and build directly into SU2
3+
the source files for CGNS v4.2.0 are bundled and build directly into SU2
44

55
From the CGNS webpage:
66

externals/cgns/adf/ADF.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ File: ADF.h
5858
ADF core code. These sizes are provided for reference only!
5959
***********************************************************************/
6060
#define ADF_DATA_TYPE_LENGTH 32
61+
#define ADF_CGIO_DATA_TYPE_LENGTH 2
6162
#define ADF_DATE_LENGTH 32
6263
#define ADF_FILENAME_LENGTH 1024
6364
#define ADF_FORMAT_LENGTH 20
@@ -249,6 +250,7 @@ EXTERN void ADF_Put_Name(
249250

250251
EXTERN void ADF_Read_All_Data(
251252
const double ID,
253+
const char *m_data_type,
252254
char *data,
253255
int *error_return ) ;
254256

@@ -269,6 +271,7 @@ EXTERN void ADF_Read_Data(
269271
const cgsize_t m_start[],
270272
const cgsize_t m_end[],
271273
const cgsize_t m_stride[],
274+
const char *m_data_type,
272275
char *data,
273276
int *error_return ) ;
274277

externals/cgns/adf/ADF_interface.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ;
13711371
CHECK_ADF_ABORT( *error_return ) ;
13721372

13731373
/** Copy the blank-filled data-type into a C string **/
1374-
ADFI_string_2_C_string( node.data_type, ADF_DATA_TYPE_LENGTH, data_type,
1374+
ADFI_string_2_C_string( node.data_type, ADF_CGIO_DATA_TYPE_LENGTH, data_type,
13751375
error_return ) ;
13761376
CHECK_ADF_ABORT( *error_return ) ;
13771377

@@ -2601,6 +2601,7 @@ output: int *error_return Error return.
26012601
***********************************************************************/
26022602
void ADF_Read_All_Data(
26032603
const double ID,
2604+
const char *m_data_type,
26042605
char *data,
26052606
int *error_return )
26062607
{
@@ -2629,7 +2630,16 @@ if( data == NULL ) {
26292630
ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ;
26302631
CHECK_ADF_ABORT( *error_return ) ;
26312632

2633+
/* if it was provided, check to make sure the data types match */
2634+
if( m_data_type != NULL ) {
2635+
if(strncmp(m_data_type, node.data_type, 2) != 0){
2636+
*error_return = INVALID_DATA_TYPE;
2637+
CHECK_ADF_ABORT( *error_return );
2638+
}
2639+
}
2640+
26322641
/** Get datatype size **/
2642+
26332643
ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes,
26342644
tokenized_data_type, &file_format, &machine_format, error_return ) ;
26352645
CHECK_ADF_ABORT( *error_return ) ;
@@ -2916,6 +2926,7 @@ void ADF_Read_Data(
29162926
const cgsize_t m_start[],
29172927
const cgsize_t m_end[],
29182928
const cgsize_t m_stride[],
2929+
const char *m_data_type,
29192930
char *data,
29202931
int *error_return )
29212932
{
@@ -2952,6 +2963,14 @@ if( (s_start == NULL) || (s_end == NULL) || (s_stride == NULL) ||
29522963
ADFI_chase_link( ID, &LID, &file_index, &block_offset, &node, error_return ) ;
29532964
CHECK_ADF_ABORT( *error_return ) ;
29542965

2966+
/* if it was provided, check to make sure the data types match */
2967+
if( m_data_type != NULL ) {
2968+
if(strncmp(m_data_type, node.data_type, 2) != 0){
2969+
*error_return = INVALID_DATA_TYPE;
2970+
CHECK_ADF_ABORT( *error_return );
2971+
}
2972+
}
2973+
29552974
/** Get datatype length **/
29562975
ADFI_evaluate_datatype( file_index, node.data_type, &file_bytes, &memory_bytes,
29572976
tokenized_data_type, &disk_format, &machine_format, error_return ) ;

externals/cgns/adf/ADF_internals.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ static void ADFI_convert_integers(
482482
}
483483
}
484484
else {
485-
memcpy(to_data, from_data, size * count);
485+
memcpy(to_data, from_data, (size_t)size * (size_t)count);
486486
}
487487
}
488488
/*------------------------------------------------------------------------------------*/

externals/cgns/adfh/ADF.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*-------------------------------------------------------------------
2+
* this is a replacement for ADF.h for HDF5 implementation
3+
*-------------------------------------------------------------------*/
4+
5+
#ifndef _ADF_H_
6+
#define _ADF_H_
7+
8+
/* map ADF calls to ADFH calls */
9+
10+
#define ADF_Children_Names ADFH_Children_Names
11+
#define ADF_Children_IDs ADFH_Children_IDs
12+
#define ADF_Create ADFH_Create
13+
#define ADF_Database_Close ADFH_Database_Close
14+
#define ADF_Database_Delete ADFH_Database_Delete
15+
#define ADF_Database_Garbage_Collection ADFH_Database_Garbage_Collection
16+
#define ADF_Database_Get_Format ADFH_Database_Get_Format
17+
#define ADF_Database_Open ADFH_Database_Open
18+
#define ADF_Database_Valid ADFH_Database_Valid
19+
#define ADF_Database_Set_Format ADFH_Database_Set_Format
20+
#define ADF_Database_Version ADFH_Database_Version
21+
#define ADF_Delete ADFH_Delete
22+
#define ADF_Error_Message ADFH_Error_Message
23+
#define ADF_Flush_to_Disk ADFH_Flush_to_Disk
24+
#define ADF_Get_Data_Type ADFH_Get_Data_Type
25+
#define ADF_Get_Dimension_Values ADFH_Get_Dimension_Values
26+
#define ADF_Get_Error_State ADFH_Get_Error_State
27+
#define ADF_Get_Label ADFH_Get_Label
28+
#define ADF_Get_Link_Path ADFH_Get_Link_Path
29+
#define ADF_Get_Name ADFH_Get_Name
30+
#define ADF_Get_Node_ID ADFH_Get_Node_ID
31+
#define ADF_Get_Number_of_Dimensions ADFH_Get_Number_of_Dimensions
32+
#define ADF_Get_Root_ID ADFH_Get_Root_ID
33+
#define ADF_Is_Link ADFH_Is_Link
34+
#define ADF_Library_Version ADFH_Library_Version
35+
#define ADF_Link ADFH_Link
36+
#define ADF_Move_Child ADFH_Move_Child
37+
#define ADF_Number_of_Children ADFH_Number_of_Children
38+
#define ADF_Put_Dimension_Information ADFH_Put_Dimension_Information
39+
#define ADF_Put_Name ADFH_Put_Name
40+
#define ADF_Read_All_Data ADFH_Read_All_Data
41+
#define ADF_Read_Block_Data ADFH_Read_Block_Data
42+
#define ADF_Read_Data ADFH_Read_Data
43+
#define ADF_Set_Error_State ADFH_Set_Error_State
44+
#define ADF_Set_Label ADFH_Set_Label
45+
#define ADF_Write_All_Data ADFH_Write_All_Data
46+
#define ADF_Write_Block_Data ADFH_Write_Block_Data
47+
#define ADF_Write_Data ADFH_Write_Data
48+
#define ADF_Release_ID ADFH_Release_ID
49+
50+
/* include ADFH.h */
51+
52+
#include "ADFH.h"
53+
54+
#endif

0 commit comments

Comments
 (0)