1 /*============================================================================
2 * Définitions des fonctions de base
3 * réalisant les sorties pour post-traitement
4 *============================================================================*/
5
6 /*
7 This file is part of Code_Saturne, a general-purpose CFD tool.
8
9 Copyright (C) 1998-2021 EDF S.A.
10
11 This program is free software; you can redistribute it and/or modify it under
12 the terms of the GNU General Public License as published by the Free Software
13 Foundation; either version 2 of the License, or (at your option) any later
14 version.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 details.
20
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
23 Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 */
25
26 /*----------------------------------------------------------------------------*/
27
28 /*============================================================================
29 * Visibilité
30 *============================================================================*/
31
32 #include "cs_config.h"
33
34
35 /*----------------------------------------------------------------------------
36 * Fichiers `include' librairie standard C
37 *----------------------------------------------------------------------------*/
38
39 #include <assert.h>
40 #include <string.h>
41
42
43 /*----------------------------------------------------------------------------
44 * Fichiers `include' visibles du paquetage global "Utilitaire"
45 *----------------------------------------------------------------------------*/
46
47 #include "ecs_def.h"
48 #include "ecs_mem.h"
49
50
51 /*----------------------------------------------------------------------------
52 * Fichier `include' du paquetage courant associe au fichier courant
53 *----------------------------------------------------------------------------*/
54
55 #include "ecs_post.h"
56 #include "ecs_post_ens.h"
57 #include "ecs_post_cgns.h"
58 #include "ecs_post_med.h"
59
60
61 /*============================================================================
62 * Fonctions privées
63 *============================================================================*/
64
65 /*============================================================================
66 * Fonctions publiques
67 *============================================================================*/
68
69 /*----------------------------------------------------------------------------
70 * Fonction initialisant une structure `ecs_post_t`
71 *----------------------------------------------------------------------------*/
72
73 ecs_post_t *
ecs_post__cree_cas(const char * nom_cas)74 ecs_post__cree_cas(const char *nom_cas)
75 {
76 ecs_post_t *cas;
77
78 /*xxxxxxxxxxxxxxxxxxxxxxxxxxx Instructions xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
79
80 assert(nom_cas != NULL);
81
82 ECS_MALLOC(cas, 1, ecs_post_t);
83
84 ECS_MALLOC(cas->nom_cas, strlen(nom_cas) + 1, char);
85 strcpy(cas->nom_cas, nom_cas);
86
87 cas->cas_ens = NULL;
88 cas->opt_ens[ECS_POST_TYPE_VOLUME] = false;
89 cas->opt_ens[ECS_POST_TYPE_ERREUR] = false;
90
91 #if defined(HAVE_CGNS)
92
93 cas->cas_cgns = NULL;
94 cas->opt_cgns[ECS_POST_TYPE_VOLUME] = false;
95 cas->opt_cgns[ECS_POST_TYPE_ERREUR] = false;
96
97 #endif /* HAVE_CGNS */
98
99 #if defined(HAVE_MED)
100
101 cas->cas_med = NULL;
102 cas->opt_med[ECS_POST_TYPE_VOLUME] = false;
103 cas->opt_med[ECS_POST_TYPE_ERREUR] = false;
104
105 #endif /* HAVE_MED */
106
107 return cas;
108 }
109
110 /*----------------------------------------------------------------------------
111 * Fonction détruisant une structure `ecs_post_t`
112 *----------------------------------------------------------------------------*/
113
114 ecs_post_t *
ecs_post__detruit_cas(ecs_post_t * cas)115 ecs_post__detruit_cas(ecs_post_t *cas)
116 {
117 /*xxxxxxxxxxxxxxxxxxxxxxxxxxx Instructions xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
118
119 if (cas == NULL)
120 return NULL;
121
122 if (cas->cas_ens != NULL)
123 ecs_post_ens__detruit_cas(cas->cas_ens);
124
125 #if defined(HAVE_CGNS)
126
127 if (cas->cas_cgns != NULL)
128 ecs_post_cgns__detruit_cas(cas->cas_cgns);
129
130 #endif
131
132 #if defined(HAVE_MED)
133
134 if (cas->cas_med != NULL)
135 ecs_post_med__detruit_cas(cas->cas_med);
136
137 #endif
138
139 ECS_FREE(cas->nom_cas);
140
141 ECS_FREE(cas);
142
143 return NULL;
144 }
145
146 /*----------------------------------------------------------------------------*/
147
148
149