10 #if !defined(KRATOS_NODAL_NEIGHBOURS_SEARCH_PROCESS_H_INCLUDED )
11 #define KRATOS_NODAL_NEIGHBOURS_SEARCH_PROCESS_H_INCLUDED
73 int AverageElements = 10,
74 int AverageNodes = 10)
75 : mrModelPart(rModelPart)
77 mAverageElements = AverageNodes;
78 mAverageNodes = AverageElements;
111 success=KratosSearch();
115 success=LohnerSearch();
121 std::cout<<
" ERROR: Nodal Neighbours Search FAILED !!! "<<std::endl;
137 for(
auto& i_node : mrModelPart.
Nodes())
139 i_node.GetValue(NEIGHBOUR_ELEMENTS).clear();
140 i_node.GetValue(NEIGHBOUR_NODES).clear();
159 std::string
Info()
const override
161 return "NodalNeighboursSearchProcess";
167 rOStream <<
"NodalNeighboursSearchProcess";
227 int mAverageElements;
234 template<
class TDataType>
void AddUniquePointer
239 while (
i != endit && (
i)->Id() != (candidate)->Id())
245 v.push_back(candidate);
250 void CleanNodeNeighbours()
253 for(
auto& i_node : mrModelPart.Nodes())
257 nNodes.reserve(mAverageNodes);
261 nElements.reserve(mAverageElements);
264 for(
const auto& i_dof : i_node.GetDofs())
268 i_node.Set(STRUCTURE);
278 void PrintNodeNeighbours()
281 std::cout<<
" NODES: neighbour elems: "<<std::endl;
282 for(
auto& i_node : mrModelPart.Nodes())
284 std::cout<<
"["<<i_node.Id()<<
"]:"<<std::endl;
287 for(
auto& i_nelem : nElements)
289 std::cout<< i_nelem.Id()<<
", ";
291 std::cout<<
" )"<<std::endl;
294 std::cout<<std::endl;
296 std::cout<<
" NODES: neighbour nodes: "<<std::endl;
298 for(
auto& i_node : rNodes)
300 std::cout<<
"["<<i_node.Id()<<
"]:"<<std::endl;
303 for(
auto& i_nnode : nNodes)
305 std::cout<< i_nnode.Id()<<
", ";
307 std::cout<<
" )"<<std::endl;
310 std::cout<<std::endl;
323 CleanNodeNeighbours();
328 for(
auto i_elem(rElements.begin()); i_elem != rElements.end(); ++i_elem)
331 for(
unsigned int i = 0;
i < rGeometry.size(); ++
i)
333 rGeometry[
i].GetValue(NEIGHBOUR_ELEMENTS).push_back(*i_elem.base());
338 for(
auto& i_node : rNodes)
341 for(
auto& i_nelem : nElements)
344 for(
unsigned int i = 0;
i < rGeometry.size(); ++
i)
346 if( rGeometry[
i].Id() != i_node.Id() )
349 AddUniquePointer<Node >(nNodes, rGeometry(
i));
365 CleanNodeNeighbours();
368 unsigned int Ne=rElements.size();
369 unsigned int Np=rNodes.size();
371 if(Ne==1)
return false;
374 std::vector<unsigned int> PSharedE (Np+1);
377 std::vector<unsigned int> PSharedN (Np+1);
380 std::vector<std::vector<unsigned int> > PSurroundN (Np+1);
388 for(
auto& i_elem : rElements)
391 for(
unsigned int i = 0;
i < rGeometry.size(); ++
i)
393 ipoi1=rGeometry[
i].Id();
399 unsigned int Nn= rGeometry.size();
403 for(
auto& i_node : rNodes)
406 int size= PSharedE[
pn]*(Nn-1)+Nn;
407 if(mAverageNodes>size)
410 i_node.GetValue(NEIGHBOUR_ELEMENTS).resize(PSharedE[
pn]);
411 PSurroundN[
pn].resize(size);
415 for(
auto i_elem(rElements.begin()); i_elem != rElements.end(); ++i_elem)
418 for(
unsigned int i = 0;
i < rGeometry.size(); ++
i)
420 ipoi1=rGeometry[
i].Id();
424 nElements(PSharedE[ipoi1])= *i_elem.base();
429 unsigned int nodeID=0;
435 for(
auto& i_node : rNodes)
441 for(
auto& i_nelem : nElements)
446 for (
unsigned int nd=0; nd<rGeometry.size(); ++nd)
448 ipn = rGeometry[nd].Id();
454 if (PSharedN[rpn]!=0)
456 for(
unsigned int spn=0; spn<=PSharedN[rpn]; ++spn)
458 if (PSurroundN[rpn][spn]!=ipn)
472 PSurroundN[rpn][PSharedN[rpn] ]=ipn;
482 for(
unsigned int spn=0; spn<PSharedN[rpn]; ++spn)
485 AddUniquePointer<Node >(nNodes, rNodes(PSurroundN[rpn][spn]));
527 rOStream << std::endl;
Geometry< NodeType > GeometryType
definition of the geometry type with given NodeType
Definition: element.h:83
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
void clear()
Definition: global_pointers_vector.h:361
The base class for processes passed to the solution scheme.
Definition: mesher_process.hpp:37
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Short class definition.
Definition: nodal_neighbours_search_process.hpp:50
ModelPart::ElementsContainerType ElementsContainerType
Definition: nodal_neighbours_search_process.hpp:58
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: nodal_neighbours_search_process.hpp:165
void ClearNeighbours()
Definition: nodal_neighbours_search_process.hpp:135
GlobalPointersVector< Element > ElementWeakPtrVectorType
Definition: nodal_neighbours_search_process.hpp:61
NodalNeighboursSearchProcess(ModelPart &rModelPart, int EchoLevel=0, int AverageElements=10, int AverageNodes=10)
Definition: nodal_neighbours_search_process.hpp:71
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: nodal_neighbours_search_process.hpp:171
KRATOS_CLASS_POINTER_DEFINITION(NodalNeighboursSearchProcess)
virtual ~NodalNeighboursSearchProcess()
Destructor.
Definition: nodal_neighbours_search_process.hpp:83
ModelPart::NodesContainerType NodesContainerType
Definition: nodal_neighbours_search_process.hpp:57
GlobalPointersVector< Node > NodeWeakPtrVectorType
Definition: nodal_neighbours_search_process.hpp:60
void operator()()
Definition: nodal_neighbours_search_process.hpp:91
GlobalPointersVector< Condition > ConditionWeakPtrVectorType
Definition: nodal_neighbours_search_process.hpp:62
std::string Info() const override
Turn back information as a string.
Definition: nodal_neighbours_search_process.hpp:159
void Execute() override
Execute method is used to execute the MesherProcess algorithms.
Definition: nodal_neighbours_search_process.hpp:101
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
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
v
Definition: generate_convection_diffusion_explicit_element.py:114
pn
Definition: generate_droplet_dynamics.py:65
integer i
Definition: TensorModule.f:17