MIDAS  0.75
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
module_meer.cpp
Go to the documentation of this file.
1 #include "module_meer.h"
2 #include "geometry.h"
3 #include "cell.h"
4 #include "point.h"
5 
6 
7 #ifdef __MEER_MODULE
8 
9 namespace midaspace {
10 
12 MEER_interface :: MEER_interface (void) : MEER ()
13 {
14  istep = 0;
15  mesh = NULL;
16 }
17 
19 MEER_interface :: ~MEER_interface ()
20 {
21  mesh = NULL;
22 }
23 
25 void MEER_interface :: local_initialize (Mesh *geom) //, long istep)
26 {
27  // implementacne zavisle promenne
28  mesh = geom; // trida s celou geometrii
29  ((Mesh*)mesh)->regions_init(); // tato fce nastavi hodnotu regid na vsech elementech
30 }
31 
32 
34 void MEER_interface :: initialize (void)
35 {
36  long i, regid, nvals;
37  int j;
38  SPRpatchType sprtype;
39  const FElement *felem;
41 
42 
43  //* *** charakteristiky ulohy ***
44 
45  //* GLOBAL VARIABLES
46  switch (mesh->give_Pd()->give_adpa()->give_norm()) {
47  case 1: enorm = MEER_EN_strain_stress; rte = RTE_global_stress; break;
48  case 2: enorm = MEER_EN_stress_stress; rte = RTE_global_stress; break;
49  default: _errorr ("Unknown norm");
50  }
51  SPR_boundary = (MEER_SPRboundaryPatchType)mesh->give_Pd()->give_adpa()->give_SPRboudary();
52 
53  //* NODES
54  this->set_alloc_NODEs(mesh->give_Npts());
55 
56  for (i=0; i<nNODEs; i++) {
57  NODEs[i].coords.copy(mesh->give_Pjnt(i)->give_coords());
58  }
59 
60  //* ELEMENTS
61  this->set_alloc_ELEMs(mesh->give_Nels());
62 
63  for (i=0; i<nELEMs; i++) {
64  felem = mesh->give_FElem(i);
65 
66  ELEMs[i].regid = felem->give_regid();
67  ELEMs[i].nnodes = felem->give_nno();
68  ELEMs[i].nodes = new long[ELEMs[i].nnodes];
69 
70  for (j=0; j<ELEMs[i].nnodes; j++)
71  ELEMs[i].nodes[j] = felem->give_point(j)->give_ID();
72 
73  // int. points
74  IntPointSet ips = this->give_IPset1(i);
75 
76  ELEMs[i].nIPs1 = IntPointSet_give_number_ips(ips);
77  ELEMs[i].IPs1_coords = new PoinT[ELEMs[i].nIPs1];
78 
79  for (j=0; j<ELEMs[i].nIPs1; j++)
80  felem->give_ip_coords_global (ips, j, ELEMs[i].IPs1_coords[j]);
81  }
82 
83  //* REGIONS
84  this->set_alloc_REGIONs(mesh->give_nRegions());
85 
86  for (i=0; i<nELEMs; i++) {
87  regid = ELEMs[i].regid;
88  felem = mesh->give_FElem(i);
89 
90  nvals = felem->give_result_ncomp(istep, rte); // pocet hodnot typu rte(napr. stress) na elementu
91  sprtype = felem->give_spr_patch_type(); // typ prokladaneho polygonu
92 
93  if (REGIONs[regid].sprtype) {
94  if (REGIONs[regid].nvals != nvals ) _errorr("Inconsistent region");
95  if (REGIONs[regid].sprtype != sprtype) _errorr("Inconsistent region");
96  }
97  else {
98  REGIONs[regid].nvals = nvals;
99  REGIONs[regid].sprtype = sprtype;
100  }
101  }
102 
103  //for (i=0; i<nRegions; i++) {
104  // if (region_nvals [i] <= 0) _errorr("Inconsistent region");
105  // if (region_sprtype[i] == 0) _errorr("Inconsistent region");
106  //}
107 
108 }
109 
110 
115 IntPointSet MEER_interface :: give_IPset1 (long elementID) const
116 {
117  return mesh->give_FElem(elementID)->give_IPset_rslts(mesh->give_rslts_solver());
118 }
120 IntPointSet MEER_interface :: give_IPset2 (long elementID) const
121 {
122  return this->give_IPset1(elementID);
123 }
124 
129 void MEER_interface :: give_superelems_to_node (long nodeID, long &nsuperelems, long *superelems) const
130 {
131  const GPA<const Element>* superlms = mesh->give_Pjnt(nodeID)->give_superelems();
132 
133  nsuperelems = superlms->give_size();
134 
135  for (long i=0; i<nsuperelems; i++)
136  superelems[i] = (*superlms)[i]->give_ID();
137 
138 }
139 
140 // /// compute global coordinates of nodeID-th node
141 // void MEER_interface :: give_node_coords (long nodeID, double *coords) const
142 // {
143 // const PoinT *coo;
144 // coo = mesh->give_Pjnt(nodeID)->give_coords();
145 // coo->copy_to(coords);
146 // }
147 
148 
150 MEER_ElemDisplInterpol MEER_interface :: give_element_EDI (long elementID) const
151 {
152  IntPointSet ips2 = this->give_IPset2(elementID);
153  MEER_ElemDisplInterpol edi;
154 
158  switch (ips2) {
159  case IPS_2D_3v_4ip:
160  case IPS_2D_3v_3ip:
161  case IPS_2D_3v_1ip: edi = MEER_EDI_2d_3n_linear; break;
162  case IPS_2D_4v_4ip: edi = MEER_EDI_2d_4n_bilinear_1; break;
163  default: _errorr ("Unknown ips");
164  }
165 
166  return edi;
167 }
168 
170 //double MEER_interface :: give_element_volume (long elementID) const
171 //{
172 // return mesh->give_FElem(elementID)->give_volume();
173 //}
174 
176 double MEER_interface :: give_element_thickness (long elementID) const
177 {
178  return mesh->give_FElem(elementID)->give_elemAttribs()->give_cs()->give_thickness();
179 }
181 double MEER_interface :: give_element_thickness_reduced (long elementID) const
182 {
183  switch (mesh->give_FElem(elementID)->give_elemAttribs()->give_sst()) {
184  case SST_plstress: return this->give_element_thickness(elementID); break;
185  case SST_3dshell: return 1.0; break; // napeti je integrovano
186  default: _errorr ("Unknown ips");
187  }
188 
189  return 0.0;
190 }
191 
193 double MEER_interface :: give_element_area (long elementID) const
194 {
195  return mesh->give_FElem(elementID)->give_lav();
196 }
197 
199 //long MEER_interface :: give_number_of_IPs1 (long elementID) const
200 //{
201 // return IntPointSet_give_number_ips (this->give_IPset1(elementID));
202 //}
204 long MEER_interface :: give_number_of_IPs2 (long elementID) const
205 {
206  return IntPointSet_give_number_ips (this->give_IPset2(elementID));
207 }
208 
209 // /// return global coordinates of ipid-th IP of elementID-th element for ip set 1
210 // /// pole predalokovano na 3
211 // void MEER_interface :: give_IPs1_coords_global (long elementID, int ipID, double *gcoords) const
212 // {
213 // IntPointSet ips = this->give_IPset1(elementID);
214 // PoinT coords;
215 // mesh->give_FElem(elementID)->give_ip_coords_global (ips, ipID, coords);
216 // coords.copy_to(gcoords);
217 // }
218 
221 double MEER_interface :: give_IPs2_coords_natural (long elementID, int ipID, double *ncoords) const
222 {
223  IntPointSet ips = this->give_IPset2(elementID);
224  PoinT coords;
225  double w = IPS_give_ip_coord_native (ipID, ips, coords);
226  coords.copy_to(ncoords);
227  return w;
228 }
229 
233 const double* MEER_interface :: give_IPs1_values (long elementID, int ipID, MEER_IPValues valtype) const
234 {
235  if (valtype == MEER_IPV_strain) return mesh->give_FElem(elementID)->give_results_dm(istep, RTE_global_strain)->give_ptr2val(ipID, 0);
236  else if (valtype == MEER_IPV_stress) return mesh->give_FElem(elementID)->give_results_dm(istep, RTE_global_stress)->give_ptr2val(ipID, 0);
237  else errol;
238 
239  return NULL;
240 }
241 
243 const double* MEER_interface :: give_IPs2_values (long elementID, int ipID, MEER_IPValues valtype) const
244 {
245  return this->give_IPs1_values (elementID, ipID, valtype);
246 }
247 
248 
249 // /// give weight as return value, and natural coordinates of node-th IP
250 // double MEER_interface :: give_coords_of_IPs2 (long elementID, long ipid, double *coo)
251 // {
252 // PoinT coords;
253 // double w = IPS_give_ip_coord_native (ipid, this->give_IPset2(elementID), coords); // IP vaha
254 //
255 // coords.copy_to(coo);
256 // return w;
257 // }
258 
259 } // namespace midaspace
260 
261 #endif
Point.
#define errol
Definition: gelib.h:142
Classes Cell, Facedge, Edge, Face, Element, Gelement, PolyLine, Line, PolygonMdl, FElement...
double IPS_give_ip_coord_native(int i, IntPointSet ips, PoinT &coords)
Definition: alias.h:1332
IntPointSet
Definition: alias.h:1248
SPRpatchType
typ spr patche, závisí na typu/geometrii elementů
Definition: alias.h:338
#define _errorr(_1)
Definition: gelib.h:151
ResultTypesAtElem
Result type at element.
Definition: alias.h:240
Class Geometry, Model and Mesh.
int IntPointSet_give_number_ips(IntPointSet ips)
give number of int. points
Definition: alias.h:1316