ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/microstructure/src/mstruct_analyse.cpp
Revision: 968
Committed: Sun Sep 16 15:27:49 2018 UTC (6 years, 7 months ago) by couturad
File size: 5003 byte(s)
Log Message:
Ajout d'une condition de sortie et d'un renvoi d'erreur pour le mailleur FEM.
Subdivision des fichiers mstruct_analyse.h/.cpp en sous fichiers pour une meilleure lisibilite.
Ajout d'une analyse des modules d'elasticite.
Ajout d'une analyse de l'energie.
Reconfiguration du main de microstructure.exe (suppression d'actions obsolètes).
Reconfiguration des fichiers generer_nb_ves, post_process.

File Contents

# User Rev Content
1 couturad 919 #include "mstruct_analyse.h"
2 couturad 968 #include "ot_boite_3d.h"
3 couturad 926 MSTRUCT_ANALYSE::MSTRUCT_ANALYSE(void)
4 couturad 919 {
5 couturad 968 m_ves=NULL;
6 couturad 926 m_identifiant="";
7     m_boite_analyse=NULL;
8     m_nom_groupe_forme="";
9 couturad 919 }
10    
11 couturad 968 MSTRUCT_ANALYSE::MSTRUCT_ANALYSE(std::string identifiant, std::string nom_groupe_forme, BOITE_3D* boite_3d)
12 couturad 919 {
13 couturad 968 m_ves=NULL;
14 couturad 926 m_identifiant=identifiant;
15     if(boite_3d!=NULL) m_boite_analyse=new BOITE_3D(*boite_3d);
16     else m_boite_analyse=NULL;
17 couturad 968 m_nom_groupe_forme=nom_groupe_forme;
18 couturad 919 }
19    
20 couturad 968 MSTRUCT_ANALYSE::MSTRUCT_ANALYSE(MSTRUCT_VES* ves,std::string identifiant, std::string nom_groupe_forme, BOITE_3D* boite_3d)
21 couturad 919 {
22 couturad 968 m_ves=ves;
23     m_identifiant=identifiant;
24     if(boite_3d!=NULL) m_boite_analyse=new BOITE_3D(*boite_3d);
25     else m_boite_analyse=NULL;
26     m_nom_groupe_forme=nom_groupe_forme;
27     }
28    
29     MSTRUCT_ANALYSE::MSTRUCT_ANALYSE(MSTRUCT_ANALYSE& mdd,bool cpy_data)
30     {
31     m_ves=mdd.m_ves;
32 couturad 926 m_identifiant=mdd.m_identifiant;
33     if(mdd.m_boite_analyse!=NULL) m_boite_analyse=new BOITE_3D(*mdd.m_boite_analyse);
34     else m_boite_analyse=NULL;
35     m_nom_groupe_forme=mdd.m_nom_groupe_forme;
36 couturad 919 }
37    
38 couturad 926 MSTRUCT_ANALYSE::~MSTRUCT_ANALYSE(void)
39 couturad 919 {
40 couturad 926 if(m_boite_analyse!=NULL) delete m_boite_analyse;
41     }
42    
43 couturad 968 MSTRUCT_VES * MSTRUCT_ANALYSE::get_ves()
44     {
45     return m_ves;
46     }
47    
48 couturad 951 void MSTRUCT_ANALYSE::change_identifiant(std::string identifiant)
49 couturad 926 {
50 couturad 919 m_identifiant=identifiant;
51     }
52    
53 couturad 951 std::string MSTRUCT_ANALYSE::get_identifiant(void)
54 couturad 919 {
55 couturad 926 return m_identifiant;
56 couturad 919 }
57    
58 couturad 926 void MSTRUCT_ANALYSE::change_boite_analyse(BOITE_3D boite_3d)
59 couturad 919 {
60 couturad 926 delete m_boite_analyse;
61     m_boite_analyse=new BOITE_3D(boite_3d);
62 couturad 919 }
63    
64 couturad 926 BOITE_3D* MSTRUCT_ANALYSE::get_boite_analyse(void)
65 couturad 919 {
66     return m_boite_analyse;
67     }
68    
69 couturad 951 void MSTRUCT_ANALYSE::change_nom_groupe_forme(std::string nom_groupe_forme)
70 couturad 919 {
71 couturad 926 m_nom_groupe_forme=nom_groupe_forme;
72 couturad 919 }
73    
74 couturad 951 std::string MSTRUCT_ANALYSE::get_nom_groupe_forme(void)
75 couturad 919 {
76 couturad 926 return m_nom_groupe_forme;
77 couturad 919 }
78    
79 couturad 951 void MSTRUCT_ANALYSE::enregistrer(std::ofstream& ofstrm)
80 couturad 926 {
81     size_t len_identifiant = m_identifiant.size();
82     ofstrm.write((char*)&len_identifiant,sizeof(size_t));
83     ofstrm.write(m_identifiant.c_str(),m_identifiant.size());
84 couturad 919
85 couturad 926 size_t len_nom_groupe_forme = m_nom_groupe_forme.size();
86     ofstrm.write((char*)&len_nom_groupe_forme,sizeof(size_t));
87     ofstrm.write(m_nom_groupe_forme.c_str(),m_nom_groupe_forme.size());
88    
89     bool avec_boite;
90     if(m_boite_analyse==NULL) avec_boite=false;
91     else avec_boite=true;
92     ofstrm.write((char*)&avec_boite,sizeof(bool));
93     if(avec_boite)
94     {
95     double xmin=m_boite_analyse->get_xmin();
96     ofstrm.write((char*)&xmin,sizeof(double));
97     double ymin=m_boite_analyse->get_ymin();
98     ofstrm.write((char*)&ymin,sizeof(double));
99     double zmin=m_boite_analyse->get_zmin();
100     ofstrm.write((char*)&zmin,sizeof(double));
101     double xmax=m_boite_analyse->get_xmax();
102     ofstrm.write((char*)&xmax,sizeof(double));
103     double ymax=m_boite_analyse->get_ymax();
104     ofstrm.write((char*)&ymax,sizeof(double));
105     double zmax=m_boite_analyse->get_zmax();
106     ofstrm.write((char*)&zmax,sizeof(double));
107     }
108 couturad 919 }
109 couturad 926
110 couturad 951 void MSTRUCT_ANALYSE::ouvrir(std::ifstream& ifstrm)
111 couturad 926 {
112     size_t len_identifiant;
113     ifstrm.read((char*)&len_identifiant,sizeof(size_t));
114     char *temp_identifiant = new char[len_identifiant+1];
115     ifstrm.read(temp_identifiant,len_identifiant);
116     temp_identifiant[len_identifiant]='\0';
117     m_identifiant=temp_identifiant;
118     delete [] temp_identifiant;
119    
120     size_t len_nom_groupe_forme;
121     ifstrm.read((char*)&len_nom_groupe_forme,sizeof(size_t));
122     char *temp_nom_groupe_forme = new char[len_nom_groupe_forme+1];
123     ifstrm.read(temp_nom_groupe_forme,len_nom_groupe_forme);
124     temp_nom_groupe_forme[len_nom_groupe_forme]='\0';
125     m_nom_groupe_forme=temp_nom_groupe_forme;
126     delete [] temp_nom_groupe_forme;
127    
128     bool avec_boite;
129     ifstrm.read((char*)&avec_boite,sizeof(bool));
130    
131     if(avec_boite)
132     {
133     double xmin;
134     ifstrm.read((char*)&xmin,sizeof(double));
135     double ymin;
136     ifstrm.read((char*)&ymin,sizeof(double));
137     double zmin;
138     ifstrm.read((char*)&zmin,sizeof(double));
139     double xmax;
140     ifstrm.read((char*)&xmax,sizeof(double));
141     double ymax;
142     ifstrm.read((char*)&ymax,sizeof(double));
143     double zmax;
144     ifstrm.read((char*)&zmax,sizeof(double));
145     m_boite_analyse = new BOITE_3D(xmin,ymin,zmin,xmax,ymax,zmax);
146     }
147     else m_boite_analyse=NULL;
148     }
149    
150 couturad 951 void MSTRUCT_ANALYSE::affiche_contenu(fonction_affiche* fonc)
151 couturad 926 {
152     char ligne[5000];
153     sprintf(ligne,"MSTRUCT_ANALYSE");
154     fonc(ligne);
155     sprintf(ligne,"-> Identifiant : %s", m_identifiant.c_str());
156     fonc(ligne);
157     if(m_boite_analyse!=NULL) sprintf(ligne,"-> Boite_3D : [%lf,%lf,%lf,%lf,%lf,%lf]", m_boite_analyse->get_xmin(),
158     m_boite_analyse->get_ymin(),
159     m_boite_analyse->get_zmin(),
160     m_boite_analyse->get_xmax(),
161     m_boite_analyse->get_ymax(),
162     m_boite_analyse->get_zmax());
163     else sprintf(ligne,"-> Boite_3D : NULL");
164     fonc(ligne);
165     if(m_nom_groupe_forme!="") sprintf(ligne,"-> MG_CG_GROUPE_FORME : %s",m_nom_groupe_forme.c_str());
166     else sprintf(ligne,"-> MG_CG_GROUPE_FORME : NULL");
167     fonc(ligne);
168    
169     }