NeoPZ
TPZElastoPlasticMemTranslator.cpp
Go to the documentation of this file.
1 /*
2  * File: TPZElastoPlasticMemTranslator.cpp
3  * Author: thiago
4  *
5  * Created on 12 de Março de 2018, 18:58
6  */
7 
9 #include "TPZTensor.h"
10 
12 }
13 
15 }
16 
17 void TPZElastoPlasticMemTranslator::UpdateStream(TPZChunkInTranslation& chunk, const std::map<std::string, uint64_t>& toVersion) {
18  auto old_version = chunk.mOldVersion["NeoPZ"];
19  switch (old_version) {
20  case 1:
21  UpdateFromV1(chunk, toVersion);
22  break;
23  default:
24  UpdateAttributes(chunk, toVersion);
25  break;
26  }
27 }
28 
29 void TPZElastoPlasticMemTranslator::UpdateFromV1(TPZChunkInTranslation &chunk, const std::map<std::string, uint64_t> &toVersion) {
30  TPZManVector<REAL, 6> m_sigma(6);
31  chunk.mOldStream.Read(&m_sigma[0],6);
32  chunk.mNewStream.Write(m_sigma);
33  TPZManVector<REAL, 6> m_eps_t(6);
34  chunk.mOldStream.Read(&m_eps_t[0],6);
35  chunk.mNewStream.Write(m_eps_t);
36  TPZManVector<REAL, 6> m_eps_p(6);
37  chunk.mOldStream.Read(&m_eps_p[0],6);
38  chunk.mNewStream.Write(m_eps_p);
39  REAL m_hardening;
40  chunk.mOldStream.Read(&m_hardening);
41  chunk.mNewStream.Write(&m_hardening);
42  int m_m_type = 1;
43  chunk.mNewStream.Write(&m_m_type);
44  int m_plastic_steps;
45  chunk.mOldStream.Read(&m_plastic_steps,1);
46  chunk.mNewStream.Write(&m_plastic_steps,1);
47  TPZManVector<REAL,3> m_u(3);
48  chunk.mOldStream.Read(&m_u[0],3);
49  chunk.mNewStream.Write(m_u);
50 }
51 
52 
53 void TPZElastoPlasticMemTranslator::UpdateAttributes(TPZChunkInTranslation& chunk, const std::map<std::string, uint64_t>& toVersion) {
54  tpzTensorTranslatorREAL.UpdateStream(chunk, toVersion); // m_sigma
55  tpzPlasticStateTranslatorREAL.UpdateStream(chunk, toVersion); // m_elastoplastic_state
56  int m_plastic_steps;
57  chunk.mOldStream.Read(&m_plastic_steps,1);
58  chunk.mNewStream.Write(&m_plastic_steps,1);
60  chunk.mOldStream.Read(m_u);
61  chunk.mNewStream.Write(m_u);
62 }
63 
65 }
66 
68  return classid;
69 }
70 
73 }
74 
virtual void Read(int *p, int howMany=1)
virtual void Write(const int *p, int howMany=1)
TPZTensorTranslator< REAL > tpzTensorTranslatorREAL
virtual void UpdateAttributes(TPZChunkInTranslation &chunk, const std::map< std::string, uint64_t > &toVersion) override
std::map< std::string, uint64_t > mOldVersion
void UpdateFromV1(TPZChunkInTranslation &chunk, const std::map< std::string, uint64_t > &toVersion)
virtual void UpdateStream(TPZChunkInTranslation &chunk, const std::map< std::string, uint64_t > &toVersion)
virtual void UpdateStream(TPZChunkInTranslation &chunk, const std::map< std::string, uint64_t > &toVersion) override
TPZContBufferedStream mOldStream
TPZPlasticStateTranslator< REAL > tpzPlasticStateTranslatorREAL
virtual void UpdateStream(TPZChunkInTranslation &chunk, const std::map< std::string, uint64_t > &toVersion)
TPZContBufferedStream mNewStream