10 #if !defined(KRATOS_LAPLACIAN_SMOOTHING_H_INCLUDED)
11 #define KRATOS_LAPLACIAN_SMOOTHING_H_INCLUDED
31 #if !defined(KRATOS_TETGEN_EXTERNAL_H_INCLUDED)
32 #define KRATOS_TETGEN_EXTERNAL_H_INCLUDED
94 mPreviousMeshes.
push_back(Kratos::make_shared<MeshType>((rModelPart.
GetMesh(
i)).Clone()));
116 std::vector<int> & PreservedElements,
117 const int* pElementsList,
118 const int& NumberOfPoints)
125 ModelPart::ElementsContainerType::iterator element_begin = rModelPart.
ElementsBegin();
127 const unsigned int nds = element_begin->GetGeometry().size();
132 std::vector<int> EmptyVector(0);
133 std::vector<std::vector<int> > NeigbourNodesList(rNodes.size());
134 std::fill( NeigbourNodesList.begin(), NeigbourNodesList.end(), EmptyVector );
136 this->GetNeigbourNodes(NeigbourNodesList, PreservedElements, pElementsList, NumberOfPoints, nds);
143 double convergence_tol = 0.001;
144 double smoothing_factor = 0.1;
145 double smoothing_iters = 3;
150 bool converged =
false;
151 double MaxLength = 0;
152 double NewMaxLength = 0;
154 bool contact_active =
false;
155 double boundary_weight = 0.9;
156 double contact_weight = 0.8;
158 unsigned int number_of_nodes = 0;
160 ModelPart::NodesContainerType::iterator nodes_begin = rModelPart.
NodesBegin();
162 while ( iters<smoothing_iters && converged==
false ){
171 double TotalWeight = 0;
178 MaxLength = NewMaxLength;
183 for(
unsigned int in = 0; in<rNodes.size(); in++)
186 unsigned int NumberOfNeighbours = NeigbourNodesList[in+1].
size();
188 if(rNodes[in+1].IsNot(BOUNDARY) && rNodes[in+1].IsNot(RIGID) && rNodes[in+1].IsNot(TO_ERASE) && NumberOfNeighbours>1)
191 TotalDistance.
clear();
196 P[0] = (nodes_begin+in)->
X();
197 P[1] = (nodes_begin+in)->
Y();
198 P[2] = (nodes_begin+in)->
Z();
203 for(
unsigned int i = 0;
i < NumberOfNeighbours; ++
i)
206 Q[0] = (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->X();
207 Q[1] = (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->Y();
208 Q[2] = (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->Z();
212 Length =sqrt(D[0]*D[0]+D[1]*D[1]+D[2]*D[2]);
223 Weight = ( 1.0/Length );
228 if( (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->Is(BOUNDARY) ){
230 contact_active =
false;
231 if( (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->SolutionStepsDataHas(CONTACT_FORCE) ){
232 array_1d<double, 3 > & ContactForce = (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->FastGetSolutionStepValue(CONTACT_FORCE);
233 if(
norm_2(ContactForce) !=0 )
234 contact_active =
true;
238 Weight *= contact_weight;
240 Weight *= boundary_weight;
244 if(NewMaxLength<Length)
245 NewMaxLength = Length;
247 TotalDistance += (Weight*(
Q-P)) ;
248 TotalWeight += Weight ;
254 D = ( smoothing_factor / TotalWeight ) * TotalDistance;
261 (nodes_begin+in)->
X() = P[0];
262 (nodes_begin+in)->
Y() = P[1];
263 (nodes_begin+in)->
Z() = P[2];
271 if( (NewMaxLength-MaxLength)/NewMaxLength < convergence_tol ){
274 std::cout<<
" Laplacian smoothing convergence achieved "<<std::endl;
282 if(iters==smoothing_iters && !converged){
284 std::cout<<
" WARNING: Laplacian smoothing convergence NOT achieved (iters:"<<iters<<
")"<<std::endl;
319 std::vector<Node::Pointer> list_of_nodes;
321 for(NodesContainerType::iterator i_node = rModelPart.
NodesBegin() ; i_node != rModelPart.
NodesEnd() ; i_node++)
327 if( i_node->IsNot(TO_ERASE) ){
328 (list_of_nodes).push_back(*(i_node.base()));
338 typedef Node::Pointer PointPointerType;
348 unsigned int bucket_size = 20;
349 KdtreeType NodesTree(list_of_nodes.begin(),list_of_nodes.end(),bucket_size);
352 unsigned int number_of_nodes = list_of_nodes.size()+1;
354 ModelPart::ElementsContainerType::iterator element_begin = rModelPart.
ElementsBegin();
355 const unsigned int nds = element_begin->GetGeometry().size();
357 std::vector<double> ShapeFunctionsN(nds);
360 if( number_of_nodes < rModelPart.
Nodes().size()+1 ){
361 number_of_nodes = rModelPart.
Nodes().size()+1;
362 std::cout<<
" WARNING: ISOLATED NODES DELETED "<<std::endl;
366 std::vector<VariablesListDataValueContainer> VariablesListVector(number_of_nodes);
367 std::vector<int> UniquePosition (number_of_nodes);
368 std::fill( UniquePosition.begin(), UniquePosition.end(), 0 );
375 Node center(0,0.0,0.0,0.0);
377 unsigned int MaximumNumberOfPointsInRadius = list_of_nodes.size();
378 std::vector<Node::Pointer> PointsInRadius (MaximumNumberOfPointsInRadius);
379 std::vector<double> PointsInRadiusDistances (MaximumNumberOfPointsInRadius);
382 std::vector<std::vector<double> > ElementPointCoordinates(nds);
383 std::vector<double> PointCoordinates(3);
384 std::fill( PointCoordinates.begin(), PointCoordinates.end(), 0.0 );
385 std::fill( ElementPointCoordinates.begin(), ElementPointCoordinates.end(), PointCoordinates );
388 for(ModelPart::ElementsContainerType::const_iterator ie = rModelPart.
ElementsBegin();
392 for(
unsigned int i=0;
i<nds; ++
i)
395 const array_1d<double,3>& Displacement = ie->GetGeometry()[
i].FastGetSolutionStepValue(DISPLACEMENT);
396 PointCoordinates[0] = ie->GetGeometry()[
i].X0() + Displacement[0];
397 PointCoordinates[1] = ie->GetGeometry()[
i].Y0() + Displacement[1];
398 PointCoordinates[2] = ie->GetGeometry()[
i].Z0() + Displacement[2];
400 ElementPointCoordinates[
i] = PointCoordinates;
403 std::fill( PointCoordinates.begin(), PointCoordinates.end(), 0.0 );
408 center.
X() = PointCoordinates[0];
409 center.
Y() = PointCoordinates[1];
410 center.
Z() = PointCoordinates[2];
412 double Radius =
radius * 1.15;
413 int NumberOfPointsInRadius = NodesTree.SearchInRadius (center, Radius, PointsInRadius.
begin(), PointsInRadiusDistances.begin(), MaximumNumberOfPointsInRadius);
418 for(std::vector<Node::Pointer>::iterator it_found = PointsInRadius.begin(); it_found != (PointsInRadius.begin() + NumberOfPointsInRadius) ; ++it_found)
421 if((*it_found)->IsNot(TO_ERASE)){
425 PointCoordinates[0] = (*it_found)->X();
426 PointCoordinates[1] = (*it_found)->Y();
427 PointCoordinates[2] = (*it_found)->Z();
431 if(is_inside ==
true)
435 if(UniquePosition [(*it_found)->Id()] == 0){
437 UniquePosition [(*it_found)->Id()] = 1;
442 VariablesListVector[(*it_found)->Id()] = DataTransferUtilities.
InterpolateVariables( ie->GetGeometry(), ShapeFunctionsN, rVariablesList, (*it_found),
alpha );
446 UniquePosition [(*it_found)->Id()] += 1;
460 rModelPart.
Nodes().Sort();
467 for(NodesContainerType::iterator i_node = rModelPart.
NodesBegin() ; i_node != rModelPart.
NodesEnd() ; ++i_node)
470 if( UniquePosition[i_node->Id()] && i_node->IsNot(TO_ERASE) ){
472 if ( i_node->SolutionStepsDataHas(DISPLACEMENT) ==
false)
474 std::cout <<
" WEIRD " << std::endl;
475 std::cout <<
" Laplacian. ThisNode Does not have displacemenet " << i_node->Id() << std::endl;
476 std::cout <<
" X: " << i_node->X() <<
" Y: " << i_node->Y() <<
" Z: " << i_node->Z() << std::endl;
479 if( i_node->IsNot(BOUNDARY) ){
484 i_node->SolutionStepData() = VariablesListVector[id];
488 i_node->X0() = i_node->X() - disp[0];
489 i_node->Y0() = i_node->Y() - disp[1];
490 i_node->Z0() = i_node->Z() - disp[2];
493 else if ( i_node->Is(BOUNDARY) && i_node->Is(INSIDE) ){
495 i_node->Set(INSIDE,
false);
500 i_node->SolutionStepData() = VariablesListVector[id];
504 bool MoveFixedNodes =
false;
507 i_node->X0() = i_node->X() - disp[0];
508 i_node->Y0() = i_node->Y() - disp[1];
509 i_node->Z0() = i_node->Z() - disp[2];
512 if ( i_node->pGetDof(DISPLACEMENT_X)->IsFixed() ==
false) {
513 i_node->X0() = i_node->X() - disp[0];
515 if ( i_node->pGetDof(DISPLACEMENT_Y)->IsFixed() ==
false) {
516 i_node->Y0() = i_node->Y() - disp[1];
519 if ( i_node->pGetDof(DISPLACEMENT_Z)->IsFixed() ==
false) {
520 i_node->Z0() = i_node->Z() - disp[2];
531 if ( i_node->SolutionStepsDataHas(DISPLACEMENT) ==
false)
533 std::cout <<
" WEIRD " << std::endl;
534 std::cout <<
" Laplacian. ThisNode Does not have displacemenet " << i_node->Id() << std::endl;
535 std::cout <<
" X: " << i_node->X() <<
" Y: " << i_node->Y() <<
" Z: " << i_node->Z() << std::endl;
543 i_node->X0() = i_node->X() - disp[0];
544 i_node->Y0() = i_node->Y() - disp[1];
545 i_node->Z0() = i_node->Z() - disp[2];
548 std::cout <<
" OUT::PSEUDOERROR: IN this line, there is a node that does not have displacement" << std::endl;
549 std::cout <<
" Laplacian. ThisNode new information does not have displacement " << i_node->Id() << std::endl;
550 std::cout <<
" THIS IS BECAUSE THE NODE is out of the DOMAIN and the interpolation is wrong" << std::endl;
551 std::cout <<
" X: " << i_node->X() <<
" Y: " << i_node->Y() <<
" Z: " << i_node->Z() << std::endl;
563 for(NodesContainerType::iterator i_node = rModelPart.
NodesBegin() ; i_node != rModelPart.
NodesEnd() ; ++i_node)
569 i_node->X0() = i_node->X() - disp[0];
570 i_node->Y0() = i_node->Y() - disp[1];
571 i_node->Z0() = i_node->Z() - disp[2];
575 if ( i_node->Is(BOUNDARY) && i_node->IsNot(TO_ERASE) && i_node->Is(INSIDE) )
577 i_node->Set(INSIDE,
false);
594 std::vector<int> & PreservedElements,
595 const int* pElementsList,
596 const int& NumberOfPoints)
602 ModelPart::ElementsContainerType::iterator element_begin = rModelPart.
ElementsBegin();
604 const unsigned int nds = element_begin->GetGeometry().size();
610 std::vector<int> EmptyVector(0);
611 std::vector<std::vector<int> > NeigbourNodesList(rNodes.size());
612 std::fill( NeigbourNodesList.begin(), NeigbourNodesList.end(), EmptyVector );
614 this->GetBoundaryNeigbourNodes(rNodes, NeigbourNodesList, PreservedElements, pElementsList, NumberOfPoints, nds);
619 double convergence_tol =0.001;
620 double smoothing_factor=0.1;
621 double smoothing_iters =4;
625 bool converged =
false;
628 double NewMaxLength=0;
630 unsigned int number_of_nodes = 0;
632 ModelPart::NodesContainerType::iterator nodes_begin = rModelPart.
NodesBegin();
634 while ( iters<smoothing_iters && converged==
false ){
643 double TotalWeight = 0;
650 MaxLength = NewMaxLength;
653 for(
unsigned int in = 0; in<rNodes.size(); ++in)
655 unsigned int NumberOfNeighbours = NeigbourNodesList[in+1].
size();
657 if(rNodes[in+1].Is(BOUNDARY) && rNodes[in+1].IsNot(TO_ERASE) && rNodes[in+1].IsNot(BOUNDARY) &&
658 rNodes[in+1].Is(INSIDE) && NumberOfNeighbours>1 )
660 TotalDistance.
clear();
665 P[0] = (nodes_begin+in)->
X();
666 P[1] = (nodes_begin+in)->
Y();
667 P[2] = (nodes_begin+in)->
Z();
673 for(
unsigned int i = 0;
i < NumberOfNeighbours; ++
i)
676 Q[0] = (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->X();
677 Q[1] = (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->Y();
678 Q[2] = (nodes_begin+(NeigbourNodesList[in+1][
i]-1))->Z();
683 Length =sqrt(D[0]*D[0]+D[1]*D[1]+D[2]*D[2]);
694 Weight = ( 1.0/Length );
699 if(NewMaxLength<Length)
700 NewMaxLength = Length;
702 TotalDistance += (Weight*(
Q-P)) ;
703 TotalWeight += Weight ;
709 D = ( smoothing_factor / TotalWeight ) * TotalDistance;
717 (nodes_begin+in)->
X() = P[0];
718 (nodes_begin+in)->
Y() = P[1];
719 (nodes_begin+in)->
Z() = P[2];
730 if( (NewMaxLength-MaxLength)/NewMaxLength < convergence_tol ){
733 std::cout<<
" Laplacian smoothing convergence achieved "<<std::endl;
741 if(iters==smoothing_iters && !converged){
743 std::cout<<
" WARNING: Boundary Laplacian smoothing convergence NOT achieved (iters:"<<iters<<
")"<<std::endl;
780 virtual std::string
Info()
const
878 void GetNeigbourNodes (std::vector<std::vector<int> >& list_of_neighbor_nodes, std::vector<int> & PreservedElements,
const int* ElementList,
const int& NumberOfPoints,
const unsigned int& nds)
883 if( (
int)list_of_neighbor_nodes.size() != NumberOfPoints+1 ){
884 list_of_neighbor_nodes.resize(NumberOfPoints+1);
886 std::vector<int> empty_vector(0);
887 std::fill( list_of_neighbor_nodes.begin(), list_of_neighbor_nodes.end(), empty_vector );
889 bool neighb_set =
false;
892 for(
unsigned int el = 0;
el<PreservedElements.size(); ++
el)
894 if(PreservedElements[
el])
897 for(
unsigned int ipn=0; ipn<nds; ++ipn)
900 for(
unsigned int jpn=0; jpn<nds; ++jpn)
904 neighb_size = list_of_neighbor_nodes[ElementList[
el*nds+ipn]].size();
906 for(
int npn=0; npn<neighb_size; ++npn)
908 if( list_of_neighbor_nodes[ElementList[
el*nds+ipn]][npn]==(ElementList[
el*nds+jpn]) ){
912 if(neighb_set==
false){
913 list_of_neighbor_nodes[ElementList[
el*nds+ipn]].push_back(ElementList[
el*nds+jpn]);
929 void GetBoundaryNeigbourNodes (
NodesContainerType& rNodes, std::vector<std::vector<int> >& list_of_neighbor_nodes, std::vector<int> & PreservedElements,
const int* ElementList,
const int& NumberOfPoints,
const unsigned int& nds)
934 if( (
int)list_of_neighbor_nodes.size() != NumberOfPoints+1 ){
935 list_of_neighbor_nodes.resize(NumberOfPoints+1);
936 std::vector<int> empty_vector(0);
937 std::fill( list_of_neighbor_nodes.begin(), list_of_neighbor_nodes.end(), empty_vector );
940 bool neighb_set =
false;
943 for(
unsigned int el = 0;
el<PreservedElements.size(); ++
el)
945 if(PreservedElements[
el])
948 for(
unsigned int ipn=0; ipn<nds; ++ipn)
950 if(rNodes[ElementList[
el*nds+ipn]].Is(BOUNDARY)){
951 for(
unsigned int jpn=0; jpn<nds; ++jpn)
953 if(ipn!=jpn && rNodes[ElementList[
el*nds+jpn]].Is(BOUNDARY)){
955 neighb_size = list_of_neighbor_nodes[ElementList[
el*nds+ipn]].size();
957 for(
int npn=0; npn<neighb_size; ++npn)
959 if( list_of_neighbor_nodes[ElementList[
el*nds+ipn]][npn]==(ElementList[
el*nds+jpn]) ){
963 if(neighb_set==
false){
964 list_of_neighbor_nodes[ElementList[
el*nds+ipn]].push_back(ElementList[
el*nds+jpn]);
982 std::vector<double> SetRanks (ModelPart& rModelPart,
983 struct triangulateio &
out,
984 std::vector<std::vector<int> > & list_of_neighbor_nodes)
991 std::vector<double> nodes_ranks;
994 std::fill( nodes_ranks.begin(), nodes_ranks.end(), 0 );
998 for(
int in = 0; in<
out.numberofpoints; ++in)
1000 bool contact_active =
false;
1002 if( rModelPart.Nodes()[in+1].SolutionStepsDataHas(CONTACT_FORCE) ){
1003 array_1d<double, 3 > & ContactForceNormal = rModelPart.Nodes()[in+1].FastGetSolutionStepValue(CONTACT_FORCE);
1004 if(
norm_2(ContactForceNormal) !=0 )
1005 contact_active =
true;
1008 if( contact_active && rModelPart.Nodes()[in+1].IsNot(BOUNDARY)){
1009 nodes_ranks[in+1]=5;
1019 double rang_assign = 0;
1020 double rang_top = 5;
1022 while (rang_assign<rang_top){
1024 for(
int in = 0; in<
out.numberofpoints; ++in)
1026 if(nodes_ranks[in+1]==rang_assign){
1029 unsigned int shared_node=1;
1030 unsigned int NumberOfNeighbours = list_of_neighbor_nodes[in+1].size();
1031 for(
unsigned int i = 0;
i < NumberOfNeighbours; ++
i)
1033 shared_node = list_of_neighbor_nodes[in+1][
i];
1035 if(nodes_ranks[shared_node]>rang_assign)
1036 nodes_ranks[shared_node]=rang_assign+1;
1054 std::vector<double> SetFirstLayer (ModelPart& rModelPart,
1055 struct triangulateio &
out,
1056 std::vector<std::vector<int> > & list_of_neighbor_nodes)
1062 std::vector<double> nodes_layer;
1065 std::fill( nodes_layer.begin(), nodes_layer.end(), 0 );
1069 for(
int in = 0; in<
out.numberofpoints; ++in)
1071 if(rModelPart.Nodes()[in+1].IsNot(BOUNDARY)){
1072 nodes_layer[in+1]=2;
1079 double layer_assign = 0;
1080 double layer_top = 1;
1082 while (layer_assign<layer_top){
1084 for(
int in = 0; in<
out.numberofpoints; ++in)
1086 if(nodes_layer[in+1]==layer_assign){
1089 unsigned int shared_node=1;
1090 unsigned int NumberOfNeighbours = list_of_neighbor_nodes[in+1].size();
1091 for(
unsigned int i = 0;
i < NumberOfNeighbours; ++
i)
1093 shared_node = list_of_neighbor_nodes[in+1][
i];
1095 if(nodes_layer[shared_node]>layer_assign)
1096 nodes_layer[shared_node]=layer_assign+1;
1120 void SetInsideProjection (ModelPart& rModelPart,
1121 struct triangulateio &
out,
1122 std::vector<std::vector<int> > & list_of_neighbor_nodes)
1127 std::vector<double> nodes_ranks = SetRanks(rModelPart,
out,list_of_neighbor_nodes);
1129 std::vector<double> nodes_layer = SetFirstLayer(rModelPart,
out,list_of_neighbor_nodes);
1131 double movement_factor = 1.2;
1132 double contact_factor = 2.0;
1133 const array_1d<double,3> ZeroPoint(3,0.0);
1137 std::fill( initial_nodes_distances.begin(), initial_nodes_distances.end(), ZeroPoint );
1139 for(
int in = 0; in<
out.numberofpoints; ++in)
1143 if(nodes_ranks[in+1]<1)
1145 array_1d<double, 3 > DeltaDisplacement = rModelPart.Nodes()[in+1].FastGetSolutionStepValue(DISPLACEMENT) - rModelPart.Nodes()[in+1].FastGetSolutionStepValue(DISPLACEMENT,1);
1147 array_1d<double, 3>& Normal= rModelPart.Nodes()[in+1].FastGetSolutionStepValue(NORMAL);
1149 double projection=
inner_prod(DeltaDisplacement,Normal);
1151 bool contact_active =
false;
1152 if( rModelPart.Nodes()[in+1].SolutionStepsDataHas(CONTACT_FORCE) ){
1153 array_1d<double, 3 > & ContactForce = rModelPart.Nodes()[in+1].FastGetSolutionStepValue(CONTACT_FORCE);
1154 if(
norm_2(ContactForce)!=0)
1155 contact_active =
true;
1159 initial_nodes_distances[in+1] = (-1)*(movement_factor*contact_factor)*fabs(projection)*Normal;
1162 initial_nodes_distances[in+1] = (-1)*(movement_factor)*fabs(projection)*Normal;
1169 array_1d<double,3> P;
1170 array_1d<double,3>
Q;
1171 array_1d<double,3> D;
1175 if(nodes_layer[in+1]==1)
1178 unsigned int NumberOfNeighbours = list_of_neighbor_nodes[in+1].size();
1185 unsigned int shared_node = 1;
1186 for(
unsigned int i = 0;
i < NumberOfNeighbours; ++
i)
1188 shared_node = list_of_neighbor_nodes[in+1][
i];
1190 if(rModelPart.Nodes()[shared_node].Is(BOUNDARY)){
1193 Q[0] =
out.pointlist[(list_of_neighbor_nodes[in+1][
i]-1)*
dimension];
1194 Q[1] =
out.pointlist[(list_of_neighbor_nodes[in+1][
i]-1)*
dimension+1];
1196 array_1d<double, 3>& Normal= rModelPart.Nodes()[shared_node].FastGetSolutionStepValue(NORMAL);
1202 array_1d<double, 3>& Offset = rModelPart.Nodes()[shared_node].FastGetSolutionStepValue(OFFSET);
1203 double offset =
norm_2(Offset);
1205 double secure_offset_factor = 1.1;
1207 if(projection<offset && offset!=0)
1208 initial_nodes_distances[in+1] = (-1)*(secure_offset_factor)*(offset-projection)*Normal;
1217 double smoothing_factor=0.15;
1218 double smoothing_iters =10;
1222 while ( iters<smoothing_iters ){
1226 double TotalWeight = 0;
1228 array_1d<double,3> TotalDistance;
1229 array_1d<double,3> Distance;
1230 array_1d<double,3> OffsetDistance;
1233 for(
int in = 0; in<
out.numberofpoints; ++in)
1236 TotalDistance = initial_nodes_distances[in+1];
1237 OffsetDistance.clear();
1240 if(nodes_ranks[in+1]>0)
1243 if(nodes_layer[in+1]==1)
1244 OffsetDistance = TotalDistance;
1246 unsigned int NumberOfNeighbours = list_of_neighbor_nodes[in+1].size();
1248 unsigned int shared_node=1;
1255 for(
unsigned int i = 0;
i < NumberOfNeighbours; ++
i)
1259 shared_node = list_of_neighbor_nodes[in+1][
i];
1261 Weight = 1.0 / (nodes_ranks[shared_node]+1.0);
1262 TotalWeight += Weight ;
1263 Distance += initial_nodes_distances[shared_node] * Weight;
1268 Distance *= ( 1.0 / TotalWeight );
1270 Distance = initial_nodes_distances[in+1];
1272 TotalDistance += smoothing_factor*(Distance-initial_nodes_distances[in+1]);
1276 if( nodes_layer[in+1]==1 &&
norm_2(OffsetDistance)>
norm_2(TotalDistance)+1
e-10 ){
1277 TotalDistance = OffsetDistance;
1279 std::cout<<
" Layer Correction "<<
norm_2(OffsetDistance)<<
" > "<<
norm_2(TotalDistance)<<std::endl;
1282 initial_nodes_distances[in+1] = TotalDistance;
1293 for(
int in = 0; in<
out.numberofpoints; ++in)
1299 if(nodes_ranks[in+1]>0)
1302 out.pointlist[in*
dimension] += initial_nodes_distances[in+1][0];
1303 out.pointlist[in*
dimension+1] += initial_nodes_distances[in+1][1];
1319 inline void CalculateCenterAndSearchRadius(
const double x0,
const double y0,
1320 const double x1,
const double y1,
1321 const double x2,
const double y2,
1322 double&
xc,
double&
yc,
double&
R)
1325 xc = 0.3333333333333333333*(x0+
x1+
x2);
1326 yc = 0.3333333333333333333*(y0+y1+y2);
1328 double R1 = (
xc-x0)*(
xc-x0) + (
yc-y0)*(
yc-y0);
1344 inline void Clear(ModelPart::NodesContainerType::iterator node_it,
int step_data_size )
1346 unsigned int buffer_size = node_it->GetBufferSize();
1351 double* step_data = (node_it)->SolutionStepData().Data(
step);
1354 for(
int j= 0;
j< step_data_size; ++
j)
1366 inline void ClearVariables(ModelPart::NodesContainerType::iterator node_it , Variable<array_1d<double,3> >& rVariable)
1368 array_1d<double, 3>& Aux_var = node_it->FastGetSolutionStepValue(rVariable, 0);
1378 inline void ClearVariables(ModelPart::NodesContainerType::iterator node_it, Variable<double>& rVariable)
1380 double& Aux_var = node_it->FastGetSolutionStepValue(rVariable, 0);
1411 rOStream << std::endl;
Short class definition.
Definition: bucket.h:57
PointerVector< TPointType > PointsArrayType
Definition: geometry.h:118
Short class definition.
Definition: laplacian_smoothing.hpp:71
virtual void SetEchoLevel(int Level)
Definition: laplacian_smoothing.hpp:755
virtual ~LaplacianSmoothing()
Destructor.
Definition: laplacian_smoothing.hpp:99
LaplacianSmoothing(ModelPart &rModelPart)
Default constructor.
Definition: laplacian_smoothing.hpp:91
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: laplacian_smoothing.hpp:786
virtual std::string Info() const
Turn back information as a string.
Definition: laplacian_smoothing.hpp:780
int GetEchoLevel()
Definition: laplacian_smoothing.hpp:760
ModelPart::ElementsContainerType ElementsContainerType
Definition: laplacian_smoothing.hpp:82
ModelPart::PropertiesType PropertiesType
Definition: laplacian_smoothing.hpp:80
ModelPart::NodesContainerType NodesContainerType
Definition: laplacian_smoothing.hpp:83
void ApplyMeshSmoothing(ModelPart &rModelPart, std::vector< int > &PreservedElements, const int *pElementsList, const int &NumberOfPoints)
Definition: laplacian_smoothing.hpp:115
ModelPart::MeshType MeshType
Definition: laplacian_smoothing.hpp:81
void SetBoundarySmoothing(ModelPart &rModelPart, std::vector< int > &PreservedElements, const int *pElementsList, const int &NumberOfPoints)
Definition: laplacian_smoothing.hpp:593
ModelPart::MeshType::GeometryType::PointsArrayType PointsArrayType
Definition: laplacian_smoothing.hpp:84
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: laplacian_smoothing.hpp:789
void ProjectVariablesToNewPositions(ModelPart &rModelPart)
Definition: laplacian_smoothing.hpp:308
KRATOS_CLASS_POINTER_DEFINITION(LaplacianSmoothing)
Pointer definition of data transfer.
Short class definition.
Definition: mesh_data_transfer_utilities.hpp:46
void CalculateCenterAndSearchRadius(const std::vector< std::vector< double > > &rPointCoordinates, std::vector< double > &rCenter, double &rRadius)
Definition: mesh_data_transfer_utilities.hpp:334
VariablesListDataValueContainer InterpolateVariables(Geometry< Node > &geom, const std::vector< double > &N, VariablesList &rVariablesList, Node::Pointer pnode, double alpha=1.0)
Definition: mesh_data_transfer_utilities.cpp:1374
static unsigned int GetMaxNodeId(ModelPart &rModelPart)
Definition: mesher_utilities.hpp:1408
static bool CalculatePosition(const std::vector< std::vector< double >> &rPointCoordinates, const std::vector< double > &rCenter, std::vector< double > &rShapeFunctionsN)
Definition: mesher_utilities.hpp:1272
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::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
SizeType NumberOfMeshes()
Definition: model_part.h:1776
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
VariablesList & GetNodalSolutionStepVariablesList()
Definition: model_part.h:549
This class defines the node.
Definition: node.h:65
double Y() const
Definition: point.h:187
double Z() const
Definition: point.h:193
double X() const
Definition: point.h:181
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
A generic tree data structure for spatial partitioning.
Definition: tree.h:190
Holds a list of variables and their position in VariablesListDataValueContainer.
Definition: variables_list.h:50
BOOST_UBLAS_INLINE void clear()
Definition: array_1d.h:325
BOOST_UBLAS_INLINE size_type size() const
Definition: array_1d.h:370
BOOST_UBLAS_INLINE const_iterator begin() const
Definition: array_1d.h:606
#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
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
DistanceVector::iterator DistanceIterator
Definition: internal_variables_interpolation_process.h:56
std::vector< PointTypePointer > PointVector
Definition: internal_variables_interpolation_process.h:53
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
PointVector::iterator PointIterator
Definition: internal_variables_interpolation_process.h:54
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
Point PointType
Geometric definitions.
Definition: mortar_classes.h:36
int step
Definition: face_heat.py:88
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
out
Definition: isotropic_damage_automatic_differentiation.py:200
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
R
Definition: isotropic_damage_automatic_differentiation.py:172
tuple Q
Definition: isotropic_damage_automatic_differentiation.py:235
float radius
Definition: mesh_to_mdpa_converter.py:18
int j
Definition: quadrature.py:648
el
Definition: read_stl.py:25
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31