TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
TBNN.h
1/****************************************************************************
2* Copyright (c) 2023, 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#ifndef TBNN_included
16#define TBNN_included
17#include <keras_model.h>
18#include <PrePostNN.h>
19#include <string>
20#include <vector>
21
22class TBNN
23{
24public:
25 TBNN(string keras_model_file,string preproc_file);
26 ~TBNN();
27
28 std::vector<double> predict(std::vector<double> lambda, std::vector<std::vector<double>> T);
29
30private:
31
32// Neural network
33 KerasModel _model; // Neural network
34 std::vector<double> _g; // output of the Neural network
35 PrePostNN *_ppNN; // objet pre et post processing
36
37// Lambda pre-processing
38 std::vector<double> _plambda; // pre-processed lambda
39
40// T pre-processing
41 std::vector<std::vector<double>> _pT; // pre-processed T
42
43// b post-processing
44 std::vector<double> _pb; // result of the prediction not post-processed
45 std::vector<double> _b; // result of the prediction post-processed
46
47// process methods
48 void process_lambda(std::vector<double> lambda); // calculate the pre-processed lambda
49 void process_T(std::vector<std::vector<double>> T); // calculate the pre-processed T
50 void applyNN(); // prédiction du réseau de neurones
51 void process_b(); // calculate the post-processed b
52};
53
54#endif
~TBNN()
Definition TBNN.cpp:35
std::vector< double > predict(std::vector< double > lambda, std::vector< std::vector< double > > T)
Definition TBNN.cpp:40
TBNN(string keras_model_file, string preproc_file)
Definition TBNN.cpp:29