YAC
3.13.0
Yet Another Coupler
Loading...
Searching...
No Matches
test_read_cube_csv.c
Go to the documentation of this file.
1
// Copyright (c) 2024 The YAC Authors
2
//
3
// SPDX-License-Identifier: BSD-3-Clause
4
5
#include <stdlib.h>
6
#include <stdio.h>
7
#include <string.h>
8
9
#include "
tests.h
"
10
#include "
read_cube_csv_grid.h
"
11
#include "
grid2vtk.h
"
12
18
int
main(
int
argc,
char
** argv) {
19
20
if
(argc != 2) {
21
PUT_ERR
(
"ERROR: missing grid file directory"
);
22
return
TEST_EXIT_CODE
;
23
}
24
25
char
* grid_filename =
26
strcat(
27
strcpy(
28
malloc(strlen(argv[1]) + 32), argv[1]),
"cube_10x10.csv"
);
29
30
struct
yac_basic_grid_data
cube_grid =
31
yac_read_cube_csv_grid
(grid_filename);
32
33
free(grid_filename);
34
35
if
(cube_grid.
num_cells
!= 600)
36
PUT_ERR
(
"ERROR: wrong number of cells\n"
);
37
38
if
(cube_grid.
num_vertices
!= 602)
39
PUT_ERR
(
"ERROR: wrong number of grid vertices\n"
)
40
41
// #define WRITE_VTK_GRID_FILE
42
#ifdef WRITE_VTK_GRID_FILE
43
yac_write_basic_grid_data_to_file
(&cube_grid,
"cube"
);
44
#endif
// WRITE_VTK_GRID_FILE
45
46
yac_basic_grid_data_free
(cube_grid);
47
48
return
TEST_EXIT_CODE
;
49
}
yac_basic_grid_data_free
void yac_basic_grid_data_free(struct yac_basic_grid_data grid)
Definition
basic_grid_data.c:58
yac_write_basic_grid_data_to_file
void yac_write_basic_grid_data_to_file(struct yac_basic_grid_data *grid, char const *name)
Definition
grid2vtk.c:54
grid2vtk.h
yac_read_cube_csv_grid
struct yac_basic_grid_data yac_read_cube_csv_grid(char *filename)
Definition
read_cube_csv_grid.c:64
read_cube_csv_grid.h
yac_basic_grid_data
Definition
basic_grid_data.h:13
yac_basic_grid_data::num_cells
size_t num_cells
Definition
basic_grid_data.h:18
yac_basic_grid_data::num_vertices
size_t num_vertices
Definition
basic_grid_data.h:19
tests.h
TEST_EXIT_CODE
#define TEST_EXIT_CODE
Definition
tests.h:14
PUT_ERR
#define PUT_ERR(string)
Definition
tests.h:10
tests
utils
test_read_cube_csv.c
Generated on Tue Jan 13 2026 15:07:57 for YAC by
1.11.0