SCOREC core
Parallel unstructured mesh tools
parma.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011-2013 Scientific Computation Research Center
3  *
4  * This work is open source software, licensed under the terms of the
5  * BSD license as described in the LICENSE file in the top-level directory.
6  */
7 
8 #ifndef PARMA_H
9 #define PARMA_H
10 
14 #include "apf.h"
15 #include "apfPartition.h"
16 #include <memory>
17 
29 void Parma_GetEntImbalance(apf::Mesh* mesh, double (*entImb)[4]);
30 
43 void Parma_GetWeightedEntImbalance(apf::Mesh* mesh, apf::MeshTag* weight,
44  double (*entImb)[4]);
45 
53 double Parma_GetWeightedEntImbalance(apf::Mesh* mesh, apf::MeshTag* weight,
54  int dim);
55 
66 void Parma_GetNeighborStats(apf::Mesh* m, int& max, int& maxNumParts,
67  double& avg, int& loc);
68 
75 void Parma_WriteSmallNeighbors(apf::Mesh* m, int small, const char* prefix);
76 
84 
94 void Parma_GetOwnedBdryVtxStats(apf::Mesh* m, int& loc, long& tot, int& min,
95  int& max, double& avg);
96 
106 void Parma_GetSharedBdryVtxStats(apf::Mesh* m, int& loc, long& tot, int& min,
107  int& max, double& avg);
108 
118 void Parma_GetMdlBdryVtxStats(apf::Mesh* m, int& loc, long& tot, int& min,
119  int& max, double& avg);
120 
129 void Parma_GetDisconnectedStats(apf::Mesh* m, int& max, double& avg, int& loc);
130 
140 void Parma_PrintPtnStats(apf::Mesh* m, std::string key, bool fine=false);
141 
152 void Parma_PrintWeightedPtnStats(apf::Mesh* m, apf::MeshTag* w, std::string key, bool fine=false);
153 
159 
169  int verbose=0);
170 
178 apf::Balancer* Parma_MakeShapeOptimizer(apf::Mesh* m, double stepFactor = 0.1,
179  int verbose=0);
180 
193 apf::Balancer* Parma_MakeMPASDiffuser(apf::Mesh* m, int layers, int bridge,
194  double stepFactor = 0.1, int verbosity=0);
195 
206  double stepFactor = 0.1, int verbosity=0);
207 
222  double stepFactor = 0.1, int verbosity=0);
223 
226 apf::Balancer* Parma_MakeGhostDiffuser(apf::Mesh* m, int layers, int bridge,
227  double stepFactor = 0.1, int verbosity=0);
228 
234 void Parma_WriteVtxPtn(apf::Mesh* m, const char* prefix);
235 
242 apf::Balancer* Parma_MakeVtxBalancer(apf::Mesh* m, double stepFactor=0.1,
243  int verbosity=0);
244 
251 apf::Balancer* Parma_MakeElmBalancer(apf::Mesh* m, double stepFactor=0.1,
252  int verbosity=0);
253 
261  double stepFactor=0.1, int verbosity=0);
262 
270  double stepFactor=0.1, int verbosity=0);
271 
279 
285 apf::MeshTag* Parma_WeighByMemory(apf::Mesh* m);
286 
291 {
292  std::unique_ptr<pcu::PCU> PCUObj;
304  virtual void run(int group) = 0;
305 };
306 
319 void Parma_ShrinkPartition(apf::Mesh2* m, int factor, Parma_GroupCode& toRun, pcu::PCU *PCUObj = nullptr);
320 
332 void Parma_SplitPartition(apf::Mesh2* m, int factor, Parma_GroupCode& toRun, pcu::PCU *PCUObj = nullptr);
333 
343 
351 apf::MeshTag* Parma_BfsReorder(apf::Mesh* m, int verbosity=0);
352 
353 #endif
tools for changing mesh partitioning
The APF Field interface.
Load balance over all mesh parts.
Definition: apfPartition.h:47
Extended mesh interface for modification.
Definition: apfMesh2.h:30
Interface to a mesh part.
Definition: apfMesh.h:105
Splits a mesh part into many.
Definition: apfPartition.h:22
The Parallel Contrul Unit class encapsulates parallel communication.
Definition: PCU.h:26
void Parma_GetWeightedEntImbalance(apf::Mesh *mesh, apf::MeshTag *weight, double(*entImb)[4])
see Parma_GetEntImbalance(...)
void Parma_WriteVtxPtn(apf::Mesh *m, const char *prefix)
write the vertex based partition to file
apf::Balancer * Parma_MakeMPASDiffuser(apf::Mesh *m, int layers, int bridge, double stepFactor=0.1, int verbosity=0)
create an APF Balancer for MPAS
apf::Balancer * Parma_MakeElmBalancer(apf::Mesh *m, double stepFactor=0.1, int verbosity=0)
create an APF Balancer targeting element imbalance
apf::MeshTag * Parma_BfsReorder(apf::Mesh *m, int verbosity=0)
reorder the mesh via a breadth first search
void Parma_PrintPtnStats(apf::Mesh *m, std::string key, bool fine=false)
prints partition stats
apf::Balancer * Parma_MakeVtxElmBalancer(apf::Mesh *m, double stepFactor=0.1, int verbosity=0)
create an APF Balancer targeting vertex, and elm imbalance
void Parma_GetDisconnectedStats(apf::Mesh *m, int &max, double &avg, int &loc)
get the maximum, average and local number of face-disconnected components
apf::Balancer * Parma_MakeGhostDiffuser(apf::Mesh *m, int layers, double stepFactor=0.1, int verbosity=0)
create an APF Balancer using ghost element aware diffusion for a vertex-based partition
int Parma_MisNumbering(apf::Mesh *m, int d)
Compute maximal independent set numbering.
void Parma_GetEntImbalance(apf::Mesh *mesh, double(*entImb)[4])
get entity imbalance
apf::Balancer * Parma_MakeVtxEdgeElmBalancer(apf::Mesh *m, double stepFactor=0.1, int verbosity=0)
create an APF Balancer targeting vertex, edge, and elm imbalance
apf::Balancer * Parma_MakeCentroidDiffuser(apf::Mesh *m, double stepFactor=0.1, int verbose=0)
create an APF Balancer using centroid diffusion
void Parma_GetNeighborStats(apf::Mesh *m, int &max, int &maxNumParts, double &avg, int &loc)
get the maximum and average number of vtx-connected neighboring parts
void Parma_WriteSmallNeighbors(apf::Mesh *m, int small, const char *prefix)
write the number of parts with neighbors formed by a small number of shared vtx
void Parma_GetMdlBdryVtxStats(apf::Mesh *m, int &loc, long &tot, int &min, int &max, double &avg)
get the number of vertices classified on the model boundary
apf::Splitter * Parma_MakeRibSplitter(apf::Mesh *m, bool sync=true)
create an APF Splitter using recursive inertial bisection
void Parma_SplitPartition(apf::Mesh2 *m, int factor, Parma_GroupCode &toRun, pcu::PCU *PCUObj=nullptr)
Split the processes into groups of (factor).
void Parma_ProcessDisconnectedParts(apf::Mesh *m)
re-connect disconnected parts
apf::Balancer * Parma_MakeShapeOptimizer(apf::Mesh *m, double stepFactor=0.1, int verbose=0)
create an APF Balancer to optimize part shape
apf::MeshTag * Parma_WeighByMemory(apf::Mesh *m)
create a mesh tag that weighs elements by their memory consumption
int Parma_GetSmallestSideMaxNeighborParts(apf::Mesh *m)
get the smallest number of shared vertices forming a neighbor ,a 'side', in a part with the maximum n...
void Parma_GetOwnedBdryVtxStats(apf::Mesh *m, int &loc, long &tot, int &min, int &max, double &avg)
get the number of owned vertices on inter-part boundaries
void Parma_ShrinkPartition(apf::Mesh2 *m, int factor, Parma_GroupCode &toRun, pcu::PCU *PCUObj=nullptr)
Shrink the mesh into N/factor processes.
apf::Balancer * Parma_MakeVtxBalancer(apf::Mesh *m, double stepFactor=0.1, int verbosity=0)
create an APF Balancer targeting vertex imbalance
apf::Balancer * Parma_MakeGhostEdgeDiffuser(apf::Mesh *m, double stepFactor=0.1, int verbosity=0)
create an edge balancer that is ghost aware
void Parma_GetSharedBdryVtxStats(apf::Mesh *m, int &loc, long &tot, int &min, int &max, double &avg)
get the number of shared vertices on inter-part boundaries
void Parma_PrintWeightedPtnStats(apf::Mesh *m, apf::MeshTag *w, std::string key, bool fine=false)
prints partition stats using entity weights
User-defined code to run on process sub-groups.
Definition: parma.h:291
virtual void run(int group)=0
Called withing sub-groups.