MIDAS  0.75
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
geometry.cpp
Go to the documentation of this file.
1 #include "geometry.h"
2 #include "point.h"
3 #include "cell.h"
4 #include "module_t3d.h"
5 #include "module_oofem.h"
6 #include "dupl.h"
7 #ifdef __MEER_MODULE
8 #include "module_meer.h"
9 #endif
10 
11 #include "mathlib.h"
12 #include "gelib.h"
13 #include "librw.h"
14 
15 #include <time.h>
16 
17 
18 namespace midaspace {
19 
20 //* ********************************************************************************************
21 //* *** *** *** *** CLASS MESHGEOMETRY *** *** *** ***
22 //* ********************************************************************************************
24 Geometry :: Geometry (long gid, const Problem *pd, MMprocessing mmp) : ProblemSubject (gid, pd)
25 {
26  //* *** GENERAL INFO ***
27  gp = mmp;
28  //* STATE
29  nodeprop = elemprop = false;
30 
31  //* *** GEOMETRY DATA ***
33  Pjnts.initialize(0,10); //* !!!!!!! toto zrusit
34  Edges.initialize(0,10);
35  Faces.initialize(0,10);
36  Elems.initialize(0,10);
37 
38  //* *** GEOMETRY STATS ***
39  connectivity_assembled = false;
40  VTKCTcl = VTKCTct = VTKCTch = -1;
41  aver_elem_circ = -1.0;
42  anyBeamElem = -1;
43  boubox_assembled = false;
44 }
47 {
48  Pjnts.delete_objects();
49  Edges.delete_objects();
50  Faces.delete_objects();
51  Elems.delete_objects();
52 }
53 
56 {
57  origPjntsNum = Pjnts();
58  origElemsNum = Elems();
59 
60  long i;
61 
62  //* set property 1 for all elements
64  for (i=0; i<Elems(); i++) Elems[i]->set_mprop(1);
65 
66  //* *** initialization of points ***
67  for (i=0; i<Pjnts(); i++) Pjnts[i]->initialize();
68  //* *** initialization of elements ***
69  for (i=0; i<Elems(); i++) Elems[i]->initialize();
70 }
73 {
74  long i;
75 
76  //* *** initialization of points ***
77  for (i=0; i<Pjnts(); i++) Pjnts[i]->finitialize();
78  //* *** initialization of elements ***
79  for (i=0; i<Elems(); i++) Elems[i]->finitialize();
80 }
83 {
84  long i;
85 
86  // *** Nodes/Elements ***
87  for (i=0; i<Pjnts(); i++) Pjnts[i]->checkConsistency();
88  for (i=0; i<Elems(); i++) Elems[i]->checkConsistency();
89 
90  // *** Node/Edge/Face/Elem[id]->gid = id ***
91  for (i=0; i<Pjnts(); i++) if ( !Pjnts[i] && Pjnts[i]->give_ID() != i ) _errorr3 ("Node %ld is on position %ld, it is forbidden", Pjnts[i]->give_ID(), i);
92  for (i=0; i<Edges(); i++) if ( !Edges[i] || Edges[i]->give_ID() != i ) _errorr3 ("Edge %ld is on position %ld, it is forbidden", Edges[i]->give_ID(), i);
93  for (i=0; i<Faces(); i++) if ( !Faces[i] && Faces[i]->give_ID() != i ) _errorr3 ("Face %ld is on position %ld, it is forbidden", Faces[i]->give_ID(), i);
94  for (i=0; i<Elems(); i++) if ( !Elems[i] && Elems[i]->give_ID() != i ) _errorr3 ("Elem %ld is on position %ld, it is forbidden", Elems[i]->give_ID(), i);
95 
96 # ifdef DEBUG
97  long j;
98  // *** check right node numbers of elements ***
99  for (i=0; i<Elems(); i++)
100  for (j=0; j<Elems[i]->give_nno(); j++)
101  if (Elems[i]->give_point(j) == NULL)
102  _errorr3 ( "The %d-th node on element %d is not set", j, i);
103 # endif
104 }
105 
106 
107 
108 //* *************************
109 //* *** GEOMETRY DATA ***
110 //* *************************
111 // ###
112 // ### manipulation with arrays of components (Nodes, Vertices, Elements....
113 // ###
114 
115 // vem kod z void LocalCoordSystem :: initialize (Geometry *geom)
116 const Point* Geometry :: give_Pjnt_with_prop (long prp, bool unique) const
117 {
118  Point *p=NULL;
119  for (long i=0; i<Pjnts(); i++)
120  if (Pjnts[i]->has_mproperty (prp)) {
121  if (unique && p) _errorr2("node with property %d is not unique", prp);
122  p = Pjnts[i];
123  if (!unique) break;
124  }
125  return p;
126 }
127 
128 
129 
130 //* \todo dodelat
131 //* !!!!!!!!!!!!!!!! tady musi byt zohledneno ze se menei STATS
132 //* !!!!!!!!!!!!!!!! kdyz pridam element tak musim resetnout statistiky a opravit connectivity
133 
134 
136 template <class T>
137 void TF_GPA_delete_damned (T &list)
138 {
139  for (long i=0; i<list(); i++)
140  if (list[i]->give_delete_flag())
141  list.delete_object(i);
142 
144 }
145 
147 template <class T>
148 void TF_GPA_add_another (GPA<T> &list, T *comp, const Geometry *mg) { comp->reset_Geom(mg); comp->set_ID(list()); list.add(comp); }
149 
150 template <class T>
151 void TF_GPA_wdg_another (GPA<T> &list, T *comp, const Geometry *mg, long nid) { comp->set_Geom(mg); comp->set_ID(nid); list.wedge(nid, comp); TF_GPA_reidoid (list); }
152 
157 
158 void Geometry :: wdg_another_Elem(Element *comp, long nid) { TF_GPA_wdg_another (Elems, comp, this, nid); this->geom_stats_assembling(comp); }
159 
162 {
163  Pold->make_invisible(Pnew, false);
164  Pjnts.assign(Pold->give_ID(), Pnew);
165  Pnew->set_ID(Pold->give_ID());
166  delete Pold;
167 }
168 
169 
171 //
172 // NEni dodelana, aktivuj damn_orphaned
173 //
175 {
176  long i;
177 
178  for (i=0; i<Elems(); i++)
179  if ( Elems[i]->give_delete_flag() )
180  Elems[i]->connectivity_removing ();
181 
182  //for (i=0; i<Nn ; i++) Nodes[i]->damn_if_orphan();
183  //for (i=0; i<Ned; i++) Edges[i]->damn_if_orphan();
184  //for (i=0; i<Nfa; i++) Faces[i]->damn_if_orphan();
185  //
186  // tady killnout osirele nodes a edges a elems...
187  //
188 
189  TF_GPA_delete_damned (Elems);
190 }
191 
194 {
195  Pjnts.resize(0);
196  Edges.resize(0);
197  Faces.resize(0);
198  Elems.resize(0);
199 }
200 
201 
202 //* **************************
203 //* *** GEOMETRY STATS ***
204 //* **************************
207 {
208  if (2*Pjnts() > Edges.give_asize()) Edges.reallocup(2*Pjnts());
209  if (2*Pjnts() > Faces.give_asize()) Faces.reallocup(2*Pjnts());
210 }
211 
214 {
215  if (connectivity_assembled) return;
216  connectivity_assembled = true;
217 
218  this->connectivity_allocation();
219 
220  for (long i=0; i<Elems(); i++)
221  Elems[i]->connectivity_assembling(false);
222 }
223 
226 {
227  long i;
228 
229  if (indx > -1) {
230  i = indx;
231  indx++;
232  }
233  else {
234  VTKCTcl = VTKCTct = VTKCTch = 0;
235  i=0;
236  indx = Elems();
237  }
238 
239  for (; i<indx; i++)
240  switch (CellGeometry_e2i_VTK(Elems[i]->give_cellGeom())) {
241  case 3: VTKCTcl++; break;
242  case 5: VTKCTct++; break;
243  case 9: VTKCTct++; break;
244  case 12: VTKCTch++; break;
245  case 0: _errorr2 ("give_VTKcelltype is not implemented on element %ld", i);
246  default: _errorr ("unsuported VTK cell type");
247  }
248 }
249 
251 void Geometry :: give_vtk_polydata_counts (long &cl, long &cp) const
252 {
253  if (! this->VTKCT_is_assembled()) ((Mesh *)this)->VTKCT_assembling ();
254 
255  cl = VTKCTcl;
256  cp = VTKCTct;
257 }
258 
261 {
262  if (! this->VTKCT_is_assembled()) ((Mesh *)this)->VTKCT_assembling ();
263 
264  if (VTKCTch) return false;
265  ; return true;
266 }
267 
270 {
271  if (! this->VTKCT_is_assembled()) ((Mesh *)this)->VTKCT_assembling ();
272 
273  if (VTKCTcl > 0 && VTKCTct == 0 && VTKCTch == 0) return true;
274  ; return false;
275 }
276 
279 {
280  if (indx > -1) {
281  aver_elem_circ = ( aver_elem_circ * (Elems() - 1) + Elems[indx]->give_circum() ) / Elems();
282  }
283  else {
284  aver_elem_circ = 0.0;
285  for (long i=0; i<Elems(); i++)
286  aver_elem_circ += Elems[i]->give_circum();
287 
288  aver_elem_circ /= Elems();
289  }
290 }
293 {
294  if (indx > -1) {
295  if (Elems[indx]->give_classid() == classBeam) anyBeamElem++;
296  }
297  else {
298  anyBeamElem = 0;
299  for (long i=0; i<Elems(); i++)
300  if (Elems[i]->give_classid() == classBeam) anyBeamElem++;
301  }
302 }
304 double Geometry :: give_aver_elem_circ (void) const { if (aver_elem_circ < 0.0) ((Mesh *)this)->aver_elem_circ_assembling(); return aver_elem_circ; }
305 long Geometry :: give_anyBeamElem (void) const { if (anyBeamElem < 0 ) ((Mesh *)this)->anyBeamElem_assembling(); return anyBeamElem; }
306 
309 {
310  const PoinT* coo;
311 
312  if (indx > -1) {
313  coo = Pjnts[indx]->give_coords();
314 
315  for (long j=0; j<3; j++)
316  if (boubox_min[j] > (*coo)[j]) boubox_min[j] = (*coo)[j];
317  else if (boubox_max[j] < (*coo)[j]) boubox_max[j] = (*coo)[j];
318  }
319  else {
320  long i, j;
321  const PoinT* coo;
322  // set boundary box
323  coo = Pjnts[0]->give_coords();
324  for (i=0; i<3; i++)
325  boubox_min[i] = boubox_max[i] = (*coo)[i];
326 
327  for (i=1; i<Pjnts(); i++) {
328  coo = Pjnts[i]->give_coords();
329  for (j=0; j<3; j++)
330  if (boubox_min[j] > (*coo)[j]) boubox_min[j] = (*coo)[j];
331  else if (boubox_max[j] < (*coo)[j]) boubox_max[j] = (*coo)[j];
332  }
333 
334  boubox_assembled = true;
335  }
336 
339 }
341 {
342  if (boubox_assembled == false)
343  ((Mesh *)this)->boubox_assembling();
344 
345  return &boubox_diff;
346 }
347 
350 {
351  if (dynamic_cast<const Point *>(comp)) {
352  if (this->boubox_assembled) this->boubox_assembling(comp->give_ID());
353  }
354  else if (dynamic_cast<const Cell *> (comp)) {
355  if (this->connectivity_assembled) ((Cell*)comp)->connectivity_assembling(true);
356 
357  if (dynamic_cast<const Element *> (comp)) {
358  if (this->VTKCT_is_assembled()) this->VTKCT_assembling (comp->give_ID());
359  if (this->aver_elem_circ > 0.0) this->aver_elem_circ_assembling (comp->give_ID());
360  if (this->anyBeamElem >= 0 ) this->anyBeamElem_assembling (comp->give_ID());
361  }
362  }
363  else errol;
364 }
365 
366 
369 {
370  for (long i=0; i<Elems(); i++)
371  if (Elems[i]->give_cellGeom() == CG_Hexahedron) return VTKDS_unstruct;
372 
373  return VTKDS_polydata;
374 }
375 
378 {
379  return Elems[i]->give_VTKPDtopology();
380 }
381 
383 void Geometry :: print_info (void) const
384 {
385  //* model geom info
386  this->print_geom_info ();
387 
388  //* mesh quality
389  const Mesh *m = dynamic_cast<const Mesh *>(this);
390  if (m)
391  m->mesh_quality();
392 
393 }
394 
397 {
398  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "%s%ld] - geometry stats:", (this->isModel() ? "Model[" : "Mesh["), this->give_ID());
399 
400  //virtual CellGeometry give_cellGeom (void) const { return CG_Line; }
401  long i;
402  long cBeam,cTriangle,cQuads,cPolygon,cTetra,cBrick;
403  ; cBeam=cTriangle=cQuads=cPolygon=cTetra=cBrick = 0;
404  long Ne = Elems();
405 
406  for (i=0; i<Ne; i++)
407  switch (Elems[i]->give_cellGeom()) {
408  case CG_Line: cBeam++; break;
409  case CG_Triangle: cTriangle++; break;
410  case CG_Quadrangle: cQuads++; break;
411  case CG_Polygon: cPolygon++; break;
412  case CG_Tetrahedron: cTetra++; break;
413  case CG_Hexahedron: cBrick++; break;
414  default: _errorr2 ("Unknown element geom type (element number %d)", i+1);
415  }
416 
417  ; Pd->sodriver()->print_info_message (SODE_row,"\n Number of nodes: %6ld", Pjnts());
418  if (cBeam) Pd->sodriver()->print_info_message (SODE_row, " Number of beams: %6ld (%2ld%% of %ld)", cBeam, (100*cBeam /Ne), Ne);
419  if (cTriangle) Pd->sodriver()->print_info_message (SODE_row, " Number of triangles: %6ld (%2ld%% of %ld)", cTriangle, (100*cTriangle/Ne), Ne);
420  if (cQuads) Pd->sodriver()->print_info_message (SODE_row, " Number of quadrangles: %6ld (%2ld%% of %ld)", cQuads, (100*cQuads /Ne), Ne);
421  if (cPolygon) Pd->sodriver()->print_info_message (SODE_row, " Number of polygons: %6ld (%2ld%% of %ld)", cPolygon, (100*cPolygon /Ne), Ne);
422  if (cTetra) Pd->sodriver()->print_info_message (SODE_row, " Number of tetras: %6ld (%2ld%% of %ld)", cTetra, (100*cTetra /Ne), Ne);
423  if (cBrick) Pd->sodriver()->print_info_message (SODE_row, " Number of bricks: %6ld (%2ld%% of %ld)", cBrick, (100*cBrick /Ne), Ne);
424 
425  //* volumes
426  int dim;
427  double lav, cs, LAV[3], VOL[2];
428  cs = LAV[0] = LAV[1] = LAV[2] = VOL[0] = VOL[1] = 0.0;
429  //
430  bool novol = false;
431  for (i=0; i<Ne; i++) {
432  dim = Elems[i]->give_dimension();
433  lav = Elems[i]->give_lav();
434 
435  if (Pd->give_fulldata()) {
436  //* toto muzu predelat na volani fce element->give_volume()
437  if (dim == 1 && (cs = Elems[i]->give_elemAttribs()->give_cs()->give_area()) <= 0.0) novol = true;
438  else if (dim == 2 && (cs = Elems[i]->give_elemAttribs()->give_cs()->give_thickness()) <= 0.0) novol = true;
439  }
440 
441  if (dim == 1) { LAV[0] += lav; VOL[0] += cs*lav; }
442  else if (dim == 2) { LAV[1] += lav; VOL[1] += cs*lav; }
443  else LAV[2] += lav;
444  }
445  if (novol)
446  VOL[0] = VOL[1] = 0.0;
447 
448  if (LAV[0] > 0.0) fprintf (stdout, " Suma of lengths/volumes: %6g / %6g\n", LAV[0], VOL[0]);
449  if (LAV[1] > 0.0) fprintf (stdout, " Suma of areas /volumes: %6g / %6g\n", LAV[1], VOL[1]);
450  if (LAV[2] > 0.0) fprintf (stdout, " Suma of volumes/volumes: %6g / %6g\n", LAV[2], LAV[2]);
451 }
452 
453 
454 //* ************************************
455 //* *** READING OF GEOMETRY MESH ***
456 //* ************************************
460 FILE* scan_DATA_head (FILE *stream, const char *str, const char *expnumtype, int *noc, const char *descript)
461 {
462  int n;
463  char auxs[255], LINE[1023];
464  sprintf (auxs, "Error in section %s", descript);
465 
466  SP_scan_expected_word_exit (str, expnumtype, auxs, CASE);
467  SP_scan_number (str, n);
468  if (*noc && *noc != n) _errorr3 ("in SCALAR, number of components is not \"%d\" but %d", *noc, n);
469  else *noc = n;
470  fgets (LINE, 1023, stream); str=LINE;
471  SP_scan_expected_word_exit (str, "LOOKUP_TABLE", auxs, CASE);
472 
473  return stream;
474 }
475 
476 void scan_DATA_field (Stream *stream, const char *str, int nexc, long m, Lmtrx *dataL, Dmtrx *dataD, Lvctr *sprs, const char *name)
477 {
478  char flint[8];
479  if ( dataL && !dataD) { if (stream->isFile()) sprintf(flint,"int"); else sprintf(flint,"Int32"); }
480  else if (!dataL && dataD) { if (stream->isFile()) sprintf(flint,"float"); else sprintf(flint,"Float32"); }
481  else errol;
482 
483  Stream strm;
484  int n=0;
485  if (stream->isFile()) strm.redefine( scan_DATA_head (stream->file(), str, flint, &n, name));
486  else strm.redefine( XP_giveDAtext (stream->tixel(), 0, false, "ascii", flint, name, &n));
487 
488  if (nexc && nexc != n) _errorr4 ("in DataArray %s, number of components is not \"%d\" but %d", name, nexc, n);
489 
490  if (sprs) sprs->resize_ignore_vals(m);
491  long i,j;
492  if (dataL) { dataL->resize_ignore_vals(m, n); for (i=0; i<m; i++) { if (sprs) ST_scan_number (&strm, (*sprs)[i]); for (j=0; j<n; j++) if (ST_scan_number (&strm, (*dataL)(i,j)) != true) _errorr3 ("There is few \"%s\" numbers in section %s", flint, name); } }
493  else { dataD->resize_ignore_vals(m, n); for (i=0; i<m; i++) { if (sprs) ST_scan_number (&strm, (*sprs)[i]); for (j=0; j<n; j++) if (ST_scan_number (&strm, (*dataD)(i,j)) != true) _errorr3 ("There is few \"%s\" numbers in section %s", flint, name); } }
494 
495  if (stream->isFile()) FP_skip_line (stream->file());
496 }
497 
498 
500 Point* Model :: allocate_point (long gid, const PoinT *coo, char attribs_alloc)
501 {
502  return (Point*)(new Vertex (this, gid, coo, attribs_alloc));
503 }
504 
505 Point* Mesh :: allocate_point (long gid, const PoinT *coo, char attribs_alloc)
506 {
507  return (Point*)(new Node (this, gid, coo, attribs_alloc) );
508 }
509 
510 
512 Element* allocate_element (bool mdl, CellGeometry eg, long gid, long oid, Geometry *geom, int np=0, bool attribs_alloc=true, long dom=0, long lid=-1)
513 {
514  if (lid == -1) lid = gid;
515 
516  if (mdl) {
517  switch (eg) {
518  case CG_Line: if (np>2) return new PolyLine (gid, oid, geom, np);
519  else return new Line (gid, oid, geom); break;
520  case CG_Polygon: return new PolygonMdl (gid, oid, geom); break;
521  default: errol;
522  }
523  }
524  else {
525  switch (eg) {
526  case CG_Line: if (np>2) errol;
527  else return new Beam (gid, oid, geom, attribs_alloc, dom, lid); break;
528  case CG_Triangle: return new Triangle (gid, oid, geom, attribs_alloc, dom, lid); break;
529  case CG_Quadrangle: return new Quadrangle (gid, oid, geom, attribs_alloc, dom, lid); break;
530  case CG_Hexahedron: return new Brick (gid, oid, geom, attribs_alloc, dom, lid); break;
531  default: errol;
532  }
533  }
534 
535  return NULL;
536 }
537 
539 void Geometry :: read_addata_VTK (const char *filename, bool sparse)
540 {
541  char *file = new char[255];
542  sprintf (file, "%s%s", Pd->give_IN_Path(), filename);
543 
544  Stream *stream = new Stream();
545  stream->open(STRM_void, "r", (const char*&)file);
546 
548  if (stream->isFile()) FP_skip_line (stream->file());
549 
550  //* reading
551  this->read_VTK ('-', stream, true, sparse);
552 
553  //* close
554  stream->close();
555  delete stream;
556 }
557 
561 void Geometry :: read_VTK (char DATASET, Stream *stream, bool addata, bool sparseflag)
562 {
563  bool lgc = stream->isFile();
564  bool mdl = this->isModel();
565 
566  // variable declaration
567  bool status = true, parent;
568  int auxi;
569  long i, j, id, nn, auxl, noel, cno, offset, nSprsItms=0;
570  PoinT coord;
571  char ed='-';
572  const char *data=NULL, *offs=NULL, *typs, *str;
573  char LINE[1023], *WORD=NULL;
574  int lLINE=1023;
575  Element *elem = NULL;
576  VTKrange range;
577  const XMLElement *xnel = NULL;
578  Stream strm;
579  Lmtrx dataL( 1 , ( Pjnts() > Elems() ? Pjnts() : Elems() ) );
580  Dmtrx dataD( 1 , ( Pjnts() > Elems() ? Pjnts() : Elems() ) );
581  Lvctr *sparse = NULL;
582  if (sparseflag) sparse = new Lvctr(Pjnts());
583 
584  //
585  cno = 0;
586 
587  if (lgc) WORD = new char[255];
588  else xnel = stream->tixel();
589 
591  if (sparse && !addata) errol;
592  if (addata) range = VTKR_pred;
593  else range = VTKR_void;
595  parent = true;
596  while (true) {
597  //* key WORD
598  if (lgc) {
599  if (fgets (LINE, lLINE, stream->file()) == NULL) break;
600  str = LINE;
601  SP_scan_word (str, WORD);
602  }
603  else {
604  if (parent) { if (! stream->relink_downF()) errol; else parent = false; }
605  else { if (! stream->relink_next()) break; }
606  WORD = (char *)stream->tixel()->Value();
607  }
608 
609  //* ******************
610  //* *** POINTS ***
611  //* ******************
612  if (strcasecmp(WORD, "Points") == 0) {
613  if (range == VTKR_void) range = VTKR_points; else errol;
614 
615  // number of nodes
616  if (lgc) {
617  SP_scan_number (str, noel);
618  SP_scan_expected_word2_exit (str, "double", "float", "Invalid structure of the given VTK file, unsupported datatype of POINTS", CASE);
619  }
620  else {
621  xnel->ToElement()->QueryLongAttribute("NumberOfPoints", &noel);
622  data = XP_giveDAtext (stream->tixel(), 1, true, "ascii", "Float32", NULL, &(auxi=3));
623  }
624 
625  Pjnts.reallocup(noel);
626 
627  // coords
628  while (noel) { noel--;
629  if (lgc) status += coord.scan_xyz(stream->file());
630  else status += coord.scan_xyz(data);
631  Pjnts.add( allocate_point (Pjnts(), &coord) );
632  }
633  if (lgc) FP_skip_line (stream->file());
634  }
635  else if (strcmp(WORD, "Vertices") == 0 || strcmp(WORD, "Verts") == 0) {
636  if (!lgc) xnel->ToElement()->QueryLongAttribute("NumberOfVerts" , &noel);
637  else noel = 1;
638  if (!noel) continue; else _errorr("error v");
639  }
640  //* *************************************
641  //* *** UNSTRUCTURED GRID - CELLS ***
642  //* *************************************
643  else if (strcasecmp(WORD, "CELLS") == 0) {
644  if (DATASET != 'U') errol;
645  if (range == VTKR_points) range = VTKR_cells; else errol;
646 
647  // number of cells
648  if (lgc) {
649  SP_scan_number (str, noel);
650  SP_scan_number (str, cno);
651  }
652  else {
653  xnel->ToElement()->QueryLongAttribute("NumberOfCells" , &noel);
654  data = XP_giveDAtext (stream->tixel(), 1, false, "ascii", "Int32", "connectivity", NULL);
655  offs = XP_giveDAtext (stream->tixel(), 2, false, "ascii", "Int32", "offsets", NULL);
656  typs = XP_giveDAtext (stream->tixel(), 3, true, "ascii", "UInt8", "types", NULL);
657  }
658 
659  Elems.reallocup(noel);
660 
661  // types of elems
662  if (lgc) {
663  FP_skip_line (stream->file(), noel);
664  fgets (LINE, lLINE, stream->file()); str=LINE;
665  SP_scan_expected_word_exit (str, "CELL_TYPES", "Invalid structure of the given VTK file", CASE);
666  SP_scan_expected_number_exit (str, noel, "Invalid structure of the given VTK file, the number following CELL_TYPES");
667  }
668 
669  while (noel) { noel--;
670  if (lgc) fscanf (stream->file(),"%ld",&auxl);
671  else status += SP_scan_number (typs, auxl);
672  switch (auxl) {
673  case 3: Elems.add( allocate_element(mdl, CG_Line, Elems(), Elems(), this) ); break;
674  case 5: Elems.add( allocate_element(mdl, CG_Triangle, Elems(), Elems(), this) ); break;
675  case 7: Elems.add( allocate_element(mdl, CG_Polygon, Elems(), Elems(), this) ); break;
676  case 9: Elems.add( allocate_element(mdl, CG_Quadrangle, Elems(), Elems(), this) ); break;
677  case 12: Elems.add( allocate_element(mdl, CG_Hexahedron, Elems(), Elems(), this) ); break;
678  default: _errorr3 ("Unknown %ld-th CELL_TYPE: %ld", Elems()+1, auxl);
679  }
680  }
681  if (lgc) {
682  rewind (stream->file());
683  FP_skip_line (stream->file(), 5+Pjnts()+1);
684  }
685  else offset = 0;
686  // elem nodes
687  for (i=0; i<Elems(); i++) {
688  // nn
689  if (lgc) { fscanf (stream->file(),"%ld",&nn); cno = cno - nn - 1; }
690  else { nn = offset; status += SP_scan_number (offs, offset); nn = offset - nn; }
691  //
692  if (Elems[i]->give_classid() == classPolygonMdl) ((PolygonMdl*)Elems[i])->allocNnNe(nn);
693  if (nn != Elems[i]->give_nno())
694  _errorr4 ("The number of element(%ld) nodes %ld is not equal to %ld, wrong array offsets", i, auxl, nn);
695  // loop
696  for (j=0; j<nn; j++) {
697  if (lgc) fscanf (stream->file(),"%ld", &auxl);
698  else status += SP_scan_number (data, auxl);
699  Elems[i]->set_point(j, auxl);
700  }
701  }
702  if (lgc) FP_skip_line (stream->file(), 1+1+Elems());
703  }
704  //* *******************************
705  //* *** POLYDATA - ELEMENTS ***
706  //* *******************************
707  else if (strcasecmp(WORD, "LINES") == 0 || strcasecmp(WORD, "POLYGONS" ) == 0 || strcasecmp(WORD, "POLYS") == 0) {
708  if (DATASET != 'P') errol;
709  if (WORD[0] == 'L') { if (range == VTKR_points) range = VTKR_lines; else errol; }
710  if (WORD[0] == 'P') { if (range == VTKR_points || range == VTKR_lines) range = VTKR_polygs; else errol; }
711 
712  // number of elements
713  if (lgc) {
714  SP_scan_number (str, noel);
715  SP_scan_number (str, cno);
716  }
717  else {
718  if (WORD[0] == 'L') xnel->ToElement()->QueryLongAttribute("NumberOfLines" , &noel);
719  if (WORD[0] == 'P') xnel->ToElement()->QueryLongAttribute("NumberOfPolys" , &noel);
720  if (!noel) continue;
721  data = XP_giveDAtext (stream->tixel(), 1, false, "ascii", "Int32", "connectivity", NULL);
722  offs = XP_giveDAtext (stream->tixel(), 2, true, "ascii", "Int32", "offsets", NULL);
723  offset = 0;
724  }
725 
726  Elems.reallocup(Elems() + noel);
727 
728  while (noel) { (noel)--;
729  // count of nodes
730  if (lgc) fscanf (stream->file(),"%ld", &nn);
731  else { nn = offset; status += SP_scan_number (offs, offset); nn = offset - nn; }
732  if (WORD[0] == 'L') {
733  if (nn == 2) elem = allocate_element(mdl, CG_Line, Elems(), Elems(), this);
734  else if (nn >= 3) elem = allocate_element(mdl, CG_Line, Elems(), Elems(), this, nn);
735  else _errorr2 ("Unsupported number of nodes on element \"%ld\"", Elems()+1);
736  }
737  if (WORD[0] == 'P') {
738  if (nn == 3) elem = allocate_element(mdl, CG_Triangle, Elems(), Elems(), this);
739  else if (nn == 4) elem = allocate_element(mdl, CG_Quadrangle, Elems(), Elems(), this);
740  else _errorr2 ("Unsupported number of nodes on element \"%ld\"", Elems()+1);
741  }
742  // nodes
743  for (j=0; j<nn; j++) {
744  if (lgc) fscanf (stream->file(),"%ld", &auxl);
745  else status += SP_scan_number (data, auxl);
746  elem->set_point(j, auxl);
747  }
748 
749  Elems.add(elem);
750 
751  if (lgc) cno = cno - nn - 1;
752  }
753  if (lgc) FP_skip_line (stream->file());
754  }
755  else if (strcmp(WORD, "Strips") == 0) {
756  if (!lgc) xnel->ToElement()->QueryLongAttribute("NumberOfStrips", &noel);
757  else noel = 1;
758  if (!noel) continue; else _errorr("error s");
759  }
760  //* **********************
761  //* *** POINT_DATA ***
762  //* **********************
763  else if (strcmp(WORD, "POINT_DATA") == 0 || strcmp(WORD, "PointData") == 0) {
764  if (range == VTKR_cells || range == VTKR_lines || range == VTKR_polygs || range == VTKR_pred) range = VTKR_pd; else errol;
765  ed = 'p';
766  // head
767  if (lgc) { if (sparse) SP_scan_number (str, nSprsItms);
768  else SP_scan_expected_number_exit (str, Pjnts(), "The number following POINT_DATA is not equal to Nn"); }
769  else { if (sparse) stream->tixel()->QueryLongAttribute("NumberOfPoints", &nSprsItms);
770  parent = true; }
771  if (!sparse) nSprsItms = Pjnts();
772  }
773  //* *********************
774  //* *** CELL_DATA ***
775  //* *********************
776  else if (strcmp(WORD, "CELL_DATA") == 0 || strcmp(WORD, "CellData") == 0) {
777  if (range == VTKR_cells || range == VTKR_lines || range == VTKR_polygs || range == VTKR_pred || range == VTKR_scals) range = VTKR_cd; else errol;
778  ed = 'c';
779  // head
780  if (lgc) { if (sparse) SP_scan_number (str, nSprsItms);
781  else SP_scan_expected_number_exit (str, Elems(), "The number following CELL_DATA is not equal to Ne"); }
782  else { if (sparse) stream->tixel()->QueryLongAttribute("NumberOfCells", &nSprsItms);
783  parent = true; }
784  if (!sparse) nSprsItms = Elems();
785  }
786  //* **************************
787  //* *** DATA - SCALARS ***
788  //* **************************
789  else if (strcmp(WORD, "SCALARS") == 0 || strcmp(WORD, "DataArray") == 0) {
790  if (range == VTKR_pd || range == VTKR_cd || range == VTKR_scals) range = VTKR_scals; else errol;
791 
792  // head
793  if (lgc) SP_scan_word (str, WORD);
794  else { WORD = (char *)stream->tixel()->ToElement()->Attribute("Name"); if (!WORD) _errorr ("there is no attribute \"Name\""); }
795 
796  //* *** DATA for POINTS ***
797  if (ed == 'p') {
798  if (strcmp(WORD, "IDS_Prescribed_Values" ) == 0) { scan_DATA_field (stream, str, 0, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); ((Node*)Pjnts[id])->give_pointAttribs()->set_nDOFs_BC(dataL.give_ccols(), dataL.give_ptr2val(i,0)); } }
799  else if (strcmp(WORD, "ID_SET_IDS_Prescribed_Values") == 0) { scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0)) ((Node*)Pjnts[id])->give_pointAttribs()->set_dofbc_with_ID( dataL(i,0)-1 ); } }
800  else if (strcmp(WORD, "ID_Boundary_Condition" ) == 0) { scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0)) ((Node*)Pjnts[id])->give_pointAttribs()->add_load ( dataL(i,0)-1) ; } }
801  else if (strcmp(WORD, "Full_Hinge" ) == 0) { scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); ((Node*)Pjnts[id])->give_pointAttribs()->set_hinge ( dataL(i,0) ) ; } }
802  else if (strcmp(WORD, "ada_refined_derivatives" ) == 0) { scan_DATA_field (stream, str, 0, nSprsItms, NULL, &dataD, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); ((Node*)Pjnts[id])->set_resultN (dataD.give_ccols(), dataD.give_ptr2val(i,0), 0, RTN_ada_refder); } ((Mesh*)this)->set_RTN(RTN_ada_refder, true); }
803  else if (strcmp(WORD, "Property" ) == 0) { scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0)) ((Node*)Pjnts[id])->set_mprop ( dataL(i,0) ) ; } }
804  else _errorr2 ("Invalid name of SCALARS/DataArray for POINT_DATA/PointData \"%s\"", WORD);
805  }
806 
807  //* *** DATA for CELLS ***
808  if (ed == 'c') {
809  if (strcmp(WORD, "Virtual" ) == 0) { if (!mdl) errol; scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); ((GelemAttribs*)Elems[id]->give_elemAttribs())->set_virtual ( dataL (i,0) ) ; } }
810  else if (strcmp(WORD, "Property" ) == 0) { elemprop = true; scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0)) Elems[id]->set_mprop ( dataL (i,0) ) ; } }
811  else if (strcmp(WORD, "IDS_Prescribed_Values" ) == 0) { if (!mdl) errol; scan_DATA_field (stream, str, 0, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); ((GelemAttribs*)Elems[id]->give_elemAttribs())->set_nDOFs_BC (dataL.give_ccols(), dataL.give_ptr2val(i,0) ) ; } }
812  else if (strcmp(WORD, "ID_SET_IDS_Prescribed_Values") == 0) { if (!mdl) errol; scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0)) ((GelemAttribs*)Elems[id]->give_elemAttribs())->set_dofbc_with_ID( dataL (i,0)-1) ; } }
813  else if (strcmp(WORD, "ID_Cross-Section" ) == 0) { scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0)) Elems[id]->give_elemAttribs() ->set_cs ( dataL (i,0)-1) ; } }
814  else if (strcmp(WORD, "ID_Material" ) == 0) { scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0)) Elems[id]->give_elemAttribs() ->set_mat ( dataL (i,0)-1) ; } }
815  else if (strncmp(WORD, "ID_Boundary_Condition", 21 ) == 0) { scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0)) Elems[id] ->set_load ( dataL (i,0)-1) ; } }
816  else if (strcmp(WORD, "symStiffMtrxOfMat" ) == 0) { scan_DATA_field (stream, str, 0, nSprsItms, NULL, &dataD, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); ((GelemAttribs*)Elems[id]->give_elemAttribs())->set_MatStiffMtrx(dataD.give_ccols(), dataD.give_ptr2val(i,0) ) ; } }
817  else if (strcmp(WORD, "LCS_xy_vector" ) == 0) { scan_DATA_field (stream, str, 3, nSprsItms, NULL, &dataD, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); Elems[id]->give_elemAttribs() ->set_lcs (LCSd_xy, LCSt_Vector, dataD.give_ptr2val(i,0) ) ; } }
818  else if (strcmp(WORD, "LCS_xz_vector" ) == 0) { scan_DATA_field (stream, str, 3, nSprsItms, NULL, &dataD, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); Elems[id]->give_elemAttribs() ->set_lcs (LCSd_xz, LCSt_Vector, dataD.give_ptr2val(i,0) ) ; } }
819  else if (strcmp(WORD, "MeshGen_elemSize" ) == 0) { if (!mdl) errol; scan_DATA_field (stream, str, 1, nSprsItms, NULL, &dataD, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataD(i,0) > 0.0) ((Gelement*) Elems[id] )->set_elemSize ( dataD (i,0) ) ; } }
820  else if (strcmp(WORD, "MeshGen_elemCount" ) == 0) { if (!mdl) errol; scan_DATA_field (stream, str, 1, nSprsItms, &dataL, NULL, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); if (dataL(i,0) > 0) ((Gelement*) Elems[id] )->set_elemCount ( dataL (i,0) ) ; } }
821  else if (strcmp(WORD, "ada_error_pct_l" ) == 0) { scan_DATA_field (stream, str, 0, nSprsItms, NULL, &dataD, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); ((FElement*) Elems[id] )->set_result ( dataD (i,0), 0, RTE_ada_error_pct_l); } ((Mesh*)this)->set_RTE(RTE_ada_error_pct_l, true); }
822  else if (strcmp(WORD, "ada_refsizel_relative" ) == 0) { scan_DATA_field (stream, str, 0, nSprsItms, NULL, &dataD, sparse, WORD); for (i=0; i<nSprsItms; i++) { id = (sparse ? (*sparse)[i] : i); ((FElement*) Elems[id] )->set_result ( dataD (i,0), 0, RTE_ada_h_new); } ((Mesh*)this)->set_RTE(RTE_ada_h_new, true); }
823  else _errorr2 ("Invalid name of SCALARS/DataArray in CELL_DATA/CellData of the given VTK XML file, \"%s\"", WORD);
824  }
825  if (!lgc) if (stream->tixel()->NextSibling() == NULL) stream->relink_up();
826  }
827  else if (strcmp(WORD, "") == 0) {;}
828  else _errorr2 ("Invalid structure of the given VTK file, unexpected key word \"%s\"", WORD);
829 
830  if (lgc) { if (cno) _errorr2 ("cno(%ld) is not zero", cno); }
831  else {
832  if (data && data[0] != '\0') _errorr2("CellData of name \"%s\" has too many numbers", WORD);
833  if (offs && offs[0] != '\0') _errorr("error");
834  }
835  }
836 
837  if (Pjnts() == 0) _errorr ("Invalid data in the given VTK file, number of points is zero");
838  if (Elems() == 0) _errorr ("Invalid data in the given VTK file, number of cells is zero");
839 
840  if (lgc) delete [] WORD;
841  if (sparseflag) delete sparse;
842  if (status == false) _errorr("error");
843 }
844 
847 {
848  Pjnts.reallocplus(Pjnts() + geom->give_Npts());
849  Edges.reallocplus(Edges() + geom->give_Neds());
850  Faces.reallocplus(Faces() + geom->give_Nfas());
851  Elems.reallocplus(Elems() + geom->give_Nels());
852 
853  long i;
854  for (i=0; i<geom->give_Npts(); i++) this->add_another_Pjnt(const_cast<Point* >(geom->give_Pjnt(i)));
855  for (i=0; i<geom->give_Neds(); i++) this->add_another_Edge(const_cast<Edge* >(geom->give_Edge(i)));
856  for (i=0; i<geom->give_Nfas(); i++) this->add_another_Face(const_cast<Face* >(geom->give_Face(i)));
857  for (i=0; i<geom->give_Nels(); i++) this->add_another_Elem(const_cast<Element*>(geom->give_Elem(i)));
858 }
859 
860 
863 bool Geometry :: give_3Delement_with_point_inside (const PoinT *point, const GeometryComponent *&comp, PoinT *nc) const
864 {
865  if ( ! connectivity_is_assembled() ) _errorr("connectivity is not initiated");
866 
867  long i, j, mind, numsuperelem;
868  double dist, distance, *distances;
869  const Point *node = NULL;
870  const Element *elem;
871 
872  // finds the most closes node to the point
873  distance = 1.0e100;
874  for (i=0; i<Pjnts(); i++) {
875  dist = point->dist2_to(Pjnts[i]->give_coords());
876  if (dist < distance && Pjnts[i]->is_on_3d_element()) {
877  distance = dist;
878  node = Pjnts[i];
879  }
880  }
881  if (!node) _errorr0;
882  //
883  numsuperelem = node->give_numsuperelem();
884 
885  distances = new double [numsuperelem];
886 
887  // computing of suma of distances startpoint-node[i] for every element superior to closednode
888  for (i=0; i<numsuperelem; i++) {
889  distances[i] = 0.0;
890  elem = node->give_superelem(i);
891  for (j=0; j<elem->give_nno(); j++)
892  distances[i] += point->dist2_to (elem->give_point(j)->give_coords());
893  }
894 
895  for (i=0; i<numsuperelem; i++) {
896  // finding the least distance
897  mind = 0;
898  for (j=1; j<numsuperelem; j++)
899  if (distances[mind] > distances[j]) mind = j;
900 
901  distances[mind] = 1.0e100;
902  elem = node->give_superelem(mind);
903 
904  if (elem->give_dimension() != 3) continue;
905 
906  if ( ((FElement*)elem)->is_point_on (point, comp, nc) ) {
907  delete [] distances;
908  return true;
909  }
910  }
911 
912  delete [] distances;
913  return false;
914 }
915 
916 
917 
918 
919 //* ********************************************************************************************
920 //* *** *** *** *** CLASS MODEL *** *** *** ***
921 //* ********************************************************************************************
922 Model :: Model (long gid, const Problem *p, MMprocessing mmp) : Geometry (gid, p, mmp)
923 {
924 
925 }
928 {
929 
930 }
931 
932 
933 //* **********************************************
934 //* *** READING OF REINFORCEMENT POLYLINES ***
935 //* **********************************************
945 void Model :: read_model_polylines (const char *path, const char *filename)
946 {
947  FILE *in = _openFilePN("r", "PolyLine", path, filename);
948 
949  elemprop = true;
950 
951  long i, j, id, nv, ne, prop;
952  PoinT coords;
953 
954  fscanf (in, "%ld", &ne);
955  Elems.reallocup(ne);
956 
957  PolyLine *pl;
958 
959  for (i=0; i<ne; i++) {
960  fscanf (in, "%ld", &id); id--; if (i != id) _errorr("mismatch in polyline file");
961  fscanf (in, "%ld", &nv);
962  fscanf (in, "%ld", &prop);
963 
964  pl = new PolyLine(id, id, this, nv);
965  Pjnts.reallocup(Pjnts()+nv);
966  pl->set_mprop(prop);
967 
968  for (j=0; j<nv; j++) {
969  coords.scan_xyz(in);
970  Pjnts.add( new Vertex (this, Pjnts(), &coords, 'n') );
971  Pjnts.last()->set_mprop(Pjnts());
972  pl->set_point(j, Pjnts.last());
973  }
974 
975  Elems.add(pl);
976  }
977 
978  fclose (in);
979 }
980 
981 
982 
983 //* **********************************************
984 //* *** READING OF REINFORCEMENT POLYLINES ***
985 //* **********************************************
989 struct Predp {
990  char name[15];
991  int id, nl, nk;
993 
994  double length (void) { return points.last()->x; }
995 
996  int is_my_ch(char *chn) {
997  return (strncmp(name, chn, strlen(name)) == 0 ? strlen(name) : 0);
998  }
999 };
1002 {
1003  FILE *in;
1004  PolyLine *pl;
1005  char filename[255] = "";
1006  char name[15], c;
1007  long auxl, id, i, nno;
1008  double auxd;
1009  //long i, j, id, nv, ne, prop;
1010  PoinT coords, *auxP;
1011  GPA<Predp> prdi;
1012  Predp *prd;
1013 
1014  int quart;
1015  int right;
1016  bool propsp;
1017 
1018  switch (Pd->give_melnik()) {
1019  case 10: quart = 4; propsp = false; break; // celek
1020  case 20: quart = 2; propsp = false; break; // polovina
1021  case 21: quart = 2; propsp = true; break; // polovina + specialni property
1022  case 40: quart = 1; propsp = false; break; // ctvrtina
1023  default: _errorr("\"-P_melnik x\" missing");
1024  }
1025 
1026  elemprop = true;
1027 
1028  for (int f=0; f<7; f++) {
1029  if (f == 0) { if (1 ) sprintf (filename, "this.model.1_dolni_krajni_L_"); else continue; }
1030  if (f == 1) { if (1 && quart > 1) sprintf (filename, "this.model.1_dolni_krajni_P_"); else continue; }
1031  if (f == 2) { if (1 ) sprintf (filename, "this.model.2_dolni_stredni_"); else continue; }
1032  if (f == 3) { if (1 ) sprintf (filename, "this.model.3_horni_konzol_L_"); else continue; }
1033  if (f == 4) { if (1 && quart > 1) sprintf (filename, "this.model.3_horni_konzol_P_"); else continue; }
1034  if (f == 5) { if (1 ) sprintf (filename, "this.model.4_horni_zmonol_L_"); else continue; }
1035  if (f == 6) { if (1 && quart > 1) sprintf (filename, "this.model.4_horni_zmonol_P_"); else continue; }
1036 
1037  //* predpeti
1038  in = _openFilePNS("r", "Melnik file", "", filename, "P.txt");
1039 
1040  while (true) {
1041  prd = new Predp;
1042 
1043  if (fscanf (in, "%d", &prd->id) == EOF) break;
1044  FP_scan_word (in, prd->name);
1045  fscanf (in, "%d", &prd->nl);
1046  fscanf (in, "%d", &prd->nk);
1047 
1048  while (true) {
1049  fscanf (in, "%lf", &auxd);
1050 
1051  auxP = new PoinT;
1052  auxP->x = auxd;
1053 
1054  prd->points.add(auxP);
1055 
1056  FP_skip_space (in);
1057  if ((c = fgetc(in)) == '\n') break;
1058  else ungetc(c,in);
1059  }
1060 
1061  for (i=0; i<prd->points()-1; i++) {
1062  prd->points[i]->scan_y(in);
1063  prd->points[i]->y *= -1.0;
1064  }
1065  FP_skip_space (in);
1066  if (fgetc(in) != '\n') errol;
1067 
1068  prdi.add(prd);
1069  }
1070 
1071  fclose (in);
1072 
1073 
1074  //* kabely
1075  for (int kz=0; kz<2; kz++) {
1076  if (kz==0) in = _openFilePNS("r", "Melnik file", "", filename, "K.txt");
1077  else if (quart < 4) continue; else in = _openFilePNS("r", "Melnik file", "", filename, "Z.txt");
1078 
1079  pl = new PolyLine(Elems(), Elems(), this, 0);
1080  id = -1;
1081  while (true) {
1082  c = fscanf (in, "%ld", &auxl); auxl--;
1083 
1084  if (id == -1) { if (auxl != 0) errol; }
1085  else if (auxl == 0 || c == EOF) {
1086  auxl = 0;
1087  for (i=0; i<prdi(); i++)
1088  if (prdi[i]->is_my_ch(name) > auxl) {
1089  prd = prdi[i];
1090  auxl = prdi[i]->is_my_ch(name);
1091  }
1092 
1093  if (!propsp) pl->set_mprop(prd->nl); // pro testovani
1094  else pl->set_mprop(prd->nl*1000+prd->id*10); // aktualni vystup
1095  //pl->set_prop_node_inher(true);
1096  prd->nk--;
1097 
1098  //* kontrola
1099  if (0) {
1100  nno = pl->give_nno();
1101  if (nno != prd->points()-1 && !(f==2 && quart==1) )
1102  _errorr6("f=%ld kz=%d %s %ld != %ld", f, kz, name, nno, prd->points()-1);
1103  auxd = (pl->give_lav() - prd->length());
1104  if ( (auxd > 0.1 || auxd < -0.1) && !(f==2 && quart==1) )
1105  _warningg5("f=%ld %s length %lf != %lf", f, name, pl->give_lav(), prd->length());
1106  //if ( (pl->give_lav()/1000.0 - prd->length()) > 0.1 ) errol;
1107  if (f==1 || f==4 || f==6) {
1108  if (quart==1) errol;
1109  for (i=0; i<nno; i++) {
1110  if ( fabs(pl->give_point(i)->give_coord(0) - prd->points[nno-1-i][0].x) > 0.001)
1111  errol;
1112  if ( fabs(pl->give_point(i)->give_coord(2) - prd->points[nno-1-i][0].y) > 0.001)
1113  _warningg5("f=%ld %s z: %lf != %lf", f, name, pl->give_point(i)->give_coord(2), prd->points[nno-1-i][0].y);
1114  }
1115  }
1116  else {
1117  for (i=0; i<nno; i++) {
1118  if ( fabs(pl->give_point(i)->give_coord(0) - prd->points[i][0].x) > 0.001 && !(f==2 && quart==1))
1119  errol;
1120  if ( fabs(pl->give_point(i)->give_coord(2) - prd->points[i][0].y) > 0.001)
1121  _warningg5("f=%ld %s z: %lf != %lf", f, name, pl->give_point(i)->give_coord(2), prd->points[i][0].y);
1122  }
1123  }
1124  }
1125 
1126  Elems.add(pl);
1127 
1128  if (c == EOF) { pl = NULL; break; }
1129 
1130  pl = new PolyLine(Elems(), Elems(), this, 0);
1131  id = -1;
1132  }
1133  id ++;
1134  if (id == 0) right = 0;
1135 
1136  coords.scan_xyz(in);
1137  coords.z *= -1.0;
1138  coords.dvd(1000.0);
1139  if (quart==1 && coords.x > 146.0) {
1140  coords.x = 146.0;
1141  right++;
1142  }
1143 
1144  // DOCASNE prekryvani vyztuze L a P pro provnani a zjisteni symetricnosti
1145  //if (coords.x > 146.0) {
1146  // coords.x = -1 * ( coords.x - 292.0);
1147  //}
1148 
1149  if (right < 2) {
1150  Pjnts.add( new Vertex (this, Pjnts(), &coords, 'n'));
1151 
1152  pl->add_point(Pjnts.last());
1153  }
1154 
1155  if (id) FP_scan_expected_word (in, name);
1156  else FP_scan_word (in, name);
1157 
1158  FP_skip_space (in);
1159  if (fgetc(in) != '\n') errol;
1160 
1161  //if (right == 1) right = 2;
1162  }
1163 
1164  fclose (in);
1165  }
1166 
1167  if (quart==4)
1168  for (i=0; i<prdi(); i++)
1169  if (prdi[i]->nk != 0)
1170  _warningg4("f=%ld predp skup %ld, %d != 0", f, i, prdi[i]->nk);
1171 
1172  prdi.delete_objects();
1173  prdi.resize(0);
1174  }
1175 }
1176 
1178 //void Model :: findRANofSkewLines (void)
1179 //{
1180 // double p1[3], p2[3];
1181 //
1182 // int a = give_edge_points_commperpend_skewlines ( Elems[0]->give_point(0)->give_coords(),
1183 // Elems[0]->give_point(1)->give_coords(),
1184 // Elems[1]->give_point(0)->give_coords(),
1185 // Elems[1]->give_point(1)->give_coords(),
1186 // p1, p2);
1187 //
1188 // printf ("p1 %lf %lf %lf\n", p1[0], p1[1], p1[2]);
1189 // printf ("p2 %lf %lf %lf\n", p2[0], p2[1], p2[2]);
1190 // printf ("a = %d\n", a);
1191 //}
1192 
1194 {
1195  MMprocessing gp = this->give_gp();
1196 
1197  switch (gp) {
1198  case MMP_primary:
1199  case MMP_secondary: {
1200  //* new mesh
1201  Mesh *mesh = new Mesh(0, Pd, 1, gp);
1202  mesh->set_Master_model(this);
1203 
1204  //* transformation
1205  if (Pd->give_IN_meshGen_elemSize() == 0.0)
1206  mesh->read_mesh_equal_to_model();
1207  else {
1208  this->generate_mesh_primary();
1209  mesh->read_mesh_T3d(NULL, NULL);
1210  }
1211 
1212  if (gp == MMP_primary && Pd->give_cMesh()) ((Problem*)Pd)->wedge_mesh(0, mesh);
1213  else ((Problem*)Pd)->add_mesh(mesh);
1214 
1215  mesh->initialize();
1216 
1217  break;
1218  }
1219  case MMP_RFbyHN:
1220  this->generate_mesh_RFbyHN();
1221  break;
1222  default: errol;
1223  }
1224 }
1225 
1226 
1228 {
1229  GPA<const Node> hnodes; // (hanging)nodes on polyline
1230  const PolyLine *pol;
1231  PolyLine *newpol;
1232  Mesh* pm = Pd->give_Mesh(0); // parent mesh geometry
1233 
1234  pm->connectivity_assembling ();
1235 
1236  //* loop over elements = RF bars
1237  for (long i=0; i<Elems(); i++) {
1238  //for (long i=37; i<38; i++) {
1239  pol = dynamic_cast<const PolyLine *>(Elems[i]);
1240  if (!pol) errol;
1241 
1242  newpol = pol->generate_mesh_RFbyHN (pm, hnodes);
1243 
1244  if (newpol) {
1245  if (i+1 == Elems()) this->add_another_Elem(newpol);
1246  else this->wdg_another_Elem(newpol, i+1);
1247 
1248  hnodes.resize(1);
1249  }
1250  else
1251  hnodes.resize(0);
1252  }
1253 }
1254 
1255 
1257 {
1258  //* info print
1259  double sec = clock();
1260  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "Model[%ld] - mesh generation by T3d", this->give_ID());
1261 
1262  this->connectivity_assembling ();
1263 
1264  switch (Pd->give_P_mesher()) {
1265  case MGT_T3d: {
1266  femFileFormat fff = FFF_T3d;
1267 
1268  //* T3D INPUT FILE
1269  FILE *out = _openFilePNS ("w", "T3d input", Pd->give_OUT_moFILE()->give_path(), Pd->give_OUT_moFILE()->give_base(), ".T3d.in");
1270 
1271  long i;
1272  for (i=0; i<Pjnts(); i++) Pjnts[i]->print_row(out, fff); fprintf (out,"\n");
1273  for (i=0; i<Edges(); i++) Edges[i]->print_row(out, fff); fprintf (out,"\n");
1274  for (i=0; i<Faces(); i++) Faces[i]->print_row(out, fff); fprintf (out,"\n");
1275  for (i=0; i<Elems(); i++) Elems[i]->print_row(out, fff);
1276 
1277  fclose (out);
1278 
1279 
1280  const char *basename = Pd->give_OUT_moFILE()->give_name();
1281  char cmd[255] = "";
1282 
1283  //if (IN_resultfile != NULL) errol;
1284  //IN_resultfile = new FiLe(FFF_OOFEM, this->OUT_moFILE->give_path(), this->OUT_moFILE->give_base(), ".oofem.out");
1285 
1286  //sprintf (cmd, "-i %s.T3d.in -o %s.T3d.out -d %.2lf -p 8 -g %s.T3d.native.log", basename, basename, Pd->give_IN_elemsize(), basename);
1287  sprintf (cmd, "-i %s.T3d.in -o %s.T3d.out -d %.2lf -p 8", basename, basename, Pd->give_IN_meshGen_elemSize());
1288  //sprintf (cmd, "-i %s.T3d.in -o %s.T3d.out -p 8", basename, basename);
1289 
1290  //sprintf (cmd, "-i %s.T3d.in -o %s.T3d.out -d %.2lf -p 264", basename, basename, Pd->give_IN_elemsize());
1291 
1292  if (Pd->give_IN_file_bgm())
1293  sprintf (cmd, "%s -m %s", cmd, Pd->give_IN_file_bgm()->give_name());
1294 
1296  else mesh_generate_T3d (Pd, NULL , cmd);
1297 
1298  //fprintf (stdout, "%s\n", cmd);
1299  break;
1300  }
1301  default: errol;
1302  }
1303 
1304  Pd->sodriver()->print_info_time_green_ok (SODE_end_green_ok, (clock() - sec) / (double)CLOCKS_PER_SEC);
1305 }
1306 
1307 
1308 //* ********************************************************************************************
1309 //* *** *** *** *** CLASS FEMESH *** *** *** ***
1310 //* ********************************************************************************************
1311 Mesh :: Mesh (long gid, const Problem *p, long numdom, MMprocessing mmp) : Geometry (gid, p, mmp)
1312 {
1313  Master = NULL;
1314 
1315  //* *** SET sequent or parallel version ***
1316  NumDomains = numdom;
1317  if (NumDomains==1) Parallel = false;
1318  else if (NumDomains>1) Parallel = true;
1319  else _errorr ("Wrong number of domains");
1320 
1321  if (Parallel) {
1322  NumNodes = new long[NumDomains];
1323  NumElems = new long[NumDomains];
1324  }
1325  else { NumNodes = NumElems = NULL; }
1326 
1327  cSubDomains = 0;
1328  //* RESULTS
1330  rslts_nsteps = 0;
1331  rslts_step = NULL;
1332  rslts_loadlevel= NULL;
1333  memset(RTN, 0, cRTN*sizeof(bool));
1334  memset(RTE, 0, cRTE*sizeof(bool));
1335  critical_coeff = 0.0;
1336  //* Adaptivity
1337  nRegions = 0;
1338 }
1341 {
1342  if (Parallel) {
1345  }
1346 
1347  delete rslts_step;
1348  delete rslts_loadlevel;
1349 
1350  Lata.delete_objects();
1351  Data.delete_objects();
1352 }
1353 
1356 {
1358 
1359  //* divide quadrangles into two triangles
1360  if (Pd->give_PDBO(PDBO_divideQuads)) {
1361  Triangle *tr1, *tr2;
1362  Quadrangle *quad;
1363  long ne = Elems();
1364  for (long i=0; i<ne; i++) {
1365  quad = dynamic_cast<Quadrangle *> (Elems[i]);
1366  if (quad == NULL) continue;
1367 
1368  bool fds = quad->is_first_diag_short();
1369  tr1 = new Triangle(quad, true, fds);
1370  tr2 = new Triangle(quad, false, fds);
1371 
1372  quad->connectivity_assembling();
1373  tr1 ->connectivity_assembling();
1374  tr2 ->connectivity_assembling();
1375 
1376  ((Face*)tr1->give_face(0))->give_facedgeAttribs()->set_new (quad->give_face(0)->give_facedgeAttribs());
1377  ((Face*)tr2->give_face(0))->give_facedgeAttribs()->set_new (quad->give_face(0)->give_facedgeAttribs());
1378 
1379  quad->connectivity_removing();
1380  delete quad;
1381  Elems.assign(i, tr1);
1382  this->add_another_Element (tr2, 0);
1383  }
1384  if (Elems() - ne) {
1385  fprintf (stdout,"\n Divided quadrangles %ld\n", Elems() - ne);
1386  // toto smaz: print_info_message ('S',ETC_DEFAULT,"");
1387  }
1388  }
1389 }
1390 
1392 void Mesh :: checkConsistency (void) const
1393 {
1395 }
1396 
1399 {
1400  elem->set_lid(Parallel ? NumElems[dom]++ : Elems());
1401 
1402  this->add_another_Elem (elem);
1403 }
1404 
1406 void Mesh :: mesh_quality (void) const
1407 {
1408  ((Mesh*)this)->connectivity_assembling ();
1409 
1410  if ( ! Pd->give_PDBO (PDBO_OUT_MeshQual) ) return;
1411 
1412  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "Compute element quality");
1413 
1414  long i;
1415  double q;
1416  long Ne = Elems();
1417  Lvctr Q(7), Qi(Ne);
1418 
1419  Q.zero();
1420 
1421  for (i=0; i<Ne; i++) {
1422  q = Elems[i]->give_quality();
1423 
1424  if (q < 0.0 ) { Q[0]++; Qi[i] = 7; }
1425  else if (q < 0.01) { Q[1]++; Qi[i] = 6; }
1426  else if (q < 0.2 ) { Q[2]++; Qi[i] = 5; }
1427  else if (q < 0.4 ) { Q[3]++; Qi[i] = 4; }
1428  else if (q < 0.6 ) { Q[4]++; Qi[i] = 3; }
1429  else if (q < 0.8 ) { Q[5]++; Qi[i] = 2; }
1430  else if (q < 1.0 ) { Q[6]++; Qi[i] = 1; }
1431  else _errorr2 ("Quality %e > 1.0", q);
1432  }
1433 
1434  // check
1435  long sum = 0;
1436  for (i=0; i<7; i++) sum += Q[i];
1437  if (sum != Ne) _errorr ("sum != Ne");
1438  // check
1439 
1440  if (true) {
1441  fprintf (stdout,"\n Element quality, %ld%% of %ld\n", (100*(Ne-Q[0]))/Ne, Ne);
1442 
1443  if (Q[0]<Ne) {
1444  fprintf (stdout," %5ld (%3ld%%) [1] fine (0.8 - 1.0)\n", Q[6], (100*Q[6])/Ne);
1445  fprintf (stdout," %5ld (%3ld%%) [2] good (0.6 - 0.8)\n", Q[5], (100*Q[5])/Ne);
1446  fprintf (stdout," %5ld (%3ld%%) [3] low (0.4 - 0.6)\n", Q[4], (100*Q[4])/Ne);
1447  fprintf (stdout," %5ld (%3ld%%) [4] wrong (0.2 - 0.4)\n", Q[3], (100*Q[3])/Ne);
1448  fprintf (stdout," %5ld (%3ld%%) [5] ugly (0.01- 0.2)\n", Q[2], (100*Q[2])/Ne);
1449  fprintf (stdout," %5ld (%3ld%%) [6] non-acceptable (0.0 -0.01)\n", Q[1], (100*Q[1])/Ne);
1450  fprintf (stdout," %5ld (%3ld%%) [7] -- ( < 0.0)\n", Q[0], (100*Q[0])/Ne);
1451  }
1452  // toto smaz: print_info_message ('S',ETC_DEFAULT,"");
1453  }
1454 
1455  if (Q[0] == Ne) Pd->sodriver()->print_info_message (SODE_end, "--");
1456  else if (Q[1] != 0) Pd->sodriver()->print_info_message_colour (SODE_end, ETC_D_RED, "NON-ACCEPTABLY LOW QUALITY");
1458 
1459  //this->print_VTK_CD_scal (true, ".mesh_quality", "mesh_quality", (const Xvctr**)&Qi);
1460 }
1461 
1462 
1465 {
1466  this->connectivity_assembling ();
1467 
1468  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "%s%ld] - RIGID elems to RigidArm switch", (this->isModel() ? "Model[" : "Mesh["), this->give_ID());
1469 
1470  long i, nd=0;
1471 
1472  for (i=0; i<Elems(); i++) {
1473  if (Elems[i]->give_elemAttribs()->give_mat() == NULL || Elems[i]->give_elemAttribs()->give_mat()->give_type() != MAT_RIGID) continue;
1474 
1475  //* check
1476  if (Elems[i]->give_classid() != classBeam) _errorr("RigidBody material is not at beam element");
1477  if (Elems[i]->give_nno() != 2) _errorr("RigidBody material is not at beam element with 2 nodes");
1478 
1479  if ( this->FElems(i)->give_mdl_masterel() &&
1480  this->FElems(i)->give_mdl_masterel()->give_lav() != this->Elems[i]->give_lav() )
1481  _errorr("Element with rigid body mat. is not same length as master");
1482 
1483  const Node *n1 = dynamic_cast<const Node *> (Elems[i]->give_point(0));
1484  const Node *n2 = dynamic_cast<const Node *> (Elems[i]->give_point(1));
1485 
1486  if (n1->give_classid() != classNode) _errorr("First node at element with RigidBody material is not Node");
1487  if (n2->give_classid() != classNode) _errorr("First node at element with RigidBody material is not Node");
1488 
1489  if (n1->give_pointAttribs()->give_nDOFs() != n2->give_pointAttribs()->give_nDOFs()) _errorr("Not same Number of DOFS at nodes of first and second node at element with RigidBody material");
1490 
1491  //* delete element
1492  Elems[i]->connectivity_removing();
1493  Elems.delete_object(i); nd++;
1494 
1495  //* make rigid arm node
1496  RigidArmNode *ran = new RigidArmNode (n1);
1497  ((RANAttribs*)ran->give_pointAttribs())->complete_setup_yourself(n2);
1498 
1499  //* smazat n1 a nahradit ran
1500  this->replace_Pjnt_by ((Node*)n1, ran); //
1501  }
1502 
1503  // shake
1505 
1506  // rm RIGID mat
1507  ((Problem*)Pd)->rm_MAT_RIGID();
1508 
1509  Pd->sodriver()->print_info_message (SODE_end, "%d", nd);
1510 }
1511 
1512 
1513 //* ************************************
1514 //* *** READING OF GEOMETRY MESH ***
1515 //* ************************************
1520 void Mesh :: read_mesh_ANSYS (char *path, const char *filename)
1521 {
1522  // open file
1523  FILE *in = _openFilePN("r", "Mesh", path, filename);
1524 
1525  // variable declaration
1526  char c;
1527  long i,id,nl,domid;
1528  PoinT coord;
1529  FElement *elem;
1530  //
1531  domid=0;
1532 
1533 
1534  // GET NUMBER OF LINES
1535  nl = FP_number_of_lines (in, true);
1536 
1537  Pjnts.reallocup(nl);
1538  Elems.reallocup(nl);
1539 
1540 
1541  //* *** HEAD ***
1542  FP_skip_line (in,4);
1543 
1544  // main loop
1545  while ((c = getc(in)) != EOF) {
1546  if (c=='\n') continue;
1547 
1548  switch (c){
1549  case 'K':{ // node
1550  //while ( getc(in) != ',') ;
1551  ; if ( getc(in) != ',') _errorr3 ("There is no separation char ',' nn=%ld, nel=%ld", Pjnts(), Elems());
1552  fscanf (in,"%ld",&id); if ( getc(in) != ',') _errorr3 ("There is no separation char ',' nn=%ld, nel=%ld", Pjnts(), Elems());
1553  coord.scan_x(in); if ( getc(in) != ',') _errorr3 ("There is no separation char ',' nn=%ld, nel=%ld", Pjnts(), Elems());
1554  coord.scan_y(in); if ( getc(in) != ',') _errorr3 ("There is no separation char ',' nn=%ld, nel=%ld", Pjnts(), Elems());
1555  coord.scan_z(in);
1556 
1557  // CTENI COORDS HODIT DO POINT.cpp read input
1558  Pjnts.add( allocate_point (id-1, &coord) );
1559  break;
1560  }
1561  case 'A':{ // element - triangle
1562  elem = new Triangle (Elems(),Elems(), this, true, domid, Elems());
1563 
1564  for (i=0; i<elem->give_nno(); i++) {
1565  if ( getc(in) != ',') _errorr3 ("There is no separation char ',' nn=%ld, nel=%ld", Pjnts(), Elems());
1566  fscanf (in,"%ld", &id);
1567  elem->set_node(i, id-1);
1568  }
1569  Elems.add(elem);
1570  break;
1571  }
1572  default:
1573  FP_skip_line(in);
1574  }
1575  }
1576 
1577  fclose (in);
1578 }
1579 
1580 //* ************************************
1581 //* *** READING OF GEOMETRY MESH ***
1582 //* ************************************
1586 void Mesh :: read_mesh_JKTK (char *path, const char *filename)
1587 {
1588  // open file
1589  FILE *in = _openFilePN("r", "Mesh", path, filename);
1590 
1591  // variable declaration
1592  long i, auxl, n;
1593  const char *str;
1594  char LINE[1023];
1595  femFileFormat fff = FFF_JKTK;
1596 
1597  //* nodes
1598  fscanf (in, "%ld", &n);
1599  Pjnts.reallocup(n);
1600  for (i=0; i<n; i++) {
1601  FP_scan_line_skip_emptyORcommented (in, LINE); str=LINE;
1602 
1603  SP_scan_expected_number_exit (str, i+1, "Invalid structure of file with JKTK format: wrong node id");
1604  Pjnts.add((Point*)new Node (this, i, NULL));
1605  Nodes(i)->read_input (str, fff);
1606  }
1607 
1608  //* connectivity will be assembled
1609  this->connectivity_allocation();
1610 
1611  //* elements
1612  fscanf (in, "%ld", &n);
1613  Elems.reallocup(n);
1614  for (i=0; i<n; i++) {
1615  FP_scan_line_skip_emptyORcommented (in, LINE); str=LINE;
1616 
1617  SP_scan_expected_number_exit (str, i+1, "Invalid structure of file with JKTK format: wrong node id");
1618  SP_scan_number (str, auxl);
1619  Elems.add( allocate_element(false, CellGeometry_i2e_JKTK(auxl), Elems(), Elems(), this) );
1620 
1621  // if quadratic element -> edit attributes !!!!!
1622 
1623  FElems(i)->read_input (str, fff);
1624  }
1625 
1626  if (EOF != fscanf (in, "%ld", &auxl)) errol;
1627 
1628  fclose (in);
1629 }
1630 
1631 
1632 //* ************************************
1633 //* *** READING OF GEOMETRY MESH ***
1634 //* ************************************
1638 void Mesh :: read_mesh_T3d (char *path, const char *filename)
1639 {
1640  FILE *in;
1641  long i, id, lid, deg, auxl, domid, trash, el[7], cND, outspec, nno;
1642  bool auxb;
1643  PoinT coord;
1644  int t3dout;
1645  CellGeometry cg;
1646 
1647  const char *str;
1648  char LINE[1023];
1649 
1650 
1651  //* connectivity will be assembled
1652  this->connectivity_allocation();
1653 
1654  for (domid=0; domid<NumDomains; domid++) {
1655  if (filename) {
1656  char domsuff[8] = "";
1657  if (Parallel) sprintf (domsuff,".%ld",domid);
1658  in = _openFilePNS ("r", "Mesh", path, filename, domsuff);
1659  }
1660  else {
1661  if (Parallel) errol;
1662  in = _openFilePNS ("r", "Mesh", NULL, Pd->give_OUT_moFILE()->give_name(), ".T3d.out");
1663  }
1664 
1665  //* *** HEAD ***
1666  fscanf (in, "%d", &t3dout); if (t3dout!=3 && t3dout!=7) _errorr("error in t3d mesh file");
1667  fscanf (in, "%ld %ld %ld", &deg, &auxl, &outspec); if (outspec!=8 && outspec!=264) _errorr("error in t3d mesh file");
1668  if (Parallel) { fscanf (in,"%ld",&auxl); if (auxl!=domid+1) _errorr("error in t3d mesh file"); }
1669 
1670  if (t3dout!=7 && Parallel) errol;
1671 
1672  // Nn
1673  fscanf (in, "%ld", &cND);
1674  if (domid==0) Pjnts.resizeup(cND);
1675  else if (Pjnts() != cND) _errorr ("error in t3d mesh file");
1676 
1677  // Ne
1678  for (i=0; i<7; i++) {
1679  if (i<t3dout) fscanf (in, "%ld", el+i);
1680  else el[i] = 0;
1681  if (i) el[i] += el[i-1];
1682  }
1683  if (domid==0) Elems.resizeup(el[6]);
1684  else if (Elems() != el[6]) _errorr ("error in t3d mesh file");
1685 
1686  if (Parallel) {
1687  fscanf (in,"%ld", NumNodes+domid); cND = NumNodes[domid];
1688  NumElems[domid] = 0;
1689  for (i=0;i<7;i++) { fscanf (in,"%ld",el+i); NumElems[domid] += el[i]; if (i) el[i] += el[i-1]; }
1690  }
1691 
1692 
1693  //* *** NODES ***
1694  for (i=0; i<cND; i++) {
1695  if (!Parallel) { fscanf (in, "%ld", &id); lid = id; }
1696  else { fscanf (in, "%ld %ld %ld", &lid, &id, &trash); }
1697 
1698  if (id<0) { auxb = true; id = -id-1;}
1699  else { auxb = false; id = id-1;}
1700 
1701  FP_scan_line_skip_emptyORcommented (in, LINE); str=LINE;
1702 
1703  if (Pjnts[id]==NULL) { Pjnts.assign(id, allocate_point (id, NULL, '-')); Nodes(id)->read_input (str, FFF_T3d); if (Parallel) Nodes(id)->initialize_domli (auxb,domid,lid-1); }
1704  else Nodes(id)->add_domain (id, str, FFF_T3d, auxb,domid,lid-1);
1705 
1706  //* RAN a HN se naalokuji podle genatu, viz Point :: attributes_allocation
1707  //* pak ale musim z Node udelat RAN nebo HN
1708  //* !! v t3d se attributes stejne nenaplnujou, tak bych je nemusel vubec allokovat, pak bych si usetril pretahavani na
1709  //* zatim to nebude implementovat, az budu do vtk zadelave HN tak tam se bude cist property az v PointData
1710  //* tak bych to mohl nejak sloucit
1711  if (Pjnts[id]->give_pointAttribs()->give_classid() == classHNAttribs) {
1712  PointAttribs* na = Nodes(id)->release_attributes();
1713  Node *newnode = new HangingNode(Nodes(id), false);
1714  newnode->assign_attributes(na);
1715  delete Pjnts[id];
1716  Pjnts.assign(id, newnode);
1717  }
1718  if (Pjnts[id]->give_pointAttribs()->give_classid() == classRANAttribs) {
1719  PointAttribs* na = Nodes(id)->release_attributes();
1720  Node *newnode = new RigidArmNode(Nodes(id), false);
1721  newnode->assign_attributes(na);
1722  delete Pjnts[id];
1723  Pjnts.assign(id, newnode);
1724  }
1725  }
1726 
1727 
1728  //* *** ELEMENTS ***
1729  if (deg != 1) errol; // jinak bude jiny pocet uzlu
1730  //
1731  for (i=0; i<el[6]; i++) {
1732  if (i < el[0]) { nno = 2; cg = CG_Line; }
1733  else if (i < el[1]) { nno = 3; cg = CG_Triangle; }
1734  else if (i < el[2]) { if (t3dout==3) { nno = 4; cg = CG_Tetrahedron; } else { nno = 4; cg = CG_Quadrangle; } }
1735  else if (i < el[3]) { nno = 4; cg = CG_Tetrahedron; }
1736  else if (i < el[4]) { nno = 6; cg = CG_Wedge; }
1737  else if (i < el[5]) { nno = 5; cg = CG_Pyramid; }
1738  else if (i < el[6]) { nno = 8; cg = CG_Hexahedron; }
1739  else errol;
1740 
1741  FP_scan_line_skip_emptyORcommented (in, LINE); str=LINE;
1742 
1743  SP_scan_number (str, id); id--;
1744 
1745  Elems.assign(id, allocate_element(false, cg, id, id, this, nno, false, domid, i) );
1746 
1747  FElems(id)->read_input (str, FFF_T3d);
1748  }
1749 
1750  if (EOF != fscanf (in, "%ld", &auxl)) errol;
1751 
1752  fclose (in);
1753  }// end of loop over domains
1754 }
1755 
1756 
1757 //* ************************************
1758 //* *** READING OF GEOMETRY MESH ***
1759 //* ************************************
1764 {
1765  long i, j;
1766  const Vertex *masterex;
1767  const Element *masterel;
1768  FElement *elem = NULL;
1769 
1770 
1771  //* nodes
1772  Pjnts.resizeup(Master->give_Npts());
1773 
1774  for (i=0; i<Pjnts(); i++) {
1775  masterex = dynamic_cast<const Vertex *>(Master->give_Pjnt(i)); if (!masterex) errol;
1776 
1777  Pjnts.assign(i, new Node(masterex, 'n'));
1778  Pjnts[i]->reset_Geom(this);
1779  Pjnts[i]->reset_property(0, i+1);
1780  Nodes(i)->set_master_component (i+1, Master, 1);
1781  }
1782 
1783 
1784  //* elements
1785  Elems.reallocup(Master->give_Nels());
1786 
1787  for (i=0; i<Master->give_Nels(); i++) {
1788  masterel = Master->give_Elem(i);
1789  const GelemAttribs *a = dynamic_cast<const GelemAttribs*>(masterel->give_elemAttribs()); if (!a) errol;
1790 
1791  if (masterel->give_classid() == classPolyLine || masterel->give_classid() == classLine) {
1792  if (masterel->give_nno()-2)
1793  Elems.reallocplus(masterel->give_nno()-2);
1794 
1795  for (j=0; j<masterel->give_nno()-1; j++) {
1796  elem = new Beam (Elems(), Elems(), this, false, 0, Elems());
1797  ((FElement*)elem)->attributes_allocation(a);
1798 
1799  // nodes
1800  if (elem->give_nno() != 2) errol;
1801  elem->set_node(0, masterel->give_point(j )->give_ID());
1802  elem->set_node(1, masterel->give_point(j+1)->give_ID());
1803 
1804  elem->set_model_prop(i+1, Master, false);
1805  Elems.add(elem);
1806  }
1807  }
1808  else errol;
1809  }
1810 
1813 }
1814 
1815 
1816 //* ************************************
1817 //* *** READING OF GEOMETRY MESH ***
1818 //* ************************************
1822 void Mesh :: read_mesh_OOFEM (FILE *stream, long nn, long ne)
1823 {
1824  // variable declaration
1825  long i;
1826  const char *str;
1827  char LINE[1023];
1828  femFileFormat fff = FFF_OOFEM;
1829  char WORD[255];
1830 
1831 
1832  //* NODES
1833  //
1834  Pjnts.reallocup(nn);
1835  for (i=0; i<nn; i++) {
1836  FP_scan_line_skip_emptyORcommented (stream, LINE); str=LINE;
1837  SP_scan_word (str, WORD);
1838  SP_scan_expected_number_exit (str, i+1, "Invalid structure of OOFEM input file");
1839 
1840  if (STRCMP(WORD, "Node" ) == 0) Pjnts.add((Point*)new Node (this, i, NULL));
1841  else if (STRCMP(WORD, "RigidArmNode") == 0) Pjnts.add((Point*)new RigidArmNode (this, i, NULL));
1842  else if (STRCMP(WORD, "HangingNode" ) == 0) Pjnts.add((Point*)new HangingNode (this, i, NULL));
1843  else _errorr2("Unknown OOFEM node type %s", WORD);
1844 
1845  Nodes(i)->read_input (str, fff);
1846  }
1847 
1848  //* ELEMENTS
1849  FiniteElementTypeSet fets;
1850  //
1851  Elems.reallocup(ne);
1852  for (i=0; i<ne; i++) {
1853  FP_scan_line_skip_emptyORcommented (stream, LINE); str=LINE;
1854  SP_scan_word (str, WORD);
1855  SP_scan_expected_number_exit (str, i+1, "Invalid structure of OOFEM input file");
1856  //
1857 
1858  FETSet_si2set (WORD, 0, SOL_OOFEM, Pd->give_analgroup(), &fets);
1859 
1860  Elems.add( allocate_element(false, fets.cg, Elems(), Elems(), this) );
1861 
1862  FElems(i)->give_elemAttribs()->set_FETS(&fets);
1863  FElems(i)->read_input (str, fff);
1864  }
1865 }
1866 
1867 //* ************************************
1868 //* *** READING OF GEOMETRY MESH ***
1869 //* ************************************
1873 void Mesh :: read_mesh_SIFEL (FILE *stream)
1874 {
1875  // variable declaration
1876  long i, nn, ne;
1877  const char *str;
1878  char LINE[1023];
1879  femFileFormat fff = FFF_SIFEL;
1880  int auxi;
1881 
1882 
1883  //* NODES
1884  FP_skip_comment(stream); fscanf (stream, "%ld", &nn);
1885  Pjnts.reallocup(nn);
1886  for (i=0; i<nn; i++) {
1887  FP_scan_line_skip_emptyORcommented (stream, LINE); str=LINE;
1888  SP_skip_word (str, 4); SP_scan_number (str, auxi); str=LINE;
1889  SP_scan_expected_number_exit (str, i+1, "Invalid structure of SIFEL input file");
1890 
1891  if (auxi > 0) Pjnts.add((Point*)new Node (this, i, NULL));
1892  else if (auxi < 0) Pjnts.add((Point*)new HangingNode (this, i, NULL));
1893  else _errorr("Unknown SIFEL node");
1894 
1895  Nodes(i)->read_input (str, fff);
1896  }
1897 
1898  //* CONSTRAINED NODES
1899  long id;
1900  FP_skip_comment(stream); fscanf (stream, "%ld", &nn);
1901  for (i=0; i<nn; i++) {
1902  fscanf (stream, "%ld", &id); id--;
1903  FP_scan_line (stream, LINE);
1904  Nodes(id)->give_pointAttribs()->set_dofbc(LINE, fff);
1905  }
1906 
1907  //* ELEMENTS
1908  FiniteElementTypeSet fets;
1909  FP_skip_comment(stream); fscanf (stream, "%ld", &ne);
1910  Elems.reallocup(ne);
1911  for (i=0; i<ne; i++) {
1912  FP_scan_line_skip_emptyORcommented (stream, LINE); str=LINE;
1913  //
1914  SP_scan_expected_number_exit (str, i+1, "Invalid structure of OOFEM input file");
1915  SP_scan_number (str, auxi);
1916 
1917  FETSet_si2set (NULL, auxi, SOL_SIFEL, Pd->give_analgroup(), &fets);
1918 
1919  Elems.add( allocate_element(false, fets.cg, Elems(), Elems(), this) );
1920 
1921  FElems(i)->give_elemAttribs()->set_FETS(&fets);
1922  FElems(i)->read_input (str, fff);
1923  }
1924 }
1925 
1926 
1927 //* ************************************
1928 //* *** READING OF GEOMETRY MESH ***
1929 //* ************************************
1933 void scan_expect_num (FILE *stream, long expctd)
1934 {
1935  long aux;
1936  fscanf (stream, "%ld", &aux);
1937  if ( aux != expctd)
1938  _errorr3 ("Invalid structure of the given UNV file: actual != expected -- %ld != %ld", aux, expctd);
1939 }
1940 
1941 void Mesh :: read_mesh_UNV (char *path, const char *filename)
1942 {
1943  // open file
1944  FILE *in = _openFilePN("r", "Mesh", path, filename);
1945 
1946  // variable declaration
1947  long auxl, nn, te, id, j, domid;
1948  PoinT coord;
1949  FElement *elem = NULL;
1950  //
1951  domid=0;
1952 
1953 
1954  // GET NUMBER OF LINES
1955  auxl = FP_number_of_lines (in, true);
1956 
1957  Pjnts.reallocup(auxl);
1958  Elems.reallocup(auxl);
1959 
1960  //* nodes
1961  scan_expect_num (in, -1);
1962  scan_expect_num (in, 2411);
1963 
1964  id=0;
1965  while (true) {
1966  fscanf (in, "%ld", &auxl);
1967  if (auxl == -1) break;
1968  if (auxl != id+1) _errorr ("Invalid structure of the given UNV file");
1969 
1970  scan_expect_num (in, 1);
1971  scan_expect_num (in, 1);
1972  scan_expect_num (in, 11);
1973 
1974  coord.scan_xyz (in);
1975  Pjnts.add( allocate_point (id, &coord) );
1976 
1977  id++;
1978  }
1979 
1980  //* elements
1981  scan_expect_num (in, -1);
1982  scan_expect_num (in, 2412);
1983 
1984  id=0;
1985  while (true) {
1986  fscanf (in, "%ld", &auxl);
1987  if (auxl == -1) break;
1988  //if (auxl != id-1) _errorr ("Invalid structure of the given UNV file");
1989 
1990  fscanf (in,"%ld %ld %ld %ld %ld", &te, &auxl, &auxl, &auxl, &nn);
1991  switch (te) {
1992  case 21: elem = new Beam (id, id, this, true, domid, id); fscanf (in,"%ld %ld %ld", &auxl, &auxl, &auxl); break;
1993  case 91: elem = new Triangle (id, id, this, true, domid, id); break;
1994  default: _errorr3 ("Unknown %ld-th \"fe descriptor id\": %ld", id+1, te);
1995  }
1996 
1997  // nodes
1998  if (elem->give_nno() != nn) errol;
1999  for (j=0; j<nn; j++) { fscanf (in, "%ld", &auxl); elem->set_node(j, auxl-1); }
2000 
2001  Elems.add(elem);
2002 
2003  id++;
2004  }
2005 
2006  if (EOF != fscanf (in, "%ld", &auxl)) errol;
2007 
2008  fclose (in);
2009 }
2010 
2011 
2012 
2013 //* *****************************************************************************************
2014 //* *** READING OF RESULTS ***
2015 //* *****************************************************************************************
2019 {
2020  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "Reading of analysis output file");
2021 
2022  const FiLe *file;
2023 
2024  //* MAIN OUTPUT
2025  file = Pd->give_IN_file_results();
2026 
2027  if (file == NULL) errol;
2028 
2029  switch (file->give_ff()) {
2030  case FFF_OOFEM: this->read_output_OOFEM (); break;
2031  case FFF_SIFEL: this->read_output_SIFEL (); break;
2032  default: _errorr2 ("Unsuppoted type of output file from structural analysis package, type %ld", file->give_ff());
2033  }
2034 
2035  //* ADDITIONAL OUTPUT
2037 
2038  if (file)
2039  this->read_addata_VTK (file->give_name(), false);
2040 
2041 
2043 }
2044 
2045 
2046 long give_nstepsOut (FILE *stream, femFileFormat ff, PAType pt, const Problem *Pd)
2047 {
2048  char c;
2049  long answer = 0;
2050  long pos = 100;
2051 
2052  if (ff == FFF_OOFEM) {
2053  while (answer == 0) {
2054  if (Pd->solver_file_ptr) return 1;
2055 
2056  //if (Pd->solver_disk_write) {
2057  // if (fseek(stream, -pos, SEEK_END) != 0) _errorr ("There is no complete data of one time step in OOFEM output file");
2058  //}
2059  //else {
2060  // return 1;
2061  // // fseek nejak nefunguje nebo co
2062  // if (fseek(stream, pos, SEEK_CUR) != 0)
2063  // _errorr ("There is no complete data of one time step in OOFEM output file");
2064  //}
2065  //
2066 
2067  if (fseek(stream, -pos, SEEK_END) != 0) _errorr ("There is no complete data of one time step in OOFEM output file");
2068 
2069  FP_skip_line(stream);
2070 
2071  while (true) {
2072  c = fgetc(stream);
2073  if ( c == 'U' &&
2074  FP_scan_expected_word (stream, "ser") &&
2075  FP_scan_expected_word (stream, "time") &&
2076  FP_scan_expected_word (stream, "consumed") &&
2077  FP_scan_expected_word (stream, "by") &&
2078  FP_scan_expected_word (stream, "solution") &&
2079  FP_scan_expected_word (stream, "step"))
2080  fscanf (stream, "%ld", &answer);
2081 
2082  if (c == '\n') continue;
2083  if (! FP_skip_line(stream)) break;
2084  }
2085 
2086  pos = 1.9 * pos;
2087  }
2088  }
2089  else if (ff == FFF_SIFEL) {
2090  switch (pt) {
2091  case PAT_static_linear: answer = 1; break;
2092  case PAT_stationary: answer = 1; break;
2093  case PAT_nonstationary:
2094  while (answer == 0) {
2095  if (fseek(stream, -pos, SEEK_END) != 0) _errorr ("There is no complete data of one time step in SIFEL output file");
2096 
2097  while (true) {
2098  // go to new line
2099  FP_skip_line(stream);
2100  // go to the line starting with '*'
2101  if (! FP_skip_to_line_starting_with(stream, '*')) break;
2102 
2103  FP_skip_line(stream);
2104  if ( FP_scan_expected_word (stream, "Step") &&
2105  FP_scan_expected_word (stream, "number=") )
2106  fscanf (stream, "%ld", &answer);
2107  }
2108 
2109  pos = 1.9 * pos;
2110  }
2111  answer++;
2112  break;
2113  default: _errorr2("Unknown problem type %d", (int)pt);
2114  }
2115  }
2116  return answer;
2117 }
2118 
2121 {
2122  if (rslts_solver != SOL_Void) errol;
2124 
2125  double auxd;
2126  PAType pt = Pd->give_analloctype();
2127 
2128  // stability in oofem runs only for 1d elements
2130  pt = PAT_static_linear;
2131 
2132  // open file
2133  const char* name = Pd->give_IN_file_results()->give_name_or_null();
2134  if (name == NULL) name = Pd->give_output_file();
2135  FILE *in;
2136  //if (Pd->solver_file_ptr) in = fmemopen(Pd->solver_file_ptr, Pd->solver_file_size, "r");
2137  //else
2138  if (name != NULL) in = _openFilePN ("r", "Mesh", Pd->give_OUT_Path(), name);
2139  else in = _openFilePNS ("r", "Mesh", Pd->give_OUT_Path(), Pd->give_OUT_moFILE()->give_name(), ".oofem.out");
2140 
2141  if (Pd->give_nsteps() == 1) rslts_nsteps = 1;
2142  else {
2144  rewind(in);
2145  }
2146 
2147  rslts_step = new Lvctr(rslts_nsteps);
2149 
2150 
2151  //* START READING
2152  FP_skip_line (in, 5);
2153  FP_scan_expected_word_exit(in, "# # # # # # # # OOFEM ver.", "Invalid structure of OOFEM output file", false);
2154  fscanf (in, "%lf", &auxd);
2155  ((Problem*)Pd)->set_OOFEM_ver((int)(auxd*10));
2156 
2157  FP_skip_line (in, 8);
2158 
2159  long i, s;
2160  for (s=0; s<rslts_nsteps; s++) {
2161  if (pt == PAT_static_nonlinear) {
2162  if (! FP_skip_to_line_starting_with (in, "Output for time", true)) _errorr("Invalid structure of OOFEM output file");
2163  fscanf (in, "%lf", &auxd);
2164  if (! FP_skip_expected_string (in, ", solution step number", true)) _errorr("Invalid structure of OOFEM output file");
2165  fscanf (in, "%ld", &((*rslts_step)[s]));
2166  FP_skip_line (in, 1);
2167  if (! FP_skip_expected_string (in, "Reached load level :", true)) _errorr("Invalid structure of OOFEM output file");
2168  fscanf (in, "%lf", &((*rslts_loadlevel)[s]));
2169  }
2170 
2171 
2172  // *** NODES ***
2173  if (pt == PAT_stability_linear) { if (! FP_skip_behind_line_starting_with (in, "Linear static:", true)) _errorr("Invalid structure of OOFEM output file"); }
2174  else { if (! FP_skip_behind_line_starting_with (in, "DofManager output:", true)) _errorr("Invalid structure of OOFEM output file"); }
2175  FP_skip_line (in, 1);
2176  RTN[RTN_displacement] = true;
2177 
2178  for (i=0; i<Pjnts(); i++) Nodes(i)->read_output_OOFEM (in, s, RTN_displacement);
2179 
2180 
2181  // *** ELEMENTS ***
2182  if (pt != PAT_stability_linear) {
2183  if (! FP_skip_behind_line_starting_with (in, "Element output:", true)) _errorr("Invalid structure of OOFEM output file");
2184  FP_skip_line (in, 1);
2185  }
2186  RTE[RTE_global_strain] = true;
2187  RTE[RTE_global_stress] = true;
2188 
2189  for (i=0; i<Elems(); i++) FElems(i)->read_output_OOFEM (in, s);
2190 
2191 
2192  // *** REACTIONS ***
2193  if (! FP_skip_behind_line_starting_with (in, "\tR E A C T I O N S O U T P U T:", true)) _errorr("Invalid structure of OOFEM output file");
2194  FP_skip_line (in, 3);
2195  RTN[RTN_reaction] = true;
2196 
2197  for (i=0; i<Pjnts(); i++) Nodes(i)->read_output_OOFEM (in, s, RTN_reaction);
2198  }
2199 
2200  if (pt == PAT_stability_linear) {
2201  if (! FP_skip_behind_line_starting_with (in, "Eigen Values are:", true)) _errorr("Invalid structure of OOFEM output file");
2202  FP_skip_line (in);
2203  fscanf (in, "%lf", &critical_coeff);
2204  }
2205 
2206  //
2207  fclose (in);
2208 }
2209 
2212 {
2213  if (rslts_solver != SOL_Void) errol;
2215 
2216  //double auxd;
2217  //* temporary, see read_output_OOFEM
2218  bool nonlin = false;
2219  if (Pd->give_analtype() == PAT_nonstationary) nonlin = true;
2220 
2221  // open file
2222  const char* name = Pd->give_IN_file_results()->give_name_or_null();
2223  if (name == NULL) name = Pd->give_output_file();
2224  if (name == NULL) errol;
2225  FILE *in = _openFilePN("r", "Mesh", Pd->give_OUT_Path(), name);
2226 
2227  // nsteps
2229  rslts_step = new Lvctr(rslts_nsteps);
2230  if (nonlin) rslts_loadlevel = new Dvctr(rslts_nsteps);
2231  rewind(in);
2232 
2233  // READ
2234  bool skip = false;
2235  long i, s, auxl;
2236  char LINE[1023];
2237  if (nonlin) s = -1; // nonlin
2238  else s = 0; // lin
2239  while (true) {
2240  if (! FP_skip_to_line_starting_with (in, "**", true)) break;
2241 
2242  if (fgetc(in) == '*') {
2243  FP_skip_line (in);
2244  if (! FP_scan_expected_word (in, "Step") ) _errorr("Invalid structure of SIFEL output file");
2245  if (! FP_scan_expected_word (in, "number=")) _errorr("Invalid structure of SIFEL output file");
2246  fscanf (in, "%ld", &auxl);
2247  skip = (s == auxl) ? true : false;
2248  s = auxl;
2249  FP_skip_line (in, 2);
2250  continue;
2251  }
2252  if (skip) continue;
2253  if (s==-1) _errorr("Invalid structure of SIFEL output file");
2254 
2255  FP_scan_line (in, LINE);
2256  if (LINE[strlen(LINE)-1] != ':') _errorr("Invalid structure of SIFEL output file");
2257 
2258  if (strcmp(LINE, "Nodal displacements:") == 0) { RTN[RTN_displacement] = true; FP_skip_line (in, 1); for (i=0; i<Pjnts(); i++) Nodes(i)->read_output_SIFEL (in, s, RTN_displacement); }
2259  else if (strcmp(LINE, "Reactions:" ) == 0) { RTN[RTN_reaction] = true; FP_skip_line (in, 1); for (i=0; i<Pjnts(); i++) Nodes(i)->read_output_SIFEL (in, s, RTN_reaction); }
2260  else if (strcmp(LINE, "Element strains:" ) == 0) { RTE[RTE_global_strain] = true; FP_skip_line (in, 1); for (i=0; i<Elems(); i++) FElems(i)->read_output_SIFEL (in, s, RTE_global_strain); }
2261  else if (strcmp(LINE, "Element stresses:" ) == 0) { RTE[RTE_global_stress] = true; FP_skip_line (in, 1); for (i=0; i<Elems(); i++) FElems(i)->read_output_SIFEL (in, s, RTE_global_stress); }
2262  else if (strcmp(LINE, "Nodal unknowns :" ) == 0) { RTN[RTN_transpunknowns] = true; FP_skip_line (in, 1); for (i=0; i<Pjnts(); i++) Nodes(i)->read_output_SIFEL (in, s, RTN_transpunknowns); }
2263  else if (strcmp(LINE, "Element gradients :" ) == 0) { RTE[RTE_gradient] = true; FP_skip_line (in, 1); for (i=0; i<Elems(); i++) FElems(i)->read_output_SIFEL (in, s, RTE_gradient); }
2264  else if (strcmp(LINE, "Element fluxes :" ) == 0) { RTE[RTE_fluxes] = true; FP_skip_line (in, 1); for (i=0; i<Elems(); i++) FElems(i)->read_output_SIFEL (in, s, RTE_fluxes); }
2265  else _errorr2("Unsuported section in SIFEL output file, \"%s\"", LINE);
2266  }
2267 
2268  //
2269  fclose (in);
2270 }
2271 
2272 // //* ************************************
2273 // //* *** READING OF GEOMETRY MESH ***
2274 // //* ************************************
2275 // /**
2276 // cte VLNA soubory, zatim omezene
2277 // */
2278 // void Mesh :: read_mesh_VLNA (char *path, char *filename)
2279 // {
2280 // // open file
2281 // FILE *in = _openFilePN("r", "Mesh", path, filename);
2282 //
2283 // // variable declaration
2284 // long i,domid,auxl,nb;
2285 // double coord[3];
2286 // //
2287 // domid=0;
2288 //
2289 //
2290 // //* *** POINTS ***
2291 // // head
2292 // fscanf (in,"%ld",&Nn); FP_skip_line (in);
2293 // Pjnts = new Node* [Nn];
2294 // // coords
2295 // for (i=0; i<Nn; i++) {
2296 // FP_scan_array (in, coord, 3);
2297 // Pjnts[i] = allocate_Point (i, 0, coord);
2298 // }
2299 //
2300 // //* *** ELEMENTS ***
2301 // fscanf (in,"%ld",&Ne);
2302 // Elems = new FElement* [Ne];
2303 // for (i=0; i<Ne; i++) {
2304 // Elems[i] = new Beam (i,this,domid,i);
2305 // // nodes
2306 // fscanf (in,"%ld", &auxl); Elems[i]->set_node(0, auxl);
2307 // fscanf (in,"%ld", &auxl); Elems[i]->set_node(1, auxl);
2308 // }
2309 //
2310 // //* *** BOUNDARY ***
2311 // int ndofs = 6;
2312 // int *bc0 = new int[ndofs]; fill_all_by (bc0, (long)ndofs, 0);
2313 // int *bc1 = new int[ndofs]; fill_all_by (bc1, (long)ndofs, 1);
2314 //
2315 // //
2316 // fscanf (in,"%ld",&nb);
2317 // //
2318 // for (i=0; i<nb; i++) {
2319 // fscanf (in,"%ld",&auxl);
2320 // Pjnts[auxl]->initialize_BC(ndofs, bc1);
2321 // }
2322 //
2323 // for (i=0; i<Nn; i++)
2324 // if (NULL == Pjnts[i]->give_BC() )
2325 // Pjnts[i]->initialize_BC(ndofs, bc0);
2326 //
2327 //
2328 // //* *** SNIH - zatizeni ***
2329 // fscanf (in,"%ld",&nb);
2330 // //
2331 // for (i=0; i<nb; i++) {
2332 // fscanf (in,"%ld",&auxl);
2333 // Pjnts[auxl]->set_prop(1);
2334 // }
2335 //
2336 //
2337 // //
2338 // fclose (in);
2339 // }
2340 
2341 
2343 {
2344  long i, j;
2345  const GeometryComponent *comp;
2346 
2347  PoinT nc;
2348 
2349  for (i=0; i<Elems(); i++) {
2350  if (! Elems[i]->give_elemAttribs()->give_HNmstr()) continue;
2351 
2352  for (j=0; j<Pjnts(); j++) {
2353  if (! Elems[i]->is_point_on (Pjnts[j]->give_coords(), comp, &nc) ) continue;
2354 
2355  switch (comp->give_classid()) {
2356  case classNode: errol; break;
2357  case classEdge:
2358  //this->node_to_hn (j, comp, nc);
2359  errol;
2360 
2361  break;
2362  default: errol;
2363  }
2364 
2365  }
2366  }
2367 }
2368 
2369 
2371 template <class T>
2372 void TF_GPA_cleanup_duplicity (const StdoutDriver *sodriver, T &list, const char *name, char t, bool shake)
2373 {
2374  sodriver->print_info_message (SODE_start_blue_arrow, "Cleaning of %s duplicities", name);
2375 
2376  long i, nd=0;
2377  for (i=list()-1; i>=0; i--)
2378  if ( list[i] && list[i]->invisible_duplicated(t) ) {
2379  list.delete_object(i);
2380  nd++;
2381  }
2382 
2383  // shake
2384  if (shake) TF_GPA_shake_down_reidoid(list);
2385 
2386  sodriver->print_info_message (SODE_end, "%d", nd);
2387 }
2388 
2391 {
2392  this->connectivity_assembling ();
2393 
2394  if (Pd->give_PDBO (PDBO_MultipNode)) {
2395  this->check_duplicity_nodes();
2396  TF_GPA_cleanup_duplicity (Pd->sodriver(), Pjnts, "nodes", 'a', true );
2397 
2398  ((Problem*)Pd)->set_PDBO (PDBO_MultipNode, false);
2399  }
2400 
2401  if (Pd->give_PDBO (PDBO_MultipElem)) {
2402  //* do not change the order of following
2403  TF_GPA_cleanup_duplicity (Pd->sodriver(), Elems, "elements - collapsed", 'c', false);
2404  TF_GPA_cleanup_duplicity (Pd->sodriver(), Elems, "elements - duplicated", 'r', true );
2405  TF_GPA_cleanup_duplicity (Pd->sodriver(), Faces, "faces", 'a', true );
2406  TF_GPA_cleanup_duplicity (Pd->sodriver(), Edges, "edges", 'a', true );
2407 
2408  ((Problem*)Pd)->set_PDBO (PDBO_MultipElem, false);
2409  }
2410 }
2411 
2412 
2415 {
2416  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "Checking of node duplicities");
2417 
2418  //
2419  long i,j;
2420  double circum;
2421 
2422  long Nn = Pjnts();
2423  long Ne = Elems();
2424 
2425  // compute average circum
2426  circum = 0.0;
2427  for (i=0; i<Ne; i++)
2428  circum += Elems[i]->give_circum();
2429  circum = circum/Ne;
2430 
2431  // ALLOC DP
2432  DuplicatePoints *dp = new DuplicatePoints(Nn, circum, ZERO_NC);
2433 
2434  // set up coords in dp
2435  for (i=0; i<Nn; i++)
2436  dp->set_point (i, Pjnts[i]->give_coords() );
2437 
2438  // allocate duplicity arrays
2439  long nd;
2440  long *Cduplicity, **duplicity;
2441 
2442  Cduplicity = new long[Nn/2];
2443  duplicity = new long*[Nn/2]; for (i=0; i<Nn/2; i++) duplicity[i] = NULL;
2444 
2445  dp->assign_cellpoints();
2446  dp->find_duplicitys(nd, Cduplicity, duplicity);
2447 
2448  // save duplicities on nodes
2449  for (i=0; i<nd; i++) {
2450  // check the nodes in duplicity squad are not hanging/rigidarm type
2451  for (j=0; j<Cduplicity[i]; j++)
2452  if (Pjnts[duplicity[i][j]]->give_classid() != classNode)
2453  _errorr ("The duplicated node %ld is not pure node, is hanging node or what");
2454 
2455  // save of particular nodes
2456  for (j=1; j<Cduplicity[i]; j++)
2457  Nodes(duplicity[i][j]) -> setup_duplicity_master( Nodes(duplicity[i][0]) );
2458 
2459  }
2460 
2461  // DELETE DP
2462  delete dp;
2463  deallocateCheck (Cduplicity);
2464  deallocateCheck ( duplicity, Nn/2, false);
2465 
2466  Pd->sodriver()->print_info_message (SODE_end, "found nnd = %d", nd);
2467 }
2468 
2469 
2472 {
2473  this->connectivity_assembling ();
2474 
2475  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "Subdomain finding");
2476 
2477  long Nn = Pjnts();
2478  long i, nn, level;
2479  long *cnisd = new long[Nn];
2480 
2481  cSubDomains = 0;
2482  cnisd[cSubDomains] = 0;
2483 
2484  level = 0;
2485  while (true) {
2486  nn = 0;
2487  for (i=0; i<Nn; i++) {
2488  if (level && Pjnts[i]->give_subdom() != -2) continue;
2489 
2490  Nodes(i)->find_parent_subdom (cSubDomains, &nn, &level);
2491 
2492  if (nn) {
2493  cnisd[cSubDomains] += nn;
2494  nn = 0;
2495  if (level == 0)
2496  cnisd[++cSubDomains] = 0;
2497  }
2498  }
2499  //printf ("level %ld;", level);
2500  if (level) {
2501  if (--level) level = 1;
2502  else cnisd[++cSubDomains] = 0;
2503  }
2504 
2505  for (i=0; i<cSubDomains; i++)
2506  nn += cnisd[i];
2507 
2508  //printf ("level %ld; nn = %ld(%ld); cSubDomains = %ld \n", level, nn, Nn, cSubDomains);
2509 
2510  if (nn == Nn) break;
2511  }
2512 
2513  cNodesInSD = new long[cSubDomains];
2514  for (i=0; i<cSubDomains; i++)
2515  cNodesInSD[i] = cnisd[i];
2516 
2517  delete [] cnisd;
2518 
2519  Pd->sodriver()->print_info_message (SODE_end, "%ld", cSubDomains);
2520 }
2524 {
2525  long i,j;
2526 
2527  for (i=0; i<Pjnts(); i++)
2528  if ( Pjnts[i]->give_subdom() != leave ) {
2529  for (j=0; j<Nodes(i)->give_numsuperedge(); j++) ((Edge* )Nodes(i)->give_superedge(j))->set_delete_flag(true);
2530  for (j=0; j<Nodes(i)->give_numsuperface(); j++) ((Face* )Nodes(i)->give_superface(j))->set_delete_flag(true);
2531  for (j=0; j<Nodes(i)->give_numsuperelem(); j++) ((FElement*)Nodes(i)->give_superelem(j))->set_delete_flag(true);
2532  Nodes(i)->set_delete_flag(true);
2533  }
2534 
2535  TF_GPA_delete_damned (Pjnts);
2539 }
2540 
2541 
2543 //void Mesh :: delete_cmfrs (void)
2544 //{
2545 // Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "Camfours finding");
2546 //
2547 // this->init_connectivity ();
2548 //
2549 // long i;
2550 // long nCmfrs;
2551 //
2552 // nCmfrs = 0;
2553 // for (i=0; i<Elems(); i++)
2554 // // zjisti zda aspon jeden konec prutu se nedotyka pouze jednoho dalsiho
2555 // if ( Elems[i]->is_cmfr() ) {
2556 // nCmfrs++;
2557 // }
2558 //
2559 // print_info_message ('e',ETC_DEFAULT,"%ld form %ld", nCmfrs, Elems());
2560 //}
2561 
2562 
2564 //void Mesh :: vlna (void)
2565 //{
2566 // //
2567 // if (! Pd->give_PDBO(PDBO_Vlna)) return;
2568 // //
2569 // printf ("VLNA\n");
2570 //
2571 // //
2572 // long i;
2573 // long Nn = Pjnts();
2574 // Lvctr *nodevars = new Lvctr(Nn);
2575 //
2576 // // *** property == snih ***
2577 // if (0) {
2578 // for (i=0; i<Nn; i++)
2579 // nodevars[0](i) = Pjnts[i]->give_property();
2580 // //
2581 // this->print_VTK_PD_scal (false, ".snih", "snih", (const Xvctr**)&nodevars);
2582 // exit (0);
2583 // }
2584 //
2585 // delete nodevars;
2586 //
2587 // ///* *** nalezeni subdomen a tisk trojbarevne ***
2588 // //if (0) {
2589 // //long *nsups;
2590 // // this->find_subdomains();
2591 // // // nalezeni podepreni
2592 // // allocate (nsups, cSubDomains);
2593 // // fill_all_by (nsups, cSubDomains, (long)0);
2594 // // for (i=0; i<Nn; i++)
2595 // // if ( Pjnts[i]->give_BC()[0] )
2596 // // nsups[Pjnts[i]->give_subdom()] ++;
2597 // //
2598 // // long nonsupSD = 0;
2599 // // for (i=0; i<cSubDomains; i++)
2600 // // if (nsups[i] == 0)
2601 // // nonsupSD++;
2602 // //
2603 // //
2604 // // // info tisk
2605 // // printf ("Pocet segmentu: %ld\n", cSubDomains);
2606 // // printf ("Pocet nepodeprenych segmentu: %ld\n", nonsupSD);
2607 // //
2608 // // //* aux print
2609 // // FILE *out = fopen ("aux.txt","w"); openFileTest (out,"txt file");
2610 // // for (i=0; i<cSubDomains; i++) fprintf (out,"%ld\n", cNodesInSD[i]);
2611 // // fclose (out);
2612 // //
2613 // // // tisk trojbarevne
2614 // // for (i=0; i<Nn; i++)
2615 // // if ( Pjnts[i]->give_subdom() == 0) nodevars[i] = 1; // klenbova subdomena
2616 // // else {
2617 // // if (nsups[Pjnts[i]->give_subdom()]) nodevars[i] = 2; // dalsi SD - podeprene
2618 // // else nodevars[i] = 3; // dalsi SD - nepodeprene
2619 // // }
2620 // //
2621 // // //
2622 // // this->print_VTK (".trojbarevnej",1, &nodevars);
2623 // // exit (0);
2624 // //}
2625 //
2626 //
2627 //
2628 //
2629 // // *** nalezeni camfouru ***
2630 // if (0) {
2631 // while (true) {
2632 // this->delete_cmfrs();
2633 // this->kill_damned_elems();
2634 //
2635 // this->find_subdomains();
2636 // if (cSubDomains == 1) break;
2637 //
2638 // // najde nejvetsi subdomenu
2639 // long ind, max = 0;
2640 // for (i=0; i<cSubDomains; i++) if (cNodesInSD[i] > max) { max = cNodesInSD[i]; ind = i; }
2641 //
2642 // // smaze nejvetsi SD
2643 // this->delete_subdomains_except (ind);
2644 // // vynuluje SD
2645 // for (i=0; i<Nn; i++)
2646 // Pjnts[i]->set_subdom(-1);
2647 // cSubDomains = 0;
2648 // delete [] cNodesInSD;
2649 // }
2650 // printf ("\n Nn = %ld\n",Nn);
2651 // this->print_VTK (false, ".in");
2652 // }
2653 //
2654 //
2655 // // *** nalezeni camfouru ***
2656 // if (Pd->give_PDBO(PDBO_uncfrd)) {
2657 // this->delete_cmfrs();
2658 // this->kill_damned_elems();
2659 //
2660 // // tisk
2661 // Lvctr *elemvars = new Lvctr(Elems());
2662 // for (i=0; i<Elems(); i++)
2663 // if ( Elems[i]->give_delete_flag() ) elemvars[0](i) = 1;
2664 // else elemvars[0](i) = 0;
2665 //
2666 // this->print_VTK_CD_scal (false, ".camfour", "camfours", (const Xvctr**)&elemvars);
2667 // delete elemvars;
2668 // //exit (0);
2669 // }
2670 //
2671 // // *** nalezeni subdomen a smazani mimoklenbovych ***
2672 // if (1) {
2673 // this->find_subdomains();
2674 //
2675 // // najde nejvetsi subdomenu
2676 // long ind=0, max = 0;
2677 // for (i=0; i<cSubDomains; i++)
2678 // if (cNodesInSD[i] > max) {
2679 // max = cNodesInSD[i];
2680 // ind = i;
2681 // }
2682 //
2683 // // smaze nejvetsi SD
2684 // this->delete_subdomains_except (ind);
2685 // this->print_VTK (false, ".in");
2686 // }
2687 //
2688 // //
2689 // printf ("KONEC\n");
2690 // //exit (0);
2691 //}
2692 
2693 
2695 void Mesh :: sort_polydata (Xvctr *data) const
2696 {
2697  long li, pi;
2698  const_cast<Mesh*>(this)->give_vtk_polydata_counts (pi, li);
2699  li = 0;
2700 
2701  Xvctr *aux = NULL;
2702  if (dynamic_cast<Lvctr *>(data)) aux = new Lvctr((Lvctr *)data);
2703  if (dynamic_cast<Dvctr *>(data)) aux = new Dvctr((Dvctr *)data);
2704 
2705  for (long i=0; i<Elems(); i++)
2706  switch (this->give_VTKPDtopology_of_elem(i)) {
2707  case VTKPD_LINE: data->cpat(li++, aux, i); break;
2708  case VTKPD_POLYGON: data->cpat(pi++, aux, i); break;
2709  default: _errorr ("unsuported VTK cell type");
2710  }
2711 
2712  delete aux;
2713 }
2714 
2715 //* ***
2716 //* *** BC assign ***
2717 //* ***
2720 {
2721  Pjnts[id]->give_attributes()->add_load(bc);
2722 }
2725 {
2726  if (prop < 1) errol;
2727 
2728  for (long i=0; i<Pjnts(); i++)
2729  if (Pjnts[i]->give_mpropertyORzero() == prop)
2730  Pjnts[i]->give_attributes()->add_load(bc);
2731 }
2734 {
2735  // 0.1 je tam proto aby norm byl mensi nez vzdalenost pro duplicities
2736  double norm = 0.1 * this->give_aver_elem_circ ();
2737 
2738  for (long i=0; i<Pjnts(); i++)
2739  if (Pjnts[i]->is_identical_to (norm, coords))
2740  Pjnts[i]->give_attributes()->add_load(bc);
2741 }
2742 
2745 {
2746  Elems[id]->give_attributes()->add_load(bc);
2747 }
2750 {
2751  for (long i=0; i<Elems(); i++)
2752  if (Elems[i]->give_mpropertyORzero() == prop)
2753  Elems[i]->give_attributes()->add_load(bc);
2754 }
2755 
2757 void Geometry :: assign_EdgeLoad_by_elem_ID (const BoundaryCond* bc, long id, int indx)
2758 {
2759  if (indx == -1) { if (Elems[id]->give_ned() == 1) indx = 0; else _errorr("ConstantEdgeLoad at element with more than 1 edge"); }
2760  ((Edge*)Elems[id]->give_edge(indx))->give_attributes()->add_load(bc);
2761 }
2764 {
2765  for (long i=0; i<Elems(); i++)
2766  if (Elems[i]->give_mpropertyORzero() == prop) {
2767  if (Elems[i]->give_ned() != 1) _errorr("ConstantEdgeLoad at element with more than 1 edge");
2768  ((Edge*)Elems[i]->give_edge(0))->give_attributes()->add_load(bc);
2769  }
2770 }
2771 
2773 void Geometry :: assign_FaceLoad_by_elem_ID (const BoundaryCond* bc, long id, int indx)
2774 {
2775  if (indx == -1) { if (Elems[id]->give_nfa() == 1) indx = 0; else _errorr("ConstantFaceLoad at element with more than 1 face"); }
2776  ((Face*)Elems[id]->give_face(indx))->give_attributes()->add_load(bc);
2777 }
2780 {
2781  for (long i=0; i<Elems(); i++)
2782  if (Elems[i]->give_mpropertyORzero() == prop) {
2783  if (Elems[i]->give_nfa() != 1) _errorr("ConstantFaceLoad at element with more than 1 face");
2784  ((Face*)Elems[i]->give_face(0))->give_attributes()->add_load(bc);
2785  }
2786 }
2789 {
2790  for (long i=0; i<Faces(); i++)
2791  if (Faces[i]->give_mpropertyORzero() == prop)
2792  Faces[i]->give_attributes()->add_load(bc);
2793 }
2794 
2795 
2798 {
2799  DOFsPerNode answer, aux;
2800  answer = Elems[0]->give_elemAttribs()->give_dpn();
2801 
2802  for (long i=1; i<Elems() ; i++) {
2803  aux = Elems[i]->give_elemAttribs()->give_dpn();
2804 
2805  if (aux != answer)
2806  _errorr ("mismatch in DOFsPerNode");
2807  }
2808 
2809  return answer;
2810 }
2811 
2813 //void Mesh :: shake_nodes (void)
2814 //{
2815 // Node* node;
2816 //
2817 // node = Pjnts[0];
2818 //
2819 // for (long i=0; i<Nn-1; i++)
2820 // Pjnts[i] = Pjnts[i+1];
2821 //
2822 // Pjnts[Nn-1] = node;
2823 //}
2824 //
2825 //void Mesh :: shake_elements (void)
2826 //{
2827 // FElement* elem;
2828 //
2829 // elem = Elems[0];
2830 //
2831 // for (long i=0; i<Ne-1; i++)
2832 // Elems[i] = Elems[i+1];
2833 //
2834 // Elems[Ne-1] = elem;
2835 //}
2836 
2837 
2838 
2839 
2840 
2842 //void Mesh :: print_geom_info (void)
2843 // long i;
2844 // long nebe,ntrs,nshl,nhmt,nebr,nrbr,nqbr;
2845 // ; nebe=ntrs=nshl=nhmt=nebr=nrbr=nqbr=0;
2846 //
2847 // for (i=0; i<Ne; i++)
2848 // switch (Elems[i]->te){
2849 // case LiBeam: // 1
2850 // case Beam: nebe++; break; // 2
2851 // case Truss: ntrs++; break; // 3
2852 // case Shell: nshl++; break; // 31
2853 // case Quad1hmt: nhmt++; break; // 35
2854 // case Brick: nebr++; break; // 53
2855 // case RBrick: nrbr++; break; // 54
2856 // case QBrick: nqbr++; break; // 55
2857 // default: _errorr2 ("Unknown element type (element number %d) in function output_print", i+1);
2858 // }
2859 //
2860 // for (i=0;i<Np;i++){
2861 // ntrs += PolyLines[i]->give_nhn() - 1;
2862 // }
2863 //
2864 // ; fprintf (stdout,"\n Number of elems: %6ld\n",Ne);
2865 // if (nebe) fprintf (stdout, " Number of beams: %6ld\n",nebe);
2866 // if (ntrs) fprintf (stdout, " Number of trusses: %6ld\n",ntrs);
2867 // if (nshl) fprintf (stdout, " Number of Shells: %6ld\n",nshl);
2868 // if (nhmt) fprintf (stdout, " Number of Quad1hmt: %6ld\n",nhmt);
2869 // if (nebr) fprintf (stdout, " Number of bricks: %6ld\n",nebr);
2870 // if (nrbr) fprintf (stdout, " Number of Rbricks: %6ld\n",nrbr);
2871 // if (nqbr) fprintf (stdout, " Number of Qbricks: %6ld\n",nqbr);
2872 //}
2873 
2874 
2875 //* ********************************************************************************************
2876 //* *** *** *** *** OUTPUT FUNCTIONS *** *** *** ***
2877 //* ********************************************************************************************
2878 
2879 //* *************************************************
2880 //* *** *** BLOCKS PRINTING *** ***
2881 //* *************************************************
2882 
2884 void Mesh :: print_block_nodes (FILE *stream, femFileFormat fff, int did)
2885 {
2886  for (long i=0; i<Pjnts(); i++)
2887  if (Nodes(i)->give_lid_id(did) != -1)
2888  Nodes(i)->print_row (stream, fff, did);
2889 
2890 }
2892 void Mesh :: print_block_supported_dofs (FILE *stream, femFileFormat fff, int did)
2893 {
2894  if (fff == FFF_SIFEL) {
2895  long n = 0;
2896  for (long i=0; i<Pjnts(); i++)
2897  if (Nodes(i)->give_lid_id(did) != -1)
2898  if (Nodes(i)->give_pointAttribs()->is_supported())
2899  n++;
2900 
2901  fprintf (stream,"\n%ld\n", n);
2902  }
2903 
2904  if (fff == FFF_SIFEL || fff == FFF_ANSYS) {
2905  for (long i=0; i<Pjnts(); i++)
2906  if (Nodes(i)->give_lid_id(did) != -1)
2908  }
2909 }
2911 void Mesh :: print_block_elems (FILE *stream, femFileFormat fff, int did)
2912 {
2913  for (long i=0; i<Elems(); i++)
2914  if (FElems(i)->give_domain() == did)
2915  FElems(i)->print_row (stream, fff);
2916 
2917 }
2919 void Mesh :: print_block_nodal_load (FILE *stream, femFileFormat fff, int did)
2920 {
2921  if (fff == FFF_SIFEL) {
2922  long n = 0;
2923  for (long i=0; i<Pjnts(); i++)
2924  if (Nodes(i)->give_pointAttribs()->is_loaded())
2925  n++;
2926 
2927  fprintf (stream, "%ld\n", n);
2928  }
2929 
2930  if (fff == FFF_SIFEL || fff == FFF_ANSYS) {
2931  for (long i=0; i<Pjnts(); i++)
2932  Nodes(i)->give_pointAttribs()->print_bc(stream, fff);
2933  }
2934 }
2937 {
2938  const GPA<BoundaryCond>* bcs = Pd->give_BCs();
2939 
2940  for (long i=0; i<(*bcs)(); i++) {
2941  switch ((*bcs)[i]->give_loctype()) {
2942  case BC_PV: break;
2943  case BC_NL: break;
2944  case BC_DW:
2945  //if ((*bcs)[i]->give_ncomp() != 3) errol;
2946 
2947  //* all elements have to have dead weight load
2948  long j, k;
2949  for (j=0; j<Elems(); j++) {
2951  for (k=0; k<(*bbc)(); k++)
2952  if ((*bbc)[k] == (*bcs)[i])
2953  break;
2954 
2955  if (k == (*bbc)()) _errorr2("element %ld has no dead weight load assign", FElems(j)->give_ID()+1);
2956  }
2957 
2958  fprintf (stream, "ACEL");
2959  for (j=0; j<(*bcs)[i]->give_ncomp(); j++)
2960  fprintf (stream, ", %.6g", 9.81 * (*bcs)[i]->give_component(j));
2961 
2962  fprintf (stream, "\n\n");
2963  break;
2964  default: _errorr2("Unknown boundary condition type %d", (*bcs)[i]->give_loctype());
2965  }
2966  }
2967 }
2968 
2969 
2970 
2971 template <class T>
2972 void TF_GPA_print_list (FILE *stream, const char *name, const char *name2, T &list, long id)
2973 {
2974  fprintf (stream,"\n %s %5ld %s ", name, id+1, name2);
2975  for (long i=0; i<list(); i++)
2976  fprintf (stream," %ld", list[i]->give_ID()+1);
2977 }
2978 
2980 void Mesh :: print_control (FILE *conout) const
2981 {
2982  long i;
2983 
2984  fprintf (conout,"\n\n\n\n");
2985  fprintf (conout," N N OOOO DDDDD EEEEE SSSS \n");
2986  fprintf (conout," NN N O O D D E S S \n");
2987  fprintf (conout," N N N O O D D EEE SS \n");
2988  fprintf (conout," N N N O O D D EEE SS \n");
2989  fprintf (conout," N NN O O D D E S S \n");
2990  fprintf (conout," N N OOOO DDDDD EEEEE SSSS \n");
2991 
2992  fprintf (conout,"\n\n EDGES SUPERIOR TO NODE \n " ); for (i=0;i<Pjnts();i++) TF_GPA_print_list (conout, "node", "superior edges ", *give_Node(i)->give_superedges(), i);
2993  fprintf (conout,"\n\n ELEMENTS SUPERIOR TO NODE \n "); for (i=0;i<Pjnts();i++) TF_GPA_print_list (conout, "node", "superior elements ", *give_Node(i)->give_superelems(), i);
2994 
2995 
2996  fprintf (conout,"\n\n\n");
2997  fprintf (conout," EEEEE DDDDD GGGG EEEEE SSSS \n");
2998  fprintf (conout," E D D G G E S S \n");
2999  fprintf (conout," EEE D D G EEE SS \n");
3000  fprintf (conout," EEE D D G GGG EEE SS \n");
3001  fprintf (conout," E D D G G E S S \n");
3002  fprintf (conout," EEEEE DDDDD GGGG EEEEE SSSS \n");
3003 
3004  fprintf (conout,"\n\n NODES ON EDGE \n " ); for (i=0;i<Edges();i++) TF_GPA_print_list (conout, "edge", "nodes", *Edges[i]->give_points(), i);
3005  fprintf (conout,"\n\n FACES SUPERIOR TO EDGE \n " ); for (i=0;i<Edges();i++) TF_GPA_print_list (conout, "edge", "superior faces ", *Edges[i]->give_superfaces(), i);
3006  fprintf (conout,"\n\n ELEMENTS SUPERIOR TO EDGE \n "); for (i=0;i<Edges();i++) TF_GPA_print_list (conout, "edge", "superior elements ", *Edges[i]->give_superelems(), i);
3007 
3008 
3009  fprintf (conout,"\n\n\n");
3010  fprintf (conout," FFFFF AAAA CCCC EEEEE SSSS \n");
3011  fprintf (conout," F A A C C E S S \n");
3012  fprintf (conout," FFF A A C EEE SS \n");
3013  fprintf (conout," FFF AAAAAA C EEE SS \n");
3014  fprintf (conout," F A A C C E S S \n");
3015  fprintf (conout," F A A CCCC EEEEE SSSS \n");
3016 
3017  fprintf (conout,"\n\n NODES ON FACE \n " ); for (i=0;i<Faces();i++) TF_GPA_print_list (conout, "face", "nodes", *Faces[i]->give_points(), i);
3018  fprintf (conout,"\n\n EDGES ON FACE \n " ); for (i=0;i<Faces();i++) TF_GPA_print_list (conout, "face", "edges", *Faces[i]->give_edges(), i);
3019  fprintf (conout,"\n\n ELEMENTS SUPERIOR TO FACE \n "); for (i=0;i<Faces();i++) TF_GPA_print_list (conout, "face", "superior elements ", *Faces[i]->give_superelems(), i);
3020 
3021 
3022  fprintf (conout,"\n\n\n");
3023  fprintf (conout," EEEEE L EEEEE M M EEEEE N N TTTTTT SSSS \n");
3024  fprintf (conout," E L E MM MM E NN N TT S S \n");
3025  fprintf (conout," EEE L EEE M MM M EEE N N N TT SS \n");
3026  fprintf (conout," EEE L EEE M M EEE N N N TT SS \n");
3027  fprintf (conout," E L E M M E N NN TT S S \n");
3028  fprintf (conout," EEEEE LLLLL EEEEE M M EEEEE N N TT SSSS \n");
3029 
3030  fprintf (conout,"\n\n NODES ON ELEMENT \n "); for (i=0;i<Elems();i++) TF_GPA_print_list (conout, "element", "nodes", *Elems[i]->give_points(), i);
3031  fprintf (conout,"\n\n EDGES ON ELEMENT \n "); for (i=0;i<Elems();i++) TF_GPA_print_list (conout, "element", "edges", *Elems[i]->give_edges(), i);
3032  fprintf (conout,"\n\n FACES ON ELEMENT \n "); for (i=0;i<Elems();i++) TF_GPA_print_list (conout, "element", "faces", *Elems[i]->give_faces(), i);
3033 }
3034 
3035 
3036 
3037 //* ************************************************
3038 //* *** *** PRINTING VTK FILE *** ***
3039 //* ************************************************
3042 
3043 void Mesh :: resize_Lata (long newsize)
3044 {
3045  if (Lata.give_size() >= newsize) return;
3046 
3047  long oldsize = Lata.give_size();
3048  Lata.resize(newsize);
3049 
3050  for (; oldsize<newsize; oldsize++)
3051  Lata.assign(oldsize, new Lvctr);
3052 
3053 }
3054 
3055 void Mesh :: resize_Lata_members (long newsize)
3056 {
3057  if (Lata[0]->give_size() != newsize) {
3058  long i = Lata.give_size();
3059  while (i--)
3060  Lata[i]->resize_ignore_vals(newsize);
3061  }
3062 }
3063 
3064 void Mesh :: resize_Data (long newsize)
3065 {
3066  if (Data.give_size() >= newsize) return;
3067 
3068  long oldsize = Data.give_size();
3069  Data.resize(newsize);
3070 
3071  for (; oldsize<newsize; oldsize++)
3072  Data.assign(oldsize, new Dvctr);
3073 
3074 }
3075 
3076 void Mesh :: resize_Data_members (long newsize)
3077 {
3078  if (Data[0]->give_size() != newsize) {
3079  long i = Data.give_size();
3080  while (i--)
3081  Data[i]->resize_ignore_vals(newsize);
3082  }
3083 }
3084 
3085 
3086 
3087 //* *** START ***
3088 void print_VTK_START (Stream *stream, const Mesh *mg, const char *name, VTKdataset ds)
3089 {
3090  char *file = new char[1023];
3091 
3092  if (stream->isFile()) {
3093  if (mg->give_Pd()->give_OUT_Path()) sprintf (file, "%s%s%s%s", mg->give_Pd()->give_OUT_Path(), mg->give_Pd()->give_OUT_moFILE()->give_name(), name, ".vtk");
3094  else sprintf (file, "%s%s%s", mg->give_Pd()->give_OUT_moFILE()->give_name(), name, ".vtk");
3095  stream->open(STRM_file, "w", (const char *&)file);
3096  }
3097  else {
3098  // name
3099  if (mg->give_Pd()->give_OUT_Path()) sprintf (file, "%s%s%s", mg->give_Pd()->give_OUT_Path(), mg->give_Pd()->give_OUT_moFILE()->give_name(), name);
3100  else sprintf (file, "%s%s", mg->give_Pd()->give_OUT_moFILE()->give_name(), name);
3101 
3102  if (ds == VTKDS_polydata) strcat(file, ".vtp");
3103  else if (ds == VTKDS_unstruct) strcat(file, ".vtu");
3104  else _errorr ("unsuported DataSet");
3105 
3106  // xml document
3107  XMLDocument *doc = new XMLDocument(true, COLLAPSE_WHITESPACE);
3108 
3109  char auxs[20];
3110  if (ds == VTKDS_polydata) sprintf(auxs, "%s", "PolyData");
3111  else sprintf(auxs, "%s", "UnstructuredGrid");
3112 
3113  doc->InsertEndChild( doc->NewDeclaration() );
3114 
3115  XMLElement *VTKFile = doc->NewElement("VTKFile"); doc->InsertEndChild(VTKFile);
3116  VTKFile->SetAttribute("type", auxs);
3117  VTKFile->SetAttribute("version", "0.1");
3118  VTKFile->SetAttribute("byte_order", "LittleEndian");
3119 
3120  // initiate stream
3121  stream->open(STRM_tixel, "w", (const char *&)file, VTKFile -> InsertEndChild(doc->NewElement(auxs))->ToElement()->InsertEndChild(doc->NewElement("Piece")) );
3122  }
3123 
3124 }
3125 
3126 //* *** END ***
3127 void print_VTK_FINISH (Stream *stream)
3128 {
3129  stream->close();
3130 }
3131 
3132 //* *** HEAD ***
3133 void print_VTK_head (FILE *stream, VTKdataset ds)
3134 {
3135  fprintf (stream,"# vtk DataFile Version 3.0\n");
3136  fprintf (stream,"VTK file written by MIDAS\n");
3137  fprintf (stream,"ASCII\n");
3138  if (ds == VTKDS_polydata) fprintf (stream,"DATASET POLYDATA\n");
3139  else if (ds == VTKDS_unstruct) fprintf (stream,"DATASET UNSTRUCTURED_GRID\n");
3140  else _errorr ("unsuported dataset");
3141 }
3142 
3143 
3144 //* *** NODES ***
3145 void Mesh :: print_VTK_nodes (Stream *stream) const
3146 {
3147  XMLElement *da = NULL;
3148 
3149  if (stream->isFile())
3150  fprintf (stream->file(), "POINTS %ld float\n", Pjnts());
3151  else {
3152  stream->tixel()->ToElement()->SetAttribute("NumberOfPoints", (int)Pjnts());
3153  //
3154  da = stream->tix_doc()->NewElement("DataArray");
3155  da->SetAttribute("type", "Float32");
3156  da->SetAttribute("NumberOfComponents", "3");
3157  da->SetAttribute("format", "ascii");
3158 
3159  stream->tixel()->InsertEndChild(stream->tix_doc()->NewElement("Points") );
3160  stream->tixel()->LastChild()->InsertEndChild(da);
3161  }
3162 
3163  char auxs[255];
3164  for (long i=0; i<Pjnts(); i++) {
3165  Pjnts[i]->print_row_VTX (auxs);
3166 
3167  if (stream->isFile()) fprintf (stream->file(), "%s\n",auxs);
3168  else da->InsertEndChild( stream->tix_doc()->NewText(auxs) );
3169  }
3170 }
3171 //* *** ELEMENTS ***
3173 {
3174  if (ds == VTKDS_polydata) {
3175  long cl, cp;
3176  FElems(0)->Msh()->give_vtk_polydata_counts(cl, cp);
3177 
3178  if (stream->isFile()) {
3179  if (cl) {
3180  fprintf (stream->file(), "LINES %ld %ld\n", cl, cl*3);
3181  for (long i=0; i<Elems(); i++)
3182  if (VTKPD_LINE == Elems[i]->give_VTKPDtopology())
3183  Elems[i]->print_row_VTK (stream->file());
3184  }
3185 
3186  if (cp) {
3187  long nnumbs = 0;
3188  for (long i=0; i<Elems(); i++)
3189  if (VTKPD_POLYGON == Elems[i]->give_VTKPDtopology())
3190  nnumbs += Elems[i]->give_nno();
3191  fprintf (stream->file(), "POLYGONS %ld %ld\n", cp, cp + nnumbs);
3192  for (long i=0; i<Elems(); i++)
3193  if (VTKPD_POLYGON == Elems[i]->give_VTKPDtopology())
3194  Elems[i]->print_row_VTK (stream->file());
3195  }
3196  }
3197  else {
3198  stream->tixel()->SetAttribute("NumberOfVerts", 0 );
3199  stream->tixel()->SetAttribute("NumberOfLines", (int)cl);
3200  stream->tixel()->SetAttribute("NumberOfStrips", 0 );
3201  stream->tixel()->SetAttribute("NumberOfPolys", (int)cp);
3202 
3203  XMLElement *lines = stream->tix_doc()->NewElement("Lines"); stream->tixel()->InsertEndChild(lines);
3204  XMLElement *polys = stream->tix_doc()->NewElement("Polys"); stream->tixel()->InsertEndChild(polys);
3205 
3206  XMLElement *dalc = stream->tix_doc()->NewElement("DataArray"); lines->InsertEndChild(dalc);
3207  dalc->SetAttribute("format", "ascii");
3208  dalc->SetAttribute("type", "Int32");
3209  dalc->SetAttribute("Name", "connectivity");
3210 
3211  XMLElement *dalo = (XMLElement*)dalc->ShallowClone(NULL); lines->InsertEndChild(dalo);
3212  dalo->SetAttribute("Name", "offsets");
3213 
3214  XMLElement *dapc = (XMLElement*)dalc->ShallowClone(NULL); polys->InsertEndChild(dapc);
3215  XMLElement *dapo = (XMLElement*)dalo->ShallowClone(NULL); polys->InsertEndChild(dapo);
3216 
3217  char auxs[255];
3218  long offl=0, offp=0;
3219  for (long i=0; i<Elems(); i++) {
3220  Elems[i]->print_row_VTX (auxs);
3221 
3222  switch (Elems[i]->give_VTKPDtopology()) {
3223  case VTKPD_LINE: dalc->InsertEndChild(stream->tix_doc()->NewText(auxs)); sprintf (auxs," %ld", offl += Elems[i]->give_nno()); dalo->InsertEndChild(stream->tix_doc()->NewText(auxs)); break;
3224  case VTKPD_POLYGON: dapc->InsertEndChild(stream->tix_doc()->NewText(auxs)); sprintf (auxs," %ld", offp += Elems[i]->give_nno()); dapo->InsertEndChild(stream->tix_doc()->NewText(auxs)); break;
3225  default:
3226  _errorr ("unsuported VTKPDtopology");
3227  }
3228  }
3229  }
3230  }
3231  else if (ds == VTKDS_unstruct) {
3232  if (stream->isFile()) {
3233  _errorr ("The output to legacy VTK for UNSTRUCTURED dataset is not implemented, use VTU please");
3234  }
3235  else {
3236  stream->tixel()->SetAttribute("NumberOfCells", (int)Elems());
3237 
3238  XMLElement *cells = stream->tix_doc()->NewElement("Cells"); stream->tixel()->InsertEndChild(cells);
3239 
3240  XMLElement *dac = stream->tix_doc()->NewElement("DataArray"); cells->InsertEndChild(dac);
3241  dac->SetAttribute("format", "ascii");
3242  dac->SetAttribute("type", "Int32");
3243  dac->SetAttribute("Name", "connectivity");
3244 
3245  XMLElement *dao = (XMLElement*)dac->ShallowClone(NULL); cells->InsertEndChild(dao);
3246  dao->SetAttribute("Name", "offsets");
3247 
3248  XMLElement *dat = (XMLElement*)dac->ShallowClone(NULL); cells->InsertEndChild(dat);
3249  dat->SetAttribute("type", "UInt8");
3250  dat->SetAttribute("Name", "types");
3251 
3252  char auxs[255];
3253  long off=0;
3254  for (long i=0; i<Elems(); i++) {
3255  Elems[i]->print_row_VTX (auxs); dac->InsertEndChild(stream->tix_doc()->NewText(auxs));
3256  sprintf (auxs," %ld", off += Elems[i]->give_nno()); dao->InsertEndChild(stream->tix_doc()->NewText(auxs));
3257  sprintf (auxs," %d", CellGeometry_e2i_VTK(Elems[i]->give_cellGeom())); dat->InsertEndChild(stream->tix_doc()->NewText(auxs));
3258  }
3259  }
3260  }
3261  else
3262  _errorr ("unsuported dataset");
3263 }
3264 
3265 
3266 //* *** HEAD + NODES + ELEMENTS ***
3267 void Mesh :: print_VTK_body (Stream *stream, VTKdataset ds) const
3268 {
3269  if (stream->isFile())
3270  print_VTK_head (stream->file(), ds);
3271 
3272  print_VTK_nodes (stream);
3273  print_VTK_elems (stream, ds);
3274 }
3275 
3276 
3277 //* ***
3278 //* *** DATA - beru long a double a tisknu to jako int a float ***
3279 //* ***
3280 
3281 //* *** HEAD ***
3282 void print_VTK_init_point_data (Stream *stream, long n) {
3283  if (stream->isFile())
3284  fprintf (stream->file(), "POINT_DATA %ld\n", n);
3285  else {
3286  stream->tixel()->InsertEndChild( stream->tix_doc()->NewElement("PointData") );
3287  stream->relink_downL();
3288  }
3289 }
3290 void print_VTK_init_cell_data (Stream *stream, long n) {
3291  if (stream->isFile())
3292  fprintf (stream->file(), "CELL_DATA %ld\n", n);
3293  else {
3294  stream->tixel()->InsertEndChild( stream->tix_doc()->NewElement("CellData") );
3295  stream->relink_downL();
3296  }
3297 }
3298 
3299 // *** SCALAR / VECTOR / TENSOR body ***
3300 void print_VTK_data_body (Stream *stream, long n, const char *name, const GPA<Array1d> *data, char type, bool r2z=false)
3301 {
3302  XMLElement *da = NULL;
3303 
3304  // check integer x double
3305  bool I = false;
3306  if ((*data)[0]->give_arrayTypedef() == ATlong ) I = true;
3307  else if ((*data)[0]->give_arrayTypedef() == ATdouble) I = false;
3308  else _errorr ("error");
3309 
3310  //
3311  char tn[8];
3312  if (I) { if (stream->isFile()) sprintf(tn,"int"); else sprintf(tn,"Int32"); }
3313  else { if (stream->isFile()) sprintf(tn,"float"); else sprintf(tn,"Float32"); }
3314 
3315  long len = (*data)[0]->give_size();
3316 
3317  if (stream->isFile()) {
3318  if (type == 's') { fprintf (stream->file(), "SCALARS %s %s %ld\n", name, tn, len); fprintf (stream->file(), "LOOKUP_TABLE default\n"); }
3319  else if (type == 'v') fprintf (stream->file(), "VECTORS %s %s\n", name, tn);
3320  else if (type == 't') fprintf (stream->file(), "TENSORS %s %s\n", name, tn);
3321  else _errorr ("error");
3322  }
3323  else {
3324  da = stream->tix_doc()->NewElement("DataArray"); stream->tixel()->InsertEndChild(da);
3325  da->SetAttribute("format", "ascii");
3326  da->SetAttribute("type", tn);
3327  da->SetAttribute("Name", name);
3328  if (type == 's') da->SetAttribute("NumberOfComponents", (int)len);
3329  if (type == 'v') da->SetAttribute("NumberOfComponents", "3");
3330  if (type == 't') da->SetAttribute("NumberOfComponents", "9");
3331  }
3332 
3333  int prec = 6;
3334  double zero, relzero;
3335  if (r2z) { zero = 1.e-14; relzero = 1.e-5; }
3336  else { zero = 0.0; relzero = 1.e-5; }
3337 
3338  char *auxs;
3339  if (type == 's') auxs = new char[ (*data)[0] ->length_printed (prec)];
3340  else if (type == 'v') auxs = new char[((Xvctr*)(*data)[0])->length_printed_vector(prec)];
3341  else auxs = new char[((Xvctr*)(*data)[0])->length_printed_tensor(prec)];
3342 
3343  for (long i=0; i<n; i++) {
3344  if (type == 's') (*data)[i] ->print (auxs, prec, zero);
3345  else if (type == 'v') ((Xvctr*)(*data)[i])->print_vector (auxs, prec, zero, true);
3346  else ((Xvctr*)(*data)[i])->print_symtensor (auxs, prec, ((Xvctr*)(*data)[i])->give_zero(zero, relzero), true);
3347 
3348  if (stream->isFile()) fprintf (stream->file(), "%s\n",auxs);
3349  else da->InsertEndChild( stream->tix_doc()->NewText(auxs) );
3350  }
3351 
3352  delete [] auxs;
3353 }
3354 
3355 //* ***
3356 //* *** FULL VTK FILE ***
3357 //* ***
3358 //* VTK file with one point data scalar
3359 // !!!!!! musim to predelat, aby se tam posilalo pole vektoru [Nn,1] a ne [1,Nn] !!!!!!!!!!
3360 //void Mesh :: print_VTK_PD_scal (bool xml, const char *suff, const char *name, const Xvctr **data)
3361 //{
3362 // Stream *stream = NULL;
3363 // VTKdataset ds;
3364 //
3365 // if (this->only_vtk_polydata()) ds = VTKDS_polydata;
3366 // else ds = VTKDS_unstruct;
3367 //
3368 // if (!xml) stream = new Stream(STRM_file);
3369 // else stream = new Stream(STRM_tixel);
3370 //
3371 // print_VTK_START (stream, this , suff, ds);
3372 // print_VTK_body (stream, ds);
3373 // print_VTK_init_point_data (stream, this->give_Nn() );
3374 // print_VTK_data_body (stream, this->give_Nn(), name, data, 's');
3375 // print_VTK_FINISH (stream);
3376 // delete stream;
3377 //}
3378 
3380 //void Mesh :: print_VTK_CD_scal (bool xml, const char *suff, const char *name, const Xvctr **data) const
3381 //{
3382 // Stream *stream = NULL;
3383 // VTKdataset ds;
3384 //
3385 // if (this->only_vtk_polydata()) ds = VTKDS_polydata;
3386 // else ds = VTKDS_unstruct;
3387 //
3388 // if (!xml) stream = new Stream(STRM_file);
3389 // else stream = new Stream(STRM_tixel);
3390 //
3391 // print_VTK_START (stream, this , suff, ds);
3392 // print_VTK_body (stream , ds);
3393 // print_VTK_init_cell_data (stream, this->give_Nels() );
3394 //
3395 // // pro polydata: je to treba sortnout aby byly lines a polys za sebou
3396 // // !!! sort meni/realokuje data ale nevraci spravnej pointer kterej se pak spatne deletuje !!!
3397 // //
3398 // if (ds == VTKDS_polydata) this->sort_polydata ((Xvctr*)data[0]);
3399 // //if (!xml && ds == VTKDS_polydata) _warningg("tady je zakomentovanej sort");
3400 //
3401 // print_VTK_data_body (stream, this->give_Nels(), name, data, 's');
3402 // print_VTK_FINISH (stream);
3403 // delete stream;
3404 //}
3405 
3407 void Mesh :: print_VTK (femFileFormat format, const char *suff)
3408 {
3409  Stream *stream = NULL;
3410  VTKdataset ds = VTKDS_Void;
3411 
3412  switch (format) {
3413  case FFF_VTK: stream = new Stream(STRM_file); ds = this->giveVTKDS(); break;
3414  case FFF_VTP: stream = new Stream(STRM_tixel); ds = VTKDS_polydata; if (ds != this->giveVTKDS()) _errorr ("The output to xml VTK for POLYDATA dataset is not supported for this mesh (probably because of brick elements), use VTU please"); break;
3415  case FFF_VTU: stream = new Stream(STRM_tixel); ds = VTKDS_unstruct; break;
3416  default: _errorr("File format for output of results is not specified ");
3417  }
3418 
3419  print_VTK_START (stream, this, suff, ds);
3420  print_VTK_body (stream , ds);
3421 
3422  //* PROPERTY
3424  this->resize_Lata (Elems());
3425  this->resize_Lata_members(1);
3426 
3427  print_VTK_init_cell_data (stream, Elems());
3428 
3429  for (long i=0; i<Elems(); i++) (*Lata[i])[0] = FElems(i)->give_mpropertyORzero();
3430 
3431  print_VTK_data_body (stream, Elems(), "Property", (GPA<Array1d>*)&Lata, 's', true);
3432  }
3433  //* PROPERTY
3435  this->resize_Lata (Elems());
3436  this->resize_Lata_members(1);
3437 
3438  print_VTK_init_cell_data (stream, Elems());
3439 
3440  for (long i=0; i<Elems(); i++) (*Lata[i])[0] = FElems(i)->give_parent_prop();
3441 
3442  print_VTK_data_body (stream, Elems(), "Property", (GPA<Array1d>*)&Lata, 's', true);
3443  }
3444 
3445  print_VTK_FINISH (stream);
3446  delete stream;
3447 }
3448 
3449 
3451 void Mesh :: print_JKTK (femFileFormat format, const char *suff)
3452 {
3453  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "JKTK file print");
3454 
3455  FILE *out = _openFilePNS ("w", "JKTK mesh", this->give_Pd()->give_OUT_Path(), this->give_Pd()->give_OUT_moFILE()->give_name(), ".jktk.top");
3456 
3457 
3458  //* *** NODES ***
3459  fprintf (out, "%ld\n", Pjnts());
3460  this->print_block_nodes(out, FFF_JKTK, 0);
3461 
3462  //* *** ELEMENTS ***
3463  fprintf (out, "\n%ld\n", Elems());
3464  this->print_block_elems(out, FFF_JKTK, 0);
3465 
3466 
3467  fclose (out);
3468 
3469  //* file with hanging nodes
3470  long i, n;
3471  for (n=i=0; i<Pjnts(); i++)
3472  if (Pjnts[i]->give_classid() == classHangingNode)
3473  n++;
3474 
3475  if (n) {
3476  FILE *out = _openFilePNS ("w", "JKTK mesh", this->give_Pd()->give_OUT_Path(), this->give_Pd()->give_OUT_moFILE()->give_name(), ".jktk.hn");
3477 
3478  fprintf (out, "%ld\n", n);
3479 
3480  for (i=0; i<Pjnts(); i++)
3481  if (Pjnts[i]->give_classid() == classHangingNode) {
3482  fprintf (out, "%ld", Pjnts[i]->give_ID()+1);
3483  Pjnts[i]->give_pointAttribs()->print_row(out, FFF_JKTK, 0);
3484  fprintf (out, "\n");
3485  }
3486 
3487  fclose (out);
3488  }
3489 
3491 }
3492 
3493 
3495 void print_dat_file (const char *file, long n, const Dvctr *data1, const Dvctr *data2, bool zeroline)
3496 {
3497  if (data1 == NULL && data2 == NULL) errol;
3498 
3499  FILE *in = _openFilePN("w", "Dat file", NULL, file);
3500 
3501  //Xvctr *aux = NULL;
3502  //if (dynamic_cast<Lvctr *>(data)) aux = new Lvctr((Lvctr *)data);
3503  //if (dynamic_cast<Dvctr *>(data)) aux = new Dvctr((Dvctr *)data);
3504 
3505  if (data1 && data1->give_size() < n) errol;
3506  if (data2 && data2->give_size() < n) errol;
3507 
3508  if (zeroline) fprintf (in, "%9.6e %9.6e\n", 0.0, 0.0);
3509 
3510  long i;
3511  if (data1 == NULL) for (i=0; i<n; i++) fprintf (in, "%9.6e %9.6e\n", (double)i+1, (*data2)[i]);
3512  else if (data2 == NULL) for (i=0; i<n; i++) fprintf (in, "%9.6e %9.6e\n", (*data1)[i], (double)i+1);
3513  else for (i=0; i<n; i++) fprintf (in, "%9.6e %9.6e\n", (*data1)[i], (*data2)[i]);
3514 
3515  fclose (in);
3516 }
3517 
3518 //* ************************************************
3519 //* *** *** RESULTS *** ***
3520 //* ************************************************
3525 {
3526  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "Results printing");
3527 
3528  //* check out the geometry is really preserved
3529  if (Pd->give_PDBO(PDBO_preserveGeom)) {
3530  if (origPjntsNum != Pjnts()) errol;
3531  if (origElemsNum != Elems()) errol;
3532  for (long i=0; i<Pjnts(); i++)
3533  if (Pjnts[i]->give_ID() != Pjnts[i]->give_origID()) errol;
3534  }
3535 
3536  //* output format
3537  bool xml = true;
3538  VTKdataset ds = VTKDS_Void;
3539 
3540  switch (Pd->give_OUT_moFILE()->give_ff()) {
3541  case FFF_VTK: xml = false; ds = this->giveVTKDS(); break;
3542  case FFF_VTP: xml = true; ds = VTKDS_polydata; if (ds != this->giveVTKDS()) _errorr ("The output to xml VTK for POLYDATA dataset is not supported for this mesh (probably because of brick elements), use VTU please"); break;
3543  case FFF_VTU: xml = true; ds = VTKDS_unstruct; break;
3544  default: _errorr("File format for output of results is not specified ");
3545  }
3546 
3547  Dvctr steps(rslts_nsteps);
3548  long numsteps = 0;
3549  //int globnDOFs = Pd->give_global_nDOFs();
3550 
3551  //* variables
3552  long i, step;
3553  Stream *stream;
3554  char suff[12];
3555  SStype SST;
3556 
3557  long Nn = Pjnts();
3558  long Ne = Elems();
3559  long NnNe = (Nn>Ne ? Nn : Ne);
3560  long dstep = Pd->give_OUT_printStep();
3561 
3562  //* ALLOCATION
3563  this->resize_Data (NnNe);
3564  this->resize_Lata (NnNe);
3565  pData.free_ptrs(); pData.resize(NnNe);
3566 
3568  //* type of stress/strain results at elements
3569  //* docasne vyhodit node priznaky varianty !!!!
3570  //* S - sigma, T - tau
3571  //* <-- OOFEM --> Pozn.
3572  //* SST_truss ... Loc N 0 0 0 0 0 [N??]
3573  //* SST_beam
3574  //* SST_3d
3575  //* SST_3dshell
3576  //* SST_3d_nodes
3577  //* SST_3dshell_nodes
3578  //* SST_2dstrain ... Glob Sx Sy 0 0 0 Txy [Pa] OOFEM dava stress_z, ale ja ho nezobrazuju
3579  //* SST_2dstress ... Glob Sx Sy 0 0 0 Txy [Pa] OOFEM nedava strain_z
3580  //* SST_transp2d ...
3581  //*
3582  int sst[cSSTypes]; memset(sst, 0, cSSTypes*sizeof(int));
3583  for (i=0; i<Ne; i++)
3584  sst[FElems(i)->give_elemAttribs()->give_sst()]++;
3585 
3586  //* plasticity
3587  bool plasticityMaterial = false;
3588  for (i=0; i<Ne; i++)
3589  if (FElems(i)->give_elemAttribs()->give_mat() && FElems(i)->give_elemAttribs()->give_mat()->isOOFEMplast()) {
3590  plasticityMaterial = true;
3591  break;
3592  }
3593 
3594  Dvctr *yielding=NULL;
3595  if (plasticityMaterial) yielding = new Dvctr(rslts_nsteps);
3596 
3597  //* LOOP OVER STEPS
3598  //* na elementech ss prumeruju na jednu hodnotu
3599  for (step=0; step<rslts_nsteps; step++) {
3600  // skip steps
3601  if (step!=1000 && step!=rslts_nsteps-1) {
3602  // skip non yielding steps
3603  //if (plasticityMaterial) {
3604  // int sum = 0;
3605  // for (i=0; i<Ne; i++) sum += ( FElems(i)->give_results(step, RTE_plaststrain) != NULL ) ? 1 : 0;
3606  // if (sum == 0 || sum == Ne) continue;
3607  //}
3608  // skip steps
3609  if (step%dstep!=0) continue;
3610  }
3611 
3612  steps[numsteps] = step+1;
3613 
3614  if (xml) stream = new Stream(STRM_tixel);
3615  else stream = new Stream(STRM_file);
3616 
3617  if (rslts_nsteps == 1) sprintf (suff, ".rslts");
3618  else sprintf (suff, ".rslts.%03ld", step+1);
3619 
3620  //* *** BODY ***
3621  print_VTK_START (stream, this, suff, ds);
3622  print_VTK_body (stream , ds);
3623 
3624 
3625  //* **********************
3626  //* *** POINT DATA ***
3627  //* **********************
3628  print_VTK_init_point_data (stream, Nn);
3629 
3630 
3631  //* DISPLACEMENT
3632  if (RTN[RTN_displacement]) { for (i=0; i<Nn; i++) Nodes(i)->setup_full_alloc_DOFvals_at(Data[i], RTN_displacement, step); print_VTK_data_body (stream, Nn, "uknw_displacement", (GPA<Array1d>*)&Data, 'v');
3633  for (i=0; i<Nn; i++) Data[i]->shift(3); print_VTK_data_body (stream, Nn, "uknw_rotation", (GPA<Array1d>*)&Data, 'v');
3634  for (i=0; i<Nn; i++) Data[i]->deshift(); }
3635 
3636  //* REACTIONS
3637  if (RTN[RTN_reaction]) { for (i=0; i<Nn; i++) Nodes(i)->setup_full_alloc_DOFvals_at(Data[i], RTN_reaction, step); print_VTK_data_body (stream, Nn, "reactions_forces", (GPA<Array1d>*)&Data, 'v');
3638  for (i=0; i<Nn; i++) Data[i]->shift(3); print_VTK_data_body (stream, Nn, "reactions_moments", (GPA<Array1d>*)&Data, 'v');
3639  for (i=0; i<Nn; i++) Data[i]->deshift(); }
3640 
3641  //* TRANSPORT UNKNOWNS
3642  if (RTN[RTN_transpunknowns]) { for (i=0; i<Nn; i++) pData.assign(i, Nodes(i)->give_resultsN_dv(step, RTN_transpunknowns)); print_VTK_data_body (stream, Nn, "uknw_transp_media", (GPA<Array1d>*)&pData, 's'); }
3643 
3644  this->resize_Data_members(1);
3645 
3646  //* ADAPTIVITY, PERCENTAGE ERROR AT ELEMENT
3647  if (RTN[RTN_ada_h_act]) {
3648  for (i=0; i<Nn; i++)
3649  (*Data[i])[0] = Nodes(i)->give_resultsN_ds(step, RTN_ada_h_act)[0]();
3650  print_VTK_data_body (stream, Nn, "ada_h_act", (GPA<Array1d>*)&Data, 's');
3651  }
3652  if (RTN[RTN_ada_h_new]) { for (i=0; i<Nn; i++) (*Data[i])[0] = Nodes(i)->give_resultsN_ds(step, RTN_ada_h_new)[0](); print_VTK_data_body (stream, Nn, "ada_h_new", (GPA<Array1d>*)&Data, 's'); }
3653 
3654  //* ADAPTIVITY, REFINED DERIVATIVES
3655  //if (RTN[RTN_ada_refder]) {
3656  // for (i=0; i<Nn; i++) datap[i] = (Dvctr*)Nodes(i)->give_resultsN_d(0 , RTN_ada_refder); print_VTK_data_body (stream, Nn, "othr_ada_refder", (GPA<Array1d>*)&pData, 's');
3657  //}
3658  if (0) {
3659  char label[24];
3660 
3661  // normala pro vsechny regiony
3662  if (0) {
3663  for (long regid=0; regid<this->nRegions; regid++) {
3664  sprintf (label, "ada_normal_reg%02ld", regid); for (i=0; i<Nn; i++) pData.assign(i, Nodes(i)->give_resultsE_dv(regid, step, RTE_ada_normal)); print_VTK_data_body (stream, Nn, label, (GPA<Array1d>*)&pData, 'v');
3665  }
3666  }
3667 
3668  // ada otocena rovina
3669  if (0) {
3670  this->resize_Data_members(3);
3671 
3672  // pouze jeden region, ten posledni
3673  long regid = this->nRegions-1;
3674  sprintf (label, "ada_osax_reg%02ld", regid); for (i=0; i<Nn; i++) Data[i]->beCopyOf( Nodes(i)->give_resultsE_dm(regid, step, RTE_ada_normal)->give_ptr2val(0,0)); print_VTK_data_body (stream, Nn, label, (GPA<Array1d>*)&Data, 'v');
3675  sprintf (label, "ada_osay_reg%02ld", regid); for (i=0; i<Nn; i++) Data[i]->beCopyOf( Nodes(i)->give_resultsE_dm(regid, step, RTE_ada_normal)->give_ptr2val(1,0)); print_VTK_data_body (stream, Nn, label, (GPA<Array1d>*)&Data, 'v');
3676  sprintf (label, "ada_osaz_reg%02ld", regid); for (i=0; i<Nn; i++) Data[i]->beCopyOf( Nodes(i)->give_resultsE_dm(regid, step, RTE_ada_normal)->give_ptr2val(2,0)); print_VTK_data_body (stream, Nn, label, (GPA<Array1d>*)&Data, 'v');
3677  }
3678  }
3679  if (Pd->give_PDBO(PDBO_P_refder)) {
3680  long regid;
3681  const Dvctr* auxD;
3682  char label[24];
3683 
3684  this->resize_Data_members(3);
3685 
3686  for (regid=0; regid<this->nRegions; regid++) {
3687 
3688  for (i=0; i<Nn; i++) {
3689  auxD = Nodes(i)->give_resultsE_dv(regid, step, RTE_global_stress);
3690  Data[i][0][0] = Data[i][0][1] = 0.0;
3691  if (auxD == NULL) Data[i][0][2] = 0.0;
3692  else Data[i][0][2] = auxD[0][6]; // sigma x
3693  }
3694 
3695  sprintf (label, "othr_ada_refder_%02ld", regid);
3696  print_VTK_data_body (stream, Nn, label, (GPA<Array1d>*)&Data, 'v');
3697  }
3698  }
3699 
3700 
3701  //* VARIABLES - D x R strain x stress
3702  //if (RTE[RTE_strain] && sst[SST = SST_3d]) { for (i=0; i<Nn; i++) Nodes(i)->give_ssstate (data[i], SST, RVTstrn_displ, 'g', step); print_VTK_data_body (stream, Nn, "Dstrain", (const Array1d**)data, 't', true); }
3703  //if (RTE[RTE_stress] && sst[SST = SST_3d]) { for (i=0; i<Nn; i++) Nodes(i)->give_ssstate (data[i], SST, RVTstrs_displ, 'g', step); print_VTK_data_body (stream, Nn, "Dstress", (const Array1d**)data, 't', true); }
3704 
3706  //if (RTE[RTE_strain] && sst[SST = SST_3dshell]) { for (i=0; i<Nn; i++) Nodes(i)->give_ssstate (data[i], SST, RVTstrn_displ, 'g', step); print_VTK_data_body (stream, Nn, "Dstrain", (const Array1d**)data, 't', true);
3707  // for (i=0; i<Nn; i++) Nodes(i)->give_ssstate (data[i], SST, RVTstrn_rotat, 'g', step); print_VTK_data_body (stream, Nn, "Rstrain", (const Array1d**)data, 't', true); }
3708  //if (RTE[RTE_stress] && sst[SST = SST_3dshell]) { for (i=0; i<Nn; i++) Nodes(i)->give_ssstate (data[i], SST, RVTstrs_displ, 'g', step); print_VTK_data_body (stream, Nn, "Dstress", (const Array1d**)data, 't', true);
3709  // for (i=0; i<Nn; i++) Nodes(i)->give_ssstate (data[i], SST, RVTstrs_rotat, 'g', step); print_VTK_data_body (stream, Nn, "Rstress", (const Array1d**)data, 't', true); }
3710 
3711  //if (sst[SST_beam]) { for (i=0; i<Nn; i++) Nodes(i)->give_ssstate (data[i], RVT_endDispl, step); print_VTK_data_body (stream, Nn, "endDispl", (const Array1d**)data, 't', true); }
3712  //if (sst[SST_beam]) { for (i=0; i<Nn; i++) Nodes(i)->give_ssstate (data[i], RVT_endForce, step); print_VTK_data_body (stream, Nn, "endForce", (const Array1d**)data, 't', true); }
3713 
3714  //* 2dstress - 3 nenulove slozky ve vektoru v globalnim SS, predpokladam rovinu xy
3715  //* do uzlu budu hazet podle nejblizsiho ip, ale zatim to implementovat nebudu
3716 
3717  if (xml) stream->relink_up();
3718 
3719 
3720  //* *********************
3721  //* *** CELL DATA ***
3722  //* *********************
3723  //* head
3724  print_VTK_init_cell_data (stream, Ne);
3725 
3726  //*
3727  //* *** NON-RESULS VALUES ***
3728  //*
3729 
3730  //* MODELA PARENT ELEMENT ID and PROPERTY
3731  this->resize_Lata_members(1);
3732  if (Pd->give_PDBO(PDBO_OUT_print_model_parent)) { for (i=0; i<Ne; i++) (*Lata[i])[0] = FElems(i)->give_parent_id(); print_VTK_data_body (stream, Ne, "ID_model_parent", (GPA<Array1d>*)&Lata, 's', true); }
3733  if (Pd->give_PDBO(PDBO_OUT_print_property)) { for (i=0; i<Ne; i++) (*Lata[i])[0] = FElems(i)->give_parent_prop(); print_VTK_data_body (stream, Ne, "Property", (GPA<Array1d>*)&Lata, 's', true); }
3734 
3735 
3736  //*
3737  //* *** STRAIN & STRESS ***
3738  //*
3739 
3740  //* 1d ELEMENTS
3741 
3742  //* TRUSS ELEMENTS - strain x force
3743  if (RTE[RTE_global_strain] && sst[SST = SST_truss]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrn, 'g', step); print_VTK_data_body (stream, Ne, "strain_truss", (GPA<Array1d>*)&Data, 's', true); }
3744  if (RTE[RTE_global_stress] && sst[SST = SST_truss]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrs, 'g', step); print_VTK_data_body (stream, Ne, "stress_truss", (GPA<Array1d>*)&Data, 's', true); }
3745 
3746  //* BEAM ELEMENTS
3747  if (RTE[RTE_global_strain] && sst[SST = SST_beam]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrn, 'g', step); print_VTK_data_body (stream, Ne, "strain_beam3D_NVM", (GPA<Array1d>*)&Data, 'v', true);
3748  for (i=0; i<Ne; i++) Data[i]->shift(3); print_VTK_data_body (stream, Ne, "strain_beam3D_NVyVz", (GPA<Array1d>*)&Data, 'v', true);
3749  for (i=0; i<Ne; i++) Data[i]->shift(3); print_VTK_data_body (stream, Ne, "strain_beam3D_MxMyMz", (GPA<Array1d>*)&Data, 'v', true);
3750  for (i=0; i<Ne; i++) Data[i]->shift(-6); }
3751  if (RTE[RTE_global_stress] && sst[SST = SST_beam]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrs, 'g', step); print_VTK_data_body (stream, Ne, "stress_beam3D_NVM", (GPA<Array1d>*)&Data, 'v', true);
3752  for (i=0; i<Ne; i++) Data[i]->shift(3); print_VTK_data_body (stream, Ne, "stress_beam3D_NVyVz", (GPA<Array1d>*)&Data, 'v', true);
3753  for (i=0; i<Ne; i++) Data[i]->shift(3); print_VTK_data_body (stream, Ne, "stress_beam3D_MxMyMz", (GPA<Array1d>*)&Data, 'v', true);
3754  for (i=0; i<Ne; i++) Data[i]->shift(-6); }
3755 
3756  //* 2d ELEMENTS
3757 
3758  //* planestrain - 3 nenulove slozky ve vektoru v globalnim SS, predpokladam rovinu xy
3759  if (RTE[RTE_global_strain] && sst[SST = SST_plstrain]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrn_displ, 'g', step); print_VTK_data_body (stream, Ne, "strain_planestrain", (GPA<Array1d>*)&Data, 'v', true); }
3760  if (RTE[RTE_global_stress] && sst[SST = SST_plstrain]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrs_displ, 'g', step); print_VTK_data_body (stream, Ne, "stress_planestrain", (GPA<Array1d>*)&Data, 'v', true); }
3761 
3762  //* planestress - 3 nenulove slozky ve vektoru v globalnim SS, predpokladam rovinu xy
3763  if (RTE[RTE_global_strain] && sst[SST = SST_plstress]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrn_displ, 'g', step); print_VTK_data_body (stream, Ne, "strain_planestress", (GPA<Array1d>*)&Data, 'v', true); }
3764  if (RTE[RTE_global_stress] && sst[SST = SST_plstress]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrs_displ, 'g', step); print_VTK_data_body (stream, Ne, "stress_planestress", (GPA<Array1d>*)&Data, 'v', true); }
3765 
3766  //* shell stra
3767  if (RTE[RTE_global_strain] && sst[SST = SST_3dshell]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrn_displ, 'g', step); print_VTK_data_body (stream, Ne, "strainD_shell_glob", (GPA<Array1d>*)&Data, 't', true);
3768  for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrn_rotat, 'g', step); print_VTK_data_body (stream, Ne, "strainR_shell_glob", (GPA<Array1d>*)&Data, 't', true); }
3769  if (RTE[RTE_global_stress] && sst[SST = SST_3dshell]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrs_displ, 'g', step); print_VTK_data_body (stream, Ne, "stressD_shell_glob", (GPA<Array1d>*)&Data, 't', true);
3770  for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrs_rotat, 'g', step); print_VTK_data_body (stream, Ne, "stressR_shell_glob", (GPA<Array1d>*)&Data, 't', true); }
3771 
3772  //* 3d ELEMENTS
3773 
3774  //*
3775  if (RTE[RTE_global_strain] && sst[SST = SST_3d]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrn_displ, 'g', step); print_VTK_data_body (stream, Ne, "strain_3D", (GPA<Array1d>*)&Data, 't', true); }
3776  if (RTE[RTE_global_stress] && sst[SST = SST_3d]) { for (i=0; i<Ne; i++) FElems(i)->give_ssstate (Data[i], SST, RVTstrs_displ, 'g', step); print_VTK_data_body (stream, Ne, "stress_3D", (GPA<Array1d>*)&Data, 't', true); }
3777 
3778  //* SECONDARY values
3779 
3780  //* plasticityMaterial
3781  if (plasticityMaterial) { for (i=0; i<Ne; i++) (*Lata[i])[0] = ( FElems(i)->give_results(step, RTE_plaststrain) != NULL ); print_VTK_data_body (stream, Ne, "yielding", (GPA<Array1d>*)&Lata, 's');
3782 
3783  for (i=0; i<Ne; i++) if ( (*Lata[i])[0] ) break;
3784  if (i==Ne) (*yielding)[numsteps] = 0;
3785  else (*yielding)[numsteps] = 1;
3786  }
3787 
3788  //* CROSS SECTION usage/leverage/utilization/level of usage
3790  for (i=0; i<Ne; i++) (*Data[i])[0] = FElems(i)->give_CSusage_elast(); print_VTK_data_body (stream, Ne, "CSusage_elast", (GPA<Array1d>*)&Data, 's', true);
3791  for (i=0; i<Ne; i++) (*Data[i])[0] = FElems(i)->give_CSusage_elast_rel(); print_VTK_data_body (stream, Ne, "CSusage_elast_rel", (GPA<Array1d>*)&Data, 's', true);
3792  for (i=0; i<Ne; i++) (*Lata[i])[0] = FElems(i)->give_CSusage_elast_bool(); print_VTK_data_body (stream, Ne, "CSusage_elast_bool", (GPA<Array1d>*)&Lata, 's'); }
3793 
3794  //* ADAPTIVITY, PERCENTAGE ERROR AT ELEMENT
3795  this->resize_Data_members(1);
3796  this->resize_Lata_members(1);
3797  //
3798  if (RTE[RTE_ada_error_pct_l]) { for (i=0; i<Ne; i++) (*Data[i])[0] = FElems(i)->give_results_ds(step, RTE_ada_error_pct_l)[0](); print_VTK_data_body (stream, Ne, "ada_error_pct_l", (GPA<Array1d>*)&Data, 's'); }
3799  if (RTE[RTE_ada_error_pct_g]) { for (i=0; i<Ne; i++) (*Data[i])[0] = FElems(i)->give_results_ds(step, RTE_ada_error_pct_g)[0](); print_VTK_data_body (stream, Ne, "ada_error_pct_g", (GPA<Array1d>*)&Data, 's'); }
3800  if (RTE[RTE_ada_h_act]) { for (i=0; i<Ne; i++) (*Data[i])[0] = FElems(i)->give_results_ds(step, RTE_ada_h_act)[0](); print_VTK_data_body (stream, Ne, "ada_h_act", (GPA<Array1d>*)&Data, 's'); }
3801  if (RTE[RTE_ada_h_new]) { for (i=0; i<Ne; i++) (*Data[i])[0] = FElems(i)->give_results_ds(step, RTE_ada_h_new)[0](); print_VTK_data_body (stream, Ne, "ada_h_new", (GPA<Array1d>*)&Data, 's'); }
3802  //if (RTE[RTE_ada_eia]) { for (i=0; i<Ne; i++) (*Data[i])[0] = FElems(i)->give_results_ds(step, RTE_ada_eia)[0](); print_VTK_data_body (stream, Ne, "ada_error_aver", (GPA<Array1d>*)&Data, 's'); }
3803  //if (RTE[RTE_ada_normal]) { for (i=0; i<Ne; i++) pData.assign(i,FElems(i)->give_results_dv(step, RTE_ada_normal)); print_VTK_data_body (stream, Ne, "ada_normal", (GPA<Array1d>*)&pData, 'v'); }
3804  if (this->nRegions) { for (i=0; i<Ne; i++) (*Lata[i])[0] = FElems(i)->give_regid() + 1; print_VTK_data_body (stream, Ne, "ada_regions", (GPA<Array1d>*)&Lata, 's'); }
3805 
3806 
3807  if (xml) stream->relink_up(); // end of CELL DATA
3808  if (xml) stream->relink_up(); // end of Piece
3809  if (xml) stream->relink_up(); // end of UnstructuredGrid
3810 
3811 
3812  //* *************************
3813  //* *** APPENDED DATA ***
3814  //* *************************
3815  //*
3816  if (xml) {
3817  char str[1023];
3818  XMLElement *txl;
3819 
3820  txl = stream->tix_doc()->NewElement("AppendedData"); stream->tixel()->InsertEndChild(txl);
3821  txl->InsertEndChild( stream->tix_doc()->NewText("_") );
3822  stream->relink_downL();
3823 
3824  if (1) { txl = stream->tix_doc()->NewElement("Volume"); stream->tixel()->InsertEndChild(txl); sprintf (str, " %lf ", this->volume_core()); txl->InsertEndChild( stream->tix_doc()->NewText(str) ); }
3825  if (Pd->give_analloctype() == PAT_stability_linear) { txl = stream->tix_doc()->NewElement("Stability_critical_coefficient"); stream->tixel()->InsertEndChild(txl); sprintf (str, " %lf ", this->critical_coeff); txl->InsertEndChild( stream->tix_doc()->NewText(str) ); }
3826  if (Pd->give_adpa()) { txl = stream->tix_doc()->NewElement("Error"); stream->tixel()->InsertEndChild(txl); sprintf (str, " %.2lf ", Pd->give_adpa()->give_error()); txl->InsertEndChild( stream->tix_doc()->NewText(str) ); }
3827  }
3828 
3829  //* *** END ***
3830  print_VTK_FINISH (stream);
3831  delete stream;
3832  numsteps++;
3833  }
3834 
3836  if (rslts_nsteps > 1) {
3838  if (plasticityMaterial) {
3839  print_dat_file ("this.dat.yielding.dat", numsteps, &steps, yielding, true);
3840  delete yielding;
3841  }
3842 
3844  //const char* anal = Pd->give_OOanalysis();
3845  //if (anal && SP_scan_expected_word (anal, "NonLinearStatic", CASE)) {
3846  long idnode = 1;
3847  int index = 0;
3848  const Node* node = this->give_Node(idnode);
3849 
3850  Dvctr displ(rslts_nsteps);
3851 
3852  node->give_displcmnt_in_all_steps (&displ, index);
3853 
3854  //if (! rslts_loadlevel)errol;
3855 
3856  print_dat_file ("this.dat", rslts_nsteps, &displ, rslts_loadlevel, true);
3857  }
3858 
3859 
3861 }
3862 
3864 //void Mesh :: print_cabletensileonly (bool mft)
3865 //{
3866 // if (this->give_anyBeamElem() == 0) return;
3867 //
3868 // Lvctr *data = new Lvctr(Elems());
3869 // long i, step;
3870 // char str[16];
3871 // const Beam *beam;
3872 //
3873 // for (step=0; step<nstepsOut; step++) {
3874 // data->zero();
3875 // for (i=0; i<Elems(); i++) {
3876 // beam = dynamic_cast<const Beam *>(Elems[i]);
3877 // if (beam && 0.0 > beam->give_normal_force(step)) data[0](i) = 1;
3878 // }
3879 //
3880 // if (nstepsOut == 1) sprintf (str, ".cbltens");
3881 // else sprintf (str, ".cbltens.%03ld", step);
3882 //
3883 // this->print_VTK_CD_scal (mft, str, "CableTensileStress", (const Array1d**)&data);
3884 // }
3885 //
3886 // delete data;
3887 //}
3888 
3889 
3892 {
3893  long i;
3894  Stream *stream = new Stream(STRM_tixel);
3895  VTKdataset ds = this->giveVTKDS();
3896 
3897  long Nn = Pjnts();
3898  long Ne = Elems();
3899  long NnNe = (Nn>Ne ? Nn : Ne);
3900 
3901  //* ALLOCATION *//
3902  this->resize_Lata (NnNe);
3903 
3904  //* ************************
3905  //* *** START + BODY ***
3906  //* ************************
3907  print_VTK_START (stream, this, ".ctrl", ds);
3908  print_VTK_body (stream , ds);
3909 
3910 
3911  //* **********************
3912  //* *** POINT DATA ***
3913  //* **********************
3914  print_VTK_init_point_data (stream, Nn);
3915 
3916  //* support
3917  for (i=0; i<Nn; i++) Nodes(i)->give_pointAttribs()->assemble_full_constrained (Lata[i]); print_VTK_data_body (stream, Nn, "supports_forces", (GPA<Array1d>*)&Lata, 'v');
3918  for (i=0; i<Nn; i++) Lata[i]->shift(3); print_VTK_data_body (stream, Nn, "supports_moments", (GPA<Array1d>*)&Lata, 'v');
3919  for (i=0; i<Nn; i++) Lata[i]->deshift();
3920 
3921  this->resize_Lata_members(1);
3922  for (i=0; i<Nn; i++) Lata[i][0][0] = Nodes(i)->give_pointAttribs()->is_supported(); print_VTK_data_body (stream, Nn, "supports_bool", (GPA<Array1d>*)&Lata, 's');
3923 
3924  //* end point data
3925  stream->relink_up();
3926 
3927 
3928  //* *********************
3929  //* *** CELL DATA ***
3930  //* *********************
3931  print_VTK_init_cell_data (stream, Ne);
3932 
3933  this->resize_Lata_members(1);
3934 
3935  //* material
3936  for (i=0; i<Ne; i++) Lata[i][0][0] = Elems[i]->give_elemAttribs()->give_mat_ID(); print_VTK_data_body (stream, Ne, "materials", (GPA<Array1d>*)&Lata, 's');
3937  for (i=0; i<Ne; i++) Lata[i][0][0] = Elems[i]->give_elemAttribs()->give_cs ()->give_ID(); print_VTK_data_body (stream, Ne, "cross-sections", (GPA<Array1d>*)&Lata, 's');
3938 
3939  //* *********************
3940  //* *** END ***
3941  //* *********************
3942  print_VTK_FINISH (stream);
3943  delete stream;
3944 }
3945 
3946 
3947 //* *****************************************************************************************
3948 //* *** MADAPTIVITY ***
3949 //* *****************************************************************************************
3951 {
3952 #ifdef __MEER_MODULE
3953 
3954  Pd->sodriver()->print_info_message (SODE_start_blue_arrow, "Adaptivity - relative stress error estimate");
3955 
3956  // allocate
3957  MEER_interface *ada = new MEER_interface;
3958 
3959  // run meer
3960  ada->local_initialize(this);
3961  ada->initialize();
3962  double err = ada->solve(Pd->give_adpa()->give_required_error());
3963 
3964  Pd->give_adpa()->set_error(err);
3965 
3966  // results at elem
3967  const double* errori_l = ada->give_error_at_elements_local();
3968  const double* errori_g = ada->give_error_at_elements_global();
3969  const double* h_old_elem = ada->give_h_old_at_elems();
3970  const double* h_new_elem = ada->give_h_new_at_elems();
3971  Dvctr*** rnvals = ada->give_refined_node_values_2();
3972 
3973  // docas
3974  const double* eia = ada->give_abs_error_at_elements();
3975 
3976  long i, j, istep = 0;
3977  long nn = Pjnts();
3978  long ne = Elems();
3979 
3980 
3981  //* save results to element
3982  this->set_RTE(RTE_ada_error_pct_l, true);
3983  this->set_RTE(RTE_ada_error_pct_g, true);
3984  this->set_RTE(RTE_ada_h_act, true);
3985  this->set_RTE(RTE_ada_h_new, true);
3986  this->set_RTE(RTE_ada_normal, true);
3987 
3988  // docas
3989  this->set_RTE(RTE_ada_eia, true);
3990 
3991  for (i=0; i<ne; i++) {
3992  // save results
3993  FElems(i)->set_result(errori_l[i], istep, RTE_ada_error_pct_l);
3994  FElems(i)->set_result(errori_g[i], istep, RTE_ada_error_pct_g);
3995  FElems(i)->set_result(h_old_elem[i], istep, RTE_ada_h_act);
3996  FElems(i)->set_result(h_new_elem[i], istep, RTE_ada_h_new);
3997  FElems(i)->set_result(ada->give_normal_at_elem(i), istep, RTE_ada_normal);
3998 
3999  // docas
4000  FElems(i)->set_result(eia[i], istep, RTE_ada_eia);
4001  }
4002 
4003  //* save results to node
4004  Dvctr h_old_node(nn);
4005  Dvctr h_new_node(nn);
4006  double sizei, size, hold, hnew;
4007 
4008  // zprumeruju h_* do uzlu
4009  for (i=0; i<nn; i++) {
4010  const GPA<const Element>* supelems = Nodes(i)->give_superelems();
4011 
4012  if (supelems[0]()) {
4013  //* vazeny prumer
4014  size = hold = hnew = 0;
4015  for (j=0; j<supelems[0](); j++) {
4016  sizei = supelems[0][j]->give_lav();
4017 
4018  size += sizei;
4019  hold += sizei * h_old_elem[supelems[0][j]->give_ID()];
4020  hnew += sizei * h_new_elem[supelems[0][j]->give_ID()];
4021  }
4022 
4023  h_old_node[i] = hold / size;
4024  h_new_node[i] = hnew / size;
4025 
4026  // //* nejmensi
4027  // for (j=0; j<supelems[0](); j++) {
4028  // hnew = h_new_elem[supelems[0][j]->give_ID()];
4029  // if (h_new_node[i] > hnew)
4030  // h_new_node[i] = hnew;
4031  // }
4032  }
4033  else {
4034  h_old_node[i] = h_new_node[i] = 0.0;
4035  }
4036  }
4037 
4038  // tisk ada_refder, normal, local coord system
4039  if (0) {
4040  // save results to node
4041  this->set_RTN(RTN_ada_refder, true);
4042 
4043  //const VectoR *v;
4044  //VectoR v0; v0.x = v0.y = v0.z = 0.0;
4045  const Dmtrx *m;
4046 
4047  for (i=0; i<this->nRegions; i++)
4048  for (j=0; j<nn; j++) {
4049  Nodes(j)->add_resultE (rnvals[i][j], i, istep, RTE_global_stress);
4050  rnvals[i][j] = NULL;
4051 
4052  //v = ada->give_normal_at_node_and_region(j, i);
4053  //if (v == NULL) v = &v0;
4054  //Nodes(j)->set_resultE (v, i, istep, RTE_ada_normal);
4055  m = ada->give_rotmat_at_node(j);
4056  Nodes(j)->set_resultE (m, i, istep, RTE_ada_normal);
4057  }
4058  }
4059 
4060  // save results
4061  this->set_RTN(RTN_ada_h_act, true);
4062  this->set_RTN(RTN_ada_h_new, true);
4063 
4064  for (i=0; i<nn; i++) {
4065  Nodes(i)->set_resultN(h_old_node[i], istep, RTN_ada_h_act);
4066  Nodes(i)->set_resultN(h_new_node[i], istep, RTN_ada_h_new);
4067  }
4068 
4069 
4070  //* print BackGroundMesh
4071  GPA<const FElement> Beams(0,ne), Triangles(0,ne), Quads(0,ne), Tetras(0,ne), Bricks(0,ne);
4072 
4073  for (i=0; i<ne; i++)
4074  switch (Elems[i]->give_cellGeom()) {
4075  case CG_Line: Beams.add(FElems(i)); break;
4076  case CG_Triangle: Triangles.add(FElems(i)); break;
4077  case CG_Quadrangle: Quads.add(FElems(i)); break;
4078  case CG_Tetrahedron: Tetras.add(FElems(i)); break;
4079  case CG_Hexahedron: Bricks.add(FElems(i)); break;
4080  default: _errorr2 ("Unknown element geom type (element number %d)", i+1);
4081  }
4082 
4083  FILE *bgm = _openFilePNS ("w", "T3d input", Pd->give_OUT_moFILE()->give_path(), Pd->give_OUT_moFILE()->give_base(), ".T3d.bgm");
4084 
4085  fprintf(bgm, "7 1\n");
4086  fprintf(bgm, "%ld %ld %ld %ld %ld %d %d %ld\n", Pjnts(), Beams(), Triangles(), Quads(), Tetras(), 0, 0, Bricks()); // 0 = pyramids, wedges
4087 
4088  // nodes
4089  for (i=0; i<nn; i++)
4090  fprintf(bgm, "%ld %e %e %e %e\n", i+1, Pjnts[i]->give_coord(0), Pjnts[i]->give_coord(1), Pjnts[i]->give_coord(2), h_new_node[i]);
4091 
4092  //
4093  long ii = 1;
4094 
4095  if (Triangles()) {
4096  for (i=0; i<Triangles(); i++) {
4097  fprintf(bgm, "%ld", i+1);
4098  for (j=0; j<3; j++) fprintf(bgm, " %ld", Triangles[i]->give_node(j)->give_ID()+1);
4099  fprintf(bgm, "\n");
4100  }
4101  }
4102 
4103  if (Quads()) {
4104  for (i=0; i<Quads(); i++) {
4105  fprintf(bgm, "%ld", i+1);
4106  for (j=0; j<4; j++) fprintf(bgm, " %ld", Quads[i]->give_node(j)->give_ID()+1);
4107  fprintf(bgm, "\n");
4108  }
4109  }
4110 
4111  if (Beams()) errol;
4112  if (Tetras()) errol;
4113  if (Bricks()) errol;
4114 
4115  fclose (bgm);
4116 
4117 
4118  delete ada;
4119 
4120  //Pd->sodriver()->print_info_message_core (SODE_green_ok);
4121  Pd->sodriver()->print_info_message (SODE_end, "%.2lf", err);
4122 
4123 #else
4124  _errorr("MEER is not linked.");
4125 #endif
4126 }
4127 
4128 #ifdef __MEER_MODULE
4129 void Mesh :: regions_init (void)
4131 {
4132  //* smyce pres vsechny elementy - zatim jsou vsechny v regionu 0
4133  this->nRegions = Pd->give_cCS();
4134  for (long i=0; i<Elems(); i++)
4135  FElems(i)->set_regid (FElems(i)->give_elemAttribs()->give_cs()->give_ID());
4136 
4137 }
4138 #endif
4139 
4141 double Mesh :: volume_core (void) const
4142 {
4143  //
4144  if (! Pd->give_fulldata()) errol;
4145 
4146  long i;
4147  double cs, vol = 0.0;
4148  for (i=0; i<Elems(); i++) {
4149  switch (Elems[i]->give_dimension()) {
4150  case 1: if ((cs = Elems[i]->give_elemAttribs()->give_cs()->give_area()) <= 0.0) errol; break;
4151  case 2: cs = Elems[i]->give_elemAttribs()->give_cs()->give_thickness(); if (cs < 0.0) cs = 0.0; break;
4152  case 3: cs = 1.0; break;
4153  default: errol;
4154  }
4155 
4156  vol += cs * Elems[i]->give_lav();
4157  }
4158 
4159  return vol;
4160 }
4161 
4162 } // namespace midaspace
virtual XMLElement * ToElement()
Safely cast to an Element, or null.
Definition: tinyxml2.h:1130
XMLText * NewText(const char *text)
Create a new Text associated with this Document.
Definition: tinyxml2.cpp:1573
const Face * give_Face(long i) const
Definition: geometry.h:70
void set_delete_flag(bool val)
Definition: geomcomp.h:121
void print_VTK_elems(Stream *stream, VTKdataset ds) const
Definition: geometry.cpp:3172
bool FP_skip_to_line_starting_with(FILE *stream, const char *string, bool cs)
move file descriptor to the line starting with string, exactly behind the string
Definition: librw.cpp:190
void set_master_component(long prop, const Model *model, int parenttype)
Definition: point.cpp:678
bool relink_next(void)
Definition: tixy2.h:157
void letoff_aa(void)
let off atributes arrays
Definition: geometry.cpp:193
DOFsPerNode give_DOFsPerNode(void)
Definition: geometry.cpp:2797
femFileFormat
Definition: alias.h:632
FElement * FElems(long i) const
Definition: geometry.h:348
virtual ~Mesh(void)
DESTRUCTOR.
Definition: geometry.cpp:1340
bool connectivity_is_assembled(void) const
Definition: geometry.h:135
#define _warningg4(_1, _2, _3, _4)
Definition: gelib.h:159
void assign_NodeLoad_by_point_ID(const BoundaryCond *bc, long id)
BC assign assign nodal load to the point by/via ...
Definition: geometry.cpp:2719
Point * allocate_point(long gid, const PoinT *coo, char attribs_alloc='n')
Definition: geometry.cpp:505
bool give_PDBO(ProbDescBoolOpt pdbo) const
Definition: problem.h:187
void set_Master_model(const Model *M)
Definition: geometry.h:283
void print_VTK_FINISH(Stream *stream)
Definition: geometry.cpp:3127
void print_VTK_head(FILE *stream, VTKdataset ds)
Definition: geometry.cpp:3133
long * give_ptr2val(long r=0, long c=0)
Definition: arrays.h:757
void TF_GPA_delete_damned(T &list)
DELETE components marked by flag "delete".
Definition: geometry.cpp:137
void set_RTN(ResultTypesAtNode rt, bool val)
Definition: geometry.h:314
int FP_scan_word(FILE *src, char *dest)
... word; return value is length of the word
Definition: librw.cpp:356
GPA< Edge > Edges
Definition: geometry.h:58
VTKdataset
VTK data set.
Definition: alias.h:201
double dist2_to(const PoinT *p) const
Definition: arrays.h:102
void add_domain(long gid, const char *&str, femFileFormat fff, bool shared, long dom, long li)
initialize shared node on next domain
Definition: point.cpp:555
void scan_DATA_field(Stream *stream, const char *str, int nexc, long m, Lmtrx *dataL, Dmtrx *dataD, Lvctr *sprs, const char *name)
Definition: geometry.cpp:476
void set_dofbc(const char *str, femFileFormat ff=FFF_Void)
Definition: attribute.h:1044
long nRegions
ADAPTIVITY == adaptivity in MIDAS.
Definition: geometry.h:308
double give_error(void) const
Definition: taux.h:332
const GPA< const Edge > * give_superedges(void) const
Definition: point.h:114
bool scan_z(FILE *stream)
Definition: arrays.h:70
PAGroup give_analgroup(void) const
Definition: problem.cpp:179
#define _errorr6(_1, _2, _3, _4, _5, _6)
Definition: gelib.h:149
virtual void read_output_SIFEL(FILE *stream, long step, ResultTypesAtElem rt)
Definition: cell.h:723
const Array * give_results(long step, ResultTypesAtElem rt) const
Definition: cell.h:692
PolyLine * generate_mesh_RFbyHN(Mesh *pm, GPA< const Node > &hnodes) const
Definition: cell.cpp:1221
DOFsPerNode
Definition: alias.h:700
void mesh_quality(void) const
compute mesh quality
Definition: geometry.cpp:1406
void add_point(const Point *val)
Definition: cell.h:510
void sort_polydata(Xvctr *data) const
sort polydata data
Definition: geometry.cpp:2695
virtual void initialize(void)
initiate/sets data
Definition: geometry.cpp:1355
long give_parent_prop(void) const
Definition: cell.h:657
void wdg_another_Elem(Element *comp, long nid)
Definition: geometry.cpp:158
const GPA< BoundaryCond > * give_BCs(void) const
Definition: problem.h:318
long give_domain(void) const
Definition: cell.h:642
VTKdataset giveVTKDS(void)
other
Definition: geometry.cpp:368
void assign_BodyLoad_by_elem_ID(const BoundaryCond *bc, long id)
assign body load to the element by/via ...
Definition: geometry.cpp:2744
long * cNodesInSD
Definition: geometry.h:293
void add_another_Element(FElement *elem, long dom)
adds elem to the end of array Elements
Definition: geometry.cpp:1398
void make_invisible(Point *master, bool duplcheck)
Definition: point.cpp:320
General functions.
long give_nsteps(void) const
Definition: problem.cpp:182
void TF_GPA_add_another(GPA< T > &list, T *comp, const Geometry *mg)
adds component to the end of list of Components
Definition: geometry.cpp:148
void scan_expect_num(FILE *stream, long expctd)
cte SRDC's I-DEAS UNV soubory
Definition: geometry.cpp:1933
const FiLe * give_IN_file_bgm(void) const
Definition: problem.h:194
void set_FETS(const FiniteElementTypeSet *val)
Definition: attribute.cpp:1273
bool relink_downF(void)
Definition: tixy2.h:154
long SP_scan_word(const char *&src, char *dest)
... word; return value is length of the word
Definition: librw.cpp:528
AdaptivityParameters * give_adpa(void) const
Definition: problem.h:181
long FP_number_of_lines(FILE *stream, bool rwd)
count number of lines in file
Definition: librw.cpp:240
FILE * file(void)
*** GET ***
Definition: tixy2.h:139
void print_VTK(femFileFormat format, const char *suff)
VTK file with no data.
Definition: geometry.cpp:3407
void resize_Lata(long newsize)
print VTK file divided to severel functions
Definition: geometry.cpp:3043
#define SP_scan_expected_word_exit(_1, _2, _3, _4)
Definition: librw.h:201
const Edge * give_superedge(long i) const
Definition: point.h:111
virtual void finitialize(void)
finalize prepropcessing
Definition: geometry.cpp:72
void print_VTK_body(Stream *stream, VTKdataset ds) const
Definition: geometry.cpp:3267
MIDAS i/o vtu ff.
Definition: alias.h:637
void assign_NodeLoad_by_point_prop(const BoundaryCond *bc, long prop)
Definition: geometry.cpp:2724
void assign_NodeLoad_by_point_coords(const BoundaryCond *bc, const PoinT *coords)
Definition: geometry.cpp:2733
bool only_1d_elements(void) const
only 1d elements
Definition: geometry.cpp:269
sifel i/o native ff
Definition: alias.h:644
Input / output function.
virtual void checkConsistency(void) const
Checks data consistency.
Definition: geometry.cpp:82
void print_VTK_init_point_data(Stream *stream, long n)
Definition: geometry.cpp:3282
const Face * give_face(long i) const
Definition: cell.h:95
long give_Nels(void) const
Definition: geometry.h:67
const Element * give_superelem(long i) const
Definition: point.h:113
long FP_scan_line_skip_emptyORcommented(FILE *stream, char *dest)
*** *** *** SCANNING *** *** *** scanning == scan ...
Definition: librw.cpp:309
long cSubDomains
Definition: geometry.h:292
bool is_supported(void) const
Definition: attribute.h:1065
Point.
long give_rslts_nsteps(void) const
Definition: geometry.h:328
int give_dimension(void) const
return type of element geometry, is identical with class derived from FElement
Definition: cell.h:32
Interface to library T3D.
void TF_GPA_cleanup_duplicity(const StdoutDriver *sodriver, T &list, const char *name, char t, bool shake)
clean up duplicity components
Definition: geometry.cpp:2372
#define SP_scan_expected_number_exit(_1, _2, _3)
Definition: librw.h:229
const Dvctr * give_resultsE_dv(long regid, long step, ResultTypesAtElem rt) const
Definition: point.cpp:1057
void TF_GPA_reidoid(GPA< T > &list)
reset ids ascending
Definition: taux.h:25
virtual Point * allocate_point(long gid, const PoinT *coo, char attribs_alloc='n')=0
const GPA< const BoundaryCond > * give_loads(void) const
Definition: attribute.h:594
const PoinT * give_boubox_diff(void) const
Definition: geometry.cpp:340
void print_info_message(SODenum flag, const char *format,...) const
Definition: taux.cpp:240
*** *** *** *** CLASS MESHGEOMETRY *** *** *** ***
Definition: dupl.h:22
void print_block_elems(FILE *stream, femFileFormat fff, int did)
print input file for solver - block with elements
Definition: geometry.cpp:2911
bool SP_skip_word(const char *&src, int n)
... word and space before
Definition: librw.cpp:472
void read_output_SIFEL(void)
read native output file of SIFEL
Definition: geometry.cpp:2211
void TF_GPA_print_list(FILE *stream, const char *name, const char *name2, T &list, long id)
Definition: geometry.cpp:2972
virtual long give_size(void) const
Definition: arrays.h:387
const char * XP_giveDAtext(const XMLNode *xelem, int n, bool last, const char *format, const char *type, const char *name, int *noc)
Definition: tixy2.cpp:137
void kill_damned_elems(void)
KILL ELEMENTS marked by flag "delete" ; KILL = invisible + delete.
Definition: geometry.cpp:174
void assign_EdgeLoad_by_elem_ID(const BoundaryCond *bc, long id, int indx=-1)
assign edge load to the edge by/via ...
Definition: geometry.cpp:2757
void assemble_full_constrained(Lvctr *aa) const
Definition: attribute.h:1071
#define STRCMP
Definition: alias.h:44
unknows in transport, N=ndofs
Definition: alias.h:207
The element is a container class.
Definition: tinyxml2.h:1116
void assign_FaceLoad_by_face_prop(const BoundaryCond *bc, long prop)
Definition: geometry.cpp:2788
#define SP_scan_expected_word2_exit(_1, _2, _3, _4, _5)
Definition: librw.h:202
virtual void read_input(const char *&str, femFileFormat fff)
Definition: cell.cpp:1816
double give_CSusage_elast_rel(void)
Definition: cell.cpp:1757
#define _openFilePN(_1, _2, _3, _4)
Definition: gelib.h:174
void add_another_Pjnt(Point *comp)
Definition: geometry.cpp:153
void print_VTK_data_body(Stream *stream, long n, const char *name, const GPA< Array1d > *data, char type, bool r2z=false)
Definition: geometry.cpp:3300
void print_info_message_core(SODenum flag, ETCLR color=ETC_DEFAULT, const char *buffer=NULL) const
Definition: taux.cpp:280
void set_node(long i, long nid)
ATRIBUTES.
Definition: cell.h:649
void RIGIDmatToRAN(void)
rigid material to RAN
Definition: geometry.cpp:1464
void assign_BodyLoad_by_elem_prop(const BoundaryCond *bc, long prop)
Definition: geometry.cpp:2749
int CellGeometry_e2i_VTK(CellGeometry cg)
Definition: alias.h:911
const char * give_path(void) const
Definition: taux.h:141
virtual ~Geometry(void)
DESTRUCTOR.
Definition: geometry.cpp:46
int give_CSusage_elast_bool(void)
Definition: cell.cpp:1778
long give_ID() const
Definition: subject.h:45
long give_Neds(void) const
Definition: geometry.h:65
void find_slaves(void)
cte VLNA soubory, zatim omezene
Definition: geometry.cpp:2342
void connectivity_assembling(bool re=false)
Function assembles connectivity between element and its nodes, edges and faces (which are allocated i...
Definition: cell.cpp:852
bool relink_up(void)
Definition: tixy2.h:156
Duplicity.
bool give_elemprop(void) const
Definition: geometry.h:47
GPA< const Dvctr > pData
Definition: geometry.h:376
#define errol
Definition: gelib.h:142
void connectivity_removing(void)
Function removes connectivity between element and its components == nodes, edges and faces...
Definition: cell.cpp:939
void read_mesh_T3d(char *path, const char *filename)
kompletni T3d mesh file
Definition: geometry.cpp:1638
bool VTKCT_is_assembled(void) const
Definition: geometry.h:136
Mesh * give_Mesh(long i) const
Definition: problem.h:357
MIDAS i/o vtp ff.
Definition: alias.h:636
long give_numsuperedge(void) const
Definition: point.h:108
oofem i/o native ff
Definition: alias.h:643
void print_characteristics_to_VTK(bool mft=true)
Definition: geometry.cpp:3891
#define _errorr2(_1, _2)
Definition: gelib.h:145
bool scan_x(FILE *stream)
Definition: arrays.h:68
void print_dat_file(const char *file, long n, const Dvctr *data1, const Dvctr *data2, bool zeroline)
print data for xmgrace
Definition: geometry.cpp:3495
void SetAttribute(const char *name, const char *value)
Sets the named attribute to value.
Definition: tinyxml2.h:1299
Geometry(long gid, const Problem *p, MMprocessing proc)
CONSTRUCTOR.
Definition: geometry.cpp:24
A Document binds together all the functionality.
Definition: tinyxml2.h:1445
void redefine(FILE *stream)
Definition: tixy2.h:134
CellGeometry
Definition: alias.h:840
Classes Cell, Facedge, Edge, Face, Element, Gelement, PolyLine, Line, PolygonMdl, FElement...
void give_displcmnt_in_all_steps(Dvctr *data, int indx) const
Definition: point.cpp:1073
bool isFile(void)
Definition: tixy2.h:150
void resize_ignore_vals(long r, long c)
print yourself
Definition: arrays.cpp:711
void replace_Pjnt_by(Point *Pold, Point *Pnew)
invisible and delete old, set ID and assign new, of new
Definition: geometry.cpp:161
void print_block_nodal_load(FILE *stream, femFileFormat fff, int did)
print input file for solver - block with nodal load
Definition: geometry.cpp:2919
XMLElement * NewElement(const char *name)
Create a new Element associated with this Document.
Definition: tinyxml2.cpp:1555
const char * give_OUT_Path(void) const
Definition: problem.h:200
const FiLe * give_IN_file_results(void) const
Definition: problem.h:192
MMprocessing give_gp(void) const
Definition: geometry.h:45
void initialize_domli(bool shared, long dom, long li)
Definition: point.cpp:529
void TF_GPA_wdg_another(GPA< T > &list, T *comp, const Geometry *mg, long nid)
Definition: geometry.cpp:151
const char * give_base(void) const
Definition: taux.h:142
long give_cMesh(void) const
Definition: problem.h:359
GPA< PoinT > points
Definition: geometry.cpp:992
virtual void set_model_prop(long val, const Model *model, bool flag=false)
Definition: cell.cpp:1620
void resize_Data_members(long newsize)
Definition: geometry.cpp:3076
PAType give_analloctype(void) const
Definition: problem.cpp:181
const Point * give_point(long i) const
Definition: cell.h:93
void set_RTE(ResultTypesAtElem rt, bool val)
Definition: geometry.h:315
const Problem * give_Pd(void) const
Definition: subject.h:48
GPA< Lvctr > Lata
dd
Definition: geometry.h:373
bool isModel(void) const
Definition: geometry.h:180
void resize_Lata_members(long newsize)
Definition: geometry.cpp:3055
void boubox_assembling(long indx=-1)
Definition: geometry.cpp:308
virtual classID give_classid() const
Returns classID - class identification.
Definition: point.h:251
void print_geom_info(void) const
print info about geometry of mesh
Definition: geometry.cpp:396
const Model * Master
Definition: geometry.h:279
int give_melnik(void) const
Definition: problem.h:204
void join_geom(Geometry *geom)
Definition: geometry.cpp:846
t3d i/o native ff
Definition: alias.h:641
void read_mesh_ANSYS(char *path, const char *filename)
zatim to cte jen primitivni batch file pro ANSYS kterej obsahuje jen coordinaty of nodes a trojuhelni...
Definition: geometry.cpp:1520
void assign_attributes(PointAttribs *na)
Definition: point.h:266
GPA< Face > Faces
Definition: geometry.h:59
virtual ~Model(void)
DESTRUCTOR.
Definition: geometry.cpp:927
void read_input(const char *&str, femFileFormat fff)
*** READ ***
Definition: point.cpp:723
PointAttribs * give_pointAttribs(void)
Definition: point.h:93
bool find_parent_subdom(long sdid, long *nn, long *level)
Definition: point.cpp:622
const char * give_name(void) const
Definition: taux.h:146
virtual classID give_classid() const
Returns classID - class identification.
Definition: geometry.h:391
void print_bc(FILE *stream, femFileFormat fff) const
Definition: attribute.cpp:1972
reaction, N=ndofs
Definition: alias.h:206
long give_cCS(void) const
Definition: problem.h:328
void transform_to_mesh(void)
Definition: geometry.cpp:1193
void print_info_message_colour(SODenum flag, ETCLR colour, const char *format,...) const
Definition: taux.cpp:253
const Problem * Pd
Pointer to owner = parent problem.
Definition: subject.h:24
const char * Value() const
The meaning of 'value' changes for the specific type.
Definition: tinyxml2.h:647
Model(long gid, const Problem *p, MMprocessing mmp)
CONSTRUCTOR.
Definition: geometry.cpp:922
const Mesh * Msh(void) const
Definition: cell.h:615
XMLDocument * tix_doc(void)
Definition: tixy2.h:143
void read_model_MELNIK(void)
Definition: geometry.cpp:1001
const char * Attribute(const char *name, const char *value=0) const
Given an attribute name, Attribute() returns the value for the attribute of that name, or null if none exists.
Definition: tinyxml2.cpp:1226
void connectivity_assembling(void)
Function computes connectivity of mesh.
Definition: geometry.cpp:213
bool RTN[cRTN]
Definition: geometry.h:304
PointAttribs * release_attributes(void)
slouzi k premene Node na RAN nebo HN
Definition: point.h:265
bool ST_scan_number(Stream *src, int &dest)
*** *** *** *** TINYXML FCE *** *** *** ***
Definition: tixy2.cpp:36
void set_ID(long val)
Definition: subject.h:44
void add_another_Edge(Edge *comp)
Definition: geometry.cpp:154
const Dscal * give_resultsN_ds(long step, ResultTypesAtNode rt) const
Definition: point.cpp:1054
MMprocessing gp
Definition: geometry.h:36
long give_Nfas(void) const
Definition: geometry.h:66
Geometry description.
Definition: geometry.h:29
special one time format for bridge in Melnik
Definition: geometry.cpp:989
void read_model_polylines(const char *path, const char *filename)
nput file with polylines first line: #1 - number of polylines first line of polyline: #1 #2 #3 #4...
Definition: geometry.cpp:945
bool FP_skip_line(FILE *stream, int n)
move file descriptor to the start of the n-th new line //[former read_line]
Definition: librw.cpp:167
long give_Npts(void) const
Definition: geometry.h:64
XMLElement * tixel(void)
Definition: tixy2.h:141
void set_point(long i, const PoinT *p)
Definition: dupl.h:51
void add_resultE(Dvctr *rslt, long regid, long step, ResultTypesAtElem rt)
Definition: point.cpp:1050
char * solver_file_ptr
Definition: problem.h:81
const Point * give_Pjnt_with_prop(long prp, bool unique) const
Definition: geometry.cpp:116
long FP_scan_line(FILE *stream, char *dest)
scan/copy line == string without ' ' from stream
Definition: librw.cpp:321
void print_info_time_green_ok(SODenum flag, double sec) const
Definition: taux.cpp:266
Geometry * give_primary_geometry(void) const
Definition: problem.cpp:197
void print_supported_BC_to_line(FILE *stream, femFileFormat fff) const
Definition: attribute.cpp:1935
virtual void checkConsistency(void) const
Checks data consistency.
Definition: geometry.cpp:1392
Interface to library OOFEM.
const Edge * give_Edge(long i) const
Definition: geometry.h:69
const FiLe * give_OUT_moFILE(void) const
Definition: problem.h:201
void read_output_OOFEM(FILE *stream, long step, ResultTypesAtNode rt)
Definition: point.cpp:800
void open(Stream_type t, const char *rw, const char *&fn, XMLNode *node=NULL)
*** SET ***
Definition: tixy2.h:74
double give_aver_elem_circ(void) const
Definition: geometry.cpp:304
ElemAttribs * give_elemAttribs(void)
Definition: cell.h:402
bool scan_xyz(FILE *stream)
Definition: arrays.h:71
void find_subdomains(void)
subdomain
Definition: geometry.cpp:2471
XMLError QueryLongAttribute(const char *name, long *value) const
Given an attribute name, QueryIntAttribute() returns XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the co...
Definition: tinyxml2.h:1212
void generate_mesh_primary(void)
Definition: geometry.cpp:1256
void aver_elem_circ_assembling(long indx=-1)
Definition: geometry.cpp:278
FacedgeAttribs * give_facedgeAttribs(void)
Definition: cell.h:198
void resize_ignore_vals(long r, long c)
Definition: arrays.cpp:665
void read_VTK(char DATASET, Stream *stream, bool addata=false, bool sparse=false)
CORE read of VTK file.
Definition: geometry.cpp:561
Lvctr * resize_ignore_vals(long newsize)
resize, ignore values
Definition: arrays.h:472
const FiLe * give_P_mesherbinary(void) const
Definition: problem.h:180
void connectivity_allocation(void)
Function allocates arrays necessary for connectivity assembling.
Definition: geometry.cpp:206
void print_control(FILE *conout) const
Function prints contol data.
Definition: geometry.cpp:2980
GPA - Generic Pointer Array, template class manages 1d array of pointers to objects of type T...
Definition: gpa.h:23
bool scan_y(FILE *stream)
Definition: arrays.h:69
virtual void print_row(FILE *stream, femFileFormat fff, bool endline=true, long did=0) const
print node row output for solver
Definition: point.cpp:923
#define ZERO_NC
Definition: alias.h:52
const Face * give_superface(long i) const
Definition: point.h:112
void geom_stats_assembling(const GeometryComponent *comp)
Definition: geometry.cpp:349
MIDAS i/o vtk ff.
Definition: alias.h:635
#define _errorr(_1)
Definition: gelib.h:151
femFileFormat give_ff(void) const
Definition: taux.h:147
void resize(long newsize)
reallocate receiver to the new size
Definition: gpa.h:98
const char * give_name_or_null(void) const
Definition: taux.h:145
void assign_cellpoints(void)
Definition: dupl.cpp:49
void print_VTK_nodes(Stream *stream) const
Definition: geometry.cpp:3145
void read_mesh_UNV(char *path, const char *filename)
Definition: geometry.cpp:1941
adaptivity, element characteristic size, actual
Definition: alias.h:209
SStype
type of stress/strain state of element; especially results depends on this variable => described at M...
Definition: alias.h:954
#define _errorr3(_1, _2, _3)
Definition: gelib.h:146
const Gelement * give_mdl_masterel(void) const
Definition: cell.h:645
const StdoutDriver * sodriver(void) const
Definition: problem.h:90
adaptivity, refined derivatives
Definition: alias.h:208
bool give_fulldata(void) const
Definition: problem.h:206
Mathematic functions.
const char * give_IN_Path(void) const
Definition: problem.h:191
SStype give_sst(void) const
Definition: attribute.h:838
void set_point(long i, const Point *val)
ATRIBUTES.
Definition: cell.h:84
void resize_Data(long newsize)
Definition: geometry.cpp:3064
long give_regid(void) const
Definition: cell.h:682
void print_info(void) const
Definition: geometry.cpp:383
void close(void)
Definition: tixy2.h:112
long give_numsuperface(void) const
Definition: point.h:109
double critical_coeff
Definition: geometry.h:302
ansys i/o native ff
Definition: alias.h:642
MMprocessing
Definition: alias.h:616
bool FP_skip_expected_string(FILE *src, const char *expctd, bool cs)
... word and compare with expected one
Definition: librw.cpp:376
void FETSet_si2set(const char *str, int val, Solver sol, PAGroup pg, FiniteElementTypeSet *set)
Definition: alias.h:1139
Node * Nodes(long i) const
Definition: geometry.h:347
bool FP_skip_space(FILE *stream)
... space
Definition: librw.cpp:277
virtual void cpat(long i, const Xvctr *p, long j)=0
void read_structural_analysis_output(void)
read output file from structural analysis package
Definition: geometry.cpp:2018
long give_nstepsOut(FILE *stream, femFileFormat ff, PAType pt, const Problem *Pd)
Definition: geometry.cpp:2046
void check_duplicity_nodes(void)
set up duplicity nodes
Definition: geometry.cpp:2414
void print_block_gravity_load_ANSYS(FILE *stream) const
print input file for solver - block with gravity load
Definition: geometry.cpp:2936
bool FP_skip_behind_line_starting_with(FILE *stream, const char *string, bool cs)
move file descriptor to the start of the new line after the one starting with string ...
Definition: librw.cpp:181
#define CASE
Definition: alias.h:43
MeshGenerator give_P_mesher(void) const
Definition: problem.h:179
void mesh_generate_T3d(const Problem *pd, const char *solver, const char *options_string)
Definition: module_t3d.cpp:19
int is_my_ch(char *chn)
Definition: geometry.cpp:996
const Dscal * give_results_ds(long step, ResultTypesAtElem rt) const
Definition: cell.cpp:1714
void read_mesh_SIFEL(FILE *stream)
read native input file to SIFEL
Definition: geometry.cpp:1873
double length(void)
Definition: geometry.cpp:994
Lvctr * rslts_step
Definition: geometry.h:300
long give_OUT_printStep(void) const
Definition: problem.h:202
virtual void read_output_OOFEM(FILE *stream, long step)
Definition: cell.h:722
double * give_ptr2val(long r=0, long c=0)
Definition: arrays.h:793
GPA< Dvctr > Data
Definition: geometry.h:374
void setup_full_alloc_DOFvals_at(Dvctr *d, ResultTypesAtNode rt, long step) const
Definition: point.cpp:1063
double aver_elem_circ
Definition: geometry.h:115
bool give_3Delement_with_point_inside(const PoinT *coords, const GeometryComponent *&comp, PoinT *nc) const
Function finds location of point indide of which 3d element is.
Definition: geometry.cpp:863
long VTKCTcl
ELEMENT STATS // VTK cells types - count elements of type:
Definition: geometry.h:111
double give_IN_meshGen_elemSize(void) const
Definition: problem.h:195
bool is_loaded(void) const
Definition: attribute.h:598
const char * give_output_file(void) const
Definition: problem.h:255
void assign_EdgeLoad_by_elem_prop(const BoundaryCond *bc, long prop)
Definition: geometry.cpp:2763
void print_block_supported_dofs(FILE *stream, femFileFormat fff, int did)
print input file for solver - block with supported nodes
Definition: geometry.cpp:2892
void set_resultE(const Dmtrx *rslt, long regid, long step, ResultTypesAtElem rt)
Definition: point.cpp:1051
const Element * give_Elem(long i) const
Definition: geometry.h:71
Dvctr * rslts_loadlevel
Definition: geometry.h:301
void give_vtk_polydata_counts(long &cl, long &cp) const
get/compute count of VTK polydata elements
Definition: geometry.cpp:251
void set_lid(long val)
Definition: cell.h:638
bool SP_scan_number(const char *&src, int &dest)
... number of type int/long/double
Definition: librw.cpp:595
long give_numsuperelem(void) const
Definition: point.h:110
void read_output_SIFEL(FILE *stream, long step, ResultTypesAtNode rt)
Definition: point.cpp:852
*** *** *** *** CLASS COMPONENT *** *** *** ***
Definition: geomcomp.h:22
tato struktura by mela obsahovat vsechny potrebne informace pro urceni konkretni implementace konecne...
Definition: alias.h:1019
void set_error(double val)
Definition: taux.h:334
bool give_nodeprop(void) const
Definition: geometry.h:46
virtual void print_row(FILE *stream, femFileFormat fff, bool endline=true, long did=0) const
print element row output for OOFEM
Definition: cell.cpp:1935
void find_duplicitys(long &nd, long *Cduplicity, long **duplicity)
return duplicity squads = 2 or more points with same coordinates nd ...
Definition: dupl.cpp:139
long give_nno(void) const
Definition: cell.h:89
void set_mprop(long val)
*** SET ***
Definition: cell.cpp:971
virtual XMLNode * ShallowClone(XMLDocument *document) const
Make a copy of this node, but not its children.
Definition: tinyxml2.cpp:1453
Point * allocate_point(long gid, const PoinT *coo, char attribs_alloc='n')
Definition: geometry.cpp:500
long * NumNodes
Definition: geometry.h:290
bool only_vtk_polydata(void) const
all elements is polydata compatible
Definition: geometry.cpp:260
#define _warningg5(_1, _2, _3, _4, _5)
Definition: gelib.h:160
const XMLNode * LastChild() const
Get the last child node, or null if none exists.
Definition: tinyxml2.h:689
void set_result(long s, double *rslt, long step, ResultTypesAtElem rt)
Definition: cell.cpp:1709
#define _errorr4(_1, _2, _3, _4)
Definition: gelib.h:147
bool connectivity_assembled
when any function changes geometry there are two types of "set" functions a) stat is not activated =>...
Definition: geometry.h:107
void read_mesh_equal_to_model(void)
make mesh equal to model - no remeshing process
Definition: geometry.cpp:1763
void delete_subdomains_except(long leave)
delete all subdomains except "leave"
Definition: geometry.cpp:2523
void print_block_nodes(FILE *stream, femFileFormat fff, int did)
PRINTING OF FILES.
Definition: geometry.cpp:2884
void read_addata_VTK(const char *filename, bool sparse)
Definition: geometry.cpp:539
XMLDeclaration * NewDeclaration(const char *text=0)
Create a new Declaration associated with this Document.
Definition: tinyxml2.cpp:1582
void set_resultN(long s, const double *rslt, long step, ResultTypesAtNode rt)
Definition: point.cpp:1048
const Node * give_Node(long i) const
Definition: geometry.h:353
#define FP_scan_expected_word_exit(_1, _2, _3, _4)
Definition: librw.h:107
void print_VTK_START(Stream *stream, const Mesh *mg, const char *name, VTKdataset ds)
Definition: geometry.cpp:3088
count of ...
Definition: alias.h:211
T * add(T *val)
add (assign) new pointer to the end; enlarge the receiver if too small
Definition: gpa.h:157
double give_lav(void) const
Definition: cell.h:35
Solver rslts_solver
RESULTS == structural analysis output data.
Definition: geometry.h:298
bool is_first_diag_short(void)
if the first diagonal is shorter then the second
Definition: cell.cpp:3359
Class Geometry, Model and Mesh.
virtual double give_ssstate(Dvctr *data, SStype SST, RVType rvtype, char type, long step, const Node *node=NULL)=0
give stress-strain state
#define _errorr0
Definition: gelib.h:143
GPA< Point > Pjnts
Definition: geometry.h:57
void cleanup_duplicities(void)
clean up duplicities (nodes,lines)
Definition: geometry.cpp:2390
void read_mesh_OOFEM(FILE *stream, long nn, long ne)
read native input file to OOFEM
Definition: geometry.cpp:1822
#define _openFilePNS(_1, _2, _3, _4, _5)
Definition: gelib.h:175
void add_another_Elem(Element *comp)
Definition: geometry.cpp:156
void read_output_OOFEM(void)
read native output file of OOFEM
Definition: geometry.cpp:2120
void adaptivity(void)
ADAPTIVITY.
Definition: geometry.cpp:3950
const GPA< const Element > * give_superelems(void) const
Definition: point.h:116
long give_parent_id(void) const
Definition: cell.h:656
bool RTE[cRTE]
Definition: geometry.h:305
Elem3D * dvd(double val)
Definition: arrays.h:60
void assign_FaceLoad_by_elem_prop(const BoundaryCond *bc, long prop)
Definition: geometry.cpp:2779
Mesh(long gid, const Problem *p, long numdom, MMprocessing mmp)
CONSTRUCTOR.
Definition: geometry.cpp:1311
void anyBeamElem_assembling(long indx=-1)
Definition: geometry.cpp:292
void generate_mesh_RFbyHN(void)
Definition: geometry.cpp:1227
double give_required_error(void) const
Definition: taux.h:329
const FiLe * give_IN_file_results_addataVTK(void) const
Definition: problem.h:193
long give_lid_id(long dom) const
vraci lid of node, pro non-Parallel vraci id
Definition: point.h:275
PAType give_analtype(void) const
Definition: problem.cpp:180
void print_JKTK(femFileFormat format, const char *suff)
print geometry to JKTK format file
Definition: geometry.cpp:3451
long give_mpropertyORzero(void) const
Definition: geomcomp.h:132
PoinT * copy(const PoinT *p)
Definition: arrays.h:99
void deallocateCheck(ArgType *p, bool check=true)
*** *** *** *** DEALLOCATE TEMPLATES *** *** *** ***
Definition: gelib.h:192
void set_regid(long val)
Definition: cell.h:677
void print_results(void)
TADY BUDOU VSECHNY INFORMACE O VYSLEDCICH ZE SOLVERU.
Definition: geometry.cpp:3524
long give_ccols(void) const
Definition: arrays.h:729
adaptivity, element characteristic size, new
Definition: alias.h:210
void TF_GPA_shake_down_reidoid(GPA< T > &list)
clear out NULL components
Definition: taux.h:29
void VTKCT_assembling(long indx=-1)
sum counts of VTK cell types
Definition: geometry.cpp:225
VTKPDtopology
VTK type of cell topology for POLYDATA.
Definition: alias.h:931
jktk i/o
Definition: alias.h:639
T * wedge(long i, T *val)
Definition: gpa.h:164
void read_mesh_JKTK(char *path, const char *filename)
JKTK file format.
Definition: geometry.cpp:1586
virtual void initialize(void)
initiate/sets data
Definition: geometry.cpp:55
XMLNode * InsertEndChild(XMLNode *addThis)
Add a child node as the last (right) child.
Definition: tinyxml2.cpp:658
GPA< Element > Elems
Definition: geometry.h:60
const XMLNode * NextSibling() const
Get the next (right) sibling node of this node.
Definition: tinyxml2.h:723
const Point * give_Pjnt(long i) const
Definition: geometry.h:68
void print_VTK_init_cell_data(Stream *stream, long n)
Definition: geometry.cpp:3290
virtual classID give_classid() const
Returns classID - class identification.
Definition: subject.h:35
double give_CSusage_elast(void)
Definition: cell.cpp:1737
FILE * scan_DATA_head(FILE *stream, const char *str, const char *expnumtype, int *noc, const char *descript)
Definition: geometry.cpp:460
long rslts_nsteps
Definition: geometry.h:299
Problem description.
Definition: problem.h:74
const PoinT * give_coords(void) const
Definition: point.h:89
long * NumElems
Definition: geometry.h:290
CellGeometry CellGeometry_i2e_JKTK(int val)
Definition: alias.h:864
bool relink_downL(void)
Definition: tixy2.h:155
Element * allocate_element(bool mdl, CellGeometry eg, long gid, long oid, Geometry *geom, int np=0, bool attribs_alloc=true, long dom=0, long lid=-1)
Definition: geometry.cpp:512
Elem3D * sub(const Elem3D *p)
Definition: arrays.h:62
long give_anyBeamElem(void) const
Definition: geometry.cpp:305
int give_nDOFs(void) const
Definition: attribute.h:1056
void add_another_Face(Face *comp)
Definition: geometry.cpp:155
displacement, N=ndofs
Definition: alias.h:205
double give_coord(int i) const
Definition: point.h:90
void assign_FaceLoad_by_elem_ID(const BoundaryCond *bc, long id, int indx=-1)
assign face load to the face by/via ...
Definition: geometry.cpp:2773
bool FP_scan_expected_word(FILE *src, const char *expctd, bool cs)
... word and compare with expected one
Definition: librw.cpp:388
bool FP_skip_comment(FILE *stream)
*** *** *** *** FILE PROCESSING *** *** *** *** general rules for file processing: ...
Definition: librw.cpp:130
VTKPDtopology give_VTKPDtopology_of_elem(long i) const
Definition: geometry.cpp:377
double volume_core(void) const
print volume to extra file
Definition: geometry.cpp:4141