13 #if !defined(KRATOS_TRIGEN_PFEM_MODELER_VMS_H_INCLUDED )
14 #define KRATOS_TRIGEN_PFEM_MODELER_VMS_H_INCLUDED
35 void triangulate(
char *,
struct triangulateio *,
struct triangulateio *,
struct triangulateio *);
109 Element const& rReferenceElement,
110 Condition const& rReferenceBoundaryCondition,
112 double my_alpha = 1.4,
double h_factor=0.5)
116 if (ThisModelPart.
NodesBegin()->SolutionStepsDataHas(IS_FREE_SURFACE)==
false )
117 KRATOS_THROW_ERROR(std::logic_error,
"Add ----IS_FREE_SURFACE---- variable!!!!!! ERROR",
"");
118 if (ThisModelPart.
NodesBegin()->SolutionStepsDataHas(IS_STRUCTURE)==
false )
119 KRATOS_THROW_ERROR(std::logic_error,
"Add ----IS_STRUCTURE---- variable!!!!!! ERROR",
"");
120 if (ThisModelPart.
NodesBegin()->SolutionStepsDataHas(IS_BOUNDARY)==
false )
121 KRATOS_THROW_ERROR(std::logic_error,
"Add ----IS_BOUNDARY---- variable!!!!!! ERROR",
"");
122 if (ThisModelPart.
NodesBegin()->SolutionStepsDataHas(IS_FLUID)==
false )
126 const auto inital_time = std::chrono::steady_clock::now();
145 unsigned int bucket_size = 20;
148 unsigned int max_results = 100;
153 Node work_point(0,0.0,0.0,0.0);
159 list_of_nodes.reserve(ThisModelPart.
Nodes().size());
160 for(ModelPart::NodesContainerType::iterator i_node = ThisModelPart.
NodesBegin() ; i_node != ThisModelPart.
NodesEnd() ; i_node++)
162 (list_of_nodes).push_back(*(i_node.base()));
165 KdtreeType nodes_tree1(list_of_nodes.begin(),list_of_nodes.end(), bucket_size);
167 RemoveCloseNodes(ThisModelPart, nodes_tree1, node_erase, h_factor);
175 struct triangulateio in_mid;
176 struct triangulateio out_mid;
177 struct triangulateio vorout_mid;
179 initialize_triangulateio(in_mid);
180 initialize_triangulateio(out_mid);
181 initialize_triangulateio(vorout_mid);
185 in_mid.numberofpoints = ThisModelPart.
Nodes().size();
186 in_mid.pointlist = (
REAL *) malloc(in_mid.numberofpoints * 2 *
sizeof(
REAL));
189 ModelPart::NodesContainerType::iterator nodes_begin = ThisModelPart.
NodesBegin();
190 for(
unsigned int i = 0;
i<ThisModelPart.
Nodes().size();
i++)
196 (nodes_begin +
i)->SetId(
i+1);
199 in_mid.pointlist[base] = (nodes_begin +
i)->
X();
200 in_mid.pointlist[base+1] = (nodes_begin +
i)->
Y();
202 auto& node_dofs = (nodes_begin +
i)->GetDofs();
203 for(
auto iii = node_dofs.begin(); iii != node_dofs.end(); iii++)
205 (**iii).SetEquationId(
i+1);
216 char options1[] =
"Pne";
217 triangulate(options1, &in_mid, &out_mid, &vorout_mid);
221 unsigned int el_number=out_mid.numberoftriangles;
224 std::vector<int> preserved_list1(el_number);
225 preserved_list1.resize(el_number);
227 int number_of_preserved_elems= PassAlphaShape(ThisModelPart, preserved_list1, el_number, my_alpha, out_mid);
231 clean_triangulateio(in_mid);
232 clean_triangulateio(vorout_mid);
236 struct triangulateio in2;
237 struct triangulateio out2;
238 struct triangulateio vorout2;
240 initialize_triangulateio(in2);
241 initialize_triangulateio(out2);
242 initialize_triangulateio(vorout2);
245 in2.numberofpoints = ThisModelPart.
Nodes().size();
246 in2.pointlist = (
REAL *) malloc(in2.numberofpoints * 2 *
sizeof(
REAL));
249 for(
unsigned int i = 0;
i<ThisModelPart.
Nodes().size();
i++)
252 in2.pointlist[base] = (nodes_begin +
i)->
X();
253 in2.pointlist[base+1] = (nodes_begin +
i)->
Y();
255 in2.numberoftriangles=number_of_preserved_elems;
257 in2.trianglelist = (
int *) malloc(in2.numberoftriangles * 3 *
sizeof(
int));
258 in2.trianglearealist = (
REAL *) malloc(in2.numberoftriangles *
sizeof(
REAL));
265 for(ModelPart::NodesContainerType::iterator i_node = ThisModelPart.
NodesBegin() ; i_node != ThisModelPart.
NodesEnd() ; i_node++)
267 if (i_node->FastGetSolutionStepValue(IS_FREE_SURFACE)!=0)
270 double& val=i_node->FastGetSolutionStepValue(NODAL_H);
278 for (
unsigned int el=0;
el<el_number;
el++)
280 if(
static_cast<bool>(preserved_list1[
el]) ==
true )
286 in2.trianglelist[new_base] = out_mid.trianglelist[old_base];
287 in2.trianglelist[new_base+1] = out_mid.trianglelist[old_base+1];
288 in2.trianglelist[new_base+2] = out_mid.trianglelist[old_base+2];
291 double prescribed_h = (nodes_begin + out_mid.trianglelist[old_base]-1)->FastGetSolutionStepValue(NODAL_H);
292 prescribed_h += (nodes_begin + out_mid.trianglelist[old_base+1]-1)->FastGetSolutionStepValue(NODAL_H);
293 prescribed_h += (nodes_begin + out_mid.trianglelist[old_base+2]-1)->FastGetSolutionStepValue(NODAL_H);
294 prescribed_h *= 0.3333;
296 in2.trianglearealist[
counter] = 0.5*(1.5*prescribed_h*1.5*prescribed_h);
302 for(ModelPart::NodesContainerType::iterator i_node = ThisModelPart.
NodesBegin() ; i_node != ThisModelPart.
NodesEnd() ; i_node++)
304 if (i_node->FastGetSolutionStepValue(IS_FREE_SURFACE)!=0)
306 double& nodal_h=i_node->FastGetSolutionStepValue(NODAL_H);
312 clean_triangulateio(out_mid);
321 char mesh_regen_opts[] =
"YJq1.4arn";
322 triangulate(mesh_regen_opts, &in2, &out2, &vorout2);
327 char mesh_regen_opts[] =
"YJrn";
328 triangulate(mesh_regen_opts, &in2, &out2, &vorout2);
336 typedef std::vector<PointType::Pointer>
PointVector;
356 int n_points_before_refinement = in2.numberofpoints;
358 if (out2.numberofpoints > n_points_before_refinement )
360 for(
int i = n_points_before_refinement;
i<out2.numberofpoints;
i++)
364 double&
x= out2.pointlist[base];
365 double&
y= out2.pointlist[base+1];
369 pnode->SetBufferSize(ThisModelPart.
NodesBegin()->GetBufferSize() );
371 list_of_new_nodes.push_back( pnode );
375 for(Node::DofsContainerType::iterator iii = reference_dofs.begin(); iii != reference_dofs.end(); iii++)
380 (p_new_dof)->FreeDof();
388 std::cout <<
"During refinement we added " << out2.numberofpoints-n_points_before_refinement<<
" nodes " <<std::endl;
403 unsigned int MaximumNumberOfResults = list_of_new_nodes.size();
409 if(out2.numberofpoints-n_points_before_refinement > 0)
412 kd_tree nodes_tree2(list_of_new_nodes.begin(),list_of_new_nodes.end(),bucket_size);
415 for(
int el = 0;
el< in2.numberoftriangles;
el++)
419 point_base = (in2.trianglelist[base] - 1)*2;
420 x1[0] = in2.pointlist[point_base];
421 x1[1] = in2.pointlist[point_base+1];
423 point_base = (in2.trianglelist[base+1] - 1)*2;
424 x2[0] = in2.pointlist[point_base];
425 x2[1] = in2.pointlist[point_base+1];
427 point_base = (in2.trianglelist[base+2] - 1)*2;
428 x3[0] = in2.pointlist[point_base];
429 x3[1] = in2.pointlist[point_base+1];
434 CalculateCenterAndSearchRadius(
x1[0],
x1[1],
440 int number_of_points_in_radius;
443 work_point.
Z() = 0.0;
445 number_of_points_in_radius = nodes_tree2.SearchInRadius(work_point,
radius*1.01, Results.begin(),
446 ResultsDistances.begin(), MaximumNumberOfResults);
449 *( (nodes_begin + in2.trianglelist[base]-1).base() ),
450 *( (nodes_begin + in2.trianglelist[base+1]-1).base() ),
451 *( (nodes_begin + in2.trianglelist[base+2]-1).base() )
455 for(
auto it_found = Results.begin(); it_found != Results.begin() + number_of_points_in_radius; it_found++)
457 bool is_inside =
false;
461 (*it_found)->X(),(*it_found)->Y(),
N);
464 if(is_inside ==
true)
476 for(
auto & list_of_new_node : list_of_new_nodes)
478 const array_1d<double,3>& disp = list_of_new_node->FastGetSolutionStepValue(DISPLACEMENT);
479 list_of_new_node->X0() = list_of_new_node->X() - disp[0];
480 list_of_new_node->Y0() = list_of_new_node->Y() - disp[1];
481 list_of_new_node->Z0() = 0.0;
491 (ThisModelPart.
Elements()).reserve(out2.numberoftriangles);
493 for(
int iii = 0; iii< out2.numberoftriangles; iii++)
498 *( (nodes_begin + out2.trianglelist[base]-1).base() ),
499 *( (nodes_begin + out2.trianglelist[base+1]-1).base() ),
500 *( (nodes_begin + out2.trianglelist[base+2]-1).base() )
506 if( *(ModelNodes).find( out2.trianglelist[base]).base() == *(ThisModelPart.
Nodes().end()).base() )
508 if( *(ModelNodes).find( out2.trianglelist[base+1]).base() == *(ThisModelPart.
Nodes().end()).base() )
510 if( *(ModelNodes).find( out2.trianglelist[base+2]).base() == *(ThisModelPart.
Nodes().end()).base() )
515 Element::Pointer p_element = rReferenceElement.
Create(
id, geom, properties);
516 (ThisModelPart.
Elements()).push_back(p_element);
522 ModelPart::ElementsContainerType::const_iterator el_begin = ThisModelPart.
ElementsBegin();
523 for(ModelPart::ElementsContainerType::const_iterator iii = ThisModelPart.
ElementsBegin();
527 int base = ( iii->Id() - 1 )*3;
529 (iii->GetValue(NEIGHBOUR_ELEMENTS)).resize(3);
531 for(
int i = 0;
i<3;
i++)
533 int index = out2.neighborlist[base+
i];
537 neighb(
i) = Element::WeakPointer();
541 IdentifyBoundary(ThisModelPart, rReferenceBoundaryCondition, properties, out2);
545 clean_triangulateio(in2);
547 clean_triangulateio(out2);
549 clean_triangulateio(vorout2);
550 KRATOS_WATCH(
"Finished remeshing with Trigen_PFEM_Refine")
571 std::string
Info()
const override
577 void PrintInfo(std::ostream& rOStream)
const override {}
580 void PrintData(std::ostream& rOStream)
const override {}
635 boost::numeric::ublas::bounded_matrix<double,2,2> mJ;
636 boost::numeric::ublas::bounded_matrix<double,2,2> mJinv;
650 unsigned int max_results = 100;
655 Node work_point(0,0.0,0.0,0.0);
657 unsigned int n_points_in_radius;
661 for(ModelPart::NodesContainerType::const_iterator in = ThisModelPart.
NodesBegin(); in != ThisModelPart.
NodesEnd(); in++)
663 radius=h_factor*in->FastGetSolutionStepValue(NODAL_H);
665 work_point[0]=in->X();
666 work_point[1]=in->Y();
667 work_point[2]=in->Z();
669 n_points_in_radius = nodes_tree1.SearchInRadius(work_point,
radius,
res.begin(),res_distances.begin(), max_results);
670 if (n_points_in_radius>1)
672 if (in->FastGetSolutionStepValue(IS_BOUNDARY)==0.0 && in->FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
675 double erased_nodes = 0;
676 for(
auto i=
res.begin();
i!=
res.begin() + n_points_in_radius ;
i++)
677 erased_nodes += in->Is(TO_ERASE);
679 if( erased_nodes < 1)
680 in->Set(TO_ERASE,
true);
683 else if ( (in)->FastGetSolutionStepValue(IS_STRUCTURE)!=1.0)
689 for(
auto i=
res.begin();
i!=
res.begin() + n_points_in_radius ;
i++)
691 if ( (*i)->FastGetSolutionStepValue(IS_BOUNDARY,1)==1.0 && res_distances[
k] < 0.2*
radius && res_distances[
k] > 0.0 )
699 in->Set(TO_ERASE,
true);
713 int PassAlphaShape(
ModelPart& ThisModelPart,
std::vector<
int>& preserved_list1,
unsigned int & el_number,
double& my_alpha, struct triangulateio& out_mid)
721 array_1d<double,3>
x1,
x2,x3,
xc;
724 int number_of_preserved_elems=0;
727 for(
unsigned int el = 0;
el< el_number;
el++)
732 point_base = (out_mid.trianglelist[base] - 1)*2;
733 x1[0] = out_mid.pointlist[point_base];
734 x1[1] = out_mid.pointlist[point_base+1];
736 point_base = (out_mid.trianglelist[base+1] - 1)*2;
737 x2[0] = out_mid.pointlist[point_base];
738 x2[1] = out_mid.pointlist[point_base+1];
740 point_base = (out_mid.trianglelist[base+2] - 1)*2;
741 x3[0] = out_mid.pointlist[point_base];
742 x3[1] = out_mid.pointlist[point_base+1];
745 Geometry<Node >
temp;
747 temp.push_back( *((ThisModelPart.Nodes()).find( out_mid.trianglelist[base]).base() ) );
748 temp.push_back( *((ThisModelPart.Nodes()).find( out_mid.trianglelist[base+1]).base() ) );
749 temp.push_back( *((ThisModelPart.Nodes()).find( out_mid.trianglelist[base+2]).base() ) );
751 int number_of_structure_nodes =
int(
temp[0].FastGetSolutionStepValue(IS_STRUCTURE) );
752 number_of_structure_nodes +=
int(
temp[1].FastGetSolutionStepValue(IS_STRUCTURE) );
753 number_of_structure_nodes +=
int(
temp[2].FastGetSolutionStepValue(IS_STRUCTURE) );
756 int nfs =
int(
temp[0].FastGetSolutionStepValue(IS_FREE_SURFACE) );
757 nfs +=
int(
temp[1].FastGetSolutionStepValue(IS_FREE_SURFACE) );
758 nfs +=
int(
temp[2].FastGetSolutionStepValue(IS_FREE_SURFACE) );
761 int nfluid =
int(
temp[0].FastGetSolutionStepValue(IS_FLUID) );
762 nfluid +=
int(
temp[1].FastGetSolutionStepValue(IS_FLUID) );
763 nfluid +=
int(
temp[2].FastGetSolutionStepValue(IS_FLUID) );
775 if(number_of_structure_nodes!=3)
777 preserved_list1[
el] =
false;
778 if (nfs != 0 || nfluid != 3 )
781 if( AlphaShape(my_alpha,
temp) && number_of_structure_nodes!=3)
789 preserved_list1[
el] =
true;
790 number_of_preserved_elems += 1;
796 double bigger_alpha = my_alpha*10.0;
797 if( AlphaShape(bigger_alpha,
temp) && number_of_structure_nodes!=3)
805 preserved_list1[
el] =
true;
806 number_of_preserved_elems += 1;
812 if ( preserved_list1[
el] ==
false && number_of_structure_nodes == 1 )
815 int Vertexiter[4] = {0,1,2,0};
816 for (
int iVertex = 0 ; iVertex < 3 ; iVertex++ )
818 if ( (
temp[Vertexiter[iVertex]].FastGetSolutionStepValue(IS_FREE_SURFACE) &&
temp[Vertexiter[iVertex + 1]].FastGetSolutionStepValue(IS_FREE_SURFACE) )
819 || (
temp[Vertexiter[iVertex]].FastGetSolutionStepValue(IS_FREE_SURFACE) &&
temp[Vertexiter[iVertex + 1]].FastGetSolutionStepValue(IS_STRUCTURE) )
820 || (
temp[Vertexiter[iVertex]].FastGetSolutionStepValue(IS_STRUCTURE) &&
temp[Vertexiter[iVertex + 1]].FastGetSolutionStepValue(IS_FREE_SURFACE) )
828 double bigger_alpha = my_alpha*1.23;
829 if( AlphaShape(bigger_alpha,
temp) && number_of_structure_nodes!=3)
837 preserved_list1[
el] =
true;
838 number_of_preserved_elems += 1;
848 preserved_list1[
el] =
false;
851 return number_of_preserved_elems;
858 void IdentifyBoundary(
ModelPart& ThisModelPart, Condition
const& rReferenceBoundaryCondition, Properties::Pointer& properties,
struct triangulateio& out2)
862 for(ModelPart::NodesContainerType::const_iterator in = ThisModelPart.NodesBegin(); in!=ThisModelPart.NodesEnd(); in++)
864 in->FastGetSolutionStepValue(IS_BOUNDARY) = 0;
867 ModelPart::ElementsContainerType::iterator elements_end = ThisModelPart.Elements().end();
869 ThisModelPart.Elements().Unique();
872 for(ModelPart::ElementsContainerType::iterator iii = ThisModelPart.ElementsBegin(); iii != ThisModelPart.ElementsEnd(); iii++)
874 int base = ( iii->Id() - 1 )*3;
876 ModelPart::ElementsContainerType::iterator el_neighb;
887 el_neighb = (ThisModelPart.Elements()).find( out2.neighborlist[base] );
888 if( el_neighb == elements_end )
892 iii->GetGeometry()[1].FastGetSolutionStepValue(IS_BOUNDARY) = 1;
893 iii->GetGeometry()[2].FastGetSolutionStepValue(IS_BOUNDARY) = 1;
898 temp1.push_back(iii->GetGeometry()(1));
899 temp1.push_back(iii->GetGeometry()(2));
901 Geometry< Node >::Pointer cond = Geometry< Node >::Pointer(
new Geometry< Node >(temp1) );
902 int id = (iii->Id()-1)*3;
903 Condition::Pointer p_cond = rReferenceBoundaryCondition.Create(
id, temp1, properties);
904 ThisModelPart.Conditions().push_back(p_cond);
910 el_neighb = (ThisModelPart.Elements()).find( out2.neighborlist[base+1] );
912 if( el_neighb == elements_end )
915 iii->GetGeometry()[2].FastGetSolutionStepValue(IS_BOUNDARY) = 1;
916 iii->GetGeometry()[0].FastGetSolutionStepValue(IS_BOUNDARY) = 1;
921 temp1.push_back(iii->GetGeometry()(2));
922 temp1.push_back(iii->GetGeometry()(0));
924 Geometry< Node >::Pointer cond = Geometry< Node >::Pointer(
new Geometry< Node >(temp1) );
925 int id = (iii->Id()-1)*3+1;
926 Condition::Pointer p_cond = rReferenceBoundaryCondition.Create(
id, temp1, properties);
927 ThisModelPart.Conditions().push_back(p_cond);
934 el_neighb = (ThisModelPart.Elements()).find( out2.neighborlist[base+2] );
935 if( el_neighb == elements_end )
938 iii->GetGeometry()[0].FastGetSolutionStepValue(IS_BOUNDARY) = 1;
939 iii->GetGeometry()[1].FastGetSolutionStepValue(IS_BOUNDARY) = 1;
944 temp1.push_back(iii->GetGeometry()(0));
945 temp1.push_back(iii->GetGeometry()(1));
947 Geometry< Node >::Pointer cond = Geometry< Node >::Pointer(
new Geometry< Node >(temp1) );
948 int id = (iii->Id()-1)*3+2;
949 Condition::Pointer p_cond = rReferenceBoundaryCondition.Create(
id, temp1, properties);
950 ThisModelPart.Conditions().push_back(p_cond);
960 bool AlphaShape(
double alpha_param, Geometry<Node >& pgeom)
966 double x0 = pgeom[0].X();
967 double x1 = pgeom[1].X();
968 double x2 = pgeom[2].X();
970 double y0 = pgeom[0].Y();
971 double y1 = pgeom[1].Y();
972 double y2 = pgeom[2].Y();
980 double detJ = mJ(0,0)*mJ(1,1)-mJ(0,1)*mJ(1,0);
982 mJinv(0,0) = mJ(1,1);
983 mJinv(0,1) = -mJ(0,1);
984 mJinv(1,0) = -mJ(1,0);
985 mJinv(1,1) = mJ(0,0);
987 bounded_matrix<double,2,2> check;
991 h = pgeom[0].FastGetSolutionStepValue(NODAL_H);
992 h += pgeom[1].FastGetSolutionStepValue(NODAL_H);
993 h += pgeom[2].FastGetSolutionStepValue(NODAL_H);
1001 pgeom[0].GetSolutionStepValue(IS_BOUNDARY) = 1;
1002 pgeom[1].GetSolutionStepValue(IS_BOUNDARY) = 1;
1003 pgeom[2].GetSolutionStepValue(IS_BOUNDARY) = 1;
1010 double x0_2 = x0*x0 + y0*y0;
1011 double x1_2 =
x1*
x1 + y1*y1;
1012 double x2_2 =
x2*
x2 + y2*y2;
1018 mRhs[0] = (x1_2 - x0_2);
1019 mRhs[1] = (x2_2 - x0_2);
1024 double radius = sqrt(pow(mC[0]-x0,2)+pow(mC[1]-y0,2));
1041 inline void CalculateCenterAndSearchRadius(
const double x0,
const double y0,
1042 const double x1,
const double y1,
1043 const double x2,
const double y2,
1044 double&
xc,
double&
yc,
double&
R
1047 xc = 0.3333333333333333333*(x0+
x1+
x2);
1048 yc = 0.3333333333333333333*(y0+y1+y2);
1050 double R1 = (
xc-x0)*(
xc-x0) + (
yc-y0)*(
yc-y0);
1061 inline double CalculateVol(
const double x0,
const double y0,
1062 const double x1,
const double y1,
1063 const double x2,
const double y2
1066 return 0.5*( (
x1-x0)*(y2-y0)- (y1-y0)*(
x2-x0) );
1070 const double x1,
const double y1,
1071 const double x2,
const double y2,
1072 const double xc,
const double yc,
1073 array_1d<double,3>&
N
1078 if(area < 0.000000000001)
1093 double upper_limit = 1.0+
tol;
1094 double lower_limit = -
tol;
1096 if(
N[0] >= lower_limit &&
N[1] >= lower_limit &&
N[2] >= lower_limit &&
N[0] <= upper_limit &&
N[1] <= upper_limit &&
N[2] <= upper_limit)
1103 void Interpolate( Triangle2D3<Node >& geom,
const array_1d<double,3>&
N,
1104 unsigned int step_data_size,
1105 Node::Pointer pnode)
1107 unsigned int buffer_size = pnode->GetBufferSize();
1115 double* step_data = (pnode)->SolutionStepData().Data(
step);
1118 double* node0_data = geom[0].SolutionStepData().Data(
step);
1119 double* node1_data = geom[1].SolutionStepData().Data(
step);
1120 double* node2_data = geom[2].SolutionStepData().Data(
step);
1123 for(
unsigned int j= 0;
j<step_data_size;
j++)
1126 step_data[
j] =
N[0]*node0_data[
j] +
N[1]*node1_data[
j] +
N[2]*node2_data[
j];
1131 if (
N[0]==0.0 &&
N[1]==0.0 &&
N[2]==0.0)
1132 KRATOS_THROW_ERROR(std::logic_error,
"SOMETHING's wrong with the added nodes!!!!!! ERROR",
"");
1143 pnode->FastGetSolutionStepValue(IS_BOUNDARY)=0.0;
1144 pnode->FastGetSolutionStepValue(IS_STRUCTURE)=0.0;
1145 pnode->FastGetSolutionStepValue(IS_INTERFACE)=0.0;
1146 pnode->Set(TO_ERASE,
false);
1147 pnode->FastGetSolutionStepValue(IS_FREE_SURFACE)=0.0;
1148 pnode->FastGetSolutionStepValue(IS_FLUID)=1.0;
1151 void initialize_triangulateio( triangulateio& tr )
1153 tr.pointlist = (
REAL*)
nullptr;
1154 tr.pointattributelist = (
REAL*)
nullptr;
1155 tr.pointmarkerlist = (
int*)
nullptr;
1156 tr.numberofpoints = 0;
1157 tr.numberofpointattributes = 0;
1158 tr.trianglelist = (
int*)
nullptr;
1159 tr.triangleattributelist = (
REAL*)
nullptr;
1160 tr.trianglearealist = (
REAL*)
nullptr;
1161 tr.neighborlist = (
int*)
nullptr;
1162 tr.numberoftriangles = 0;
1163 tr.numberofcorners = 3;
1164 tr.numberoftriangleattributes = 0;
1165 tr.segmentlist = (
int*)
nullptr;
1166 tr.segmentmarkerlist = (
int*)
nullptr;
1167 tr.numberofsegments = 0;
1168 tr.holelist = (
REAL*)
nullptr;
1169 tr.numberofholes = 0;
1170 tr.regionlist = (
REAL*)
nullptr;
1171 tr.numberofregions = 0;
1172 tr.edgelist = (
int*)
nullptr;
1173 tr.edgemarkerlist = (
int*)
nullptr;
1174 tr.normlist = (
REAL*)
nullptr;
1175 tr.numberofedges = 0;
1178 void clean_triangulateio( triangulateio& tr )
1180 if(tr.pointlist !=
nullptr) free(tr.pointlist );
1181 if(tr.pointattributelist !=
nullptr) free(tr.pointattributelist );
1182 if(tr.pointmarkerlist !=
nullptr) free(tr.pointmarkerlist );
1183 if(tr.trianglelist !=
nullptr) free(tr.trianglelist );
1184 if(tr.triangleattributelist !=
nullptr) free(tr.triangleattributelist );
1185 if(tr.trianglearealist !=
nullptr) free(tr.trianglearealist );
1186 if(tr.neighborlist !=
nullptr) free(tr.neighborlist );
1187 if(tr.segmentlist !=
nullptr) free(tr.segmentlist );
1188 if(tr.segmentmarkerlist !=
nullptr) free(tr.segmentmarkerlist );
1189 if(tr.holelist !=
nullptr) free(tr.holelist );
1190 if(tr.regionlist !=
nullptr) free(tr.regionlist );
1191 if(tr.edgelist !=
nullptr) free(tr.edgelist );
1192 if(tr.edgemarkerlist !=
nullptr) free(tr.edgemarkerlist );
1193 if(tr.normlist !=
nullptr) free(tr.normlist );
1242 rOStream << std::endl;
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Short class definition.
Definition: bucket.h:57
Base class for all Conditions.
Definition: condition.h:59
Geometry< NodeType >::PointsArrayType NodesArrayType
definition of nodes container type, redefined from GeometryType
Definition: condition.h:86
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
Base class for all Elements.
Definition: element.h:60
virtual Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const
It creates a new element pointer.
Definition: element.h:202
This process removes the entities from a model part with the flag TO_ERASE.
Definition: entity_erase_process.h:70
void Execute() override
Execute method is used to execute the Process algorithms.
This class is a wrapper for a pointer to a data that is located in a different rank.
Definition: global_pointer.h:44
Definition: amatrix_interface.h:497
Definition: amatrix_interface.h:530
PropertiesType::Pointer pGetProperties(IndexType PropertiesId)
Definition: mesh.h:394
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
NodeType::Pointer CreateNewNode(int Id, double x, double y, double z, VariablesList::Pointer pNewVariablesList, IndexType ThisIndex=0)
Definition: model_part.cpp:270
SizeType GetNodalSolutionStepDataSize()
Definition: model_part.h:571
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
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
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
std::vector< std::unique_ptr< Dof< double > >> DofsContainerType
The DoF container type definition.
Definition: node.h:92
double Y() const
Definition: point.h:187
double Z() const
Definition: point.h:193
double X() const
Definition: point.h:181
void reserve(size_type dim)
Definition: pointer_vector.h:319
static double ElapsedSeconds(const std::chrono::steady_clock::time_point StartTime)
This method returns the resulting time.
Definition: timer.h:179
A generic tree data structure for spatial partitioning.
Definition: tree.h:190
Short class definition.
Definition: trigen_pfem_refine.h:64
std::vector< double > DistanceVector
Definition: trigen_pfem_refine.h:75
std::vector< PointType::Pointer > PointVector
Definition: trigen_pfem_refine.h:73
Short class definition.
Definition: trigen_pfem_refine_vms.h:63
~TriGenPFEMModelerVMS() override=default
Destructor.
std::vector< double > DistanceVector
Definition: trigen_pfem_refine_vms.h:74
PointVector::iterator PointIterator
Definition: trigen_pfem_refine_vms.h:73
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: trigen_pfem_refine_vms.h:577
std::string Info() const override
Turn back information as a string.
Definition: trigen_pfem_refine_vms.h:571
KRATOS_CLASS_POINTER_DEFINITION(TriGenPFEMModelerVMS)
Pointer definition of TriGenModeler.
void ReGenerateMesh(ModelPart &ThisModelPart, Element const &rReferenceElement, Condition const &rReferenceBoundaryCondition, EntitiesEraseProcess< Node > &node_erase, bool rem_nodes=true, bool add_nodes=true, double my_alpha=1.4, double h_factor=0.5)
Definition: trigen_pfem_refine_vms.h:107
Node::Pointer PointPointerType
Definition: trigen_pfem_refine_vms.h:71
std::vector< double >::iterator DistanceIterator
Definition: trigen_pfem_refine_vms.h:75
TriGenPFEMModelerVMS()
Default constructor.
Definition: trigen_pfem_refine_vms.h:84
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: trigen_pfem_refine_vms.h:580
Tree< KDTreePartition< BucketType > > KdtreeType
Definition: trigen_pfem_refine_vms.h:77
std::vector< PointType::Pointer > PointVector
Definition: trigen_pfem_refine_vms.h:72
Bucket< 3, PointType, PointVector, PointPointerType, PointIterator, DistanceIterator > BucketType
Definition: trigen_pfem_refine_vms.h:76
Node PointType
Definition: trigen_pfem_refine_vms.h:70
A three node 2D triangle geometry with linear shape functions.
Definition: triangle_2d_3.h:74
#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 REAL
Definition: delaunator_utilities.cpp:16
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
z
Definition: GenerateWind.py:163
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
double CalculateVol(const double x0, const double y0, const double x1, const double y1, const double x2, const double y2)
Definition: transfer_utility.h:424
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::vector< PointTypePointer > PointVector
Definition: internal_variables_interpolation_process.h:53
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
void triangulate(char *, struct triangulateio *, struct triangulateio *, struct triangulateio *)
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
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
y
Other simbols definition.
Definition: generate_axisymmetric_navier_stokes_element.py:54
res
Definition: generate_convection_diffusion_explicit_element.py:211
h
Definition: generate_droplet_dynamics.py:91
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
int tol
Definition: hinsberg_optimization.py:138
R
Definition: isotropic_damage_automatic_differentiation.py:172
float radius
Definition: mesh_to_mdpa_converter.py:18
def Interpolate(variable, entity, sf_values, historical_value)
Definition: point_output_process.py:231
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
el
Definition: read_stl.py:25
float temp
Definition: rotating_cone.py:85
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
int counter
Definition: script_THERMAL_CORRECT.py:218
add_nodes
Definition: script.py:96
N
Definition: sensitivityMatrix.py:29
x
Definition: sensitivityMatrix.py:49
namespace
Definition: array_1d.h:793
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31