124 morton_partitioning_process.
Execute();
134 CalculateDomainsGraph(domains_graph, number_of_elements, elements_connectivities, nodes_partitions, elements_partitions);
148 DividingNodes(nodes_all_partitions, elements_connectivities, conditions_connectivities, nodes_partitions, elements_partitions, conditions_partitions);
163 io_nodes_partitions, io_elements_partitions, io_conditions_partitions,
164 nodes_all_partitions, elements_all_partitions, conditions_all_partitions);
173 for(
SizeType i_element = 0 ; i_element < NumberOfElements ; i_element++)
175 for(std::vector<std::size_t>::iterator i_node = ElementsConnectivities[i_element].begin() ;
176 i_node != ElementsConnectivities[i_element].end() ; i_node++)
178 SizeType node_rank = NPart[*i_node-1];
179 SizeType element_rank = EPart[i_element];
180 if(node_rank != element_rank)
183 rDomainsGraph(node_rank, element_rank) = 1;
184 rDomainsGraph(element_rank, node_rank) = 1;
206 std::string
Info()
const override
208 return "MortonDivideInputToPartitionsProcess";
214 rOStream <<
"MortonDivideInputToPartitionsProcess";
237 mLocalIds.resize(NumberOfNeighbours);
238 mGhostsIds.resize(NumberOfNeighbours);
239 mInterfacesIds.resize(NumberOfNeighbours);
259 return mInterfacesIds;
262 std::vector<std::size_t> mAllIds;
263 std::vector<std::vector<std::size_t> > mLocalIds;
264 std::vector<std::vector<std::size_t> > mGhostsIds;
265 std::vector<std::vector<std::size_t> > mInterfacesIds;
300 SizeType number_of_conditions = ConditionsConnectivities.size();
302 ConditionsPartitions.resize(number_of_conditions);
305 for(
SizeType i_condition = 0 ; i_condition < number_of_conditions ; i_condition++)
307 if(ConditionsConnectivities[i_condition].size() > 0)
309 double average_index = 0.00;
310 for(IO::ConnectivitiesContainerType::value_type::iterator i_node = ConditionsConnectivities[i_condition].begin() ;
311 i_node != ConditionsConnectivities[i_condition].end() ; i_node++)
314 const int my_gid = *i_node-1;
316 average_index += NodesPartitions[my_gid];
319 average_index /= ConditionsConnectivities[i_condition].size();
323 for(IO::ConnectivitiesContainerType::value_type::iterator i_node = ConditionsConnectivities[i_condition].begin() ;
324 i_node != ConditionsConnectivities[i_condition].end() ; i_node++)
327 const int my_gid = *i_node-1;
330 const int node_partition = NodesPartitions[my_gid];
332 if(difference > fabs(average_index - node_partition))
334 difference = fabs(average_index - node_partition);
335 ConditionsPartitions[i_condition] = node_partition;
350 SizeType number_of_nodes = NodesPartitions.size();
351 SizeType number_of_elements = ElementsPartitions.size();
352 SizeType number_of_conditions = ConditionsPartitions.size();
354 rNodesAllPartitions.resize(number_of_nodes);
356 for(
SizeType i_element = 0 ; i_element < number_of_elements ; i_element++)
358 const int element_partition = ElementsPartitions[i_element];
361 for(IO::ConnectivitiesContainerType::value_type::iterator i_node = ElementsConnectivities[i_element].begin() ;
362 i_node != ElementsConnectivities[i_element].end() ; i_node++)
365 const int my_gid = *i_node-1;
368 const int node_partition = NodesPartitions[my_gid];
371 if(element_partition != node_partition)
373 std::cout <<
"Partiton element differnet form partition node" << std::endl;
374 rNodesAllPartitions[my_gid].push_back(element_partition);
379 for(
SizeType i_condition = 0 ; i_condition < number_of_conditions ; i_condition++)
381 const int condition_partition = ConditionsPartitions[i_condition];
384 for(IO::ConnectivitiesContainerType::value_type::iterator i_node = ConditionsConnectivities[i_condition].begin() ;
385 i_node != ConditionsConnectivities[i_condition].end() ; i_node++)
388 const int my_gid = *i_node-1;
391 const int node_partition = NodesPartitions[my_gid];
394 if(condition_partition != node_partition)
395 rNodesAllPartitions[my_gid].push_back(condition_partition);
400 for(
SizeType i_node = 0 ; i_node < number_of_nodes ; i_node++)
402 IO::PartitionIndicesContainerType::value_type& node_partitions = rNodesAllPartitions[i_node];
403 node_partitions.push_back(NodesPartitions[i_node]);
405 std::sort(node_partitions.begin(), node_partitions.end());
406 IO::PartitionIndicesContainerType::value_type::iterator new_end=std::unique(node_partitions.begin(), node_partitions.end());
407 node_partitions.resize(new_end - node_partitions.begin());
413 SizeType number_of_elements = ElementsPartitions.size();
415 rElementsAllPartitions.resize(number_of_elements);
418 for(
SizeType i_element = 0 ; i_element < number_of_elements ; i_element++)
420 rElementsAllPartitions[i_element].push_back(ElementsPartitions[i_element]);
426 SizeType number_of_conditions = ConditionsPartitions.size();
428 rConditionsAllPartitions.resize(number_of_conditions);
431 for(
SizeType i_condition = 0 ; i_condition < number_of_conditions ; i_condition++)
433 rConditionsAllPartitions[i_condition].push_back(ConditionsPartitions[i_condition]);
519 rOStream << std::endl;
Getting a graph of connectivities (of domains) and performs a coloring procedure.
Definition: graph_coloring_process.h:43
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: graph_coloring_process.h:99
IO provides different implementation of input output procedures which can be used to read and write w...
Definition: io.h:58
virtual void DivideInputToPartitions(SizeType NumberOfPartitions, const PartitioningInfo &rPartitioningInfo)
This method divides a model part into partitions.
Definition: io.h:490
virtual std::size_t ReadConditionsConnectivities(ConnectivitiesContainerType &rConditionsConnectivities)
This method reads the conditions connectivities.
Definition: io.h:338
virtual bool ReadNodes(NodesContainerType &rThisNodes)
This method reads the nodes from an array of nodes.
Definition: io.h:150
std::vector< std::vector< std::size_t > > ConnectivitiesContainerType
Definition: io.h:91
std::vector< std::size_t > PartitionIndicesType
Definition: io.h:95
std::vector< std::vector< std::size_t > > PartitionIndicesContainerType
Definition: io.h:93
virtual std::size_t ReadElementsConnectivities(ConnectivitiesContainerType &rElementsConnectivities)
This method reads the elements connectivities.
Definition: io.h:289
Definition: amatrix_interface.h:41
Definition: morton_divide_input_to_partitions_process.h:233
std::vector< std::vector< std::size_t > > & LocalIds()
Definition: morton_divide_input_to_partitions_process.h:247
std::vector< std::vector< std::size_t > > & InterfacesIds()
Definition: morton_divide_input_to_partitions_process.h:257
std::vector< std::size_t > & AllIds()
Definition: morton_divide_input_to_partitions_process.h:242
std::vector< std::vector< std::size_t > > & GhostsIds()
Definition: morton_divide_input_to_partitions_process.h:252
DomainEntitiesIdContainer(std::size_t NumberOfNeighbours)
Definition: morton_divide_input_to_partitions_process.h:235
Short class definition.
Definition: morton_partitioning_process.h:88
std::vector< idxtype > PartitionIndicesType
Definition: morton_partitioning_process.h:100
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: morton_partitioning_process.h:152
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
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
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
scalar_matrix< double > ScalarMatrix
Definition: amatrix_interface.h:728
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432