34#ifdef OOMPH_TRANSITION_TO_VERSION_3
54 const double& max_error,
55 const double& min_error,
152 for (
unsigned e = 0;
e <
nelem;
e++)
158 for (
unsigned j = 0;
j < ndof;
j++)
184 for (std::set<unsigned>::iterator
it1 =
elements.begin();
188 for (std::set<unsigned>::iterator
it2 =
elements.begin();
192 if ((*
it1) != (*it2))
212 for (
unsigned e = 0;
e <
nelem;
e++)
218 typedef std::set<unsigned>::iterator
IT;
240 <<
"CPU time for setup of METIS data structures [nelem="
241 <<
nelem <<
"]: " <<
cpu0 <<
" sec" << std::endl;
253 <<
"Note: All elements in the Problem's Mesh appear to be\n"
254 <<
"unconnected. This happens, e.g. if all elements only have\n"
255 <<
"internal Data. Bypassing metis and distributing elements\n"
256 <<
"in round-robin fashion amongst the " <<
n_proc <<
" processors."
258 for (
unsigned e = 0;
e <
nelem;
e++)
292 int* options =
new int[10];
295#ifdef OOMPH_TRANSITION_TO_VERSION_3
337 <<
"Biasing element distribution via spatial error estimate\n";
345 mmesh_pt->spatial_error_estimator_pt()->get_element_errors(
355 for (
unsigned e = 0;
e <
nelem;
e++)
395 <<
"Biasing element distribution via spatial error estimate\n";
412 mmesh_pt->spatial_error_estimator_pt()->get_element_errors(
424 for (
unsigned e = start;
e <
end;
e++)
439 for (
unsigned e = start;
e <
end;
e++)
449#ifdef OOMPH_TRANSITION_TO_VERSION_3
514 for (
unsigned e = 0;
e <
nelem;
e++)
533 <<
"when trying to partition " <<
nelem <<
"elements over "
534 <<
nparts <<
" processors!\n";
551 <<
"CPU time for METIS mesh partitioning [nelem="
552 <<
nelem <<
"]: " <<
cpu1 <<
" sec" << std::endl;
602 unsigned n_proc = comm_pt->nproc();
603 unsigned my_rank = comm_pt->my_rank();
616 unsigned n = elemental_assembly_time.
size();
620 error_stream <<
"Number of elements doesn't match the \n"
621 <<
"number of elemental assembly times: " <<
n_elem <<
" "
630 if (elemental_assembly_time.
size() != 0)
640 std::map<unsigned, std::set<GeneralisedElement*>>
727 for (
unsigned i = 0;
i <
n_dof;
i++)
774 comm_pt->mpi_comm());
813 comm_pt->mpi_comm());
866 comm_pt->mpi_comm());
899 comm_pt->mpi_comm());
932 comm_pt->mpi_comm());
952 comm_pt->mpi_comm());
959 <<
"CPU time for global setup of METIS data structures [nroot_elem="
982 std::map<unsigned, std::set<unsigned>>
1013 for (std::set<unsigned>::iterator
it =
1032 if ((*
it1) != (*it2))
1045 oomph_info <<
"CPU time for setup of connected elements (load balance) "
1068 typedef std::set<unsigned>::iterator
IT;
1089 oomph_info <<
"CPU time for setup of METIS data structures (load "
1090 "balance) [nroot_elem="
1121 int* options =
new int[10];
1124#ifdef OOMPH_TRANSITION_TO_VERSION_3
1166 oomph_info <<
"Basing distribution on assembly times of elements\n";
1176 error_stream <<
"Minimum assemble time for element is zero!\n";
1206 oomph_info <<
"Basing distribution on number of elements\n";
1227 <<
"Bypassing METIS for validation purposes.\n"
1228 <<
"Appending input for metis in metis_input_for_validation.dat\n";
1230 outfile.open(
"metis_input_for_validation.dat", std::ios_base::app);
1238 for (
unsigned i = 0;
i <
n;
i++)
1251#ifdef OOMPH_TRANSITION_TO_VERSION_3
1313 oomph_info <<
"Total weight on proc " <<
j <<
" is "
1319 oomph_info <<
"CPU time for METIS mesh partitioning [nroot_elem="
1353 comm_pt->mpi_comm());
1409 oomph_info <<
"CPU time for communication of partition to all processors "
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
A Generalised Element class.
bool is_halo() const
Is this element a halo?
unsigned ndof() const
Return the number of equations/dofs in the element.
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nelement() const
Return number of elements in the mesh.
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
OomphCommunicator * communicator_pt()
access function to the oomph-lib communicator
Vector< double > elemental_assembly_time()
Return vector of most-recent elemental assembly times (used for load balancing). Zero sized if no Jac...
unsigned nsub_mesh() const
Return number of submeshes.
Mesh *& mesh_pt()
Return a pointer to the global mesh.
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
Base class for refineable meshes. Provides standardised interfaces for the following standard mesh ad...
//////////////////////////////////////////////////////////////////////
void uniform_partition_mesh(Problem *problem_pt, const unsigned &ndomain, Vector< unsigned > &element_domain)
Partition mesh uniformly by dividing elements equally over the partitions, in the order in which they...
void partition_distributed_mesh(Problem *problem_pt, const unsigned &objective, Vector< unsigned > &element_domain_on_this_proc, const bool &bypass_metis=false)
Use METIS to assign each element in an already-distributed mesh to a domain. On return,...
void partition_mesh(Problem *problem_pt, const unsigned &ndomain, const unsigned &objective, Vector< unsigned > &element_domain)
Use METIS to assign each element to a domain. On return, element_domain[ielem] contains the number of...
void(* ErrorToWeightFctPt)(const double &spatial_error, const double &max_error, const double &min_error, int &weight)
Typedef for function pointer to to function that translates spatial error into weight for METIS parti...
ErrorToWeightFctPt Error_to_weight_fct_pt
Function pointer to to function that translates spatial error into weight for METIS partitioning.
void default_error_to_weight_fct(const double &spatial_error, const double &max_error, const double &min_error, int &weight)
Default function that translates spatial error into weight for METIS partitioning (unit weight regard...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void METIS_PartGraphKway(int *, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *)
Metis graph partitioning function.
void METIS_PartGraphVKway(int *, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *)
Metis graph partitioning function – decomposes nodal graph based on minimum communication volume.
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...