TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
SourceFiltree_FT_disc_base.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 <SourceFiltree_FT_disc_base.h>
17#include <Parser.h>
18#include <Transport_Interfaces_FT_Disc.h>
19#include <algorithm>
20
28{
29 int i;
30 for (i=0 ; i<2*dimension_ ; i++)
31 {
32 delete fI_xyz_t[i];
33 }
34 delete[] fI_xyz_t;
35}
36
38{
39 int i;
40 os<<"phase 0 : Fonctions : { "<<finl;
41 for (i=0 ; i<dimension_ ; i++)
42 {
43 os << (fI_xyz_t[i]->getString()).c_str() ;
44 if (i<dimension_-1)
45 {
46 os << " , ";
47 }
48 }
49 os << " } "<<finl;
50 os<<"phase 1 : Fonctions : { "<<finl;
51 for (i=0 ; i<dimension_ ; i++)
52 {
53 os << (fI_xyz_t[dimension_+i]->getString()).c_str() ;
54 if (i<dimension_-1)
55 {
56 os << " , ";
57 }
58 }
59 os << " } "<<finl;
60
61 return os;
62}
63/*! @brief Lit les parametres du terme source a partir d'un flot d'entree.
64 *
65 * @param (Entree& is) un flot d'entree
66 */
68{
69 Motcle accolade_ouverte("{");
70 Motcle accolade_fermee("}");
71 Motcle motlu;
72 Motcles les_motcles(3);
73 {
74 les_motcles[0] = "phase0";
75 les_motcles[1] = "phase1";
76 les_motcles[2] = "equation_transport";
77 }
78
79 is >> motlu;
80 if (motlu != accolade_ouverte)
81 {
82 Cerr << "Erreur a la lecture des parametres de lire_donnees " << finl;
84 }
85 is >> motlu;
86 Nom tmp;
87 fI_xyz_t = new Parser*[2*dimension_];
88 int i, ph0_lu,ph1_lu;
89 ph0_lu = ph1_lu = 0;
90 while (motlu != accolade_fermee)
91 {
92 int rang = les_motcles.search(motlu);
93 switch(rang)
94 {
95 case 0 :
96 {
97 is >> motlu;
98 ph0_lu = 1;
99 assert(motlu==accolade_ouverte);
100 for (i=0 ; i<dimension_ ; i++)
101 {
102 is >> tmp;
103 const char *s = tmp.getChar();
104 std::string ss(s);
105 std::transform(ss.begin(), ss.end(), ss.begin(), ::toupper);
106 fI_xyz_t[i] = new Parser(ss,4);
107 fI_xyz_t[i]->addVar("x");
108 fI_xyz_t[i]->addVar("y");
109 fI_xyz_t[i]->addVar("z");
110 fI_xyz_t[i]->addVar("t");
111 fI_xyz_t[i]->parseString();
112 Cerr<<"lecture phase0["<<i<<"] : "<<(fI_xyz_t[i]->getString()).c_str()<<finl;
113 }
114 is >> motlu;
115 assert(motlu==accolade_fermee);
116 break;
117 }
118 case 1 :
119 {
120 is >> motlu;
121 ph1_lu = 1;
122 assert(motlu==accolade_ouverte);
123 for (i=0 ; i<dimension_ ; i++)
124 {
125 is >> tmp;
126 const char *s = tmp.getChar();
127 std::string ss(s);
128 std::transform(ss.begin(), ss.end(), ss.begin(), ::toupper);
129 fI_xyz_t[dimension_+i] = new Parser(ss,4);
130 fI_xyz_t[dimension_+i]->addVar("x");
131 fI_xyz_t[dimension_+i]->addVar("y");
132 fI_xyz_t[dimension_+i]->addVar("z");
133 fI_xyz_t[dimension_+i]->addVar("t");
134 fI_xyz_t[dimension_+i]->parseString();
135 Cerr<<"lecture phase1["<<dimension_+i<<"] : "<<(fI_xyz_t[dimension_+i]->getString()).c_str()<<finl;
136 }
137 is >> motlu;
138 assert(motlu==accolade_fermee);
139 break;
140 }
141 case 2:
142 {
143 is >> nom_eq_transport_;
145 Cerr << "Equation de transport pour SourceFiltree_FT_Disc : " << nom_eq_transport_ << finl;
146 break;
147 }
148 default :
149 {
150 Cerr << "Erreur a la lecture des parametres de SourceFiltree_FT_disc " << finl;
151 Cerr << "On attendait les " << les_motcles << "ou } a la place de " << motlu << finl;
153 }
154 }
155 is >> motlu;
156 }
157 assert(motlu==accolade_fermee);
158 if (ph0_lu==0)
159 {
160 for (i=0 ; i<dimension_ ; i++)
161 {
162 is >> tmp;
163 std::string ss("");
164 fI_xyz_t[i] = new Parser(ss,4);
165 fI_xyz_t[i]->addVar("x");
166 fI_xyz_t[i]->addVar("y");
167 fI_xyz_t[i]->addVar("z");
168 fI_xyz_t[i]->addVar("t");
169 fI_xyz_t[i]->parseString();
170 }
171 }
172 if (ph1_lu==0)
173 {
174 for (i=0 ; i<dimension_ ; i++)
175 {
176 is >> tmp;
177 std::string ss("0");
178 fI_xyz_t[dimension_+i] = new Parser(ss,4);
179 fI_xyz_t[dimension_+i]->addVar("x");
180 fI_xyz_t[dimension_+i]->addVar("y");
181 fI_xyz_t[dimension_+i]->addVar("z");
182 fI_xyz_t[dimension_+i]->addVar("t");
183 fI_xyz_t[dimension_+i]->parseString();
184 }
185 }
186
187 ecrire_donnees(Cerr);
188
189 return is;
190}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
Un tableau d'objets de la classe Motcle.
Definition Motcle.h:63
int search(const Motcle &t) const
Definition Motcle.cpp:321
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const char * getChar() const
Definition Nom.h:91
static int dimension
Definition Objet_U.h:99
Representation des donnees de la classe Parser.
Definition Parser.h:39
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
Classe de base des flux de sortie.
Definition Sortie.h:52
Sortie & ecrire_donnees(Sortie &) const
Entree & lire_donnees(Entree &)
Lit les parametres du terme source a partir d'un flot d'entree.