TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Champ_Fonc_MED_Tabule.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <Champ_Fonc_MED_Tabule.h>
17
18Implemente_instanciable( Champ_Fonc_MED_Tabule, "Champ_Fonc_MED_Tabule", Champ_Fonc_MED );
19// XD Champ_Fonc_MED_Tabule champ_fonc_med Champ_Fonc_MED_Tabule INHERITS_BRACE not_set
21{
23 return os;
24}
25
27{
29 return is;
30}
31
33{
34
35 // temps1_ temps2_ tel que temps [temps1_ , temps2_[
36 if (est_egal(le_temps, temps_calc_))
37 return;
38
39 if ((temps2_ < -1e8) || (le_temps <= temps_calc_))
40 {
41 // initialisation de -1e9 a T[0] on met la meme chose
42 lire(temps_sauv_[0]);
43 tab1_ = valeurs();
44 tab2_ = valeurs();
46 }
47 if (le_temps >= temps2_)
48 {
49 int i, nbt = temps_sauv_.size_array();
50 int trouve = 0;
51 for (i = 0; i < nbt - 1; i++)
52 {
53 if ((le_temps >= temps_sauv_[i]) && (le_temps <= temps_sauv_[i + 1]))
54 {
55 trouve = 1;
58 tab1_ = valeurs();
59 temps2_ = temps_sauv_[i + 1];
61 tab2_ = valeurs();
62 }
63 }
64 if (trouve == 0)
65 {
66 temps1_ = temps_sauv_[nbt - 1];
67 assert(le_temps >= temps_sauv_[nbt - 1]);
69 tab1_ = valeurs();
70 tab2_ = tab1_;
71 temps2_ = DMAXFLOAT;
72 }
73 else
75 }
76
77 if ((le_temps >= temps1_) && (le_temps < temps2_))
78 {
79 valeurs() = tab2_;
80 valeurs() -= tab1_;
81 valeurs() *= (le_temps - temps1_) / (temps2_ - temps1_);
82 valeurs() += tab1_;
83 temps_calc_ = le_temps;
84 // Cerr<<temps_calc_<<" YYYYYY "<<valeurs()[0]<<" "<< tab2_[0]<< " "<<tab1_[0]<<finl;
85 }
86 else
87 {
88 Cerr << "internal error" << finl;
89 exit();
90 }
91
92}
virtual void set_instationnaire(bool flag)
: class Champ_Fonc_MED_Tabule
void mettre_a_jour(double temps) override
Mise a jour en temps du champ.
classe Champ_Fonc_MED Load a field from a MED file for a given time.
virtual void lire(double tps, int given_iteration=-1)
ArrOfDouble temps_sauv_
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
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