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.
mesher_utilities.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosDelaunayMeshingApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: April 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_MESHER_UTILITIES_H_INCLUDED)
11 #define KRATOS_MESHER_UTILITIES_H_INCLUDED
12 
13 // External includes
14 
15 // System includes
16 
17 // Project includes
23 
24 namespace Kratos
25 {
28 
32 
36 
40 
44 
46 
48  class KRATOS_API(DELAUNAY_MESHING_APPLICATION) MesherUtilities
49  {
50  public:
53 
56 
57  typedef Node PointType;
58  typedef Node::Pointer PointPointerType;
60  typedef std::vector<PointPointerType> PointPointerVector;
68 
72 
73  enum ContactElementType //(contact domain definition)
74  {
75  NonContact, // this is not a contact element
76  PointToFace, // 2D/3D classical well defined node to face contact
77  EdgeToEdge, // 3D edge to edge complex contact element
78  PointToPoint, // 2D/3D not compatible element belong to multiple bodies
79  Undefined // to be defined later
80  };
81 
86  // meshing options
87 
88  //(configuration)
94  KRATOS_DEFINE_LOCAL_FLAG(CONTACT_SEARCH);
95  KRATOS_DEFINE_LOCAL_FLAG(MESH_SMOOTHING);
96  KRATOS_DEFINE_LOCAL_FLAG(VARIABLES_SMOOTHING);
97 
98  // removing options
99 
100  //(configuration)
102  KRATOS_DEFINE_LOCAL_FLAG(REMOVE_NODES_ON_DISTANCE);
103  KRATOS_DEFINE_LOCAL_FLAG(REMOVE_NODES_ON_ERROR);
104  KRATOS_DEFINE_LOCAL_FLAG(REMOVE_NODES_ON_THRESHOLD);
105 
106  KRATOS_DEFINE_LOCAL_FLAG(REMOVE_BOUNDARY_NODES);
107  KRATOS_DEFINE_LOCAL_FLAG(REMOVE_BOUNDARY_NODES_ON_DISTANCE);
108  KRATOS_DEFINE_LOCAL_FLAG(REMOVE_BOUNDARY_NODES_ON_ERROR);
109  KRATOS_DEFINE_LOCAL_FLAG(REMOVE_BOUNDARY_NODES_ON_THRESHOLD);
110 
111  // refining options
112 
113  //(configuration)
114  KRATOS_DEFINE_LOCAL_FLAG(REFINE_ADD_NODES);
115  KRATOS_DEFINE_LOCAL_FLAG(REFINE_INSERT_NODES);
116 
117  KRATOS_DEFINE_LOCAL_FLAG(REFINE_ELEMENTS);
118  KRATOS_DEFINE_LOCAL_FLAG(REFINE_ELEMENTS_ON_DISTANCE);
119  KRATOS_DEFINE_LOCAL_FLAG(REFINE_ELEMENTS_ON_ERROR);
120  KRATOS_DEFINE_LOCAL_FLAG(REFINE_ELEMENTS_ON_THRESHOLD);
121 
122  KRATOS_DEFINE_LOCAL_FLAG(REFINE_BOUNDARY);
123  KRATOS_DEFINE_LOCAL_FLAG(REFINE_BOUNDARY_ON_DISTANCE);
124  KRATOS_DEFINE_LOCAL_FLAG(REFINE_BOUNDARY_ON_ERROR);
125  KRATOS_DEFINE_LOCAL_FLAG(REFINE_BOUNDARY_ON_THRESHOLD);
126 
127  // execution options
128  //(select)
129  KRATOS_DEFINE_LOCAL_FLAG(INITIALIZE_MESHER_INPUT);
130  KRATOS_DEFINE_LOCAL_FLAG(FINALIZE_MESHER_INPUT);
131 
132  KRATOS_DEFINE_LOCAL_FLAG(TRANSFER_KRATOS_NODES_TO_MESHER);
133  KRATOS_DEFINE_LOCAL_FLAG(TRANSFER_KRATOS_ELEMENTS_TO_MESHER);
134  KRATOS_DEFINE_LOCAL_FLAG(TRANSFER_KRATOS_NEIGHBOURS_TO_MESHER);
135  KRATOS_DEFINE_LOCAL_FLAG(TRANSFER_KRATOS_FACES_TO_MESHER);
136 
137  KRATOS_DEFINE_LOCAL_FLAG(SELECT_TESSELLATION_ELEMENTS);
138  KRATOS_DEFINE_LOCAL_FLAG(KEEP_ISOLATED_NODES);
139  KRATOS_DEFINE_LOCAL_FLAG(REFINE_WALL_CORNER);
140 
141  // execution options (tessellation) //not needed any more, just the strings definition...to set.
142  KRATOS_DEFINE_LOCAL_FLAG(NEIGHBOURS_SEARCH);
143  KRATOS_DEFINE_LOCAL_FLAG(BOUNDARIES_SEARCH);
145 
146  KRATOS_DEFINE_LOCAL_FLAG(PASS_ALPHA_SHAPE);
147 
149  {
150 
152 
153  protected:
154  double *mpPointList;
156 
159 
162 
163  public:
164  // flags to set when the pointers are created (true) or deleted (false)
169 
170  void SetPointList(double *&rPointList) { mpPointList = rPointList; }
171  void SetElementList(int *&rElementList) { mpElementList = rElementList; };
172  void SetElementSizeList(double *&rElementSizeList) { mpElementSizeList = rElementSizeList; };
173  void SetElementNeighbourList(int *&rElementNeighbourList) { mpElementNeighbourList = rElementNeighbourList; };
174  void SetNumberOfPoints(int &rNumberOfPoints) { mNumberOfPoints = rNumberOfPoints; };
175  void SetNumberOfElements(int &rNumberOfElements) { mNumberOfElements = rNumberOfElements; };
176 
177  double *GetPointList() { return mpPointList; };
178  int *GetElementList() { return mpElementList; };
179  double *GetElementSizeList() { return mpElementSizeList; };
180  int *GetElementNeighbourList() { return mpElementNeighbourList; };
181 
182  int &GetNumberOfPoints() { return mNumberOfPoints; };
183  int &GetNumberOfElements() { return mNumberOfElements; };
184 
185  void CreatePointList(const unsigned int NumberOfPoints, const unsigned int Dimension)
186  {
187  if (mpPointList)
188  {
189  delete[] mpPointList;
190  }
191  mNumberOfPoints = NumberOfPoints;
192  mpPointList = new double[NumberOfPoints * Dimension];
193  PointListFlag = true;
194  }
195 
196  void CreateElementList(const unsigned int NumberOfElements, const unsigned int NumberOfVertices)
197  {
198  if (mpElementList)
199  {
200  delete[] mpElementList;
201  }
202  mNumberOfElements = NumberOfElements;
203  mpElementList = new int[NumberOfElements * NumberOfVertices];
204  ElementListFlag = true;
205  }
206 
207  void CreateElementSizeList(const unsigned int NumberOfElements)
208  {
209  if (mpElementSizeList)
210  {
211  delete[] mpElementSizeList;
212  }
213  mpElementSizeList = new double[NumberOfElements];
214  ElementSizeListFlag = true;
215  }
216 
217  void CreateElementNeighbourList(const unsigned int NumberOfElements, const unsigned int NumberOfFaces)
218  {
219  if (mpElementNeighbourList)
220  {
221  delete[] mpElementNeighbourList;
222  }
223  mpElementNeighbourList = new int[NumberOfElements * NumberOfFaces];
224  ElementNeighbourListFlag = true;
225  }
226 
227  void Initialize()
228  {
229  mpPointList = (double *)NULL;
230  mpElementList = (int *)NULL;
231  mpElementSizeList = (double *)NULL;
232  mpElementNeighbourList = (int *)NULL;
233  mNumberOfPoints = 0;
234  mNumberOfElements = 0;
235 
236  PointListFlag = false;
237  ElementListFlag = false;
238  ElementSizeListFlag = false;
239  ElementNeighbourListFlag = false;
240  }
241 
242  void Finalize()
243  {
244  if (mpPointList && PointListFlag)
245  {
246  delete[] mpPointList;
247  }
248 
249  if (mpElementList && ElementListFlag)
250  {
251  delete[] mpElementList;
252  }
253 
254  if (mpElementSizeList && ElementSizeListFlag)
255  {
256  delete[] mpElementSizeList;
257  }
258 
259  if (mpElementNeighbourList && ElementNeighbourListFlag)
260  {
261  delete[] mpElementNeighbourList;
262  }
263 
264  Initialize();
265  }
266  };
267 
269  {
270 
272 
273  public:
274  // initial and total
275  unsigned int NumberOfElements;
276  unsigned int NumberOfNodes;
277  unsigned int NumberOfConditions;
278 
279  unsigned int InitialNumberOfNodes;
280 
281  // added
282  unsigned int NumberOfNewElements;
283  unsigned int NumberOfNewNodes;
284  unsigned int NumberOfNewConditions;
285 
288 
289  // total for all refining boxes
290  unsigned int InsertedNodes;
291  unsigned int RemovedNodes;
293  unsigned int InsertedBoundaryNodes;
295 
296  unsigned int CriticalElements;
297 
300 
302 
303  void Initialize()
304  {
305 
306  NumberOfElements = 0;
307  NumberOfNodes = 0;
308  NumberOfConditions = 0;
309 
310  NumberOfNewElements = 0;
311  NumberOfNewNodes = 0;
312  NumberOfNewConditions = 0;
313 
314  InsertedNodes = 0;
315  RemovedNodes = 0;
316 
317  InsertedBoundaryNodes = 0;
318  InsertedBoundaryConditions = 0;
319 
320  CriticalElements = 0;
321 
322  GeometricalSmoothingRequired = false;
323  MechanicalSmoothingRequired = false;
324  };
325 
326  void SetNumberOfNodes(unsigned int NumberNodes)
327  {
328  NumberOfNodes = NumberNodes;
329  }
330 
331  void SetNumberOfElements(unsigned int NumberElements)
332  {
333  NumberOfElements = NumberElements;
334  }
335 
336  void SetNumberOfConditions(unsigned int NumberConditions)
337  {
338  NumberOfConditions = NumberConditions;
339  }
340 
341  unsigned int GetNumberOfNodes()
342  {
343  return NumberOfNodes;
344  }
345 
346  unsigned int GetNumberOfElements()
347  {
348  return NumberOfElements;
349  }
350 
351  unsigned int GetNumberOfConditions()
352  {
353  return NumberOfConditions;
354  }
355 
356  void SetNumberOfNewNodes(unsigned int NumberNodes)
357  {
358  NumberOfNewNodes = NumberNodes;
359  }
360 
361  void SetNumberOfNewElements(unsigned int NumberElements)
362  {
363  NumberOfNewElements = NumberElements;
364  }
365 
366  void SetNumberOfNewConditions(unsigned int NumberConditions)
367  {
368  NumberOfNewConditions = NumberConditions;
369  }
370 
371  void SetInitialMeshVolume(double Volume)
372  {
373  InitialMeshVolume = Volume;
374  }
375 
377  {
378  return InitialMeshVolume;
379  }
380 
382  {
383 
384  // std::cout<<" Inserted Nodes "<<InsertedNodes<<" NumNodes "<<NumberOfNodes<<" Removed "<<RemovedNodes<<std::endl;
385 
386  if (InsertedNodes > NumberOfNodes * 0.001 || RemovedNodes > NumberOfNodes * 0.001)
387  {
388  GeometricalSmoothingRequired = true;
389  }
390  else if ((InsertedNodes + RemovedNodes) > NumberOfNodes * 0.002)
391  {
392  GeometricalSmoothingRequired = true;
393  }
394  else
395  {
396  GeometricalSmoothingRequired = false;
397  }
398 
399  return GeometricalSmoothingRequired;
400  }
401 
403  {
404 
405  if (CriticalElements > 0 || NumberOfNewElements != 0)
406  MechanicalSmoothingRequired = true;
407  else
408  MechanicalSmoothingRequired = false;
409 
410  return MechanicalSmoothingRequired;
411  }
412 
414  {
415  return InsertedNodes;
416  }
417  };
418 
420  {
421  // number of entities refined/removed due to criterion:
422  unsigned int on_distance;
423  unsigned int on_threshold;
424  unsigned int on_error;
425 
426  void Initialize()
427  {
428  on_distance = 0;
429  on_threshold = 0;
430  on_error = 0;
431  }
432 
433  void EchoStats()
434  {
435  std::cout << " BodyInfo [on_distance:" << on_distance << ", on_threshold:" << on_threshold << ", on_error:" << on_error << "]" << std::endl;
436  }
437  };
438 
440  {
441  // number of entities refined/removed due to criterion:
442  unsigned int on_distance;
443  unsigned int on_threshold;
444  unsigned int on_error;
445 
446  unsigned int in_contact;
447  unsigned int in_concave_boundary;
448  unsigned int in_convex_boundary;
449 
450  void Initialize()
451  {
452  on_distance = 0;
453  on_threshold = 0;
454  on_error = 0;
455  in_contact = 0;
456  in_concave_boundary = 0;
457  in_convex_boundary = 0;
458  }
459 
460  void EchoStats()
461  {
462  std::cout << " BoundaryInfo [on_distance:" << on_distance << ", on_threshold:" << on_threshold << ", on_error:" << on_error << "]" << std::endl;
463  std::cout << " [in_contact:" << in_contact << ", in_concave_boundary:" << in_concave_boundary << ", in_convex_boundary:" << in_convex_boundary << "]" << std::endl;
464  }
465  };
466 
468  {
469  // refine/remove body
470  RefineBodyInfo BodyElementsRefined; // refined elements
472 
473  // refine/remove boundary
474  RefineBoundaryInfo BoundaryConditionsRefined; // refined boundary conditions
475  RefineBoundaryInfo BoundaryNodesRemoved; // removed boundary nodes
476  };
477 
479  {
480 
482 
483  private:
484  // Pointer variables
485  const Variable<double> *mpThresholdVariable;
486  const Variable<double> *mpErrorVariable;
487 
488  public:
489  // reference sizes
490  Flags RefiningOptions; // configuration refining options
491  Flags RemovingOptions; // configuration removing options
492 
493  double Alpha; // critical alpha parameter
494 
495  double CriticalRadius; // critical area size
496  double CriticalSide; // critical length size
497 
498  double ReferenceThreshold; // critical variable threshold value
499  double ReferenceError; // critical error percentage
500 
501  // computed sizes
502  double InitialRadius; // initial mesh radius/nodal-h
503  double MeanVolume; // mean element area/volume
504 
505  // info parameters
507 
508  // applied in the spatial box
510  SpatialBoundingBox::Pointer RefiningBox;
511 
512  // setting refining variables (generally for python interface)
513 
514  void SetRefiningOptions(const Flags &rOptions)
515  {
516  RefiningOptions = rOptions;
517  };
518 
519  void SetRemovingOptions(const Flags &rOptions)
520  {
521  RemovingOptions = rOptions;
522  };
523 
524  void SetAlphaParameter(const double rAlpha)
525  {
526  Alpha = rAlpha;
527  };
528 
529  double GetMeanVolume()
530  {
531  return MeanVolume;
532  };
533 
534  void SetMeanVolume(const double rMeanVolume)
535  {
536  MeanVolume = rMeanVolume;
537  };
538 
539  void SetCriticalRadius(const double rCriticalRadius)
540  {
541  CriticalRadius = rCriticalRadius;
542  };
543 
544  void SetInitialRadius(const double rInitialRadius)
545  {
546  KRATOS_TRY
547  InitialRadius = rInitialRadius;
548  KRATOS_CATCH(" ")
549  }
550 
551  void SetCriticalSide(const double rCriticalSide)
552  {
553  CriticalSide = rCriticalSide;
554  };
555 
556  void SetParameters(const double rAlpha, const double rCriticalRadius, const double rCriticalSide)
557  {
558  Alpha = rAlpha;
559  CriticalRadius = rCriticalRadius;
560  CriticalSide = rCriticalSide;
561  }
562 
563  void SetRefiningBox(SpatialBoundingBox::Pointer pRefiningBox)
564  {
565  RefiningBoxSetFlag = true;
566  RefiningBox = pRefiningBox;
567  }
568 
569  void SetReferenceThreshold(const double rReferenceThreshold)
570  {
571  ReferenceThreshold = rReferenceThreshold;
572  };
573 
574  void SetReferenceError(const double rReferenceError)
575  {
576  ReferenceError = rReferenceError;
577  };
578 
579  void SetThresholdVariable(const Variable<double> &rVariable)
580  {
581  mpThresholdVariable = &rVariable;
582  };
583 
584  void SetErrorVariable(const Variable<double> &rVariable)
585  {
586  mpErrorVariable = &rVariable;
587  };
588 
590  {
591  return RefiningOptions;
592  };
593 
595  {
596  return RemovingOptions;
597  };
598 
600  {
601  return ReferenceThreshold;
602  };
603 
605  {
606  return *mpThresholdVariable;
607  };
608 
610  {
611  return *mpErrorVariable;
612  };
613 
614  void Initialize()
615  {
616 
617  Alpha = 0;
618 
619  CriticalRadius = 0;
620  CriticalSide = 0;
621 
622  ReferenceThreshold = 0;
623  ReferenceError = 0;
624 
625  InitialRadius = 0;
626  MeanVolume = 0;
627  };
628  };
629 
631  {
632 
634 
635  protected:
636  // Pointer variables
639 
640  public:
641  // SubModelPart Name
642  std::string SubModelPartName;
643 
644  // General configuration flags
646 
647  // Local execution flags
648  Flags ExecutionOptions; // configuration meshing options
649 
650  // General configuration variables
652  double OffsetFactor;
653 
654  // Options for the mesher
655  std::string TessellationFlags;
656  std::string TessellationInfo;
657 
659 
660  // Local execution variablesg
663 
664  unsigned int ConditionMaxId;
665  unsigned int ElementMaxId;
666  unsigned int NodeMaxId;
667 
668  std::vector<int> NodalPreIds;
669  std::vector<int> PreservedElements;
670 
671  std::vector<BoundedVector<double, 3>> Holes;
672 
673  // Mesher pointers to the mesh structures
677 
678  std::vector<std::vector<int>> NeighbourList;
679 
680  // Global Meshing info
681  MeshingInfoParameters::Pointer Info;
682 
683  // Global Remining parameters
684  RefiningParameters::Pointer Refine;
685 
686  // some local bbx-based refining parameters
687  // can be defined here: std::vector<RefiningParameters::Pointer> LocalRefineVector;
688 
689  // Global Tranfer parameters
690  TransferParametersType::Pointer Transfer;
691 
692  PropertiesType::Pointer Properties;
693 
694  // Global Meshing box
696  SpatialBoundingBox::Pointer MeshingBox;
697 
703 
704  std::vector<bool> UseRefiningBox;
705  std::vector<double> RefiningBoxInitialTime;
706  std::vector<double> RefiningBoxFinalTime;
707  std::vector<double> RefiningBoxMeshSize;
708  std::vector<unsigned int> RefiningBoxElementsInTransitionZone;
709  std::vector<array_1d<double, 3>> RefiningBoxMinimumPoint;
710  std::vector<array_1d<double, 3>> RefiningBoxMaximumPoint;
711 
712  std::vector<array_1d<double, 3>> RefiningBoxShiftedMinimumPoint;
713  std::vector<array_1d<double, 3>> RefiningBoxShiftedMaximumPoint;
714 
715  void Set(Flags ThisFlag)
716  {
717  Options.Set(ThisFlag);
718  };
719 
720  void Reset(Flags ThisFlag)
721  {
722  Options.Reset(ThisFlag);
723  };
724 
725  void SetOptions(const Flags &rOptions)
726  {
727  Options = rOptions;
728  };
729 
730  void SetSubModelPartName(std::string const &rSubModelPartName)
731  {
732  SubModelPartName = rSubModelPartName;
733  };
734 
735  void SetExecutionOptions(const Flags &rOptions)
736  {
737  ExecutionOptions = rOptions;
738  };
739 
740  void SetTessellationFlags(std::string rFlags)
741  {
742  TessellationFlags = rFlags;
743  };
744 
745  void SetTessellationInfo(std::string rInfo)
746  {
747  TessellationInfo = rInfo;
748  };
749 
750  void SetAlphaParameter(const double rAlpha)
751  {
752  AlphaParameter = rAlpha;
753  };
754 
755  void SetOffsetFactor(const double rOffsetFactor)
756  {
757  OffsetFactor = rOffsetFactor;
758  };
759 
760  void SetInfoParameters(MeshingInfoParameters::Pointer rInfo)
761  {
762  Info = rInfo;
763  };
764 
765  void SetRefiningParameters(RefiningParameters::Pointer rRefine)
766  {
767  Refine = rRefine;
768  };
769 
770  void SetProperties(PropertiesType::Pointer rProperties)
771  {
772  Properties = rProperties;
773  };
774 
775  void SetMeshingBox(SpatialBoundingBox::Pointer pMeshingBox)
776  {
777  MeshingBoxSetFlag = true;
778  MeshingBox = pMeshingBox;
779  }
780 
781  void SetTransferParameters(TransferParametersType::Pointer rTransferVariables)
782  {
783  TransferVariablesSetFlag = true;
784  Transfer = rTransferVariables;
785  }
786 
787  void SetTransferVariable(const Variable<double> &rTransferVariable)
788  {
789  TransferVariablesSetFlag = true;
790  Transfer->SetVariable(rTransferVariable);
791  }
792 
793  void SetReferenceElement(const Element &rElement)
794  {
795  mpReferenceElement = &rElement;
796  };
797 
798  void SetReferenceCondition(const Condition &rCondition)
799  {
800  mpReferenceCondition = &rCondition;
801  };
802 
803  void SetHoles(std::vector<BoundedVector<double, 3>> &rHoles)
804  {
805  Holes = rHoles;
806  }
807 
808  std::vector<BoundedVector<double, 3>> &GetHoles()
809  {
810  return Holes;
811  }
812 
813  std::string GetSubModelPartName()
814  {
815  return SubModelPartName;
816  };
817 
819  {
820  return Options;
821  };
822 
823  MeshingInfoParameters::Pointer GetInfoParameters()
824  {
825  return Info;
826  };
827 
828  TransferParametersType::Pointer GetTransferParameters()
829  {
830  return Transfer;
831  };
832 
833  RefiningParameters::Pointer GetRefiningParameters()
834  {
835  return Refine;
836  };
837 
838  PropertiesType::Pointer GetProperties()
839  {
840  return Properties;
841  };
842 
844  {
845  return *mpReferenceElement;
846  };
848  {
849  return *mpReferenceCondition;
850  };
851 
852  void Initialize()
853  {
854 
855  AlphaParameter = 0;
856 
857  OffsetFactor = 0;
858 
859  MeshingBoxSetFlag = false;
860 
861  TransferVariablesSetFlag = false;
862 
863  InputInitializedFlag = false;
864  MeshElementsSelectedFlag = false;
865 
866  ConditionMaxId = 0;
867  ElementMaxId = 0;
868  NodeMaxId = 0;
869 
870  InMesh.Initialize();
871  OutMesh.Initialize();
872  MidMesh.Initialize();
873 
874  // RemeshInfo.Initialize();
875  // Refine.Initialize();
876  };
877 
879  {
880  MeshElementsSelectedFlag = false;
881  PreservedElements.clear();
882  PreservedElements.resize(0);
883  };
884 
886  {
887  MeshElementsSelectedFlag = false;
888  PreservedElements.clear();
889  PreservedElements.resize(0);
890  };
891 
892  void SetUseBoundingBox(bool rUseBoundingBox)
893  {
894  UseBoundingBox = rUseBoundingBox;
895  };
896 
897  void SetBoundingBoxLowerPoint(double rBoundingBoxLowerPointX, double rBoundingBoxLowerPointY, double rBoundingBoxLowerPointZ)
898  {
899  BoundingBoxLowerPoint[0] = rBoundingBoxLowerPointX;
900  BoundingBoxLowerPoint[1] = rBoundingBoxLowerPointY;
901  BoundingBoxLowerPoint[2] = rBoundingBoxLowerPointZ;
902  };
903 
904  void SetBoundingBoxUpperPoint(double rBoundingBoxUpperPointX, double rBoundingBoxUpperPointY, double rBoundingBoxUpperPointZ)
905  {
906  BoundingBoxUpperPoint[0] = rBoundingBoxUpperPointX;
907  BoundingBoxUpperPoint[1] = rBoundingBoxUpperPointY;
908  BoundingBoxUpperPoint[2] = rBoundingBoxUpperPointZ;
909  };
910 
911  void SetBoundingBoxTimeInterval(double rBoundingBoxInitialTime, double rBoundingBoxFinalTime)
912  {
913  BoundingBoxInitialTime = rBoundingBoxInitialTime;
914  BoundingBoxFinalTime = rBoundingBoxFinalTime;
915  };
916 
917  void InitializeRefiningBoxParameters(unsigned int size)
918  {
919  UseRefiningBox.resize(size, false);
920  RefiningBoxMinimumPoint.resize(size);
921  RefiningBoxMaximumPoint.resize(size);
922  RefiningBoxShiftedMinimumPoint.resize(size);
923  RefiningBoxShiftedMaximumPoint.resize(size);
924  RefiningBoxInitialTime.resize(size, false);
925  RefiningBoxFinalTime.resize(size, false);
926  RefiningBoxMeshSize.resize(size, false);
927  RefiningBoxElementsInTransitionZone.resize(size, false);
928  }
929 
930  void SetUseRefiningBox(unsigned int index, bool rUseRefiningBox)
931  {
932  UseRefiningBox[index] = rUseRefiningBox;
933  };
934 
935  void SetRefiningBoxMinimumPoint(unsigned int index, double rRefiningBoxMinimumPointX, double rRefiningBoxMinimumPointY, double rRefiningBoxMinimumPointZ)
936  {
937  RefiningBoxMinimumPoint[index][0] = rRefiningBoxMinimumPointX;
938  RefiningBoxMinimumPoint[index][1] = rRefiningBoxMinimumPointY;
939  RefiningBoxMinimumPoint[index][2] = rRefiningBoxMinimumPointZ;
940  };
941 
942  void SetRefiningBoxMaximumPoint(unsigned int index, double rRefiningBoxMaximumPointX, double rRefiningBoxMaximumPointY, double rRefiningBoxMaximumPointZ)
943  {
944  RefiningBoxMaximumPoint[index][0] = rRefiningBoxMaximumPointX;
945  RefiningBoxMaximumPoint[index][1] = rRefiningBoxMaximumPointY;
946  RefiningBoxMaximumPoint[index][2] = rRefiningBoxMaximumPointZ;
947  };
948 
949  void SetRefiningBoxShiftedMinimumPoint(unsigned int index, double rPointX, double rPointY, double rPointZ)
950  {
951  RefiningBoxShiftedMinimumPoint[index][0] = rPointX;
952  RefiningBoxShiftedMinimumPoint[index][1] = rPointY;
953  RefiningBoxShiftedMinimumPoint[index][2] = rPointZ;
954  };
955 
956  void SetRefiningBoxShiftedMaximumPoint(unsigned int index, double rPointX, double rPointY, double rPointZ)
957  {
958  RefiningBoxShiftedMaximumPoint[index][0] = rPointX;
959  RefiningBoxShiftedMaximumPoint[index][1] = rPointY;
960  RefiningBoxShiftedMaximumPoint[index][2] = rPointZ;
961  };
962 
963  void SetRefiningBoxTimeInterval(unsigned int index, double rRefiningBoxInitialTime, double rRefiningBoxFinalTime)
964  {
965  RefiningBoxInitialTime[index] = rRefiningBoxInitialTime;
966  RefiningBoxFinalTime[index] = rRefiningBoxFinalTime;
967  };
968 
969  void SetRefiningBoxMeshSize(unsigned int index, double rRefiningBoxMeshSize)
970  {
971  RefiningBoxMeshSize[index] = rRefiningBoxMeshSize;
972  };
973 
974  void SetRefiningBoxElementsInTransitionZone(unsigned int index, unsigned int rRefiningBoxElementsInTransitionZone)
975  {
976  RefiningBoxElementsInTransitionZone[index] = rRefiningBoxElementsInTransitionZone;
977  };
978 
979  };
980 
984 
987 
989  virtual ~MesherUtilities() {}
990 
994 
998 
999  void SetModelPartNameToElements(ModelPart &rModelPart);
1000 
1001  void SetModelPartNameToConditions(ModelPart &rModelPart);
1002 
1003  void SetModelPartNameToNodes(ModelPart &rModelPart);
1004 
1005  void SetFlagsToNodes(ModelPart &rModelPart, const std::vector<Flags> rControlFlags, const std::vector<Flags> rAssignFlags);
1006 
1007  double ComputeModelPartVolume(ModelPart &rModelPart);
1008 
1009  //*******************************************************************************************
1010  //*******************************************************************************************
1011 
1012  bool CheckSubdomain(Geometry<Node> &rGeometry);
1013 
1014  bool CheckRigidOuterCentre(Geometry<Node> &rGeometry);
1015 
1016  bool CheckInnerCentre(Geometry<Node> &rGeometry);
1017 
1018  bool CheckOuterCentre(Geometry<Node> &rGeometry, double &rOffsetFactor, bool &rSelfContact);
1019 
1020  bool CheckSliver(Geometry<Node> &rGeometry);
1021 
1022  ContactElementType CheckContactElement(Geometry<Node> &rGeometry, std::vector<int> &rSlaveVertices);
1023 
1024  double GetAndCompareSideLenghts(Geometry<Node> &rGeometry, double &rMaximumSideLength, double &rMinimumSideLength);
1025 
1026  bool CheckGeometryShape(Geometry<Node> &rGeometry, int &rShape);
1027 
1028  //*******************************************************************************************
1029  //*******************************************************************************************
1030 
1031  // computes geometry radius
1032  double &ComputeRadius(double &rRadius, double &rVolume, std::vector<Vector> &rVertices, const unsigned int &dimension);
1033 
1034  // returns false if it should be removed
1035  bool AlphaShape(double AlphaParameter, Geometry<Node> &rGeometry, const unsigned int dimension);
1036  bool AlphaShape(double AlphaParameter, Geometry<Node> &rGeometry, const unsigned int dimension, const double MeanMeshSize);
1037 
1038  // returns false if it should be removed
1039  bool ShrankAlphaShape(double AlphaParameter, Geometry<Node> &rGeometry, double &rOffsetFactor, const unsigned int dimension);
1040 
1041  // returns the nodal h relative to a single boundary node
1042  double FindBoundaryH(Node &BoundaryPoint);
1043 
1044  // writes a list of particles telling if they are set as boundary or not
1045  void CheckParticles(ModelPart &rModelPart);
1046 
1047  // computes velocity norms of the geometry
1048  bool CheckRelativeVelocities(Geometry<Node> &rGeometry, const double &rRelativeFactor);
1049 
1050  // computes prediction of volume decrease of the geometry
1051  bool CheckVolumeDecrease(GeometryType &rVertices, const unsigned int &rDimension, const double &rTolerance, double &VolumeChange);
1052 
1053  // computes prediction of volume after a projection of the displacement geometry
1054  double GetMovedVolume(GeometryType &rVertices, const unsigned int &rDimension, double MovementFactor);
1055 
1056  // computes deformation gradient determinant
1057  double GetDeformationGradientDeterminant(GeometryType &rVertices, const unsigned int &rDimension);
1058 
1059  void DefineMeshSizeInTransitionZones2D(MeshingParameters &rMeshingVariables,
1060  double currentTime,
1061  array_1d<double, 3> NodeCoordinates,
1062  double &meanMeshSize,
1063  bool &insideTransitionZone);
1064 
1065  void DefineMeshSizeInTransitionZones3D(MeshingParameters &rMeshingVariables,
1066  double currentTime,
1067  array_1d<double, 3> NodeCoordinates,
1068  double &meanMeshSize,
1069  bool &insideTransitionZone);
1070  //*******************************************************************************************
1071  //*******************************************************************************************
1072 
1073  static inline double CalculateSideLength(PointType &P1, PointType &P2)
1074  {
1075  return sqrt((P1.X() - P2.X()) * (P1.X() - P2.X()) + (P1.Y() - P2.Y()) * (P1.Y() - P2.Y()) + (P1.Z() - P2.Z()) * (P1.Z() - P2.Z()));
1076  };
1077 
1078  static inline double CalculateBoundarySize(Geometry<Node> &rGeometry)
1079  {
1080 
1081  if (rGeometry.size() == 2)
1082  {
1083  return CalculateSideLength(rGeometry[0], rGeometry[1]);
1084  }
1085  else if (rGeometry.size() == 3)
1086  {
1087  return 2 * CalculateTriangleRadius(rGeometry);
1088  }
1089  else
1090  {
1091  std::cout << "BOUNDARY SIZE NOT COMPUTED :: geometry not correct" << std::endl;
1092  return 0;
1093  }
1094  };
1095 
1096  static inline double CalculateTriangleRadius(Geometry<Node> &rGeometry)
1097  {
1098 
1099  double L1 = CalculateSideLength(rGeometry[0], rGeometry[1]);
1100  double L2 = CalculateSideLength(rGeometry[1], rGeometry[2]);
1101  double L3 = CalculateSideLength(rGeometry[2], rGeometry[0]);
1102 
1103  double Area = rGeometry.Area();
1104 
1105  // inradius
1106  double Rcrit = Area * 2 / (L1 + L2 + L3);
1107 
1108  return Rcrit;
1109  };
1110 
1111  static inline double CalculateTetrahedronRadius(Geometry<Node> &rGeometry)
1112  {
1113 
1114  // edges
1115  double L1 = CalculateSideLength(rGeometry[0], rGeometry[1]);
1116  double L2 = CalculateSideLength(rGeometry[1], rGeometry[2]);
1117  double L3 = CalculateSideLength(rGeometry[2], rGeometry[3]);
1118  double L4 = CalculateSideLength(rGeometry[3], rGeometry[0]);
1119  double L5 = CalculateSideLength(rGeometry[3], rGeometry[1]);
1120  double L6 = CalculateSideLength(rGeometry[2], rGeometry[0]);
1121 
1122  // inradius
1123  double S = 0.5 * (L1 + L4 + L5); // semiperimeter
1124  double R1 = sqrt(S * (S - L1) * (S - L4) * (S - L5)) / S;
1125 
1126  S = 0.5 * (L2 + L3 + L5); // semiperimeter
1127  double R2 = sqrt(S * (S - L2) * (S - L3) * (S - L5)) / S;
1128 
1129  S = 0.5 * (L3 + L4 + L6); // semiperimeter
1130  double R3 = sqrt(S * (S - L3) * (S - L4) * (S - L6)) / S;
1131 
1132  S = 0.5 * (L1 + L2 + L6); // semiperimeter
1133  double R4 = sqrt(S * (S - L1) * (S - L2) * (S - L6)) / S;
1134 
1135  S = 1.0 / (R1 * R1) + 1.0 / (R2 * R2) + 1.0 / (R3 * R3) + 1.0 / (R4 * R4);
1136 
1137  double Rcrit = sqrt(2.0 / S); // this is always bigger than the inradius
1138 
1139  return Rcrit;
1140  };
1141 
1142  static inline double CalculateElementRadius(Geometry<Node> &rGeometry)
1143  {
1144 
1145  if (rGeometry.size() == 3)
1146  return CalculateTriangleRadius(rGeometry);
1147  else
1148  return CalculateTetrahedronRadius(rGeometry);
1149  };
1150 
1151  static inline double CalculateElementRadius(Geometry<Node> &rGeometry, double &rDomainSize)
1152  {
1153 
1154  if (rGeometry.size() == 3)
1155  return CalculateTriangleRadius(rGeometry[0].X(), rGeometry[0].Y(),
1156  rGeometry[1].X(), rGeometry[1].Y(),
1157  rGeometry[2].X(), rGeometry[2].Y(),
1158  rDomainSize);
1159  else
1160  return CalculateTetrahedronRadius(rGeometry[0].X(), rGeometry[0].Y(), rGeometry[0].Z(),
1161  rGeometry[1].X(), rGeometry[1].Y(), rGeometry[1].Z(),
1162  rGeometry[2].X(), rGeometry[2].Y(), rGeometry[2].Z(),
1163  rGeometry[3].X(), rGeometry[3].Y(), rGeometry[3].Z(),
1164  rDomainSize);
1165  };
1166 
1167  static inline double CalculateTriangleArea(const double x0, const double y0,
1168  const double x1, const double y1,
1169  const double x2, const double y2)
1170  {
1171  return 0.5 * ((x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0));
1172  }
1173 
1174  static inline double CalculateTriangleRadius(const double x0, const double y0,
1175  const double x1, const double y1,
1176  const double x2, const double y2,
1177  double &Area)
1178  {
1179 
1180  double L1 = sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1));
1181  double L2 = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
1182  double L3 = sqrt((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0));
1183 
1184  Area = fabs(0.5 * ((x0 * y1) - (x0 * y2) - (x1 * y0) + (x1 * y2) + (x2 * y0) - (x2 * y1)));
1185 
1186  // std::cout<< " Area "<<Area<<" L1 "<<L1<<" L2 "<<L2<<" L3 "<<L3<<std::endl;
1187 
1188  // inradius
1189  double Rcrit = Area * 2 / (L1 + L2 + L3);
1190 
1191  return Rcrit;
1192  }
1193 
1194  static inline double CalculateTetrahedronVolume(const double x0, const double y0, const double z0,
1195  const double x1, const double y1, const double z1,
1196  const double x2, const double y2, const double z2,
1197  const double x3, const double y3, const double z3)
1198  {
1199  // volume
1200  double Volume = 0;
1201 
1202  Volume = CalculateDeterminant(x1, y1, z1, x2, y2, z2, x3, y3, z3);
1203  Volume -= CalculateDeterminant(x0, y0, z0, x2, y2, z2, x3, y3, z3);
1204  Volume += CalculateDeterminant(x0, y0, z0, x1, y1, z1, x3, y3, z3);
1205  Volume -= CalculateDeterminant(x0, y0, z0, x1, y1, z1, x2, y2, z2);
1206 
1207  Volume *= (1.0 / 6.0);
1208 
1209  return Volume;
1210  }
1211 
1212  static inline double CalculateTetrahedronRadius(const double x0, const double y0, const double z0,
1213  const double x1, const double y1, const double z1,
1214  const double x2, const double y2, const double z2,
1215  const double x3, const double y3, const double z3,
1216  double &Volume)
1217  {
1218 
1219  // edges
1220  double L1 = sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1) + (z0 - z1) * (z0 - z1));
1221  double L2 = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2));
1222  double L3 = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3) + (z2 - z3) * (z2 - z3));
1223  double L4 = sqrt((x3 - x0) * (x3 - x0) + (y3 - y0) * (y3 - y0) + (z3 - z0) * (z3 - z0));
1224  double L5 = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1) + (z3 - z1) * (z3 - z1));
1225  double L6 = sqrt((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0) + (z2 - z0) * (z2 - z0));
1226 
1227  // volume
1228  Volume = CalculateTetrahedronVolume(x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3);
1229 
1230  // inradius
1231  double S = 0.5 * (L1 + L4 + L5); // semiperimeter
1232  double R1 = sqrt(S * (S - L1) * (S - L4) * (S - L5)) / S;
1233 
1234  S = 0.5 * (L2 + L3 + L5); // semiperimeter
1235  double R2 = sqrt(S * (S - L2) * (S - L3) * (S - L5)) / S;
1236 
1237  S = 0.5 * (L3 + L4 + L6); // semiperimeter
1238  double R3 = sqrt(S * (S - L3) * (S - L4) * (S - L6)) / S;
1239 
1240  S = 0.5 * (L1 + L2 + L6); // semiperimeter
1241  double R4 = sqrt(S * (S - L1) * (S - L2) * (S - L6)) / S;
1242 
1243  S = 1.0 / (R1 * R1) + 1.0 / (R2 * R2) + 1.0 / (R3 * R3) + 1.0 / (R4 * R4);
1244 
1245  double Rcrit = sqrt(2.0 / S); // this is always bigger than the inradius
1246 
1247  return Rcrit;
1248  }
1249 
1250  static inline double CalculateDeterminant(const double x0, const double y0, const double z0,
1251  const double x1, const double y1, const double z1,
1252  const double x2, const double y2, const double z2)
1253  {
1254  return (x0 * y1 * z2 - x0 * y2 * z1 - x1 * y0 * z2 + x1 * y2 * z0 + x2 * y0 * z1 - x2 * y1 * z0);
1255  }
1256 
1257  static inline double CalculateAverageSideLength(const double x0, const double y0,
1258  const double x1, const double y1,
1259  const double x2, const double y2)
1260  {
1261  double length_0 = sqrt(x0 * x0 + y0 * y0);
1262  double length_1 = sqrt(x1 * x1 + y1 * y1);
1263  double length_2 = sqrt(x2 * x2 + y2 * y2);
1264 
1265  return 0.5 * (length_0 + length_1 + length_2);
1266  };
1267 
1268  //*******************************************************************************************
1269  //*******************************************************************************************
1270  //*******************************************************************************************
1271  //*******************************************************************************************
1272  static inline bool CalculatePosition(const std::vector<std::vector<double>> &rPointCoordinates,
1273  const std::vector<double> &rCenter, std::vector<double> &rShapeFunctionsN)
1274  {
1275 
1276  if (rPointCoordinates.size() == 3)
1277  {
1278 
1279  return CalculatePosition(rPointCoordinates[0][0], rPointCoordinates[0][1],
1280  rPointCoordinates[1][0], rPointCoordinates[1][1],
1281  rPointCoordinates[2][0], rPointCoordinates[2][1],
1282  rCenter[0], rCenter[1], rShapeFunctionsN);
1283  }
1284  else if (rPointCoordinates.size() == 4)
1285  {
1286 
1287  return CalculatePosition(rPointCoordinates[0][0], rPointCoordinates[0][1], rPointCoordinates[0][2],
1288  rPointCoordinates[1][0], rPointCoordinates[1][1], rPointCoordinates[1][2],
1289  rPointCoordinates[2][0], rPointCoordinates[2][1], rPointCoordinates[2][2],
1290  rPointCoordinates[3][0], rPointCoordinates[3][1], rPointCoordinates[3][2],
1291  rCenter[0], rCenter[1], rCenter[2], rShapeFunctionsN);
1292  }
1293  else
1294  {
1295  KRATOS_THROW_ERROR(std::logic_error, "Number of points supplied out of range ERROR", "")
1296  }
1297 
1298  return false;
1299  }
1300 
1301  //*******************************************************************************************
1302  //*******************************************************************************************
1303 
1304  static inline bool CalculatePosition(const double &x0, const double &y0, const double &z0,
1305  const double &x1, const double &y1, const double &z1,
1306  const double &x2, const double &y2, const double &z2,
1307  const double &x3, const double &y3, const double &z3,
1308  const double &xc, const double &yc, const double &zc,
1309  std::vector<double> &rShapeFunctionsN)
1310  {
1311  double volume = CalculateTetrahedronVolume(x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3);
1312 
1313  if (volume < 1e-25)
1314  {
1315  std::cout << " ERROR LS: tetrahedral element with zero area found: " << volume << " position (" << x0 << ", " << y0 << ", " << z0 << ") (" << x1 << ", " << y1 << ", " << z1 << ") (" << x2 << ", " << y2 << ", " << z2 << ") (" << x3 << ", " << y3 << ", " << z3 << ") " << std::endl;
1316  }
1317 
1318  if (rShapeFunctionsN.size() != 4)
1319  {
1320  rShapeFunctionsN.resize(4);
1321  // std::fill( rShapeFunctionsN.begin(), rShapeFunctionsN.end(), 0 );
1322  }
1323 
1324  rShapeFunctionsN[0] = CalculateTetrahedronVolume(xc, yc, zc, x1, y1, z1, x2, y2, z2, x3, y3, z3) / volume;
1325  rShapeFunctionsN[1] = CalculateTetrahedronVolume(x0, y0, z0, xc, yc, zc, x2, y2, z2, x3, y3, z3) / volume;
1326  rShapeFunctionsN[2] = CalculateTetrahedronVolume(x0, y0, z0, x1, y1, z1, xc, yc, zc, x3, y3, z3) / volume;
1327  rShapeFunctionsN[3] = CalculateTetrahedronVolume(x0, y0, z0, x1, y1, z1, x2, y2, z2, xc, yc, zc) / volume;
1328 
1329  // std::cout<<" N "<<rShapeFunctionsN[0]<<" "<<rShapeFunctionsN[1]<<" "<<rShapeFunctionsN[2]<<" "<<rShapeFunctionsN[3]<<" "<<std::endl;
1330 
1331  double tol = 1e-5;
1332  double upper_limit = 1.0 + tol;
1333  double lower_limit = -tol;
1334 
1335  if (rShapeFunctionsN[0] >= lower_limit && rShapeFunctionsN[1] >= lower_limit && rShapeFunctionsN[2] >= lower_limit && rShapeFunctionsN[3] >= lower_limit &&
1336  rShapeFunctionsN[0] <= upper_limit && rShapeFunctionsN[1] <= upper_limit && rShapeFunctionsN[2] <= upper_limit && rShapeFunctionsN[3] <= upper_limit) // if the xc yc zc is inside the tetrahedron
1337  return true;
1338  return false;
1339  }
1340 
1341  //*******************************************************************************************
1342  //*******************************************************************************************
1343 
1344  static inline bool CalculatePosition(const double &x0, const double &y0,
1345  const double &x1, const double &y1,
1346  const double &x2, const double &y2,
1347  const double &xc, const double &yc,
1348  std::vector<double> &rShapeFunctionsN)
1349  {
1350  double area = CalculateTriangleArea(x0, y0, x1, y1, x2, y2);
1351 
1352  if (area < 1e-15)
1353  {
1354  // KRATOS_THROW_ERROR( std::logic_error,"element with zero area found", "" );
1355  std::cout << " ERROR LS: triangle element with zero area found: " << area << " position (" << x0 << ", " << y0 << ") (" << x1 << ", " << y1 << ") (" << x2 << ", " << y2 << ") " << std::endl;
1356  }
1357 
1358  if (rShapeFunctionsN.size() != 3)
1359  {
1360  rShapeFunctionsN.resize(3);
1361  // std::fill( rShapeFunctionsN.begin(), rShapeFunctionsN.end(), 0 );
1362  }
1363 
1364  rShapeFunctionsN[0] = CalculateTriangleArea(x1, y1, x2, y2, xc, yc) / area;
1365  rShapeFunctionsN[1] = CalculateTriangleArea(x2, y2, x0, y0, xc, yc) / area;
1366  rShapeFunctionsN[2] = CalculateTriangleArea(x0, y0, x1, y1, xc, yc) / area;
1367 
1368  double tol = 1e-5;
1369  double upper_limit = 1.0 + tol;
1370  double lower_limit = -tol;
1371 
1372  if (rShapeFunctionsN[0] >= lower_limit && rShapeFunctionsN[1] >= lower_limit && rShapeFunctionsN[2] >= lower_limit && rShapeFunctionsN[0] <= upper_limit && rShapeFunctionsN[1] <= upper_limit && rShapeFunctionsN[2] <= upper_limit) // if the xc yc is inside the triangle
1373  return true;
1374 
1375  return false;
1376  }
1377 
1378  //*******************************************************************************************
1379  //*******************************************************************************************
1380 
1381  bool CheckConditionInBox(Condition::Pointer &pCondition, SpatialBoundingBox &rRefiningBox, ProcessInfo &rCurrentProcessInfo);
1382 
1383  bool CheckElementInBox(Element::Pointer &pElement, SpatialBoundingBox &rRefiningBox, ProcessInfo &rCurrentProcessInfo);
1384 
1385  bool CheckVerticesInBox(Geometry<Node> &rGeometry, SpatialBoundingBox &rRefiningBox, ProcessInfo &rCurrentProcessInfo);
1386 
1387  //*******************************************************************************************
1388  //*******************************************************************************************
1389 
1390  Condition::Pointer FindMasterCondition(Condition::Pointer &pCondition, ModelPart::ConditionsContainerType &rModelConditions, bool &condition_found);
1391 
1392  Condition::Pointer FindMasterCondition(Condition::Pointer &pCondition, PointType &pSlaveNode, ModelPart::ConditionsContainerType &rModelConditions, bool &condition_found);
1393 
1394  //*******************************************************************************************
1395  //*******************************************************************************************
1396 
1397  bool CheckContactActive(GeometryType &rConditionGeometry, bool &rSemiActiveContact, std::vector<bool> &rSemiActiveNodes);
1398 
1399  bool CheckContactCurvature(GeometryType &rConditionGeometry, std::vector<array_1d<double, 3>> &rContactNormals);
1400 
1401  double CheckCriticalRadius(ModelPart &rModelPart, double rCriticalRadius);
1402 
1403  double GetMeanRadius(ModelPart &rModelPart, double &rCriticalRadius);
1404 
1405  //*******************************************************************************************
1406  //*******************************************************************************************
1407 
1408  static inline unsigned int GetMaxNodeId(ModelPart &rModelPart)
1409  {
1410  KRATOS_TRY
1411 
1412  unsigned int max_id = rModelPart.Nodes().back().Id();
1413 
1414  for (ModelPart::NodesContainerType::iterator i_node = rModelPart.NodesBegin(); i_node != rModelPart.NodesEnd(); ++i_node)
1415  {
1416  if (i_node->Id() > max_id)
1417  max_id = i_node->Id();
1418  }
1419 
1420  return max_id;
1421 
1422  KRATOS_CATCH("")
1423  }
1424 
1425  //*******************************************************************************************
1426  //*******************************************************************************************
1427 
1428  static inline double CalculateModelPartVolume(ModelPart &rModelPart)
1429  {
1430  KRATOS_TRY
1431 
1432  const unsigned int dimension = rModelPart.GetProcessInfo()[SPACE_DIMENSION];
1433  double ModelPartVolume = 0;
1434  if (dimension == 2)
1435  {
1436 
1437  for (ModelPart::ElementsContainerType::iterator i_elem = rModelPart.ElementsBegin(); i_elem != rModelPart.ElementsEnd(); ++i_elem)
1438  {
1439  if (i_elem->GetGeometry().LocalSpaceDimension() != dimension)
1440  ModelPartVolume += i_elem->GetGeometry().Area();
1441  }
1442  }
1443  else if (dimension == 3)
1444  { // dimension == 3
1445 
1446  for (ModelPart::ElementsContainerType::iterator i_elem = rModelPart.ElementsBegin(); i_elem != rModelPart.ElementsEnd(); ++i_elem)
1447  {
1448  if (i_elem->GetGeometry().LocalSpaceDimension() != dimension)
1449  ModelPartVolume += i_elem->GetGeometry().Volume();
1450  }
1451  }
1452 
1453  return ModelPartVolume;
1454 
1455  KRATOS_CATCH(" ")
1456  }
1457 
1458  //*******************************************************************************************
1459  //*******************************************************************************************
1460 
1461  static inline unsigned int GetMaxConditionId(ModelPart &rModelPart)
1462  {
1463  KRATOS_TRY
1464 
1465  unsigned int max_id = rModelPart.Conditions().back().Id();
1466 
1467  for (ModelPart::ConditionsContainerType::iterator i_cond = rModelPart.ConditionsBegin(); i_cond != rModelPart.ConditionsEnd(); ++i_cond)
1468  {
1469  if (i_cond->Id() > max_id)
1470  max_id = i_cond->Id();
1471  }
1472 
1473  return max_id;
1474 
1475  KRATOS_CATCH("")
1476  }
1477 
1478  //*******************************************************************************************
1479  //*******************************************************************************************
1480 
1481  static inline unsigned int GetMaxElementId(ModelPart &rModelPart)
1482  {
1483  KRATOS_TRY
1484 
1485  unsigned int max_id = rModelPart.Elements().back().Id();
1486 
1487  for (ModelPart::ElementsContainerType::iterator i_elem = rModelPart.ElementsBegin(); i_elem != rModelPart.ElementsEnd(); ++i_elem)
1488  {
1489  if (i_elem->Id() > max_id)
1490  max_id = i_elem->Id();
1491  }
1492 
1493  return max_id;
1494 
1495  KRATOS_CATCH("")
1496  }
1497 
1498  //*******************************************************************************************
1499  //*******************************************************************************************
1500 
1501  bool FindCondition(Geometry<Node> &rConditionGeometry, Geometry<Node> &rGeometry, DenseMatrix<unsigned int> &lpofa, DenseVector<unsigned int> &lnofa, unsigned int &iface);
1502 
1503  //*******************************************************************************************
1504  //*******************************************************************************************
1505 
1509  void SetNodes(ModelPart &rModelPart,
1510  MeshingParameters &rMeshingVariables);
1511 
1515  void SetElements(ModelPart &rModelPart,
1516  MeshingParameters &rMeshingVariables);
1517 
1521 
1525 
1529 
1531  virtual std::string Info() const
1532  {
1533  std::stringstream buffer;
1534  buffer << "MesherUtilities";
1535  return buffer.str();
1536  }
1537 
1539  virtual void PrintInfo(std::ostream &rOStream) const
1540  {
1541  rOStream << "MesherUtilities";
1542  }
1543 
1545  virtual void PrintData(std::ostream &rOStream) const
1546  {
1547  rOStream << "MesherUtilities Data";
1548  }
1549 
1553 
1555 
1556  protected:
1559 
1563 
1567 
1571 
1575 
1579 
1583 
1585 
1586  private:
1589 
1593 
1597 
1599  MesherUtilities &operator=(MesherUtilities const &rOther);
1600 
1604 
1608 
1612 
1616 
1618 
1619  }; // Class MesherUtilities
1620 
1622 
1625 
1629 
1631  inline std::istream &operator>>(std::istream &rIStream,
1632  MesherUtilities &rThis);
1633 
1635  inline std::ostream &operator<<(std::ostream &rOStream,
1636  const MesherUtilities &rThis)
1637  {
1638  rThis.PrintInfo(rOStream);
1639  rOStream << std::endl;
1640  rThis.PrintData(rOStream);
1641 
1642  return rOStream;
1643  }
1645 
1647 
1648 } // namespace Kratos.
1649 
1650 #endif // KRATOS_MESHER_UTILITIES_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Base class for all Conditions.
Definition: condition.h:59
Base class for all Elements.
Definition: element.h:60
Definition: flags.h:58
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
void Reset(const Flags ThisFlag)
Definition: flags.h:193
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
PointerVector< TPointType > PointsArrayType
Definition: geometry.h:118
virtual double Area() const
This method calculate and return area or surface area of this geometry depending to it's dimension.
Definition: geometry.h:1345
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
Definition: amatrix_interface.h:41
Short class definition.
Definition: mesher_utilities.hpp:49
KRATOS_DEFINE_LOCAL_FLAG(REFINE_BOUNDARY_ON_THRESHOLD)
ModelPart::MeshType::GeometryType::PointsArrayType PointsArrayType
Definition: mesher_utilities.hpp:66
KRATOS_DEFINE_LOCAL_FLAG(REMOVE_BOUNDARY_NODES)
static unsigned int GetMaxConditionId(ModelPart &rModelPart)
Definition: mesher_utilities.hpp:1461
static double CalculateSideLength(PointType &P1, PointType &P2)
Definition: mesher_utilities.hpp:1073
Node::Pointer PointPointerType
Definition: mesher_utilities.hpp:58
KRATOS_DEFINE_LOCAL_FLAG(FINALIZE_MESHER_INPUT)
KRATOS_DEFINE_LOCAL_FLAG(REFINE_ADD_NODES)
KRATOS_DEFINE_LOCAL_FLAG(REMOVE_BOUNDARY_NODES_ON_DISTANCE)
KRATOS_DEFINE_LOCAL_FLAG(REFINE_ELEMENTS_ON_THRESHOLD)
KRATOS_DEFINE_LOCAL_FLAG(TRANSFER_KRATOS_NEIGHBOURS_TO_MESHER)
Geometry< Node > GeometryType
Definition: mesher_utilities.hpp:59
static double CalculateTetrahedronRadius(Geometry< Node > &rGeometry)
Definition: mesher_utilities.hpp:1111
std::vector< PointPointerType > PointPointerVector
Definition: mesher_utilities.hpp:60
Node PointType
Definition: mesher_utilities.hpp:57
GlobalPointersVector< Condition > ConditionWeakPtrVectorType
Definition: mesher_utilities.hpp:71
KRATOS_DEFINE_LOCAL_FLAG(REFINE_WALL_CORNER)
KRATOS_DEFINE_LOCAL_FLAG(TRANSFER)
static bool CalculatePosition(const double &x0, const double &y0, const double &z0, const double &x1, const double &y1, const double &z1, const double &x2, const double &y2, const double &z2, const double &x3, const double &y3, const double &z3, const double &xc, const double &yc, const double &zc, std::vector< double > &rShapeFunctionsN)
Definition: mesher_utilities.hpp:1304
KRATOS_DEFINE_LOCAL_FLAG(REMOVE_BOUNDARY_NODES_ON_THRESHOLD)
virtual ~MesherUtilities()
Destructor.
Definition: mesher_utilities.hpp:989
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: mesher_utilities.hpp:1539
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: mesher_utilities.hpp:1545
ContactElementType
Definition: mesher_utilities.hpp:74
@ PointToFace
Definition: mesher_utilities.hpp:76
@ EdgeToEdge
Definition: mesher_utilities.hpp:77
@ NonContact
Definition: mesher_utilities.hpp:75
@ PointToPoint
Definition: mesher_utilities.hpp:78
double GetMeanRadius(ModelPart &rModelPart, double &rCriticalRadius)
KRATOS_DEFINE_LOCAL_FLAG(CONSTRAINED)
GlobalPointersVector< Element > ElementWeakPtrVectorType
Definition: mesher_utilities.hpp:70
KRATOS_DEFINE_LOCAL_FLAG(RECONNECT)
static unsigned int GetMaxNodeId(ModelPart &rModelPart)
Definition: mesher_utilities.hpp:1408
KRATOS_DEFINE_LOCAL_FLAG(REFINE_ELEMENTS_ON_DISTANCE)
KRATOS_DEFINE_LOCAL_FLAG(NEIGHBOURS_SEARCH)
ModelPart::PropertiesType PropertiesType
Definition: mesher_utilities.hpp:61
KRATOS_DEFINE_LOCAL_FLAG(INITIALIZE_MESHER_INPUT)
static double CalculateBoundarySize(Geometry< Node > &rGeometry)
Definition: mesher_utilities.hpp:1078
static double CalculateDeterminant(const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const double x2, const double y2, const double z2)
Definition: mesher_utilities.hpp:1250
KRATOS_DEFINE_LOCAL_FLAG(REMOVE_BOUNDARY_NODES_ON_ERROR)
static double CalculateElementRadius(Geometry< Node > &rGeometry, double &rDomainSize)
Definition: mesher_utilities.hpp:1151
MeshDataTransferUtilities::TransferParameters TransferParametersType
Definition: mesher_utilities.hpp:67
KRATOS_DEFINE_LOCAL_FLAG(REFINE_ELEMENTS_ON_ERROR)
KRATOS_DEFINE_LOCAL_FLAG(REFINE_BOUNDARY)
KRATOS_DEFINE_LOCAL_FLAG(REFINE_BOUNDARY_ON_DISTANCE)
MesherUtilities()
Default constructor.
Definition: mesher_utilities.hpp:986
KRATOS_DEFINE_LOCAL_FLAG(REFINE_BOUNDARY_ON_ERROR)
KRATOS_DEFINE_LOCAL_FLAG(REMOVE_NODES)
static bool CalculatePosition(const double &x0, const double &y0, const double &x1, const double &y1, const double &x2, const double &y2, const double &xc, const double &yc, std::vector< double > &rShapeFunctionsN)
Definition: mesher_utilities.hpp:1344
static double CalculateTriangleArea(const double x0, const double y0, const double x1, const double y1, const double x2, const double y2)
Definition: mesher_utilities.hpp:1167
KRATOS_DEFINE_LOCAL_FLAG(TRANSFER_KRATOS_FACES_TO_MESHER)
static double CalculateAverageSideLength(const double x0, const double y0, const double x1, const double y1, const double x2, const double y2)
Definition: mesher_utilities.hpp:1257
KRATOS_DEFINE_LOCAL_FLAG(REMOVE_NODES_ON_ERROR)
ModelPart::NodesContainerType NodesContainerType
Definition: mesher_utilities.hpp:65
static double CalculateTetrahedronVolume(const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const double x2, const double y2, const double z2, const double x3, const double y3, const double z3)
Definition: mesher_utilities.hpp:1194
KRATOS_DEFINE_LOCAL_FLAG(MESH_SMOOTHING)
ModelPart::PropertiesContainerType PropertiesContainerType
Definition: mesher_utilities.hpp:62
KRATOS_DEFINE_LOCAL_FLAG(TRANSFER_KRATOS_NODES_TO_MESHER)
static unsigned int GetMaxElementId(ModelPart &rModelPart)
Definition: mesher_utilities.hpp:1481
static double CalculateElementRadius(Geometry< Node > &rGeometry)
Definition: mesher_utilities.hpp:1142
KRATOS_DEFINE_LOCAL_FLAG(TRANSFER_KRATOS_ELEMENTS_TO_MESHER)
KRATOS_DEFINE_LOCAL_FLAG(REMOVE_NODES_ON_DISTANCE)
static bool CalculatePosition(const std::vector< std::vector< double >> &rPointCoordinates, const std::vector< double > &rCenter, std::vector< double > &rShapeFunctionsN)
Definition: mesher_utilities.hpp:1272
static double CalculateTetrahedronRadius(const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const double x2, const double y2, const double z2, const double x3, const double y3, const double z3, double &Volume)
Definition: mesher_utilities.hpp:1212
static double CalculateTriangleRadius(const double x0, const double y0, const double x1, const double y1, const double x2, const double y2, double &Area)
Definition: mesher_utilities.hpp:1174
KRATOS_DEFINE_LOCAL_FLAG(REMOVE_NODES_ON_THRESHOLD)
KRATOS_CLASS_POINTER_DEFINITION(MesherUtilities)
Pointer definition of MesherUtilities.
KRATOS_DEFINE_LOCAL_FLAG(SELECT_TESSELLATION_ELEMENTS)
KRATOS_DEFINE_LOCAL_FLAG(REFINE_INSERT_NODES)
KRATOS_DEFINE_LOCAL_FLAG(KEEP_ISOLATED_NODES)
KRATOS_DEFINE_LOCAL_FLAG(SET_DOF)
GlobalPointersVector< Node > NodeWeakPtrVectorType
Definition: mesher_utilities.hpp:69
KRATOS_DEFINE_LOCAL_FLAG(REFINE_ELEMENTS)
virtual std::string Info() const
Turn back information as a string.
Definition: mesher_utilities.hpp:1531
KRATOS_DEFINE_LOCAL_FLAG(VARIABLES_SMOOTHING)
KRATOS_DEFINE_LOCAL_FLAG(PASS_ALPHA_SHAPE)
ModelPart::MeshType MeshType
Definition: mesher_utilities.hpp:63
static double CalculateTriangleRadius(Geometry< Node > &rGeometry)
Definition: mesher_utilities.hpp:1096
KRATOS_DEFINE_LOCAL_FLAG(CONTACT_SEARCH)
static double CalculateModelPartVolume(ModelPart &rModelPart)
Definition: mesher_utilities.hpp:1428
KRATOS_DEFINE_LOCAL_FLAG(BOUNDARIES_SEARCH)
ModelPart::ElementsContainerType ElementsContainerType
Definition: mesher_utilities.hpp:64
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
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
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
ConditionIterator ConditionsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1371
This class defines the node.
Definition: node.h:65
Point class.
Definition: point.h:59
double Y() const
Definition: point.h:187
double Z() const
Definition: point.h:193
double X() const
Definition: point.h:181
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Short class definition.
Definition: spatial_bounding_box.hpp:48
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
bool CalculatePosition(Geometry< Node > &geom, const double xc, const double yc, const double zc, array_1d< double, 3 > &N)
Definition: transfer_utility.h:343
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
S
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:39
int tol
Definition: hinsberg_optimization.py:138
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
def Alpha(n, j)
Definition: quadrature.py:93
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
volume
Definition: sp_statistics.py:15
e
Definition: run_cpp_mpi_tests.py:31
Definition: mesh_data_transfer_utilities.hpp:80
Definition: mesher_utilities.hpp:149
int mNumberOfElements
Definition: mesher_utilities.hpp:161
void SetElementNeighbourList(int *&rElementNeighbourList)
Definition: mesher_utilities.hpp:173
int mNumberOfPoints
Definition: mesher_utilities.hpp:160
void CreateElementSizeList(const unsigned int NumberOfElements)
Definition: mesher_utilities.hpp:207
double * mpElementSizeList
Definition: mesher_utilities.hpp:157
int * GetElementNeighbourList()
Definition: mesher_utilities.hpp:180
void SetNumberOfPoints(int &rNumberOfPoints)
Definition: mesher_utilities.hpp:174
int * GetElementList()
Definition: mesher_utilities.hpp:178
void SetNumberOfElements(int &rNumberOfElements)
Definition: mesher_utilities.hpp:175
void CreateElementList(const unsigned int NumberOfElements, const unsigned int NumberOfVertices)
Definition: mesher_utilities.hpp:196
void CreateElementNeighbourList(const unsigned int NumberOfElements, const unsigned int NumberOfFaces)
Definition: mesher_utilities.hpp:217
int & GetNumberOfPoints()
Definition: mesher_utilities.hpp:182
void SetElementList(int *&rElementList)
Definition: mesher_utilities.hpp:171
bool ElementNeighbourListFlag
Definition: mesher_utilities.hpp:168
int * mpElementNeighbourList
Definition: mesher_utilities.hpp:158
void CreatePointList(const unsigned int NumberOfPoints, const unsigned int Dimension)
Definition: mesher_utilities.hpp:185
bool PointListFlag
Definition: mesher_utilities.hpp:165
void Finalize()
Definition: mesher_utilities.hpp:242
double * GetPointList()
Definition: mesher_utilities.hpp:177
int & GetNumberOfElements()
Definition: mesher_utilities.hpp:183
void SetPointList(double *&rPointList)
Definition: mesher_utilities.hpp:170
void SetElementSizeList(double *&rElementSizeList)
Definition: mesher_utilities.hpp:172
double * GetElementSizeList()
Definition: mesher_utilities.hpp:179
bool ElementListFlag
Definition: mesher_utilities.hpp:166
double * mpPointList
Definition: mesher_utilities.hpp:154
void Initialize()
Definition: mesher_utilities.hpp:227
int * mpElementList
Definition: mesher_utilities.hpp:155
bool ElementSizeListFlag
Definition: mesher_utilities.hpp:167
Definition: mesher_utilities.hpp:269
unsigned int NumberOfNewElements
Definition: mesher_utilities.hpp:282
unsigned int InitialNumberOfNodes
Definition: mesher_utilities.hpp:279
int BalancePrincipalSecondaryPartsNodes
Definition: mesher_utilities.hpp:292
int GetInsertedNodes()
Definition: mesher_utilities.hpp:413
unsigned int GetNumberOfNodes()
Definition: mesher_utilities.hpp:341
double GetInitialMeshVolume()
Definition: mesher_utilities.hpp:376
unsigned int InsertedNodes
Definition: mesher_utilities.hpp:290
bool MechanicalSmoothingRequired
Definition: mesher_utilities.hpp:299
unsigned int GetNumberOfConditions()
Definition: mesher_utilities.hpp:351
bool GeometricalSmoothingRequired
Definition: mesher_utilities.hpp:298
unsigned int NumberOfNodes
Definition: mesher_utilities.hpp:276
unsigned int NumberOfElements
Definition: mesher_utilities.hpp:275
unsigned int NumberOfLagrangianInletNodes
Definition: mesher_utilities.hpp:287
double InitialMeshVolume
Definition: mesher_utilities.hpp:301
unsigned int NumberOfNewNodes
Definition: mesher_utilities.hpp:283
void Initialize()
Definition: mesher_utilities.hpp:303
unsigned int GetNumberOfElements()
Definition: mesher_utilities.hpp:346
bool CheckGeometricalSmoothing()
Definition: mesher_utilities.hpp:381
unsigned int CriticalElements
Definition: mesher_utilities.hpp:296
KRATOS_CLASS_POINTER_DEFINITION(MeshingInfoParameters)
unsigned int NumberOfEulerianInletNodes
Definition: mesher_utilities.hpp:286
void SetNumberOfNewElements(unsigned int NumberElements)
Definition: mesher_utilities.hpp:361
void SetNumberOfNewNodes(unsigned int NumberNodes)
Definition: mesher_utilities.hpp:356
bool CheckMechanicalSmoothing()
Definition: mesher_utilities.hpp:402
void SetInitialMeshVolume(double Volume)
Definition: mesher_utilities.hpp:371
unsigned int NumberOfConditions
Definition: mesher_utilities.hpp:277
unsigned int InsertedBoundaryConditions
Definition: mesher_utilities.hpp:294
void SetNumberOfNodes(unsigned int NumberNodes)
Definition: mesher_utilities.hpp:326
void SetNumberOfElements(unsigned int NumberElements)
Definition: mesher_utilities.hpp:331
unsigned int InsertedBoundaryNodes
Definition: mesher_utilities.hpp:293
unsigned int NumberOfNewConditions
Definition: mesher_utilities.hpp:284
unsigned int RemovedNodes
Definition: mesher_utilities.hpp:291
void SetNumberOfNewConditions(unsigned int NumberConditions)
Definition: mesher_utilities.hpp:366
void SetNumberOfConditions(unsigned int NumberConditions)
Definition: mesher_utilities.hpp:336
Definition: mesher_utilities.hpp:631
void Reset(Flags ThisFlag)
Definition: mesher_utilities.hpp:720
MeshingInfoParameters::Pointer Info
Definition: mesher_utilities.hpp:681
void SetTransferVariable(const Variable< double > &rTransferVariable)
Definition: mesher_utilities.hpp:787
Flags Options
Definition: mesher_utilities.hpp:645
void SetTessellationFlags(std::string rFlags)
Definition: mesher_utilities.hpp:740
void SetMeshingBox(SpatialBoundingBox::Pointer pMeshingBox)
Definition: mesher_utilities.hpp:775
void SetRefiningParameters(RefiningParameters::Pointer rRefine)
Definition: mesher_utilities.hpp:765
std::string TessellationInfo
Definition: mesher_utilities.hpp:656
Condition const & GetReferenceCondition()
Definition: mesher_utilities.hpp:847
std::vector< int > PreservedElements
Definition: mesher_utilities.hpp:669
void SetBoundingBoxUpperPoint(double rBoundingBoxUpperPointX, double rBoundingBoxUpperPointY, double rBoundingBoxUpperPointZ)
Definition: mesher_utilities.hpp:904
RefiningParameters::Pointer Refine
Definition: mesher_utilities.hpp:684
bool MeshElementsSelectedFlag
Definition: mesher_utilities.hpp:662
MeshContainer InMesh
Definition: mesher_utilities.hpp:674
void SetInfoParameters(MeshingInfoParameters::Pointer rInfo)
Definition: mesher_utilities.hpp:760
RefiningParameters::Pointer GetRefiningParameters()
Definition: mesher_utilities.hpp:833
std::string GetSubModelPartName()
Definition: mesher_utilities.hpp:813
std::vector< std::vector< int > > NeighbourList
Definition: mesher_utilities.hpp:678
std::vector< unsigned int > RefiningBoxElementsInTransitionZone
Definition: mesher_utilities.hpp:708
std::vector< array_1d< double, 3 > > RefiningBoxShiftedMaximumPoint
Definition: mesher_utilities.hpp:713
std::vector< double > RefiningBoxMeshSize
Definition: mesher_utilities.hpp:707
TransferParametersType::Pointer Transfer
Definition: mesher_utilities.hpp:690
Flags GetOptions()
Definition: mesher_utilities.hpp:818
void SetOptions(const Flags &rOptions)
Definition: mesher_utilities.hpp:725
MeshContainer OutMesh
Definition: mesher_utilities.hpp:675
double BoundingBoxInitialTime
Definition: mesher_utilities.hpp:699
void SetAlphaParameter(const double rAlpha)
Definition: mesher_utilities.hpp:750
void SetRefiningBoxMeshSize(unsigned int index, double rRefiningBoxMeshSize)
Definition: mesher_utilities.hpp:969
void SetRefiningBoxMaximumPoint(unsigned int index, double rRefiningBoxMaximumPointX, double rRefiningBoxMaximumPointY, double rRefiningBoxMaximumPointZ)
Definition: mesher_utilities.hpp:942
double OffsetFactor
Definition: mesher_utilities.hpp:652
MeshingInfoParameters::Pointer GetInfoParameters()
Definition: mesher_utilities.hpp:823
std::vector< double > RefiningBoxFinalTime
Definition: mesher_utilities.hpp:706
bool TransferVariablesSetFlag
Definition: mesher_utilities.hpp:658
bool UseBoundingBox
Definition: mesher_utilities.hpp:698
double BoundingBoxFinalTime
Definition: mesher_utilities.hpp:700
void SetSubModelPartName(std::string const &rSubModelPartName)
Definition: mesher_utilities.hpp:730
std::vector< bool > UseRefiningBox
Definition: mesher_utilities.hpp:704
void FinalizeMeshing()
Definition: mesher_utilities.hpp:885
void SetTessellationInfo(std::string rInfo)
Definition: mesher_utilities.hpp:745
bool InputInitializedFlag
Definition: mesher_utilities.hpp:661
std::string TessellationFlags
Definition: mesher_utilities.hpp:655
void Initialize()
Definition: mesher_utilities.hpp:852
void SetBoundingBoxLowerPoint(double rBoundingBoxLowerPointX, double rBoundingBoxLowerPointY, double rBoundingBoxLowerPointZ)
Definition: mesher_utilities.hpp:897
void SetRefiningBoxElementsInTransitionZone(unsigned int index, unsigned int rRefiningBoxElementsInTransitionZone)
Definition: mesher_utilities.hpp:974
void SetTransferParameters(TransferParametersType::Pointer rTransferVariables)
Definition: mesher_utilities.hpp:781
void InitializeMeshing()
Definition: mesher_utilities.hpp:878
TransferParametersType::Pointer GetTransferParameters()
Definition: mesher_utilities.hpp:828
void SetBoundingBoxTimeInterval(double rBoundingBoxInitialTime, double rBoundingBoxFinalTime)
Definition: mesher_utilities.hpp:911
void SetRefiningBoxMinimumPoint(unsigned int index, double rRefiningBoxMinimumPointX, double rRefiningBoxMinimumPointY, double rRefiningBoxMinimumPointZ)
Definition: mesher_utilities.hpp:935
array_1d< double, 3 > BoundingBoxUpperPoint
Definition: mesher_utilities.hpp:702
array_1d< double, 3 > BoundingBoxLowerPoint
Definition: mesher_utilities.hpp:701
void SetProperties(PropertiesType::Pointer rProperties)
Definition: mesher_utilities.hpp:770
PropertiesType::Pointer GetProperties()
Definition: mesher_utilities.hpp:838
unsigned int ConditionMaxId
Definition: mesher_utilities.hpp:664
KRATOS_CLASS_POINTER_DEFINITION(MeshingParameters)
std::string SubModelPartName
Definition: mesher_utilities.hpp:642
void SetRefiningBoxShiftedMaximumPoint(unsigned int index, double rPointX, double rPointY, double rPointZ)
Definition: mesher_utilities.hpp:956
std::vector< int > NodalPreIds
Definition: mesher_utilities.hpp:668
unsigned int ElementMaxId
Definition: mesher_utilities.hpp:665
void SetHoles(std::vector< BoundedVector< double, 3 >> &rHoles)
Definition: mesher_utilities.hpp:803
void SetUseRefiningBox(unsigned int index, bool rUseRefiningBox)
Definition: mesher_utilities.hpp:930
double AlphaParameter
Definition: mesher_utilities.hpp:651
std::vector< BoundedVector< double, 3 > > & GetHoles()
Definition: mesher_utilities.hpp:808
const Element * mpReferenceElement
Definition: mesher_utilities.hpp:637
Flags ExecutionOptions
Definition: mesher_utilities.hpp:648
void SetExecutionOptions(const Flags &rOptions)
Definition: mesher_utilities.hpp:735
Element const & GetReferenceElement()
Definition: mesher_utilities.hpp:843
std::vector< array_1d< double, 3 > > RefiningBoxMinimumPoint
Definition: mesher_utilities.hpp:709
void SetRefiningBoxTimeInterval(unsigned int index, double rRefiningBoxInitialTime, double rRefiningBoxFinalTime)
Definition: mesher_utilities.hpp:963
std::vector< double > RefiningBoxInitialTime
Definition: mesher_utilities.hpp:705
MeshContainer MidMesh
Definition: mesher_utilities.hpp:676
bool MeshingBoxSetFlag
Definition: mesher_utilities.hpp:695
std::vector< array_1d< double, 3 > > RefiningBoxMaximumPoint
Definition: mesher_utilities.hpp:710
void SetUseBoundingBox(bool rUseBoundingBox)
Definition: mesher_utilities.hpp:892
void InitializeRefiningBoxParameters(unsigned int size)
Definition: mesher_utilities.hpp:917
void SetOffsetFactor(const double rOffsetFactor)
Definition: mesher_utilities.hpp:755
void SetReferenceElement(const Element &rElement)
Definition: mesher_utilities.hpp:793
void Set(Flags ThisFlag)
Definition: mesher_utilities.hpp:715
void SetReferenceCondition(const Condition &rCondition)
Definition: mesher_utilities.hpp:798
unsigned int NodeMaxId
Definition: mesher_utilities.hpp:666
PropertiesType::Pointer Properties
Definition: mesher_utilities.hpp:692
std::vector< BoundedVector< double, 3 > > Holes
Definition: mesher_utilities.hpp:671
SpatialBoundingBox::Pointer MeshingBox
Definition: mesher_utilities.hpp:696
std::vector< array_1d< double, 3 > > RefiningBoxShiftedMinimumPoint
Definition: mesher_utilities.hpp:712
const Condition * mpReferenceCondition
Definition: mesher_utilities.hpp:638
void SetRefiningBoxShiftedMinimumPoint(unsigned int index, double rPointX, double rPointY, double rPointZ)
Definition: mesher_utilities.hpp:949
Definition: mesher_utilities.hpp:420
void Initialize()
Definition: mesher_utilities.hpp:426
unsigned int on_error
Definition: mesher_utilities.hpp:424
void EchoStats()
Definition: mesher_utilities.hpp:433
unsigned int on_distance
Definition: mesher_utilities.hpp:422
unsigned int on_threshold
Definition: mesher_utilities.hpp:423
Definition: mesher_utilities.hpp:440
void Initialize()
Definition: mesher_utilities.hpp:450
unsigned int in_contact
Definition: mesher_utilities.hpp:446
void EchoStats()
Definition: mesher_utilities.hpp:460
unsigned int in_convex_boundary
Definition: mesher_utilities.hpp:448
unsigned int on_threshold
Definition: mesher_utilities.hpp:443
unsigned int in_concave_boundary
Definition: mesher_utilities.hpp:447
unsigned int on_error
Definition: mesher_utilities.hpp:444
unsigned int on_distance
Definition: mesher_utilities.hpp:442
Definition: mesher_utilities.hpp:468
RefineBoundaryInfo BoundaryConditionsRefined
Definition: mesher_utilities.hpp:474
RefineBoundaryInfo BoundaryNodesRemoved
Definition: mesher_utilities.hpp:475
RefineBodyInfo BodyNodesRemoved
Definition: mesher_utilities.hpp:471
RefineBodyInfo BodyElementsRefined
Definition: mesher_utilities.hpp:470
Definition: mesher_utilities.hpp:479
double MeanVolume
Definition: mesher_utilities.hpp:503
void SetRemovingOptions(const Flags &rOptions)
Definition: mesher_utilities.hpp:519
void SetMeanVolume(const double rMeanVolume)
Definition: mesher_utilities.hpp:534
const Variable< double > & GetErrorVariable()
Definition: mesher_utilities.hpp:609
Flags RemovingOptions
Definition: mesher_utilities.hpp:491
SpatialBoundingBox::Pointer RefiningBox
Definition: mesher_utilities.hpp:510
double ReferenceThreshold
Definition: mesher_utilities.hpp:498
void Initialize()
Definition: mesher_utilities.hpp:614
double Alpha
Definition: mesher_utilities.hpp:493
void SetErrorVariable(const Variable< double > &rVariable)
Definition: mesher_utilities.hpp:584
void SetCriticalRadius(const double rCriticalRadius)
Definition: mesher_utilities.hpp:539
void SetAlphaParameter(const double rAlpha)
Definition: mesher_utilities.hpp:524
void SetThresholdVariable(const Variable< double > &rVariable)
Definition: mesher_utilities.hpp:579
Flags GetRemovingOptions()
Definition: mesher_utilities.hpp:594
double GetMeanVolume()
Definition: mesher_utilities.hpp:529
void SetReferenceThreshold(const double rReferenceThreshold)
Definition: mesher_utilities.hpp:569
double CriticalSide
Definition: mesher_utilities.hpp:496
double ReferenceError
Definition: mesher_utilities.hpp:499
Flags RefiningOptions
Definition: mesher_utilities.hpp:490
bool RefiningBoxSetFlag
Definition: mesher_utilities.hpp:509
void SetCriticalSide(const double rCriticalSide)
Definition: mesher_utilities.hpp:551
void SetInitialRadius(const double rInitialRadius)
Definition: mesher_utilities.hpp:544
void SetParameters(const double rAlpha, const double rCriticalRadius, const double rCriticalSide)
Definition: mesher_utilities.hpp:556
const Variable< double > & GetThresholdVariable()
Definition: mesher_utilities.hpp:604
void SetRefiningBox(SpatialBoundingBox::Pointer pRefiningBox)
Definition: mesher_utilities.hpp:563
double InitialRadius
Definition: mesher_utilities.hpp:502
KRATOS_CLASS_POINTER_DEFINITION(RefiningParameters)
double GetReferenceThreshold()
Definition: mesher_utilities.hpp:599
Flags GetRefiningOptions()
Definition: mesher_utilities.hpp:589
void SetReferenceError(const double rReferenceError)
Definition: mesher_utilities.hpp:574
RefiningInfoParameters Info
Definition: mesher_utilities.hpp:506
void SetRefiningOptions(const Flags &rOptions)
Definition: mesher_utilities.hpp:514
double CriticalRadius
Definition: mesher_utilities.hpp:495