KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
binbased_projection.h
Go to the documentation of this file.
1 // KRATOS __ __ _____ ____ _ _ ___ _ _ ____
2 // | \/ | ____/ ___|| | | |_ _| \ | |/ ___|
3 // | |\/| | _| \___ \| |_| || || \| | | _
4 // | | | | |___ ___) | _ || || |\ | |_| |
5 // |_| |_|_____|____/|_| |_|___|_| \_|\____| APPLICATION
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Antonia Larese De Tetto
11 //
12 
13 #if !defined(KRATOS_BINBASED_PROJECTION )
14 #define KRATOS_BINBASED_PROJECTION
15 
16 //External includes
17 
18 // System includes
19 #include <string>
20 #include <iostream>
21 #include <cstdlib>
22 
23 // Project includes
24 #include "includes/define.h"
25 #include "includes/model_part.h"
26 #include "utilities/timer.h"
28 
29 //Database includes
33 
34 namespace Kratos
35 {
38 
42 
46 
50 
54 
56 
70 //class BinBasedMeshTransfer
71 template<std::size_t TDim >
73 {
74 public:
77 
80 
82  typedef Node NodeType;
84 
88 
90  BinBasedMeshTransfer() = default; //
91 
93  virtual ~BinBasedMeshTransfer() = default;
94 
95 
99 
100 
104 
105  //If you want to pass the whole model part
106  //**********************************************************************
107  //**********************************************************************
109 
114  ModelPart& rOrigin_ModelPart ,
115  ModelPart& rDestination_ModelPart
116  )
117  {
118  KRATOS_TRY
119 
120  KRATOS_ERROR << "Not implemented yet" << std::endl;
121 
122  KRATOS_CATCH("")
123  }
124 
125 
126  //If you want to pass only one variable
127  //**********************************************************************
128  //**********************************************************************
130 
137  // Form fixed to moving model part
138  template<class TDataType>
140  ModelPart& rFixed_ModelPart ,
141  ModelPart& rMoving_ModelPart,
142  Variable<TDataType>& rFixedDomainVariable ,
143  Variable<TDataType>& rMovingDomainVariable,
144  BinBasedFastPointLocator<TDim>& node_locator
145  )
146  {
147  KRATOS_TRY
148 
149  KRATOS_INFO("BinBasedMeshTransfer") << "Interpolate From Fixed Mesh*************************************" << std::endl;
150 
151  //creating an auxiliary list for the new nodes
152  for(auto node_it = rMoving_ModelPart.NodesBegin(); node_it != rMoving_ModelPart.NodesEnd(); ++node_it) {
153  ClearVariables(node_it, rMovingDomainVariable);
154  }
155 
156  Vector N(TDim + 1);
157  const int max_results = 10000;
158  typename BinBasedFastPointLocator<TDim>::ResultContainerType results(max_results);
159  const int nparticles = rMoving_ModelPart.Nodes().size();
160 
161  #pragma omp parallel for firstprivate(results,N)
162  for (int i = 0; i < nparticles; i++) {
163  ModelPart::NodesContainerType::iterator iparticle = rMoving_ModelPart.NodesBegin() + i;
164  NodeType::Pointer pparticle = *(iparticle.base());
165  auto result_begin = results.begin();
166  Element::Pointer pelement;
167 
168  bool is_found = node_locator.FindPointOnMesh(pparticle->Coordinates(), N, pelement, result_begin, max_results);
169 
170  if (is_found == true) {
171  //Interpolate( ElemIt, N, *it_found , rFixedDomainVariable , rMovingDomainVariable );
172  Interpolate( pelement, N, pparticle, rFixedDomainVariable , rMovingDomainVariable );
173  }
174  }
175 
176  KRATOS_CATCH("")
177  }
178 
181 
188  // From moving to fixed model part
189  template<class TDataType>
191  ModelPart& rMoving_ModelPart ,
192  ModelPart& rFixed_ModelPart,
193  Variable<TDataType>& rMovingDomainVariable ,
194  Variable<TDataType>& rFixedDomainVariable,
195  BinBasedFastPointLocator<TDim>& node_locator //this is a bin of objects which contains the FIXED model part
196  )
197  {
198  KRATOS_TRY
199 
200  KRATOS_INFO("BinBasedMeshTransfer") << "Transfer From Moving Mesh*************************************" << std::endl;
201 
202  if (rMoving_ModelPart.NodesBegin()->SolutionStepsDataHas(rMovingDomainVariable) == false)
203  KRATOS_THROW_ERROR(std::logic_error, "Add MovingDomain VARIABLE!!!!!! ERROR", "");
204  if (rFixed_ModelPart.NodesBegin()->SolutionStepsDataHas(rFixedDomainVariable) == false)
205  KRATOS_THROW_ERROR(std::logic_error, "Add FixedDomain VARIABLE!!!!!! ERROR", "");
206 
207 
208  //creating an auxiliary list for the new nodes
209  for(ModelPart::NodesContainerType::iterator node_it = rFixed_ModelPart.NodesBegin();
210  node_it != rFixed_ModelPart.NodesEnd(); ++node_it)
211  {
212 
213  ClearVariables(node_it, rFixedDomainVariable);
214 
215  }
216 
217  for (ModelPart::NodesContainerType::iterator node_it = rFixed_ModelPart.NodesBegin();
218  node_it != rFixed_ModelPart.NodesEnd(); node_it++)
219  {
220 // if (node_it->IsFixed(VELOCITY_X) == false)
221 // {
222 // (node_it)->FastGetSolutionStepValue(VELOCITY) = ZeroVector(3);
223 // (node_it)->FastGetSolutionStepValue(TEMPERATURE) = 0.0;
224  (node_it)->GetValue(YOUNG_MODULUS) = 0.0;
225 // }
226  }
227  //defintions for spatial search
228 // typedef NodeType PointType;
229 // typedef NodeType::Pointer PointTypePointer;
230 
231  Vector N(TDim + 1);
232  const int max_results = 10000;
233  typename BinBasedFastPointLocator<TDim>::ResultContainerType results(max_results);
234  const int nparticles = rMoving_ModelPart.Nodes().size();
235 
236  #pragma omp parallel for firstprivate(results,N)
237  for (int i = 0; i < nparticles; i++)
238  {
239  ModelPart::NodesContainerType::iterator iparticle = rMoving_ModelPart.NodesBegin() + i;
240 
241  NodeType::Pointer pparticle = *(iparticle.base());
242  auto result_begin = results.begin();
243 
244  Element::Pointer pelement;
245 
246  bool is_found = node_locator.FindPointOnMesh(pparticle->Coordinates(), N, pelement, result_begin, max_results);
247 
248  if (is_found == true)
249  {
250  GeometryType& geom = pelement->GetGeometry();
251  // const array_1d<double, 3 > & vel_particle = (iparticle)->FastGetSolutionStepValue(VELOCITY);
252  // const double& temperature_particle = (iparticle)->FastGetSolutionStepValue(TEMPERATURE);
253  const TDataType& value = (iparticle)->FastGetSolutionStepValue(rMovingDomainVariable);
254 
255  for (std::size_t k = 0; k < geom.size(); k++)
256  {
257  geom[k].SetLock();
258  geom[k].FastGetSolutionStepValue(rFixedDomainVariable) += N[k] * value;
259  geom[k].GetValue(YOUNG_MODULUS) += N[k];
260  geom[k].UnSetLock();
261 
262  }
263 
264  }
265 
266  }
267 
268 
269  for (ModelPart::NodesContainerType::iterator node_it = rFixed_ModelPart.NodesBegin();
270  node_it != rFixed_ModelPart.NodesEnd(); node_it++)
271  {
272  const double NN = (node_it)->GetValue(YOUNG_MODULUS);
273  if (NN != 0.0)
274  {
275  (node_it)->FastGetSolutionStepValue(rFixedDomainVariable) /= NN;
276  }
277  }
278 
279  KRATOS_CATCH("")
280  }
281 
282  // From moving to fixed model part
284 
291  template<class TDataType>
293  ModelPart& rMoving_ModelPart ,
294  ModelPart& rFixed_ModelPart,
295  Variable<TDataType>& rMovingDomainVariable ,
296  Variable<TDataType>& rFixedDomainVariable,
297  BinBasedNodesInElementLocator<TDim>& node_locator //this is a bin of objects which contains the FIXED model part
298  )
299  {
300  KRATOS_TRY
301 
302  KRATOS_WATCH("Transfer From Moving Mesh*************************************")
303  if (rMoving_ModelPart.NodesBegin()->SolutionStepsDataHas(rMovingDomainVariable) == false)
304  KRATOS_THROW_ERROR(std::logic_error, "Add MovingDomain VARIABLE!!!!!! ERROR", "");
305  if (rFixed_ModelPart.NodesBegin()->SolutionStepsDataHas(rFixedDomainVariable) == false)
306  KRATOS_THROW_ERROR(std::logic_error, "Add FixedDomain VARIABLE!!!!!! ERROR", "");
307 
308 
309  //creating an auxiliary list for the new nodes
310  for(ModelPart::NodesContainerType::iterator node_it = rFixed_ModelPart.NodesBegin();
311  node_it != rFixed_ModelPart.NodesEnd(); ++node_it)
312  {
313  ClearVariables(node_it, rFixedDomainVariable);
314  }
315 
316  //defintions for spatial search
319  const std::size_t max_results = 5000;
320  Matrix Nmat(max_results,TDim+1);
321  boost::numeric::ublas::vector<int> positions(max_results);
322  PointVector work_results(max_results);
323  DistanceVector work_distances(max_results);
324  Node work_point(0,0.0,0.0,0.0);
325  for(ModelPart::ElementsContainerType::iterator elem_it = rMoving_ModelPart.ElementsBegin(); elem_it != rMoving_ModelPart.ElementsEnd(); ++elem_it)
326  {
327  std::size_t nfound = node_locator.FindNodesInElement(*(elem_it.base()), positions, Nmat, max_results, work_results.begin(), work_distances.begin(), work_point);
328  for(std::size_t k=0; k<nfound; k++)
329  {
330  auto it = work_results.begin() + positions[k];
331 
332 
333  array_1d<double,TDim+1> N = row(Nmat,k);
334  Interpolate( *(elem_it.base()), N, *it, rMovingDomainVariable , rFixedDomainVariable);
335  }
336 
337  }
338 
339 
340  KRATOS_CATCH("")
341  }
342 
346 
347 
351 
352 
356 
358  virtual std::string Info() const
359  {
360  return "";
361  }
362 
364  virtual void PrintInfo(std::ostream& rOStream) const {}
365 
367  virtual void PrintData(std::ostream& rOStream) const {}
368 
369 
373 
375 
376 protected:
379 
380 
384 
385 
389 
390 
394 
395 
399 
400 
404 
405 
409 
410 
412 
413 private:
416 
417 
421 
422 
423 
424  inline void CalculateCenterAndSearchRadius(GeometryType&geom,
425  double& xc, double& yc, double& zc, double& R, array_1d<double,3>& N
426  )
427  {
428  double x0 = geom[0].X();
429  double y0 = geom[0].Y();
430  double x1 = geom[1].X();
431  double y1 = geom[1].Y();
432  double x2 = geom[2].X();
433  double y2 = geom[2].Y();
434 
435 
436  xc = 0.3333333333333333333*(x0+x1+x2);
437  yc = 0.3333333333333333333*(y0+y1+y2);
438  zc = 0.0;
439 
440  double R1 = (xc-x0)*(xc-x0) + (yc-y0)*(yc-y0);
441  double R2 = (xc-x1)*(xc-x1) + (yc-y1)*(yc-y1);
442  double R3 = (xc-x2)*(xc-x2) + (yc-y2)*(yc-y2);
443 
444  R = R1;
445  if(R2 > R) R = R2;
446  if(R3 > R) R = R3;
447 
448  R = 1.01 * sqrt(R);
449  }
450  //***************************************
451  //***************************************
452  inline void CalculateCenterAndSearchRadius(GeometryType&geom,
453  double& xc, double& yc, double& zc, double& R, array_1d<double,4>& N
454 
455  )
456  {
457  double x0 = geom[0].X();
458  double y0 = geom[0].Y();
459  double z0 = geom[0].Z();
460  double x1 = geom[1].X();
461  double y1 = geom[1].Y();
462  double z1 = geom[1].Z();
463  double x2 = geom[2].X();
464  double y2 = geom[2].Y();
465  double z2 = geom[2].Z();
466  double x3 = geom[3].X();
467  double y3 = geom[3].Y();
468  double z3 = geom[3].Z();
469 
470 
471  xc = 0.25*(x0+x1+x2+x3);
472  yc = 0.25*(y0+y1+y2+y3);
473  zc = 0.25*(z0+z1+z2+z3);
474 
475  double R1 = (xc-x0)*(xc-x0) + (yc-y0)*(yc-y0) + (zc-z0)*(zc-z0);
476  double R2 = (xc-x1)*(xc-x1) + (yc-y1)*(yc-y1) + (zc-z1)*(zc-z1);
477  double R3 = (xc-x2)*(xc-x2) + (yc-y2)*(yc-y2) + (zc-z2)*(zc-z2);
478  double R4 = (xc-x3)*(xc-x3) + (yc-y3)*(yc-y3) + (zc-z3)*(zc-z3);
479 
480  R = R1;
481  if(R2 > R) R = R2;
482  if(R3 > R) R = R3;
483  if(R4 > R) R = R4;
484 
485  R = sqrt(R);
486  }
487  //***************************************
488  //***************************************
489  inline double CalculateVol( const double x0, const double y0,
490  const double x1, const double y1,
491  const double x2, const double y2
492  )
493  {
494  return 0.5*( (x1-x0)*(y2-y0)- (y1-y0)*(x2-x0) );
495  }
496  //***************************************
497  //***************************************
498  inline double CalculateVol( const double x0, const double y0, const double z0,
499  const double x1, const double y1, const double z1,
500  const double x2, const double y2, const double z2,
501  const double x3, const double y3, const double z3
502  )
503  {
504  double x10 = x1 - x0;
505  double y10 = y1 - y0;
506  double z10 = z1 - z0;
507 
508  double x20 = x2 - x0;
509  double y20 = y2 - y0;
510  double z20 = z2 - z0;
511 
512  double x30 = x3 - x0;
513  double y30 = y3 - y0;
514  double z30 = z3 - z0;
515 
516  double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
517  return detJ*0.1666666666666666666667;
518 
519  //return 0.5*( (x1-x0)*(y2-y0)- (y1-y0)*(x2-x0) );
520  }
521  //***************************************
522  //***************************************
523  inline bool CalculatePosition( GeometryType&geom,
524  const double xc, const double yc, const double zc,
525  array_1d<double,3>& N
526  )
527  {
528  double x0 = geom[0].X();
529  double y0 = geom[0].Y();
530  double x1 = geom[1].X();
531  double y1 = geom[1].Y();
532  double x2 = geom[2].X();
533  double y2 = geom[2].Y();
534 
535  double area = CalculateVol(x0,y0,x1,y1,x2,y2);
536  double inv_area = 0.0;
537  if(area == 0.0)
538  {
539 
540 // KRATOS_THROW_ERROR(std::logic_error,"element with zero area found","");
541  //The interpolated node will not be inside an elemente with zero area
542  return false;
543 
544  }
545  else
546  {
547  inv_area = 1.0 / area;
548  }
549 
550 
551  N[0] = CalculateVol(x1,y1,x2,y2,xc,yc) * inv_area;
552  N[1] = CalculateVol(x2,y2,x0,y0,xc,yc) * inv_area;
553  N[2] = CalculateVol(x0,y0,x1,y1,xc,yc) * inv_area;
554 
555 
556  if(N[0] >= 0.0 && N[1] >= 0.0 && N[2] >= 0.0 && N[0] <=1.0 && N[1]<= 1.0 && N[2] <= 1.0) //if the xc yc is inside the triangle return true
557  return true;
558 
559  return false;
560  }
561 
562  //***************************************
563  //***************************************
564 
565  inline bool CalculatePosition( GeometryType&geom,
566  const double xc, const double yc, const double zc,
567  array_1d<double,4>& N
568  )
569  {
570 
571  double x0 = geom[0].X();
572  double y0 = geom[0].Y();
573  double z0 = geom[0].Z();
574  double x1 = geom[1].X();
575  double y1 = geom[1].Y();
576  double z1 = geom[1].Z();
577  double x2 = geom[2].X();
578  double y2 = geom[2].Y();
579  double z2 = geom[2].Z();
580  double x3 = geom[3].X();
581  double y3 = geom[3].Y();
582  double z3 = geom[3].Z();
583 
584  double vol = CalculateVol(x0,y0,z0,x1,y1,z1,x2,y2,z2,x3,y3,z3);
585 
586  double inv_vol = 0.0;
587  if(vol < 0.0000000000001)
588  {
589 
590 // KRATOS_THROW_ERROR(std::logic_error,"element with zero vol found","");
591  //The interpolated node will not be inside an elemente with zero volume
592  return false;
593 // KRATOS_WATCH("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
594  }
595  else
596  {
597  inv_vol = 1.0 / vol;
598  }
599 
600  N[0] = CalculateVol(x1,y1,z1,x3,y3,z3,x2,y2,z2,xc,yc,zc) * inv_vol;
601  N[1] = CalculateVol(x3,y3,z3,x0,y0,z0,x2,y2,z2,xc,yc,zc) * inv_vol;
602  N[2] = CalculateVol(x3,y3,z3,x1,y1,z1,x0,y0,z0,xc,yc,zc) * inv_vol;
603  N[3] = CalculateVol(x0,y0,z0,x1,y1,z1,x2,y2,z2,xc,yc,zc) * inv_vol;
604 
605 
606  if(N[0] >= 0.0 && N[1] >= 0.0 && N[2] >= 0.0 && N[3] >=0.0 &&
607  N[0] <= 1.0 && N[1] <= 1.0 && N[2] <= 1.0 && N[3] <=1.0)
608  //if the xc yc zc is inside the tetrahedron return true
609  return true;
610 
611  return false;
612  }
613 
614  //ElemI Element iterator
615  //N Shape functions
616  //step_data_size
617  //pnode pointer to the node
618  //projecting total model part 2Dversion
619  void Interpolate(
620  Element::Pointer ElemIt,
621  const Vector& N,
622  int step_data_size,
623  NodeType::Pointer pnode)
624  {
625  //Geometry element of the rOrigin_ModelPart
626  GeometryType& geom = ElemIt->GetGeometry();
627 
628  const std::size_t buffer_size = pnode->GetBufferSize();
629 
630  const std::size_t vector_size = N.size();
631 
632  for(std::size_t step = 0; step<buffer_size; step++) {
633  //getting the data of the solution step
634  double* step_data = (pnode)->SolutionStepData().Data(step);
635 
636  double* node0_data = geom[0].SolutionStepData().Data(step);
637 
638  //copying this data in the position of the vector we are interested in
639  for(int j= 0; j< step_data_size; j++) {
640  step_data[j] = N[0]*node0_data[j];
641  }
642  for(std::size_t k= 1; k< vector_size; k++) {
643  double* node1_data = geom[k].SolutionStepData().Data(step);
644  for(int j= 0; j< step_data_size; j++) {
645  step_data[j] += N[k]*node1_data[j];
646  }
647  }
648  }
649 // pnode->GetValue(IS_VISITED) = 1.0;
650 
651  }
652 
653  //projecting an array1D 2Dversion
654  void Interpolate(
655  Element::Pointer ElemIt,
656  const Vector& N,
657  NodeType::Pointer pnode,
658  Variable<array_1d<double,3> >& rOriginVariable,
659  Variable<array_1d<double,3> >& rDestinationVariable)
660  {
661  //Geometry element of the rOrigin_ModelPart
662  GeometryType& geom = ElemIt->GetGeometry();
663 
664  const std::size_t buffer_size = pnode->GetBufferSize();
665 
666  const std::size_t vector_size = N.size();
667 
668  for(std::size_t step = 0; step<buffer_size; step++) {
669  //getting the data of the solution step
670  array_1d<double,3>& step_data = (pnode)->FastGetSolutionStepValue(rDestinationVariable , step);
671  //Reference or no reference???//CANCELLA
672  step_data = N[0] * geom[0].FastGetSolutionStepValue(rOriginVariable , step);
673 
674  // Copying this data in the position of the vector we are interested in
675  for(std::size_t j= 1; j< vector_size; j++) {
676  const array_1d<double,3>& node_data = geom[j].FastGetSolutionStepValue(rOriginVariable , step);
677  step_data += N[j] * node_data;
678  }
679  }
680 // pnode->GetValue(IS_VISITED) = 1.0;
681  }
682 
683  //projecting a scalar 2Dversion
684  void Interpolate(
685  Element::Pointer ElemIt,
686  const Vector& N,
687  NodeType::Pointer pnode,
688  Variable<double>& rOriginVariable,
689  Variable<double>& rDestinationVariable)
690  {
691  //Geometry element of the rOrigin_ModelPart
692  GeometryType& geom = ElemIt->GetGeometry();
693 
694  const std::size_t buffer_size = pnode->GetBufferSize();
695 
696  const std::size_t vector_size = N.size();
697 
698  //facendo un loop sugli step temporali step_data come salva i dati al passo anteriore? CioĊ› dove passiamo l'informazione ai nodi???
699  for(std::size_t step = 0; step<buffer_size; step++) {
700  //getting the data of the solution step
701  double& step_data = (pnode)->FastGetSolutionStepValue(rDestinationVariable , step);
702  //Reference or no reference???//CANCELLA
703 
704  //copying this data in the position of the vector we are interested in
705  step_data = N[0] * geom[0].FastGetSolutionStepValue(rOriginVariable , step);
706 
707  // Copying this data in the position of the vector we are interested in
708  for(std::size_t j= 1; j< vector_size; j++) {
709  const double node_data = geom[j].FastGetSolutionStepValue(rOriginVariable , step);
710  step_data += N[j] * node_data;
711  }
712 
713  }
714 // pnode->GetValue(IS_VISITED) = 1.0;
715 
716  }
717 
718  inline void Clear(ModelPart::NodesContainerType::iterator node_it, int step_data_size )
719  {
720  std::size_t buffer_size = node_it->GetBufferSize();
721 
722  for(std::size_t step = 0; step<buffer_size; step++)
723  {
724  //getting the data of the solution step
725  double* step_data = (node_it)->SolutionStepData().Data(step);
726 
727  //copying this data in the position of the vector we are interested in
728  for(int j= 0; j< step_data_size; j++)
729  {
730  step_data[j] = 0.0;
731  }
732  }
733 
734  }
735 
736  inline void ClearVariables(ModelPart::NodesContainerType::iterator node_it , Variable<array_1d<double,3> >& rVariable)
737  {
738  array_1d<double, 3>& Aux_var = node_it->FastGetSolutionStepValue(rVariable, 0);
739 
740  noalias(Aux_var) = ZeroVector(3);
741 
742  }
743 
744  inline void ClearVariables(ModelPart::NodesContainerType::iterator node_it, Variable<double>& rVariable)
745  {
746  double& Aux_var = node_it->FastGetSolutionStepValue(rVariable, 0);
747 
748  Aux_var = 0.0;
749 
750  }
751 
755 
759 
760 
764 
765 
769 
770 
774 
776  BinBasedMeshTransfer& operator=(BinBasedMeshTransfer const& rOther);
777 
778 
780 
781 }; // Class BinBasedMeshTransfer
782 
784 
787 
788 
792 
793 
794 
795 
797 template<std::size_t TDim>
798 inline std::ostream& operator << (std::ostream& rOStream,
799  const BinBasedMeshTransfer<TDim>& rThis)
800 {
801  rThis.PrintInfo(rOStream);
802  rOStream << std::endl;
803  rThis.PrintData(rOStream);
804 
805  return rOStream;
806 }
808 
809 
810 } // namespace Kratos.
811 
812 #endif // KRATOS_BINBASED_PROJECTION defined
This class is designed to allow the fast location of MANY points on the top of a 3D mesh.
Definition: binbased_fast_point_locator.h:68
ConfigureType::ResultContainerType ResultContainerType
Definition: binbased_fast_point_locator.h:81
This class allows the interpolation between non-matching meshes in 2D and 3D.
Definition: binbased_projection.h:73
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: binbased_projection.h:367
BinBasedMeshTransfer()=default
Default constructor.
KRATOS_CLASS_POINTER_DEFINITION(BinBasedMeshTransfer< TDim >)
Pointer definition of BinBasedMeshTransfer.
void DirectInterpolation(ModelPart &rOrigin_ModelPart, ModelPart &rDestination_ModelPart)
Interpolate the whole problem type.
Definition: binbased_projection.h:113
void MappingFromMovingMesh_VariableMeshes(ModelPart &rMoving_ModelPart, ModelPart &rFixed_ModelPart, Variable< TDataType > &rMovingDomainVariable, Variable< TDataType > &rFixedDomainVariable, BinBasedNodesInElementLocator< TDim > &node_locator)
Interpolate one variable from the moving mesh to the fixed one.
Definition: binbased_projection.h:292
Geometry< NodeType > GeometryType
Definition: binbased_projection.h:83
virtual std::string Info() const
Turn back information as a stemplate<class T, std::size_t dim> tring.
Definition: binbased_projection.h:358
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: binbased_projection.h:364
void DirectVariableInterpolation(ModelPart &rFixed_ModelPart, ModelPart &rMoving_ModelPart, Variable< TDataType > &rFixedDomainVariable, Variable< TDataType > &rMovingDomainVariable, BinBasedFastPointLocator< TDim > &node_locator)
Interpolate one variable from the fixed mesh to the moving one.
Definition: binbased_projection.h:139
virtual ~BinBasedMeshTransfer()=default
Destructor.
void MappingFromMovingMesh(ModelPart &rMoving_ModelPart, ModelPart &rFixed_ModelPart, Variable< TDataType > &rMovingDomainVariable, Variable< TDataType > &rFixedDomainVariable, BinBasedFastPointLocator< TDim > &node_locator)
Definition: binbased_projection.h:190
Node NodeType
Node type definition.
Definition: binbased_projection.h:82
REMARK: the location function is threadsafe, and can be used in OpenMP loops.
Definition: binbased_nodes_in_element_locator.h:44
std::vector< PointType::Pointer > PointVector
Definition: binbased_nodes_in_element_locator.h:49
unsigned int FindNodesInElement(Element::Pointer &pelement, DenseVector< int > &positions, Matrix &Nmat, const unsigned int max_results, PointIterator work_results, DistanceIterator work_distances, Node &work_point)
function to find all teh nodes of a fixed mesh contained in the elements of a moving mesh
Definition: binbased_nodes_in_element_locator.h:133
std::vector< double > DistanceVector
Definition: binbased_nodes_in_element_locator.h:51
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometry.h:627
iterator begin()
Definition: amatrix_interface.h:241
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_INFO(label)
Definition: logger.h:250
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
std::vector< PointTypePointer > PointVector
Definition: internal_variables_interpolation_process.h:53
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
std::vector< double > DistanceVector
Definition: internal_variables_interpolation_process.h:55
int step
Definition: face_heat.py:88
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
R
Definition: isotropic_damage_automatic_differentiation.py:172
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17