Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
DLR-AMR
GitHub Repository: DLR-AMR/t8code
Path: blob/main/src/t8_vtk.h
900 views
1
/*
2
This file is part of t8code.
3
t8code is a C library to manage a collection (a forest) of multiple
4
connected adaptive space-trees of general element classes in parallel.
5
6
Copyright (C) 2015 the developers
7
8
t8code is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
12
13
t8code is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with t8code; if not, write to the Free Software Foundation, Inc.,
20
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
*/
22
23
/** \file t8_vtk.h
24
* This header file collects macros that are needed for
25
* the forest and cmesh vtk routines.
26
* \see t8_forest_vtk.h \see t8_cmesh_vtk_writer.h \see t8_cmesh_vtk_reader.hxx
27
*/
28
29
#ifndef T8_VTK_H
30
#define T8_VTK_H
31
32
#include <t8.h>
33
34
/** typedef and macros */
35
#define T8_VTK_LOCIDX "Int32"
36
/** TODO: Paraview has troubles with Int64, so we switch to Int32 and be careful.
37
* Investigate this further. See also vtk macro VTK_USE_64BIT_IDS */
38
#define T8_VTK_GLOIDX "Int32"
39
40
/** TODO: these macros need to be set by configure. */
41
#ifndef T8_VTK_DOUBLES
42
#define T8_VTK_FLOAT_NAME "Float32" /**< Name of the floats used for vtk */
43
#define T8_VTK_FLOAT_TYPE float /**< Float type for vtk */
44
#else
45
#define T8_VTK_FLOAT_NAME "Float64"
46
#define T8_VTK_FLOAT_TYPE double
47
#endif
48
49
#define T8_VTK_FORMAT_STRING "ascii" /**< Format string for vtk */
50
51
#if T8_ENABLE_VTK
52
#define t8_vtk_locidx_array_type_t vtkTypeInt32Array /**< VTK array type for local indices */
53
#define t8_vtk_gloidx_array_type_t vtkTypeInt64Array /**< VTK array type for global indices */
54
#endif
55
56
/** TODO: Add support for integer data type. */
57
typedef enum {
58
T8_VTK_SCALAR, /**< One double value per element */
59
T8_VTK_VECTOR /**< 3 double values per element */
60
} t8_vtk_data_type_t;
61
62
/** A data field for VTK output.
63
* This struct is used to store data that is written to the VTK files.
64
* It contains the type of the data, a description, and the actual data array.
65
*/
66
typedef struct
67
{
68
t8_vtk_data_type_t type; /**< Describes of which type the data array is */
69
char description[BUFSIZ]; /**< String that describes the data. */
70
double *data;
71
/**< An array of length n*num_local_elements doubles with
72
n = 1 if type = T8_VTK_SCALAR, n = 3 if type = T8_VTK_VECTOR */
73
} t8_vtk_data_field_t;
74
75
T8_EXTERN_C_BEGIN ();
76
77
/* function declarations */
78
/** Writes the pvtu header file that links to the processor local files.
79
* It is used by the cmesh and forest vtk routines.
80
* This function should only be called by one process.
81
* Return 0 on success. */
82
/* TODO: document */
83
int
84
t8_write_pvtu (const char *filename, int num_procs, int write_tree, int write_rank, int write_level, int write_id,
85
int num_data, t8_vtk_data_field_t *data);
86
87
T8_EXTERN_C_END ();
88
89
#endif /* !T8_VTK_H */
90
91