TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Option_CGNS.cpp
1/****************************************************************************
2* Copyright (c) 2026, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <Option_CGNS.h>
17#include <Param.h>
18
19Implemente_instanciable(Option_CGNS, "Option_CGNS", Interprete);
20// XD Option_CGNS interprete Option_CGNS BRACE Class for CGNS options.
21
22bool Option_CGNS::PARALLEL_OVER_ZONE = false; /* NOT BY DEFAULT */
23bool Option_CGNS::USE_LINKS = false; /* NOT BY DEFAULT */
24bool Option_CGNS::LINKED_FILES_PER_COMM_GROUP = false; /* NOT BY DEFAULT */
25bool Option_CGNS::SINGLE_FILE_PER_COMM_GROUP = false; /* NOT BY DEFAULT */
26bool Option_CGNS::KEEP_FILES_BEFORE_RESET_TIME = false; /* NOT BY DEFAULT */
27int Option_CGNS::CLOSE_EVERY_N = -1; /* -1 BY DEFAULT => never opened/closed */
28int Option_CGNS::FLUSH_EVERY_N = 1; /* 1 BY DEFAULT => flush each dt post */
29
30Sortie& Option_CGNS::printOn(Sortie& os) const { return Interprete::printOn(os); }
32
34{
35 Param param(que_suis_je());
36 param.ajouter_flag("PARALLEL_OVER_ZONE", &PARALLEL_OVER_ZONE); // XD_ADD_P rien
37 // XD_CONT If used, data will be written in separate zones (ie: one zone per processor). This is not so performant but
38 // XD_CONT easier to read later ...
39 param.ajouter_flag("USE_LINKS", &USE_LINKS); // XD_ADD_P rien
40 // XD_CONT If used, data will be written in separate files; one file for mesh, and then one file for solution time.
41 // XD_CONT Links will be used.
42 param.ajouter_flag("LINKED_FILES_PER_COMM_GROUP", &LINKED_FILES_PER_COMM_GROUP); // XD_ADD_P rien
43 // XD_CONT If used, data will be written (at each comm group) in separate files; one file for mesh, and then one file
44 // XD_CONT for solution time. Links will be used.
45 param.ajouter_flag("SINGLE_FILE_PER_COMM_GROUP", &SINGLE_FILE_PER_COMM_GROUP); // XD_ADD_P rien
46 // XD_CONT If used, data will be written (at each comm group) in a single file.
47 param.ajouter_flag("KEEP_FILES_BEFORE_RESET_TIME", &KEEP_FILES_BEFORE_RESET_TIME); // XD_ADD_P rien
48 // XD_CONT If used with resetTime, CGNS files will be kept. Otherwise the files are overwritten.
49 param.ajouter("CLOSE_EVERY_N", &CLOSE_EVERY_N); // XD_ADD_P entier
50 // XD_CONT Used to fix the opening/closing frequency when writing in a single CGNS file (choice by defaut).
51 param.ajouter("FLUSH_EVERY_N", &FLUSH_EVERY_N); // XD_ADD_P entier
52 // XD_CONT Used to fix the flush-to-disc frequency when writing in a single CGNS file (choice by defaut).
54
55 const bool single_file = (!USE_LINKS && !LINKED_FILES_PER_COMM_GROUP);
56
57 if ((PARALLEL_OVER_ZONE || SINGLE_FILE_PER_COMM_GROUP) && !single_file)
58 {
59 Cerr << finl << "Error in Option_CGNS :" << finl;
60 Cerr << " You can not activate the option 'PARALLEL_OVER_ZONE' and/or 'SINGLE_FILE_PER_COMM_GROUP' with 'USE_LINKS' and/or 'LINKED_FILES_PER_COMM_GROUP' !!!" << finl;
61 Cerr << " The default CGNS post behavior is a single file for all times/fields." << finl;
62 Cerr << " PARALLEL_OVER_ZONE and/or SINGLE_FILE_PER_COMM_GROUP options remain in this context; ie: single file." << finl;
63 Cerr << " USE_LINKS and/or LINKED_FILES_PER_COMM_GROUP options require several linked files." << finl;
64 Cerr << " See the doc for more details or contact the TRUST support ... " << finl << finl;
66 }
67
68 Cerr << finl << "*********************************" << finl;
69 Cerr << "********** Option_CGNS **********" << finl;
70 Cerr << "*********************************" << finl << finl;
71
72 if (single_file)
73 {
74 if (FLUSH_EVERY_N > 0)
75 Cerr << " Data will be flushed into a single CGNS file each " << FLUSH_EVERY_N << " time post ..." << finl;
76
77 if (CLOSE_EVERY_N > 0)
78 Cerr << " A single CGNS file will be closed and opened each " << CLOSE_EVERY_N << " time post ..." << finl;
79
81 Cerr << " PARALLEL_OVER_ZONE => CGNS data will be written in separate zones ..." << finl;
82
84 Cerr << " SINGLE_FILE_PER_COMM_GROUP => A single CGNS file will be written in each COMM group ... ..." << finl;
85 }
86 else
87 {
89 {
90 USE_LINKS = true;
91 Cerr << " LINKED_FILES_PER_COMM_GROUP => Several linked CGNS files will be written in each COMM group ..." << finl;
92 Cerr << " This will activate also the option USE_LINKS ..." << finl;
93 }
94
95 if (USE_LINKS)
96 Cerr << " USE_LINKS => CGNS data will be written in separate files (mesh, solution ...)" << finl;
97 }
98
99 Cerr << finl << "*********************************" << finl << finl;
100
101 return is;
102}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe de base des objets "interprete".
Definition Interprete.h:38
friend class Entree
Definition Objet_U.h:76
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Global CGNS post-processing options.
Definition Option_CGNS.h:42
static bool KEEP_FILES_BEFORE_RESET_TIME
Definition Option_CGNS.h:55
Entree & interpreter(Entree &) override
static bool LINKED_FILES_PER_COMM_GROUP
Definition Option_CGNS.h:52
static bool PARALLEL_OVER_ZONE
Definition Option_CGNS.h:48
static int CLOSE_EVERY_N
Definition Option_CGNS.h:49
static bool SINGLE_FILE_PER_COMM_GROUP
Definition Option_CGNS.h:48
static bool USE_LINKS
Definition Option_CGNS.h:52
static int FLUSH_EVERY_N
Definition Option_CGNS.h:49
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
Definition Param.cpp:474
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
Definition Param.cpp:32
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52