waves
Basic FE playground
wTimeIntegration.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 University of Liège
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef WTIMEINTEGRATION_H
18 #define WTIMEINTEGRATION_H
19 
20 #include "waves.h"
21 #include "wObject.h"
22 #include "wTimer.h"
23 #include "wElement.h"
24 #include <iostream>
25 #include <vector>
26 #include <memory>
27 #include <Eigen/Sparse>
28 
29 namespace waves
30 {
31 
32 enum class Wgmsh
33 {
34  WG_NONE = 0,
35  WG_ONE = 1,
36  WG_ALL = 2
37 };
38 
43 class WAVES_API TimeIntegration : public fwk::wObject
44 {
45 public:
46  bool verbose;
47  std::shared_ptr<Problem> pbl;
48 #ifndef SWIG
50 #endif
51 
52  bool stopit;
53 
54  int nthreads;
56 
57  double ttot;
58  double dt;
59  int savefreq;
60 
61  fwk::Timer chrono1;
62 
63  std::vector<double> u1;
64  std::vector<double> v1;
65 
66  TimeIntegration(std::shared_ptr<waves::Problem> _pbl);
67 
68  virtual char const *clsname() const { return "TimeIntegration"; }
69 
70  virtual void start(tbox::MshExport *mshWriter);
71 
72  void dummyIC();
73 
74  void buildS(Eigen::SparseMatrix<double, Eigen::RowMajor> &S2);
75 
76  void buildKM(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, std::vector<double> &Md, std::vector<double> const &u);
77  void buildKM_tbb_lambda(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, std::vector<double> &Md, std::vector<double> const &u);
78 
79  void setGUI(DisplayHook &hook) { dhook = &hook; }
80 
81  //void build(tbox::MATTYPE type, Eigen::SparseMatrix<double, Eigen::RowMajor> &A2);
82 
83  void stop() { stopit = true; }
84 
85 #ifndef SWIG
86  virtual void write(std::ostream &out) const override;
87 #endif
88 };
89 
90 } // namespace waves
91 
92 #endif //WTIMEINTEGRATION_H
waves::TimeIntegration::v1
std::vector< double > v1
Definition: wTimeIntegration.h:64
waves::Wgmsh::WG_ALL
@ WG_ALL
write a separate file for each archived step
waves::TimeIntegration::chrono1
fwk::Timer chrono1
Definition: wTimeIntegration.h:61
waves::Wgmsh::WG_NONE
@ WG_NONE
do not write results on disk
waves::TimeIntegration::clsname
virtual const char * clsname() const
Definition: wTimeIntegration.h:68
waves::TimeIntegration::nthreads
int nthreads
nb of threads for the assembly
Definition: wTimeIntegration.h:54
WAVES_API
#define WAVES_API
Definition: waves.h:29
waves::TimeIntegration::dt
double dt
time step
Definition: wTimeIntegration.h:58
waves::TimeIntegration::ttot
double ttot
final time
Definition: wTimeIntegration.h:57
waves::TimeIntegration::stop
void stop()
Definition: wTimeIntegration.h:83
waves::TimeIntegration::wgmsh
Wgmsh wgmsh
how to write results on disk?
Definition: wTimeIntegration.h:55
waves::TimeIntegration::u1
std::vector< double > u1
Definition: wTimeIntegration.h:63
waves::TimeIntegration
Time integration base class.
Definition: wTimeIntegration.h:43
waves
Definition: waves.h:34
waves.h
waves::TimeIntegration::stopit
bool stopit
Definition: wTimeIntegration.h:52
waves::DisplayHook
quad element
Definition: wDisplayHook.h:31
waves::TimeIntegration::dhook
DisplayHook * dhook
Definition: wTimeIntegration.h:49
waves::TimeIntegration::savefreq
int savefreq
archive/update_gui frequency
Definition: wTimeIntegration.h:59
waves::Wgmsh::WG_ONE
@ WG_ONE
continuously overwrite the same result file (onelab)
waves::TimeIntegration::pbl
std::shared_ptr< Problem > pbl
Definition: wTimeIntegration.h:47
waves::Wgmsh
Wgmsh
Definition: wTimeIntegration.h:32
waves::TimeIntegration::verbose
bool verbose
Definition: wTimeIntegration.h:46
waves::TimeIntegration::setGUI
void setGUI(DisplayHook &hook)
Definition: wTimeIntegration.h:79