NeoPZ
TPZSandlerDimaggioTranslator.h
Go to the documentation of this file.
1 /*
2  * File: TPZSandlerDimaggioTranslator.h
3  * Author: thiago
4  *
5  * Created on 12 de Março de 2018, 19:25
6  */
7 
8 #ifndef TPZSANDLERDIMAGGIOTRANSLATOR_H
9 #define TPZSANDLERDIMAGGIOTRANSLATOR_H
10 
11 #include "TPZChunkInTranslation.h"
12 
13 template<typename SANDLERDIMAGGIOPARENTTRANSLATOR>
14 class TPZSandlerDimaggioTranslator : public SANDLERDIMAGGIOPARENTTRANSLATOR {
15 public:
17 
18  virtual void UpdateStream(TPZChunkInTranslation& chunk, const std::map<std::string, uint64_t>& toVersion);
19  virtual void UpdateAttributes(TPZChunkInTranslation& chunk, const std::map<std::string, uint64_t>& toVersion);
20 
23 private:
24  void UpdateFromV1(TPZChunkInTranslation &chunk, const std::map<std::string, uint64_t> &toVersion);
25  SANDLERDIMAGGIOPARENTTRANSLATOR parentTranslator;
26 };
27 
28 template<typename SANDLERDIMAGGIOPARENTTRANSLATOR>
30 }
31 
32 template<typename SANDLERDIMAGGIOPARENTTRANSLATOR>
34 }
35 
36 template<typename SANDLERDIMAGGIOPARENTTRANSLATOR>
37 void TPZSandlerDimaggioTranslator<SANDLERDIMAGGIOPARENTTRANSLATOR>::UpdateStream(TPZChunkInTranslation& chunk, const std::map<std::string, uint64_t>& toVersion) {
38  auto old_version = chunk.mOldVersion["NeoPZ"];
39  switch (old_version) {
40  case 1:
41  UpdateFromV1(chunk, toVersion);
42  break;
43  default:
44  UpdateAttributes(chunk, toVersion);
45  break;
46  }
47 }
48 
49 template<typename SANDLERDIMAGGIOPARENTTRANSLATOR>
50 void TPZSandlerDimaggioTranslator<SANDLERDIMAGGIOPARENTTRANSLATOR>::UpdateFromV1(TPZChunkInTranslation &chunk, const std::map<std::string, uint64_t> &toVersion) {
51  parentTranslator.UpdateStream(chunk, toVersion);
52  REAL fA, fB, fC, fD, fR, fW;
53 
54  chunk.mOldStream.Read(&fA);
55  chunk.mOldStream.Read(&fB);
56  chunk.mOldStream.Read(&fC);
57  chunk.mOldStream.Read(&fD);
58  chunk.mOldStream.Read(&fR);
59  chunk.mOldStream.Read(&fW);
60 
61  REAL fLambda;
62  chunk.mOldStream.Read(&fLambda);
63  REAL fMu;
64  chunk.mOldStream.Read(&fMu);
65 
66  REAL fResTol;
67  chunk.mOldStream.Read(&fResTol);
68  REAL fIntegrTol;
69  chunk.mOldStream.Read(&fIntegrTol);
70  int fMaxNewton;
71  chunk.mOldStream.Read(&fMaxNewton);
72  REAL fMinLambda;
73  chunk.mOldStream.Read(&fMinLambda);
74 
75  TPZManVector<REAL, 6> fEpsT_fData(6);
76  chunk.mOldStream.Read(fEpsT_fData);
77  TPZManVector<REAL, 6> fEpsP_fData(6);
78  chunk.mOldStream.Read(fEpsP_fData);
79  REAL m_hardening;
80  chunk.mOldStream.Read(&m_hardening);
81 }
82 
83 template<typename SANDLERDIMAGGIOPARENTTRANSLATOR>
85  parentTranslator.UpdateStream(chunk, toVersion);
86 }
87 
88 template<typename SANDLERDIMAGGIOPARENTTRANSLATOR>
90 }
91 
92 
93 
94 #endif /* TPZSANDLERDIMAGGIOTRANSLATOR_H */
95 
virtual void Read(int *p, int howMany=1)
std::map< std::string, uint64_t > mOldVersion
TPZContBufferedStream mOldStream
void UpdateFromV1(TPZChunkInTranslation &chunk, const std::map< std::string, uint64_t > &toVersion)
SANDLERDIMAGGIOPARENTTRANSLATOR parentTranslator
virtual void UpdateAttributes(TPZChunkInTranslation &chunk, const std::map< std::string, uint64_t > &toVersion)
virtual void UpdateStream(TPZChunkInTranslation &chunk, const std::map< std::string, uint64_t > &toVersion)