NeoPZ
neopz_bindings.cpp
Go to the documentation of this file.
1 #include <pybind11/pybind11.h>
2 #include <pybind11/operators.h>
3 #include <pybind11/iostream.h>
4 #include <pybind11/stl.h>
5 #include <pybind11/stl_bind.h>
6 
7 // cpp STL
8 #include <map> // for map
9 #include <set> // for set
10 
11 namespace py = pybind11;
12 using namespace py::literals;
13 
14 // NeoPZ container classes
15 #include "pzmanvector.h"
16 #include "pzfmatrix.h"
17 #include "pztrnsform.h"
18 
19 // NeoPZ topology classes
20 #include "tpzpoint.h"
21 #include "tpzline.h"
22 #include "tpztriangle.h"
23 #include "tpzquadrilateral.h"
24 #include "tpztetrahedron.h"
25 #include "tpzpyramid.h"
26 #include "tpzprism.h"
27 #include "tpzcube.h"
28 
29 // Mesh
30 #include "pzgmesh.h"
31 #include "TPZGmshReader.h"
32 #include "TPZVTKGeoMesh.h"
33 #include "pzgeoelbc.h"
34 #include "pzgeoelside.h"
35 #include "tpzgeoelrefpattern.h"
36 
37 #include "pzcmesh.h"
38 
39 // Matrix
40 #include "pzmatrix.h"
41 
42 //StrMatrix
43 #include "pzstrmatrix.h"
44 #include "pzfstrmatrix.h"
45 #include "TPZSSpStructMatrix.h"
46 #include "TPZFrontStructMatrix.h"
48 #include "TPZStructMatrixBase.h"
49 #include "pzskylstrmatrix.h"
51 
52 // Material
53 #include "TPZMaterial.h"
54 #include "pzpoisson3d.h"
55 #include "TPZMatElasticity2D.h"
56 #include "pzelast3d.h"
57 #include "pzbndcond.h"
58 #include "pzanalysis.h"
59 #include "pzstepsolver.h"
60 #include "pzpostprocanalysis.h"
61 
62 #include "pzsolve.h"
63 #include "tpzautopointer.h"
64 
65 // Elastoplasticity
66 #include "TPZBndCondWithMem.h"
67 #include "TPZBndCondWithMem_impl.h"
68 #include "TPZMatElastoPlastic2D.h"
69 #include "TPZPlasticStepPV.h"
70 #include "TPZYCMohrCoulombPV.h"
71 #include "TPZElasticResponse.h"
72 #include "TPZElastoPlasticMem.h"
73 #include "TPZPlasticCriterion.h"
74 #include "TPZTensor.h"
75 #include "TPZPlasticState.h"
76 #include "TPZBndCondWithMem.h"
77 
78 // For SBFEM simulations
79 #include "TPZSBFemVolume.h"
80 #include "TPZSBFemElementGroup.h"
81 #include "TPZBuildSBFem.h"
82 #include "tpzquadraticquad.h"
83 
84 
85 using namespace std;
86 
87 PYBIND11_MAKE_OPAQUE(std::map<int,int>)
88 
89 string to_string(const string &value) {return value;}
90 
91 namespace {
92 
93  template<typename T>
94  static void declareTPZVec(py::module &mod, std::string const &suffix) {
95  using Class = TPZVec<T>;
96  using PyClass = py::class_<Class, std::shared_ptr<Class>>;
97 
98  PyClass cls(mod, ("TPZVec" + suffix).c_str());
99 
100  cls.def(py::init());
101  cls.def(py::init<int>());
102  cls.def(py::init<int64_t, T>());
103  cls.def("Resize", [](Class &vec, const int64_t &newsize) { return vec.Resize(newsize); });
104  cls.def("Size", [](const Class &vec) { return vec.size(); });
105  cls.def("__repr__",
106  [](const Class &vec) {
107  std::string r("TPZVec [");
108  r += to_string(vec[0]);
109  for (int i = 1; i < vec.NElements(); i++) {
110  r += ", ";
111  r += to_string(vec[i]);
112  }
113  r += "]";
114  return r;
115  }
116  );
117 
118  cls.def("__getitem__",
119  [](const Class &vec, int64_t position) {
120  if (position >= vec.size() || position < 0) throw py::index_error();
121  return vec[position];
122  },
123  py::is_operator()
124  );
125  cls.def("__setitem__",
126  [](Class &vec, int64_t position, T value) {
127  if (position >= vec.size() || position < 0) throw py::index_error();
128  vec[position] = value;
129  },
130  py::is_operator()
131  );
132 
133  } //declareTPZVec
134 
135 
136  template <typename T>
137  static void declareTPZManVector(py::module & mod, std::string const & suffix) {
138  using Class = TPZManVector<T>;
139  using PyClass = py::class_<Class, std::shared_ptr<Class>, TPZVec<T> >;
140 
141  PyClass cls(mod, ("TPZManVector" + suffix).c_str());
142 
143  cls.def(py::init());
144  cls.def(py::init<int>());
145  cls.def(py::init<int64_t, T>());
146  cls.def("Resize", [](Class & vec, const int64_t& newsize) { return vec.Resize(newsize); });
147  cls.def("Size", [](const Class & vec) { return vec.size(); });
148  cls.def("__repr__",
149  [](const Class & vec) {
150  std::string r("TPZManVector [");
151  r += to_string(vec[0]);
152  for (int i = 1; i < vec.NElements(); i++) {
153  r += ", ";
154  r += to_string(vec[i]);
155  }
156  r += "]";
157  return r;
158  }
159  );
160 
161  cls.def("__getitem__",
162  [](const Class & vec, int64_t position) {
163  if (position >= vec.size() || position < 0) throw py::index_error();
164  return vec[position];
165  },
166  py::is_operator()
167  );
168  cls.def("__setitem__",
169  [](Class & vec, int64_t position, T value) {
170  if (position >= vec.size() || position < 0) throw py::index_error();
171  vec[position] = value;
172  },
173  py::is_operator()
174  );
175 
176  } //declareTPZManVector
177 
178  template <typename T>
179  static void declareTPZStack(py::module & mod, std::string const & suffix) {
180  using Class = TPZStack<T>;
181  using PyClass = py::class_<Class, std::shared_ptr<Class>>;
182 
183  PyClass cls(mod, ("TPZStack" + suffix).c_str());
184 
185  cls.def(py::init());
186  cls.def(py::init<int, T>());
187  cls.def("Push", [](Class & stack, T object) {
188  stack.Push(object);
189  });
190  cls.def("Pop", [](Class & stack) {
191  return stack.Pop();
192  });
193  cls.def("Peek", [](Class & stack) {
194  return stack.Peek();
195  });
196  cls.def("__repr__",
197  [](const Class & stack) {
198  std::string r("TPZStack [");
199  for (int i = 0; i < stack.NElements(); i++) {
200  r += to_string(stack[i]);
201  if (i != stack.NElements() - 1) {
202  r += ", ";
203  }
204  }
205  r += "]";
206  return r;
207  }
208  );
209  } //declareTPZStack
210 
211 }// dummyNamespace
212 
214  m.doc() = R"pbdoc(
215  -------------------------
216  Python bindings for NeoPZ
217  -------------------------
218  )pbdoc";
219 
220 
221 //CONTAINERS
222  declareTPZVec<int>(m, "_int");
223  declareTPZVec<int64_t>(m, "_int64_t");
224  declareTPZVec<double>(m, "_double");
225  declareTPZVec<std::string>(m, "_string");
226 
227  declareTPZManVector<int>(m, "_int");
228  declareTPZManVector<int64_t>(m, "_int64_t");
229  declareTPZManVector<double>(m, "_double");
230  declareTPZManVector<std::string>(m, "_string");
231 
232  declareTPZStack<int>(m, "_int");
233  declareTPZStack<int64_t>(m, "_int64_t");
234  declareTPZStack<double>(m, "_double");
235  declareTPZStack<std::string>(m, "_string");
236 
237  // TPZFMatrix<double> bindings
238  py::class_<TPZFMatrix<double>>(m, "TPZFMatrix")
239  .def(py::init())
240  .def(py::init<int64_t, int64_t>())
241  .def(py::init<int64_t, int64_t, double>())
242  .def("GetVal", [](TPZFMatrix<double>& matrix, const int64_t& row, const int64_t& col) {
243  if (row >= matrix.Rows() || row < 0) throw py::index_error();
244  if (col >= matrix.Cols() || col < 0) throw py::index_error();
245  return matrix.GetVal(row, col);
246  })
247  .def("SetItem",
248  [](TPZFMatrix<double>& mat, int64_t rows, int64_t cols, double value) {
249  if (rows >= mat.Rows() || rows < 0) throw py::index_error();
250  if (cols >= mat.Cols() || cols < 0) throw py::index_error();
251  mat(rows,cols) = value;
252  }//, py::is_operator()
253  )
254  .def("__repr__",
255  [](TPZFMatrix<double>& matrix) {
256  std::string r("TPZFMatrix ");
257  r += "'(";
258  r += std::to_string(matrix.Rows());
259  r += " x ";
260  r += std::to_string(matrix.Cols());
261  r += ")' = [\n";
262  for (int64_t row = 0; row < matrix.Rows(); row++) {
263  r += "\t";
264  for (int64_t col = 0; col < matrix.Cols(); col++) {
265  r += std::to_string(matrix.GetVal(row, col));
266  r += " ";
267  }
268  r += "\n";
269  }
270  r += "]";
271  return r;
272  }
273  )
274 
275  .def("Zero", & TPZFMatrix<double>::Zero)
276  .def("Cols", & TPZFMatrix<double>::Cols)
277  .def("Rows", & TPZFMatrix<double>::Rows)
278  .def("Resize", & TPZFMatrix<double>::Resize)
279  .def("SetSize", & TPZFMatrix<double>::SetSize)
280 
281  .def(py::self + py::self)
282  .def(py::self += py::self)
283  .def(py::self *= float())
284 
285  //Global Functions
286  .def("Norm", [](TPZFMatrix<double> &matrix){ return Norm(matrix);})
287  // .def("Norm", &TPZFMatrix<double>::Norm)
288 
289  ;
290 
291 
292  py::class_<TPZMatrix<double> >(m, "TPZMatrix")
293  // .def(py::init<>())
294  .def("SetIsDecomposed", & TPZMatrix<double>::SetIsDecomposed)
295 
296  .def("__repr__", [](TPZMatrix<double> &matrix){
297  std::ofstream printstream;
298  matrix.Print("Matrix = ", printstream);
299  return printstream;
300  }
301  )
302  ;
303 
304  // TPZAdmChunkVectorNodes bindings
305  py::class_<TPZAdmChunkVector<TPZGeoNode>>(m, "TPZAdmChunkVectorNodes")
306  .def(py::init<int>())
307  .def("NElements", &TPZAdmChunkVector<TPZGeoNode>::NElements)
309  .def("__getitem__",
310  [](const TPZAdmChunkVector<TPZGeoNode>& vec, int64_t position) {
311  if (position >= vec.NElements() || position < 0) throw py::index_error();
312  return vec[position];
313  },
314  py::is_operator()
315  )
316  ;
317 
318  // TPZTransform bindings
319  py::class_<TPZTransform<double>>(m, "TPZTransform")
320  .def(py::init())
321  .def(py::init<int>())
322  .def(py::init<int, int>())
323  .def("Mult", py::overload_cast<>(&TPZTransform<double>::Mult))
324  .def("Sum", py::overload_cast<>(&TPZTransform<double>::Sum))
325  .def("Mult", py::overload_cast<>(&TPZTransform<double>::Mult, py::const_))
326  .def("Sum", py::overload_cast<>(&TPZTransform<double>::Sum, py::const_))
327  .def("SetMatrix", &TPZTransform<double>::SetMatrix)
328  .def("Multiply", &TPZTransform<double>::Multiply)
329  .def("Apply", &TPZTransform<double>::Apply)
330  .def("__repr__",
331  [](const TPZTransform<double>& trans) {
332  // std::stringstream repr;
333  // trans.Print(repr);
334  // return repr.str();
335  std::string r("TPZTransform\n");
336  r += " Mult ";
337  r += "'(";
338  r += std::to_string(trans.Mult().Rows());
339  r += " x ";
340  r += std::to_string(trans.Mult().Cols());
341  r += ")' = [\n";
342  for (int64_t row = 0; row < trans.Mult().Rows(); row++) {
343  r += "\t";
344  for (int64_t col = 0; col < trans.Mult().Cols(); col++) {
345  r += std::to_string(trans.Mult().GetVal(row, col));
346  r += " ";
347  }
348  r += "\n";
349  }
350  r += "]\n";
351  r += " Sum";
352  r += "'(";
353  r += std::to_string(trans.Sum().Rows());
354  r += " x ";
355  r += std::to_string(trans.Sum().Cols());
356  r += ")' = [\n";
357  for (int64_t row = 0; row < trans.Sum().Rows(); row++) {
358  r += "\t";
359  for (int64_t col = 0; col < trans.Sum().Cols(); col++) {
360  r += std::to_string(trans.Sum().GetVal(row, col));
361  r += " ";
362  }
363  r += "\n";
364  }
365  r += "]";
366  return r;
367  }
368  )
369  ;
370 
371  // TPZPoint bindings
372  py::class_<pztopology::TPZPoint>(m, "TPZPoint")
373  .def(py::init())
374  .def_static("SideDimension", &pztopology::TPZPoint::SideDimension)
375  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &>(&pztopology::TPZPoint::LowerDimensionSides))
376  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &, int>(&pztopology::TPZPoint::LowerDimensionSides))
377  .def_static("HigherDimensionSides", &pztopology::TPZPoint::HigherDimensionSides)
378  .def_static("NSideNodes", &pztopology::TPZPoint::NSideNodes)
379  .def_static("SideNodeLocId", &pztopology::TPZPoint::SideNodeLocId)
380  .def_static("NumSides", py::overload_cast<>(&pztopology::TPZPoint::NumSides))
381  .def_static("CenterPoint", &pztopology::TPZPoint::CenterPoint)
382  .def_static("RefElVolume", [](pztopology::TPZPoint& topology) { return topology.RefElVolume(); })
383  .def_static("SideToSideTransform", &pztopology::TPZPoint::SideToSideTransform)
384  .def_static("TransformSideToElement", &pztopology::TPZPoint::TransformSideToElement)
385  .def_static("TransformElementToSide", &pztopology::TPZPoint::TransformElementToSide)
386  .def_static("IsInParametricDomain", &pztopology::TPZPoint::IsInParametricDomain)
387  .def_static("CreateSideIntegrationRule", &pztopology::TPZPoint::CreateSideIntegrationRule)
388  ;
389 
390  // TPZLine bindings
391  py::class_<pztopology::TPZLine>(m, "TPZLine")
392  .def(py::init())
393  .def_static("SideDimension", &pztopology::TPZLine::SideDimension)
394  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &>(&pztopology::TPZLine::LowerDimensionSides))
395  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &, int>(&pztopology::TPZLine::LowerDimensionSides))
396  .def_static("HigherDimensionSides", &pztopology::TPZLine::HigherDimensionSides)
397  .def_static("NSideNodes", &pztopology::TPZLine::NSideNodes)
398  .def_static("SideNodeLocId", &pztopology::TPZLine::SideNodeLocId)
399  .def_static("NumSides", py::overload_cast<>(&pztopology::TPZLine::NumSides))
400  .def_static("CenterPoint", &pztopology::TPZLine::CenterPoint)
401  .def_static("RefElVolume", [](pztopology::TPZLine& topology) { return topology.RefElVolume(); })
402  .def_static("SideToSideTransform", &pztopology::TPZLine::SideToSideTransform)
403  .def_static("TransformSideToElement", &pztopology::TPZLine::TransformSideToElement)
404  .def_static("TransformElementToSide", &pztopology::TPZLine::TransformElementToSide)
405 
406  //TODO: should use py::overload_cast<> for both methods below, but Fad<REAL> breaks for some reason not clear right now
407  // USING_FAD was checked and was ON
408  .def_static("IsInParametricDomain", (bool (*) (const TPZVec<REAL>&, REAL)) &pztopology::TPZLine::IsInParametricDomain)
409  //.def_static("IsInParametricDomain", (bool (*) (const TPZVec<Fad<REAL>>&, REAL) &pztopology::TPZLine::IsInParametricDomain)
410 
411  .def_static("CreateSideIntegrationRule", &pztopology::TPZLine::CreateSideIntegrationRule)
412  ;
413 
414  // TPZTriangle bindings
415  py::class_<pztopology::TPZTriangle>(m, "TPZTriangle")
416  .def(py::init())
417  .def_static("SideDimension", &pztopology::TPZTriangle::SideDimension)
418  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &>(&pztopology::TPZTriangle::LowerDimensionSides))
419  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &, int>(&pztopology::TPZTriangle::LowerDimensionSides))
420  .def_static("HigherDimensionSides", &pztopology::TPZTriangle::HigherDimensionSides)
421  .def_static("NSideNodes", &pztopology::TPZTriangle::NSideNodes)
422  .def_static("SideNodeLocId", &pztopology::TPZTriangle::SideNodeLocId)
423  .def_static("NumSides", py::overload_cast<>(&pztopology::TPZTriangle::NumSides))
424  .def_static("CenterPoint", &pztopology::TPZTriangle::CenterPoint)
425  .def_static("RefElVolume", [](pztopology::TPZTriangle& topology) { return topology.RefElVolume(); })
426  .def_static("SideToSideTransform", &pztopology::TPZTriangle::SideToSideTransform)
427  .def_static("TransformSideToElement", &pztopology::TPZTriangle::TransformSideToElement)
428  .def_static("TransformElementToSide", &pztopology::TPZTriangle::TransformElementToSide)
429  .def_static("IsInParametricDomain", (bool (*) (const TPZVec<REAL>&, REAL)) &pztopology::TPZTriangle::IsInParametricDomain)
430  .def_static("CreateSideIntegrationRule", &pztopology::TPZTriangle::CreateSideIntegrationRule)
431  ;
432 
433 
434  // TPZQuadrilateral bindings
435  py::class_<pztopology::TPZQuadrilateral>(m, "TPZQuadrilateral")
436  .def(py::init())
437  .def_static("SideDimension", &pztopology::TPZQuadrilateral::SideDimension)
438  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &>(&pztopology::TPZQuadrilateral::LowerDimensionSides))
439  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &, int>(&pztopology::TPZQuadrilateral::LowerDimensionSides))
440  .def_static("HigherDimensionSides", &pztopology::TPZQuadrilateral::HigherDimensionSides)
441  .def_static("NSideNodes", &pztopology::TPZQuadrilateral::NSideNodes)
442  .def_static("SideNodeLocId", &pztopology::TPZQuadrilateral::SideNodeLocId)
443  .def_static("NumSides", py::overload_cast<>(&pztopology::TPZQuadrilateral::NumSides))
444  .def_static("CenterPoint", &pztopology::TPZQuadrilateral::CenterPoint)
445  .def_static("RefElVolume", [](pztopology::TPZQuadrilateral& topology) { return topology.RefElVolume(); })
446  .def_static("SideToSideTransform", &pztopology::TPZQuadrilateral::SideToSideTransform)
447  .def_static("TransformSideToElement", &pztopology::TPZQuadrilateral::TransformSideToElement)
448  .def_static("TransformElementToSide", &pztopology::TPZQuadrilateral::TransformElementToSide)
449  .def_static("IsInParametricDomain", (bool (*) (const TPZVec<REAL>&, REAL)) &pztopology::TPZQuadrilateral::IsInParametricDomain)
450  .def_static("CreateSideIntegrationRule", &pztopology::TPZQuadrilateral::CreateSideIntegrationRule)
451  ;
452 
453  // TPZTetrahedron bindings
454  py::class_<pztopology::TPZTetrahedron>(m, "TPZTetrahedron")
455  .def(py::init())
456  .def_static("SideDimension", &pztopology::TPZTetrahedron::SideDimension)
457  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &>(&pztopology::TPZTetrahedron::LowerDimensionSides))
458  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &, int>(&pztopology::TPZTetrahedron::LowerDimensionSides))
459  .def_static("HigherDimensionSides", &pztopology::TPZTetrahedron::HigherDimensionSides)
460  .def_static("NSideNodes", &pztopology::TPZTetrahedron::NSideNodes)
461  .def_static("SideNodeLocId", &pztopology::TPZTetrahedron::SideNodeLocId)
462  .def_static("NumSides", py::overload_cast<>(&pztopology::TPZTetrahedron::NumSides))
463  .def_static("CenterPoint", &pztopology::TPZTetrahedron::CenterPoint)
464  .def_static("RefElVolume", [](pztopology::TPZTetrahedron& topology) { return topology.RefElVolume(); })
465  .def_static("SideToSideTransform", &pztopology::TPZTetrahedron::SideToSideTransform)
466  .def_static("TransformSideToElement", &pztopology::TPZTetrahedron::TransformSideToElement)
467  .def_static("TransformElementToSide", &pztopology::TPZTetrahedron::TransformElementToSide)
468  .def_static("IsInParametricDomain", (bool (*) (const TPZVec<REAL>&, REAL)) &pztopology::TPZTetrahedron::IsInParametricDomain)
469  .def_static("CreateSideIntegrationRule", &pztopology::TPZTetrahedron::CreateSideIntegrationRule)
470  ;
471 
472  // TPZPyramid bindings
473  py::class_<pztopology::TPZPyramid>(m, "TPZPyramid")
474  .def(py::init())
475  .def_static("SideDimension", &pztopology::TPZPyramid::SideDimension)
476  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &>(&pztopology::TPZPyramid::LowerDimensionSides))
477  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &, int>(&pztopology::TPZPyramid::LowerDimensionSides))
478  .def_static("HigherDimensionSides", &pztopology::TPZPyramid::HigherDimensionSides)
479  .def_static("NSideNodes", &pztopology::TPZPyramid::NSideNodes)
480  .def_static("SideNodeLocId", &pztopology::TPZPyramid::SideNodeLocId)
481  .def_static("NumSides", py::overload_cast<>(&pztopology::TPZPyramid::NumSides))
482  .def_static("CenterPoint", &pztopology::TPZPyramid::CenterPoint)
483  .def_static("RefElVolume", [](pztopology::TPZPyramid& topology) { return topology.RefElVolume(); })
484  .def_static("SideToSideTransform", &pztopology::TPZPyramid::SideToSideTransform)
485  .def_static("TransformSideToElement", &pztopology::TPZPyramid::TransformSideToElement)
486  .def_static("TransformElementToSide", &pztopology::TPZPyramid::TransformElementToSide)
487  .def_static("IsInParametricDomain", (bool (*) (const TPZVec<REAL>&, REAL)) &pztopology::TPZPyramid::IsInParametricDomain)
488  .def_static("CreateSideIntegrationRule", &pztopology::TPZPyramid::CreateSideIntegrationRule)
489  ;
490 
491  // TPZPrism bindings
492  py::class_<pztopology::TPZPrism>(m, "TPZPrism")
493  .def(py::init())
494  .def_static("SideDimension", &pztopology::TPZPrism::SideDimension)
495  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &>(&pztopology::TPZPrism::LowerDimensionSides))
496  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &, int>(&pztopology::TPZPrism::LowerDimensionSides))
497  .def_static("HigherDimensionSides", &pztopology::TPZPrism::HigherDimensionSides)
498  .def_static("NSideNodes", &pztopology::TPZPrism::NSideNodes)
499  .def_static("SideNodeLocId", &pztopology::TPZPrism::SideNodeLocId)
500  .def_static("NumSides", py::overload_cast<>(&pztopology::TPZPrism::NumSides))
501  .def_static("CenterPoint", &pztopology::TPZPrism::CenterPoint)
502  .def_static("RefElVolume", [](pztopology::TPZPrism& topology) { return topology.RefElVolume(); })
503  .def_static("SideToSideTransform", &pztopology::TPZPrism::SideToSideTransform)
504  .def_static("TransformSideToElement", &pztopology::TPZPrism::TransformSideToElement)
505  .def_static("TransformElementToSide", &pztopology::TPZPrism::TransformElementToSide)
506  .def_static("IsInParametricDomain", (bool (*) (const TPZVec<REAL>&, REAL)) &pztopology::TPZPrism::IsInParametricDomain)
507  .def_static("CreateSideIntegrationRule", &pztopology::TPZPrism::CreateSideIntegrationRule)
508  ;
509 
510  // TPZCube bindings
511  py::class_<pztopology::TPZCube>(m, "TPZCube")
512  .def(py::init())
513  .def_static("SideDimension", &pztopology::TPZCube::SideDimension)
514  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &>(&pztopology::TPZCube::LowerDimensionSides))
515  .def_static("LowerDimensionSides", py::overload_cast<int, TPZStack<int> &, int>(&pztopology::TPZCube::LowerDimensionSides))
516  .def_static("HigherDimensionSides", &pztopology::TPZCube::HigherDimensionSides)
517  .def_static("NSideNodes", &pztopology::TPZCube::NSideNodes)
518  .def_static("SideNodeLocId", &pztopology::TPZCube::SideNodeLocId)
519  .def_static("NumSides", py::overload_cast<>(&pztopology::TPZCube::NumSides))
520  .def_static("CenterPoint", &pztopology::TPZCube::CenterPoint)
521  .def_static("RefElVolume", [](pztopology::TPZCube& topology) { return topology.RefElVolume(); })
522  .def_static("SideToSideTransform", &pztopology::TPZCube::SideToSideTransform)
523  .def_static("TransformSideToElement", &pztopology::TPZCube::TransformSideToElement)
524  .def_static("TransformElementToSide", &pztopology::TPZCube::TransformElementToSide)
525  .def_static("IsInParametricDomain", (bool (*) (const TPZVec<REAL>&, REAL)) &pztopology::TPZCube::IsInParametricDomain)
526  .def_static("CreateSideIntegrationRule", &pztopology::TPZCube::CreateSideIntegrationRule)
527  ;
528 
529  // TPZGeoMesh bindings
530  py::class_<TPZGeoMesh>(m, "TPZGeoMesh")
531  .def(py::init())
532  .def("Print", [](TPZGeoMesh &GeoMesh){ return GeoMesh.Print();})
533  .def("BuildConnectivity", &TPZGeoMesh::BuildConnectivity)
534  .def("NElements", &TPZGeoMesh::NElements)
535  .def("Dimension", &TPZGeoMesh::Dimension)
536  .def("NNodes", &TPZGeoMesh::NNodes)
537  .def("NodeVec", py::overload_cast<>(&TPZGeoMesh::NodeVec))
538  .def("NElements", &TPZGeoMesh::NElements)
539  .def("Element", &TPZGeoMesh::Element)
540  .def("ReadUNSWSBGeoFile",[](TPZGeoMesh & self, const std::string &filename, int ESkeleton, TPZVec<int64_t> &elpartition, TPZVec<int64_t> &scalingcenterindices)
541  {
542 
543  int maxvol = -1;
544 
545  std::ifstream file(filename);
546 
547  map<set<int64_t> , int64_t> midnode;
548  string buf;
549  getline(file,buf);
550  if(!file) DebugStop();
551  int64_t nnodes, nvolumes;
552  file >> nnodes >> nvolumes;
553  elpartition.Resize(nvolumes*6, -1);
554  TPZGeoMesh *gmesh = new TPZGeoMesh;
555  gmesh->SetDimension(3);
556  gmesh->NodeVec().Resize(nnodes);
557  for (int64_t in=0; in<nnodes; in++) {
558  TPZManVector<REAL,3> xco(3);
559  for (int i=0; i<3; i++) {
560  file >> xco[i];
561  }
562  gmesh->NodeVec()[in].Initialize(xco, *gmesh);
563  }
564 #ifdef PZDEBUG
565  std::set<int64_t> badvolumes;
566 #endif
567  int64_t nothing;
568  file >> nothing;
569  for (int64_t iv=0; iv<nvolumes; iv++) {
570 #ifdef PZDEBUG
571  map<set<int64_t>,int64_t> nodepairs;
572 #endif
573  int nfaces;
574  file >> nfaces;
575  for (int face = 0; face < nfaces; face++) {
576  int elnnodes;
577  file >> elnnodes;
578 
579  TPZManVector<int64_t,10> nodes(elnnodes);
580  for (int i=0; i<elnnodes; i++) {
581  file >> nodes[i];
582  nodes[i]--;
583 #ifdef PZDEBUG
584  if (i>0) {
585  set<int64_t> edge;
586  edge.insert(nodes[i-1]);
587  edge.insert(nodes[i]);
588  nodepairs[edge]++;
589  }
590  if (i==elnnodes-1) {
591  set<int64_t> edge;
592  edge.insert(nodes[0]);
593  edge.insert(nodes[i]);
594  nodepairs[edge]++;
595  }
596 #endif
597  }
598 
599  // tototototo
600  if (maxvol != -1 && iv >= maxvol) {
601  continue;
602  }
603  if (elnnodes == 1)
604  {
605  int64_t index;
606  MElementType eltype = EPoint;
607  gmesh->CreateGeoElement(eltype, nodes, ESkeleton, index);
608  elpartition[index] = iv;
609 
610  }
611  else if (elnnodes == 2)
612  {
613  int64_t index;
614  MElementType eltype = EOned;
615  gmesh->CreateGeoElement(eltype, nodes, ESkeleton, index);
616  elpartition[index] = iv;
617 
618  }
619  else if (elnnodes == 3 || elnnodes == 4)
620  {
621  int64_t index;
622  MElementType eltype = ETriangle;
623  if (elnnodes == 4) {
624  eltype = EQuadrilateral;
625  }
626  gmesh->CreateGeoElement(eltype, nodes, ESkeleton, index);
627  elpartition[index] = iv;
628  }
629  else if(elnnodes == 8)
630  {
631  int64_t index;
632  new TPZGeoElRefPattern<pzgeom::TPZQuadraticQuad> (nodes, ESkeleton, *gmesh, index);
633  elpartition[index] = iv;
634 
635  }
636  else if(elnnodes > 4)
637  {
638  set<int64_t> elnodes;
639  TPZManVector<REAL,3> midxco(3,0.);
640  for (int i=0; i<elnnodes; i++) {
641  elnodes.insert(nodes[i]);
643  gmesh->NodeVec()[nodes[i]].GetCoordinates(x);
644  // std::cout << "x " << x << endl;
645  for(int j=0; j<3; j++) midxco[j] += x[j]/elnnodes;
646  }
647  int64_t midindex = -1;
648  if (midnode.find(elnodes) == midnode.end()) {
649  midindex = gmesh->NodeVec().AllocateNewElement();
650  gmesh->NodeVec()[midindex].Initialize(midxco, *gmesh);
651  midnode[elnodes] = midindex;
652  }
653  else
654  {
655  midindex = midnode[elnodes];
656  }
657  for (int triangle = 0; triangle <elnnodes; triangle++) {
658  TPZManVector<int64_t,3> nodeindices(3);
659  for (int in=0; in<2; in++) {
660  nodeindices[in] = nodes[(triangle+in)%elnnodes];
661  }
662  nodeindices[2] = midindex;
663  int64_t index;
664  gmesh->CreateGeoElement(ETriangle, nodeindices, ESkeleton, index);
665  elpartition[index] = iv;
666  }
667  }
668  else
669  {
670  DebugStop();
671  }
672  }
673 #ifdef PZDEBUG
674  bool suspicious = false;
675  for (auto it = nodepairs.begin(); it != nodepairs.end(); it++) {
676  if(it->second != 2) suspicious = true;
677  }
678  if (suspicious == true) {
679  std::cout << "volume " << iv << " has no closure\n";
680  badvolumes.insert(iv);
681  }
682 #endif
683  if (elpartition.size() < gmesh->NElements()+100) {
684  elpartition.Resize(elpartition.size()*2, -1);
685  }
686  }
687  // totototototo
688  if (maxvol != -1) {
689  nvolumes = maxvol;
690  }
691  int64_t nmidnodes = midnode.size();
692  gmesh->NodeVec().Resize(nvolumes+nmidnodes+nnodes);
693  scalingcenterindices.Resize(nvolumes, -1);
694  for (int64_t in=0; in<nvolumes; in++) {
695  TPZManVector<REAL,3> xco(3);
696  for (int i=0; i<3; i++) {
697  file >> xco[i];
698  }
699  gmesh->NodeVec()[nnodes+nmidnodes+in].Initialize(xco, *gmesh);
700  scalingcenterindices[in] = nnodes+nmidnodes+in;
701  }
702  {
703  ofstream mirror("gmesh.vtk");
704  TPZVTKGeoMesh::PrintGMeshVTK(gmesh, mirror);
705  }
706 #ifdef PZDEBUG
707  if (badvolumes.size()) {
708  int64_t nel = gmesh->NElements();
709  TPZManVector<REAL> elval(nel,0);
710  for (int64_t el=0; el<nel; el++) {
711  if (badvolumes.find(elpartition[el]) != badvolumes.end()) {
712  elval[el] = 10.;
713  }
714  }
715  {
716  ofstream badel("gmesh_bad.vtk");
717  TPZVTKGeoMesh::PrintGMeshVTK(gmesh, badel, elval);
718  }
719  }
720 #endif
721  elpartition.Resize(gmesh->NElements(), -1);
722  std::cout << "Building element connectivity\n";
723  gmesh->BuildConnectivity();
724  return gmesh;
725  })
726  ;
727 
728  // TPZGeoNode bindings
729  py::class_<TPZGeoNode>(m, "TPZGeoNode")
730  .def(py::init())
731  .def("GetCoordinates", &TPZGeoNode::GetCoordinates)
732  ;
733 
734  // TPZGeoEl
735  py::class_<TPZGeoEl, std::unique_ptr<TPZGeoEl, py::nodelete> >(m, "TPZGeoEl")
736  .def("NSides", &TPZGeoEl::NSides)
737  .def("NSideNodes", &TPZGeoEl::NSideNodes)
738  .def("SideNodeIndex", &TPZGeoEl::SideNodeIndex)
739  .def("SideDimension", &TPZGeoEl::SideDimension)
740  .def("Dimension", &TPZGeoEl::Dimension)
741  .def("Neighbour", &TPZGeoEl::Neighbour)
742  ;
743 
744  // TPZGeoElBC
745  py::class_<TPZGeoElBC >(m, "TPZGeoElBC")
746  .def(py::init<TPZGeoEl*, int, int>())
747  ;
748 
749  // TPZGeoElSide
750  py::class_<TPZGeoElSide, std::unique_ptr<TPZGeoElSide, py::nodelete> >(m, "TPZGeoElSide")
751  .def(py::init())
752  .def(py::init<TPZGeoEl*, int>())
753  .def("Neighbour", &TPZGeoElSide::Neighbour)
754  ;
755 
756  // TPZGMshReader
757  py::class_<TPZGmshReader>(m, "TPZGmshReader")
758  .def(py::init())
759  .def("GeometricGmshMesh3", &TPZGmshReader::GeometricGmshMesh3, "Reads geometric mesh from GMsh (3.x) .msh file.")
760  .def("GeometricGmshMesh4", &TPZGmshReader::GeometricGmshMesh4, "Reads geometric mesh from GMsh (4.x) .msh file.")
761  ;
762 
763  //TPZMaterial
764  py::class_<TPZMaterial, std::unique_ptr<TPZMaterial, py::nodelete>>(m, "TPZMaterial")
765  .def("CreateBC", &TPZMaterial::CreateBC)
766  .def("SetId", &TPZMaterial::SetId)
767  .def("Id", &TPZMaterial::Id)
768  ;
769 
770  py::class_<TPZBndCond, TPZMaterial , std::unique_ptr<TPZBndCond, py::nodelete>>(m, "TPZBndCond")
771  .def(py::init())
772  .def(py::init<int>())
773  .def(py::init< TPZMaterial * ,int ,int , TPZFMatrix<STATE> & ,TPZFMatrix<STATE> & >())
774  ;
775 
776 
777  py::class_<TPZBndCondWithMem<TPZElastoPlasticMem>, TPZBndCond, std::unique_ptr<TPZBndCondWithMem<TPZElastoPlasticMem>, py::nodelete>>(m, "TPZBndCondWithMem")
778  .def(py::init())
779  .def(py::init< TPZMaterial * ,int ,int , TPZFMatrix<STATE> & ,TPZFMatrix<STATE> & >())
780  ;
781 
782 
783  py::class_<TPZMatPoisson3d, TPZMaterial, std::unique_ptr<TPZMatPoisson3d, py::nodelete>>(m, "TPZMatPoisson3d")
784  .def(py::init<int, int>())
785  ;
786 
787  py::class_<TPZMatElastoPlastic< TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem >, TPZMaterial, std::unique_ptr<TPZMatElastoPlastic< TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem >, py::nodelete>>(m, "TPZMatElastoPlasticMC")
788  .def(py::init())
789  ;
790 
791  py::class_<TPZMatWithMem<TPZElastoPlasticMem>, TPZMaterial, std::unique_ptr<TPZMatWithMem<TPZElastoPlasticMem>, py::nodelete>>(m, "TPZMatWithMem")
792  // .def("SetUpdateMem", & TPZMatWithMem::SetUpdateMem)
793  // .def("SetUpdateMem", [](TPZMatWithMem<TPZElastoPlasticMem> & plasticupdate){ return plasticupdate.SetUpdateMem;})
794  ;
795 
796  py::class_<TPZMatElastoPlastic2D < TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem >,TPZMatElastoPlastic< TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem >, TPZMatWithMem<TPZElastoPlasticMem>, TPZMaterial, std::unique_ptr<TPZMatElastoPlastic2D < TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem >, py::nodelete>>(m, "TPZMatElastoPlastic2DMC")
797  .def(py::init<int, int>())
798  .def("SetPlasticityModel", &TPZMatElastoPlastic2D < TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem >::SetPlasticityModel)
799  .def("SetDefaultMem", &TPZMatElastoPlastic2D < TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, TPZElastoPlasticMem >::SetDefaultMem)
800  ;
801 
802  py::class_<TPZElasticResponse>(m, "TPZElasticResponse")
803  .def(py::init())
804  .def("SetEngineeringData", & TPZElasticResponse::SetEngineeringData)
805  ;
806 
807  py::class_<TPZTensor<REAL>>(m, "TPZTensor")
808  .def(py::init())
809  .def("Zero", & TPZTensor<REAL>::Zero)
810  ;
811 
812  py::class_<TPZPlasticState<STATE>>(m, "TPZPlasticState")
813  .def(py::init())
814  ;
815 
816  py::class_<TPZElastoPlasticMem>(m, "TPZElastoPlasticMem")
817  .def(py::init())
818  .def("SetElasticResponse", [](TPZElastoPlasticMem &self, TPZElasticResponse &ER){
819  self.m_ER = ER;
820  return;
821  })
822  .def("SetStress", [](TPZElastoPlasticMem &self, TPZTensor<REAL> &stress){
823  self.m_sigma = stress;
824  return;
825  })
826  .def("SetPlasticState", [](TPZElastoPlasticMem &self, TPZPlasticState<REAL> &plastic_state){
827  self.m_elastoplastic_state = plastic_state;
828  return;
829  })
830  ;
831 
832 
833  py::class_<TPZPlasticCriterion, std::unique_ptr<TPZPlasticCriterion, py::nodelete>>(m, "TPZPlasticCriterion")
834  ;
835 
836  py::class_<TPZYCMohrCoulombPV, TPZPlasticCriterion>(m, "TPZYCMohrCoulombPV")
837  .def(py::init())
838  .def("SetUp", & TPZYCMohrCoulombPV::SetUp)
839  ;
840 
841  py::class_<TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, std::unique_ptr<TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>, py::nodelete>>(m, "TPZPlasticStepPVMC")
842  .def(py::init())
844  // .def("GetYC", & TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse>::GetYC)
845  .def("YC", [](TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse> & plasticstep){ return plasticstep.fYC;})
846  .def("fN", [](TPZPlasticStepPV<TPZYCMohrCoulombPV, TPZElasticResponse> & plasticstep){ return plasticstep.fN;})
847  ;
848 
849  py::class_<TPZMatElasticity2D, TPZMaterial >(m, "TPZMatElasticity2D")
850  .def(py::init<int>())
851  ;
852 
853  py::class_<TPZElasticity3D, TPZMaterial, std::unique_ptr<TPZElasticity3D, py::nodelete>>(m, "TPZElasticity3D")
854  .def(py::init<int>())
855  .def("SetMaterialDataHook", & TPZElasticity3D::SetMaterialDataHook)
856  ;
857 
858 
859  py::class_<TPZCreateApproximationSpace, std::unique_ptr<TPZCreateApproximationSpace, py::nodelete>>(m, "TPZCreateApproximationSpace")
860  .def(py::init())
861  .def("NeedsMemory", [](TPZCreateApproximationSpace &approximateSpace){ return approximateSpace.NeedsMemory();})
862  .def("CreateWithMemory", & TPZCreateApproximationSpace::CreateWithMemory)
863  ;
864 
865 
866  py::class_<TPZCompMesh , std::unique_ptr<TPZCompMesh, py::nodelete>>(m, "TPZCompMesh")
867  .def(py::init())
868  .def(py::init<TPZGeoMesh *>())
869  .def("AutoBuild", [](TPZCompMesh &compmesh){ return compmesh.AutoBuild();})
870  .def("SetDimModel", &TPZCompMesh::SetDimModel )
871  .def("InsertMaterialObject", [](TPZCompMesh &compmesh, TPZMaterial *mat){ return compmesh.InsertMaterialObject(mat);} )
872  .def("SetAllCreateFunctionsContinuous", &TPZCompMesh::SetAllCreateFunctionsContinuous)
873  .def("SetAllCreateFunctionsContinuousWithMem", &TPZCompMesh::SetAllCreateFunctionsContinuousWithMem)
874  .def("NMaterials", &TPZCompMesh::NMaterials )
875  .def("NElements", &TPZCompMesh::NElements)
876  .def("Print", [](TPZCompMesh &compmesh){ return compmesh.Print();})
877  .def("SetDefaultOrder",&TPZCompMesh::SetDefaultOrder)
878  .def("FindMaterial", &TPZCompMesh::FindMaterial)
879  .def("NEquations", &TPZCompMesh::NEquations)
880  .def("ApproxSpace", [](TPZCompMesh &compmesh){ return compmesh.ApproxSpace();})
881  .def("Solution", &TPZCompMesh::Solution)
882  .def("__repr__",
883  [](TPZCompMesh & comp) {
884  std::ofstream printstream;
885  comp.Print(printstream);
886  return printstream;
887  }
888  )
889  ;
890 
891 
892 
893 
894 
895  py::enum_<DecomposeType>(m, "DecomposeType")
896  .value("ECholesky", DecomposeType::ECholesky)
897  .value("ELDLt", DecomposeType::ELDLt)
898  .value("ELU", DecomposeType::ELU)
899  .export_values()
900  ;
901 
902  py::class_<TPZStructMatrix >(m, "TPZStructMatrix")
903  // .def("__repr__",
904  // [](TPZStructMatrix & matrix) {
905  // std::ofstream printstream;
906  // matrix.Print(printstream);
907  // return printstream;
908  // }
909  // )
910  ;
911 
912  py::class_<TPZFStructMatrix,TPZStructMatrix >(m, "TPZFStructMatrix")
913 
914  .def(py::init<TPZCompMesh *>())
915  ;
916 
917 
918  py::class_<TPZSkylineStructMatrix, TPZStructMatrix >(m, "TPZSkylineStructMatrix")
919 
920  .def(py::init<TPZCompMesh *>())
921  ;
922 
923 
924  py::class_<TPZSkylineNSymStructMatrix, TPZSkylineStructMatrix >(m, "TPZSkylineNSymStructMatrix")
925  .def(py::init<TPZCompMesh *>())
926  ;
927 
928 
929  py::class_<TPZFrontStructMatrix<TPZFrontSym<STATE> >, TPZStructMatrix>(m, "TPZFrontStructMatrix")
930  .def(py::init<TPZCompMesh *>())
931  ;
932 
933  py::class_<TPZParFrontStructMatrix<TPZFrontSym<STATE> >, TPZFrontStructMatrix<TPZFrontSym<STATE> >>(m, "TPZParFrontStructMatrix")
934  .def(py::init<TPZCompMesh *>())
935  ;
936 
937 
938  py::class_<TPZStructMatrixBase >(m, "TPZStructMatrixBase")
939  .def("SetNumThreads", &TPZStructMatrixBase::SetNumThreads)
940  ;
941 
942  py::class_<TPZSymetricSpStructMatrix, TPZStructMatrix >(m, "TPZSymetricSpStructMatrix")
943  .def(py::init<TPZCompMesh *>())
944  .def("Create", [](TPZSymetricSpStructMatrix & spmatrix) {
945  })
946  .def("SetupMatrixData", [](TPZSymetricSpStructMatrix & spmatrix,TPZStack<int64_t> & elgraph, TPZVec<int64_t> &elgraphindex) {
947  return spmatrix.SetupMatrixData(elgraph, elgraphindex);
948  })
949  ;
950 
951  py::class_<TPZAnalysis >(m, "TPZAnalysis")
952  .def(py::init())
953  .def(py::init<TPZCompMesh *, bool>())
954  .def("SetStructuralMatrix",py::overload_cast<TPZStructMatrix &>(&TPZAnalysis::SetStructuralMatrix))
955  .def("SetSolver", &TPZAnalysis::SetSolver)
956  // .def("Solver", &TPZAnalysis::Solver)
957  // .def("Solver", [](TPZAnalysis &self) ->TPZMatrixSolver<STATE>& {
958  // return self.Solver();
959  // })
960  .def("PrintMatrix", [](TPZAnalysis &self){
961  self.Solver().Matrix()->Print("K = ",std::cout,EMathematicaInput);
962  return 0;
963  })
964 
965  .def("PrintRhs", [](TPZAnalysis &self){
966  self.Rhs().Print("R = ", std::cout,EMathematicaInput);
967  return 0;
968  })
969  .def("SetStructMatrixDecomposed", [](TPZAnalysis &self, bool key = true){
970  self.Solver().Matrix()->SetIsDecomposed(key);
971  return key;
972  })
973  .def("LoadSolution", py::overload_cast<const TPZFMatrix<STATE> & >(&TPZAnalysis::LoadSolution))
974  .def("Solution", [](TPZAnalysis &sol){ return sol.Solution();})
975  .def("Assemble", &TPZAnalysis::Assemble)
976  .def("AssembleResidual", &TPZAnalysis::AssembleResidual)
977  .def("Solve", &TPZAnalysis::Solve)
978  .def("DefineGraphMesh", py::overload_cast<int,const TPZVec<std::string> &,const TPZVec<std::string>&, const std::string & >(&TPZAnalysis::DefineGraphMesh))
979  .def("DefineGraphMesh", py::overload_cast<int,const TPZVec<std::string> &,const TPZVec<std::string>&, const TPZVec<std::string>&, const std::string & >(&TPZAnalysis::DefineGraphMesh))
980  .def("PostProcess", py::overload_cast<int, int>(&TPZAnalysis::PostProcess))
981  .def("Mesh", &TPZAnalysis::Mesh)
982  .def("Rhs",&TPZAnalysis::Rhs)
983 // .def("SetRhs", &TPZAnalysis::SetRhs)
984  .def("AcceptPseudoTimeStepSolution",[](TPZAnalysis & self){
985  TPZCompMesh *cmesh = self.Mesh();
986  bool update = true;
987  {
988  std::map<int, TPZMaterial *> &refMatVec = cmesh->MaterialVec();
989  TPZMatWithMem<TPZElastoPlasticMem> * pMatWithMem;
990  for(auto mit = refMatVec.begin(); mit != refMatVec.end(); mit++){
991  pMatWithMem = dynamic_cast<TPZMatWithMem<TPZElastoPlasticMem> *>(mit->second);
992  if(pMatWithMem != NULL){
993  pMatWithMem->SetUpdateMem(update);
994  }
995  }
996  }
997  self.AssembleResidual();
998  update = false;
999  {
1000  std::map<int, TPZMaterial *> &refMatVec = cmesh->MaterialVec();
1001  TPZMatWithMem<TPZElastoPlasticMem> * pMatWithMem;
1002  for(auto mit = refMatVec.begin(); mit != refMatVec.end(); mit++){
1003  pMatWithMem = dynamic_cast<TPZMatWithMem<TPZElastoPlasticMem> *>(mit->second);
1004  if(pMatWithMem != NULL){
1005  pMatWithMem->SetUpdateMem(update);
1006  }
1007  }
1008  }
1009  })
1010  ;
1011 
1012 
1013  py::class_<TPZAutoPointer<STATE> >(m, "TPZAutoPointer")
1014 
1015  ;
1016 
1017 
1018  py::class_<TPZSolver<STATE> >(m, "TPZSolver")
1019  ;
1020 
1021  py::class_<TPZMatrixSolver<STATE>, TPZSolver<STATE> >(m, "TPZMatrixSolver")
1022 
1023  .def("Matrix", [](TPZMatrixSolver<STATE> & self) ->TPZMatrix<STATE>& {
1024  // TPZMatrix<STATE> matrix
1025  // matrix = *(self.Matrix().operator->());
1026  return *(self.Matrix().operator->());
1027  })
1028 
1029  ;
1030 
1031 
1032  py::class_<TPZStepSolver<STATE>, TPZMatrixSolver<STATE> >(m, "TPZStepSolver")
1033  .def(py::init())
1034  .def("SetDirect", &TPZStepSolver<STATE>::SetDirect)
1035  ;
1036 
1037  py::class_<TPZPostProcAnalysis, TPZAnalysis, std::unique_ptr<TPZPostProcAnalysis, py::nodelete> >(m, "TPZPostProcAnalysis")
1038  .def(py::init())
1039  .def("SetCompMesh", &TPZPostProcAnalysis::SetCompMesh)
1040  .def("SetPostProcessVariables", &TPZPostProcAnalysis::SetPostProcessVariables)
1041  .def("SetStructuralMatrix",py::overload_cast<TPZStructMatrix &>(&TPZAnalysis::SetStructuralMatrix))
1042  .def("TransferSolution", &TPZPostProcAnalysis::TransferSolution)
1043  // .def("DefineGraphMesh", py::overload_cast<int,const TPZVec<std::string> &,const TPZVec<std::string>&, const TPZVec<std::string>&, const std::string & >(&TPZPostProcAnalysis::DefineGraphMesh))
1044  // .def("PostProcess", py::overload_cast<int, int>(&TPZPostProcAnalysis::PostProcess))
1045  ;
1046 
1047 // py::class_<TPZSBFemVolume, std::unique_ptr<TPZSBFemVolume, py::nodelete> >(m, "TPZSBFemVolume")
1048 // .def(py::init())
1049 // ;
1050 
1051  // TPZGeoMesh bindings
1052  py::class_<TPZVTKGeoMesh, std::unique_ptr<TPZVTKGeoMesh, py::nodelete>>(m, "TPZVTKGeoMesh")
1053  .def(py::init())
1054  .def_static("PrintGMeshVTK", py::overload_cast<TPZGeoMesh*, const char *, int>(&TPZVTKGeoMesh::PrintGMeshVTK))
1055  ;
1056 
1057  py::bind_map<std::map<int, int>>(m, "MapIntInt");
1058 
1059  // TPZBuildSBFem bindings
1060  py::class_<TPZBuildSBFem, std::unique_ptr<TPZBuildSBFem, py::nodelete>>(m, "TPZBuildSBFem")
1061  .def(py::init<TPZGeoMesh*, int, std::map<int,int> &>())
1062  .def("SetPartitions", &TPZBuildSBFem::SetPartitions)
1063  .def("BuildComputationalMeshFromSkeleton", &TPZBuildSBFem::BuildComputationalMeshFromSkeleton)
1064  ;
1065 
1066 
1067 #ifdef VERSION_INFO
1068  m.attr("__version__") = VERSION_INFO;
1069 #else
1070  m.attr("__version__") = "dev";
1071 #endif
1072 }
TPZGeoMesh * GeometricGmshMesh4(std::string file_name, TPZGeoMesh *gmesh=NULL)
Convert a Gmsh *.msh file with format 4 to a TPZGeoMesh object.
virtual int64_t SideNodeIndex(int side, int nodenum) const =0
Returns the index of the nodenum node of side.
static void CenterPoint(int side, TPZVec< REAL > &center)
Returns the barycentric coordinates in the master element space of the original element.
Definition: tpzprism.cpp:588
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
Defines the topology of a Pyramid element. Topology Sides 0 to 4 are vertices, sides 5 to 12 are line...
Definition: tpzpyramid.h:35
void SetPartitions(TPZVec< int64_t > &gelpartitionids, TPZVec< int64_t > &partition_nodeindices)
define the partition index of each element and the ids of the scaling centers
Definition: TPZBuildSBFem.h:64
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=pztopology::gTolerance)
Verifies if the parametric point pt is in the element parametric domain.
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
Definition: tpzcube.cpp:721
int AllocateNewElement()
Makes more room for new elements.
Definition: pzadmchunk.h:184
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
Returns the transformation which takes a point from the side sidefrom to the side sideto...
Definition: tpzpyramid.cpp:528
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=pztopology::gTolerance)
Verifies if the parametric point pt is in the element parametric domain.
Definition: tpzprism.cpp:991
static constexpr REAL RefElVolume()
Volume of the master element (measure)
Contains TPZAnalysis class which implements the sequence of actions to perform a finite element analy...
PYBIND11_MODULE(NEOPZ, m)
static void CenterPoint(int side, TPZVec< REAL > &center)
Returns the barycentric coordinates in the master element space of the original element.
void SetAllCreateFunctionsContinuous()
Definition: pzcmesh.h:508
filename
Definition: stats.py:82
Definition: pzmatrix.h:52
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
Returns the transformation which takes a point from the side sidefrom to the side sideto...
Definition: tpzline.cpp:253
Contains declaration of TPZGeoElSide class which represents an element and its side, and TPZGeoElSideIndex class which represents an TPZGeoElSide index.
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
Definition: tpzline.cpp:136
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
Definition: tpzcube.cpp:535
virtual void Solve()
Invert the stiffness matrix.
Definition: pzanalysis.cpp:352
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
Definition: pzanalysis.cpp:82
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=pztopology::gTolerance)
Verifies if the parametric point pt is in the element parametric domain.
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=pztopology::gTolerance)
Verifies if the parametric point pt is in the element parametric domain.
Definition: tpzpyramid.cpp:952
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
static void CenterPoint(int side, TPZVec< REAL > &center)
returns the barycentric coordinates in the master element space of the original element ...
virtual TPZGeoEl * CreateGeoElement(MElementType type, TPZVec< int64_t > &cornerindexes, int matid, int64_t &index, int reftype=1)
Generic method for creating a geometric element. Putting this method centrally facilitates the modifi...
Definition: pzgmesh.cpp:1296
Contains the TPZFrontStructMatrix class which responsible for a interface among Finite Element Packag...
static int NumSides()
Returns the number of connects for a set dimension.
Definition: tpzline.cpp:376
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
Returns the transformation which takes a point from the side sidefrom to the side sideto...
Definition: tpzpoint.h:172
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
static int SideNodeLocId(int side, int node)
Returns the local node number of the node "node" along side "side".
Definition: tpzcube.cpp:567
int64_t NEquations()
This computes the number of equations associated with non-restrained nodes.
Definition: pzcmesh.cpp:721
static constexpr REAL RefElVolume()
Volume of the master element.
Definition: tpzpyramid.h:227
static TPZTransform TransformElementToSide(int side)
Returns the transformation which projects a point from the interior of the element to the side...
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=pztopology::gTolerance)
Verifies if the parametric point pt is in the element parametric domain.
Definition: tpzline.cpp:154
static int SideDimension(int side)
Returns the dimension of the side.
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
Definition: tpzpoint.h:81
TPZGeoMesh * GeometricGmshMesh3(std::string file_name, TPZGeoMesh *gmesh=NULL)
Convert a Gmsh *.msh file with format 3 to a TPZGeoMesh object.
Defines the topology of a triangle element. Topology Sides 0 to 2 are vertices, sides 3 to 5 are line...
Definition: tpztriangle.h:35
Contains the TPZQuadraticQuad class which defines a quadrilateral geometric element with quadratic ma...
void TransferSolution()
static int SideDimension(int side)
Returns the dimension of the side.
Definition: tpzline.cpp:245
Defines step solvers class. Solver.
Definition: pzmganalysis.h:17
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
static constexpr REAL RefElVolume()
Volume of the master element (measure)
Definition: tpztriangle.h:239
const TPZFMatrix< T > & Mult() const
Definition: pztrnsform.h:64
static int NSideNodes(int side)
Returns the number of nodes (not connectivities) associated with a side.
Definition: tpzpyramid.cpp:82
virtual TPZMatrix< STATE > * SetupMatrixData(TPZStack< int64_t > &elgraph, TPZVec< int64_t > &elgraphindex)
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
Definition: tpzprism.cpp:878
Defines the topology of a point. Topology It has a one side (the same element).
Definition: tpzpoint.h:34
Contains the TPZPoint class which defines the topology of a point.
static TPZTransform TransformElementToSide(int side)
Returns the transformation which transform a point from the interior of the element to the side...
static void HigherDimensionSides(int side, TPZStack< int > &high)
Returns all sides whose closure contains side.
Definition: tpzpyramid.cpp:482
virtual void Assemble()
Assemble the stiffness matrix and load vector.
Definition: pzanalysis.cpp:304
TPZCompMesh * Mesh() const
Returns the pointer to the computational mesh.
Definition: pzanalysis.h:180
int64_t NElements() const
Number of elements of the mesh.
Definition: pzgmesh.h:129
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
Definition: tpzpyramid.cpp:464
static TPZTransform TransformElementToSide(int side)
Returns the transformation which transform a point from the interior of the element to the side...
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
Definition: tpzpoint.cpp:34
static void HigherDimensionSides(int side, TPZStack< int > &high)
Returns all sides whose closure contains side.
Definition: tpzprism.cpp:536
Contains declaration of TPZGeoElBC class, it is a structure to help the construction of geometric ele...
static int NSideNodes(int side)
return the number of vertices (not connectivities) associated with a side
size_t NMaterials() const
Number of materials.
Definition: pzcmesh.h:172
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
virtual void DefineGraphMesh(int dimension, const TPZVec< std::string > &scalnames, const TPZVec< std::string > &vecnames, const std::string &plotfile)
Define GrapMesh as V3D, DX, MV or VTK depending on extension of the file.
Definition: pzanalysis.cpp:952
int64_t NElements() const
Access method to query the number of elements of the vector.
Implements a chunk vector with free store administration. Utility.
Definition: TPZStream.h:39
static int SideDimension(int side)
Returns the dimension of the side.
Definition: tpzprism.cpp:598
TPZGeoElSide Neighbour() const
Definition: pzgeoel.h:754
virtual int NSides() const =0
Returns the number of connectivities of the element.
Contains the TPZStructMatrixOR class which responsible for a interface among Matrix and Finite Elemen...
Contains the TPZSymetricSpStructMatrix class which implements sparse structural matrices.
virtual int SideDimension(int side) const =0
Return the dimension of side.
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
returns the transformation which takes a point from the side sidefrom to the side sideto ...
void SetDimension(int dim)
Set Dimension.
Definition: pzgmesh.h:285
static TPZTransform TransformElementToSide(int side)
Returns the transformation which projects a point from the interior of the element to the side...
Definition: tpzcube.cpp:644
void SetPostProcessVariables(TPZVec< int > &matIds, TPZVec< std::string > &varNames)
Contains the TPZMatPoisson3d class.
Implements an abstract class implementing the memory features.
Definition: TPZMatWithMem.h:23
Contains the TPZTriangle class which defines the topology of a triangle.
static int NumSides()
Returns the number of connects of the element (21)
Definition: tpzprism.cpp:936
static int SideNodeLocId(int side, int node)
Returns the local node number of the node "node" along side "side".
Contains the TPZTetrahedron class which defines the topology of the tetrahedron element.
Contains the TPZElasticity3D class which implements a 3D isotropic elasticity material.
TPZSkylMatrix< REAL > matrix
Definition: numatst.cpp:255
Contains the TPZFStructMatrix class which implements Full Structural Matrices.
void SetDefaultOrder(int order)
Definition: pzcmesh.h:403
void BuildComputationalMeshFromSkeleton(TPZCompMesh &cmesh)
build the computational elements of the skeleton and build the volume elements directly from the skel...
static int NumSides()
Number of connects of the element (27)
TPZFMatrix< STATE > & Solution()
Returns the solution matrix.
Definition: pzanalysis.h:177
Refines geometrical mesh (all the elements) num times.
Definition: pzstrmatrix.h:35
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
static void HigherDimensionSides(int side, TPZStack< int > &high)
Returns all sides whose closure contains side.
Definition: tpzline.cpp:206
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
static void HigherDimensionSides(int side, TPZStack< int > &high)
Returns all sides whose closure contains side.
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
Definition: pzvec.h:373
Defines the topology of the hexahedron element. Topology Sides 0 to 7 are vertices, sides 8 to 19 are lines, 20 to 25 are quadrilaterals and side 26 is the hexahedra (cube).
Definition: tpzcube.h:38
void Resize(const int newsize)
Increase the size of the chunk vector.
Definition: pzadmchunk.h:280
static int NumSides()
Returns number of connects of the element ???
Definition: tpzpoint.h:104
TPZCreateApproximationSpace & ApproxSpace()
Definition: pzcmesh.h:498
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
Returns the transformation which takes a point from the side sidefrom to the side sideto...
static int SideNodeLocId(int side, int node)
Returns the local node number of the node "node" along side "side".
Definition: tpzprism.cpp:569
Implements the sequence of actions to perform a finite element analysis. Analysis.
Definition: pzanalysis.h:32
static int NSideNodes(int side)
Returns the number of nodes (not connectivities) associated with a side.
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
Definition: tpzprism.cpp:749
static TPZTransform TransformElementToSide(int side)
Returns the transformation which transform a point from the interior of the element to the side...
Definition: tpzline.cpp:293
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
Returns the transformation which takes a point from the side sidefrom to the side sideto...
Definition: tpzcube.cpp:596
virtual void LoadSolution()
Load the solution into the computable grid.
Definition: pzanalysis.cpp:441
virtual void Print(std::ostream &out=std::cout) const
Print the information of the grid to an ostream.
Definition: pzgmesh.cpp:130
Implements a generic geometric element which is refined according to a generic refinement pattern...
Definition: pzgmesh.h:35
static constexpr REAL RefElVolume()
Volume of the master element (measure of the element)
Definition: tpzpoint.h:239
TPZGeoEl * Element(int64_t iel)
Definition: pzgmesh.h:139
static int SideDimension(int side)
Returns the dimension of the side.
Definition: tpzcube.cpp:588
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
static int SideDimension(int side)
Returns the dimension of the side.
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
int64_t NNodes() const
Number of nodes of the mesh.
Definition: pzgmesh.h:126
virtual void SetNumThreads(int n)
YC_t fYC
Object which represents the yield criterium.
void SetAllCreateFunctionsContinuousWithMem()
Definition: pzcmesh.h:552
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
Contains the TPZSkylineStructMatrix class which implements SkyLine Structural Matrices.
virtual void SetUpdateMem(bool update=1)
Sets/Unsets the internal memory data to be updated in the next assemble/contribute call...
static void HigherDimensionSides(int side, TPZStack< int > &high)
Returns all sides whose closure contains side.
Definition: tpzpoint.h:92
Free store vector implementation.
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
Definition: pzmatrix.h:52
Contains the TPZQuadrilateral class which defines the topology of a quadrilateral element...
static int SideDimension(int side)
Returns the dimension of the side.
Definition: tpzpyramid.cpp:520
static int SideDimension(int side)
Returns the dimension of the side.
Definition: tpzpoint.h:76
TPZMaterial * FindMaterial(int id)
Find the material with identity id.
Definition: pzcmesh.cpp:297
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Definition: pzgmesh.h:140
virtual void AutoBuild(const std::set< int > *MaterialIDs)
Creates the computational elements, and the degree of freedom nodes.
Definition: pzcmesh.cpp:308
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
const TPZFMatrix< T > & Sum() const
Definition: pztrnsform.h:66
static int NSideNodes(int side)
Returns the number of nodes (not connectivities) associated with a side.
Definition: tpzline.cpp:120
static constexpr REAL RefElVolume()
Volume of the master element (measure)
Contains declaration of TPZGeoElRefPattern class which implements a generic geometric element which i...
Defines the topology of a Prism. Topology Sides 0 to 7 are vertices, sides 7 to 14 are lines...
Definition: tpzprism.h:34
static TPZTransform TransformElementToSide(int side)
Definition: tpzpoint.h:187
Responsible for a interface among Finite Element Package and Matrices package to frontal method...
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
Definition: tpzline.cpp:344
static void CenterPoint(int side, TPZVec< REAL > &center)
Returns the barycentric coordinates in the master element space of the original element.
Definition: tpzcube.cpp:578
virtual TPZGeoElSide Neighbour(int side)=0
Returns a pointer to the neighbour and the neighbourside along side of the current element...
Defines the topology of a line element. Topology Sides 0 and 1 are vertices, side 2 is the line...
Definition: tpzline.h:38
static void PrintGMeshVTK(TPZGeoMesh *gmesh, std::ofstream &file, bool matColor=true)
Default constructor for graphical mesh with VTK format.
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
static void CenterPoint(int side, TPZVec< REAL > &center)
Returns the barycentric coordinates in the master element space of the original element.
Definition: tpzpyramid.cpp:510
Contains declaration of TPZCompMesh class which is a repository for computational elements...
Full matrix class. Matrix.
Definition: pzfmatrix.h:32
virtual void PostProcess(int resolution)
Draw solution over mesh for all dimensions.
static void HigherDimensionSides(int side, TPZStack< int > &high)
Returns all sides whose closure contains side.
Definition: tpzcube.cpp:552
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
Definition: tpzprism.cpp:518
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
Definition: tpzcube.cpp:872
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
Definition: tpzline.cpp:316
Contains the TPZPyramid class which defines the topology of a pyramid element.
void SetDimModel(int dim)
Set de dimension of the domain of the problem.
Definition: pzcmesh.h:139
virtual int NSideNodes(int side) const =0
Returns the number of nodes for a particular side.
static int NSideNodes(int side)
Returns the number of nodes (not connectivities) associated with a side.
Definition: tpzpoint.h:95
std::map< int,TPZMaterial *> & MaterialVec()
Returns a reference to the material pointers vector.
Definition: pzcmesh.h:203
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=pztopology::gTolerance)
Verifies if the parametric point pt is in the element parametric domain.
Definition: tpzcube.cpp:1000
Contains TPZMatrix<TVar>class, root matrix class.
static void CenterPoint(int side, TPZVec< REAL > &center)
Returns the barycentric coordinates in the master element space of the original element.
static int SideNodeLocId(int side, int node)
Returns the local node number of the node "node" along side "side".
Definition: tpzpyramid.cpp:492
static int NumSides()
Returns number of connects of the element (27) ???
Definition: tpzcube.cpp:936
void BuildConnectivity()
Build the connectivity of the grid.
Definition: pzgmesh.cpp:967
virtual TPZBndCond * CreateBC(TPZMaterial *reference, int id, int typ, TPZFMatrix< STATE > &val1, TPZFMatrix< STATE > &val2)
Creates an object TPZBndCond derived of TPZMaterial.
int InsertMaterialObject(TPZMaterial *mat)
Insert a material object in the datastructure.
Definition: pzcmesh.cpp:287
Defines the topology of the tetrahedron element. Topology Sides 0 to 3 are vertices, sides 4 to 9 are lines, sides 10 to 13 are triangles and side 14 is the tetrahedra.
virtual int Dimension() const =0
Returns the dimension of the element.
void SetMaterialDataHook(REAL Ela, REAL poisson)
Definition: pzelast3d.h:202
static int NumSides()
Returns number of sides of the element (9)
int Dimension()
Get Dimension.
Definition: pzgmesh.h:291
virtual void AssembleResidual()
Assemble the load vector.
Definition: pzanalysis.cpp:288
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
Returns the transformation which takes a point from the side sidefrom to the side sideto...
Definition: tpzprism.cpp:606
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
MElementType
Define the element types.
Definition: pzeltype.h:52
void SetEngineeringData(REAL Eyoung, REAL Poisson)
This class implements a stack object. Utility.
Definition: pzcheckmesh.h:14
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
Definition: tpzpyramid.cpp:842
static int NSideNodes(int side)
Returns the number of nodes (not connectivities) associated with a side.
static int NSideNodes(int side)
Returns the number of nodes (not connectivities) associated with a side.
Definition: tpzcube.cpp:562
string to_string(const string &value)
static TPZTransform TransformElementToSide(int side)
Returns the transformation which projects a point from the interior of the element to the side...
Definition: tpzpyramid.cpp:563
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
Contains TPZSolver class which defines a abstract class of solvers which will be used by matrix class...
static void CenterPoint(int side, TPZVec< REAL > &center)
Returns the barycentric coordinates in the master element space of the original element.
Definition: tpzpoint.h:123
Classe que efetua avanco de um passo de plastificacao utilizando o metodo de Newton.
static int NSideNodes(int side)
Returns the number of nodes (not connectivities) associated with a side.
Definition: tpzprism.cpp:552
Defines the topology of a quadrilateral element. Topology Sides 0 to 3 are vertices, sides 4 to 7 are lines, side 8 is the quadrilateral.
static int NumSides()
Returns the number of connects of the element (7)
int Id() const
Definition: TPZMaterial.h:170
static TPZTransform TransformElementToSide(int side)
Returns the transformation which projects a point from the interior of the element to the side...
Definition: tpzprism.cpp:645
static constexpr REAL RefElVolume()
Volume of the master element.
Definition: tpzcube.h:226
Contains TPZStepSolver class which defines step solvers class.
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=pztopology::gTolerance)
Verifies if the parametric point pt is in the element parametric domain.
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
static int SideDimension(int side)
returns the dimension of the side
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
Definition: tpzpoint.h:182
void SetId(int id)
Definition: TPZMaterial.h:171
Contains the TPZTransform<> class which implements an affine transformation between points in paramet...
TPZPlasticState< STATE > fN
Plastic State Variables (EpsT, EpsP, Alpha) at the current time step.
static int NumSides()
Number of connects of the element (21)
Definition: tpzpyramid.cpp:897
static int SideNodeLocId(int side, int node)
Returns the local node number of the node "node" along side "side".
Definition: tpzpoint.h:99
static TPZTransform TransformSideToElement(int side)
Returns the transformation which transform a point from the side to the interior of the element...
Definition: tpzpyramid.cpp:711
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
static bool IsInParametricDomain(const TPZVec< REAL > &pt, REAL tol=1e-6)
Verifies if the parametric point pt is in the element parametric domain.
Definition: tpzpoint.h:127
TPZFMatrix< STATE > & Rhs()
Returns the load vector.
Definition: pzanalysis.h:174
Contains the TPZCube class which defines the topology of the hexahedron element.
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
void GetCoordinates(TPZVec< REAL > &co)
Fill the coordinates of the node.
Definition: pzgnode.cpp:83
Contains the TPZLine class which defines the topology of a line element.
void SetCompMesh(TPZCompMesh *pRef, bool mustOptimizeBandwidth=false) override
Set the computational mesh we are going to post process.
static int SideNodeLocId(int side, int node)
Returns the local node number of the node "node" along side "side".
Definition: pzeltype.h:55
static int SideNodeLocId(int side, int node)
returns the local node number of the node "node" along side "side"
Contains the TPZPrism class which defines the topology of a Prism.
Contains the TPZVTKGeoMesh class which implements the graphical mesh to VTK environment to geometric ...
static void LowerDimensionSides(int side, TPZStack< int > &smallsides)
Get all sides with lower dimension on side.
static int SideNodeLocId(int side, int node)
Returns the local node number of the node "node" along side "side".
Definition: tpzline.cpp:216
Implements Sparse Structural Matrices. Structural Matrix.
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
Definition: pzfmatrix.h:566
static constexpr REAL RefElVolume()
Volume of the master element.
Definition: tpzprism.h:227
TPZFMatrix< STATE > & Solution()
Access the solution vector.
Definition: pzcmesh.h:219
void SetUp(REAL Phi, REAL Psi, REAL c, TPZElasticResponse &ER)
Sets up the data.
Contains the TPZParFrontStructMatrix class which is a structural matrix with parallel techniques incl...
static constexpr REAL RefElVolume()
Volume of the master element (measure of the element)
Definition: tpzline.h:231
static void CenterPoint(int side, TPZVec< REAL > &center)
Returns the barycentric coordinates in the master element space of the original element.
Definition: tpzline.cpp:224
virtual void Print(std::ostream &out=std::cout) const
Prints mesh data.
Definition: pzcmesh.cpp:236
static TPZTransform SideToSideTransform(int sidefrom, int sideto)
Returns the transformation which takes a point from the side sidefrom of the side sideto...
static TPZIntPoints * CreateSideIntegrationRule(int side, int order)
Create an integration rule over side.
Root matrix class (abstract). Matrix.
Definition: pzmatrix.h:60
static void HigherDimensionSides(int side, TPZStack< int > &high)
Returns all sides whose closure contains side.
static void HigherDimensionSides(int side, TPZStack< int > &high)
returns all sides whose closure contains side